localToGlobal method
Converts the point object from this display object's local coordinates
to the Stage
global 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 the
Stage
's global coordinates.
Implementation
Point<num> localToGlobal(Point<num> localPoint, [Point<num>? returnPoint]) {
final p = returnPoint is Point ? returnPoint : Point<num>(0.0, 0.0);
p.x = localPoint.x.toDouble();
p.y = localPoint.y.toDouble();
for (DisplayObject? obj = this; obj != null; obj = obj.parent) {
obj.localToParent(p, p);
}
return p;
}