fix: fire selection `CHANGE` event to correct listener (#118)
The `CHANGE` event is now fired to `GraphSelectionModel` instead of `Graph`. This is the behavior of mxGraph that was mistakenly modified during the migration of the code.development
parent
a3b5a60c60
commit
3954001a84
|
@ -63,7 +63,7 @@ class SelectionCellsHandler extends EventSource implements GraphPlugin {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.graph.addListener(InternalEvent.CHANGE, this.refreshHandler);
|
this.graph.getSelectionModel().addListener(InternalEvent.CHANGE, this.refreshHandler);
|
||||||
this.graph.getDataModel().addListener(InternalEvent.CHANGE, this.refreshHandler);
|
this.graph.getDataModel().addListener(InternalEvent.CHANGE, this.refreshHandler);
|
||||||
this.graph.getView().addListener(InternalEvent.SCALE, this.refreshHandler);
|
this.graph.getView().addListener(InternalEvent.SCALE, this.refreshHandler);
|
||||||
this.graph.getView().addListener(InternalEvent.TRANSLATE, this.refreshHandler);
|
this.graph.getView().addListener(InternalEvent.TRANSLATE, this.refreshHandler);
|
||||||
|
|
|
@ -49,11 +49,11 @@ class SelectionChange implements UndoableChange {
|
||||||
selectionModel.updatingSelectionResource;
|
selectionModel.updatingSelectionResource;
|
||||||
|
|
||||||
for (const removed of this.removed) {
|
for (const removed of this.removed) {
|
||||||
this.graph.getSelectionModel().cellRemoved(removed);
|
selectionModel.cellRemoved(removed);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const added of this.added) {
|
for (const added of this.added) {
|
||||||
this.graph.getSelectionModel().cellAdded(added);
|
selectionModel.cellAdded(added);
|
||||||
}
|
}
|
||||||
|
|
||||||
[this.added, this.removed] = [this.removed, this.added];
|
[this.added, this.removed] = [this.removed, this.added];
|
||||||
|
@ -61,7 +61,7 @@ class SelectionChange implements UndoableChange {
|
||||||
window.status =
|
window.status =
|
||||||
Translations.get(selectionModel.doneResource) || selectionModel.doneResource;
|
Translations.get(selectionModel.doneResource) || selectionModel.doneResource;
|
||||||
|
|
||||||
this.graph.fireEvent(
|
selectionModel.fireEvent(
|
||||||
new EventObject(InternalEvent.CHANGE, { added: this.added, removed: this.removed })
|
new EventObject(InternalEvent.CHANGE, { added: this.added, removed: this.removed })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue