@Hesh wrote:
In the following code, the model is changed, plus a
model.addChangedListeneris being registered to detect any subsequent changes made by user actions.I want the callback function,
myModelChangedto be invoked only on subsequent changes, and not when the whole model is changed. I have tried using a flagnewModel = truefor the purpose, turning it tofalseafter a new model has been created.However, the callback method is invoked in both situations, when the new model is created, and when it is changed by user actions.
var newModel = true; function diagChange(nodes, links) { diagram.model = new go.GraphLinksModel(nodes, links); newModel = false; diagram.model.addChangedListener(function (e) { if (!newModel && e.isTransactionFinished) { myModelChanged(diagram.model.toJSON()); } } ); }How can I make sure that the callback is called only with the subsequent changes to the model?
Posts: 1
Participants: 1