Exemple #1
0
 protected override void OnUntouchedCore(Point imagePoint)
 {
     base.OnUntouchedCore(imagePoint);
     UnsuspendControllerSafe();
     originalTouchPoint        = TouchPoint.None;
     originalTouchPointerStyle = TouchPointerStyle.None;
 }
Exemple #2
0
 protected override void OnTouchedCore(Point imagePoint)
 {
     base.OnTouchedCore(imagePoint);
     UnsuspendControllerSafe();
     controllerSuspender       = Controller.SuspendCallManipulations();
     originalTouchPointerStyle = GetTouchPointerStyleCore(imagePoint);
     originalTouchPoint        = GetTouchPoint(imagePoint);
 }
        protected override void OnUntouchedCore(Point imagePoint)
        {
            touchedPointerStyle = TouchPointerStyle.None;
            touchedPoint        = VisualZoomCropController.TouchPoint.None;
            touchedCell         = new Point(-1, -1);

            if (suspendImageChangedEventOnTouch)
            {
                SourceImage.TriggerImageChanged();
                suspendImageChangedEventOnTouch = false;
            }
            base.OnUntouchedCore(imagePoint);
        }
 protected override void OnTouchedCore(Point imagePoint)
 {
     if (MouseMode == MouseActionMode.Shift)
     {
         base.OnTouchedCore(imagePoint);
     }
     else if (MouseMode == MouseActionMode.Pen)
     {
         suspendImageChangedEventOnTouch = true;
         Pen(CellFromImagePoint(imagePoint));
     }
     else if (MouseMode == MouseActionMode.Fill)
     {
         Fill(CellFromImagePoint(imagePoint));
     }
     else if (MouseMode == MouseActionMode.Select)
     {
         touchedPointerStyle = GetTouchPointerStyleCore(imagePoint);                 // Should be saved calculated first
         touchedPoint        = GetTouchPoint(imagePoint);
         var point = touchedCell = CellFromImagePoint(imagePoint);
         if (point.X >= 0 && point.X < SourceImage.Size.Width && point.Y >= 0 && point.Y < SourceImage.Size.Height)
         {
             if (touchedPoint == VisualZoomCropController.TouchPoint.None || SelectedRect.Width == 0 || SelectedRect.Height == 0)
             {
                 SelectedRect = new Rectangle(point.X, point.Y, 1, 1);
             }
         }
     }
     else if (MouseMode == MouseActionMode.MoveSelection)
     {
         var cellPoint = CellFromImagePoint(imagePoint);
         if (!SelectedRect.ContainsPoint(cellPoint))
         {
             FinishMoveSelection();
         }
         else
         {
             initialTouchImagePoint = cellPoint;
         }
     }
 }
Exemple #5
0
        internal static TouchPoint GetTouchPoint(Point imagePoint, TouchPointerStyle touchPointerStyle, Rectangle cropRect)
        {
            switch (touchPointerStyle)
            {
            case TouchPointerStyle.ResizeHorizontal:
                return(IsInsideRadius(imagePoint.X, cropRect.Left) ? TouchPoint.Left : TouchPoint.Right);

            case TouchPointerStyle.ResizeVertical:
                return(IsInsideRadius(imagePoint.Y, cropRect.Top) ? TouchPoint.Top : TouchPoint.Bottom);

            case TouchPointerStyle.ResizeLeftTop_RightBottom:
                return(IsInsideRadius(imagePoint.X, cropRect.Left) ? TouchPoint.LeftTop : TouchPoint.RightBottom);

            case TouchPointerStyle.ResizeRightTop_LeftBottom:
                return(IsInsideRadius(imagePoint.X, cropRect.Left) ? TouchPoint.LeftBottom : TouchPoint.RightTop);

            case TouchPointerStyle.ResizeAll:
                return(TouchPoint.Middle);

            default:
                return(TouchPoint.None);
            }
        }