Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite recrusion when using addArray of oversized rect with non-exclusive tag matching #28

Closed
tionkje opened this issue Apr 28, 2021 · 2 comments

Comments

@tionkje
Copy link

tionkje commented Apr 28, 2021

When adding a rect that oversizes the exclusively tagged bin using addArray, It hangs and after some time crashes with RangeError: Maximum call stack size exceeded

const opt = { smart: true, pot: false, square: false, allowRotation: false, 
    tag: true,
    exclusiveTag: false
}         
const packer = new MaxRectsPacker(1024, 1024, 0, opt)
let input = [
    {width: 2000, height: 1000, data: { tag: 'bla' }} 
];
packer.addArray(input); // Never returns / RangeError: Maximum call stack size exceeded

The same happens when the sum of the rects ends up oversized

let input = [
    {width: 1000, height: 1000, data: { number:1, tag: 'bla' }},
    {width: 1000, height: 1000, data: { number:2, tag: 'bla' }} 
];
packer.addArray(input); // Never returns / RangeError: Maximum call stack size exceeded

No big issue, just annoying when trying to reduce the size of the output bins.

Otherwise great stuff 👍

@dylanbox
Copy link
Contributor

dylanbox commented Jun 1, 2021

@tionkje Take a look now with this new version to see if it solves your issue!

@tionkje
Copy link
Author

tionkje commented Jun 1, 2021

Yes this fixed my test case. Thanks!

I did notice that a single over sized rect seems to just disappear? I think it normally creates a bin with an oversized flag.

@tionkje tionkje closed this as completed Jun 1, 2021
@avaer avaer mentioned this issue Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants