-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Zoom out: fix scaling issues #65998
Merged
+14
−5
Merged
Zoom out: fix scaling issues #65998
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6dcea75
changed from using borders to use pseudo elements
MaggieCabrera 53fe5ab
added comments
MaggieCabrera 22587a1
Include frame size in the scaling calculation
jeryj 7dfed11
Account for scaling in the frame height
jeryj abe17a2
Calculation in CSS
ajlende c70f39a
Revert "Calculation in CSS"
jeryj a444cdb
Add comment about why the calculation for scaling needs to happen in …
jeryj 7af85bd
Force px value for frameSize
jeryj 4146bd3
Restore previous frameSize var setting
jeryj 28e4dd0
Add back line break
jeryj 03ed997
Use padding top/bottom instead of before/after for top/bottom frame
jeryj 47b31ed
Remove more before/after css since we are using padding
jeryj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This treats any
frameSize
value as a pixel. That’s probably not a big problem or could even be argued that it creates some compensation for a non-pixel value even if it won’t be accurate. The approach in #65814 was different by avoiding factoring in a non-pixelframeSize
but I think @ajlende mistook it for leaving out theframeSize
entirely and called it breaking change #65814 (comment). Then seemingly didn’t see my reply trying to clarify.Anyhow, my point is this is practically very similar yet at least in my PR the code acknowledges what’s inaccurate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - you figured out the main bug. That was a huge help. 🙏🏻 You were supposed to be credited in this PR because of that. This PR takes a slightly different direction by removing the border entirely and just account for the frame size scaling that you figured out.
I'm fine forcing pixels for
frameSize
, as I don't think we can accurately account for non-pixel sizes in everything we need due to css calc limitations. I thought it was going to be possible to accurately account for any value, but now I'm convinced it isn't possible 😅There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries about the credit. I do love that this ultimately does make the styles simpler. I thought I’d tried removing the border with my PR but seems like it was making it so the inline frame spacing wasn’t maintained through resizes.
Yeah, not without rendering another element to measure with
getComputedStyle
and some compromises. Trying to put the calculation in CSS was a great thought.Oh, if that comment is meant to do that it seems misplaced. It’s detached from the JS calculation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW this approach also causes the same breaking change that I commented on in your PR. I wasn't ready for this one to be merged so soon. I think still we need to document the requirement of a number representing pixels or a pixel string for the API of this component. Based on this argument that I shared on https://github.com/WordPress/gutenberg/pull/65814/files#r1795825607:
And sorry for the slow response btw, I wanted to make sure that I understood your perspective and make sure the suggestions that I was about to share were valid and made sense which ended up taking all day for me yesterday. One thing that can annoy me is half-baked responses that seem dismissive or suggestions that won't work because they haven't fully been thought out, and I didn't want to do that to you. I have finally posted it https://github.com/WordPress/gutenberg/pull/65814/files#r1795825607, but it seems that ended up being too late.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry I rushed merging this one! and also about not adding proper credit, I take full responsibility for that. I shouldn't have jumped on the merge button like that