panovsky

stopFullScreen (resize) on mobileDevices

Recommended Posts

Hi all!

On start canvas must be 400*225, when user need more details - canvas resize to 1280*720 and go fullscreen. 


To enter/exit fullscreen i use this code

// my default scaleManager parameters
    game.scale.minWidth = 400;
    game.scale.minHeight = 225;
    game.scale.maxWidth = 400;
    game.scale.maxHeight = 225;
    game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
    game.scale.pageAlignHorizontally = true;
    game.scale.pageAlignVertically = true;
    game.scale.updateLayout(true);
    game.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT;


// ENTER
function fsEnter(){
if (!game.scale.isFullScreen) {
    game.scale.maxWidth = 1280;
    game.scale.maxHeight = 720;
     
    game.scale.startFullScreen();
    game.scale.refresh();
}
}


// EXIT
function fsExit(){
if (game.scale.isFullScreen) {
    game.scale.maxWidth = 400;
    game.scale.maxHeight = 225;
    
    game.scale.stopFullScreen();
    game.scale.refresh();
}
} 

it's all ok on pc-browsers, but on mobile-devices i can only enter to full screen (on mobile - canvas stretch to fill).

When i try to "exit from fullscreen mode" on mobile-devices - canvas is not resize to 400*225.
Please explain - how to solve this problem?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.