From 3349df21832e3b90582ebc03bccd200d1bc48360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Thu, 10 Oct 2024 17:30:27 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E6=80=A7=E8=83=BD=E6=A8=A1=E5=BC=8F=E6=97=B6=E6=8B=96?= =?UTF-8?q?=E5=8A=A8=E5=AD=90=E8=8A=82=E7=82=B9=E5=9C=A8=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E5=A4=96=E7=9A=84=E8=8A=82=E7=82=B9=E6=97=B6=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/core/render/node/MindMapNode.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/simple-mind-map/src/core/render/node/MindMapNode.js b/simple-mind-map/src/core/render/node/MindMapNode.js index 2865b8af..93f08e41 100644 --- a/simple-mind-map/src/core/render/node/MindMapNode.js +++ b/simple-mind-map/src/core/render/node/MindMapNode.js @@ -971,7 +971,7 @@ class MindMapNode { // 隐藏节点 hide() { - this.group.hide() + if (this.group) this.group.hide() this.hideGeneralization() if (this.parent) { let index = this.parent.children.indexOf(this) @@ -1014,7 +1014,7 @@ class MindMapNode { // 包括连接线和下级节点 setOpacity(val) { // 自身及连线 - this.group.opacity(val) + if (this.group) this.group.opacity(val) this._lines.forEach(line => { line.opacity(val) }) @@ -1053,13 +1053,13 @@ class MindMapNode { // 被拖拽中 startDrag() { this.isDrag = true - this.group.addClass('smm-node-dragging') + if (this.group) this.group.addClass('smm-node-dragging') } // 拖拽结束 endDrag() { this.isDrag = false - this.group.removeClass('smm-node-dragging') + if (this.group) this.group.removeClass('smm-node-dragging') } // 连线 @@ -1302,7 +1302,7 @@ class MindMapNode { // 获取节点的尺寸和位置信息,宽高是应用了缩放效果后的实际宽高,位置是相对于浏览器窗口左上角的位置 getRect() { - return this.group.rbox() + return this.group ? this.group.rbox() : null } // 获取节点的尺寸和位置信息,宽高是应用了缩放效果后的实际宽高,位置信息相对于画布