Skip to content

Commit

Permalink
fix(pointers): don't respond to multiple mouse button presses at the …
Browse files Browse the repository at this point in the history
…same time
  • Loading branch information
ramezgerges committed Jul 31, 2024
1 parent ab52a98 commit e576ca5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Uno.UI/UI/Xaml/Internal/InputManager.Pointers.Managed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,12 @@ private void OnPointerExited(Windows.UI.Core.PointerEventArgs args)

private void OnPointerPressed(Windows.UI.Core.PointerEventArgs args)
{
// If 2+ mouse buttons are pressed, we only respond to the first.
if (args.CurrentPoint.PointerDeviceType == PointerDeviceType.Mouse && _pressedElements.Count != 0)
{
return;
}

if (TryRedirectPointerPress(args))
{
return;
Expand Down Expand Up @@ -387,6 +393,13 @@ private void OnPointerPressed(Windows.UI.Core.PointerEventArgs args)

private void OnPointerReleased(Windows.UI.Core.PointerEventArgs args)
{
// When multiple mouse buttons are pressed and then released, we only respond to the last OnPointerReleased
// (i.e when no more buttons are still pressed).
if (args.CurrentPoint.PointerDeviceType == PointerDeviceType.Mouse && args.CurrentPoint.IsInContact)
{
return;
}

if (TryRedirectPointerRelease(args))
{
return;
Expand Down

0 comments on commit e576ca5

Please sign in to comment.