fix(studio): a rotate keeps a transform-centred element in place - #4826
Merged
miguel-heygen merged 1 commit intoOct 1, 2026
Merged
miguel-heygen merged 1 commit into
miguel-heygen merged 1 commit into
Conversation
miguel-heygen
force-pushed
the
fix/studio-rotate-none-drop
branch
from
October 1, 2026 01:53
75e080f to
216a2eb
Compare
miguel-heygen
force-pushed
the
fix/studio-rotate-transform-centred
branch
from
October 1, 2026 02:02
d76dde8 to
0fca73b
Compare
miguel-heygen
merged commit Oct 1, 2026
0fca73b
into
fix/studio-rotate-none-drop
10 of 14 checks passed
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
Rotating an element centred with
transform: translate(-50%, -50%)(the common centring idiom) keeps it in place, while dragging and after the save.The CSS
rotateproperty applies beforetransform, so a turn written there also turns the transform's translate: the box swung around its old centre (62 px on the bench's centred box) and, with the plain-CSS rotate save, stayed there. Now, when the element's transform translates it, the turn is written into that transform after the translate (translate(-50%, -50%) rotate(25deg)), which turns the box about its visual centre. A second rotate replaces its own trailingrotate()instead of stacking one. The CSSrotateproperty is still the target for every element whose transform does not move it. Where the turn goes is read once at press, so the draft does no per-frame style read; the save writes the same value the draft drew.The authored transform is read from the inline style, else from the last matching stylesheet rule (specificity,
!importantand@mediaare not weighed; noted in the code).Stacked on #4802.
Score (edit accuracy bench with the transform-centred rotate rows from #4801,
^rotate-none-transform-, 4 cases, same machine)Tests
manualOffsetDrag.test.ts: a transform-centred element with an authoredrotate: 30degturns inside its transform after the translate, leaves therotateproperty alone, and a second turn replaces the first.plainRotation.test.ts: the save patches the transform as drawn, and a failed save puts the inline transform back.Before
A transform-centred box after a 25 deg turn: swung off its centre.
After
The same case turns in place.