fix width calculation

This commit is contained in:
HF 2024-02-23 20:41:57 +01:00
parent d2e2656c26
commit edfc921d48

View File

@ -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();
}