Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix viewport selection bug #424

Merged
merged 2 commits into from
Oct 25, 2023
Merged

Fix viewport selection bug #424

merged 2 commits into from
Oct 25, 2023

Conversation

nmanu1
Copy link
Contributor

@nmanu1 nmanu1 commented Oct 25, 2023

This PR fixes a bug with viewport selection where some changes to aspect ratio didn't properly apply the correct style (i.e. applied w-full instead of h-full or vice versa). Aaron also had some confusion as to why the size of the iFrame didn't match the pixel values displayed for each viewport. So, to fix both things, I updated the viewport styling to use exact pixel values instead of the aspect ratio. Now, if a viewport is wider than the size of the preview panel, the overflow width is hidden but scrollable. But, even our largest viewports can still be viewed in full by collapsing the sidebars. If the viewport is longer than the size of the preview panel, the length of the Studio page expands to encompass it.

Also, this fixes another odd UX case where changing the active component would change the iFrame size because if one component had a lot of props, the prop editing panel on the right side would be very long and increase the length of the page. And since we were using aspect ratio and if it was fit to h-full, then the change in page height was cause the "zoom" of the iFrame to increase, which would look like an unexpected width increase in the iFrame despite being on the same viewport when switching between active components.

J=SLAP-2970
TEST=manual

Tested that the bug Aaron reported was no longer occurring locally or in Studio in Storm. Saw that exact pixel values were used for the iFrame width and height instead of aspect ratios.

@nmanu1 nmanu1 marked this pull request as ready for review October 25, 2023 15:17
Copy link
Contributor

@alextaing alextaing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@nmanu1 nmanu1 merged commit f19478a into main Oct 25, 2023
15 checks passed
@nmanu1 nmanu1 deleted the dev/viewport-fixes branch October 25, 2023 21:25
@alextaing alextaing mentioned this pull request Oct 30, 2023
alextaing added a commit that referenced this pull request Oct 30, 2023
## Features
- We have introduced Collapsible Sidebars (#408).
- We now support aliased type imports (#411).
- The TypeScript utility types Omit, Pick, and Required are now
supported for props in a component's prop interface (#413, #414, #415).
- The Studio Preview can now display CSS and SCSS styling (#418).
- Undo keyboard shortcuts (`cmd+z` for OS X, and `ctrl+z` for other
OSes) are now supported in Studio (#417).

## Changes
- `_server.tsx` and `_client.tsx` are now reserved template names for
PagesJS Repos (#423).

## Fixes
- Miscellaneous viewport bugs have been fixed (#424).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants