Is there a way to disable layout rearrangement after doCancel() is called?
here is my application with example diagram:
I allow user to move nodes around so after few actions it can looklike this:
I validate drag and drop from the palette to diagram, have few rules what users can do, and cannot do. When a user does something that is not allowed I run
diagram.currentTool.doCancel()so the action is canceled. This however does not return to the previous state, but rather to the initial one.
Why is it a problem for me?
I store model state in react state and it is updated and used on every change. After
doCancelis called this state is not updated and it holds old positions of nodes and links (arrangement made by the user). When I move another node again graph looks like this:
Nodes stay in the same places, but links jump back to the previous arrangement.
I see two solutions here.
1 - I can update the state after
doCancel call with current locations of every element. I didn’t found any property from the diagram I could use for getting the required information, for example
diagram.model.modelData given me an empty object.
2 - If I could disable this rearrangement I would probably leave everything else as is and everything would work fine.
Is there any suggestion from you I could use for 2 solution? Or could you help me with first one?