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.

Point pointInBoxCoordinates = myNode.convertPointToBoxSpace(localPoint);

Implementation

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

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