localToParent method

Point<num> localToParent (Point<num> localPoint, [ Point<num> returnPoint ])

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

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

Implementation

Point<num> localToParent(Point<num> localPoint, [Point<num> returnPoint]) {
  var p = returnPoint is Point ? returnPoint : Point<num>(0.0, 0.0);
  var x = localPoint.x.toDouble();
  var y = localPoint.y.toDouble();
  var m = this.transformationMatrix;

  p.x = x * m.a + y * m.c + m.tx;
  p.y = x * m.b + y * m.d + m.ty;

  return p;
}