/// <summary> /// Determines if the given point is inside this handle's bounds. /// </summary> /// <param name="p"> /// A <c>PointF</c> value in document coordinates. /// </param> /// <returns> /// True if the point is considered "on" the handle. /// </returns> /// <remarks> /// This assumes that handles are actually hollow when the /// <see cref="P:Northwoods.Go.GoHandle.HandleID" /> is <see cref="P:Northwoods.Go.GoHandle.GoObject" />.<c>NoHandle</c>-- /// that is, a point well inside the handle's bounds is /// not considered "on" the handle if the handle's ID is /// <see cref="P:Northwoods.Go.GoHandle.GoObject" />.<c>NoHandle</c>. This is useful for /// letting bounding handles be ignored by mouse over behavior. /// Note that this method does not take the <see cref="P:Northwoods.Go.GoHandle.Style" /> /// into account--it assumes the handle is rectangular. /// </remarks> public override bool ContainsPoint(PointF p) { RectangleF a = Bounds; float penWidth = PenWidth; GoObject.InflateRect(ref a, penWidth / 2f, penWidth / 2f); if (!GoObject.ContainsRect(a, p)) { return(false); } if (HandleID == 0) { GoObject.InflateRect(ref a, 0f - penWidth, 0f - penWidth); return(!GoObject.ContainsRect(a, p)); } return(true); }
/// <summary> /// Unlike the standard behavior provided by <see cref="T:Northwoods.Go.GoGroup" />'s <see cref="M:Northwoods.Go.GoGroup.PickObjects(System.Drawing.PointF,System.Boolean,Northwoods.Go.IGoCollection,System.Int32)" />, /// subgraphs allow the picking of more than one child, if they overlap each other at the given point. /// </summary> /// <param name="p"></param> /// <param name="selectableOnly"></param> /// <param name="coll"></param> /// <param name="max"></param> /// <returns></returns> /// <remarks> /// If <see cref="M:Northwoods.Go.GoObject.CanView" /> is false for this group, no children are added to the collection. /// </remarks> public override IGoCollection PickObjects(PointF p, bool selectableOnly, IGoCollection coll, int max) { if (coll == null) { coll = new GoCollection(); } if (coll.Count >= max) { return(coll); } if (!GoObject.ContainsRect(Bounds, p)) { return(coll); } if (!CanView()) { return(coll); } foreach (GoObject backward in base.Backwards) { GoSubGraphBase goSubGraphBase = backward as GoSubGraphBase; if (goSubGraphBase != null) { goSubGraphBase.PickObjects(p, selectableOnly, coll, max); } else { GoObject goObject = backward.Pick(p, selectableOnly); if (goObject != null) { coll.Add(goObject); if (coll.Count >= max) { return(coll); } } } } if (PickableBackground && (!selectableOnly || CanSelect())) { coll.Add(this); } return(coll); }
/// <summary> /// Treat this rectangle as being hollow--the user can only pick the rectangle when close to the edge. /// </summary> /// <param name="p"></param> /// <returns></returns> public override bool ContainsPoint(PointF p) { GoView view = base.View; if (view == null) { return(false); } RectangleF a = Bounds; float num = 4f / view.DocScale; GoObject.InflateRect(ref a, num, num); if (!GoObject.ContainsRect(a, p)) { return(false); } GoObject.InflateRect(ref a, -2f * num, -2f * num); return(!GoObject.ContainsRect(a, p)); }