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

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 {
this.clearCache();
const canvas = this.canvas;
canvas.removeChild(this.container);
if (this.container?.parent) {
canvas.removeChild(this.container);
}
canvas.off('mousedown', this.onLeftDown, this);
canvas.off('mousemove', this.onMouseMove, this);
canvas.off('mouseup', this.onLeftUp, this);