From edfc921d48ecb12d8c7d96d65cb38099f6f2bcf1 Mon Sep 17 00:00:00 2001 From: HF Date: Fri, 23 Feb 2024 20:41:57 +0100 Subject: [PATCH] fix width calculation --- src/ui/render2Delements.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ui/render2Delements.js b/src/ui/render2Delements.js index dd9ca9b0..dbcf3b6b 100644 --- a/src/ui/render2Delements.js +++ b/src/ui/render2Delements.js @@ -140,14 +140,18 @@ export function renderOverlay( context.scale(offscreenScale, offscreenScale); context.globalAlpha = state.templates.oOpacity / 100; for (const template of templates) { - const tempWidth = template.x - x + width / 2 / offscreenScale; - const tempHeight = template.y - y + height / 2 / offscreenScale; - if (tempWidth < 1 || tempHeight < 1) continue; + if (template.width * offscreenScale < 1 + || template.height * offscreenScale < 1 + ) continue; const image = templateLoader.getTemplateSync(template.imageId); if (!image) continue; - context.drawImage(image, tempWidth, tempHeight); + context.drawImage( + image, + template.x - x + width / 2 / offscreenScale, + template.y - y + height / 2 / offscreenScale, + ); } context.restore(); }