1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +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); dropBox.setTemplate(item);
} }
else
{
dropBox.clickLeft(true, true);
}
} }
@@ -449,8 +453,14 @@ void TemplatesDropBox::clickLeft(tribool down, bool previousState)
{ {
if(down && !hovered) if(down && !hovered)
{ {
assert(GH.topInt().get() == this); auto w = widget<CSlider>("slider");
GH.popInt(GH.topInt());
// 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());
}
} }
} }