Skip to content

Commit a6b925e

Browse files
authored
Merge pull request #1430 from sn3ha-dev278/fix-export-zoom
Make sure SVG and PNG exports are not affected by the zoom level
2 parents 8cfbe01 + 07b3d9e commit a6b925e

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

td.vue/src/components/GraphButtons.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,26 @@ export default {
139139
},
140140
async exportPNG() {
141141
await this.withSelectionCleared(() => {
142-
this.graph.exportPNG(`${this.diagram.title}.png`, {
143-
padding: 50
144-
});
142+
const currentZoom = this.graph.zoom();
143+
try {
144+
this.graph.zoomTo(1);
145+
this.graph.exportPNG(`${this.diagram.title}.png`, {
146+
padding: 50
147+
});
148+
}finally{
149+
this.graph.zoomTo(currentZoom);
150+
}
145151
});
146152
},
147153
async exportSVG() {
148154
await this.withSelectionCleared(() => {
149-
this.graph.exportSVG(`${this.diagram.title}.svg`);
155+
const currentZoom = this.graph.zoom();
156+
try{
157+
this.graph.zoomTo(1);
158+
this.graph.exportSVG(`${this.diagram.title}.svg`);
159+
}finally{
160+
this.graph.zoomTo(currentZoom);
161+
}
150162
});
151163
},
152164
async withSelectionCleared(fn) {

0 commit comments

Comments
 (0)