mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Tables: Fixed an issue with ScrollX enabled where an extraneous draw command would be created.
Randomly found while deep-diving into #6765. ContentMaxXHeadersUsed has been set to max since the dawn of tables, which contradict the intent of passing zero-width to ItemSize(). The ItemSize code allowed SameLine() to operate, but this mistake setting ContentMaxXHeadersUsed would make right-most visible column in a ScrollX set incorrectly use a draw command due to header claiming whole column width.
This commit is contained in:
parent
947255c3da
commit
8db02ef8df
@ -109,7 +109,8 @@ Other changes:
|
||||
- Fixed bottom-most and right-most outer border offset by one. (#6765, #3752) [@v-ein]
|
||||
- Fixed top-most outer border being drawn with both TableBorderLight and TableBorderStrong
|
||||
in some situations, causing the earlier to be visible underneath when alpha is not 1.0f.
|
||||
- fixed right-clicking right-most section (past right-most column) from highlighting a column.
|
||||
- Fixed right-clicking right-most section (past right-most column) from highlighting a column.
|
||||
- Fixed an issue with ScrollX enabled where an extraneous draw command would be created.
|
||||
- TabBar: Fixed position of unsaved document marker (ImGuiTabItemFlags_UnsavedDocument) which was
|
||||
accidentally offset in 1.89.9. (#6862) [@alektron]
|
||||
- Fonts: 'float size_pixels' passed to AddFontXXX() functions is now rounded to lowest integer.
|
||||
|
@ -3015,11 +3015,14 @@ void ImGui::TableHeader(const char* label)
|
||||
// Calculate ideal size for sort order arrow
|
||||
float w_arrow = 0.0f;
|
||||
float w_sort_text = 0.0f;
|
||||
bool sort_arrow = false;
|
||||
char sort_order_suf[4] = "";
|
||||
const float ARROW_SCALE = 0.65f;
|
||||
if ((table->Flags & ImGuiTableFlags_Sortable) && !(column->Flags & ImGuiTableColumnFlags_NoSort))
|
||||
{
|
||||
w_arrow = ImTrunc(g.FontSize * ARROW_SCALE + g.Style.FramePadding.x);
|
||||
if (column->SortOrder != -1)
|
||||
sort_arrow = true;
|
||||
if (column->SortOrder > 0)
|
||||
{
|
||||
ImFormatString(sort_order_suf, IM_ARRAYSIZE(sort_order_suf), "%d", column->SortOrder + 1);
|
||||
@ -3027,9 +3030,9 @@ void ImGui::TableHeader(const char* label)
|
||||
}
|
||||
}
|
||||
|
||||
// We feed our unclipped width to the column without writing on CursorMaxPos, so that column is still considering for merging.
|
||||
// We feed our unclipped width to the column without writing on CursorMaxPos, so that column is still considered for merging.
|
||||
float max_pos_x = label_pos.x + label_size.x + w_sort_text + w_arrow;
|
||||
column->ContentMaxXHeadersUsed = ImMax(column->ContentMaxXHeadersUsed, column->WorkMaxX);
|
||||
column->ContentMaxXHeadersUsed = ImMax(column->ContentMaxXHeadersUsed, sort_arrow ? cell_r.Max.x : ImMin(max_pos_x, cell_r.Max.x));
|
||||
column->ContentMaxXHeadersIdeal = ImMax(column->ContentMaxXHeadersIdeal, max_pos_x);
|
||||
|
||||
// Keep header highlighted when context menu is open.
|
||||
|
Loading…
Reference in New Issue
Block a user