From 979e856a2c38c16b6521c5251477574941fc8e8e Mon Sep 17 00:00:00 2001 From: zhangyu Date: Mon, 13 Sep 2021 13:37:08 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-967=20fix:=20=E4=B8=8B=E6=BB=91=E6=A1=86=20?= =?UTF-8?q?=E5=86=85=20diagram=20=E5=9B=BE=E6=97=A0=E6=B3=95=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=20=E6=82=AC=E6=B5=AE=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/charts/chart-list-group.vue | 3 +++ nezha-fronted/src/components/charts/chart-list.vue | 3 +++ .../src/components/common/ChartDiagram/diagram.vue | 8 ++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/nezha-fronted/src/components/charts/chart-list-group.vue b/nezha-fronted/src/components/charts/chart-list-group.vue index 92781a361..4d61a3686 100644 --- a/nezha-fronted/src/components/charts/chart-list-group.vue +++ b/nezha-fronted/src/components/charts/chart-list-group.vue @@ -551,6 +551,9 @@ export default { const chartBox = document.getElementById('chart-' + item.id)// this.$refs['editChart'+item.id][0]; this.handleElementInViewport(chartBox, scrollTop, item, index) } + if (item.type === 'diagram') { + this.$refs['editChart' + item.id][0].resize() + } }) } }, diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index cf436f35c..6440e6d2d 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -742,6 +742,9 @@ export default { const chartBox = document.getElementById('chart-' + item.id)// this.$refs['editChart'+item.id][0]; this.handleElementInViewport(chartBox, scrollTop, item, index) } + if (item.type === 'diagram') { + this.$refs['editChart' + item.id][0].resize() + } if (item.type === 'group') { this.$refs['editChart' + item.id][0].$refs.listGroup.loadChartData(scrollTop) } diff --git a/nezha-fronted/src/components/common/ChartDiagram/diagram.vue b/nezha-fronted/src/components/common/ChartDiagram/diagram.vue index be358e613..1de3e3277 100644 --- a/nezha-fronted/src/components/common/ChartDiagram/diagram.vue +++ b/nezha-fronted/src/components/common/ChartDiagram/diagram.vue @@ -732,16 +732,16 @@ export default { }) } }) - this.winResize() - },200) + }) // if(this.fromPrev){ // getTopology(this.topologyIndex).scaleTo(data.scale/2) // } // getTopology(this.topologyIndex).fitView(); this.oldTopologyData = JSON.stringify(getTopology(this.topologyIndex).data) - this.getNodesArr() + this.winResize() }) } + this.winResize() }) }) }, @@ -2052,7 +2052,7 @@ export default { winResize () { setTimeout(() => { - const domRect = document.getElementById('topology-canvas' + this.topologyIndex).getBoundingClientRect() + const domRect = getTopology(this.topologyIndex).divLayer.canvas.getBoundingClientRect() getTopology(this.topologyIndex).canvasPos = domRect if (this.fromOverView) { getTopology(this.topologyIndex).open(this.oldTopologyData)