public static void ClearSelection(this Windows.UI.Input.Inking.InkManager inkManager)
 {
     foreach (var stroke in inkManager.GetStrokes())
     {
         stroke.Selected = false;
     }
 }
 public static void SelectAll(this Windows.UI.Input.Inking.InkManager inkManager)
 {
     foreach (var stroke in inkManager.GetStrokes())
     {
         stroke.Selected = true;
     }
 }
 public static bool AnySelected(this Windows.UI.Input.Inking.InkManager inkManager)
 {
     foreach (var stroke in inkManager.GetStrokes())
     {
         if (stroke.Selected)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 4
0
        void InkingArea_PointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            var pointerPoint = e.GetCurrentPoint(InkingArea);

            if (pointerId == (int)pointerPoint.PointerId)
            {
                switch (inkManager.Mode)
                {
                case Windows.UI.Input.Inking.InkManipulationMode.Erasing:
                    // Check if something has been erased.
                    // In erase mode InkManager::ProcessPointerUpdate returns an invalidate
                    // rectangle: if it is not degenerate something has been erased
                    // In erase mode we don't bother processing intermediate points
                    var invalidateRect = (Windows.Foundation.Rect)inkManager.ProcessPointerUpdate(e.GetCurrentPoint(InkingArea));
                    if (invalidateRect.Height != 0 && invalidateRect.Width != 0)
                    {
                        // We don't know what has been erased so we clear the render
                        // and add back all the ink saved in the ink manager
                        renderer.Clear();
                        renderer.AddInk(inkManager.GetStrokes());
                    }
                    break;

                case Windows.UI.Input.Inking.InkManipulationMode.Inking:
                case Windows.UI.Input.Inking.InkManipulationMode.Selecting:
                    // Process intermediate points
                    var intermediatePoints = e.GetIntermediatePoints(InkingArea);
                    for (int i = intermediatePoints.Count - 1; i >= 0; i--)
                    {
                        inkManager.ProcessPointerUpdate(intermediatePoints[i]);
                    }

                    // Live rendering
                    renderer.UpdateLiveRender(pointerPoint);
                    break;
                }
            }
        }