fix(studio): rotate from the angle a CSS-rotated element shows, without GSAP too - #4780
Closed
miguel-heygen wants to merge 2 commits into
Closed
miguel-heygen wants to merge 2 commits into
miguel-heygen wants to merge 2 commits into
Conversation
miguel-heygen
force-pushed
the
fix/studio-edit-resize-size-hold
branch
from
September 30, 2026 17:21
6d7af01 to
5315bc4
Compare
miguel-heygen
force-pushed
the
fix/studio-rotate-from-css-rotation
branch
from
September 30, 2026 17:32
f1bbd05 to
f85d658
Compare
Collaborator
Author
|
Fixed on main by #4802: a rotate starts from the angle the element shows, its CSS rotation included, with or without GSAP. Every rotate case in the edit-accuracy gate, including those with a 30° CSS rotation, passes on main with no jump on drop. Closing. |
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
A rotate gesture starts from the angle the element actually shows, and in a composition without GSAP the live draft shows the absolute angle the commit writes. Before this, a layer rotated by an authored CSS
rotate: 30degand turned another 25° was saved at 25°, and snapped back by 30° after the drop.Why
The rotate base was GSAP's
rotationplus Studio's old rotation variable, with|| 0when the page had no GSAP. The authored CSSrotatewas ignored. The commit saved the absolute angle (0 + 25) asgsap.set({ rotation }), which replaces the CSS rotation once GSAP loads, while the draft had shown 30 + 25 by composing onto the authored value. The benchmark saw a 74.7 px drop on every CSS-rotated rotate cell without GSAP.Related work
Stacked on #4776 (then #4774, #4766). Same reader as #4774: that PR reads position, this one adds rotation. Measured with the edit accuracy benchmark from #4760.
How
readRotationBase(element): GSAP's rotation (plus the old variable) when the page has GSAP. Without GSAP it is the rotation GSAP's CSSPlugin will parse from the CSSrotate,scaleandtransform: the same folded matrix the fix(studio): start every drag from one position reader and draft what it commits #4774 position reader uses, now also givingatan2(b, a). There is no|| 0fallback.applyRotationDraft, used for the drag and the release: GSAP'srotation, or without GSAP a CSSrotateof the target angle less whatscaleandtransformalready turn. Atransform: rotate()or a mirrored element then drafts exactly what the commit will show.restoreRotationDraft, used for no-change, failed-commit and cancel: the CSS snapshot plus GSAP's rotation without the old variable.readGsapRotation, the old composed rotation draft (applyStudioRotationDraft), and three "GSAP, else the old CSS channel" branches in the overlay gesture handler.Score
The edit accuracy benchmark was run on a dev machine: every rotate cell at 100% zoom, with no GSAP, a GSAP tween or a GSAP hold, px/pct/centre/xPercent placements, 0°/30°, root and nested. That is 44 cells. Base is #4776. Both runs wait 3 s before each snapshot.
No cell got worse.
Before
A layer with an authored
rotate: 30degand no GSAP, rotated 25° more. After the drop it snaps back by 30°.before-rot.webm
After
Same rotation: the layer stays at the angle it was dropped at.
after-rot.webm
Test plan
transformrotate or a mirror (scale: -1 1,scaleX(-1)) already draws. Each fails without the change. The old variable's snapshot/restore test now uses the committed path.src/components/editorandsrc/hooks: all pass. tsc, oxfmt, oxlint and the comment ratchet are clean.