Repository navigation
fix(core): a film without a declared size reports its measured size to a sealed Studio - #8578
Conversation
…o a sealed Studio
Edit accuracy: accurate 271 (base branch 271), smooth 57 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
…the frame never answers
…ys why it didn't start
…oot-size # Conflicts: # packages/studio/src/components/editor/previewGestureStarts.ts
vanceingalls
left a comment
There was a problem hiding this comment.
Compared the head against #8588's merge (2cc423b): pressOutline.ts is byte-identical, and the poll still replays the press and then ends the outline's draw wait (replay(false) returns false immediately), with the new "why it didn't start" notice only when no replay starts. So #8588's behaviour is kept. The new measuredSize field is ignored by the player and useCompositionDimensions, which require finite width/height. Fix-line tests cover the runtime post, the size wait and the unanswered notice. Approving.
Non-blocking: a root that stays 0x0 (or an older runtime) makes every press and nudge wait the full 10 s before the notice; a shorter wait once the timeline is known to have posted without a size would be kinder. Conflicts with #8596 in previewOverlayRects.test.ts; second to merge rebases.
What
On a sealed preview of a film whose root declares no
data-widthanddata-height, Studio now draws the selection box and accepts drags and arrow-key nudges. Before, nothing showed: no selection or hover box, a press fell back to the drawn rect, and nudges were dropped without a word, for as long as the film was open. Unsealed, the same film works because Studio measures the root.A press or nudge that comes before the frame's size arrives on any film now waits for it, up to the press's existing wait, instead of giving up. If the frame still hasn't answered after that wait, the press or nudge says so with the notice a blocked move already uses, instead of doing nothing:
Why
Studio scales its overlay by the film's size. Unsealed,
computeOverlayRootScalereads the root's declared size or measures its box. Sealed, Studio can't reach the frame's document, so it uses the size the runtime posts (previewStageSize). The runtime postedstage-sizeonly for a declared size (postTimelineininit.ts), so a root that declared none never had one sealed.Related work
Refs #7846 (Studio's preview sealed by default).
How
init.ts): for a root that declares no size,stage-sizecarriesmeasuredSize, the root's layout box (offsetWidth/offsetHeight, so a GSAP transform on the root doesn't skew it). It's posted with every timeline post and again when aResizeObserversees the root change; teardown disconnects it. A declared root's message is unchanged.width/height: the player and Studio'suseCompositionDimensionssize the iframe fromwidth/height, and a measured root follows the iframe, so feeding it back would loop. They read onlywidth/height, so they skip ameasuredSizemessage as they are, and a new runtime beside an older player changes nothing. The protocol only grows.bridgePlayback.ts): the frame mirror behindpreviewStageSizetakesmeasuredSizewhen there's no declared size.previewGestureStartRead.ts):askShownGestureStarts, the read every sealed press and nudge goes through, waits for the frame's size (whenPreviewStageSized) for up toPRESS_WAIT_MAX_MS, now defined there and re-exported frompreviewGestureStarts.ts. An older runtime that never sends a size still gives up after that wait, but now says so.previewGestureStarts.ts,useDomEditNudge.ts): when that read comes back unanswered and there's no drawn box to start from, the press and the nudge callonBlockedMoveRef, the one blocked-move notice.unansweredMoveReasonpicks the message: the frame mirror records that the runtime posted its timeline, so a frame that answered without a size is told apart from one that never answered.No visible change
On a sealed preview of a film without a declared size, the selection box shows and moves work as they do unsealed. The interface itself doesn't change.
Test plan
fails without the fix:
packages/core/src/runtime/init.test.ts: "posts its measured layout box as measuredSize, with no width or height a host would size by", "posts the box again when the root resizes, and stops at teardown";packages/studio/src/components/editor/previewGestureStartRead.test.ts: "scales the overlay by the root's measured box, as the unsealed overlay measures the root", "waits for the frame's size before reading a press, instead of giving up", "tells a frame that answered without a size from one that never answered";packages/studio/src/components/editor/previewOverlayRects.test.ts: "says the preview didn't answer when it never does and no box was drawn";packages/studio/src/components/editor/useDomEditNudge.sealed.test.tsx: "says the preview didn't answer when a sealed nudge's read never does"."leaves measuredSize off a root that declares its size" (
init.test.ts) and "leaves the frame's size alone for a root's measured box, which follows the frame" (packages/player/src/runtime-message-handler.test.ts) pass on main too. They pin that a declared root's message and today's player don't change.src/components/editorandsrc/player(402 files, 4,880 tests) pass and typecheck clean at the latest commit.src/runtime(164 files, 3,601 tests), player (20 files, 639 tests), Studio (833 files, 9,415 tests), producer unit (1,540 tests) and engine (218 files, 3,640 tests) pass. Core, Studio and player typecheck clean.