From b94f0241f1218d7a4caaa62e7a37e3cb825ea172 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 5 Dec 2018 21:19:42 +0100 Subject: [PATCH] Docking: Adjusting the docking popup menu position so it tends to stay within the same viewport. --- imgui.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 3c9fcff6..d1651cf3 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -10845,8 +10845,8 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node) DockNodeGetHostWindowTitle(node, window_label, IM_ARRAYSIZE(window_label)); ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_DockNodeHost; window_flags |= ImGuiWindowFlags_NoFocusOnAppearing; - window_flags |= ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoNavFocus; - window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse; + window_flags |= ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoNavFocus | ImGuiWindowFlags_NoCollapse; + window_flags |= ImGuiWindowFlags_NoTitleBar; PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0)); Begin(window_label, NULL, window_flags); @@ -11032,7 +11032,8 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w // Collapse button changes shape and display a list if (IsPopupOpen("#TabListMenu")) { - SetNextWindowPos(ImVec2(node->Pos.x - style.FramePadding.x, node->Pos.y + GetFrameHeight())); + // Try to position the menu so it is more likely to stays within the same viewport + SetNextWindowPos(ImVec2(node->Pos.x, node->Pos.y + GetFrameHeight())); if (BeginPopup("#TabListMenu")) { is_focused = true;