Support reification of rotate transformations - #109
Open
reznakt wants to merge 4 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #109 +/- ##
==========================================
+ Coverage 91.27% 91.60% +0.33%
==========================================
Files 32 32
Lines 3495 3623 +128
Branches 364 383 +19
==========================================
+ Hits 3190 3319 +129
+ Misses 199 195 -4
- Partials 106 109 +3
|
reznakt
force-pushed
the
reify-rotate
branch
2 times, most recently
from
August 21, 2026 13:01
147c03f to
e0c0613
Compare
reznakt
force-pushed
the
reify-rotate
branch
from
September 1, 2026 18:56
e0c0613 to
43028cb
Compare
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.
Adds support for reifying
rotate()transformations, converting shapes that cannot express a rotation into paths.Behavior
reify()now appliesrotate(), not justtranslate()/scale().circle,line,polyline,polygonandpath.rectandellipseat multiples of 90 degrees.rect/ellipseat any other angle are converted to<path>in place.text,image, nested viewports and percentage coordinates keep the transformation, as before.Signatures
reify()returnsElementinstead ofNone— itself, or the replacement<path>.Element.replace_with(new)— new method, swaps an element for another in its parent.Contracts that changed
BasicShape.to_path()returns a detached element (parent is None) carrying deep copies of its children. It previously returned one attached to a deep-copied clone of the whole document, with the children dropped.Rect.to_path_data()emits a closed subpath, omits degenerateA0,0arcs on square corners, and clampsrx/ryto half the width/height. Command counts and stroke joins differ from before.swap_transforms()raisesSvgTransformSwapErrorfor a rotation and a non-uniform scale. It used to return a mathematically wrong pair: the identity holds only when the scale is isotropic or the rotation is a multiple of 180 degrees.swap_transforms()now also handles rotation ↔ rotation about differing centres.ReifiableincludesRotate.No removals; the only source-level break is code that annotated
reify()as returningNone.