Browse Source

fixes(Input): Suppress warning CS0618 'PointerPressedEventArgs.ClickCount' is obsolete

pull/6506/head
Giuseppe Lippolis 5 years ago
parent
commit
91c9281511
  1. 8
      src/Avalonia.Input/Gestures.cs

8
src/Avalonia.Input/Gestures.cs

@ -81,17 +81,21 @@ namespace Avalonia.Input
var e = (PointerPressedEventArgs)ev;
var visual = (IVisual)ev.Source;
if (e.ClickCount <= 1)
#pragma warning disable CS0618 // Type or member is obsolete
var clickCount = e.ClickCount;
#pragma warning restore CS0618 // Type or member is obsolete
if (clickCount <= 1)
{
s_lastPress = new WeakReference<IInteractive>(ev.Source);
}
else if (s_lastPress != null && e.ClickCount == 2 && e.GetCurrentPoint(visual).Properties.IsLeftButtonPressed)
else if (s_lastPress != null && clickCount == 2 && e.GetCurrentPoint(visual).Properties.IsLeftButtonPressed)
{
if (s_lastPress.TryGetTarget(out var target) && target == e.Source)
{
e.Source.RaiseEvent(new TappedEventArgs(DoubleTappedEvent, e));
}
}
}
}

Loading…
Cancel
Save