From 7da6f4d747a10d425f0d272dc94d04a49bf5e811 Mon Sep 17 00:00:00 2001 From: "J.C" <1571995@qq.com> Date: Tue, 21 Dec 2021 17:18:35 +0800 Subject: [PATCH] in canvas mode, don't draw stuff with no size, it will throws error, and actually unnecessary. --- src/renderer/canvas/CanvasRenderer.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/renderer/canvas/CanvasRenderer.js b/src/renderer/canvas/CanvasRenderer.js index 7a72f370d..6ee717051 100644 --- a/src/renderer/canvas/CanvasRenderer.js +++ b/src/renderer/canvas/CanvasRenderer.js @@ -818,7 +818,10 @@ var CanvasRenderer = new Class({ sprite.mask.preRenderCanvas(this, sprite, camera); } - ctx.drawImage(frame.source.image, frameX, frameY, frameWidth, frameHeight, x, y, frameWidth / res, frameHeight / res); + if (frameWidth > 0 && frameHeight > 0) + { + ctx.drawImage(frame.source.image, frameX, frameY, frameWidth, frameHeight, x, y, frameWidth / res, frameHeight / res); + } if (sprite.mask) {