Feat:上移、下移命令支持指定操作节点

This commit is contained in:
街角小林 2024-12-04 18:49:23 +08:00
parent f02098f697
commit 7d399b436b

View File

@ -988,11 +988,12 @@ class Render {
} }
// 上移节点,多个节点只会操作第一个节点 // 上移节点,多个节点只会操作第一个节点
upNode() { upNode(appointNode) {
if (this.activeNodeList.length <= 0) { if (this.activeNodeList.length <= 0 && !appointNode) {
return return
} }
let node = this.activeNodeList[0] const list = appointNode ? [appointNode] : this.activeNodeList
const node = list[0]
if (node.isRoot) { if (node.isRoot) {
return return
} }
@ -1013,11 +1014,12 @@ class Render {
} }
// 下移节点,多个节点只会操作第一个节点 // 下移节点,多个节点只会操作第一个节点
downNode() { downNode(appointNode) {
if (this.activeNodeList.length <= 0) { if (this.activeNodeList.length <= 0 && !appointNode) {
return return
} }
let node = this.activeNodeList[0] const list = appointNode ? [appointNode] : this.activeNodeList
const node = list[0]
if (node.isRoot) { if (node.isRoot) {
return return
} }
@ -1594,7 +1596,7 @@ class Render {
this.setNodeDataRender(node, data) this.setNodeDataRender(node, data)
// 更新了连线的样式 // 更新了连线的样式
if (lineStyleProps.includes(prop)) { if (lineStyleProps.includes(prop)) {
;(node.parent || node).renderLine(true) (node.parent || node).renderLine(true)
} }
} }
@ -1618,7 +1620,7 @@ class Render {
} }
}) })
if (hasLineStyleProps) { if (hasLineStyleProps) {
;(node.parent || node).renderLine(true) (node.parent || node).renderLine(true)
} }
} }