Jump to content

How to prevent user from zooming in the game?


Tommy_
 Share

Recommended Posts

I have a platform game and I want my game to fit the page so in config i used this:

width: window.innerWidth, 
height: window.innerHeight

now the problem is when the player zoom out he can see more of the game world and i don't want that... I did some research and apparently there is no way to disable the browser zooming feature (right?),

so how can I prevent user from zooming in the game?

Link to comment
Share on other sites

But as far as I'm concerned zooming the browser window doesn't affect the canvas's world size. Are you using any plugins? How does your game work? I'd appreciate some screenshots of the problem before and after zoom and with dev tools on the canvas and your camera controlling code; In the meantime maybe you could fix the problem with camera's methods such as scene.cameras.main.setSize(width,height). It would in theory just set the camera's size to a hardcoded number so that the player can't see anything beside it. Not ideal but maybe it's enough for you.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...