Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kinetic.Node.prototype.setAbsolutePosition and position events #1044

Open
AimForNaN opened this issue Nov 13, 2014 · 0 comments
Open

Kinetic.Node.prototype.setAbsolutePosition and position events #1044

AimForNaN opened this issue Nov 13, 2014 · 0 comments

Comments

@AimForNaN
Copy link

Currently at (near): https://github.com/ericdrowell/KineticJS/blob/master/kinetic.js#L3051

Having setPosition called before _setTransform causes events to fire with objects that have inaccurate information. By reversing the order, we can have accurate information without any noticeably undesirable side effect (as far I can tell, at least).

In other words, this

this.setPosition({x:pos.x, y:pos.y});
this._setTransform(origTrans);

Should be

this._setTransform(origTrans);
this.setPosition({x:pos.x, y:pos.y});

This is important, in my case, because I am listening for xChange and yChange events, and when receiving this information, I also try to obtain other information (i.e. rotation), and things like rotation report with a value of 0, even though that is not true. But by having the order of execution changed, things like rotation report with an accurate value on xChange and yChange events (and who knows what other areas should be modified to reflect this kind of order of execution).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant