From 3d7ae3e72d43a5b19ad0228193cab8c62d40a79d Mon Sep 17 00:00:00 2001 From: pothemagicdragon Date: Thu, 18 Jun 2026 21:52:12 -0700 Subject: [PATCH] closes click gui by clicking on the background --- .../com/lambda/gui/components/ClickGuiLayout.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/kotlin/com/lambda/gui/components/ClickGuiLayout.kt b/src/main/kotlin/com/lambda/gui/components/ClickGuiLayout.kt index 155eda4b0..ab064e323 100644 --- a/src/main/kotlin/com/lambda/gui/components/ClickGuiLayout.kt +++ b/src/main/kotlin/com/lambda/gui/components/ClickGuiLayout.kt @@ -43,6 +43,7 @@ import com.lambda.imgui.extension.implot.ImPlot import com.lambda.imgui.flag.ImGuiCol import com.lambda.imgui.flag.ImGuiCond import com.lambda.imgui.flag.ImGuiHoveredFlags +import com.lambda.imgui.flag.ImGuiPopupFlags import com.lambda.imgui.flag.ImGuiWindowFlags import com.lambda.module.ModuleRegistry import com.lambda.module.modules.client.Client @@ -303,6 +304,19 @@ object ClickGuiLayout : Loadable, Config( } } + // A left click on empty space — not over any window and with no popup + // open — closes the GUI (click-outside-to-dismiss). When a popup/menu is + // open, the same click only dismisses that popup, so the GUI stays open. + if ( + activeDragWindowName == null && + mousePressedThisFrameGlobal && + !ImGui.isWindowHovered(ImGuiHoveredFlags.AnyWindow) && + !ImGui.isPopupOpen("", ImGuiPopupFlags.AnyPopup) + ) { + toggle() + return@buildLayout + } + val tags = if (developerMode) shownTags + ModuleTag.DEBUG else shownTags if (tags.isEmpty()) return@buildLayout