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:
@ -394,6 +394,10 @@ void TemplatesDropBox::ListItem::clickLeft(tribool down, bool previousState)
|
|||||||
{
|
{
|
||||||
dropBox.setTemplate(item);
|
dropBox.setTemplate(item);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dropBox.clickLeft(true, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -448,10 +452,16 @@ void TemplatesDropBox::hover(bool on)
|
|||||||
void TemplatesDropBox::clickLeft(tribool down, bool previousState)
|
void TemplatesDropBox::clickLeft(tribool down, bool previousState)
|
||||||
{
|
{
|
||||||
if(down && !hovered)
|
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);
|
assert(GH.topInt().get() == this);
|
||||||
GH.popInt(GH.topInt());
|
GH.popInt(GH.topInt());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TemplatesDropBox::updateListItems()
|
void TemplatesDropBox::updateListItems()
|
||||||
|
Reference in New Issue
Block a user