fix: set paper size error #181

pr675
Hufe921 3 years ago
parent 86569f51d3
commit 10ada8cf54

@ -656,15 +656,17 @@ export class Draw {
} }
public setPaperSize(width: number, height: number) { public setPaperSize(width: number, height: number) {
const dpr = window.devicePixelRatio
this.options.width = width this.options.width = width
this.options.height = height this.options.height = height
this.container.style.width = `${width}px` const dpr = window.devicePixelRatio
const realWidth = this.getWidth()
const realHeight = this.getHeight()
this.container.style.width = `${realWidth}px`
this.pageList.forEach((p, i) => { this.pageList.forEach((p, i) => {
p.width = width * dpr p.width = realWidth * dpr
p.height = height * dpr p.height = realHeight * dpr
p.style.width = `${width}px` p.style.width = `${realWidth}px`
p.style.height = `${height}px` p.style.height = `${realHeight}px`
this._initPageContext(this.ctxList[i]) this._initPageContext(this.ctxList[i])
}) })
this.render({ this.render({

Loading…
Cancel
Save