Phaser.ScaleManager = function (game, width, height){ this.game = game; this.dom = Phaser.DOM; this.grid = null ; this.width = 0; this.height = 0; this.minWidth = null ; this.maxWidth = null ; this.minHeight = null ; this.maxHeight = null ; this.offset = new Phaser.Point(); this.forceLandscape = false ; this.forcePortrait = false ; this.incorrectOrientation = false ; this._pageAlignHorizontally = false ; this._pageAlignVertically = false ; this.maxIterations = 5; this.onOrientationChange = new Phaser.Signal(); this.enterLandscape = new Phaser.Signal(); this.enterPortrait = new Phaser.Signal(); this.enterIncorrectOrientation = new Phaser.Signal(); this.leaveIncorrectOrientation = new Phaser.Signal(); this.fullScreenTarget = null ; this._createdFullScreenTarget = null ; this.onFullScreenInit = new Phaser.Signal(); this.onFullScreenChange = new Phaser.Signal(); this.onFullScreenError = new Phaser.Signal(); this.enterFullScreen = new Phaser.Signal(); this.leaveFullScreen = new Phaser.Signal(); this.fullScreenFailed = this.onFullScreenError; this.screenOrientation = this.dom.getScreenOrientation(); this.scaleFactor = new Phaser.Point(1, 1); this.scaleFactorInversed = new Phaser.Point(1, 1); this.margin = { left: 0, top: 0, right: 0, bottom: 0, x: 0, y: 0} ; this.bounds = new Phaser.Rectangle(); this.aspectRatio = 0; this.sourceAspectRatio = 0; this.event = null ; this.windowConstraints = { right: 'layout', bottom: ''} ; this.compatibility = { supportsFullScreen: false , orientationFallback: null , noMargins: false , scrollTo: null , forceMinimumDocumentHeight: false , canExpandParent: true , clickTrampoline: ''} ; this._scaleMode = Phaser.ScaleManager.NO_SCALE; this._fullScreenScaleMode = Phaser.ScaleManager.NO_SCALE; this.parentIsWindow = false ; this.parentNode = null ; this.parentScaleFactor = new Phaser.Point(1, 1); this.trackParentInterval = 2000; this.onSizeChange = new Phaser.Signal(); this.onResize = null ; this.onResizeContext = null ; this._fullScreenRestore = null ; this._gameSize = new Phaser.Rectangle(); this._userScaleFactor = new Phaser.Point(1, 1); this._userScaleTrim = new Phaser.Point(0, 0); this._lastUpdate = 0; this._updateThrottle = 0; this._updateThrottleReset = 100; this._parentBounds = new Phaser.Rectangle(); this._tempBounds = new Phaser.Rectangle(); this._lastReportedCanvasSize = new Phaser.Rectangle(); this._lastReportedGameSize = new Phaser.Rectangle(); if (game.config) { this.parseConfig(game.config); } this.setupScale(width, height); } ; Phaser.ScaleManager.EXACT_FIT = 0; Phaser.ScaleManager.NO_SCALE = 1; Phaser.ScaleManager.SHOW_ALL = 2; Phaser.ScaleManager.RESIZE = 3; Phaser.ScaleManager.USER_SCALE = 4; Phaser.ScaleManager.prototype = { boot: function (){ var compat = this.compatibility; compat.supportsFullScreen = this.game.device.fullscreen && !this.game.device.cocoonJS; if (!this.game.device.iPad && !this.game.device.webApp && !this.game.device.desktop) { if (this.game.device.android && !this.game.device.chrome) { compat.scrollTo = new Phaser.Point(0, 1); } else { compat.scrollTo = new Phaser.Point(0, 0); } } if (this.game.device.desktop) { compat.orientationFallback = 'screen'; compat.clickTrampoline = 'when-not-mouse'; } else { compat.orientationFallback = ''; compat.clickTrampoline = ''; } var _this = this; this._orientationChange = function (event){ return _this.orientationChange(event); } ; this._windowResize = function (event){ return _this.windowResize(event); } ; window.addEventListener('orientationchange', this._orientationChange, false ); window.addEventListener('resize', this._windowResize, false ); if (this.compatibility.supportsFullScreen) { this._fullScreenChange = function (event){ return _this.fullScreenChange(event); } ; this._fullScreenError = function (event){ return _this.fullScreenError(event); } ; document.addEventListener('webkitfullscreenchange', this._fullScreenChange, false ); document.addEventListener('mozfullscreenchange', this._fullScreenChange, false ); document.addEventListener('MSFullscreenChange', this._fullScreenChange, false ); document.addEventListener('fullscreenchange', this._fullScreenChange, false ); document.addEventListener('webkitfullscreenerror', this._fullScreenError, false ); document.addEventListener('mozfullscreenerror', this._fullScreenError, false ); document.addEventListener('MSFullscreenError', this._fullScreenError, false ); document.addEventListener('fullscreenerror', this._fullScreenError, false ); } this.game.onResume.add(this._gameResumed, this); this.dom.getOffset(this.game.canvas, this.offset); this.bounds.setTo(this.offset.x, this.offset.y, this.width, this.height); this.setGameSize(this.game.width, this.game.height); this.screenOrientation = this.dom.getScreenOrientation(this.compatibility.orientationFallback); this.grid = new Phaser.FlexGrid(this, this.width, this.height); } , parseConfig: function (config){ if (config.scaleMode) { this.scaleMode = config.scaleMode; } if (config.fullScreenScaleMode) { this.fullScreenScaleMode = config.fullScreenScaleMode; } if (config.fullScreenTarget) { this.fullScreenTarget = config.fullScreenTarget; } } , setupScale: function (width, height){ var target; var rect = new Phaser.Rectangle(); if (this.game.parent !== '') { if (typeof this.game.parent === 'string') { target = document.getElementById(this.game.parent); } else if (this.game.parent && this.game.parent.nodeType === 1) { target = this.game.parent; } } if (!target) { this.parentNode = null ; this.parentIsWindow = true ; rect.width = this.dom.visualBounds.width; rect.height = this.dom.visualBounds.height; this.offset.set(0, 0); } else { this.parentNode = target; this.parentIsWindow = false ; this.getParentBounds(this._parentBounds); rect.width = this._parentBounds.width; rect.height = this._parentBounds.height; this.offset.set(this._parentBounds.x, this._parentBounds.y); } var newWidth = 0; var newHeight = 0; if (typeof width === 'number') { newWidth = width; } else { this.parentScaleFactor.x = parseInt(width, 10) / 100; newWidth = rect.width * this.parentScaleFactor.x; } if (typeof height === 'number') { newHeight = height; } else { this.parentScaleFactor.y = parseInt(height, 10) / 100; newHeight = rect.height * this.parentScaleFactor.y; } this._gameSize.setTo(0, 0, newWidth, newHeight); this.updateDimensions(newWidth, newHeight, false ); } , _gameResumed: function (){ this.queueUpdate(true ); } , setGameSize: function (width, height){ this._gameSize.setTo(0, 0, width, height); if (this.currentScaleMode !== Phaser.ScaleManager.RESIZE) { this.updateDimensions(width, height, true ); } this.queueUpdate(true ); } , setUserScale: function (hScale, vScale, hTrim, vTrim){ this._userScaleFactor.setTo(hScale, vScale); this._userScaleTrim.setTo(hTrim | 0, vTrim | 0); this.queueUpdate(true ); } , setResizeCallback: function (callback, context){ this.onResize = callback; this.onResizeContext = context; } , signalSizeChange: function (){ if (!Phaser.Rectangle.sameDimensions(this, this._lastReportedCanvasSize) || !Phaser.Rectangle.sameDimensions(this.game, this._lastReportedGameSize)) { var width = this.width; var height = this.height; this._lastReportedCanvasSize.setTo(0, 0, width, height); this._lastReportedGameSize.setTo(0, 0, this.game.width, this.game.height); this.grid.onResize(width, height); this.onSizeChange.dispatch(this, width, height); if (this.currentScaleMode === Phaser.ScaleManager.RESIZE) { this.game.state.resize(width, height); this.game.load.resize(width, height); } } } , setMinMax: function (minWidth, minHeight, maxWidth, maxHeight){ this.minWidth = minWidth; this.minHeight = minHeight; if (typeof maxWidth !== 'undefined') { this.maxWidth = maxWidth; } if (typeof maxHeight !== 'undefined') { this.maxHeight = maxHeight; } } , preUpdate: function (){ if (this.game.time.time < (this._lastUpdate + this._updateThrottle)) { return ; } var prevThrottle = this._updateThrottle; this._updateThrottleReset = prevThrottle >= 400? 0: 100; this.dom.getOffset(this.game.canvas, this.offset); var prevWidth = this._parentBounds.width; var prevHeight = this._parentBounds.height; var bounds = this.getParentBounds(this._parentBounds); var boundsChanged = bounds.width !== prevWidth || bounds.height !== prevHeight; var orientationChanged = this.updateOrientationState(); if (boundsChanged || orientationChanged) { if (this.onResize) { this.onResize.call(this.onResizeContext, this, bounds); } this.updateLayout(); this.signalSizeChange(); } var throttle = this._updateThrottle * 2; if (this._updateThrottle < prevThrottle) { throttle = Math.min(prevThrottle, this._updateThrottleReset); } this._updateThrottle = Phaser.Math.clamp(throttle, 25, this.trackParentInterval); this._lastUpdate = this.game.time.time; } , pauseUpdate: function (){ this.preUpdate(); this._updateThrottle = this.trackParentInterval; } , updateDimensions: function (width, height, resize){ this.width = width * this.parentScaleFactor.x; this.height = height * this.parentScaleFactor.y; this.game.width = this.width; this.game.height = this.height; this.sourceAspectRatio = this.width / this.height; this.updateScalingAndBounds(); if (resize) { this.game.renderer.resize(this.width, this.height); this.game.camera.setSize(this.width, this.height); this.game.world.resize(this.width, this.height); } } , updateScalingAndBounds: function (){ this.scaleFactor.x = this.game.width / this.width; this.scaleFactor.y = this.game.height / this.height; this.scaleFactorInversed.x = this.width / this.game.width; this.scaleFactorInversed.y = this.height / this.game.height; this.aspectRatio = this.width / this.height; if (this.game.canvas) { this.dom.getOffset(this.game.canvas, this.offset); } this.bounds.setTo(this.offset.x, this.offset.y, this.width, this.height); if (this.game.input && this.game.input.scale) { this.game.input.scale.setTo(this.scaleFactor.x, this.scaleFactor.y); } } , forceOrientation: function (forceLandscape, forcePortrait){ if (typeof forcePortrait === 'undefined') { forcePortrait = false ; } this.forceLandscape = forceLandscape; this.forcePortrait = forcePortrait; this.queueUpdate(true ); } , classifyOrientation: function (orientation){ if (orientation === 'portrait-primary' || orientation === 'portrait-secondary') { return 'portrait'; } else if (orientation === 'landscape-primary' || orientation === 'landscape-secondary') { return 'landscape'; } else { return null ; } } , updateOrientationState: function (){ var previousOrientation = this.screenOrientation; var previouslyIncorrect = this.incorrectOrientation; this.screenOrientation = this.dom.getScreenOrientation(this.compatibility.orientationFallback); this.incorrectOrientation = (this.forceLandscape && !this.isLandscape) || (this.forcePortrait && !this.isPortrait); var changed = previousOrientation !== this.screenOrientation; var correctnessChanged = previouslyIncorrect !== this.incorrectOrientation; if (changed) { if (this.isLandscape) { this.enterLandscape.dispatch(this.orientation, true , false ); } else { this.enterPortrait.dispatch(this.orientation, false , true ); } } if (correctnessChanged) { if (this.incorrectOrientation) { this.enterIncorrectOrientation.dispatch(); } else { this.leaveIncorrectOrientation.dispatch(); } } if (changed || correctnessChanged) { this.onOrientationChange.dispatch(this, previousOrientation, previouslyIncorrect); } return changed || correctnessChanged; } , orientationChange: function (event){ this.event = event; this.queueUpdate(true ); } , windowResize: function (event){ this.event = event; this.queueUpdate(true ); } , scrollTop: function (){ var scrollTo = this.compatibility.scrollTo; if (scrollTo) { window.scrollTo(scrollTo.x, scrollTo.y); } } , refresh: function (){ this.scrollTop(); this.queueUpdate(true ); } , updateLayout: function (){ var scaleMode = this.currentScaleMode; if (scaleMode === Phaser.ScaleManager.RESIZE) { this.reflowGame(); return ; } this.scrollTop(); if (this.compatibility.forceMinimumDocumentHeight) { document.documentElement.style.minHeight = window.innerHeight + 'px'; } if (this.incorrectOrientation) { this.setMaximum(); } else { if (scaleMode === Phaser.ScaleManager.EXACT_FIT) { this.setExactFit(); } else if (scaleMode === Phaser.ScaleManager.SHOW_ALL) { if (!this.isFullScreen && this.boundingParent && this.compatibility.canExpandParent) { this.setShowAll(true ); this.resetCanvas(); this.setShowAll(); } else { this.setShowAll(); } } else if (scaleMode === Phaser.ScaleManager.NO_SCALE) { this.width = this.game.width; this.height = this.game.height; } else if (scaleMode === Phaser.ScaleManager.USER_SCALE) { this.width = (this.game.width * this._userScaleFactor.x) - this._userScaleTrim.x; this.height = (this.game.height * this._userScaleFactor.y) - this._userScaleTrim.y; } } if (!this.compatibility.canExpandParent && (scaleMode === Phaser.ScaleManager.SHOW_ALL || scaleMode === Phaser.ScaleManager.USER_SCALE)) { var bounds = this.getParentBounds(this._tempBounds); this.width = Math.min(this.width, bounds.width); this.height = Math.min(this.height, bounds.height); } this.width = this.width | 0; this.height = this.height | 0; this.reflowCanvas(); } , getParentBounds: function (target){ var bounds = target || new Phaser.Rectangle(); var parentNode = this.boundingParent; var visualBounds = this.dom.visualBounds; var layoutBounds = this.dom.layoutBounds; if (!parentNode) { bounds.setTo(0, 0, visualBounds.width, visualBounds.height); } else { var clientRect = parentNode.getBoundingClientRect(); bounds.setTo(clientRect.left, clientRect.top, clientRect.width, clientRect.height); var wc = this.windowConstraints; if (wc.right) { var windowBounds = wc.right === 'layout'? layoutBounds: visualBounds; bounds.right = Math.min(bounds.right, windowBounds.width); } if (wc.bottom) { var windowBounds = wc.bottom === 'layout'? layoutBounds: visualBounds; bounds.bottom = Math.min(bounds.bottom, windowBounds.height); } } bounds.setTo(Math.round(bounds.x), Math.round(bounds.y), Math.round(bounds.width), Math.round(bounds.height)); return bounds; } , alignCanvas: function (horizontal, vertical){ var parentBounds = this.getParentBounds(this._tempBounds); var canvas = this.game.canvas; var margin = this.margin; if (horizontal) { margin.left = margin.right = 0; var canvasBounds = canvas.getBoundingClientRect(); if (this.width < parentBounds.width && !this.incorrectOrientation) { var currentEdge = canvasBounds.left - parentBounds.x; var targetEdge = (parentBounds.width / 2) - (this.width / 2); targetEdge = Math.max(targetEdge, 0); var offset = targetEdge - currentEdge; margin.left = Math.round(offset); } canvas.style.marginLeft = margin.left + 'px'; if (margin.left !== 0) { margin.right = - (parentBounds.width - canvasBounds.width - margin.left); canvas.style.marginRight = margin.right + 'px'; } } if (vertical) { margin.top = margin.bottom = 0; var canvasBounds = canvas.getBoundingClientRect(); if (this.height < parentBounds.height && !this.incorrectOrientation) { var currentEdge = canvasBounds.top - parentBounds.y; var targetEdge = (parentBounds.height / 2) - (this.height / 2); targetEdge = Math.max(targetEdge, 0); var offset = targetEdge - currentEdge; margin.top = Math.round(offset); } canvas.style.marginTop = margin.top + 'px'; if (margin.top !== 0) { margin.bottom = - (parentBounds.height - canvasBounds.height - margin.top); canvas.style.marginBottom = margin.bottom + 'px'; } } margin.x = margin.left; margin.y = margin.top; } , reflowGame: function (){ this.resetCanvas('', ''); var bounds = this.getParentBounds(this._tempBounds); this.updateDimensions(bounds.width, bounds.height, true ); } , reflowCanvas: function (){ if (!this.incorrectOrientation) { this.width = Phaser.Math.clamp(this.width, this.minWidth || 0, this.maxWidth || this.width); this.height = Phaser.Math.clamp(this.height, this.minHeight || 0, this.maxHeight || this.height); } this.resetCanvas(); if (!this.compatibility.noMargins) { if (this.isFullScreen && this._createdFullScreenTarget) { this.alignCanvas(true , true ); } else { this.alignCanvas(this.pageAlignHorizontally, this.pageAlignVertically); } } this.updateScalingAndBounds(); } , resetCanvas: function (cssWidth, cssHeight){ if (typeof cssWidth === 'undefined') { cssWidth = this.width + 'px'; } if (typeof cssHeight === 'undefined') { cssHeight = this.height + 'px'; } var canvas = this.game.canvas; if (!this.compatibility.noMargins) { canvas.style.marginLeft = ''; canvas.style.marginTop = ''; canvas.style.marginRight = ''; canvas.style.marginBottom = ''; } canvas.style.width = cssWidth; canvas.style.height = cssHeight; } , queueUpdate: function (force){ if (force) { this._parentBounds.width = 0; this._parentBounds.height = 0; } this._updateThrottle = this._updateThrottleReset; } , reset: function (clearWorld){ if (clearWorld) { this.grid.reset(); } } , setMaximum: function (){ this.width = this.dom.visualBounds.width; this.height = this.dom.visualBounds.height; } , setShowAll: function (expanding){ var bounds = this.getParentBounds(this._tempBounds); var width = bounds.width; var height = bounds.height; var multiplier; if (expanding) { multiplier = Math.max((height / this.game.height), (width / this.game.width)); } else { multiplier = Math.min((height / this.game.height), (width / this.game.width)); } this.width = Math.round(this.game.width * multiplier); this.height = Math.round(this.game.height * multiplier); } , setExactFit: function (){ var bounds = this.getParentBounds(this._tempBounds); this.width = bounds.width; this.height = bounds.height; if (this.isFullScreen) { return ; } if (this.maxWidth) { this.width = Math.min(this.width, this.maxWidth); } if (this.maxHeight) { this.height = Math.min(this.height, this.maxHeight); } } , createFullScreenTarget: function (){ var fsTarget = _AN_Call_createelement('createElement', document, 'div'); fsTarget.style.margin = '0'; fsTarget.style.padding = '0'; _AN_Write_background('background', fsTarget.style, false , '#000'); return fsTarget; } , startFullScreen: function (antialias, allowTrampoline){ if (this.isFullScreen) { return false ; } if (!this.compatibility.supportsFullScreen) { var _this = this; _AN_Call_settimeout('setTimeout', window, function (){ _this.fullScreenError(); } , 10); return ; } if (this.compatibility.clickTrampoline === 'when-not-mouse') { var input = this.game.input; if (input.activePointer && input.activePointer !== input.mousePointer && (allowTrampoline || allowTrampoline !== false )) { input.activePointer.addClickTrampoline("startFullScreen", this.startFullScreen, this, [antialias, false ] ); return ; } } if (typeof antialias !== 'undefined' && this.game.renderType === Phaser.CANVAS) { this.game.stage.smoothed = antialias; } var fsTarget = this.fullScreenTarget; if (!fsTarget) { this.cleanupCreatedTarget(); this._createdFullScreenTarget = this.createFullScreenTarget(); fsTarget = this._createdFullScreenTarget; } var initData = { targetElement: fsTarget} ; this.onFullScreenInit.dispatch(this, initData); if (this._createdFullScreenTarget) { var canvas = this.game.canvas; var parent = canvas.parentNode; parent.insertBefore(fsTarget, canvas); _AN_Call_appendchild('appendChild', fsTarget, canvas); } if (this.game.device.fullscreenKeyboard) { fsTarget[this.game.device.requestFullscreen](Element.ALLOW_KEYBOARD_INPUT); } else { fsTarget[this.game.device.requestFullscreen](); } return true ; } , stopFullScreen: function (){ if (!this.isFullScreen || !this.compatibility.supportsFullScreen) { return false ; } document[this.game.device.cancelFullscreen](); return true ; } , cleanupCreatedTarget: function (){ var fsTarget = this._createdFullScreenTarget; if (fsTarget && fsTarget.parentNode) { var parent = fsTarget.parentNode; parent.insertBefore(this.game.canvas, fsTarget); parent.removeChild(fsTarget); } this._createdFullScreenTarget = null ; } , prepScreenMode: function (enteringFullscreen){ var createdTarget = !!this._createdFullScreenTarget; var fsTarget = this._createdFullScreenTarget || this.fullScreenTarget; if (enteringFullscreen) { if (createdTarget || this.fullScreenScaleMode === Phaser.ScaleManager.EXACT_FIT) { if (fsTarget !== this.game.canvas) { this._fullScreenRestore = { targetWidth: fsTarget.style.width, targetHeight: fsTarget.style.height} ; fsTarget.style.width = '100%'; fsTarget.style.height = '100%'; } } } else { if (this._fullScreenRestore) { fsTarget.style.width = this._fullScreenRestore.targetWidth; fsTarget.style.height = this._fullScreenRestore.targetHeight; this._fullScreenRestore = null ; } this.updateDimensions(this._gameSize.width, this._gameSize.height, true ); this.resetCanvas(); } } , fullScreenChange: function (event){ this.event = event; if (this.isFullScreen) { this.prepScreenMode(true ); this.updateLayout(); this.queueUpdate(true ); this.enterFullScreen.dispatch(this.width, this.height); } else { this.prepScreenMode(false ); this.cleanupCreatedTarget(); this.updateLayout(); this.queueUpdate(true ); this.leaveFullScreen.dispatch(this.width, this.height); } this.onFullScreenChange.dispatch(this); } , fullScreenError: function (event){ this.event = event; this.cleanupCreatedTarget(); console.warn('Phaser.ScaleManager: requestFullscreen failed or device does not support the Fullscreen API'); this.onFullScreenError.dispatch(this); } , scaleSprite: function (sprite, width, height, letterBox){ if (typeof width === 'undefined') { width = this.width; } if (typeof height === 'undefined') { height = this.height; } if (typeof letterBox === 'undefined') { letterBox = false ; } if (!sprite || !sprite.scale) { return sprite; } sprite.scale.x = 1; sprite.scale.y = 1; if ((sprite.width <= 0) || (sprite.height <= 0) || (width <= 0) || (height <= 0)) { return sprite; } var scaleX1 = width; var scaleY1 = (sprite.height * width) / sprite.width; var scaleX2 = (sprite.width * height) / sprite.height; var scaleY2 = height; var scaleOnWidth = (scaleX2 > width); if (scaleOnWidth) { scaleOnWidth = letterBox; } else { scaleOnWidth = !letterBox; } if (scaleOnWidth) { sprite.width = Math.floor(scaleX1); sprite.height = Math.floor(scaleY1); } else { sprite.width = Math.floor(scaleX2); sprite.height = Math.floor(scaleY2); } return sprite; } , destroy: function (){ this.game.onResume.remove(this._gameResumed, this); window.removeEventListener('orientationchange', this._orientationChange, false ); window.removeEventListener('resize', this._windowResize, false ); if (this.compatibility.supportsFullScreen) { document.removeEventListener('webkitfullscreenchange', this._fullScreenChange, false ); document.removeEventListener('mozfullscreenchange', this._fullScreenChange, false ); document.removeEventListener('MSFullscreenChange', this._fullScreenChange, false ); document.removeEventListener('fullscreenchange', this._fullScreenChange, false ); document.removeEventListener('webkitfullscreenerror', this._fullScreenError, false ); document.removeEventListener('mozfullscreenerror', this._fullScreenError, false ); document.removeEventListener('MSFullscreenError', this._fullScreenError, false ); document.removeEventListener('fullscreenerror', this._fullScreenError, false ); } } } ; Phaser.ScaleManager.prototype.constructor = Phaser.ScaleManager; Phaser.ScaleManager.prototype.checkResize = Phaser.ScaleManager.prototype.windowResize; Phaser.ScaleManager.prototype.checkOrientation = Phaser.ScaleManager.prototype.orientationChange; Phaser.ScaleManager.prototype.setScreenSize = Phaser.ScaleManager.prototype.updateLayout; Phaser.ScaleManager.prototype.setSize = Phaser.ScaleManager.prototype.reflowCanvas; Phaser.ScaleManager.prototype.checkOrientationState = function (){ var changed = this.updateOrientationState(); if (changed) { _AN_Call_refresh('refresh', this); } return changed; } ; Object.defineProperty(Phaser.ScaleManager.prototype, "boundingParent", { get: function (){ if (this.parentIsWindow || (this.isFullScreen && !this._createdFullScreenTarget)) { return null ; } var parentNode = this.game.canvas && this.game.canvas.parentNode; return parentNode || null ; } } ); Object.defineProperty(Phaser.ScaleManager.prototype, "scaleMode", { get: function (){ return this._scaleMode; } , set: function (value){ if (value !== this._scaleMode) { if (!this.isFullScreen) { this.updateDimensions(this._gameSize.width, this._gameSize.height, true ); this.queueUpdate(true ); } this._scaleMode = value; } return this._scaleMode; } } ); Object.defineProperty(Phaser.ScaleManager.prototype, "fullScreenScaleMode", { get: function (){ return this._fullScreenScaleMode; } , set: function (value){ if (value !== this._fullScreenScaleMode) { if (this.isFullScreen) { this.prepScreenMode(false ); this._fullScreenScaleMode = value; this.prepScreenMode(true ); this.queueUpdate(true ); } else { this._fullScreenScaleMode = value; } } return this._fullScreenScaleMode; } } ); Object.defineProperty(Phaser.ScaleManager.prototype, "currentScaleMode", { get: function (){ return this.isFullScreen? this._fullScreenScaleMode: this._scaleMode; } } ); Object.defineProperty(Phaser.ScaleManager.prototype, "pageAlignHorizontally", { get: function (){ return this._pageAlignHorizontally; } , set: function (value){ if (value !== this._pageAlignHorizontally) { this._pageAlignHorizontally = value; this.queueUpdate(true ); } } } ); Object.defineProperty(Phaser.ScaleManager.prototype, "pageAlignVertically", { get: function (){ return this._pageAlignVertically; } , set: function (value){ if (value !== this._pageAlignVertically) { this._pageAlignVertically = value; this.queueUpdate(true ); } } } ); Object.defineProperty(Phaser.ScaleManager.prototype, "isFullScreen", { get: function (){ return !!(document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement); } } ); Object.defineProperty(Phaser.ScaleManager.prototype, "isPortrait", { get: function (){ return this.classifyOrientation(this.screenOrientation) === 'portrait'; } } ); Object.defineProperty(Phaser.ScaleManager.prototype, "isLandscape", { get: function (){ return this.classifyOrientation(this.screenOrientation) === 'landscape'; } } ); Object.defineProperty(Phaser.ScaleManager.prototype, "orientation", { get: function (){ return (this.classifyOrientation(this.screenOrientation) === 'portrait'? 0: 90); } } ); Object.defineProperty(Phaser.ScaleManager.prototype, "isGamePortrait", { get: function (){ return (this.height > this.width); } } ); Object.defineProperty(Phaser.ScaleManager.prototype, "isGameLandscape", { get: function (){ return (this.width > this.height); } } );