convertPointFromNode method

Offset convertPointFromNode (
  1. Offset point,
  2. Node node
)

Converts a point from another nodes coordinate system into the local coordinate system of this node.

Point pointInNodeASpace = nodeA.convertPointFromNode(pointInNodeBSpace, nodeB);

Implementation

Offset convertPointFromNode(Offset point, Node node) {
  assert(node != null);
  assert(point != null);
  assert(_spriteBox != null);
  assert(_spriteBox == node._spriteBox);

  Offset boxPoint = node.convertPointToBoxSpace(point);
  Offset localPoint = convertPointToNodeSpace(boxPoint);

  return localPoint;
}