Skip to content

Support anchor/pivot point in atlas #31

@DannyT

Description

@DannyT

Atlas/Sprite sheet creation tools like TexturePacker offer the ability to set anchor/pivot points on images. NinePatch currently doesn't take these into account.

In this screenshot I have loaded an image from my atlas, once using this.add.image and once using this.add.ninePatch, both defining the same x and y position:

image

In TexturePacker, the pivot point is set to 0, 0 (top left) which the default phaser image add is respecting but not in NinePatch.

This is the relevant json from the atlas:

{
    "filename": "controls/beige-panel.png",
    "rotated": false,
    "trimmed": false,
    "sourceSize": {
        "w": 100,
        "h": 100
    },
    "spriteSourceSize": {
        "x": 0,
        "y": 0,
        "w": 100,
        "h": 100
    },
    "frame": {
        "x": 4,
        "y": 1,
        "w": 100,
        "h": 100
    },
    "anchor": {
        "x": 0,
        "y": 0
    }
}

Would be great to have support for this if at all possible 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions