From 6763a32a6c5b17d63fecbeb367d8a838e70f8bc4 Mon Sep 17 00:00:00 2001 From: Idrees Hassan Date: Thu, 26 Dec 2024 11:18:31 -0500 Subject: [PATCH] Fix horizontal centering --- birb.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/birb.js b/birb.js index 99fca28..35d44b3 100644 --- a/birb.js +++ b/birb.js @@ -987,8 +987,8 @@ function roundToPixel(value) { * @param {number} x */ function setX(x) { - x = x - getCanvasWidth() / 2 - WINDOW_PIXEL_SIZE / 2; - canvas.style.left = `${x}px`; + let mod = getCanvasWidth() / -2 - (WINDOW_PIXEL_SIZE * (direction === Directions.RIGHT ? 2 : -2)); + canvas.style.left = `${x + mod}px`; } /**