Repository navigation
fix(studio): undoing a crop leaves a GSAP-animated layer where its file puts it - #4868
Closed
miguel-heygen wants to merge 7 commits into
Closed
miguel-heygen wants to merge 7 commits into
miguel-heygen wants to merge 7 commits into
Conversation
miguel-heygen
force-pushed
the
fix/studio-crop-undo-gsap-refold
branch
from
October 1, 2026 16:47
b1c84ae to
a11bb11
Compare
miguel-heygen
force-pushed
the
fix/studio-drag-after-undo
branch
from
October 1, 2026 16:48
90d53ad to
bbcd151
Compare
miguel-heygen
force-pushed
the
fix/studio-crop-undo-gsap-refold
branch
from
October 1, 2026 17:25
a11bb11 to
99f1934
Compare
Edit accuracy: 888 passing here, 843 on the base branchThe gate fails: 4 case(s) that pass on the base branch fail here; 45 newly passing case(s) are not banked in baseline.json. Regressed (4)
Newly passing (49)
Not banked (commit the artifact's baseline.json) (45)
Quarantined, measured but not gated (1)
Unstable (2)
|
miguel-heygen
force-pushed
the
fix/studio-crop-undo-gsap-refold
branch
from
October 1, 2026 18:59
efaa875 to
b6cbcff
Compare
Collaborator
Author
|
Folded into #4869, which now carries this fix (undoing a crop leaves a GSAP-animated layer where its file puts it) together with the other GSAP edit fixes. |
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.
Stacked on #4853; review only the commits after e185c11.
What
An undo or redo of a crop (or any style-only edit) on a layer GSAP animates now puts the layer back exactly where its file and script put it. Before, the layer jumped: a
gsap.sethold lost its position (10 px off on the edit-accuracy fixture), a tween counted the stylesheettranslatetwice, and a CSSrotatewas applied twice.Why
The in-place undo copies the file's attributes onto the live element. That wipes what GSAP wrote inline when it first parsed the element (
translate: none; rotate: none; scale: noneand, for an off-timelinegsap.set, the transform itself), while GSAP's cache (el._gsap) keeps the values it parsed. When the script did not change (a crop changes onlystyle), the restore only seeked, so GSAP never parsed the element again and the stylesheet transform came back under GSAP's own.Related work
Stacked on #4853 (gesture-aware attribute sync); its tests stay green. Takes the idea of #4771 (re-run the script when the sync touches an element GSAP parsed), not its branch.
How
applyUndoRestoreToPreview: when a synced element was parsed by GSAP and the document has a GSAP script, re-run the restored script in place (the soft-reload path a script change already takes), even if the script text is unchanged. A document with several GSAP scripts cannot re-run one in place, so that case reloads.applySoftReloadtakes those elements asreparseand resets GSAP's cache for exactly them. Its existing sweep only found GSAP elements that still had an inlinetransform, which the sync had just removed.Why a re-run and not only clearing GSAP's cache and seeking: an off-timeline
gsap.sethold has no tween left to render after the cache is cleared, so only re-running the script puts the hold back. Re-running is also what a fresh load does, so holds, tweens and rotation all match it.Test plan
gsapUndoRestore.browser.test.tsdrives real Chrome with the edit-accuracy fixtures (hold, tween, xPercent tween with CSSrotate: 30deg), crops the live layer, runs the undo and compares the layer's box with the box before the edit. It fails on fix(studio): an undo that lands mid-drag keeps the box under the pointer #4853's head (hold[600, 330]vs[600, 320]; tween[660, 367.5]vs[620, 337.5]; rotated box swapped) and passes with the fix.gsapUndoRestore.test.tsandgsapSoftReload.test.tspass unchanged.crop-(hold|tween)-*-rootcases that failed on main pass every gated metric (CI gate: 0 regressed, 49 newly passing, the 45 crop cases banked from that run's artifact). Theresize-hold-*-rootundo boxes are unchanged by this PR (the same numbers as main to 0.1 px); this PR does not fix them.Before
Edit-accuracy fixture
crop-hold-px-r0-root-z100in Studio at #4853's head: crop, then Cmd+Z. The layer lands 10 px (composition) below where its file puts it; redo is off by the same 10 px.After
Same case with this PR: undo and redo land exactly (box error 0).