/// <summary> /// Transforms a point from the local coordinate system to GRoot coordinates. /// </summary> /// <param name="pt"></param> /// <param name="r"></param> /// <returns></returns> public Vector2 LocalToRoot(Vector2 pt, GRoot r) { pt = displayObject.LocalToGlobal(pt); if (r == null || r == GRoot.inst) { //fast pt.x /= GRoot.contentScaleFactor; pt.y /= GRoot.contentScaleFactor; } else { return(r.GlobalToLocal(pt)); } return(pt); }
/// <summary> /// Transforms a point from the local coordinate system to GRoot coordinates. /// </summary> /// <param name="pt"></param> /// <param name="r"></param> /// <returns></returns> public Vector2 LocalToRoot(Vector2 pt, GRoot r) { pt = LocalToGlobal(pt); if (r == null || r == GRoot.inst) { //fast pt.x /= GRoot.contentScaleFactor; pt.y /= GRoot.contentScaleFactor; } else return r.GlobalToLocal(pt); return pt; }