mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fix button interaction with hotkey & mouse
This commit is contained in:
@@ -172,23 +172,29 @@ void CButton::clickLeft(tribool down, bool previousState)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (down)
|
if (down)
|
||||||
|
{
|
||||||
|
if (getState() != PRESSED)
|
||||||
{
|
{
|
||||||
if (!soundDisabled)
|
if (!soundDisabled)
|
||||||
CCS->soundh->playSound(soundBase::button);
|
CCS->soundh->playSound(soundBase::button);
|
||||||
setState(PRESSED);
|
setState(PRESSED);
|
||||||
|
|
||||||
|
if (actOnDown)
|
||||||
|
onButtonClicked();
|
||||||
}
|
}
|
||||||
else if(hoverable && isHovered())
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (getState() == PRESSED)
|
||||||
|
{
|
||||||
|
if(hoverable && isHovered())
|
||||||
setState(HIGHLIGHTED);
|
setState(HIGHLIGHTED);
|
||||||
else
|
else
|
||||||
setState(NORMAL);
|
setState(NORMAL);
|
||||||
|
|
||||||
if (actOnDown && down)
|
if (!actOnDown && previousState && (down == false))
|
||||||
{
|
|
||||||
onButtonClicked();
|
onButtonClicked();
|
||||||
}
|
}
|
||||||
else if (!actOnDown && previousState && (down==false))
|
|
||||||
{
|
|
||||||
onButtonClicked();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user