From c16043c1d580a20202c8ceee79b0a6002e3b1dff Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 19 Feb 2024 20:49:52 +0100 Subject: [PATCH] Tables: Angled headers: improve clipping of text since multi-line labels makes clipping issues visible. (#6917) --- imgui_tables.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 28d0ee2be..9d5dafdc7 100644 --- a/imgui_tables.cpp +++ b/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;