From 6afcfe3442c07ef654c8a6d99af4e21f04629ad7 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 1 Dec 2021 17:46:04 +0100 Subject: [PATCH] Docking: Fixed incorrectly rounded tab bars for dock node that are not at the top of their dock tree. --- docs/CHANGELOG.txt | 1 + imgui.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index d31e753a..12547d62 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -158,6 +158,7 @@ Docking+Viewports Branch: - Docking: Revert removal of io.ConfigDockingWithShift config option (removed in 1.83). (#4643) - Docking: Fixed a bug undocking windows docked into a non-visible or _KeepAliveOnly dockspace when unrelated windows submitted before the dockspace have dynamic visibility. (#4757) +- Docking: Fixed incorrectly rounded tab bars for dock node that are not at the top of their dock tree. - Viewports: Made it possible to explicitly assign ImGuiWindowClass::ParentViewportId to 0 in order to ensure a window is not parented. Previously this would use the global default (which might be 0, but not always as it would depend on io.ConfigViewportsNoDefaultParent). (#3152, #2871) diff --git a/imgui.cpp b/imgui.cpp index 39905874..28c31b54 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4646,7 +4646,7 @@ static void ImGui::EndFrameDrawDimmedBackgrounds() draw_list->AddRectFilled(viewport->Pos, viewport->Pos + viewport->Size, dim_bg_col); } - // Draw modal whitening background between CTRL-TAB list + // Draw modal whitening background behind CTRL-TAB list if (dim_bg_for_window_list && g.NavWindowingTargetAnim->Active) { // Choose a draw list that will be front-most across all our children @@ -14488,7 +14488,11 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w if (is_focused) node->LastFrameFocused = g.FrameCount; ImU32 title_bar_col = GetColorU32(host_window->Collapsed ? ImGuiCol_TitleBgCollapsed : is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg); - host_window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, host_window->WindowRounding, ImDrawFlags_RoundCornersTop); + bool rounding_t = node->Pos.y <= host_window->Pos.y + DOCKING_SPLITTER_SIZE; + bool rounding_tl = rounding_t && (node->Pos.x <= host_window->Pos.x + DOCKING_SPLITTER_SIZE); + bool rounding_tr = rounding_t && (node->Pos.x + node->Size.x >= host_window->Pos.x + host_window->Size.x - DOCKING_SPLITTER_SIZE); + ImDrawFlags rounding_flags = ImDrawFlags_RoundCornersNone | (rounding_tl ? ImDrawFlags_RoundCornersTopLeft : 0) | (rounding_tr ? ImDrawFlags_RoundCornersTopRight : 0); + host_window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, host_window->WindowRounding, rounding_flags); // Docking/Collapse button if (has_window_menu_button)