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

Merge pull request #1887 from Adriankhl/fix_dropbox_left_click

Fix: close dropbox with left mouse click outside of the dropbox
This commit is contained in:
Ivan Savenko
2023-04-08 19:11:50 +03:00
committed by GitHub

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());
}
} }
} }