Skip to content

fixed shape at non-100% viewport zoon to apply scale correctly#3723

Draft
krVatsal wants to merge 8 commits intoGraphiteEditor:masterfrom
krVatsal:fix-shape-at-non-100%-viewport-zoom-wrongly-applies-the-scale
Draft

fixed shape at non-100% viewport zoon to apply scale correctly#3723
krVatsal wants to merge 8 commits intoGraphiteEditor:masterfrom
krVatsal:fix-shape-at-non-100%-viewport-zoom-wrongly-applies-the-scale

Conversation

@krVatsal
Copy link
Contributor

@krVatsal krVatsal commented Feb 5, 2026

Fixes #2582
When drawing shapes (Rectangle, Ellipse, Circle, Polygon, Star, Arc, Spiral) at a viewport zoom other than 100%, the Transform node would receive a scale value corresponding to the zoom level instead of 1.

The fix converts viewport-space dimensions to document-space before setting shape parameters and uses TransformIn::Local instead of TransformIn::Viewport . This matches how the Line tool already worked correctly.

@krVatsal krVatsal marked this pull request as ready for review February 5, 2026 19:36
@krVatsal krVatsal marked this pull request as draft February 5, 2026 19:49
@krVatsal krVatsal marked this pull request as ready for review February 6, 2026 11:56
@Keavon Keavon force-pushed the fix-shape-at-non-100%-viewport-zoom-wrongly-applies-the-scale branch from cee75a5 to 94f589b Compare February 13, 2026 23:59
@Keavon
Copy link
Member

Keavon commented Feb 14, 2026

  • This is seemingly not working for Ellipse.
  • We get a crash when drawing a Spiral.

@Keavon Keavon marked this pull request as draft February 14, 2026 00:06
…-scale' of https://github.com/krVatsal/Graphite into fix-shape-at-non-100%-viewport-zoom-wrongly-applies-the-scale
@krVatsal
Copy link
Contributor Author

  • We get a crash when drawing a Spiral.
    Hey, can you explain a bit what do you mean by crash, like it works fine on my localhost for spiral.

@krVatsal
Copy link
Contributor Author

krVatsal commented Feb 14, 2026

After analyzing the test failures, I realized that ellipse is intentionally designed to work in viewport space (visual/screen space), not document space(which was my solution for this scale issue). This is correct behavior for canvas rotation scenarios. The zoom-related fix likely only applies to shapes like Rectangle that use document space ([TransformIn::Local]), which I already fixed in my previous fix.

If there is something that i am getting wrong or if i should follow any other method please suggest.
@Keavon

@Keavon
Copy link
Member

Keavon commented Feb 14, 2026

Ellipse should work the same as Rectangle in that regard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drawing a shape at non-100% viewport zoom wrongly applies the scale to the Transform node not the shape

2 participants