|
|
@@ -33,13 +33,14 @@ export default class Product {
|
|
|
static graphJson = null //图形对象
|
|
|
static deleteNodeList = null//被删除节点
|
|
|
static nodeClickValue = null//点击节点
|
|
|
+ static nodeChangeMethod = null//节点改变
|
|
|
static graph = null //图形对象
|
|
|
static embedPadding = 30 // 触发群组动态调整大小的padding
|
|
|
ctrlPressed = false//ctrl键是是否按下
|
|
|
|
|
|
|
|
|
// region 初始化图形
|
|
|
- static init(dom, graphJson, deleteNodeList, nodeClickValue, readonly = false) {
|
|
|
+ static init(dom, graphJson, deleteNodeList, nodeClickValue, nodeChange, readonly = false) {
|
|
|
if (this.graph){
|
|
|
//销毁画布
|
|
|
this.graph.dispose()
|
|
|
@@ -48,6 +49,7 @@ export default class Product {
|
|
|
this.graphJson = graphJson
|
|
|
this.deleteNodeList = deleteNodeList
|
|
|
this.nodeClickValue = nodeClickValue
|
|
|
+ this.nodeChangeMethod = nodeChange
|
|
|
// region 画布配置
|
|
|
this.graph = new Graph({
|
|
|
container: dom,//获取节点
|
|
|
@@ -486,6 +488,8 @@ export default class Product {
|
|
|
if (children && children.length) {
|
|
|
node.prop('originSize', node.getSize())
|
|
|
}
|
|
|
+
|
|
|
+ this.nodeChangeMethod(node)
|
|
|
})
|
|
|
|
|
|
this.graph.on('node:change:position', ({ node, options }) => {
|
|
|
@@ -555,6 +559,8 @@ export default class Product {
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ this.nodeChangeMethod(node)
|
|
|
})
|
|
|
// endregion
|
|
|
|