Skip to content

sendPointToPlane

sendPointToPlane(point, from?, to?): Point

Defined in: util/misc/planeChange.ts:36

Sends a point from the source coordinate plane to the destination coordinate plane.
From the canvas/viewer’s perspective the point remains unchanged.

Point

TMat2D = iMatrix

plane matrix containing object. Passing undefined is equivalent to passing the identity matrix, which means point exists in the canvas coordinate plane.

TMat2D = iMatrix

destination plane matrix to contain object. Passing undefined means point should be sent to the canvas coordinate plane.

Point

transformed point

Send point from canvas plane to group plane

var obj = new Rect({ left: 20, top: 20, width: 60, height: 60, strokeWidth: 0 });
var group = new Group([obj], { strokeWidth: 0 });
var sentPoint1 = sendPointToPlane(new Point(50, 50), undefined, group.calcTransformMatrix());
var sentPoint2 = sendPointToPlane(new Point(50, 50), iMatrix, group.calcTransformMatrix());
console.log(sentPoint1, sentPoint2) // both points print (0,0) which is the center of group