Blazor.Diagrams
Blazor.Diagrams copied to clipboard
Grid snap to center
- Added GridSnapToCenter to DiagramOptions
- In Drag Behavior, check the option to see if the snap point should be the Top Left (GridSnapToCenter = false) or center of the node (GridSnapToCenter = true).
Did you try this in the demos? I'm guessing that this breaks moving link vertices for example. MovableModel was created to represent all things that can be moved, you can't just not use it alltogether
Indeed it breaks moving links and the snap to grid example.
What about adding Size to MovableModel?
Not all movables require a size though, so that's also not the solution we should go for.
For now, try to just make your checks as: Diagram.Options.GridSnapToCenter && movable is NodeModel node
, so that it would be a specifial case for nodes only for now.
The Vertices example works again but the Snap To Grid example is broken. Checking develop branch though and it is broken there as well for ServerSide Demo.
Fixed the snap to grid demo crash and added a toggle for Snap to Center.
@zHaytam, do you see anything else that this PR needs in order to get merged?
Just a unit test in DragMovablesBehaviorTests please
Unit Test Theory in place
Just checking on this PR. Anything more to add? I'd love to get this out on nuget in the next beta.
Thank you for the PR!