mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	Tables: fixed seemingly unnecessarily copy of ImGuiTableColumnFlags_NoDirectResize_ which broken resizing from W3| in a F1 W3 F2 setup. Header only allow overlap on hover, not when active (amend f2df804f)
				
					
				
			Otherwise TableUpdateBorders() tends to override mouse cursor.
This commit is contained in:
		| @@ -815,25 +815,14 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) | |||||||
|             continue; |             continue; | ||||||
|         ImGuiTableColumn* column = &table->Columns[column_n]; |         ImGuiTableColumn* column = &table->Columns[column_n]; | ||||||
|  |  | ||||||
|         // Allocate width for stretched/weighted columns |         // Allocate width for stretched/weighted columns (StretchWeight gets converted into WidthRequest) | ||||||
|         if (column->Flags & ImGuiTableColumnFlags_WidthStretch) |         if ((column->Flags & ImGuiTableColumnFlags_WidthStretch) && !mixed_same_widths) | ||||||
|         { |  | ||||||
|             // StretchWeight gets converted into WidthRequest |  | ||||||
|             if (!mixed_same_widths) |  | ||||||
|         { |         { | ||||||
|             float weight_ratio = column->StretchWeight / sum_weights_stretched; |             float weight_ratio = column->StretchWeight / sum_weights_stretched; | ||||||
|             column->WidthRequest = IM_FLOOR(ImMax(width_avail_for_stretched_columns * weight_ratio, min_column_width) + 0.01f); |             column->WidthRequest = IM_FLOOR(ImMax(width_avail_for_stretched_columns * weight_ratio, min_column_width) + 0.01f); | ||||||
|             width_remaining_for_stretched_columns -= column->WidthRequest; |             width_remaining_for_stretched_columns -= column->WidthRequest; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|             // [Resize Rule 2] Resizing from right-side of a stretch column preceding a fixed column |  | ||||||
|             // needs to forward resizing to left-side of fixed column. We also need to copy the NoResize flag.. |  | ||||||
|             if (column->NextEnabledColumn != -1) |  | ||||||
|                 if (ImGuiTableColumn* next_column = &table->Columns[column->NextEnabledColumn]) |  | ||||||
|                     if (next_column->Flags & ImGuiTableColumnFlags_WidthFixed) |  | ||||||
|                         column->Flags |= (next_column->Flags & ImGuiTableColumnFlags_NoDirectResize_); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         // [Resize Rule 1] The right-most Visible column is not resizable if there is at least one Stretch column |         // [Resize Rule 1] The right-most Visible column is not resizable if there is at least one Stretch column | ||||||
|         // See additional comments in TableSetColumnWidth(). |         // See additional comments in TableSetColumnWidth(). | ||||||
|         if (column->NextEnabledColumn == -1 && table->LeftMostStretchedColumn != -1) |         if (column->NextEnabledColumn == -1 && table->LeftMostStretchedColumn != -1) | ||||||
| @@ -1876,15 +1865,17 @@ void ImGui::TableSetColumnWidth(int column_n, float width) | |||||||
|     // - F1 F2 F3  resize from F3|          --> ok: alter ->WidthRequested of Fixed column. If active, ScrollX extent can be altered. |     // - F1 F2 F3  resize from F3|          --> ok: alter ->WidthRequested of Fixed column. If active, ScrollX extent can be altered. | ||||||
|     // - F1 F2 W3  resize from F1| or F2|   --> ok: alter ->WidthRequested of Fixed column. If active, ScrollX extent can be altered, but it doesn't make much sense as the Stretch column will always be minimal size. |     // - F1 F2 W3  resize from F1| or F2|   --> ok: alter ->WidthRequested of Fixed column. If active, ScrollX extent can be altered, but it doesn't make much sense as the Stretch column will always be minimal size. | ||||||
|     // - F1 F2 W3  resize from W3|          --> ok: no-op (disabled by Resize Rule 1) |     // - F1 F2 W3  resize from W3|          --> ok: no-op (disabled by Resize Rule 1) | ||||||
|     // - W1 W2 W3  resize from W1| or W2|   --> FIXME |     // - W1 W2 W3  resize from W1| or W2|   --> ok | ||||||
|     // - W1 W2 W3  resize from W3|          --> ok: no-op (disabled by Resize Rule 1) |     // - W1 W2 W3  resize from W3|          --> ok: no-op (disabled by Resize Rule 1) | ||||||
|     // - W1 F2 F3  resize from F3|          --> ok: no-op (disabled by Resize Rule 1) |     // - W1 F2 F3  resize from F3|          --> ok: no-op (disabled by Resize Rule 1) | ||||||
|     // - W1 F2     resize from F2|          --> ok: no-op (disabled by Resize Rule 1) |     // - W1 F2     resize from F2|          --> ok: no-op (disabled by Resize Rule 1) | ||||||
|     // - W1 W2 F3  resize from W1| or W2|   --> ok |     // - W1 W2 F3  resize from W1| or W2|   --> ok | ||||||
|     // - W1 F2 W3  resize from W1| or F2|   --> FIXME |     // - W1 F2 W3  resize from W1| or F2|   --> FIXME | ||||||
|     // - F1 W2 F3  resize from W2|          --> ok |     // - F1 W2 F3  resize from W2|          --> ok | ||||||
|  |     // - F1 W3 F2  resize from W3|          --> ok | ||||||
|     // - W1 F2 F3  resize from W1|          --> ok: equivalent to resizing |F2. F3 will not move. (forwarded by Resize Rule 2) |     // - W1 F2 F3  resize from W1|          --> ok: equivalent to resizing |F2. F3 will not move. (forwarded by Resize Rule 2) | ||||||
|     // - W1 F2 F3  resize from F2|          --> FIXME should resize F2, F3 and not have effect on W1 (Stretch columns are _before_ the Fixed column). |     // - W1 F2 F3  resize from F2|          --> ok | ||||||
|  |     // All resizes from a Wx columns are locking other columns. | ||||||
|  |  | ||||||
|     // Rules: |     // Rules: | ||||||
|     // - [Resize Rule 1] Can't resize from right of right-most visible column if there is any Stretch column. Implemented in TableUpdateLayout(). |     // - [Resize Rule 1] Can't resize from right of right-most visible column if there is any Stretch column. Implemented in TableUpdateLayout(). | ||||||
| @@ -2679,6 +2670,7 @@ void ImGui::TableHeader(const char* label) | |||||||
|     // Using AllowItemOverlap mode because we cover the whole cell, and we want user to be able to submit subsequent items. |     // Using AllowItemOverlap mode because we cover the whole cell, and we want user to be able to submit subsequent items. | ||||||
|     bool hovered, held; |     bool hovered, held; | ||||||
|     bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_AllowItemOverlap); |     bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_AllowItemOverlap); | ||||||
|  |     if (g.ActiveId != id) | ||||||
|         SetItemAllowOverlap(); |         SetItemAllowOverlap(); | ||||||
|     if (hovered || selected) |     if (hovered || selected) | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -7664,7 +7664,7 @@ bool    ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, | |||||||
|     hovered |= (g.HoveredId == id); |     hovered |= (g.HoveredId == id); | ||||||
|  |  | ||||||
|     // Allow the close button to overlap unless we are dragging (in which case we don't want any overlapping tabs to be hovered) |     // Allow the close button to overlap unless we are dragging (in which case we don't want any overlapping tabs to be hovered) | ||||||
|     if (!held) |     if (g.ActiveId != id) | ||||||
|         SetItemAllowOverlap(); |         SetItemAllowOverlap(); | ||||||
|  |  | ||||||
|     // Drag and drop: re-order tabs |     // Drag and drop: re-order tabs | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ocornut
					ocornut