Update Map.Avalonia.cs

This commit is contained in:
ClemensFischer 2024-05-19 23:46:11 +02:00
parent 4c6322b193
commit 5294594846

View file

@ -22,6 +22,9 @@ namespace MapControl
public Map() public Map()
{ {
PointerWheelChanged += OnPointerWheelChanged; PointerWheelChanged += OnPointerWheelChanged;
PointerPressed += OnPointerPressed;
PointerReleased += OnPointerReleased;
PointerMoved += OnPointerMoved;
} }
/// <summary> /// <summary>
@ -56,10 +59,8 @@ namespace MapControl
cancellationTokenSource = null; cancellationTokenSource = null;
} }
protected override void OnPointerPressed(PointerPressedEventArgs e) private void OnPointerPressed(object sender, PointerPressedEventArgs e)
{ {
base.OnPointerPressed(e);
var point = e.GetCurrentPoint(this); var point = e.GetCurrentPoint(this);
if (point.Properties.IsLeftButtonPressed) if (point.Properties.IsLeftButtonPressed)
@ -69,10 +70,8 @@ namespace MapControl
} }
} }
protected override void OnPointerReleased(PointerReleasedEventArgs e) private void OnPointerReleased(object sender, PointerReleasedEventArgs e)
{ {
base.OnPointerReleased(e);
if (mousePosition.HasValue) if (mousePosition.HasValue)
{ {
e.Pointer.Capture(null); e.Pointer.Capture(null);
@ -80,10 +79,8 @@ namespace MapControl
} }
} }
protected override void OnPointerMoved(PointerEventArgs e) private void OnPointerMoved(object sender, PointerEventArgs e)
{ {
base.OnPointerMoved(e);
if (mousePosition.HasValue) if (mousePosition.HasValue)
{ {
var position = e.GetPosition(this); var position = e.GetPosition(this);