Skip to content

Commit 6d10be6

Browse files
committed
When creating a Sprite or Image using a texture atlas it would set the frame twice, once in loadTexture and once when the initial frame is set. This has been reduced down to just a single setting now.
1 parent ee5f645 commit 6d10be6

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ Version 2.0.6 - "Jornhill" - -in development-
107107
* A Canvas style set from a game config object used an incorrect property (thanks @TatumCreative, fix #861)
108108
* Phaser.Line.intersectsPoints fixed for floating point inaccuracy (thanks @woutercommandeur, fix #865)
109109
* Sound.destroy(true) would call remove on the SoundManager, which in turn would throw a TypeError as it tried to remove the sound events twice (thanks @AnderbergE, fix #874)
110+
* When creating a Sprite or Image using a texture atlas it would set the frame twice, once in loadTexture and once when the initial frame is set. This has been reduced down to just a single setting now.
110111

111112
### Migration Guide
112113

src/animation/AnimationManager.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,28 @@ Phaser.AnimationManager.prototype = {
7878
* @method Phaser.AnimationManager#loadFrameData
7979
* @private
8080
* @param {Phaser.FrameData} frameData - The FrameData set to load.
81+
* @param {string|number} frame - The frame to default to.
8182
*/
82-
loadFrameData: function (frameData) {
83+
loadFrameData: function (frameData, frame) {
8384

8485
this._frameData = frameData;
85-
this.frame = 0;
86+
87+
if (typeof frame === 'undefined' || frame === null)
88+
{
89+
this.frame = 0;
90+
}
91+
else
92+
{
93+
if (typeof frame === 'string')
94+
{
95+
this.frameName = frame;
96+
}
97+
else
98+
{
99+
this.frame = frame;
100+
}
101+
}
102+
86103
this.isLoaded = true;
87104

88105
},

0 commit comments

Comments
 (0)