Merge pull request #1324 from cloudflightio/master

Fix math in Transform.setAbsolutePosition
This commit is contained in:
Anton Lavrenov 2022-04-13 16:15:16 -05:00 committed by GitHub
commit 81cf46c18a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -206,25 +206,6 @@ export class Transform {
getMatrix() {
return this.m;
}
/**
* set to absolute position via translation
* @method
* @name Konva.Transform#setAbsolutePosition
* @returns {Konva.Transform}
* @author ericdrowell
*/
setAbsolutePosition(x: number, y: number) {
var m0 = this.m[0],
m1 = this.m[1],
m2 = this.m[2],
m3 = this.m[3],
m4 = this.m[4],
m5 = this.m[5],
yt = (m0 * (y - m5) - m1 * (x - m4)) / (m0 * m3 - m1 * m2),
xt = (x - m4 - m2 * yt) / m0;
return this.translate(xt, yt);
}
/**
* convert transformation matrix back into node's attributes
* @method