soimy / maxrects-packer

A max rectangle 2d bin packer npm-module for packing glyphs or images into multiple sprite-sheet/atlas

Home Page:https://soimy.github.io/maxrects-packer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

packer.addArray(array) fails if the array is empty and exclusiveTag: false is set

CosmoMyzrailGorynych opened this issue · comments

It is not a critical issue but is a case of inconsistent behavior under different settings.

To reproduce:

const Packer = require('maxrects-packer').MaxRectsPacker;
const packer = new Packer(atlasWidth, atlasHeight, 0, {
    pot: true,
    square: true,
    tag: true,
    exclusiveTag: false
});
packer.addArray([]); // Bazinga! Cannot read property 'data' of undefined
                     // Does work if you remove `exclusiveTag: false`