mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
Fix closing dropdown box via clicking outside bounds
This commit is contained in:
@@ -448,6 +448,11 @@ TemplatesDropBox::TemplatesDropBox(RandomMapTab & randomMapTab, int3 size):
|
|||||||
w->setAmount(curItems.size());
|
w->setAmount(curItems.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FIXME: this should be done by InterfaceObjectConfigurable, but might have side-effects
|
||||||
|
pos = children.front()->pos;
|
||||||
|
for (auto const & child : children)
|
||||||
|
pos = pos.include(child->pos);
|
||||||
|
|
||||||
updateListItems();
|
updateListItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,17 +474,11 @@ void TemplatesDropBox::sliderMove(int slidPos)
|
|||||||
|
|
||||||
void TemplatesDropBox::clickLeft(tribool down, bool previousState)
|
void TemplatesDropBox::clickLeft(tribool down, bool previousState)
|
||||||
{
|
{
|
||||||
if(down && !isActive())
|
if (!pos.isInside(GH.getCursorPosition()))
|
||||||
{
|
|
||||||
auto w = widget<CSlider>("slider");
|
|
||||||
|
|
||||||
// pop the interface only if the mouse is not clicking on the slider
|
|
||||||
if (!w || !w->isMouseLeftButtonPressed())
|
|
||||||
{
|
{
|
||||||
assert(GH.windows().isTopWindow(this));
|
assert(GH.windows().isTopWindow(this));
|
||||||
GH.windows().popWindows(1);
|
GH.windows().popWindows(1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TemplatesDropBox::updateListItems()
|
void TemplatesDropBox::updateListItems()
|
||||||
|
Reference in New Issue
Block a user