@Giosk wrote:
I have a diagram with entities and links and I’m trying to save and restore the entity positions.
I created a solution following this example and it works correctly.
Is it possible to avoid a complete diagram re-layout if I change only a subset of my entities?
In the example if I change in the “nodeDataArray” the location of an entity{"id":0, "loc":"300 300", "text":"Initial"}
and I press “Load”, the diagram is reload as a new diagram.
Is it possible to move the entity if its location changed avoiding a complete re-layout?I tried the following solution:
myDiagram.startTransaction("change Layout") myDiagram.model.nodeDataArray[0].location = "500 500" myDiagram.commitTransaction("change Layout")
and this one:
myDiagram.startTransaction("change Layout") var first = myDiagram.model.nodeDataArray[0] var firstnode = myDiagram.findPartForKey(first.id) firstnode.locationObject.data.loc = "500 500" myDiagram.commitTransaction("change Layout")
neither of them worked.
Thanks
GiorgioEDIT
I found a solutionmyDiagram.model.commit(function(m) { var data = m.nodeDataArray[0] m.set(data, "loc", "500 500") }, "change location")
Posts: 1
Participants: 1