Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rendering of rotated nodes #244

Open
rylin8 opened this issue Jul 26, 2023 · 1 comment
Open

Fix rendering of rotated nodes #244

rylin8 opened this issue Jul 26, 2023 · 1 comment
Labels
❗ P1 Priority for next release 🟢 P2 Priority for next 2-3 releases Type: Bug Something isn't working Type: Customer Issue Many eyes on this issue

Comments

@rylin8
Copy link
Collaborator

rylin8 commented Jul 26, 2023

When a node in Figma is rotated and offset from its parent (meaning it has an x and/or y offset from its parent when not rotated), we often render the node incorrectly. Something incorrect happens in transform_flexbox.rs when setting the transform matrix.

In the stroke validation test https://www.figma.com/file/Z3ucY0wMAbIwZIa6mLEWIK/stroke-stuff?node-id=0%3A1&t=0Dq3abJhR4zpH060-1, the node from the Battleship doc breaks because the rect is rotated 90 degrees, offset from its parent, and has its constraints set to left-right + top-bottom. This causes the width/height of the frame to be calculated incorrectly.

A possible fix may be to undo any rotation set in the Figma file so that we get the x/y offset without any rotation, then set the transform matrix with the rotation in it. We may need to also add a translation to the rotation so that we rotate about the center, not the top left.

@github-project-automation github-project-automation bot moved this to Needs Triage in DesignCompose Jul 26, 2023
@timothyfroehlich timothyfroehlich moved this from Needs Triage to Todo in DesignCompose Jul 26, 2023
@timothyfroehlich timothyfroehlich added Type: Customer Issue Many eyes on this issue 🟢 P2 Priority for next 2-3 releases Type: Bug Something isn't working labels Jul 26, 2023
@rizniazi rizniazi added the ❗ P1 Priority for next release label Aug 31, 2023
@rylin8
Copy link
Collaborator Author

rylin8 commented Sep 28, 2023

This has improved with #314 but there may still be issues with nested rotations. Battleship looks correct though:
Screenshot 2023-09-28 at 3 26 55 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❗ P1 Priority for next release 🟢 P2 Priority for next 2-3 releases Type: Bug Something isn't working Type: Customer Issue Many eyes on this issue
Projects
Status: New
Development

No branches or pull requests

3 participants