fix:init page context when paper change
This commit is contained in:
@@ -504,15 +504,12 @@ export class Draw {
|
|||||||
const height = this.getHeight()
|
const height = this.getHeight()
|
||||||
this.container.style.width = `${width}px`
|
this.container.style.width = `${width}px`
|
||||||
this.pageList.forEach((p, i) => {
|
this.pageList.forEach((p, i) => {
|
||||||
p.width = width
|
p.width = width * dpr
|
||||||
p.height = height
|
p.height = height * dpr
|
||||||
p.style.width = `${width}px`
|
p.style.width = `${width}px`
|
||||||
p.style.height = `${height}px`
|
p.style.height = `${height}px`
|
||||||
p.style.marginBottom = `${this.getPageGap()}px`
|
p.style.marginBottom = `${this.getPageGap()}px`
|
||||||
// 分辨率
|
this._initPageContext(this.ctxList[i])
|
||||||
p.width = width * dpr
|
|
||||||
p.height = height * dpr
|
|
||||||
this.ctxList[i].scale(dpr, dpr)
|
|
||||||
})
|
})
|
||||||
this.render({
|
this.render({
|
||||||
isSubmitHistory: false,
|
isSubmitHistory: false,
|
||||||
@@ -530,7 +527,7 @@ export class Draw {
|
|||||||
this.pageList.forEach((p, i) => {
|
this.pageList.forEach((p, i) => {
|
||||||
p.width = width * dpr
|
p.width = width * dpr
|
||||||
p.height = height * dpr
|
p.height = height * dpr
|
||||||
this.ctxList[i].scale(dpr, dpr)
|
this._initPageContext(this.ctxList[i])
|
||||||
})
|
})
|
||||||
this.render({
|
this.render({
|
||||||
isSubmitHistory: false,
|
isSubmitHistory: false,
|
||||||
@@ -539,14 +536,16 @@ 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`
|
this.container.style.width = `${width}px`
|
||||||
this.pageList.forEach(p => {
|
this.pageList.forEach((p, i) => {
|
||||||
p.width = width
|
p.width = width * dpr
|
||||||
p.height = height
|
p.height = height * dpr
|
||||||
p.style.width = `${width}px`
|
p.style.width = `${width}px`
|
||||||
p.style.height = `${height}px`
|
p.style.height = `${height}px`
|
||||||
|
this._initPageContext(this.ctxList[i])
|
||||||
})
|
})
|
||||||
this.render({
|
this.render({
|
||||||
isSubmitHistory: false,
|
isSubmitHistory: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user