chore: address changes add test cases
Signed-off-by: Michael Pollind <mpollind@gmail.com>
This commit is contained in:
@@ -241,7 +241,7 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
void QtEventToAzInputMapper::SetCursorMode(QtEventToAzInputMapper::CursorInputMode mode)
|
||||
void QtEventToAzInputMapper::SetCursorMode(AzToolsFramework::CursorInputMode mode)
|
||||
{
|
||||
if (mode != m_cursorMode)
|
||||
{
|
||||
@@ -445,7 +445,7 @@ namespace AzToolsFramework
|
||||
return QPoint{ denormalizedX, denormalizedY };
|
||||
}
|
||||
|
||||
void wrapCursorX(const QRect& rect, QPoint& point)
|
||||
void WrapCursorX(const QRect& rect, QPoint& point)
|
||||
{
|
||||
if (point.x() < rect.left())
|
||||
{
|
||||
@@ -457,7 +457,7 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
void wrapCursorY(const QRect& rect, QPoint& point)
|
||||
void WrapCursorY(const QRect& rect, QPoint& point)
|
||||
{
|
||||
if (point.y() < rect.top())
|
||||
{
|
||||
@@ -492,14 +492,14 @@ namespace AzToolsFramework
|
||||
switch (m_cursorMode)
|
||||
{
|
||||
case CursorInputMode::CursorModeWrappedX:
|
||||
wrapCursorX(widgetRect, screenPos);
|
||||
WrapCursorX(widgetRect, screenPos);
|
||||
break;
|
||||
case CursorInputMode::CursorModeWrappedY:
|
||||
wrapCursorY(widgetRect, screenPos);
|
||||
WrapCursorY(widgetRect, screenPos);
|
||||
break;
|
||||
case CursorInputMode::CursorModeWrapped:
|
||||
wrapCursorX(widgetRect, screenPos);
|
||||
wrapCursorY(widgetRect, screenPos);
|
||||
WrapCursorX(widgetRect, screenPos);
|
||||
WrapCursorY(widgetRect, screenPos);
|
||||
break;
|
||||
default:
|
||||
// this should never happen
|
||||
|
||||
@@ -32,6 +32,17 @@ class QWheelEvent;
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
enum class CursorInputMode {
|
||||
CursorModeNone,
|
||||
CursorModeCaptured, //!< Sets whether or not the cursor should be constrained to the source widget and invisible.
|
||||
//!< Internally, this will reset the cursor position after each move event to ensure movement
|
||||
//!< events don't allow the cursor to escape. This can be used for typical camera controls
|
||||
//!< like a dolly or rotation, where mouse movement is important but cursor location is not.
|
||||
CursorModeWrapped, //!< Flags whether the curser is going to wrap around the soruce widget.
|
||||
CursorModeWrappedX,
|
||||
CursorModeWrappedY
|
||||
};
|
||||
|
||||
//! Maps events from the Qt input system to synthetic InputChannels in AzFramework
|
||||
//! that can be used by AzFramework::ViewportControllers.
|
||||
class QtEventToAzInputMapper final
|
||||
@@ -41,17 +52,6 @@ namespace AzToolsFramework
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum class CursorInputMode {
|
||||
CursorModeNone,
|
||||
CursorModeCaptured, //< Sets whether or not the cursor should be constrained to the source widget and invisible.
|
||||
//< Internally, this will reset the cursor position after each move event to ensure movement
|
||||
//< events don't allow the cursor to escape. This can be used for typical camera controls
|
||||
//< like a dolly or rotation, where mouse movement is important but cursor location is not.
|
||||
CursorModeWrapped, //< Flags whether the curser is going to wrap around the soruce widget.
|
||||
CursorModeWrappedX,
|
||||
CursorModeWrappedY
|
||||
};
|
||||
|
||||
QtEventToAzInputMapper(QWidget* sourceWidget, int syntheticDeviceId = 0);
|
||||
~QtEventToAzInputMapper() = default;
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace AzToolsFramework
|
||||
void SetCursorCaptureEnabled(bool enabled);
|
||||
|
||||
//! Set the cursor mode.
|
||||
void SetCursorMode(QtEventToAzInputMapper::CursorInputMode mode);
|
||||
void SetCursorMode(AzToolsFramework::CursorInputMode mode);
|
||||
|
||||
void SetOverrideCursor(ViewportInteraction::CursorStyleOverride cursorStyleOverride);
|
||||
void ClearOverrideCursor();
|
||||
@@ -192,7 +192,7 @@ namespace AzToolsFramework
|
||||
// Flags whether or not Qt events should currently be processed.
|
||||
bool m_enabled = true;
|
||||
// Controls the cursor behavior.
|
||||
QtEventToAzInputMapper::CursorInputMode m_cursorMode = CursorInputMode::CursorModeNone;
|
||||
AzToolsFramework::CursorInputMode m_cursorMode = AzToolsFramework::CursorInputMode::CursorModeNone;
|
||||
// Flags whether the cursor has been overridden.
|
||||
bool m_overrideCursor = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user