diff --git a/Gems/Gestures/Code/Include/Gestures/IGestureRecognizer.h b/Gems/Gestures/Code/Include/Gestures/IGestureRecognizer.h index 69e28df102..e606d68a3e 100644 --- a/Gems/Gestures/Code/Include/Gestures/IGestureRecognizer.h +++ b/Gems/Gestures/Code/Include/Gestures/IGestureRecognizer.h @@ -209,12 +209,17 @@ namespace Gestures //////////////////////////////////////////////////////////////////////////////////////////////// inline uint32_t IRecognizer::GetGesturePointerIndex(const AzFramework::InputChannel& inputChannel) { - const auto& mouseButtonIt = AZStd::find(AzFramework::InputDeviceMouse::Button::All.cbegin(), - AzFramework::InputDeviceMouse::Button::All.cend(), - inputChannel.GetInputChannelId()); - if (mouseButtonIt != AzFramework::InputDeviceMouse::Button::All.cend()) + // Only recognize gestures for the default mouse input device. The Editor may register synthetic + // mouse input devices with the same mouse input channels, which can confuse gesture recognition. + if (inputChannel.GetInputDevice().GetInputDeviceId() == AzFramework::InputDeviceMouse::Id) { - return static_cast(mouseButtonIt - AzFramework::InputDeviceMouse::Button::All.cbegin()); + const auto& mouseButtonIt = AZStd::find(AzFramework::InputDeviceMouse::Button::All.cbegin(), + AzFramework::InputDeviceMouse::Button::All.cend(), + inputChannel.GetInputChannelId()); + if (mouseButtonIt != AzFramework::InputDeviceMouse::Button::All.cend()) + { + return static_cast(mouseButtonIt - AzFramework::InputDeviceMouse::Button::All.cbegin()); + } } const auto& touchIndexIt = AZStd::find(AzFramework::InputDeviceTouch::Touch::All.cbegin(),