@@ -326,7 +326,7 @@ Phaser.ScaleManager = function (game, width, height) {
326326 * @protected
327327 * @readonly
328328 */
329- this . supportsFullScreen = game . device . fullscreen && ! game . device . cocoonJS ;
329+ this . supportsFullScreen = false ;
330330
331331 /**
332332 * The original width/height properties of the manager when fullscreen started.
@@ -533,6 +533,8 @@ Phaser.ScaleManager.prototype = {
533533 */
534534 boot : function ( ) {
535535
536+ this . supportsFullScreen = this . game . device . fullscreen && ! this . game . device . cocoonJS ;
537+
536538 // Now the canvas has been created we can target it
537539 this . fullScreenTarget = this . game . canvas ;
538540
@@ -737,15 +739,15 @@ Phaser.ScaleManager.prototype = {
737739 } ,
738740
739741 /**
740- * Checks if the browser is in the correct orientation for the game, dependent upon `forceLandscape` and `forcePortrait`.
742+ * Checks if the browser is in the correct orientation for the game, dependent upon `forceLandscape` and `forcePortrait`, and updates the state .
741743 *
742744 * The appropriate event is dispatched if the orientation became valid or invalid.
743745 *
744- * @method Phaser.ScaleManager#checkOrientationState
746+ * @method Phaser.ScaleManager#updateOrientationState
745747 * @private
746748 * @return {boolean } True if the orientation state changed (consider a refresh)
747749 */
748- checkOrientationState : function ( ) {
750+ updateOrientationState : function ( ) {
749751
750752 // They are in the wrong orientation
751753 if ( this . incorrectOrientation )
@@ -885,7 +887,7 @@ Phaser.ScaleManager.prototype = {
885887 }
886888 }
887889
888- if ( this . checkOrientationState ( ) &&
890+ if ( this . updateOrientationState ( ) &&
889891 ( scaleMode !== Phaser . ScaleManager . NO_SCALE ) )
890892 {
891893 this . refresh ( ) ;
@@ -982,7 +984,7 @@ Phaser.ScaleManager.prototype = {
982984
983985 if ( this . incorrectOrientation )
984986 {
985- this . setToWindow ( ) ;
987+ this . setMaximum ( ) ;
986988 }
987989 else
988990 {
@@ -1001,7 +1003,7 @@ Phaser.ScaleManager.prototype = {
10011003 }
10021004 }
10031005
1004- this . updateCanvas ( ) ;
1006+ this . reflowCanvas ( ) ;
10051007
10061008 this . _updateSize = false ;
10071009 clearInterval ( this . _resizeIntervalId ) ;
@@ -1044,10 +1046,10 @@ Phaser.ScaleManager.prototype = {
10441046 /**
10451047 * Update the canvas position/margins - for alignment within the parent container.
10461048 *
1047- * @method Phaser.ScaleManager#updateCanvasPosition
1049+ * @method Phaser.ScaleManager#alignCanvas
10481050 * @private
10491051 */
1050- updateCanvasPosition : function ( ) {
1052+ alignCanvas : function ( ) {
10511053
10521054 // For fullscreen where the fullScreenTarget is the canvas it
10531055 // is may be possible to set the margins to 0 and avoid a wee bit of math.
@@ -1099,10 +1101,10 @@ Phaser.ScaleManager.prototype = {
10991101 /**
11001102 * Updates the size/position of the canvas based on internal state.
11011103 *
1102- * @method Phaser.ScaleManager#updateCanvas
1104+ * @method Phaser.ScaleManager#reflowCanvas
11031105 * @private
11041106 */
1105- updateCanvas : function ( ) {
1107+ reflowCanvas : function ( ) {
11061108
11071109 var scaleMode = this . currentScaleMode ;
11081110
@@ -1134,7 +1136,7 @@ Phaser.ScaleManager.prototype = {
11341136
11351137 if ( this . pageAlignHorizontally || this . pageAlignVertically )
11361138 {
1137- this . updateCanvasPosition ( ) ;
1139+ this . alignCanvas ( ) ;
11381140 }
11391141
11401142 Phaser . Canvas . getOffset ( this . game . canvas , this . offset ) ;
@@ -1149,7 +1151,7 @@ Phaser.ScaleManager.prototype = {
11491151 this . scaleFactorInversed . x = this . width / this . game . width ;
11501152 this . scaleFactorInversed . y = this . height / this . game . height ;
11511153
1152- if ( this . checkOrientationState ( ) &&
1154+ if ( this . updateOrientationState ( ) &&
11531155 ( scaleMode !== Phaser . ScaleManager . NO_SCALE ) )
11541156 {
11551157 this . refresh ( ) ;
@@ -1175,10 +1177,10 @@ Phaser.ScaleManager.prototype = {
11751177 /**
11761178 * Updates the width/height to that of the window.
11771179 *
1178- * @method Phaser.ScaleManager#setToWindow
1180+ * @method Phaser.ScaleManager#setMaximum
11791181 * @private
11801182 */
1181- setToWindow : function ( ) {
1183+ setMaximum : function ( ) {
11821184
11831185 this . width = window . innerWidth ;
11841186 this . height = window . innerHeight ;
@@ -1268,6 +1270,7 @@ Phaser.ScaleManager.prototype = {
12681270 setTimeout ( function ( scaleManager ) {
12691271 scaleManager . fullScreenError ( ) ;
12701272 } , 10 , this ) ;
1273+ return ;
12711274 }
12721275
12731276 if ( typeof antialias !== 'undefined' && this . game . renderType === Phaser . CANVAS )
@@ -1462,6 +1465,54 @@ Phaser.ScaleManager.prototype = {
14621465
14631466Phaser . ScaleManager . prototype . constructor = Phaser . ScaleManager ;
14641467
1468+ /**
1469+ * window.resize event handler.
1470+ * @method checkResize
1471+ * @memberof Phaser.ScaleManager
1472+ * @protected
1473+ * @deprecated 2.1.4 - Internal. _Do not use_
1474+ */
1475+ Phaser . ScaleManager . prototype . checkResize = Phaser . ScaleManager . prototype . windowResize ;
1476+
1477+ /**
1478+ * window.orientationchange event handler.
1479+ * @method checkOrientation
1480+ * @memberof Phaser.ScaleManager
1481+ * @protected
1482+ * @deprecated 2.1.4 - Internal. _Do not use_
1483+ */
1484+ Phaser . ScaleManager . prototype . checkOrientation = Phaser . ScaleManager . prototype . orientationChange ;
1485+
1486+ /**
1487+ * Updates the size/position of the canvas based on internal state.
1488+ * @method setSize
1489+ * @memberof Phaser.ScaleManager
1490+ * @protected
1491+ * @deprecated 2.1.4 - Internal. Use `refresh` if needed.
1492+ */
1493+ Phaser . ScaleManager . prototype . setSize = Phaser . ScaleManager . prototype . reflowCanvas ;
1494+
1495+ /**
1496+ * Checks if the browser is in the correct orientation for the game, dependent upon `forceLandscape` and `forcePortrait`, and updates the state.
1497+ *
1498+ * The appropriate event is dispatched if the orientation became valid or invalid.
1499+ *
1500+ * @method checkOrientationState
1501+ * @memberof Phaser.ScaleManager
1502+ * @protected
1503+ * @return {boolean } True if the orientation state changed (consider a refresh)
1504+ * @deprecated 2.1.4 - This is only for backward compatibility of user code.
1505+ */
1506+ Phaser . ScaleManager . prototype . checkOrientationState = function ( ) {
1507+
1508+ if ( this . updateOrientationState ( ) &&
1509+ ( this . currentScaleMode !== Phaser . ScaleManager . NO_SCALE ) )
1510+ {
1511+ this . refresh ( ) ;
1512+ }
1513+
1514+ } ;
1515+
14651516/**
14661517* The scaling method used by the ScaleManager.
14671518*
@@ -1633,8 +1684,8 @@ Object.defineProperty(Phaser.ScaleManager.prototype, "isFullScreen", {
16331684
16341685 get : function ( ) {
16351686 return ! ! ( document [ 'fullscreenElement' ] ||
1636- document [ 'mozFullScreenElement' ] ||
16371687 document [ 'webkitFullscreenElement' ] ||
1688+ document [ 'mozFullScreenElement' ] ||
16381689 document [ 'msFullscreenElement' ] ) ;
16391690 }
16401691
0 commit comments