9patch rotation

I am rotating a 9patch, and it rotates, if we only stop at how it looks. But in fact there is a big problem with it : the 9patch looks rotated but its position stays unchanged.

The letters at the bottom are all positioned based on the 9patch position. And if you put the both image on each other, you will that the position of the 9patch doesn’t change.

Angle = 0

Angle = 90

I will find a workaround for this but this is a big problem.
Steps to reproduce :

  • Add a 9patch and place it on the Scene
  • Use the debugger and look at the position
  • Change the rotation of the 9patch with an event
  • Comeback to the debugger, refresh, and see that nothing changed.


Objects position X() and Y() always stays the same when objects are rotated.
Maybe BoundingBoxLeft() and BoundingBoxTop()could help.

But ? This doesn’t make any sense ?
If items had the same position, then they would rotate around their origin and the result should be like this :

Instead, my result is like this :

Which means it rotates around the center, my origin moves, but you tell me the position is the red dot ?
I don’t get it. And yes i changed my example to see if it was the same behavior for sprites. And the answer is yes as you can see.

For sprites you can use points with NewSprite.PointX("MyPoint"). They rotate with the sprite.

You can use this action to see the points:

Sure, but why not the origin then ?
And my issue still was with 9Patch, and from what i read there is no solution instead of doing all the maths myself.

It would be strange if the object position changed when it’s rotated, but NewSprite.PointX("Origin") should work.

For 9-patch, there is still BoundingBoxLeft() and BoundingBoxTop().

My images show that the origin naturally moves by itself when it rotates so it looks logical to me that it had to change.

But yeah, i’ll use workarounds instead.