fix(studio): anchor the color picker popover to its trigger#83
Merged
Conversation
The popover was pinned to the panel edge and hung below its row; it now visually anchors to the clicked swatch: top aligned with the row via a -36px lift (swatch 2rem + 4px margin, derived in a comment) as a transform on the positioned element itself (ancestor transforms remain absent), and its right edge approaches the swatch's left edge via an inherited --picker-anchor-right custom property (210px for standard rows, 114px override for indented object sub-rows — both derivations commented against the layout constants). The data-state fade keyframes compose with the lift so the popover no longer fades at the unlifted position and jumps. Zero runtime measurement.
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.
User feedback on #82 (screenshot): the popover overlaid the canvas but was pinned to the panel edge and hung below its row — it should anchor to the clicked trigger: popover top-right against the swatch's top-left.
Same measurement-free doctrine, layout constants only:
-36pxlift (translateYon the positioned element itself — legal; only ancestor transforms hijack fixed) aligning the popover top with its row; derivation commented (2rem swatch + 4px margin).right: var(--picker-anchor-right)—210pxinherited from the panel root for standard rows,114pxoverride on object sub-row wrappers (both derivations commented against the layout constants: padding 14, label 76, gaps 8, indent 12).data-statefade keyframes carry their own transform which would override the lift during the animation (fade at the wrong spot, then a 36px jump) — both keyframe sets now compose withvar(--picker-lift), preserving the 4px slide around the lifted position.Known minor: a Color sub-row inside a depth-2 nested object inherits the nearest wrapper's 114px (slight misalignment in that rare case). The near-window-bottom overflow residual from #82 is unchanged and out of scope.
Verify:
cargo check -p rustmotion-studio✓ ·cargo test --workspace→ 403 passed ✓ ·cargo fmt --check✓ · clippy gated ≤1 ✓