//------------------------------------------------------------------------------- // // Private Methods // //------------------------------------------------------------------------------- #region Private Methods /// <summary> /// SelectionAdorner MouseButtonDown /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void OnAdornerMouseButtonDownEvent(object sender, MouseButtonEventArgs args) { // If the ButtonDown is raised by RightMouse, we should just bail out. if ( (args.StylusDevice == null && args.LeftButton != MouseButtonState.Pressed) ) { return; } Point pointOnSelectionAdorner = args.GetPosition(InkCanvas.SelectionAdorner); InkCanvasSelectionHitResult hitResult = InkCanvasSelectionHitResult.None; // Check if we should start resizing/moving hitResult = HitTestOnSelectionAdorner(pointOnSelectionAdorner); if ( hitResult != InkCanvasSelectionHitResult.None ) { // We always use MouseDevice for the selection editing. EditingCoordinator.ActivateDynamicBehavior(EditingCoordinator.SelectionEditingBehavior, args.Device); } else { // //push selection and we're done // // If the current captured device is Stylus, we should activate the LassoSelectionBehavior with // the Stylus. Otherwise, use mouse. EditingCoordinator.ActivateDynamicBehavior(EditingCoordinator.LassoSelectionBehavior, args.StylusDevice != null ? args.StylusDevice : args.Device); } }
// Token: 0x060077B8 RID: 30648 RVA: 0x00222B14 File Offset: 0x00220D14 internal InkCanvasSelectionHitResult SelectionHandleHitTest(Point point) { InkCanvasSelectionHitResult inkCanvasSelectionHitResult = InkCanvasSelectionHitResult.None; Rect wireFrameRect = this.GetWireFrameRect(); if (!wireFrameRect.IsEmpty) { for (InkCanvasSelectionHitResult inkCanvasSelectionHitResult2 = InkCanvasSelectionHitResult.TopLeft; inkCanvasSelectionHitResult2 <= InkCanvasSelectionHitResult.Left; inkCanvasSelectionHitResult2++) { Rect rect; Rect rect2; this.GetHandleRect(inkCanvasSelectionHitResult2, wireFrameRect, out rect, out rect2); if (rect2.Contains(point)) { inkCanvasSelectionHitResult = inkCanvasSelectionHitResult2; break; } } if (inkCanvasSelectionHitResult == InkCanvasSelectionHitResult.None && Rect.Inflate(wireFrameRect, 4.0, 4.0).Contains(point)) { inkCanvasSelectionHitResult = InkCanvasSelectionHitResult.Selection; } } return(inkCanvasSelectionHitResult); }
// Token: 0x06006D84 RID: 28036 RVA: 0x001F72D4 File Offset: 0x001F54D4 internal InkCanvasSelectionHitResult HitTestSelection(Point pointOnInkCanvas) { if (this._activeSelectionHitResult != null) { return(this._activeSelectionHitResult.Value); } if (!this.HasSelection) { return(InkCanvasSelectionHitResult.None); } GeneralTransform generalTransform = this._inkCanvas.TransformToDescendant(this._inkCanvas.SelectionAdorner); Point point = generalTransform.Transform(pointOnInkCanvas); InkCanvasSelectionHitResult inkCanvasSelectionHitResult = this._inkCanvas.SelectionAdorner.SelectionHandleHitTest(point); if (inkCanvasSelectionHitResult == InkCanvasSelectionHitResult.Selection && this.SelectedElements.Count == 1 && this.SelectedStrokes.Count == 0) { GeneralTransform generalTransform2 = this._inkCanvas.TransformToDescendant(this._inkCanvas.InnerCanvas); Point pointOnInnerCanvas = generalTransform2.Transform(pointOnInkCanvas); if (this.HasHitSingleSelectedElement(pointOnInnerCanvas)) { inkCanvasSelectionHitResult = InkCanvasSelectionHitResult.None; } } return(inkCanvasSelectionHitResult); }
// Token: 0x06006D7B RID: 28027 RVA: 0x001F6DE4 File Offset: 0x001F4FE4 internal void StartFeedbackAdorner(Rect feedbackRect, InkCanvasSelectionHitResult activeSelectionHitResult) { this._activeSelectionHitResult = new InkCanvasSelectionHitResult?(activeSelectionHitResult); AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this._inkCanvas.InnerCanvas); InkCanvasFeedbackAdorner feedbackAdorner = this._inkCanvas.FeedbackAdorner; adornerLayer.Add(feedbackAdorner); feedbackAdorner.UpdateBounds(feedbackRect); }
// Token: 0x060077BD RID: 30653 RVA: 0x00222EDC File Offset: 0x002210DC private void GetHandleRect(InkCanvasSelectionHitResult hitResult, Rect rectWireFrame, out Rect visibleRect, out Rect toleranceRect) { Point point = default(Point); double num = 0.0; double num2 = 3.0; switch (hitResult) { case InkCanvasSelectionHitResult.TopLeft: num = 8.0; point = new Point(rectWireFrame.Left, rectWireFrame.Top); break; case InkCanvasSelectionHitResult.Top: num = 6.0; point = new Point(rectWireFrame.Left + rectWireFrame.Width / 2.0, rectWireFrame.Top); num2 = 5.0; break; case InkCanvasSelectionHitResult.TopRight: num = 8.0; point = new Point(rectWireFrame.Right, rectWireFrame.Top); break; case InkCanvasSelectionHitResult.Right: num = 6.0; point = new Point(rectWireFrame.Right, rectWireFrame.Top + rectWireFrame.Height / 2.0); num2 = 5.0; break; case InkCanvasSelectionHitResult.BottomRight: num = 8.0; point = new Point(rectWireFrame.Right, rectWireFrame.Bottom); break; case InkCanvasSelectionHitResult.Bottom: num = 6.0; point = new Point(rectWireFrame.Left + rectWireFrame.Width / 2.0, rectWireFrame.Bottom); num2 = 5.0; break; case InkCanvasSelectionHitResult.BottomLeft: num = 8.0; point = new Point(rectWireFrame.Left, rectWireFrame.Bottom); break; case InkCanvasSelectionHitResult.Left: num = 6.0; point = new Point(rectWireFrame.Left, rectWireFrame.Top + rectWireFrame.Height / 2.0); num2 = 5.0; break; } visibleRect = new Rect(point.X - num / 2.0, point.Y - num / 2.0, num, num); toleranceRect = visibleRect; toleranceRect.Inflate(num2, num2); }
/// <summary> /// This method updates the cursor when the mouse is hovering ont the selection adorner. /// It is called from /// OnAdornerMouseLeaveEvent /// OnAdornerMouseEvent /// </summary> /// <param name="hitPoint">the handle is being hit</param> private void UpdateSelectionCursor(Point hitPoint) { InkCanvasSelectionHitResult hitResult = HitTestOnSelectionAdorner(hitPoint); if ( _hitResult != hitResult ) { // Keep the current handle _hitResult = hitResult; EditingCoordinator.InvalidateBehaviorCursor(this); } }
// Token: 0x060077BB RID: 30651 RVA: 0x00222C40 File Offset: 0x00220E40 private void DrawHandles(DrawingContext drawingContext, Rect rectWireFrame) { for (InkCanvasSelectionHitResult inkCanvasSelectionHitResult = InkCanvasSelectionHitResult.TopLeft; inkCanvasSelectionHitResult <= InkCanvasSelectionHitResult.Left; inkCanvasSelectionHitResult++) { Rect rectangle; Rect rect; this.GetHandleRect(inkCanvasSelectionHitResult, rectWireFrame, out rectangle, out rect); drawingContext.DrawRectangle(this._adornerFillBrush, this._adornerPenBrush, rectangle); } }
// Token: 0x06006DEC RID: 28140 RVA: 0x001FA254 File Offset: 0x001F8454 private void UpdateSelectionCursor(Point hitPoint) { InkCanvasSelectionHitResult inkCanvasSelectionHitResult = this.HitTestOnSelectionAdorner(hitPoint); if (this._hitResult != inkCanvasSelectionHitResult) { this._hitResult = inkCanvasSelectionHitResult; base.EditingCoordinator.InvalidateBehaviorCursor(this); } }
/// <summary> /// Draw Handles /// </summary> /// <param name="drawingContext"></param> /// <param name="rectWireFrame"></param> private void DrawHandles(DrawingContext drawingContext, Rect rectWireFrame) { for (InkCanvasSelectionHitResult hitResult = InkCanvasSelectionHitResult.TopLeft; hitResult <= InkCanvasSelectionHitResult.Left; hitResult++) { // Draw the handle Rect toleranceRect; Rect visibleRect; GetHandleRect(hitResult, rectWireFrame, out visibleRect, out toleranceRect); drawingContext.DrawRectangle(_adornerFillBrush, _adornerPenBrush, visibleRect); } }
// Token: 0x06006DCA RID: 28106 RVA: 0x001F8F28 File Offset: 0x001F7128 internal static Cursor GetSelectionCursor(InkCanvasSelectionHitResult hitResult, bool isRightToLeft) { Cursor result; switch (hitResult) { case InkCanvasSelectionHitResult.TopLeft: case InkCanvasSelectionHitResult.BottomRight: if (isRightToLeft) { result = Cursors.SizeNESW; } else { result = Cursors.SizeNWSE; } break; case InkCanvasSelectionHitResult.Top: case InkCanvasSelectionHitResult.Bottom: result = Cursors.SizeNS; break; case InkCanvasSelectionHitResult.TopRight: case InkCanvasSelectionHitResult.BottomLeft: if (isRightToLeft) { result = Cursors.SizeNWSE; } else { result = Cursors.SizeNESW; } break; case InkCanvasSelectionHitResult.Right: case InkCanvasSelectionHitResult.Left: result = Cursors.SizeWE; break; case InkCanvasSelectionHitResult.Selection: result = Cursors.SizeAll; break; default: result = Cursors.Cross; break; } return(result); }
private void OnAdornerMouseButtonDownEvent(object sender, MouseButtonEventArgs args) { if (args.StylusDevice == null && args.LeftButton != MouseButtonState.Pressed) { return; } Point position = args.GetPosition(base.InkCanvas.SelectionAdorner); InkCanvasSelectionHitResult inkCanvasSelectionHitResult = this.HitTestOnSelectionAdorner(position); if (inkCanvasSelectionHitResult != InkCanvasSelectionHitResult.None) { base.EditingCoordinator.ActivateDynamicBehavior(base.EditingCoordinator.SelectionEditingBehavior, args.Device); return; } base.EditingCoordinator.ActivateDynamicBehavior(base.EditingCoordinator.LassoSelectionBehavior, (args.StylusDevice != null) ? args.StylusDevice : args.Device); }
// Token: 0x06006DEB RID: 28139 RVA: 0x001FA1EC File Offset: 0x001F83EC private InkCanvasSelectionHitResult HitTestOnSelectionAdorner(Point position) { InkCanvasSelectionHitResult inkCanvasSelectionHitResult = InkCanvasSelectionHitResult.None; if (base.InkCanvas.InkCanvasSelection.HasSelection) { inkCanvasSelectionHitResult = base.InkCanvas.SelectionAdorner.SelectionHandleHitTest(position); if (inkCanvasSelectionHitResult >= InkCanvasSelectionHitResult.TopLeft && inkCanvasSelectionHitResult <= InkCanvasSelectionHitResult.Left) { inkCanvasSelectionHitResult = (base.InkCanvas.ResizeEnabled ? inkCanvasSelectionHitResult : InkCanvasSelectionHitResult.None); } else if (inkCanvasSelectionHitResult == InkCanvasSelectionHitResult.Selection) { inkCanvasSelectionHitResult = (base.InkCanvas.MoveEnabled ? inkCanvasSelectionHitResult : InkCanvasSelectionHitResult.None); } } return(inkCanvasSelectionHitResult); }
//------------------------------------------------------------------------------- // // Internal Methods // //------------------------------------------------------------------------------- #region Internal Methods /// <summary> /// Start a feedback rubberband. /// This method is called from SelectionEditingBehavior.OnActivated /// </summary> /// <param name="feedbackRect"></param> /// <param name="activeSelectionHitResult"></param> internal void StartFeedbackAdorner(Rect feedbackRect, InkCanvasSelectionHitResult activeSelectionHitResult) { Debug.Assert(_inkCanvas.EditingCoordinator.UserIsEditing == true); Debug.Assert(activeSelectionHitResult != InkCanvasSelectionHitResult.None, "activeSelectionHitResult cannot be InkCanvasSelectionHitResult.None."); _activeSelectionHitResult = activeSelectionHitResult; AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(_inkCanvas.InnerCanvas); // Until the next start, we are going to use this adorner regardless user will change feedback adorner or not during the editing. InkCanvasFeedbackAdorner feedbackAdorner = _inkCanvas.FeedbackAdorner; // The feedback adorner shouldn't have been connected to the adorner layer yet. Debug.Assert(VisualTreeHelper.GetParent(feedbackAdorner) == null, "feedbackAdorner shouldn't be added to tree."); // Now, attach the feedback adorner to the adorner layer. Then update its bounds adornerLayer.Add(feedbackAdorner); feedbackAdorner.UpdateBounds(feedbackRect); }
internal InkCanvasSelectionHitResult HitTestSelection(Point pointOnInkCanvas) { // If Selection is moving or resizing now, we should returns the active hit result. if (_activeSelectionHitResult.HasValue) { return(_activeSelectionHitResult.Value); } // No selection at all. Just return None. if (!HasSelection) { return(InkCanvasSelectionHitResult.None); } // Get the transform from InkCanvas to SelectionAdorner GeneralTransform inkCanvasToSelectionAdorner = _inkCanvas.TransformToDescendant(_inkCanvas.SelectionAdorner); Point pointOnSelectionAdorner = inkCanvasToSelectionAdorner.Transform(pointOnInkCanvas); InkCanvasSelectionHitResult hitResult = _inkCanvas.SelectionAdorner.SelectionHandleHitTest(pointOnSelectionAdorner); // If the hit test returns Selection and there is one and only one element is selected. // We have to check whether we hit on inside the element. if (hitResult == InkCanvasSelectionHitResult.Selection && SelectedElements.Count == 1 && SelectedStrokes.Count == 0) { GeneralTransform transformToInnerCanvas = _inkCanvas.TransformToDescendant(_inkCanvas.InnerCanvas); Point pointOnInnerCanvas = transformToInnerCanvas.Transform(pointOnInkCanvas); // Try to find out whether we hit the single selement. If so, just return None. if (HasHitSingleSelectedElement(pointOnInnerCanvas)) { hitResult = InkCanvasSelectionHitResult.None; } } return(hitResult); }
/// <summary> /// Hit test for the grab handles /// </summary> /// <param name="position"></param> /// <returns></returns> private InkCanvasSelectionHitResult HitTestOnSelectionAdorner(Point position) { InkCanvasSelectionHitResult hitResult = InkCanvasSelectionHitResult.None; if ( InkCanvas.InkCanvasSelection.HasSelection ) { // First, do hit test on the adorner hitResult = InkCanvas.SelectionAdorner.SelectionHandleHitTest(position); // Now, check if ResizeEnabled or MoveEnabled has been set. // If so, reset the grab handle. if ( hitResult >= InkCanvasSelectionHitResult.TopLeft && hitResult <= InkCanvasSelectionHitResult.Left ) { hitResult = InkCanvas.ResizeEnabled ? hitResult : InkCanvasSelectionHitResult.None; } else if ( hitResult == InkCanvasSelectionHitResult.Selection ) { hitResult = InkCanvas.MoveEnabled ? hitResult : InkCanvasSelectionHitResult.None; } } return hitResult; }
/// <summary> /// SelectionHandleHitTest /// </summary> /// <param name="point"></param> /// <returns></returns> internal InkCanvasSelectionHitResult SelectionHandleHitTest(Point point) { InkCanvasSelectionHitResult result = InkCanvasSelectionHitResult.None; Rect rectWireFrame = GetWireFrameRect(); if (!rectWireFrame.IsEmpty) { // Hit test on the grab handles first for (InkCanvasSelectionHitResult hitResult = InkCanvasSelectionHitResult.TopLeft; hitResult <= InkCanvasSelectionHitResult.Left; hitResult++) { Rect toleranceRect; Rect visibleRect; GetHandleRect(hitResult, rectWireFrame, out visibleRect, out toleranceRect); if (toleranceRect.Contains(point)) { result = hitResult; break; } } // Now, check if we hit on the frame if (result == InkCanvasSelectionHitResult.None) { Rect outterRect = Rect.Inflate(rectWireFrame, CornerResizeHandleSize / 2, CornerResizeHandleSize / 2); if (outterRect.Contains(point)) { result = InkCanvasSelectionHitResult.Selection; //We need to add Hittest on the selected element } } } return(result); }
/// <summary> /// Retrieve selection cursor /// </summary> /// <param name="hitResult">hitResult</param> /// <param name="isRightToLeft">True if InkCanvas.FlowDirection is RightToLeft, false otherwise</param> /// <returns></returns> internal static Cursor GetSelectionCursor(InkCanvasSelectionHitResult hitResult, bool isRightToLeft) { Cursor cursor; switch ( hitResult ) { case InkCanvasSelectionHitResult.TopLeft: case InkCanvasSelectionHitResult.BottomRight: { if (isRightToLeft) { cursor = Cursors.SizeNESW; } else { cursor = Cursors.SizeNWSE; } break; } case InkCanvasSelectionHitResult.Bottom: case InkCanvasSelectionHitResult.Top: { cursor = Cursors.SizeNS; break; } case InkCanvasSelectionHitResult.BottomLeft: case InkCanvasSelectionHitResult.TopRight: { if (isRightToLeft) { cursor = Cursors.SizeNWSE; } else { cursor = Cursors.SizeNESW; } break; } case InkCanvasSelectionHitResult.Left: case InkCanvasSelectionHitResult.Right: { cursor = Cursors.SizeWE; break; } case InkCanvasSelectionHitResult.Selection: { cursor = Cursors.SizeAll; break; } default: { // By default, use the Cross cursor. cursor = Cursors.Cross; break; } } return cursor; }
/// <summary> /// Retrieve selection cursor /// </summary> /// <param name="hitResult">hitResult</param> /// <param name="isRightToLeft">True if InkCanvas.FlowDirection is RightToLeft, false otherwise</param> /// <returns></returns> internal static Cursor GetSelectionCursor(InkCanvasSelectionHitResult hitResult, bool isRightToLeft) { Cursor cursor; switch (hitResult) { case InkCanvasSelectionHitResult.TopLeft: case InkCanvasSelectionHitResult.BottomRight: { if (isRightToLeft) { cursor = Cursors.SizeNESW; } else { cursor = Cursors.SizeNWSE; } break; } case InkCanvasSelectionHitResult.Bottom: case InkCanvasSelectionHitResult.Top: { cursor = Cursors.SizeNS; break; } case InkCanvasSelectionHitResult.BottomLeft: case InkCanvasSelectionHitResult.TopRight: { if (isRightToLeft) { cursor = Cursors.SizeNWSE; } else { cursor = Cursors.SizeNESW; } break; } case InkCanvasSelectionHitResult.Left: case InkCanvasSelectionHitResult.Right: { cursor = Cursors.SizeWE; break; } case InkCanvasSelectionHitResult.Selection: { cursor = Cursors.SizeAll; break; } default: { // By default, use the Cross cursor. cursor = Cursors.Cross; break; } } return(cursor); }
/// <summary> /// Returns the handle rect (both visibile and the tolerance one) /// </summary> private void GetHandleRect(InkCanvasSelectionHitResult hitResult, Rect rectWireFrame, out Rect visibleRect, out Rect toleranceRect) { Point center = new Point(); double size = 0; double tolerance = ResizeHandleTolerance; switch ( hitResult ) { case InkCanvasSelectionHitResult.TopLeft: { size = CornerResizeHandleSize; center = new Point(rectWireFrame.Left, rectWireFrame.Top); break; } case InkCanvasSelectionHitResult.Top: { size = MiddleResizeHandleSize; center = new Point(rectWireFrame.Left + rectWireFrame.Width / 2, rectWireFrame.Top); tolerance = (CornerResizeHandleSize - MiddleResizeHandleSize) + ResizeHandleTolerance; break; } case InkCanvasSelectionHitResult.TopRight: { size = CornerResizeHandleSize; center = new Point(rectWireFrame.Right, rectWireFrame.Top); break; } case InkCanvasSelectionHitResult.Left: { size = MiddleResizeHandleSize; center = new Point(rectWireFrame.Left, rectWireFrame.Top + rectWireFrame.Height / 2); tolerance = (CornerResizeHandleSize - MiddleResizeHandleSize) + ResizeHandleTolerance; break; } case InkCanvasSelectionHitResult.Right: { size = MiddleResizeHandleSize; center = new Point(rectWireFrame.Right, rectWireFrame.Top + rectWireFrame.Height / 2); tolerance = (CornerResizeHandleSize - MiddleResizeHandleSize) + ResizeHandleTolerance; break; } case InkCanvasSelectionHitResult.BottomLeft: { size = CornerResizeHandleSize; center = new Point(rectWireFrame.Left, rectWireFrame.Bottom); break; } case InkCanvasSelectionHitResult.Bottom: { size = MiddleResizeHandleSize; center = new Point(rectWireFrame.Left + rectWireFrame.Width / 2, rectWireFrame.Bottom); tolerance = (CornerResizeHandleSize - MiddleResizeHandleSize) + ResizeHandleTolerance; break; } case InkCanvasSelectionHitResult.BottomRight: { size = CornerResizeHandleSize; center = new Point(rectWireFrame.Right, rectWireFrame.Bottom); break; } } visibleRect = new Rect(center.X - size / 2, center.Y - size / 2, size, size); toleranceRect = visibleRect; toleranceRect.Inflate(tolerance, tolerance); }
//------------------------------------------------------------------------------- // // Internal Methods // //------------------------------------------------------------------------------- #region Internal Methods /// <summary> /// Start a feedback rubberband. /// This method is called from SelectionEditingBehavior.OnActivated /// </summary> /// <param name="feedbackRect"></param> /// <param name="activeSelectionHitResult"></param> internal void StartFeedbackAdorner(Rect feedbackRect, InkCanvasSelectionHitResult activeSelectionHitResult) { Debug.Assert( _inkCanvas.EditingCoordinator.UserIsEditing == true ); Debug.Assert(activeSelectionHitResult != InkCanvasSelectionHitResult.None, "activeSelectionHitResult cannot be InkCanvasSelectionHitResult.None."); _activeSelectionHitResult = activeSelectionHitResult; AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(_inkCanvas.InnerCanvas); // Until the next start, we are going to use this adorner regardless user will change feedback adorner or not during the editing. InkCanvasFeedbackAdorner feedbackAdorner = _inkCanvas.FeedbackAdorner; // The feedback adorner shouldn't have been connected to the adorner layer yet. Debug.Assert(VisualTreeHelper.GetParent(feedbackAdorner) == null, "feedbackAdorner shouldn't be added to tree."); // Now, attach the feedback adorner to the adorner layer. Then update its bounds adornerLayer.Add(feedbackAdorner); feedbackAdorner.UpdateBounds(feedbackRect); }
/// <summary> /// Returns the handle rect (both visibile and the tolerance one) /// </summary> private void GetHandleRect(InkCanvasSelectionHitResult hitResult, Rect rectWireFrame, out Rect visibleRect, out Rect toleranceRect) { Point center = new Point(); double size = 0; double tolerance = ResizeHandleTolerance; switch (hitResult) { case InkCanvasSelectionHitResult.TopLeft: { size = CornerResizeHandleSize; center = new Point(rectWireFrame.Left, rectWireFrame.Top); break; } case InkCanvasSelectionHitResult.Top: { size = MiddleResizeHandleSize; center = new Point(rectWireFrame.Left + rectWireFrame.Width / 2, rectWireFrame.Top); tolerance = (CornerResizeHandleSize - MiddleResizeHandleSize) + ResizeHandleTolerance; break; } case InkCanvasSelectionHitResult.TopRight: { size = CornerResizeHandleSize; center = new Point(rectWireFrame.Right, rectWireFrame.Top); break; } case InkCanvasSelectionHitResult.Left: { size = MiddleResizeHandleSize; center = new Point(rectWireFrame.Left, rectWireFrame.Top + rectWireFrame.Height / 2); tolerance = (CornerResizeHandleSize - MiddleResizeHandleSize) + ResizeHandleTolerance; break; } case InkCanvasSelectionHitResult.Right: { size = MiddleResizeHandleSize; center = new Point(rectWireFrame.Right, rectWireFrame.Top + rectWireFrame.Height / 2); tolerance = (CornerResizeHandleSize - MiddleResizeHandleSize) + ResizeHandleTolerance; break; } case InkCanvasSelectionHitResult.BottomLeft: { size = CornerResizeHandleSize; center = new Point(rectWireFrame.Left, rectWireFrame.Bottom); break; } case InkCanvasSelectionHitResult.Bottom: { size = MiddleResizeHandleSize; center = new Point(rectWireFrame.Left + rectWireFrame.Width / 2, rectWireFrame.Bottom); tolerance = (CornerResizeHandleSize - MiddleResizeHandleSize) + ResizeHandleTolerance; break; } case InkCanvasSelectionHitResult.BottomRight: { size = CornerResizeHandleSize; center = new Point(rectWireFrame.Right, rectWireFrame.Bottom); break; } } visibleRect = new Rect(center.X - size / 2, center.Y - size / 2, size, size); toleranceRect = visibleRect; toleranceRect.Inflate(tolerance, tolerance); }