Modified event occur when I drag

I have 2 diagram, diagram A and B. when I drag a node from A to B, A diagram’s Modified event is occur and isModified status was true.
test code is every simple. like below .
myDiagram.diagramKey = “A”;
myDiagram2.diagramKey = “B”;

myDiagram.addDiagramListener(“Modified”, digmModified);
myDiagram2.addDiagramListener(“Modified”, digmModified);

function digmModified(e) {
console.log( "Modified Diagram: "+ e.diagram.diagramKey + " " + e.diagram.isModified);
I think the correct action is diagram A not Modified. or even Modified event is not occur.

Dragging within Diagram “A” will modify the state of the diagram, even if the transaction does not actually change its model because the drag-and-drop went to a different diagram.

I suppose we could be smarter about recognizing transactions where there were actually no changes to the diagram’s model, but I believe that will not be so easy to implement reliably. Sorry.

Perhaps you really want to implement a Changed listener on the Model? In other words, call Diagram.addModelChangedListener instead of Diagram.addDiagramListener. The event argument will be a ChangedEvent rather than a DiagramEvent.

I tried this, but Diagram.addModelChangedListener (ChangedEvent ) also occur on Diagram “A”.

i know I know, it is in one transaction. so… become not easy to implement. when drop to B cancel the diagram A transaction ? i don’t know it is possible or not.

Cancelling the transaction would cancel the drag-and-drop to Diagram “B”.

Yes, the problem is distinguishing when the drop happens successfully within Diagram “A” from when it goes to Diagram “B”.

I looked at the source code and there does not appear to be any hook for when the dragged nodes in the source diagram are moved back to their original locations because the drag is now external into another diagram.

Just to be clear – you want Diagram.isModified to be set to true when the drag-and-drop stays within Diagram “A”, and you do not want Diagram.isModified to be set to true if the drag-and-drop is cancelled or if the drag-and-drop is successful to another Diagram, yes? (Of course Diagram.isModified might already have been true.)

the answer is yes.

by the way i test a lot. I also want incremental(ModelChanged) event not happen in diagram A. if is easy to change code.

so my test code in diagram A like this.

myDiagram.addModelChangedListener(function(evt) {
// ignore unimportant Transaction events
if (!evt.isTransactionFinished) return;
var json = evt.model.toIncrementalJson(evt);

I don’t know if this will work in your situation, but something like this might suit your needs:

    diagramB.addDiagramListener("ExternalObjectsDropped", function(e) {

This assumes that the two Diagrams / Models have separate UndoManagers

this is what i want. perfect !! thank you.