Jump to content

How to prevent user from zooming in the game?


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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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