From 9de29ed934ffb9556e473911fdb715524f1d2fad Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Sun, 19 Mar 2023 15:31:49 +0800 Subject: [PATCH] fix:set editor zone method --- src/editor/core/zone/Zone.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/editor/core/zone/Zone.ts b/src/editor/core/zone/Zone.ts index 21f0897..7b38161 100644 --- a/src/editor/core/zone/Zone.ts +++ b/src/editor/core/zone/Zone.ts @@ -1,10 +1,13 @@ import { EditorZone } from '../../dataset/enum/Editor' +import { Draw } from '../draw/Draw' export class Zone { + private draw: Draw private currentZone: EditorZone - constructor() { + constructor(draw: Draw) { + this.draw = draw this.currentZone = EditorZone.MAIN } @@ -21,7 +24,14 @@ export class Zone { } public setZone(payload: EditorZone) { + if (this.currentZone === payload) return this.currentZone = payload + this.draw.getRange().clearRange() + this.draw.render({ + isSubmitHistory: false, + isSetCursor: false, + isCompute: false + }) } } \ No newline at end of file