hbchen 11 сар өмнө
parent
commit
b614e4a79b

+ 8 - 6
src/views/sandbox_manage/index_new_version.vue

@@ -218,8 +218,10 @@ import { myGraph } from './common/gragh';
             this.graph.zoomToFit()
           })
         }else{
-          this.graph.fromJSON(newval);
-          this.graph.zoomToFit()
+          this.$nextTick(()=>{
+            this.graph.fromJSON(newval);
+            this.graph.zoomToFit()
+          })
         }
       }
 	  },
@@ -1182,11 +1184,11 @@ import { myGraph } from './common/gragh';
           const {x,y,width,height} = this.graph.getContentBBox(cells)
           let {tx,ty} = this.graph.translate()
           //给导出的svg增加一点宽高
-          svg.setAttribute('width',width+50)
-          svg.setAttribute('height',height+50) 
+          svg.setAttribute('width',width+60)
+          svg.setAttribute('height',height+60) 
           //设置viewBox使图像居中
-          svg.setAttribute('viewBox',`${x-25} ${y-25} ${width+50} ${height+50}`)
-          let gNode = svg.getElementsByClassName('x6-graph-svg-viewport')[0]
+          svg.setAttribute('viewBox',`${x-30} ${y-30} ${width+60} ${height+60}`)
+          // let gNode = svg.getElementsByClassName('x6-graph-svg-viewport')[0]
           // 去掉不该截图的添加图标
           let leftImg = svg.getElementsByClassName('left-topic-image')
           for (let i = 0; i < leftImg.length; i++) {