Skip to content

Commit 5b16bd4

Browse files
committed
ScaleManager - minor fullscreenerror fixes
- IE9 compatibility (no setWindow arguments) - And removed code that assumpted event.target was the canvas.. (Actually adding the changes this time..)
1 parent d89c709 commit 5b16bd4

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

src/core/ScaleManager.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,18 +1247,19 @@ Phaser.ScaleManager.prototype = {
12471247
},
12481248

12491249
/**
1250-
* Tries to enter the browser into full screen mode.
1250+
* Tries to enter the browser into full screen mode - this _must_ be called from a user input Pointer or Mouse event.
12511251
*
12521252
* Fullscreen mode needs to be supported by the browser. It is _not_ the same as setting the game size to fill the browser window.
12531253
*
12541254
* The `fullScreenDailed` signal will be dispatched if the fullscreen change request failed or the game does not support the Fullscreen API.
1255-
*
1255+
*
12561256
* @method Phaser.ScaleManager#startFullScreen
12571257
* @public
12581258
* @param {boolean} [antialias] - Changes the anti-alias feature of the canvas before jumping in to full screen (false = retain pixel art, true = smooth art). If not specified then no change is made. Only works in CANVAS mode.
1259+
* @param {boolean} [allowTrampoline=undefined] - Internal argument. If false click trampolining is suppressed.
12591260
* @return {boolean} Returns true if the device supports fullscreen mode and fullscreen mode was attempted to be started. (It might not actually start, wait for the signals.)
12601261
*/
1261-
startFullScreen: function (antialias) {
1262+
startFullScreen: function (antialias, allowTrampoline) {
12621263

12631264
if (this.isFullScreen)
12641265
{
@@ -1267,13 +1268,26 @@ Phaser.ScaleManager.prototype = {
12671268

12681269
if (!this.supportsFullScreen)
12691270
{
1271+
// Error is called in timeout to emulate the real fullscreenerror event better
12701272
var _this = this;
12711273
setTimeout(function () {
12721274
_this.fullScreenError();
12731275
}, 10, this);
12741276
return;
12751277
}
12761278

1279+
// IE11 clicks trigger MSPointer which is not the mousePointer
1280+
// (The extra check for addClickTrampoline is to not break if that is not in..)
1281+
var input = this.game.input;
1282+
if (input.activePointer !== input.mousePointer &&
1283+
input.activePointer.addClickTrampoline &&
1284+
(allowTrampoline || allowTrampoline === undefined))
1285+
{
1286+
input.activePointer.addClickTrampoline(
1287+
"startFullScreen", this.startFullScreen, this, [antialias, false]);
1288+
return;
1289+
}
1290+
12771291
if (typeof antialias !== 'undefined' && this.game.renderType === Phaser.CANVAS)
12781292
{
12791293
this.game.stage.smoothed = antialias;

0 commit comments

Comments
 (0)