Draft: snap-to-grid with different grid sizes (factors of 100 for now, but easily changed)
This merge request implements "snap-to-grid" for mouse motion. It's set in the GUI preferences menu, with cell sizes of "5", "10", "20", and "25".
We also keep a partially transparent version of a grid for editmode. This allows us to keep editmode visually distinct from runmode, even if snap-to-grid isn't turned on.
If needed it's pretty easy to make the following changes:
- set the "big" cell size to something that isn't 100 (but I'm not sure how much control over the grid we actually want to give users-- e.g., setting the big cell to something for which the small cell isn't a factor
- allow snap-to-grid to be set independently for each canvas. (But again, what would be the use case for this?
To move from draft to ready-to-merge:
-
Have Albert take a look at the core algo in canvas_snap_to_grid to see if it could be improved.
-
Have a look at the non-default GUI presets to make sure the grid appears readable with them. This probably requires setting a class for the grid so it can inherit the relevant preset colors.