Browse Source

Renamed GetPointerPoint to GetCurrentPoint to match UWP

pull/3101/head
Nikita Tsukanov 6 years ago
parent
commit
1b5f3b6cc8
  1. 4
      src/Avalonia.Controls/MenuItem.cs
  2. 13
      src/Avalonia.Input/PointerEventArgs.cs

4
src/Avalonia.Controls/MenuItem.cs

@ -337,7 +337,7 @@ namespace Avalonia.Controls
{
base.OnPointerEnter(e);
var point = e.GetPointerPoint(null);
var point = e.GetCurrentPoint(null);
RaiseEvent(new PointerEventArgs(PointerEnterItemEvent, this, e.Pointer, this.VisualRoot, point.Position,
e.Timestamp, point.Properties, e.KeyModifiers));
}
@ -347,7 +347,7 @@ namespace Avalonia.Controls
{
base.OnPointerLeave(e);
var point = e.GetPointerPoint(null);
var point = e.GetCurrentPoint(null);
RaiseEvent(new PointerEventArgs(PointerLeaveItemEvent, this, e.Pointer, this.VisualRoot, point.Position,
e.Timestamp, point.Properties, e.KeyModifiers));
}

13
src/Avalonia.Input/PointerEventArgs.cs

@ -88,9 +88,20 @@ namespace Avalonia.Input
return _rootVisualPosition * _rootVisual.TransformToVisual(relativeTo) ?? default;
}
public PointerPoint GetPointerPoint(IVisual relativeTo)
[Obsolete("Use GetCurrentPoint")]
public PointerPoint GetPointerPoint(IVisual relativeTo) => GetCurrentPoint(relativeTo);
/// <summary>
/// Returns the PointerPoint associated with the current event
/// </summary>
/// <param name="relativeTo">The visual which coordinate system to use. Pass null for toplevel coordinate system</param>
/// <returns></returns>
public PointerPoint GetCurrentPoint(IVisual relativeTo)
=> new PointerPoint(Pointer, GetPosition(relativeTo), _properties);
/// <summary>
/// Returns the current pointer point properties
/// </summary>
protected PointerPointProperties Properties => _properties;
}

Loading…
Cancel
Save