Harden a few pieces of viewport controller logic

-Don't eat mouse/keyboard release events in the ViewportManipulatorController
-Do a key activity check in the LegacyViewportCameraController instead of checking state (this could be done elsewhere but it seems to be working as-is and is scheduled to go away)
-Ignore idle mouse delta updates sent to the modular camera controller

Signed-off-by: nvsickle <nvsickle@amazon.com>
monroegm-disable-blank-issue-2
nvsickle 5 years ago
parent f4c96fc9df
commit 042e465622

@ -404,7 +404,7 @@ bool LegacyViewportCameraControllerInstance::HandleInputChannelEvent(const AzFra
}
else if (auto key = GetKeyboardKey(event.m_inputChannel); key != Qt::Key_unknown)
{
if (state == InputChannel::State::Ended)
if (!event.m_inputChannel.IsActive())
{
m_pressedKeys.erase(key);
}

@ -216,7 +216,8 @@ namespace SandboxEditor
interactionHandled, AzToolsFramework::GetEntityContextId(), targetInteractionEvent, mouseInteractionEvent);
}
return interactionHandled;
// Only filter button/key press events, not release events
return interactionHandled && event.m_inputChannel.IsActive();
}
void ViewportManipulatorControllerInstance::ResetInputChannels()

@ -747,19 +747,23 @@ namespace AzFramework
return button == inputChannelId;
});
if (inputChannelId == InputDeviceMouse::Movement::X)
// Accept active mouse channel updates, inactive movement channels will just have a 0 delta.
if (inputChannel.IsActive())
{
return HorizontalMotionEvent{ aznumeric_cast<int>(inputChannel.GetValue()) };
}
else if (inputChannelId == InputDeviceMouse::Movement::Y)
{
return VerticalMotionEvent{ aznumeric_cast<int>(inputChannel.GetValue()) };
}
else if (inputChannelId == InputDeviceMouse::Movement::Z)
{
return ScrollEvent{ inputChannel.GetValue() };
if (inputChannelId == InputDeviceMouse::Movement::X)
{
return HorizontalMotionEvent{ aznumeric_cast<int>(inputChannel.GetValue()) };
}
else if (inputChannelId == InputDeviceMouse::Movement::Y)
{
return VerticalMotionEvent{ aznumeric_cast<int>(inputChannel.GetValue()) };
}
else if (inputChannelId == InputDeviceMouse::Movement::Z)
{
return ScrollEvent{ inputChannel.GetValue() };
}
}
else if (wasMouseButton || InputDeviceKeyboard::IsKeyboardDevice(inputDeviceId))
if (wasMouseButton || InputDeviceKeyboard::IsKeyboardDevice(inputDeviceId))
{
return DiscreteInputEvent{ inputChannelId, inputChannel.GetState() };
}

Loading…
Cancel
Save