1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +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
commit d00fa5bf86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -394,6 +394,10 @@ void TemplatesDropBox::ListItem::clickLeft(tribool down, bool previousState)
{
dropBox.setTemplate(item);
}
else
{
dropBox.clickLeft(true, true);
}
}
@ -449,8 +453,14 @@ void TemplatesDropBox::clickLeft(tribool down, bool previousState)
{
if(down && !hovered)
{
assert(GH.topInt().get() == this);
GH.popInt(GH.topInt());
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());
}
}
}