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

Support anchor/pivot point in atlas #31

Open
DannyT opened this issue Dec 1, 2019 · 0 comments
Open

Support anchor/pivot point in atlas #31

DannyT opened this issue Dec 1, 2019 · 0 comments

Comments

@DannyT
Copy link

DannyT commented Dec 1, 2019

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 🙏

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