mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 14:40:38 +00:00
It was not possible to set the zoom value of the Scale Manager back to 1 again, having changed it to a different value. Fix #4633
This commit is contained in:
parent
f872b1ece9
commit
bf3a424dfd
1 changed files with 20 additions and 1 deletions
|
@ -260,6 +260,16 @@ var ScaleManager = new Class({
|
||||||
*/
|
*/
|
||||||
this.zoom = 1;
|
this.zoom = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal flag set when the game zoom factor is modified.
|
||||||
|
*
|
||||||
|
* @name Phaser.Scale.ScaleManager#_resetZoom
|
||||||
|
* @type {boolean}
|
||||||
|
* @readonly
|
||||||
|
* @since 3.19.0
|
||||||
|
*/
|
||||||
|
this._resetZoom = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The scale factor between the baseSize and the canvasBounds.
|
* The scale factor between the baseSize and the canvasBounds.
|
||||||
*
|
*
|
||||||
|
@ -554,6 +564,11 @@ var ScaleManager = new Class({
|
||||||
|
|
||||||
this.zoom = zoom;
|
this.zoom = zoom;
|
||||||
|
|
||||||
|
if (zoom !== 1)
|
||||||
|
{
|
||||||
|
this._resetZoom = true;
|
||||||
|
}
|
||||||
|
|
||||||
// The modified game size, which is the w/h * resolution
|
// The modified game size, which is the w/h * resolution
|
||||||
this.baseSize.setSize(width * resolution, height * resolution);
|
this.baseSize.setSize(width * resolution, height * resolution);
|
||||||
|
|
||||||
|
@ -868,6 +883,7 @@ var ScaleManager = new Class({
|
||||||
setZoom: function (value)
|
setZoom: function (value)
|
||||||
{
|
{
|
||||||
this.zoom = value;
|
this.zoom = value;
|
||||||
|
this._resetZoom = true;
|
||||||
|
|
||||||
return this.refresh();
|
return this.refresh();
|
||||||
},
|
},
|
||||||
|
@ -884,6 +900,7 @@ var ScaleManager = new Class({
|
||||||
setMaxZoom: function ()
|
setMaxZoom: function ()
|
||||||
{
|
{
|
||||||
this.zoom = this.getMaxZoom();
|
this.zoom = this.getMaxZoom();
|
||||||
|
this._resetZoom = true;
|
||||||
|
|
||||||
return this.refresh();
|
return this.refresh();
|
||||||
},
|
},
|
||||||
|
@ -996,10 +1013,12 @@ var ScaleManager = new Class({
|
||||||
styleHeight = Math.floor(styleHeight);
|
styleHeight = Math.floor(styleHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zoom > 1)
|
if (this._resetZoom)
|
||||||
{
|
{
|
||||||
style.width = styleWidth + 'px';
|
style.width = styleWidth + 'px';
|
||||||
style.height = styleHeight + 'px';
|
style.height = styleHeight + 'px';
|
||||||
|
|
||||||
|
this._resetZoom = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (this.scaleMode === CONST.SCALE_MODE.RESIZE)
|
else if (this.scaleMode === CONST.SCALE_MODE.RESIZE)
|
||||||
|
|
Loading…
Reference in a new issue