diff --git a/packages/core/src/canvas/view/CanvasView.ts b/packages/core/src/canvas/view/CanvasView.ts index c88753c1a..dc0e0ce63 100644 --- a/packages/core/src/canvas/view/CanvasView.ts +++ b/packages/core/src/canvas/view/CanvasView.ts @@ -84,7 +84,7 @@ export default class CanvasView extends ModuleView { frames!: FramesView; frame?: FrameView; - private timerZoom?: number; + private timerZoom?: NodeJS.Timeout; private frmOff?: { top: number; left: number; width: number; height: number }; private cvsOff?: { top: number; left: number; width: number; height: number }; @@ -135,6 +135,7 @@ export default class CanvasView extends ModuleView { } remove(...args: any) { + clearTimeout(this.timerZoom); this.frames?.remove(); //@ts-ignore this.frames = undefined; @@ -242,12 +243,12 @@ export default class CanvasView extends ModuleView { this.clearOff(); toolsWrpEl.style.display = 'none'; em.trigger('canvas:update', ev); - this.timerZoom && clearTimeout(this.timerZoom); + clearTimeout(this.timerZoom); this.timerZoom = setTimeout(() => { em.stopDefault(defOpts); em.runDefault(defOpts); toolsWrpEl.style.display = ''; - }, 300) as any; + }, 300); } updateFramesArea() { diff --git a/packages/core/src/editor/model/Editor.ts b/packages/core/src/editor/model/Editor.ts index e7787b0d4..077474478 100644 --- a/packages/core/src/editor/model/Editor.ts +++ b/packages/core/src/editor/model/Editor.ts @@ -907,10 +907,10 @@ export default class EditorModel extends Model { * @private */ runDefault(opts = {}) { - const command = this.get('Commands').get(this.config.defaultCommand); + const command = this.Commands.get(this.config.defaultCommand!); if (!command || this.defaultRunning) return; - command.stop(this, this, opts); - command.run(this, this, opts); + command.stop!(this as any, this, opts); + command.run!(this as any, this, opts); this.defaultRunning = true; } @@ -920,11 +920,11 @@ export default class EditorModel extends Model { * @private */ stopDefault(opts = {}) { - const commands = this.get('Commands'); + const commands = this.Commands; if (!commands) return; - const command = commands.get(this.config.defaultCommand); + const command = commands.get(this.config.defaultCommand!); if (!command || !this.defaultRunning) return; - command.stop(this, this, opts); + command.stop!(this as any, this, opts); this.defaultRunning = false; }