Skip to content

Commit 454964f

Browse files
committed
Set renderer type for ImageSequence effect
Adds 'image-sequence' type to the renderer in the ImageSequence constructor and toObject method for better identification. Also includes minor formatting improvements in the dispose method.
1 parent 45a177d commit 454964f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/effects/image-sequence.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ export class ImageSequence extends Rectangle {
123123
constructor(paths, ox, oy, frameRate) {
124124
super(ox, oy, 0, 0);
125125

126+
this._renderer.type = 'image-sequence';
127+
126128
for (let prop in proto) {
127129
Object.defineProperty(this, prop, proto[prop]);
128130
}
@@ -314,6 +316,7 @@ export class ImageSequence extends Rectangle {
314316
*/
315317
toObject() {
316318
const object = super.toObject.call(this);
319+
object.renderer.type = 'image-sequence';
317320
object.textures = this.textures.map(function (texture) {
318321
return texture.toObject();
319322
});
@@ -338,15 +341,15 @@ export class ImageSequence extends Rectangle {
338341
dispose() {
339342
// Call parent dispose to preserve renderer type and unbind events
340343
super.dispose();
341-
344+
342345
// Stop animation if playing
343346
if (this._playing) {
344347
this._playing = false;
345348
}
346-
349+
347350
// Clear animation callbacks
348351
this._onLastFrame = null;
349-
352+
350353
// Unbind textures collection events
351354
if (this.textures && typeof this.textures.unbind === 'function') {
352355
try {
@@ -355,7 +358,7 @@ export class ImageSequence extends Rectangle {
355358
// Ignore unbind errors for incomplete Collection objects
356359
}
357360
}
358-
361+
359362
// Dispose individual textures (more thorough than unbind)
360363
if (this.textures) {
361364
for (let i = 0; i < this.textures.length; i++) {
@@ -367,7 +370,7 @@ export class ImageSequence extends Rectangle {
367370
}
368371
}
369372
}
370-
373+
371374
return this;
372375
}
373376

0 commit comments

Comments
 (0)