Skip to content

Commit

Permalink
fix(spriteSheet): actually default margin and spacing to 0 (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
straker authored Aug 21, 2024
1 parent dc3362e commit 787d607
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/spriteSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ class SpriteSheet {
image,
frameWidth,
frameHeight,
spacing,
margin,
spacing = 0,
margin = 0,
animations
} = {}) {
// @ifdef DEBUG
Expand Down
12 changes: 12 additions & 0 deletions test/unit/spriteSheet.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ describe('spriteSheet', () => {
expect(SpriteSheetClass.prototype.createAnimations.called).to.be
.true;
});

it('should default margin and spacing to 0', () => {
let spriteSheet = SpriteSheet({
image: new Image(100, 200),
frameWidth: 10,
frameHeight: 10
});

expect(spriteSheet.frame.margin).to.equal(0);
expect(spriteSheet.frame.spacing).to.equal(0);
expect(spriteSheet._f).to.equal(10);
});
});

// --------------------------------------------------
Expand Down

0 comments on commit 787d607

Please sign in to comment.