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

maxWidth doesn't appear to be working. It simply grows beyond it's bounds. #2

Open
JoshuaBevers opened this issue Jul 12, 2023 · 0 comments

Comments

@JoshuaBevers
Copy link

var bins = [
            { width: 10, height: 20 },
            { width: 1000, height: 100 },
            { width: 50, height: 19 },
            { width: 50, height: 19 },
            { width: 50, height: 19 },
            { width: 50, height: 19 },
            { width: 50, height: 19 },
            { width: 50, height: 19 },
            { width: 50, height: 19 },
            { width: 50, height: 19 },
            { width: 50, height: 19 },
            { width: 50, height: 19 },
        ];

        var result = pack(bins, { maxWidth: 144});
        console.log(result);

        result.items.forEach((item: any) => {
            console.log(item);
        });
        
    Yeilds:
    {
      width: 1000,
      height: 215,
      items: [
        { width: 1000, height: 100, item: [Object], x: 0, y: 0 },
        { width: 50, height: 19, item: [Object], x: 0, y: 100 }, 
        { width: 50, height: 19, item: [Object], x: 50, y: 100 },
        { width: 50, height: 19, item: [Object], x: 0, y: 119 }, 
        { width: 50, height: 19, item: [Object], x: 50, y: 119 },
        { width: 50, height: 19, item: [Object], x: 0, y: 138 },
        { width: 50, height: 19, item: [Object], x: 50, y: 138 },
        { width: 50, height: 19, item: [Object], x: 0, y: 157 },
        { width: 50, height: 19, item: [Object], x: 50, y: 157 },
        { width: 50, height: 19, item: [Object], x: 0, y: 176 },
        { width: 50, height: 19, item: [Object], x: 50, y: 176 },
        { width: 10, height: 20, item: [Object], x: 0, y: 195 }
      ]
    }
    
It doesn't return any form of error or explicitly call out which ones go beyond packing comfortably within the constraint
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

1 participant