Repository navigation
fix(core): a sealed resize keeps a layer centred by a % translate under the pointer - #8547
Merged
Merged
Conversation
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 60 of thoseThe gate passes. Quarantined, measured but not gated (0) |
terencecho
approved these changes
Nov 23, 2026
terencecho
left a comment
Contributor
There was a problem hiding this comment.
The growth probe now measures with the same pixel-resolved translate the sealed resize draft draws. It restores the original inline values and priorities after measuring, and leaves the transforms used by GSAP alone. All 28 focused tests passed with a local test-only alias for the workspace parser. Restoring the previous gesture code made the named regression fail on the expected growth coefficients.
— tai (automated review)
This was referenced Nov 23, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
In a sealed preview, resizing a layer centred by a CSS
translatepercentage (left: 50%; top: 50%; translate: -50% -50%) keeps it under the pointer again. Since #8467 the box drifted about 60 px from the pointer while it was dragged. An unsealed preview was never affected.Why
A sealed resize draws the new size in the frame and pins the layer with a translate. To work out that translate, #8467 made the frame measure, at gesture start, how far the layer's centre moves as its drawn size grows. The probe grew the box with its
translatestill written as percentages, so atranslate: -50%layer re-centred itself and measured 0, and Studio pinned it by 0.The draft doesn't draw it that way. Once it draws a translate,
drawTranslate(packages/core/src/runtime/editingDraft.ts) replaces the layer's translate with its computed value, each % as the px it was when the gesture started. From then on the layer grows from its corner and its centre moves half the growth, and nothing took that back: the box drifted half the resize away from the pointer.Layers centred by GSAP
xPercent/yPercent, the case #8467 fixed, are drawn throughtransform, which the draft leaves alone, so they keep measuring 0.Related work
Fixes the regression from #8467.
How
measureGrowResponse(packages/core/src/runtime/editingGestureStart.ts) now writes the translate the resize draft will draw (movedTranslate(computedTranslateAxes(element), 0), the same helpersdrawTranslateuses) before each probe size, and puts the layer's own translate back with its size afterwards.Test plan
fails without the fix:
packages/core/src/runtime/editingGestureStart.test.ts, "measures a %-translated box's growth as the draft draws it, its % turned into px". On main the probe reports 0 for atranslate: -50% -50%card whose box grows from its corner once the % is px.With the fix, on a Linux machine: that file and
editingDraft.test.tspass three runs in a row (28 tests).Bench
Edit-accuracy bench on a Linux machine, main at the merge of #8301 (513dcce) with and without this change, the same bench for both. Live tracking is the worst px between the box and the pointer while dragging; every drop was 0.0.
seqresize-none-center(CSStranslate: -50%), rootseqresize-none-center, nestedresize-hold-xpercent(GSAPxPercent, #8467's case), root and nestedresize-tween-xpercent, root and nestedThe commit before #8467 (2d72e52) tracks
seqresize-none-centerat 0.28 sealed, and #8467 at 60.43: a bisect with this bench at every step.The 0.2 px left between sealed and unsealed is while dragging only; both drop at 0.0.
No visible change
Sealed previews are off by default, so nothing changes for anyone yet. With them on, a resized layer centred by a CSS
translate% stays under the pointer.