移除容器前判断父元素是否存在

This commit is contained in:
fan 2023-06-09 17:44:01 +08:00
parent 729a3c25b4
commit 65f8e53e6b

View File

@ -102,7 +102,9 @@ export abstract class GraphicDrawAssistant<
unbind(): void { unbind(): void {
this.clearCache(); this.clearCache();
const canvas = this.canvas; const canvas = this.canvas;
canvas.removeChild(this.container); if (this.container?.parent) {
canvas.removeChild(this.container);
}
canvas.off('mousedown', this.onLeftDown, this); canvas.off('mousedown', this.onLeftDown, this);
canvas.off('mousemove', this.onMouseMove, this); canvas.off('mousemove', this.onMouseMove, this);
canvas.off('mouseup', this.onLeftUp, this); canvas.off('mouseup', this.onLeftUp, this);