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.76k stars 408 forks source link

Further customisation of snapping #1705

Closed 0HyperCube closed 5 months ago

0HyperCube commented 6 months ago

Currently the user can only choose to toggle snapping to bounding boxes and snapping to geometry. current snap settings

This should be expanded to allow users to for example ignore snapping to bounding box centres but still snap to corners. State to enable more fine grained snapping is already implemented as part of the BoundsSnapping and NodeSnapping structs. The "Snap customization settings" popup is declared in document_message_handler.rs and the snapping state is stored in misc.rs.

shyamjayakannan commented 5 months ago

@0HyperCube would it be alright to convert bounding_box_snapping and geometry_snapping to maybe enums in which the various fields of BoundsSnapping and PointSnapping are either activated or not. Right now both only have a default implementation. https://github.com/GraphiteEditor/Graphite/blob/438c45eb802e75e41aad5ce0ab055c006563a334/editor/src/messages/portfolio/document/utility_types/misc.rs#L58-L99

0HyperCube commented 5 months ago

@shyamjayakannan I'm not sure what you mean by a maybe enums. The struct here stores these booleans separately as you can snap to many things at the same time, but if you approach keeps this behaviour then it will be fine.

shyamjayakannan commented 5 months ago

Would behavior like that in the video below be alright?

https://github.com/GraphiteEditor/Graphite/assets/120047549/8b1cb1da-5310-480f-8823-c8dd5d6f2049

As can be seen in the video, earlier the cursor was snapping to Bounding Box edges, but turning it off removes the snapping behavior.

I have also removed the checkboxes in front of the Bounding boxes and Geometry options that were present earlier because the snapping can be further customized using the Popover button

Keavon commented 5 months ago

That looks great. My only comment is that we don't want recursive popover menus, so please include all those checkboxes in the same menu under the two labeled categories.

shyamjayakannan commented 5 months ago

@Keavon will do. Should I make a separate PR or add commits to #1727?

Keavon commented 5 months ago

Separate PRs for separate topics.