From c1fcf5485edd8ee96351a7ef3f663c5c12c0ec56 Mon Sep 17 00:00:00 2001 From: hanyuxia Date: Wed, 14 Aug 2024 10:42:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=9E=E4=BD=93=E5=85=B3=E7=B3=BB?= =?UTF-8?q?=E5=9B=BE=E4=BC=98=E5=8C=96:1.=E7=82=B9=E5=87=BB=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E8=8A=82=E7=82=B9=E6=97=B6=EF=BC=8C=E5=85=88=E5=9B=BA?= =?UTF-8?q?=E5=AE=9Alist=E8=8A=82=E7=82=B9=EF=BC=8C=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=E5=86=8D=E8=BF=9B=E8=A1=8Clist=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E7=9A=84=E9=87=8A=E6=94=BE=EF=BC=8C=E5=90=A6=E5=88=99?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=B8=B4=E6=97=B6=E8=8A=82=E7=82=B9=E6=97=B6?= =?UTF-8?q?=EF=BC=8Clist=E8=8A=82=E7=82=B9=E4=BC=9A=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E8=BE=83=E5=A4=9A=EF=BC=88=E4=B8=94=E5=B8=A6=E7=9D=80entity?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E4=B8=80=E8=B5=B7=E7=A7=BB=E5=8A=A8=EF=BC=89?= =?UTF-8?q?=EF=BC=9B2.=E8=87=AA=E9=80=82=E5=BA=94=E4=B8=8A=E4=B8=8B?= =?UTF-8?q?=E8=BE=B9=E8=B7=9D=E8=B0=83=E6=95=B4=EF=BC=9B3.=E4=B8=8A?= =?UTF-8?q?=E4=B8=80=E6=AD=A5=E6=93=8D=E4=BD=9C=E5=90=8E=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=B0=83=E6=95=B4=E4=BD=8D=E7=BD=AE=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/entityExplorer/EntityGraph.vue | 25 ++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/views/entityExplorer/EntityGraph.vue b/src/views/entityExplorer/EntityGraph.vue index d043f9a8..2be4e1f8 100644 --- a/src/views/entityExplorer/EntityGraph.vue +++ b/src/views/entityExplorer/EntityGraph.vue @@ -512,6 +512,9 @@ export default { this.rightBox.mode = 'detail' } } else { + //20240809 添加:点击临时节点时,先固定list节点,渲染之后再进行list节点的释放,否则点击临时节点时,list节点会移动较多(且带着entity节点一起移动) + this.fixNode(nodeType.listNode) + // 点击tempNode,根据source生成listNode和entityNode以及对应的edge。查完entityNode的接口再删除临时node和edge。 // 若已达第六层,则只生成listNode,不再展开entityNode const nodes = [] @@ -699,7 +702,7 @@ export default { }) }) .onEngineStop(() => { - //this.releaseNodes(this.graph.graphData().nodes,nodeType.listNode)//此处释放节点,会导致有一段时间,list节点为固定状态 + this.releaseNodes(this.graph.graphData().nodes,nodeType.listNode)//此处释放节点,会导致有一段时间,list节点为固定状态 }) .onEngineTick(() => { if (this.isClicking) { @@ -722,6 +725,19 @@ export default { } }) }, + //临时固定节点,之后会释放 + fixNode(nodeType) { + let listNodeGroup = this.graph.graphData().nodes.filter(n => n.type === nodeType) + if(listNodeGroup && listNodeGroup.length > 0) { + listNodeGroup.forEach(listNode => { + listNode.fx = listNode.x + listNode.fy = listNode.y + }) + setTimeout(() => { + //this.releaseNodes(this.graph.graphData().nodes,nodeType.listNode) + }, 300) + } + }, /* sleep() { for (let i = 0; i < 100000000*2; i++) { @@ -835,6 +851,8 @@ export default { links.splice(linksIndex, 1) } }) + this.graph.graphData({nodes:nodes,links:links}) + this.cleanTempItems() this.stackData.redo.push(data) if (this.stackData.justRedo) { @@ -854,12 +872,12 @@ export default { this.onCloseBlock() } } else if (code === 'autoZoom') { - this.graph.zoomToFit(100, 100) if(this.rightBox.show) { this.graph.width(document.body.clientWidth - this.rightBoxWidth) } else { this.graph.width(document.body.clientWidth) } + this.graph.zoomToFit(100, 30) } else if (code === 'zoomOut') { this.graph.zoom(this.graph.zoom() + 0.2) } else if (code === 'zoomIn') { @@ -1235,6 +1253,9 @@ export default { }, 100) }, async expandList (nodeId) { + //20240809 添加:点击临时节点时,先固定list节点,渲染之后再进行list节点的释放,否则点击临时节点时,list节点会移动较多(且带着entity节点一起移动) + this.fixNode(nodeType.listNode) + const { nodes } = this.graph.graphData() const node = nodes.find(n => n.id === nodeId) const sourceNode = nodes.find(n => n.id === node.sourceNode.id)