From 9639f8670e1da72a532bea955f3cfe2a32e28b7d Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Fri, 24 Feb 2023 14:13:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dlayout=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugin/layout/layout.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugin/layout/layout.ts b/src/plugin/layout/layout.ts index 7fe5316..262818d 100644 --- a/src/plugin/layout/layout.ts +++ b/src/plugin/layout/layout.ts @@ -64,7 +64,13 @@ export class Layout { if (img instanceof Path2D) { this.ctx.fill(img); } else { - this.ctx.drawImage(img, sx, sy, sw!, sh!, dx!, dy!, dw!, dh!); + if (!has(sw)) { + this.ctx.drawImage(img, sx, sy); + } else if (!has(dx)) { + this.ctx.drawImage(img, sx, sy, sw, sh!); + } else { + this.ctx.drawImage(img, sx, sy, sw, sh!, dx, dy!, dw!, dh!); + } } }; if (type & Layout.IMAGE) {