globalToLocal method

Point<num> globalToLocal(
  1. Point<num> globalPoint, [
  2. Point<num>? returnPoint
])

Converts the point object from the Stage's global coordinates to this display object's local coordinates.

This method allows you to convert any given x- and y-coordinates from values that are relative to the origin (0,0) of the Stage's global coordinates to values that are relative to the origin of this display object's local coordinates.

Implementation

Point<num> globalToLocal(Point<num> globalPoint, [Point<num>? returnPoint]) {
  final p = returnPoint is Point ? returnPoint : Point<num>(0.0, 0.0);
  p.x = globalPoint.x.toDouble();
  p.y = globalPoint.y.toDouble();

  _globalToLocalRecursion(p);
  return p;
}