From 1b8e1c684bd821a8868f4bdd592e172f06ff534c Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Thu, 11 Feb 2021 10:44:29 -0500 Subject: [PATCH] Center Image more accurately --- commands/edit-image/rotate.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/commands/edit-image/rotate.js b/commands/edit-image/rotate.js index 06284069..4792e7e7 100644 --- a/commands/edit-image/rotate.js +++ b/commands/edit-image/rotate.js @@ -1,7 +1,6 @@ const Command = require('../../structures/Command'); const { createCanvas, loadImage } = require('canvas'); const request = require('node-superfetch'); -const { centerImage } = require('../../util/Canvas'); module.exports = class RotateCommand extends Command { constructor(client) { @@ -43,8 +42,7 @@ module.exports = class RotateCommand extends Command { ctx.translate(canvas.width / 2, canvas.height / 2); ctx.rotate(degrees * (Math.PI / 180)); ctx.translate(-(canvas.width / 2), -(canvas.height / 2)); - const { x, y, width, height } = centerImage(canvas, data); - ctx.drawImage(data, x, y, width, height); + ctx.drawImage(data, canvas.width / 2, canvas.height / 2); ctx.translate(canvas.width / 2, canvas.height / 2); ctx.rotate(-degrees * (Math.PI / 180)); const attachment = canvas.toBuffer();