Repository navigation
Validate imperative layout changes against the group's current size - #772
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pixel-based constraints (e.g.
minSize="200px") are converted to percentages using the group size that the group'sResizeObserverlast measured. If the group was resized and an imperative method ran before that observer did (e.g. from an application's ownResizeObserver), the layout was validated against the old size's constraints. The clamped result was then saved as the requested layout, so it stayed wrong after the observer ran.The fix:
ResizeObserver's sync step into a newsyncAxisStateToCurrentSize()helper. It measures the group, recalculates the pixel-based constraints, and re-derives the layout from the requested layout. It returns the new state without saving it.onLayoutChangefires once per call.calculateItemConstraints()accepts an already-measured size, so each sync measures the panels once.Behavior changes:
setLayout()now applies the layout instead of ignoring it.Panel.resize()on a hidden group now uses the last measured size instead of dividing by zero.Note
Each imperative call now reads the panels'
offsetWidth/offsetHeightonce. This can make the browser recalculate layout if a change is pending.Fixes #770