Skip to content

Commit 1bf3f08

Browse files
committed
Merge pull request phaserjs#1420 from pnstickne/wip-1406
Fix Full Screen launching in Android Chrome
2 parents 38a224d + 388ab1d commit 1bf3f08

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

src/core/ScaleManager.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -442,14 +442,20 @@ Phaser.ScaleManager = function (game, width, height) {
442442
* @property {boolean} [forceMinimumDocumentHeight=false] - If enabled the document elements minimum height is explicity set on updates.
443443
*
444444
* @property {boolean} [canExpandParent=true] - If enabled then SHOW_ALL and USER_SCALE modes can try and expand the parent element. It may be necessary for the parent element to impose CSS width/height restrictions.
445+
*
446+
* @property {string} [clickTrampoline=(auto)] - On certain browsers (eg. IE) FullScreen events need to be triggered via 'click' events.
447+
* A value of 'when-not-mouse' uses a click trampoline when a pointer that is not the primary mouse is used.
448+
* Any other string value (including the empty string) prevents using click trampolines.
449+
* For more details on click trampolines see {@link Phaser.Pointer#addClickTrampoline}.
445450
*/
446451
this.compatibility = {
447452
supportsFullScreen: false,
448453
orientationFallback: null,
449454
noMargins: false,
450455
scrollTo: null,
451456
forceMinimumDocumentHeight: false,
452-
canExpandParent: true
457+
canExpandParent: true,
458+
clickTrampoline: ''
453459
};
454460

455461
/**
@@ -692,10 +698,12 @@ Phaser.ScaleManager.prototype = {
692698
if (this.game.device.desktop)
693699
{
694700
compat.orientationFallback = 'screen';
701+
compat.clickTrampoline = 'when-not-mouse';
695702
}
696703
else
697704
{
698705
compat.orientationFallback = '';
706+
compat.clickTrampoline = '';
699707
}
700708

701709
// Configure event listeners
@@ -1777,13 +1785,17 @@ Phaser.ScaleManager.prototype = {
17771785
return;
17781786
}
17791787

1780-
// IE11 clicks trigger MSPointer which is not the mousePointer
1781-
var input = this.game.input;
1782-
1783-
if (input.activePointer !== input.mousePointer && (allowTrampoline || allowTrampoline !== false))
1788+
if (this.compatibility.clickTrampoline === 'when-not-mouse')
17841789
{
1785-
input.activePointer.addClickTrampoline("startFullScreen", this.startFullScreen, this, [antialias, false]);
1786-
return;
1790+
var input = this.game.input;
1791+
1792+
if (input.activePointer &&
1793+
input.activePointer !== input.mousePointer &&
1794+
(allowTrampoline || allowTrampoline !== false))
1795+
{
1796+
input.activePointer.addClickTrampoline("startFullScreen", this.startFullScreen, this, [antialias, false]);
1797+
return;
1798+
}
17871799
}
17881800

17891801
if (typeof antialias !== 'undefined' && this.game.renderType === Phaser.CANVAS)

0 commit comments

Comments
 (0)