Skip to content

Commit 7c9dfef

Browse files
committed
Loader resize handler.
1 parent e63988f commit 7c9dfef

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/loader/Loader.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,23 @@ Phaser.Loader.prototype = {
212212

213213
},
214214

215+
/**
216+
* Called automatically by ScaleManager when the game resizes in RESIZE scalemode.
217+
* We use this to adjust the height of the preloading sprite, if set.
218+
*
219+
* @method Phaser.Loader#resize
220+
* @param {number} width - The new width of the game in pixels.
221+
* @param {number} height - The new height of the game in pixels.
222+
*/
223+
resize: function () {
224+
225+
if (this.preloadSprite && this.preloadSprite.height !== this.preloadSprite.sprite.height)
226+
{
227+
this.preloadSprite.rect.height = this.preloadSprite.sprite.height;
228+
}
229+
230+
},
231+
215232
/**
216233
* Check whether asset exists with a specific key.
217234
* Use Phaser.Cache to access loaded assets, e.g. Phaser.Cache#checkImageKey

0 commit comments

Comments
 (0)