mirror of
https://github.com/ocornut/imgui.git
synced 2026-02-04 04:00:07 +00:00
Tables: Fix for calling TableSetBgColor(ImGuiTableBgTarget_CellBg) multiple times on the same cell.
This commit is contained in:
parent
45a80716b1
commit
8e97cdf8e8
4 changed files with 10 additions and 8 deletions
|
|
@ -1623,7 +1623,7 @@ void ImGui::TableBeginRow(ImGuiTable* table)
|
|||
table->CurrentRow++;
|
||||
table->CurrentColumn = -1;
|
||||
table->RowBgColor[0] = table->RowBgColor[1] = IM_COL32_DISABLE;
|
||||
table->RowCellDataCount = 0;
|
||||
table->RowCellDataCurrent = -1;
|
||||
table->IsInsideRow = true;
|
||||
|
||||
// Begin frozen rows
|
||||
|
|
@ -1702,7 +1702,7 @@ void ImGui::TableEndRow(ImGuiTable* table)
|
|||
}
|
||||
}
|
||||
|
||||
const bool draw_cell_bg_color = table->RowCellDataCount > 0;
|
||||
const bool draw_cell_bg_color = table->RowCellDataCurrent >= 0;
|
||||
const bool draw_strong_bottom_border = unfreeze_rows;// || (table->RowFlags & ImGuiTableRowFlags_Headers);
|
||||
if ((bg_col0 | bg_col1 | border_col) != 0 || draw_strong_bottom_border || draw_cell_bg_color)
|
||||
{
|
||||
|
|
@ -1727,7 +1727,7 @@ void ImGui::TableEndRow(ImGuiTable* table)
|
|||
// Draw cell background color
|
||||
if (draw_cell_bg_color)
|
||||
{
|
||||
ImGuiTableCellData* cell_data_end = &table->RowCellData[table->RowCellDataCount - 1];
|
||||
ImGuiTableCellData* cell_data_end = &table->RowCellData[table->RowCellDataCurrent];
|
||||
for (ImGuiTableCellData* cell_data = &table->RowCellData[0]; cell_data <= cell_data_end; cell_data++)
|
||||
{
|
||||
ImGuiTableColumn* column = &table->Columns[cell_data->Column];
|
||||
|
|
@ -2359,7 +2359,9 @@ void ImGui::TableSetBgColor(ImGuiTableBgTarget bg_target, ImU32 color, int colum
|
|||
column_n = table->CurrentColumn;
|
||||
if ((table->VisibleUnclippedMaskByIndex & ((ImU64)1 << column_n)) == 0)
|
||||
return;
|
||||
ImGuiTableCellData* cell_data = &table->RowCellData[table->RowCellDataCount++];
|
||||
if (table->RowCellDataCurrent < 0 || table->RowCellData[table->RowCellDataCurrent].Column != column_n)
|
||||
table->RowCellDataCurrent++;
|
||||
ImGuiTableCellData* cell_data = &table->RowCellData[table->RowCellDataCurrent];
|
||||
cell_data->BgColor = color;
|
||||
cell_data->Column = (ImS8)column_n;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue