diff --git a/packages/core/src/view/handler/SelectionCellsHandler.ts b/packages/core/src/view/handler/SelectionCellsHandler.ts index 6969940e9..7be7733e0 100644 --- a/packages/core/src/view/handler/SelectionCellsHandler.ts +++ b/packages/core/src/view/handler/SelectionCellsHandler.ts @@ -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.getView().addListener(InternalEvent.SCALE, this.refreshHandler); this.graph.getView().addListener(InternalEvent.TRANSLATE, this.refreshHandler); diff --git a/packages/core/src/view/undoable_changes/SelectionChange.ts b/packages/core/src/view/undoable_changes/SelectionChange.ts index e4cde4c79..27f76b595 100644 --- a/packages/core/src/view/undoable_changes/SelectionChange.ts +++ b/packages/core/src/view/undoable_changes/SelectionChange.ts @@ -49,11 +49,11 @@ class SelectionChange implements UndoableChange { selectionModel.updatingSelectionResource; for (const removed of this.removed) { - this.graph.getSelectionModel().cellRemoved(removed); + selectionModel.cellRemoved(removed); } for (const added of this.added) { - this.graph.getSelectionModel().cellAdded(added); + selectionModel.cellAdded(added); } [this.added, this.removed] = [this.removed, this.added]; @@ -61,7 +61,7 @@ class SelectionChange implements UndoableChange { window.status = Translations.get(selectionModel.doneResource) || selectionModel.doneResource; - this.graph.fireEvent( + selectionModel.fireEvent( new EventObject(InternalEvent.CHANGE, { added: this.added, removed: this.removed }) ); }