Skip to content

Commit

Permalink
Merge pull request #6506 from workgroupengineering/fixes/Input_Warnings
Browse files Browse the repository at this point in the history
Fixes input warnings
  • Loading branch information
maxkatz6 authored and grokys committed Sep 29, 2021
1 parent ea45ad6 commit af2685d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Avalonia.Input/Gestures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,21 @@ private static void PointerPressed(RoutedEventArgs ev)
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));
}
}

}
}

Expand Down
2 changes: 2 additions & 0 deletions src/Avalonia.Input/MouseDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ public Point GetPosition(IVisual relativeTo)
throw new InvalidOperationException("Control is not attached to visual tree.");
}

#pragma warning disable CS0618 // Type or member is obsolete
var rootPoint = relativeTo.VisualRoot.PointToClient(Position);
#pragma warning restore CS0618 // Type or member is obsolete
var transform = relativeTo.VisualRoot.TransformToVisual(relativeTo);
return rootPoint * transform!.Value;
}
Expand Down

0 comments on commit af2685d

Please sign in to comment.