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

NineSlice does not respect pivot point of texture set by TexturePacker #6655

Closed
michalfialadev opened this issue Oct 21, 2023 · 2 comments
Closed

Comments

@michalfialadev
Copy link

michalfialadev commented Oct 21, 2023

When Phaser.Gameobjects.Image from an atlas made by TexturePacker is added to scene, and the Frame of such image has a custom Pivot Point, this image in Phaser will automatically have it's pivot point set to the pivot point set inside the TexturePacker IDE.

Is same possible to be done, when NineSlice is used for such atlas Frame? Currently the NineSlice created using frame with custom Pivot point will not inherit this custom pivot point. This introduces a discrepancy, when Image or NineSlice is used for same Frame.

image

The image above, when NineSlice is used to display it, will not take it's custom pivot point into account, but will have its origin set to (0.5,0.5)

EDIT: it seems NineSlice doesnt support setOrigin at all. Can it be made to support custom origin?

@CodeAndWeb
Copy link
Contributor

CodeAndWeb commented Nov 13, 2023

setOrigin seems to work.
However loading the origin from the sprite sheet does not - I can confirm this.

button.png has a pivot point of 0/0 set in TexturePacker.

        this.add.nineslice(50,50,'cityscene', 'button.png', 100, 50);
        this.add.sprite(50,50,'cityscene', 'button.png');

When loaded as a Sprite, it's positioned correctly. The NineSlice is misaligned with the origin of 0.5/0.5

2023-11-13_17-05-57

Both should be in the same position.

@rgk
Copy link
Collaborator

rgk commented Feb 20, 2024

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants