Docking: Fixed incorrectly rounded tab bars for dock node that are not at the top of their dock tree.

This commit is contained in:
ocornut 2021-12-01 17:46:04 +01:00
parent 848d21b6b5
commit 6afcfe3442
2 changed files with 7 additions and 2 deletions

View File

@ -158,6 +158,7 @@ Docking+Viewports Branch:
- Docking: Revert removal of io.ConfigDockingWithShift config option (removed in 1.83). (#4643) - 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 - 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) 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 - 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, 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) but not always as it would depend on io.ConfigViewportsNoDefaultParent). (#3152, #2871)

View File

@ -4646,7 +4646,7 @@ static void ImGui::EndFrameDrawDimmedBackgrounds()
draw_list->AddRectFilled(viewport->Pos, viewport->Pos + viewport->Size, dim_bg_col); 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) if (dim_bg_for_window_list && g.NavWindowingTargetAnim->Active)
{ {
// Choose a draw list that will be front-most across all our children // 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) if (is_focused)
node->LastFrameFocused = g.FrameCount; node->LastFrameFocused = g.FrameCount;
ImU32 title_bar_col = GetColorU32(host_window->Collapsed ? ImGuiCol_TitleBgCollapsed : is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg); 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 // Docking/Collapse button
if (has_window_menu_button) if (has_window_menu_button)