ericdrowell/KineticJS — pull request #48 by vijairamcharan (2012-07-10 18:36:44+00:00)
Title: Issue with getAbsolutePosition() when used with a parent with a center offset

Hi Eric,

I was running into an issue where getAbsolutePosition() did not work correctly. In my scenario this was happening when the shape was part of a Group with a center offset.

The center offset translation was being applied in the draw function, but not in the getTransform.

What did I do:

1) Unit test to demonstrate the issue
My first commit adds a unit test for demonstrating the issue. This unit test will fail without the changes in my second commit
2) My proposal for fixing the issue
In my second commit I moved the center offset translation to the getTransform which seems to be the correct place for it.

I have run all the tests and they are passing.

Note: If people have been using workaround (eg. by applying center offset calculations after calling getAbsolutePosition) this fix might break things for them. However, I get the feeling it is not a big issue.

Looking forward to your reaction.

kr, Vijai