Skip to content

Commit 54fbe73

Browse files
committed
applu scale for domtoimage
1 parent ec70d23 commit 54fbe73

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

js/text.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// import html2canvas from 'html2canvas/dist/html2canvas.min';
21
import { KEYS } from './utils';
32
import { tr } from './translation';
43
import domtoimage from 'dom-to-image';
@@ -205,7 +204,14 @@ export default class TextTool {
205204
const origBorder = this.input.style.border;
206205
const scale = this.main.getScale();
207206
this.input.style.border = 'none';
208-
domtoimage.toPng(this.input)
207+
domtoimage.toPng(this.input, {
208+
style: {
209+
'transform-origin': 'top left',
210+
transform: `scale(${scale})`
211+
},
212+
width: this.input.clientWidth * scale,
213+
height: this.input.clientHeight * scale,
214+
})
209215
.then((dataUrl) => {
210216
const img = new Image();
211217
img.src = dataUrl;

0 commit comments

Comments
 (0)