Skip to content

Commit

Permalink
fail and warn when spriteatlas is full
Browse files Browse the repository at this point in the history
ref #1633
  • Loading branch information
ansis committed Jan 6, 2016
1 parent 6171a2f commit 09281d6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/symbol/bin_pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ BinPack.prototype.allocate = function(width, height) {

if (smallest < 0) {
// There's no space left for this char.
return { x: -1, y: -1 };
return { x: -1, y: -1, w: 0, h: 0 };
}

this.free.splice(smallest, 1);
Expand Down
1 change: 1 addition & 0 deletions js/symbol/sprite_atlas.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ SpriteAtlas.prototype.allocateImage = function(pixelWidth, pixelHeight) {
// Add a 1px border around every image.
var rect = this.bin.allocate(packWidth, packHeight);
if (rect.w === 0) {
console.warn('SpriteAtlas out of space.');
return rect;
}

Expand Down

0 comments on commit 09281d6

Please sign in to comment.