@@ -108,6 +108,12 @@ namespace RobotecSpectatorCamera
108
108
109
109
if (channelId == AzFramework::InputDeviceMouse::Button::Right || m_configuration.m_cameraMode == CameraMode::FreeFlying)
110
110
{
111
+ AzFramework::SystemCursorState currentCursorState;
112
+ AzFramework::InputSystemCursorRequestBus::EventResult (
113
+ currentCursorState, AzFramework::InputDeviceMouse::Id, &AzFramework::InputSystemCursorRequests::GetSystemCursorState);
114
+ const bool isConstrained = // flag to do not lose information whether the cursor is constrained or not
115
+ (currentCursorState == AzFramework::SystemCursorState::ConstrainedAndHidden ||
116
+ currentCursorState == AzFramework::SystemCursorState::ConstrainedAndVisible);
111
117
if (inputChannel.IsStateBegan ())
112
118
{
113
119
m_isRightMouseButtonPressed = true ;
@@ -118,7 +124,8 @@ namespace RobotecSpectatorCamera
118
124
AzFramework::InputSystemCursorRequestBus::Event (
119
125
AzFramework::InputDeviceMouse::Id,
120
126
&AzFramework::InputSystemCursorRequests::SetSystemCursorState,
121
- AzFramework::SystemCursorState::ConstrainedAndHidden);
127
+ isConstrained ? AzFramework::SystemCursorState::ConstrainedAndHidden
128
+ : AzFramework::SystemCursorState::UnconstrainedAndHidden);
122
129
}
123
130
else if (inputChannel.IsStateEnded ())
124
131
{
@@ -135,7 +142,8 @@ namespace RobotecSpectatorCamera
135
142
AzFramework::InputSystemCursorRequestBus::Event (
136
143
AzFramework::InputDeviceMouse::Id,
137
144
&AzFramework::InputSystemCursorRequests::SetSystemCursorState,
138
- AzFramework::SystemCursorState::ConstrainedAndVisible);
145
+ isConstrained ? AzFramework::SystemCursorState::ConstrainedAndVisible
146
+ : AzFramework::SystemCursorState::UnconstrainedAndVisible);
139
147
}
140
148
}
141
149
0 commit comments