Skip to content

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

@AimForNaN

Description

@AimForNaN

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions