mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 21:21:06 +01:00 
			
		
		
		
	Tables: Fix for calling TableSetBgColor(ImGuiTableBgTarget_CellBg) multiple times on the same cell.
This commit is contained in:
		| @@ -2028,7 +2028,7 @@ struct ImGuiTable | ||||
|     ImS8                        FreezeRowsCount;            // Actual frozen row count (== FreezeRowsRequest, or == 0 when no scrolling offset) | ||||
|     ImS8                        FreezeColumnsRequest;       // Requested frozen columns count | ||||
|     ImS8                        FreezeColumnsCount;         // Actual frozen columns count (== FreezeColumnsRequest, or == 0 when no scrolling offset) | ||||
|     ImS8                        RowCellDataCount;           // Number of RowCellData[] entries in current row | ||||
|     ImS8                        RowCellDataCurrent;         // Index of current RowCellData[] entry in current row | ||||
|     bool                        IsLayoutLocked;             // Set by TableUpdateLayout() which is called when beginning the first row. | ||||
|     bool                        IsInsideRow;                // Set when inside TableBeginRow()/TableEndRow(). | ||||
|     bool                        IsInitializing; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -5999,7 +5999,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl | ||||
|     // which would be advantageous since most selectable are not selected. | ||||
|     if (span_all_columns && window->DC.CurrentColumns) | ||||
|         PushColumnsBackground(); | ||||
|     else if ((flags & ImGuiSelectableFlags_SpanAllColumns) && g.CurrentTable) | ||||
|     else if (span_all_columns && g.CurrentTable) | ||||
|         PushTableBackground(); | ||||
|  | ||||
|     // We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries | ||||
|   | ||||
		Reference in New Issue
	
	Block a user