mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-23 03:17:41 +08:00
Feat:将节点实例的isParent方法改名为isAncestor
This commit is contained in:
parent
6723250266
commit
d32588763c
@ -903,7 +903,7 @@ class Node {
|
||||
}
|
||||
|
||||
// 检测当前节点是否是某个节点的祖先节点
|
||||
isParent(node) {
|
||||
isAncestor(node) {
|
||||
if (this.uid === node.uid) {
|
||||
return false
|
||||
}
|
||||
|
||||
@ -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)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user