Skip to content

Commit

Permalink
#4356 - Macro: Clear canvas button doesn't work in Sequence mode (#4441)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmrr13 authored Apr 10, 2024
1 parent 08f1d10 commit 5f5c9f5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/ketcher-core/src/application/editor/tools/Clear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down

0 comments on commit 5f5c9f5

Please sign in to comment.