Blazor-Diagrams / Blazor.Diagrams

A fully customizable and extensible all-purpose diagrams library for Blazor
https://blazor-diagrams.zhaytam.com
MIT License
993 stars 196 forks source link

Grid snap to center #241

Closed 240026763 closed 2 years ago

240026763 commented 2 years ago
zHaytam commented 2 years ago

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

240026763 commented 2 years ago

Indeed it breaks moving links and the snap to grid example.

What about adding Size to MovableModel?

zHaytam commented 2 years ago

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.

240026763 commented 2 years ago

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.

240026763 commented 2 years ago

Fixed the snap to grid demo crash and added a toggle for Snap to Center.

240026763 commented 2 years ago

@zHaytam, do you see anything else that this PR needs in order to get merged?

zHaytam commented 2 years ago

Just a unit test in DragMovablesBehaviorTests please

240026763 commented 2 years ago

Unit Test Theory in place

240026763 commented 2 years ago

Just checking on this PR. Anything more to add? I'd love to get this out on nuget in the next beta.

zHaytam commented 2 years ago

Thank you for the PR!