Rotating Phone Seems To Affect Zoom

I don’t know exactly how to ask this question , because I don’t think it is actually the Phaser specific zoom variable thats afffected. However , I have this event listener to resize my game.

window.addEventListener('resize', function (event) {
  let newWidth = window.innerWidth
  let newHeight = window.innerHeight 

  if((newWidth % 2) != 0) newWidth--
  if((newHeight % 2) != 0) newHeight--

  game.scale.resize(newWidth , newHeight)
 }, false);

If I flip my phone from vertical , to horizontal , and back to vertical the game appears to be zoomed way out. Can anyone give me insight or lead me down the path to fixing this? (Pictures below)

Original Vertical Orientation

Rotated phone sideways

Rotated Phone Vertical once more

I think you can try

<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
1 Like

Thanks Samme! thats exactly what I needed , I had an initial-scale=1 instead of a minimum and maximum.