/// <summary> /// 计算手柄所在位置 /// </summary> /// <param name="rc"></param> /// <param name="thumbType"></param> /// <returns></returns> public static Point GetThumbPosition(this Rect rc, ThumbType thumbType) { switch (thumbType) { case ThumbType.Left: return rc.LeftCenter(); case ThumbType.Right: return rc.RightCenter(); case ThumbType.Top: return rc.TopCenter(); case ThumbType.Bottom: return rc.BottomCenter(); case ThumbType.TopLeft: return rc.TopLeft; case ThumbType.TopRight: return rc.TopRight; case ThumbType.BottomLeft: return rc.BottomLeft; case ThumbType.BottomRight: return rc.BottomRight; default: throw new ApplicationException("UnSupport Handle: " + thumbType); } }
/// <summary> /// 计算连接点位置 /// </summary> /// <param name="rc"></param> /// <param name="connectorType"></param> /// <returns></returns> public static Point GetConnectorPosition(this Rect rc, ConnectorType connectorType) { switch (connectorType) { case ConnectorType.Left: return rc.LeftCenter(); case ConnectorType.Right: return rc.RightCenter(); case ConnectorType.Top: return rc.TopCenter(); case ConnectorType.Bottom: return rc.BottomCenter(); default: throw new ApplicationException("UnSupport Connection Point Type:" + connectorType); } }
public static Rect BottomCenter(this Rect r, Vector2 v) { return r.BottomCenter(v.x, v.y); }
public static Rect BottomCenter(this Rect r, float f) { return r.BottomCenter(f, f); }
public static Rect LowerCenter(this Rect r, float width, float height) { return r.BottomCenter(width, height); }
public static Rect LowerCenter(this Rect r, Vector2 v) { return r.BottomCenter(v); }
public static Vector2 LowerCenter(this Rect r) { return r.BottomCenter(); }