Skip to content

fix(studio): anchor the color picker popover to its trigger#83

Merged
LeadcodeDev merged 1 commit into
mainfrom
fix/studio-picker-anchor-align
Jul 19, 2026
Merged

fix(studio): anchor the color picker popover to its trigger#83
LeadcodeDev merged 1 commit into
mainfrom
fix/studio-picker-anchor-align

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

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:

  • Vertical: -36px lift (translateY on the positioned element itself — legal; only ancestor transforms hijack fixed) aligning the popover top with its row; derivation commented (2rem swatch + 4px margin).
  • Horizontal: right: var(--picker-anchor-right)210px inherited from the panel root for standard rows, 114px override on object sub-row wrappers (both derivations commented against the layout constants: padding 14, label 76, gaps 8, indent 12).
  • Trap caught: the data-state fade 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 with var(--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 ✓

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.
@LeadcodeDev
LeadcodeDev merged commit 5ba9975 into main Jul 19, 2026
3 checks passed
@LeadcodeDev
LeadcodeDev deleted the fix/studio-picker-anchor-align branch July 19, 2026 13:36
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.

1 participant