mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-03-22 09:48:14 +05:00
Fix focus sound playing repeatedly on mouse hover (#890)
Only play eSFX_Focus when the focus control or child actually changes. Previously the sound fired on every focus event even when hovering over the same element, causing rapid sound spam over Texture Pack icons in the Create World menu. Fixes a bug reported on Discord. Co-authored-by: MCbabel <MCbabel@users.noreply.github.com>
This commit is contained in:
@@ -1331,11 +1331,17 @@ bool UIScene::hasRegisteredSubstitutionTexture(const wstring &textureName)
|
||||
|
||||
void UIScene::_handleFocusChange(F64 controlId, F64 childId)
|
||||
{
|
||||
m_iFocusControl = (int)controlId;
|
||||
m_iFocusChild = (int)childId;
|
||||
int newControl = (int)controlId;
|
||||
int newChild = (int)childId;
|
||||
|
||||
handleFocusChange(controlId, childId);
|
||||
ui.PlayUISFX(eSFX_Focus);
|
||||
if (newControl != m_iFocusControl || newChild != m_iFocusChild)
|
||||
{
|
||||
m_iFocusControl = newControl;
|
||||
m_iFocusChild = newChild;
|
||||
|
||||
handleFocusChange(controlId, childId);
|
||||
ui.PlayUISFX(eSFX_Focus);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene::_handleInitFocus(F64 controlId, F64 childId)
|
||||
|
||||
Reference in New Issue
Block a user