edemaine / cocreate

Cocreate Shared Whiteboard/Drawing
MIT License
209 stars 27 forks source link

Snapping lines to different angles #123

Open edemaine opened 3 years ago

edemaine commented 3 years ago

Currently, Shift snaps line segments to orthogonal directions (multiple of 90). It'd be great to have this configurable to be a multiple of any angle, or maybe 360 / n for any n. In particular, useful values include 22.5 = 360/16, 30 = 360/12, 45 = 360/8, 60 = 360/6, 90 = 360/4. Illustrator seems to do multiples of 45 degrees with Shift, but for Smart Guides it lets you specify a list of angles to span to and includes some built-in options like "multiples of 60 degrees + vertical".

Not sure how this should be affected by a change in grid (#21). Maybe both are configured on a common popup? Maybe changing the grid changes the default snap, but doesn't change snap if it's been set already? Should the snap be global to all users on that page, or local to a user?

diomidov commented 3 years ago

30 degree snap would be useful, but only on a triangular/hexagonal grid.

22.5 degree snapping would require many additional features before it's useful. At the very least you'd want to snap to previous objects. And maybe even intersections of previous objects. I don't think it's worth it.

I think it's fine to just have one fixed snapping angle for each grid. For example: