PointerInput Class
A pointer of an input device of the user (https://w3c.github.io/pointerevents/#dfn-pointer): the mouse, a pen, or a finger on a touch screen. See UserInput.
public sealed class PointerInputProperties
| Name | Description |
|---|---|
| Buttons | Gets the pressed buttons (https://w3c.github.io/pointerevents/#dfn-chorded-button-interactions: the buttons bit mask). A touch pointer in contact presses the primary button. |
| IsPrimary | Gets a value indicating whether the pointer is the primary pointer of its type (https://w3c.github.io/pointerevents/#dfn-primary-pointer). |
| PointerId | Gets the identifier of the pointer (https://w3c.github.io/pointerevents/#dom-pointerevent-pointerid): 1 for the mouse; a touch pointer gets a new identifier for each contact, and a pen when it is first used. |
| PointerType | Gets the type of the device: mouse, pen or touch. |
| X | Gets the horizontal position of the pointer in the viewport of the top-level browsing context. |
| Y | Gets the vertical position of the pointer in the viewport of the top-level browsing context. |
Buttons
UserInput.csIsPrimary
UserInput.csPointerId
UserInput.csPointerType
UserInput.csMethods
| Name | Description |
|---|---|
| BeginDrag(DragData) | Starts a drag from outside the page at the position of the mouse, as when the user drags files from the file manager into the window: dragenter and dragover are fired at the element under the pointer. Then PointerInput.Move fires the drag events (not the pointer events), PointerInput.Up drops the data, and Escape (KeyboardInput.Press) or PointerInput.Cancel cancels the drag. |
| Cancel() | Cancels the pointer (https://w3c.github.io/pointerevents/#dfn-pointercancel-event): pointercancel, and the buttons are released without click. |
| Down(int, PointerInputProperties?) | Presses a button of the pointer (0: primary, 1: auxiliary, 2: secondary), or starts the contact of a touch pointer. |
| Move(double, double, PointerInputProperties?) | Moves the pointer to a position of the viewport of the top-level browsing context: the boundary events, then pointermove and its compatibility mouse event; a touch pointer in contact may pan (scroll) instead, as touch-action allows. While the mouse is locked (https://w3c.github.io/pointerlock/), it keeps its position (PointerInput.X, PointerInput.Y): the events are fired at the pointer-lock target with the movement from the position of the previous move (movementX, movementY); see PointerInput.MoveBy. |
| MoveBy(double, double, PointerInputProperties?) | Moves the pointer by a distance, as PointerInput.Move does: the movement of the device that a host reads while the mouse is locked, where the pointer has no position. |
| Up(int) | Releases a button of the pointer, or ends the contact of a touch pointer: pointerup, then the click events. |
BeginDrag(DragData)
UserInput.csStarts a drag from outside the page at the position of the mouse, as when the user drags files from the file manager into the window: dragenter and dragover are fired at the element under the pointer. Then PointerInput.Move fires the drag events (not the pointer events), PointerInput.Up drops the data, and Escape (KeyboardInput.Press) or PointerInput.Cancel cancels the drag.
Parameters
dataDragData- The files, the directories and the strings that are dragged.
Exceptions
InvalidOperationException- The pointer is not the mouse, or a button is pressed.
Cancel()
UserInput.csCancels the pointer (https://w3c.github.io/pointerevents/#dfn-pointercancel-event): pointercancel, and the buttons are released without click.
public void Cancel()Down(int, PointerInputProperties?)
UserInput.csPresses a button of the pointer (0: primary, 1: auxiliary, 2: secondary), or starts the contact of a touch pointer.
public void Down(int button = 0, PointerInputProperties? properties = null)Parameters
buttonintpropertiesPointerInputProperties?
Move(double, double, PointerInputProperties?)
UserInput.csMoves the pointer to a position of the viewport of the top-level browsing context: the boundary events, then pointermove and its compatibility mouse event; a touch pointer in contact may pan (scroll) instead, as touch-action allows. While the mouse is locked (https://w3c.github.io/pointerlock/), it keeps its position (PointerInput.X, PointerInput.Y): the events are fired at the pointer-lock target with the movement from the position of the previous move (movementX, movementY); see PointerInput.MoveBy.
public void Move(double x, double y, PointerInputProperties? properties = null)Parameters
xdoubleydoublepropertiesPointerInputProperties?
MoveBy(double, double, PointerInputProperties?)
UserInput.csMoves the pointer by a distance, as PointerInput.Move does: the movement of the device that a host reads while the mouse is locked, where the pointer has no position.
public void MoveBy(double deltaX, double deltaY, PointerInputProperties? properties = null)Parameters
deltaXdoubledeltaYdoublepropertiesPointerInputProperties?