-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add layout="x" and layout="y" axis constraints #3627
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2119,6 +2119,18 @@ function notifyLayoutUpdate(node: IProjectionNode) { | |
| axisSnapshot.min = layout[axis].min | ||
| axisSnapshot.max = axisSnapshot.min + length | ||
| }) | ||
| } else if (animationType === "x" || animationType === "y") { | ||
| const snapAxis = animationType === "x" ? "y" : "x" | ||
| const axisSnapshot = isShared | ||
| ? snapshot.measuredBox[snapAxis] | ||
| : snapshot.layoutBox[snapAxis] | ||
| axisSnapshot.min = layout[snapAxis].min | ||
| axisSnapshot.max = layout[snapAxis].max | ||
|
|
||
| if (isShared) { | ||
| snapshot.measuredBox[snapAxis].min = layout[snapAxis].min | ||
| snapshot.measuredBox[snapAxis].max = layout[snapAxis].max | ||
| } | ||
|
||
| } else if ( | ||
| shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout) | ||
| ) { | ||
|
|
||
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 test coverage for axis constraints with
layoutId(shared layout)The PR description states the feature "Works with both
layoutandlayoutId", but both new Cypress tests use a plainlayout="x"/layout="y"element withoutlayoutId. The code path for shared layout transitions (isShared = true) takes a different branch insidenotifyLayoutUpdate, and — as noted in the logic comment above — theif (isShared)block appears to contain a bug specific to that path.Consider adding a test case that uses
layout="x"(or"y") together withlayoutIdto verify that the snap axis truly snaps while the animated axis transitions correctly, and to prevent regressions in the shared-layout flow.