phaser icon indicating copy to clipboard operation
phaser copied to clipboard

ScaleManager.updateLayout() called on each frame

Open spixy opened this issue 10 years ago • 3 comments

Hi, on latest phaser ScaleManager.updateLayout() got called in each frame.

Settings:

game.scale.scaleMode = Phaser.ScaleManager.USER_SCALE;
game.scale.pageAlignHorizontally = true;
game.scale.pageAlignVertically = true;
game.scale.setResizeCallback(function(scale, parentBounds)
{
    var scaleRatio = getMinSquareParentSize() / game.width;
    scale.setUserScale(scaleRatio, scaleRatio, 0, 0);   // set square size
}, this);

ScaleManager.preUpdate (line 78586):

...
var boundsChanged = bounds.width !== prevWidth || bounds.height !== prevHeight;
console.log(bounds.width + " -> " + prevWidth + ", " + bounds.height + " -> " + prevHeight);
...

Console output on each frame:

1057 -> 0, 955 -> 0

index.html:

<body>
    <div id="game" style="position: absolute; top: 0; left: 0; bottom: 0; right: 0;"></div>
    <script type="text/javascript" src="app.js"></script>
</body>

spixy avatar Aug 05 '16 14:08 spixy

This is more interesting:

var prevWidth = this._parentBounds.width;
var prevHeight = this._parentBounds.height;
var bounds = this.getParentBounds(this._parentBounds);

var boundsChanged = bounds.width !== prevWidth || bounds.height !== prevHeight;

console.log(this._parentBounds.width + " vs " + prevWidth + ", " + this._parentBounds.width + " vs " + prevHeight);

Output each frame: 1057 vs 0, 1057 vs 0

spixy avatar Aug 05 '16 14:08 spixy

I have the same issue, I've been bouncing my head against the wall about this. I'll roll back to an older version of Phaser (Im using 2.6.2) to see if this keeps happening or it's a bug of this last version.

jackfreak avatar Oct 03 '16 04:10 jackfreak

Thank you for taking the time to open this issue. However, official support for Phaser 2 has now ended as we focus on preparing Phaser 3 for beta release. In a bid to keep the project tidy, and avoid confusion, we are closing all v2 related issues.

This does not mean your issue won't be looked-at. In November 2016 the Phaser CE (Community Edition) project began. The aim of Phaser CE was to allow the community to continue v2 development. Since then it has gained significant traction, with many updates and releases.

If you are still interested in having your issue investigated we strongly recommend testing the latest Phaser CE release. And only if the problem persists, opening an issue on the Phaser CE repo.

photonstorm avatar Apr 20 '17 12:04 photonstorm