Skip to content

Commit b733dbc

Browse files
committed
The ScaleManager.resolution property has been removed and all internal use of it.
1 parent 68946f3 commit b733dbc

1 file changed

Lines changed: 19 additions & 40 deletions

File tree

src/scale/ScaleManager.js

Lines changed: 19 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ var ScaleManager = new Class({
204204
/**
205205
* The Base Size component.
206206
*
207-
* The modified game size, which is the gameSize * resolution, used to set the canvas width and height
207+
* The modified game size, which is the auto-rounded gameSize, used to set the canvas width and height
208208
* (but not the CSS style)
209209
*
210210
* @name Phaser.Scale.ScaleManager#baseSize
@@ -233,17 +233,6 @@ var ScaleManager = new Class({
233233
*/
234234
this.scaleMode = CONST.SCALE_MODE.NONE;
235235

236-
/**
237-
* The canvas resolution.
238-
*
239-
* This is hard-coded to a value of 1 in the 3.16 release of Phaser and will be enabled at a later date.
240-
*
241-
* @name Phaser.Scale.ScaleManager#resolution
242-
* @type {number}
243-
* @since 3.16.0
244-
*/
245-
this.resolution = 1;
246-
247236
/**
248237
* The game zoom factor.
249238
*
@@ -491,7 +480,6 @@ var ScaleManager = new Class({
491480
var width = config.width;
492481
var height = config.height;
493482
var scaleMode = config.scaleMode;
494-
var resolution = config.resolution;
495483
var zoom = config.zoom;
496484
var autoRound = config.autoRound;
497485

@@ -527,11 +515,6 @@ var ScaleManager = new Class({
527515
height = Math.floor(parentHeight * parentScaleY);
528516
}
529517

530-
// This is fixed at 1 on purpose.
531-
// Changing it will break all user input.
532-
// Wait for another release to solve this issue.
533-
this.resolution = 1;
534-
535518
this.scaleMode = scaleMode;
536519

537520
this.autoRound = autoRound;
@@ -561,8 +544,8 @@ var ScaleManager = new Class({
561544
this._resetZoom = true;
562545
}
563546

564-
// The modified game size, which is the w/h * resolution
565-
this.baseSize.setSize(width * resolution, height * resolution);
547+
// The modified game size
548+
this.baseSize.setSize(width, height);
566549

567550
if (autoRound)
568551
{
@@ -663,9 +646,8 @@ var ScaleManager = new Class({
663646
DOMRect.height = GetInnerHeight(true);
664647
}
665648

666-
var resolution = this.resolution;
667-
var newWidth = DOMRect.width * resolution;
668-
var newHeight = DOMRect.height * resolution;
649+
var newWidth = DOMRect.width;
650+
var newHeight = DOMRect.height;
669651

670652
if (parentSize.width !== newWidth || parentSize.height !== newHeight)
671653
{
@@ -745,7 +727,6 @@ var ScaleManager = new Class({
745727
setGameSize: function (width, height)
746728
{
747729
var autoRound = this.autoRound;
748-
var resolution = this.resolution;
749730

750731
if (autoRound)
751732
{
@@ -759,8 +740,8 @@ var ScaleManager = new Class({
759740
// The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc
760741
this.gameSize.resize(width, height);
761742

762-
// The modified game size, which is the w/h * resolution
763-
this.baseSize.resize(width * resolution, height * resolution);
743+
// The modified game size
744+
this.baseSize.resize(width, height);
764745

765746
if (autoRound)
766747
{
@@ -810,7 +791,6 @@ var ScaleManager = new Class({
810791
resize: function (width, height)
811792
{
812793
var zoom = this.zoom;
813-
var resolution = this.resolution;
814794
var autoRound = this.autoRound;
815795

816796
if (autoRound)
@@ -825,8 +805,8 @@ var ScaleManager = new Class({
825805
// The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc
826806
this.gameSize.resize(width, height);
827807

828-
// The modified game size, which is the w/h * resolution
829-
this.baseSize.resize(width * resolution, height * resolution);
808+
// The modified game size
809+
this.baseSize.resize(width, height);
830810

831811
if (autoRound)
832812
{
@@ -836,7 +816,7 @@ var ScaleManager = new Class({
836816

837817
// The size used for the canvas style, factoring in the scale mode and parent and zoom value
838818
// We just use the w/h here as this is what sets the aspect ratio (which doesn't then change)
839-
this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution);
819+
this.displaySize.setSize((width * zoom), (height * zoom));
840820

841821
this.canvas.width = this.baseSize.width;
842822
this.canvas.height = this.baseSize.height;
@@ -940,7 +920,7 @@ var ScaleManager = new Class({
940920
domStyle.marginTop = canvasStyle.marginTop;
941921
}
942922

943-
this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution, previousWidth, previousHeight);
923+
this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, previousWidth, previousHeight);
944924

945925
return this;
946926
},
@@ -989,15 +969,14 @@ var ScaleManager = new Class({
989969

990970
var zoom = this.zoom;
991971
var autoRound = this.autoRound;
992-
var resolution = 1;
993972

994973
if (this.scaleMode === CONST.SCALE_MODE.NONE)
995974
{
996975
// No scale
997-
this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution);
976+
this.displaySize.setSize((width * zoom), (height * zoom));
998977

999-
styleWidth = this.displaySize.width / resolution;
1000-
styleHeight = this.displaySize.height / resolution;
978+
styleWidth = this.displaySize.width;
979+
styleHeight = this.displaySize.height;
1001980

1002981
if (autoRound)
1003982
{
@@ -1022,10 +1001,10 @@ var ScaleManager = new Class({
10221001

10231002
this.gameSize.setSize(this.displaySize.width, this.displaySize.height);
10241003

1025-
this.baseSize.setSize(this.displaySize.width * resolution, this.displaySize.height * resolution);
1004+
this.baseSize.setSize(this.displaySize.width, this.displaySize.height);
10261005

1027-
styleWidth = this.displaySize.width / resolution;
1028-
styleHeight = this.displaySize.height / resolution;
1006+
styleWidth = this.displaySize.width;
1007+
styleHeight = this.displaySize.height;
10291008

10301009
if (autoRound)
10311010
{
@@ -1041,8 +1020,8 @@ var ScaleManager = new Class({
10411020
// All other scale modes
10421021
this.displaySize.setSize(this.parentSize.width, this.parentSize.height);
10431022

1044-
styleWidth = this.displaySize.width / resolution;
1045-
styleHeight = this.displaySize.height / resolution;
1023+
styleWidth = this.displaySize.width;
1024+
styleHeight = this.displaySize.height;
10461025

10471026
if (autoRound)
10481027
{

0 commit comments

Comments
 (0)