Graphite icon indicating copy to clipboard operation
Graphite copied to clipboard

Stretch and tilt ruler increments when canvas is tilted

Open Keavon opened this issue 7 months ago • 0 comments

If the user tilts the canvas in the viewport, the scale of the increments becomes inaccurate. We want to essentially tilt the measuring system with the canvas. So for example, if the canvas is viewed with a 45° tilt, the increments become √2 = 1.414... wider.

Additionally, the horizontal and vertical ticks (for the vertical and horizontal rulers, respectively) should themselves become tilted to help visualize the fact that they are measuring tilted lines that, if conceptually extended into the document, would remain axis-aligned with document space. It's important that they actually align, so for example the increment ticks at 0 for both rulers would pass through the document origin (if the ticks were extended beyond the rulers). The tick marks would be allowed to tilt up to 45°, at which point the axes would switch and the tilt would become less angled until 90° is reached whereupon the ticks are not tilted but the X and Y rulers mark the dimensions of the Y and X axes, respectively. This behavior of course continues with additional canvas tilt until a full rotation at 360° brings things back to how they started.

Care should be taken to ensure the ticks and numbers generally don't overlap, so the number positioning and tick density would need to intelligently adjust to avoid overlap depending on the canvas zoom level and tilt angle.

This is mostly a web issue, so Svelte/CSS/JS and figuring out some math and logic is required. Plumbing through the canvas tilt, thus extending upon the existing origin point and scale information sent by the backend, would be all the necessary Rust knowledge. This PR can provide a reference for what Rust code needs to change, and feel free to also reach out on Discord to ask for help with this aspect if you're unfamiliar with Rust.

Keavon avatar Nov 28 '23 10:11 Keavon