fix: preserve node rotation, true size, ink bounds, and explicit line breaks - #420
Open
gillianrode-123 wants to merge 1 commit into
Open
fix: preserve node rotation, true size, ink bounds, and explicit line breaks#420gillianrode-123 wants to merge 1 commit into
gillianrode-123 wants to merge 1 commit into
Conversation
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.
Problem
The simplifier currently loses three classes of design facts:
absoluteBoundingBoxis the axis-aligned box around a rotated node — inflated and corner-anchored. A 100x148.75 rectangle at -18.3° is reported as an unrotated 141.6x172.6 box at the wrong position, and the angle is unrecoverable from the output. Any design with tilted elements (photo collages, decorative scatter, badges) cannot be implemented faithfully from the simplified data: consumers render everything upright and oversized.(what Shift+Return inserts) passes through unescaped while\n/are escaped to\nmarkers, so a designer's manual break silently collapses into a space in HTML and the text re-wraps differently from the design.Root cause for 1–2: the REST requests never pass
geometry=paths, so Figma never sendsrelativeTransform/size, and the transformer only reads bounding boxes.Change
geometry=pathsongetRawFile/getRawNode.rotation(degrees, Figma sign: counter-clockwise positive; CSS equivalent isrotate(-<rotation>deg)withtransform-origin: top left), and switchdimensions/locationRelativeToParentto the true unrotated size and the pre-rotation top-left fromrelativeTransform(already parent-relative). Children of rotated groups take this path even when locally unrotated so nested transforms compose.renderBounds(parent-relativeabsoluteRenderBounds) for vector-class nodes (TEXT_PATH,VECTOR,BOOLEAN_OPERATION,STAR,LINE,POLYGON) when ink differs from the layout box by more than 1px.like\n/in both the line splitter and the markdown escaper.Backward compatibility
SimplifiedLayout.geometry=pathsincreases the raw REST payload server-side; the simplified output only grows by the new fields on affected nodes.Validation
src/tests/rotation-transform.test.ts); full suite passes (255 tests).