Dela via


InkManager.ProcessPointerUpdate(PointerPoint) Method

Definition

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Processes position and state properties, such as pressure and tilt, for the specified pointer, from the last pointer event up to and including the current pointer event.Call this method after ProcessPointerDown and before ProcessPointerUp.

Important

This method is not supported in desktop apps.

public:
 virtual Platform::Object ^ ProcessPointerUpdate(PointerPoint ^ pointerPoint) = ProcessPointerUpdate;
IInspectable ProcessPointerUpdate(PointerPoint const& pointerPoint);
public object ProcessPointerUpdate(PointerPoint pointerPoint);
function processPointerUpdate(pointerPoint)
Public Function ProcessPointerUpdate (pointerPoint As PointerPoint) As Object

Parameters

pointerPoint
PointerPoint

The input pointer for which updates are to be processed.

Returns

Object

Platform::Object

IInspectable

When the current InkManipulationMode is Inking or Selecting, this method returns the Point (screen position in ink space) associated with the last ProcessPointerUpdate of pointerPoint.

Examples

The following example demonstrates a handler for a PointerMoved event on an InkCanvas.

Here, the intermediate points (intermediatePoints) unprocessed since the last update are processed by the InkManager (inkManager) in the ProcessPointerUpdate call.

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, ProcessPointerUpdate returns an 
                // `invalidateRect` (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;
        }
    }
}

Applies to

See also