Skip to content

fix(studio): a sealed resize of a layer whose GSAP keyframes animate its width saves - #8288

Merged
miguel-heygen merged 3 commits into
mainfrom
fix/sealed-resize-box-backfill
Nov 20, 2026
Merged

miguel-heygen merged 3 commits into
mainfrom
fix/sealed-resize-box-backfill

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

What

In a sealed preview (Studio cannot script the frame), resizing a layer whose GSAP keyframes animate its width now saves. Before, the resize was refused ("Studio can't add this edit to the animation's keyframes") and the box snapped back to its old size when released. An unsealed preview already saved it.

The sealed preview is off by default until the sealed-by-default change (#7846) lands, so nothing changes for anyone before then.

Why

A resize written into a size tween fills in the side the tween does not animate (here the height) at the tween's existing keyframes, from the box as it was before the drag. Studio reads that box from marks the resize draft leaves on the element. In a sealed preview the draft runs on the frame's element, so the selection's stand-in has no marks: the height had no value, and the keyframe edit refused itself (implicit-end-unknown).

A sealed press already measures the box in the frame (gesture-start's layout, gestureStartLayout), and the scale route of the same resize already falls back to it.

How

preGestureBoxSize is the one read of the box before the draft, for the size tween's backfill, the size route's backfill and the scale route's base size: the draft's marks first, then, for a sealed stand-in, the box its press measured. The scale route's own copy of that fallback goes.

A resize with no press (an agent's or a typed one) on a sealed layer still has no measured box unless an earlier press measured it; that is unchanged here.

Test plan

gsapResizeIntercept.test.ts, a size written at the playhead into a tween that animates only width:

  • with the draft's marks on the element (unsealed), the height is filled in at the tween's keyframes, as before;
  • with a bare stand-in and the box the press measured over a mocked port (sealed), the same.

fails without the fix:

  • with the press's measured box not used, "a size written at the playhead backfills the box's other side when the element is a sealed frame's stand-in, measured at the press" fails (blocked, not persisted).

Run on Linux: the resize intercept tests pass three runs in a row; Studio's hooks, components/editor and webmcp tests (4048) pass; Studio tsc no errors; format clean.

Bench

Edit-accuracy bench, resize drags of layers GSAP animates (fromto, keys, scale, size) at r0, root, 100% zoom (12 per run), at main and at this change:

preview accurate drop / reload / undo / teleport misses failing cases
unsealed, main 12 0 / 0 / 0 / 0 0
unsealed, this change 12 0 / 0 / 0 / 0 2 (smooth only)
sealed, main 6 6 / 6 / 3 / 6 7
sealed, this change 9 3 / 3 / 3 / 3 3

Sealed keys resizes go from never saved (60 px drop, the box back at its old size) to accurate, 3 of 3. The three left are sealed scale resizes, unchanged and fixed separately: there the scale route's last step, which moves the scaled box onto the drop point, needs the frame's element. smooth (frame pacing) is reported and not gated; every geometry check in those two unsealed cases passes.

Before

Sealed preview at main, the bench's keys layer (GSAP keyframes animate its x and width) at 1 s, after a corner drag that grew it: the resize is refused and the box is back at its old size.

before: the resize is refused and the box is back at its old size

After

The same drag at this change: the box keeps the size it was dropped at, and the size and position keys at 1 s are in the tween.

after: the box keeps its new size, with size and position keys at 1 s

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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

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

Quarantined, measured but not gated (0)

Unstable (1)

  • seqplainkeys-none-center-r0-nested-z100: tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true

@eddy-heygen eddy-heygen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Eddy's agent) Reviewed by Eddy's Claude agent at commit 7df1f70 (full diff read by me).

Verdict: approve.

Summary
In a sealed preview, resizing a layer whose keyframes animate only its width (or only its height) was dropped: the layer's size before the gesture was read off Studio's stand-in element, which carries none. The one helper that reads the pre-gesture size now falls back to the box the frame measured when the gesture started, and the three places that needed that size all use it.

What I checked

  • For a live (unsealed) element the recorded original size is still used first, so that path is unchanged.
  • The fallback is used per side and only when the recorded value is missing; a zero or absent measured side is not written, so the old defaults still apply in the intercept.
  • The duplicated fallback that existed in one of the three places is replaced by the shared helper with the same order of preference.
  • No port request is added; the measured box is the one the gesture already had.

CI: 54 pass, 20 skipped, none failing; 2 pending (the runtime tests and the producer integration tests, which do not cover the changed Studio file). The Studio tests and edit-accuracy shards passed.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 20, 2026
@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 9b7be27 Nov 20, 2026
77 checks passed
@miguel-heygen
miguel-heygen deleted the fix/sealed-resize-box-backfill branch November 20, 2026 14:15
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.

2 participants