prime31/UIToolkit — Issue #66: Miscalculation in sprite percent positioning when centerized
Author: cayse
Created: 2012-01-29 18:16:05+00:00
State: open

Problem in sprite positioning if sprite centerized.
sample:
var sprite = spriteToolkit.addSprite( "spritename.png", 0, 0, 1 );
sprite.centerize();
sprite.positionFromBottomLeft( .0f, 0.f );

sprite must be at bottom left but wrongly in near center left

Solution:
if sprite used centerize(); then
wrong
line 76 pos.y = -UIRelative.yPercentFrom( UIyAnchor.Bottom, percentFromBottom, sprite.height );
must be
line 76 pos.y = -UIRelative.yPercentFrom( UIyAnchor.Bottom, percentFromBottom, 0 );
but only for centrerized sprite

maybe some like:
if (sprite.gameObjectOriginInCenter)
pos.y = -UIRelative.yPercentFrom( UIyAnchor.Bottom, percentFromBottom, 0 );
else
pos.y = -UIRelative.yPercentFrom( UIyAnchor.Bottom, percentFromBottom, sprite.height );

P.S. possibly in anothers metods same error ...