1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

fix: close dropbox with left mouse click outside of the dropbox

This commit is contained in:
Adriankhl 2023-04-06 18:32:21 +02:00
parent 41696d6692
commit 57409a0d94

View File

@ -394,6 +394,10 @@ void TemplatesDropBox::ListItem::clickLeft(tribool down, bool previousState)
{
dropBox.setTemplate(item);
}
else
{
dropBox.clickLeft(true, true);
}
}
@ -448,10 +452,16 @@ void TemplatesDropBox::hover(bool on)
void TemplatesDropBox::clickLeft(tribool down, bool previousState)
{
if(down && !hovered)
{
auto w = widget<CSlider>("slider");
// pop the interface only if the mouse is not clicking on the slider
if (!w || !w->mouseState(MouseButton::LEFT))
{
assert(GH.topInt().get() == this);
GH.popInt(GH.topInt());
}
}
}
void TemplatesDropBox::updateListItems()