From d32588763c80fbb8bec7fb44bc715be8e7c48cf6 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Tue, 21 Nov 2023 10:40:00 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E5=B0=86=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E5=AE=9E=E4=BE=8B=E7=9A=84isParent=E6=96=B9=E6=B3=95=E6=94=B9?= =?UTF-8?q?=E5=90=8D=E4=B8=BAisAncestor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/core/render/node/Node.js | 2 +- simple-mind-map/src/plugins/Drag.js | 2 +- simple-mind-map/src/utils/index.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/simple-mind-map/src/core/render/node/Node.js b/simple-mind-map/src/core/render/node/Node.js index 45a92a9c..5737fb25 100644 --- a/simple-mind-map/src/core/render/node/Node.js +++ b/simple-mind-map/src/core/render/node/Node.js @@ -903,7 +903,7 @@ class Node { } // 检测当前节点是否是某个节点的祖先节点 - isParent(node) { + isAncestor(node) { if (this.uid === node.uid) { return false } diff --git a/simple-mind-map/src/plugins/Drag.js b/simple-mind-map/src/plugins/Drag.js index 9752022f..9640f501 100644 --- a/simple-mind-map/src/plugins/Drag.js +++ b/simple-mind-map/src/plugins/Drag.js @@ -677,7 +677,7 @@ class Drag extends Base { // 检查某个节点是否在被拖拽节点内 checkIsInBeingDragNodeList(node) { return !!this.beingDragNodeList.find(item => { - return item.uid === node.uid || item.isParent(node) + return item.uid === node.uid || item.isAncestor(node) }) } } diff --git a/simple-mind-map/src/utils/index.js b/simple-mind-map/src/utils/index.js index 6c4684bb..eac4b3de 100644 --- a/simple-mind-map/src/utils/index.js +++ b/simple-mind-map/src/utils/index.js @@ -713,7 +713,7 @@ export const getTopAncestorsFomNodeList = list => { list.forEach(node => { if ( !list.find(item => { - return item.uid !== node.uid && item.isParent(node) + return item.uid !== node.uid && item.isAncestor(node) }) ) { res.push(node) @@ -728,7 +728,7 @@ export const checkHasSupSubRelation = list => { const cur = list[i] if ( list.find(item => { - return item.uid !== cur.uid && cur.isParent(item) + return item.uid !== cur.uid && cur.isAncestor(item) }) ) { return true