Skip to content

Commit 6e0c182

Browse files
committed
Added _startHeight mod, but disabled until further testing.
1 parent 7a64f53 commit 6e0c182

1 file changed

Lines changed: 21 additions & 18 deletions

File tree

src/core/ScaleManager.js

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Phaser.ScaleManager = function (game, width, height) {
168168
this.scaleFactorInversed = new Phaser.Point(1, 1);
169169

170170
/**
171-
* @property {Phaser.Point} margin - If the game canvas is seto to align by adjusting the margin, the margin calculation values are stored in this Point.
171+
* @property {Phaser.Point} margin - If the game canvas is set to align by adjusting the margin, the margin calculation values are stored in this Point.
172172
* @readonly
173173
*/
174174
this.margin = new Phaser.Point(0, 0);
@@ -376,7 +376,7 @@ Phaser.ScaleManager.prototype = {
376376

377377
if (typeof orientationImage !== 'undefined')
378378
{
379-
if (orientationImage == null || this.game.cache.checkImageKey(orientationImage) === false)
379+
if (orientationImage === null || this.game.cache.checkImageKey(orientationImage) === false)
380380
{
381381
orientationImage = '__default';
382382
}
@@ -521,9 +521,12 @@ Phaser.ScaleManager.prototype = {
521521
refresh: function () {
522522

523523
// We can't do anything about the status bars in iPads, web apps or desktops
524-
if (this.game.device.iPad === false && this.game.device.webApp === false && this.game.device.desktop === false)
524+
if (!this.game.device.iPad && !this.game.device.webApp && !this.game.device.desktop)
525525
{
526-
if (this.game.device.android && this.game.device.chrome === false)
526+
// TODO - Test this
527+
// this._startHeight = window.innerHeight;
528+
529+
if (this.game.device.android && !this.game.device.chrome)
527530
{
528531
window.scrollTo(0, 1);
529532
}
@@ -533,7 +536,7 @@ Phaser.ScaleManager.prototype = {
533536
}
534537
}
535538

536-
if (this._check == null && this.maxIterations > 0)
539+
if (this._check === null && this.maxIterations > 0)
537540
{
538541
this._iterations = this.maxIterations;
539542

@@ -554,14 +557,14 @@ Phaser.ScaleManager.prototype = {
554557
*/
555558
setScreenSize: function (force) {
556559

557-
if (typeof force == 'undefined')
560+
if (typeof force === 'undefined')
558561
{
559562
force = false;
560563
}
561564

562-
if (this.game.device.iPad === false && this.game.device.webApp === false && this.game.device.desktop === false)
565+
if (!this.game.device.iPad && !this.game.device.webApp && !this.game.device.desktop)
563566
{
564-
if (this.game.device.android && this.game.device.chrome === false)
567+
if (this.game.device.android && !this.game.device.chrome)
565568
{
566569
window.scrollTo(0, 1);
567570
}
@@ -578,28 +581,28 @@ Phaser.ScaleManager.prototype = {
578581
// Set minimum height of content to new window height
579582
document.documentElement['style'].minHeight = window.innerHeight + 'px';
580583

581-
if (this.incorrectOrientation === true)
584+
if (this.incorrectOrientation)
582585
{
583586
this.setMaximum();
584587
}
585588
else if (!this.isFullScreen)
586589
{
587-
if (this.scaleMode == Phaser.ScaleManager.EXACT_FIT)
590+
if (this.scaleMode === Phaser.ScaleManager.EXACT_FIT)
588591
{
589592
this.setExactFit();
590593
}
591-
else if (this.scaleMode == Phaser.ScaleManager.SHOW_ALL)
594+
else if (this.scaleMode === Phaser.ScaleManager.SHOW_ALL)
592595
{
593596
this.setShowAll();
594597
}
595598
}
596599
else
597600
{
598-
if (this.fullScreenScaleMode == Phaser.ScaleManager.EXACT_FIT)
601+
if (this.fullScreenScaleMode === Phaser.ScaleManager.EXACT_FIT)
599602
{
600603
this.setExactFit();
601604
}
602-
else if (this.fullScreenScaleMode == Phaser.ScaleManager.SHOW_ALL)
605+
else if (this.fullScreenScaleMode === Phaser.ScaleManager.SHOW_ALL)
603606
{
604607
this.setShowAll();
605608
}
@@ -618,7 +621,7 @@ Phaser.ScaleManager.prototype = {
618621
*/
619622
setSize: function () {
620623

621-
if (this.incorrectOrientation === false)
624+
if (!this.incorrectOrientation)
622625
{
623626
if (this.maxWidth && this.width > this.maxWidth)
624627
{
@@ -648,7 +651,7 @@ Phaser.ScaleManager.prototype = {
648651

649652
if (this.pageAlignHorizontally)
650653
{
651-
if (this.width < window.innerWidth && this.incorrectOrientation === false)
654+
if (this.width < window.innerWidth && !this.incorrectOrientation)
652655
{
653656
this.margin.x = Math.round((window.innerWidth - this.width) / 2);
654657
this.game.canvas.style.marginLeft = this.margin.x + 'px';
@@ -662,7 +665,7 @@ Phaser.ScaleManager.prototype = {
662665

663666
if (this.pageAlignVertically)
664667
{
665-
if (this.height < window.innerHeight && this.incorrectOrientation === false)
668+
if (this.height < window.innerHeight && !this.incorrectOrientation)
666669
{
667670
this.margin.y = Math.round((window.innerHeight - this.height) / 2);
668671
this.game.canvas.style.marginTop = this.margin.y + 'px';
@@ -770,7 +773,7 @@ Object.defineProperty(Phaser.ScaleManager.prototype, "isFullScreen", {
770773
Object.defineProperty(Phaser.ScaleManager.prototype, "isPortrait", {
771774

772775
get: function () {
773-
return this.orientation === 0 || this.orientation == 180;
776+
return (this.orientation === 0 || this.orientation === 180);
774777
}
775778

776779
});
@@ -783,7 +786,7 @@ Object.defineProperty(Phaser.ScaleManager.prototype, "isPortrait", {
783786
Object.defineProperty(Phaser.ScaleManager.prototype, "isLandscape", {
784787

785788
get: function () {
786-
return this.orientation === 90 || this.orientation === -90;
789+
return (this.orientation === 90 || this.orientation === -90);
787790
}
788791

789792
});

0 commit comments

Comments
 (0)