Skip to content

fix(studio): sealed group moves, resizes and rotations reach the preview as early as single moves - #8912

Open
miguel-heygen wants to merge 2 commits into
mainfrom
fix/sealed-group-drag-raw-steps
Open

miguel-heygen wants to merge 2 commits into
mainfrom
fix/sealed-group-drag-raw-steps

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

In a sealed preview, a group move, a resize and a rotation now reach the preview as early as a single-layer move already does, and every kind's first step does too. Before, each of those steps was drawn one display frame after the pointer.

Why

A sealed preview only draws what Studio posts to it. A single-layer move posts each step from the browser's raw pointer update, which fires before the task that paints the frame. Everything else still posted from pointermove, which runs inside that task, so the preview drew the step a frame late:

  • a group move (shift-click two layers, drag): the layers trailed the pointer by one more step than in an unsealed preview;
  • a resize and a rotation: the same path, the same lag;
  • the first step of every kind, a single move included: raw stepping was only armed by the first pointermove, so that step went out 3.6 to 4.6 ms after the move instead of before the paint.

Related work

Follows #8899, which did this for a single-layer move.

How

  • gestureSteps.ts computes each kind's step once: rotationAt, resizeSizeAt, plus the existing snappedDragDelta and a new groupDragDelta lifted out of the group mover. pointermove, the release and the raw update all use them, so the two paths cannot disagree.
  • armSealedRawSteps, called at press in both startGesture and startGroupDrag, arms the raw update for any held gesture when the preview is sealed. The raw step draws only the preview's drafts; the overlay, readouts and guides stay on pointermove. A draft equal to the last one is not posted twice (drawsNothingNew, from fix(studio): a sealed drag sends each step to the preview as the pointer moves #8899), so the second draw from pointermove costs nothing.
  • Browsers without pointerrawupdate are unchanged.

Test plan

  • Unit tests added/updated
    • sealedRawDragStep.test.ts: a group move draws every member, a rotation draws its angle and a resize draws its size, each from the raw update; a real press through startGesture draws the first step from the raw update with no pointermove before it. Fails without the fix: all four (3 with the kinds left on pointermove, 1 with the press-time arming removed).
    • src/components/editor: 188 files, 2225 tests pass.
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments"

…iew as early as single moves

Only a single layer's move drew its steps from the raw pointer update, and only from its second
step on. A group move, a resize and a rotation still drew each step from pointermove, which runs
in the task that paints the frame, and every kind's first step went out from pointermove too.

Each kind's step is now computed once (gestureSteps.ts) and drawn from the raw update for any
held sealed gesture, armed at press.
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Test plan addition at ef60878: a fifth test drives a real press through startGroupDrag and checks that the group's first step is drawn from the raw update before any pointermove. It fails with that press-time arming removed; 3 green runs. Before/After frames follow in a later comment.

@github-actions

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 273 (base branch 271), smooth 67 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Newly passing (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Quarantined, measured but not gated (0)

Unstable (1)

  • seqab-none-pct-r0-root-z100: tracking 0.05, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.05, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.05, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true

@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Before

A sealed group drag (two layers, shift-click, drag) in Chrome with the preview sharing Studio's process, one mid-drag frame at 2x: the layers trail the pointer.

Before: sealed group drag, mid-drag frame

After

The same frame on this branch: the layers are under the pointer. The green outline is drawn by Studio a frame late on both trees, a separate fix, so read the layers against the pointer, not against the outline.

After: sealed group drag, mid-drag frame

Group board, layer steps behind the drawn pointer (most common value per drag, 3 sealed and 3 unsealed sessions per mode, interleaved):

main, sealed main, unsealed this branch, sealed this branch, unsealed
preview in Studio's process 2 / 1-2 / 2-3 0-2 / 1 / 1-2 1-2 / 1-2 / 1 0-1 / 1 / 2-3
preview in its own process 1-2 / 1 / 1-2 0-1 / 2 / 1 1 / 0-1 / 0-2 1 / 0-1 / 0-1

With this branch the sealed group sits inside the unsealed range in both modes.

This branch has not been deployed

No deployments
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