Blazor-Diagrams / Blazor.Diagrams

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

How to detect any changes #180

Closed MitaTarp closed 2 years ago

MitaTarp commented 2 years ago

How can I detect any changes in diagram, nodes and links. I would like to use it to be able to enable a button when anything has changed. I have found the Node events added and removed but not moved. Do I need to implement the mouse and touch events and check if the node has been moved?

zHaytam commented 2 years ago

Hi, sorry for the delay! What kind of changes would you like to detect? There are a lot of events in the diagram and models themselves. If you want to be very granular, you can subscribe to the Changed event in the models, but I'd leave that as the last resort.

MitaTarp commented 2 years ago

Hi, no worries I just needed to detect when a node is moved, added or deleted. I have used the mouse down and up events to achieve it by storing mouse position if an element is present in the event and then comparing mouse position on mouse up event. The added and deleted is detected with diagram changed event.