diff --git a/src/Avalonia.Input/IPointer.cs b/src/Avalonia.Input/IPointer.cs
index 361f3ac370..98f7c81f02 100644
--- a/src/Avalonia.Input/IPointer.cs
+++ b/src/Avalonia.Input/IPointer.cs
@@ -1,15 +1,53 @@
namespace Avalonia.Input
{
+ ///
+ /// Identifies specific pointer generated by input device.
+ ///
+ ///
+ /// Some devices, for instance, touchscreen might generate a pointer on each physical contact.
+ ///
public interface IPointer
{
+ ///
+ /// Gets a unique identifier for the input pointer.
+ ///
int Id { get; }
+
+ ///
+ /// Captures pointer input to the specified control.
+ ///
+ /// The control.
+ ///
+ /// When an element captures the pointer, it receives pointer input whether the cursor is
+ /// within the control's bounds or not. The current pointer capture control is exposed
+ /// by the property.
+ ///
void Capture(IInputElement? control);
+
+ ///
+ /// Gets the control that is currently capturing by the pointer, if any.
+ ///
+ ///
+ /// When an element captures the pointer, it receives pointer input whether the cursor is
+ /// within the control's bounds or not. To set the pointer capture, call the
+ /// method.
+ ///
IInputElement? Captured { get; }
+
+ ///
+ /// Gets the pointer device type.
+ ///
PointerType Type { get; }
+
+ ///
+ /// Gets a value that indicates whether the input is from the primary pointer when multiple pointers are registered.
+ ///
bool IsPrimary { get; }
-
}
+ ///
+ /// Enumerates pointer device types.
+ ///
public enum PointerType
{
Mouse,
diff --git a/src/Avalonia.Input/PointerEventArgs.cs b/src/Avalonia.Input/PointerEventArgs.cs
index 79335eb9fc..058c2f9cc1 100644
--- a/src/Avalonia.Input/PointerEventArgs.cs
+++ b/src/Avalonia.Input/PointerEventArgs.cs
@@ -67,7 +67,14 @@ namespace Avalonia.Input
public IPointer? TryGetPointer(RawPointerEventArgs ev) => _ev.Pointer;
}
+ ///
+ /// Gets specific pointer generated by input device.
+ ///
public IPointer Pointer { get; }
+
+ ///
+ /// Gets the time when the input occurred.
+ ///
public ulong Timestamp { get; }
private IPointerDevice? _device;
@@ -91,7 +98,10 @@ namespace Avalonia.Input
return mods;
}
}
-
+
+ ///
+ /// Gets a value that indicates which key modifiers were active at the time that the pointer event was initiated.
+ ///
public KeyModifiers KeyModifiers { get; }
private Point GetPosition(Point pt, IVisual? relativeTo)
@@ -102,7 +112,12 @@ namespace Avalonia.Input
return pt;
return pt * _rootVisual.TransformToVisual(relativeTo) ?? default;
}
-
+
+ ///
+ /// Gets the pointer position relative to a control.
+ ///
+ /// The control.
+ /// The pointer position in the control's coordinates.
public Point GetPosition(IVisual? relativeTo) => GetPosition(_rootVisualPosition, relativeTo);
[Obsolete("Use GetCurrentPoint")]
diff --git a/src/Avalonia.Input/PointerPoint.cs b/src/Avalonia.Input/PointerPoint.cs
index c704aa28c6..71145b5cb0 100644
--- a/src/Avalonia.Input/PointerPoint.cs
+++ b/src/Avalonia.Input/PointerPoint.cs
@@ -2,6 +2,9 @@ using Avalonia.Input.Raw;
namespace Avalonia.Input
{
+ ///
+ /// Provides basic properties for the input pointer associated with a single mouse, pen/stylus, or touch contact.
+ ///
public sealed class PointerPoint
{
public PointerPoint(IPointer pointer, Point position, PointerPointProperties properties)
@@ -10,34 +13,109 @@ namespace Avalonia.Input
Position = position;
Properties = properties;
}
+
+ ///
+ /// Gets specific pointer generated by input device.
+ ///
public IPointer Pointer { get; }
+
+ ///
+ /// Gets extended information about the input pointer.
+ ///
public PointerPointProperties Properties { get; }
+
+ ///
+ /// Gets the location of the pointer input in client coordinates.
+ ///
public Point Position { get; }
}
+ ///
+ /// Provides extended properties for a PointerPoint object.
+ ///
public sealed class PointerPointProperties
{
+ ///
+ /// Gets a value that indicates whether the pointer input was triggered by the primary action mode of an input device.
+ ///
public bool IsLeftButtonPressed { get; }
+
+ ///
+ /// Gets a value that indicates whether the pointer input was triggered by the tertiary action mode of an input device.
+ ///
public bool IsMiddleButtonPressed { get; }
+
+ ///
+ /// Gets a value that indicates whether the pointer input was triggered by the secondary action mode (if supported) of an input device.
+ ///
public bool IsRightButtonPressed { get; }
+
+ ///
+ /// Gets a value that indicates whether the pointer input was triggered by the first extended mouse button (XButton1).
+ ///
public bool IsXButton1Pressed { get; }
+
+ ///
+ /// Gets a value that indicates whether the pointer input was triggered by the second extended mouse button (XButton2).
+ ///
public bool IsXButton2Pressed { get; }
+
+ ///
+ /// Gets a value that indicates whether the barrel button of the pen/stylus device is pressed.
+ ///
public bool IsBarrelButtonPressed { get; }
+
+ ///
+ /// Gets a value that indicates whether the input is from a pen eraser.
+ ///
public bool IsEraser { get; }
+
+ ///
+ /// Gets a value that indicates whether the digitizer pen is inverted.
+ ///
public bool IsInverted { get; }
+ ///
+ /// Gets the clockwise rotation in degrees of a pen device around its own major axis (such as when the user spins the pen in their fingers).
+ ///
+ ///
+ /// A value between 0.0 and 359.0 in degrees of rotation. The default value is 0.0.
+ ///
public float Twist { get; }
- public float Pressure { get; }
+
+ ///
+ /// Gets a value that indicates the force that the pointer device (typically a pen/stylus) exerts on the surface of the digitizer.
+ ///
+ ///
+ /// A value from 0 to 1.0. The default value is 0.5.
+ ///
+ public float Pressure { get; } = 0.5f;
+
+ ///
+ /// Gets the plane angle between the Y-Z plane and the plane that contains the Y axis and the axis of the input device (typically a pen/stylus).
+ ///
+ ///
+ /// The value is 0.0 when the finger or pen is perpendicular to the digitizer surface, between 0.0 and 90.0 when tilted to the right of perpendicular, and between 0.0 and -90.0 when tilted to the left of perpendicular. The default value is 0.0.
+ ///
public float XTilt { get; }
- public float YTilt { get; }
+ ///
+ /// Gets the plane angle between the X-Z plane and the plane that contains the X axis and the axis of the input device (typically a pen/stylus).
+ ///
+ ///
+ /// The value is 0.0 when the finger or pen is perpendicular to the digitizer surface, between 0.0 and 90.0 when tilted towards the user, and between 0.0 and -90.0 when tilted away from the user. The default value is 0.0.
+ ///
+ public float YTilt { get; }
+ ///
+ /// Gets the kind of pointer state change.
+ ///
public PointerUpdateKind PointerUpdateKind { get; }
private PointerPointProperties()
- {
+ {
}
-
+
public PointerPointProperties(RawInputModifiers modifiers, PointerUpdateKind kind)
{
PointerUpdateKind = kind;