fix controller breaking when mouse goes of any buttons

This commit is contained in:
Devlrxxh 2026-03-06 14:53:09 +01:00
parent de46641cda
commit aa00b2dd40

View file

@ -845,8 +845,7 @@ void UIController::tickInput()
break; break;
} }
} }
if (hitObject != IGGY_FOCUS_NULL && hitObject != currentFocus) // <-- THE FIX
if (hitObject != currentFocus)
{ {
IggyPlayerSetFocusRS(movie, hitObject, 0); IggyPlayerSetFocusRS(movie, hitObject, 0);
} }
@ -875,16 +874,13 @@ void UIController::tickInput()
panelOffsetX = pMainPanel->getXPos(); panelOffsetX = pMainPanel->getXPos();
panelOffsetY = pMainPanel->getYPos(); panelOffsetY = pMainPanel->getYPos();
} }
bool leftPressed = g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT); bool leftPressed = g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT);
bool leftDown = leftPressed || g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT); bool leftDown = leftPressed || g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT);
if (m_mouseDraggingSliderScene != eUIScene_COUNT && m_mouseDraggingSliderScene != pScene->getSceneType()) if (m_mouseDraggingSliderScene != eUIScene_COUNT && m_mouseDraggingSliderScene != pScene->getSceneType())
{ {
m_mouseDraggingSliderScene = eUIScene_COUNT; m_mouseDraggingSliderScene = eUIScene_COUNT;
m_mouseDraggingSliderId = -1; m_mouseDraggingSliderId = -1;
} }
if (leftPressed) if (leftPressed)
{ {
vector<UIControl*>* controls = pScene->GetControls(); vector<UIControl*>* controls = pScene->GetControls();
@ -895,7 +891,6 @@ void UIController::tickInput()
UIControl* ctrl = (*controls)[i]; UIControl* ctrl = (*controls)[i];
if (!ctrl || ctrl->getControlType() != UIControl::eSlider || !ctrl->getVisible()) if (!ctrl || ctrl->getControlType() != UIControl::eSlider || !ctrl->getVisible())
continue; continue;
UIControl_Slider* pSlider = (UIControl_Slider*)ctrl; UIControl_Slider* pSlider = (UIControl_Slider*)ctrl;
pSlider->UpdateControl(); pSlider->UpdateControl();
S32 cx = pSlider->getXPos() + panelOffsetX; S32 cx = pSlider->getXPos() + panelOffsetX;
@ -904,7 +899,6 @@ void UIController::tickInput()
S32 ch = pSlider->getHeight(); S32 ch = pSlider->getHeight();
if (cw <= 0 || ch <= 0) if (cw <= 0 || ch <= 0)
continue; continue;
if (sceneMouseX >= cx && sceneMouseX <= cx + cw && sceneMouseY >= cy && sceneMouseY <= cy + ch) if (sceneMouseX >= cx && sceneMouseX <= cx + cw && sceneMouseY >= cy && sceneMouseY <= cy + ch)
{ {
m_mouseDraggingSliderScene = pScene->getSceneType(); m_mouseDraggingSliderScene = pScene->getSceneType();
@ -914,7 +908,6 @@ void UIController::tickInput()
} }
} }
} }
if (leftDown && m_mouseDraggingSliderScene == pScene->getSceneType() && m_mouseDraggingSliderId >= 0) if (leftDown && m_mouseDraggingSliderScene == pScene->getSceneType() && m_mouseDraggingSliderId >= 0)
{ {
UIControl_Slider* pSlider = FindSliderById(pScene, m_mouseDraggingSliderId); UIControl_Slider* pSlider = FindSliderById(pScene, m_mouseDraggingSliderId);