|
@@ -879,6 +879,12 @@ import addLInkDia from './components/addLInkDia.vue';
|
|
},{
|
|
},{
|
|
preserveDimensions:false,//让svg为实际图片大小
|
|
preserveDimensions:false,//让svg为实际图片大小
|
|
beforeSerialize:(svg)=>{
|
|
beforeSerialize:(svg)=>{
|
|
|
|
+ let shouldRemoveElement = svg.querySelectorAll('.right-topic-image,.left-topic-image')
|
|
|
|
+ for (let i = 0; i < shouldRemoveElement.length; i++) {
|
|
|
|
+ const element = shouldRemoveElement[i];
|
|
|
|
+ element.remove()
|
|
|
|
+ }
|
|
|
|
+
|
|
const {x,y,width,height} = this.graph.getContentBBox(cells)
|
|
const {x,y,width,height} = this.graph.getContentBBox(cells)
|
|
// let {tx,ty} = this.graph.translate()
|
|
// let {tx,ty} = this.graph.translate()
|
|
//给导出的svg增加一点宽高
|
|
//给导出的svg增加一点宽高
|
|
@@ -887,7 +893,6 @@ import addLInkDia from './components/addLInkDia.vue';
|
|
//设置viewBox使图像居中
|
|
//设置viewBox使图像居中
|
|
svg.setAttribute('viewBox',`${x-25} ${y-25} ${width+50} ${height+50}`)
|
|
svg.setAttribute('viewBox',`${x-25} ${y-25} ${width+50} ${height+50}`)
|
|
// let gNode = svg.getElementsByClassName('x6-graph-svg-viewport')[0]
|
|
// let gNode = svg.getElementsByClassName('x6-graph-svg-viewport')[0]
|
|
- // console.log(leftImg,rightImg,'rightImg');
|
|
|
|
|
|
|
|
// let textNode = document.createElement('text')
|
|
// let textNode = document.createElement('text')
|
|
// textNode.setAttribute('x',x-tx+width-90)
|
|
// textNode.setAttribute('x',x-tx+width-90)
|
|
@@ -898,19 +903,7 @@ import addLInkDia from './components/addLInkDia.vue';
|
|
// gNode.appendChild(textNode)
|
|
// gNode.appendChild(textNode)
|
|
},
|
|
},
|
|
copyStyles:false,
|
|
copyStyles:false,
|
|
- stylesheet: `
|
|
|
|
- svg{
|
|
|
|
- background-color:white;
|
|
|
|
- }
|
|
|
|
- .x6-port {
|
|
|
|
- visibility: hidden;
|
|
|
|
- }
|
|
|
|
- .left-topic-image{
|
|
|
|
- visibility:hidden;
|
|
|
|
- }
|
|
|
|
- .right-topic-image{
|
|
|
|
- visibility: hidden;
|
|
|
|
- }`
|
|
|
|
|
|
+ stylesheet: `svg{background-color:white;} .x6-port{visibility: hidden;}`
|
|
|
|
|
|
})
|
|
})
|
|
},500),
|
|
},500),
|
|
@@ -972,6 +965,11 @@ import addLInkDia from './components/addLInkDia.vue';
|
|
},{
|
|
},{
|
|
preserveDimensions:true,//让svg为实际图片大小
|
|
preserveDimensions:true,//让svg为实际图片大小
|
|
beforeSerialize:(svg)=>{
|
|
beforeSerialize:(svg)=>{
|
|
|
|
+ let shouldRemoveElement = svg.querySelectorAll('.right-topic-image,.left-topic-image')
|
|
|
|
+ for (let i = 0; i < shouldRemoveElement.length; i++) {
|
|
|
|
+ const element = shouldRemoveElement[i];
|
|
|
|
+ element.remove()
|
|
|
|
+ }
|
|
// const zoom = this.graph.zoom();
|
|
// const zoom = this.graph.zoom();
|
|
const {x,y,width,height} = this.graph.getContentBBox(cells)
|
|
const {x,y,width,height} = this.graph.getContentBBox(cells)
|
|
// let {tx,ty} = this.graph.translate() // 画布偏移量
|
|
// let {tx,ty} = this.graph.translate() // 画布偏移量
|
|
@@ -991,20 +989,7 @@ import addLInkDia from './components/addLInkDia.vue';
|
|
// gNode.appendChild(textNode)
|
|
// gNode.appendChild(textNode)
|
|
},
|
|
},
|
|
copyStyles:false,
|
|
copyStyles:false,
|
|
- stylesheet: `
|
|
|
|
- svg{
|
|
|
|
- background-color:white;
|
|
|
|
- }
|
|
|
|
- .x6-port {
|
|
|
|
- visibility: hidden;
|
|
|
|
- }
|
|
|
|
- .left-topic-image{
|
|
|
|
- visibility:hidden;
|
|
|
|
- }
|
|
|
|
- .right-topic-image{
|
|
|
|
- visibility: hidden;
|
|
|
|
- }
|
|
|
|
- `
|
|
|
|
|
|
+ stylesheet: `svg{background-color:white;} .x6-port{visibility: hidden;}`
|
|
})
|
|
})
|
|
|
|
|
|
},500),
|
|
},500),
|