Growler

MelonJS 5.1 - requestFullScreen changes pointer locations

Recommended Posts

Hello,

I'm on a Macbook Pro 15" monitor, on Google Chrome. MelonJS 5.1. 640 x 480 dimension.

if (!me.video.init(640, 480, {
        wrapper: 'screen',
        scale: 'auto',
		scaleMethod: 'fit',
        renderer: me.video.AUTO,
        subPixel: false,
    })) {
    alert('Your browser does not support HTML5 canvas.');
    return;
}

I'm trying to request full screen. I'm using DOM elements for the GUI, so I'm requesting full screen on documentElement:

      me.device.requestFullscreen(document.documentElement);

When I change to full screen, there's no issues with my pointer events— e.gameX, e.gameY.

When I exit full screen, e.gameY seems to be permanently offset by the height difference expanding back to normal viewport, by about 84 pixels. 

This only happens when I have Chrome console closed. If Chrome console is open, there's no issue with e.gameY.

Clicking in the same exact location each time, I get:

Normal browser viewport:

e.gameX: 3018.744

e.gameY: 2284.550

Full screen: 

e.gameX: 3018.138

e.gameY: 2284.371

Exited full screen:

e.gameX: 3018.465

e.gameY: 2367.873

Why does this happen?

Edited by Growler

Share this post


Link to post
Share on other sites

before version 7.0, there were some issues indeed when the game was embedded in a complex css layouts, this has been fixed here if you want to back port the change to version 5.1 and see if it fixed it :

https://github.com/melonjs/melonJS/commit/7b1301c492654e4f59c6fc7d46c092f3ac3d1466#diff-7dc57d2221a69e771261f215eefd8926

 

this say,  you should reaaaally consider updating, the improvements since 5.x up to 8.0 that is to be released soon are huge now , and solves many of the issues you have reported here :

https://github.com/melonjs/melonJS/blob/master/CHANGELOG

and also since version 6.0 we provide backward compatibility as much as possible when changing the API, so by following the updated guide (even by one version at the time) it should not be difficult task https://github.com/melonjs/melonJS/wiki/Upgrade-Guide

 

Edited by obiot

Share this post


Link to post
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.

Guest
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.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.