Docking: Adjusting the docking popup menu position so it tends to stay within the same viewport.

docking
omar 6 years ago
parent b96b1f2412
commit b94f0241f1

@ -10845,8 +10845,8 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
DockNodeGetHostWindowTitle(node, window_label, IM_ARRAYSIZE(window_label)); DockNodeGetHostWindowTitle(node, window_label, IM_ARRAYSIZE(window_label));
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_DockNodeHost; ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_DockNodeHost;
window_flags |= ImGuiWindowFlags_NoFocusOnAppearing; window_flags |= ImGuiWindowFlags_NoFocusOnAppearing;
window_flags |= ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoNavFocus; window_flags |= ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoNavFocus | ImGuiWindowFlags_NoCollapse;
window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse; window_flags |= ImGuiWindowFlags_NoTitleBar;
PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0)); PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
Begin(window_label, NULL, window_flags); 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 // Collapse button changes shape and display a list
if (IsPopupOpen("#TabListMenu")) 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")) if (BeginPopup("#TabListMenu"))
{ {
is_focused = true; is_focused = true;

Loading…
Cancel
Save