convertPointToBoxSpace method

Offset convertPointToBoxSpace(
  1. Offset nodePoint
)

Converts a point from the local coordinate system of the node to the coordinate system of the SpriteBox.

var pointInBoxCoordinates =
  myNode.convertPointToBoxSpace(localPoint);

Implementation

Offset convertPointToBoxSpace(Offset nodePoint) {
  assert(_spriteBox != null);

  Vector4 v = _nodeToBoxMatrix()
      .transform(Vector4(nodePoint.dx, nodePoint.dy, 0.0, 1.0));
  return Offset(v[0], v[1]);
}