Skip to content

Example broken #26

Closed
Closed

Description

@ErikSom

The main example has this invalid object in the input:
{width: 2000, height: 2000, name: "oversized background", {frameWidth: 500, frameHeight: 500}},

Activity

  1. SchrodingersCpp commented on Apr 10, 2025

    @SchrodingersCpp

    Looks like any name is accepted, though, I'm not 100% sure:
    {width: 2000, height: 2000, name: "oversized background", some_invalid_name: {frameWidth: 500, frameHeight: 500}},

  2. soimy commented on Oct 12, 2026

    @soimy
    Owner

    Fixed by the README rewrite — closing as obsolete. The current example is valid JavaScript:

    { width: 2000, height: 2000, name: "oversized background" }, // gets a bin of its own

    For the record, the bug was the bare {frameWidth: 500, frameHeight: 500} sitting in the object literal without a key, which is a syntax error. The follow-up reading of it — some_invalid_name: {frameWidth: 500, frameHeight: 500} — is a perfectly valid nested object; an extra property has never been a problem, the missing key was. That is also why "any name is accepted": the packer only reads width and height off the input, and carries everything else through untouched.

    Oversized rects now have their own section in the guide: https://soimy.github.io/maxrects-packer/user/packing

  3. reopened this on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions