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)