From 2e1af9677bffe63cc1c049e9e2af94e9d80d872e Mon Sep 17 00:00:00 2001 From: Egor Shnel Date: Tue, 9 Apr 2024 14:02:49 +0500 Subject: [PATCH] #4356 - Macro: Clear canvas button doesn't work in Sequence mode --- .../ketcher-core/src/application/editor/tools/Clear.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/ketcher-core/src/application/editor/tools/Clear.ts b/packages/ketcher-core/src/application/editor/tools/Clear.ts index ce2270da39..eef1a7b2bb 100644 --- a/packages/ketcher-core/src/application/editor/tools/Clear.ts +++ b/packages/ketcher-core/src/application/editor/tools/Clear.ts @@ -16,6 +16,7 @@ import { CoreEditor, EditorHistory } from 'application/editor/internal'; import { SequenceMode } from 'application/editor/modes'; import { BaseTool } from 'application/editor/tools/Tool'; +import { ReinitializeSequenceModeCommand } from 'application/editor/operations/modes'; class ClearTool implements BaseTool { private history: EditorHistory; @@ -24,12 +25,13 @@ class ClearTool implements BaseTool { this.editor = editor; this.history = new EditorHistory(editor); + const modelChanges = this.editor.drawingEntitiesManager.deleteAllEntities(); + this.editor.renderersContainer.update(modelChanges); + if (editor.mode instanceof SequenceMode) { - return; + modelChanges.addOperation(new ReinitializeSequenceModeCommand()); } - const modelChanges = this.editor.drawingEntitiesManager.deleteAllEntities(); - this.editor.renderersContainer.update(modelChanges); this.history.update(modelChanges); }