forked from ppfun/pixelplanet
fix width calculation
This commit is contained in:
parent
d2e2656c26
commit
edfc921d48
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user