mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-25 04:07:23 +00:00
Fix horizontal centering
This commit is contained in:
4
birb.js
4
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`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user