Skip to content

Commit

Permalink
Merge pull request #343 from Codas/spritesheet-fixes
Browse files Browse the repository at this point in the history
Some spritesheet fixes
  • Loading branch information
Haxxer authored Oct 22, 2024
2 parents 0d15bad + 1809d6b commit 43a3081
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/canvas-effects/sequencer-sprite-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,9 @@ export class SequencerSpriteManager extends PIXI.Container {
const prev = this.managedSprite;
view.tint = prev.tint;
view.anchor.copyFrom(prev.anchor);
view.scale.copyFrom(prev.scale);
view.width = prev.width;
view.height = prev.height;
view.scale.copyFrom(prev.scale);
view.tileScale.copyFrom(prev.tileScale);
view.tilePosition.copyFrom(prev.tilePosition);
view.pivot.copyFrom(prev.pivot);
Expand Down
5 changes: 3 additions & 2 deletions src/lib/meshes/AnimatedSpriteMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,12 @@ export default class AnimatedSpriteMesh extends TilingSpriteMesh {
return;
}
this._previousFrame = currentFrame;
this.texture = this._textures[currentFrame];
this._texture = this._textures[currentFrame];
this._textureID = -1;
this._textureTrimmedID = -1;
this._cachedTint = [1, 1, 1, 1];
this.updateUvs();
this.uvs.set(this._texture._uvs.uvsFloat32);

if (this.updateAnchor) {
this._anchor.copyFrom(this._texture.defaultAnchor);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/spritesheets/FramePacker.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class FramePacker {
* @param {number} scaleFactor
* @return {Promise<{buffer: Uint8Array, size: Size}>}
*/
async function getScaledImageBuffer(buffer, sourceSize, scaleFactor) {
const getScaledImageBuffer = async (buffer, sourceSize, scaleFactor) => {
if (scaleFactor === 1) {
return { buffer, size: sourceSize };
}
Expand Down
4 changes: 2 additions & 2 deletions src/modules/sequencer-file-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const SequencerFileCache = {
)
return undefined
}
return result.spritesheet
return result?.spritesheet
},

registerSpritesheet(inSrc, inSpriteSheet) {
Expand All @@ -182,7 +182,6 @@ const SequencerFileCache = {
*/
async unloadSpritesheet(inSrc) {
const existingSheetRef = this._spritesheets.get(inSrc)
this._generateSpritesheetJobs.delete(inSrc)
if (!existingSheetRef) {
console.error("trying to unlaod spritesheet that was not loaded:", inSrc)
return
Expand All @@ -191,6 +190,7 @@ const SequencerFileCache = {
if (existingSheetRef[1] > 0) {
return
}
this._generateSpritesheetJobs.delete(inSrc)
this._spritesheets.delete(inSrc)
/** @type {PIXI.Spritesheet} */
const sheet = existingSheetRef[0]
Expand Down

0 comments on commit 43a3081

Please sign in to comment.