Skip to content

Commit

Permalink
feat: autoscroll to Game
Browse files Browse the repository at this point in the history
  • Loading branch information
dhmmasson committed Oct 10, 2024
1 parent 6dcc32b commit cfe3b1b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,19 @@ function setup() {
// Create canvas and put it in the canvas div to guess the size
textFont("Cabin Sketch");
imageMode(CENTER);
createCanvas(Game.board.size.width, Game.board.size.height).parent("#canvas");
c = createCanvas(Game.board.size.width, Game.board.size.height).parent(
"#canvas"
);
windowResized();

const scroll = () => {
window.scrollBy({
top: c.elt.getBoundingClientRect().top - 10,
behavior: "smooth",
});
};
setTimeout(scroll, 100);

//startGame();
}

Expand Down

0 comments on commit cfe3b1b

Please sign in to comment.