Pārlūkot izejas kodu

Tables: Angled headers: fixed table contents overflowing when a list clipper is used. (#7416)

cfillion 1 gadu atpakaļ
vecāks
revīzija
f0802287db
2 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  1. 2 0
      docs/CHANGELOG.txt
  2. 1 1
      imgui_tables.cpp

+ 2 - 0
docs/CHANGELOG.txt

@@ -59,6 +59,8 @@ Other changes:
   non-scrollable tables. (#7416) [@cfillion]
 - Tables: Angled headers: fixed borders not moving back up after TableAngleHeadersRow()
   stops being called. (#7416) [@cfillion]
+- Tables: Angled headers: rounding header size to nearest integers, fixes some issues
+  when using clipper.
 - Menus, Popups: Fixed an issue where sibling menu popups re-opening in successive
   frames would erroneously close the window. While it is technically a popup issue
   it would generally manifest when fast moving the mouse bottom to top in a sub-menu.

+ 1 - 1
imgui_tables.cpp

@@ -3186,7 +3186,7 @@ void ImGui::TableAngledHeadersRowEx(float angle, float max_label_width)
     // Calculate our base metrics and set angled headers data _before_ the first call to TableNextRow()
     // FIXME-STYLE: Would it be better for user to submit 'max_label_width' or 'row_height' ? One can be derived from the other.
     const float header_height = g.FontSize + g.Style.CellPadding.x * 2.0f;
-    const float row_height = ImFabs(ImRotate(ImVec2(max_label_width, flip_label ? +header_height : -header_height), cos_a, sin_a).y);
+    const float row_height = ImTrunc(ImFabs(ImRotate(ImVec2(max_label_width, flip_label ? +header_height : -header_height), cos_a, sin_a).y));
     table->AngledHeadersHeight = row_height;
     table->AngledHeadersSlope = (sin_a != 0.0f) ? (cos_a / sin_a) : 0.0f;
     const ImVec2 header_angled_vector = unit_right * (row_height / -sin_a); // vector from bottom-left to top-left, and from bottom-right to top-right