GraphiteEditor / Graphite

2D vector & raster editor that melds traditional layers & tools with a modern node-based, non-destructive, procedural workflow.
https://graphite.rs
Apache License 2.0
7.75k stars 408 forks source link

Migrate node graph UI interaction from frontend to backend #1768

Closed adamgerhant closed 3 months ago

adamgerhant commented 3 months ago

Closes #1777 and (presumably) fixes #1548.

This PR will migrate click detection, translation/scale and wire calculations from Graph.svelte to the NodeGraphMessageHandler. Instead of relying on the DOM and JavaScript click detection to get positions for various elements and send messages via editor.handle, all logic and calculations will be performed in the NodeGraphMessageHandler. Since Rust only has access to the node and wire data, all positioning functions that previously used the DOM will have to be recreated. This includes

Another important concept will be to store positions in node graph coordinates, and derive pixel coordinates when needed using the current transform (position/scale). This should solve a current issue where scaling the node graph breaks the automatic node insertion on a wire.

Other features

Issues: