From 01340bb13ce31e51abaac150e5294b7b10e64005 Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Sat, 19 Aug 2023 22:13:40 +0800 Subject: [PATCH] fix: drawing background size error #254 --- src/editor/core/draw/Draw.ts | 2 +- src/editor/core/draw/frame/Background.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/editor/core/draw/Draw.ts b/src/editor/core/draw/Draw.ts index 293e406..f43f137 100644 --- a/src/editor/core/draw/Draw.ts +++ b/src/editor/core/draw/Draw.ts @@ -1679,7 +1679,7 @@ export class Draw { ctx.globalAlpha = !this.zone.isMainActive() ? inactiveAlpha : 1 this._clearPage(pageNo) // 绘制背景 - this.background.render(ctx) + this.background.render(ctx, pageNo) // 绘制页边距 this.margin.render(ctx, pageNo) // 渲染元素 diff --git a/src/editor/core/draw/frame/Background.ts b/src/editor/core/draw/frame/Background.ts index b05f8e4..ea736ca 100644 --- a/src/editor/core/draw/frame/Background.ts +++ b/src/editor/core/draw/frame/Background.ts @@ -7,9 +7,9 @@ export class Background { this.draw = draw } - public render(ctx: CanvasRenderingContext2D) { - const width = this.draw.getOriginalWidth() - const height = this.draw.getOriginalHeight() + public render(ctx: CanvasRenderingContext2D, pageNo: number) { + const width = this.draw.getCanvasWidth(pageNo) + const height = this.draw.getCanvasHeight(pageNo) ctx.save() ctx.fillStyle = '#ffffff' ctx.fillRect(0, 0, width, height)