Browse Source

Tables: fixed cell background of fully clipped row overlapping with header. (#7575, #7041)

prabu 1 year ago
parent
commit
510eb8f480
2 changed files with 4 additions and 1 deletions
  1. 2 0
      docs/CHANGELOG.txt
  2. 2 1
      imgui_tables.cpp

+ 2 - 0
docs/CHANGELOG.txt

@@ -43,6 +43,8 @@ Breaking changes:
 
 
 Other changes:
 Other changes:
 
 
+- Tables: fixed cell background of fully clipped row overlapping with header. (#7575, #7041) [@prabuinet]
+
 
 
 -----------------------------------------------------------------------
 -----------------------------------------------------------------------
  VERSION 1.90.6 (Released 2024-05-08)
  VERSION 1.90.6 (Released 2024-05-08)

+ 2 - 1
imgui_tables.cpp

@@ -1963,7 +1963,8 @@ void ImGui::TableEndRow(ImGuiTable* table)
                 cell_bg_rect.ClipWith(table->BgClipRect);
                 cell_bg_rect.ClipWith(table->BgClipRect);
                 cell_bg_rect.Min.x = ImMax(cell_bg_rect.Min.x, column->ClipRect.Min.x);     // So that first column after frozen one gets clipped when scrolling
                 cell_bg_rect.Min.x = ImMax(cell_bg_rect.Min.x, column->ClipRect.Min.x);     // So that first column after frozen one gets clipped when scrolling
                 cell_bg_rect.Max.x = ImMin(cell_bg_rect.Max.x, column->MaxX);
                 cell_bg_rect.Max.x = ImMin(cell_bg_rect.Max.x, column->MaxX);
-                window->DrawList->AddRectFilled(cell_bg_rect.Min, cell_bg_rect.Max, cell_data->BgColor);
+                if (cell_bg_rect.Min.y < cell_bg_rect.Max.y)
+                    window->DrawList->AddRectFilled(cell_bg_rect.Min, cell_bg_rect.Max, cell_data->BgColor);
             }
             }
         }
         }