fix
This commit is contained in:
@@ -100,4 +100,21 @@ export class NodeManager {
|
||||
}
|
||||
return this.createNode(options_)
|
||||
}
|
||||
|
||||
copyNodeById(id: string) {
|
||||
const node = this.stateManager.getNodeById(id)
|
||||
const flowNode = this.stateManager.flowManager.getNodeById(id)
|
||||
console.log(node,this.stateManager.flowManager.getNodeById(id))
|
||||
if (!node) return console.warn(`copyNodeById: ${id}找不到对应节点`)
|
||||
const node_ = {
|
||||
...JSON.parse(JSON.stringify(node)),
|
||||
id: createId(),
|
||||
position: {
|
||||
x: node.position.x,
|
||||
y: node.position.y + (flowNode?.dimensions?.height || 0) + 50,
|
||||
}
|
||||
}
|
||||
this.stateManager.addNode(node_)
|
||||
// return this.createNode(options_)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,4 +127,12 @@ export class StateManager {
|
||||
setNodesDraggable(v: boolean) { this.nodesDraggable.value = v }
|
||||
/** 设置是否可以平移画布 */
|
||||
setPanOnDrag(v: boolean) { this.panOnDrag.value = v }
|
||||
/** 获取节点最大zIndex值 */
|
||||
getMaxZIndex() {
|
||||
return this.nodes.value.reduce((max, node) => Math.max(max, node.zIndex), 0)
|
||||
}
|
||||
/** 获取节点最小zIndex值 */
|
||||
getMinZIndex() {
|
||||
return this.nodes.value.reduce((min, node) => Math.min(min, node.zIndex), 0)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user