Browse Source

fix: close dropbox with left mouse click outside of the dropbox

Adriankhl 2 years ago
parent
commit
57409a0d94
1 changed files with 12 additions and 2 deletions
  1. 12 2
      client/lobby/RandomMapTab.cpp

+ 12 - 2
client/lobby/RandomMapTab.cpp

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