From f68d58e332796d9c648cfad64037a92a47e85c09 Mon Sep 17 00:00:00 2001 From: zk-phi Date: Wed, 25 Sep 2024 14:25:23 +0900 Subject: [PATCH] Render bounding box in dev-mode when nocrop is enabled --- src/utils/emoji.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils/emoji.ts b/src/utils/emoji.ts index 620eb135..b66edd6d 100644 --- a/src/utils/emoji.ts +++ b/src/utils/emoji.ts @@ -72,8 +72,13 @@ function renderFrameUncut( } if (noCrop) { - // copy webgl canvas with background to a 2d canvas - return cropCanvas(canvas, 0, 0, targetWidth * 2, targetHeight * 2, fillStyle); + // copy webgl canvas to a 2d canvas, with background + const result = cropCanvas(canvas, 0, 0, targetWidth * 2, targetHeight * 2, fillStyle); + const ctx = result.getContext("2d")!; + ctx.rect(targetWidth / 2, targetHeight / 2, targetWidth, targetHeight); + ctx.strokeStyle = "#8888"; + ctx.stroke(); + return result; } else { return cropCanvas( canvas,