Remove requestedFullscreenChange and replace with checking the document's fullscreen element

This commit is contained in:
Adam Beswick 2019-12-30 10:34:43 +00:00
parent e270d3afd8
commit cf4a4e2107

View file

@ -346,16 +346,6 @@ var ScaleManager = new Class({
*/
this._createdFullscreenTarget = false;
/**
* Internal var that keeps track of the user, or the browser, requesting fullscreen changes.
*
* @name Phaser.Scale.ScaleManager#_requestedFullscreenChange
* @type {boolean}
* @private
* @since 3.16.2
*/
this._requestedFullscreenChange = false;
/**
* The dirty state of the Scale Manager.
* Set if there is a change between the parent size and the current size.
@ -1238,8 +1228,6 @@ var ScaleManager = new Class({
{
var fsTarget = this.getFullscreenTarget();
this._requestedFullscreenChange = true;
var fsPromise;
if (fullscreen.keyboard)
@ -1382,8 +1370,6 @@ var ScaleManager = new Class({
if (fullscreen.active)
{
this._requestedFullscreenChange = true;
document[fullscreen.cancel]();
}
@ -1490,12 +1476,10 @@ var ScaleManager = new Class({
onFullScreenChange: function ()
{
// They pressed ESC while in fullscreen mode
if (!this._requestedFullscreenChange)
if (!(document.fullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement || document.mozFullScreenElement))
{
this.stopFullscreen();
}
this._requestedFullscreenChange = false;
},
/**