KineticJS icon indicating copy to clipboard operation
KineticJS copied to clipboard

Kinetic.Node.prototype.setAbsolutePosition and position events

Open AimForNaN opened this issue 11 years ago • 0 comments

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).

AimForNaN avatar Nov 13 '14 14:11 AimForNaN