Explorar el Código

Tables: Angled headers: improve clipping of text since multi-line labels makes clipping issues visible. (#6917)

ocornut hace 1 año
padre
commit
c16043c1d5
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      imgui_tables.cpp

+ 3 - 1
imgui_tables.cpp

@@ -3252,9 +3252,11 @@ void ImGui::TableAngledHeadersRowEx(float angle, float max_label_width)
                     if (label_name_eol == NULL)
                         label_name_eol = label_name_end;
 
+                    // FIXME: Individual line clipping for right-most column is broken for negative angles.
                     ImVec2 label_size = CalcTextSize(label_name, label_name_eol);
                     float clip_width = max_label_width - padding.y; // Using padding.y*2.0f would be symetrical but hide more text.
-                    ImRect clip_r(window->ClipRect.Min, window->ClipRect.Min + ImVec2(clip_width, label_size.y));
+                    float clip_height = ImMin(label_size.y, column->ClipRect.Max.x - column->WorkMinX - line_off_curr_x);
+                    ImRect clip_r(window->ClipRect.Min, window->ClipRect.Min + ImVec2(clip_width, clip_height));
                     int vtx_idx_begin = draw_list->_VtxCurrentIdx;
                     RenderTextEllipsis(draw_list, clip_r.Min, clip_r.Max, clip_r.Max.x, clip_r.Max.x, label_name, label_name_eol, &label_size);
                     int vtx_idx_end = draw_list->_VtxCurrentIdx;