Skip to content

fix(studio): sync child overlays during parent element drag#1277

Closed
miguel-heygen wants to merge 1 commit into
mainfrom
fix/overlay-children-follow-drag
Closed

fix(studio): sync child overlays during parent element drag#1277
miguel-heygen wants to merge 1 commit into
mainfrom
fix/overlay-children-follow-drag

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

Summary

  • Child element overlays now follow the parent when dragging a parent element on the canvas
  • Previously, dragging a parent froze all other overlays because the RAF measurement loop was fully paused during gestures

What changed

Split the RAF pause into two modes:

  • Full pause (rafPausedRef) — used for group drags where all overlay items are already manually managed by the gesture handler
  • Selection-only pause (rafSelectionOnlyPausedRef) — skips only the dragged element's rect update while letting hover rects, group rects, and other element overlays continue measuring from the iframe DOM

Single-element drag, resize, and rotate gestures now use the selection-only pause. The dragged element's overlay is still manually positioned by the gesture handler (no flickering), but the RAF loop keeps running for everything else — so children, hover targets, and other visible overlays track their real positions in real time.

Test plan

  • Select a parent element with children (e.g. #shelf containing child divs)
  • Drag the parent — child overlays should follow smoothly
  • Verify no flickering on the dragged element itself
  • Verify hover highlight still works during drag
  • Group drag (shift-select multiple elements) still works correctly

When dragging a parent element's overlay, the RAF loop was fully paused
to prevent flickering on the dragged element. This caused child element
overlays to freeze in place since they rely on the RAF loop to measure
their positions from the iframe DOM.

Split the pause into two modes: rafPausedRef (full pause, used for group
drags where all overlay items are manually managed) and
rafSelectionOnlyPausedRef (skips only the selected element's rect update
while letting hover and group rects continue measuring). Single-element
drag/resize/rotate now uses the selection-only pause, so children,
hover targets, and other overlays follow the parent's movement in
real time.
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