mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-25 12:17:22 +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
|
* @param {number} x
|
||||||
*/
|
*/
|
||||||
function setX(x) {
|
function setX(x) {
|
||||||
x = x - getCanvasWidth() / 2 - WINDOW_PIXEL_SIZE / 2;
|
let mod = getCanvasWidth() / -2 - (WINDOW_PIXEL_SIZE * (direction === Directions.RIGHT ? 2 : -2));
|
||||||
canvas.style.left = `${x}px`;
|
canvas.style.left = `${x + mod}px`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user