From 7485792f1acbfe6c564903f37f9c07755e71ef2a Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Fri, 12 Jun 2020 10:48:24 -0400 Subject: [PATCH] Fix --- commands/edit-image/yu-gi-oh-gen.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/commands/edit-image/yu-gi-oh-gen.js b/commands/edit-image/yu-gi-oh-gen.js index 71f0b70f..03303219 100644 --- a/commands/edit-image/yu-gi-oh-gen.js +++ b/commands/edit-image/yu-gi-oh-gen.js @@ -113,13 +113,14 @@ module.exports = class YuGiOhGenCommand extends Command { const ctx = canvas.getContext('2d'); ctx.fillStyle = 'white'; ctx.fillRect(0, 0, base.width, base.height); - const { x, y, width, height } = centerImagePart(data, 590, 590, 109, 241); - ctx.drawImage(data, x, y, width, height); + const { x, y } = centerImagePart(data, 590, 590, 109, 241); + const height = 590 / data.width; + ctx.drawImage(data, x, y, 590, height); ctx.drawImage(base, 0, 0); ctx.drawImage(atr, 669, 61, 77, 77); for (let i = 0; i < level; i++) { - const x = 676 - (50 * i) - (5 * i); - ctx.drawImage(levelI, x, 160, 50, 50); + const levelX = 676 - (50 * i) - (5 * i); + ctx.drawImage(levelI, levelX, 160, 50, 50); } ctx.font = '14px Noto'; ctx.fillStyle = 'black';