prime31/UIToolkit — pull request #44 by nsxdavid (2011-11-27 21:02:43+00:00)
Title: Correction for relative positioning and anchoring

Since the refactor of positioning, anchoring and relative positioning has been broken for the right and bottom.

For example:

```C#
sprite.positionFromBottomRight(0,0);
```
Would move the sprite too far and not be visible at all on screen; where one expects it to be visible an anchored to the bottom right of the screen.

None of the demo scenes that use any right/bottom positioning were working correctly.

This commit fixes this problem by fixing the logic in IPositionablePositioningExtensions.cs : refreshPosition().

Notes:

* This also introduces what I believe to be the expected behavior that if you are positioning a sprite relative to a parent, then the percentages are relative to the parent as well. For example, if I position to the bottom left but with 25% offset, it would move 25% the width of its parent. Originally it was the screen, which didn't seem to make any sense or be useable for anything in this context. Pixel offsets still work the same as they are absolute.

* There may be other issues with parenting propagation elsewhere in the code when it comes to animation, for example. I've not looked into this, nor tested this as its unrelated parts of the code. Thinking is, if this was wrong, other things might be wrong.

* All the demo scenes now work correct as far as relative positioning goes. However Kitchen Sink still has an error on startup which seems related to the original refactoring but is an entirely different bug not related to this code change.

* Even though this code works, the choice of where I put my support methods may not match the intended pattern of UIRelative. I did all my work in one file, so this might need some methods moved around.