phaser
phaser copied to clipboard
NineSlice does not respect pivot point of texture set by TexturePacker
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.
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?
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
Both should be in the same position.
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.