mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	Internals, TreeNode, Selectable: tweak span_all_columns paths for clarity.
This commit is contained in:
		| @@ -6413,20 +6413,22 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiID storage_id, ImGuiTreeNodeFlags | |||||||
|     // Compute open and multi-select states before ItemAdd() as it clear NextItem data. |     // Compute open and multi-select states before ItemAdd() as it clear NextItem data. | ||||||
|     bool is_open = TreeNodeUpdateNextOpen(storage_id, flags); |     bool is_open = TreeNodeUpdateNextOpen(storage_id, flags); | ||||||
|  |  | ||||||
|     // Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackgroundChannel for every Selectable.. |     bool is_visible; | ||||||
|     const float backup_clip_rect_min_x = window->ClipRect.Min.x; |  | ||||||
|     const float backup_clip_rect_max_x = window->ClipRect.Max.x; |  | ||||||
|     if (span_all_columns) |     if (span_all_columns) | ||||||
|     { |     { | ||||||
|  |         // Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackgroundChannel for every Selectable.. | ||||||
|  |         const float backup_clip_rect_min_x = window->ClipRect.Min.x; | ||||||
|  |         const float backup_clip_rect_max_x = window->ClipRect.Max.x; | ||||||
|         window->ClipRect.Min.x = window->ParentWorkRect.Min.x; |         window->ClipRect.Min.x = window->ParentWorkRect.Min.x; | ||||||
|         window->ClipRect.Max.x = window->ParentWorkRect.Max.x; |         window->ClipRect.Max.x = window->ParentWorkRect.Max.x; | ||||||
|     } |         is_visible = ItemAdd(interact_bb, id); | ||||||
|     const bool is_visible = ItemAdd(interact_bb, id); |  | ||||||
|     if (span_all_columns) |  | ||||||
|     { |  | ||||||
|         window->ClipRect.Min.x = backup_clip_rect_min_x; |         window->ClipRect.Min.x = backup_clip_rect_min_x; | ||||||
|         window->ClipRect.Max.x = backup_clip_rect_max_x; |         window->ClipRect.Max.x = backup_clip_rect_max_x; | ||||||
|     } |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |         is_visible = ItemAdd(interact_bb, id); | ||||||
|  |     } | ||||||
|     g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HasDisplayRect; |     g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HasDisplayRect; | ||||||
|     g.LastItemData.DisplayRect = frame_bb; |     g.LastItemData.DisplayRect = frame_bb; | ||||||
|  |  | ||||||
| @@ -6796,23 +6798,24 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl | |||||||
|     } |     } | ||||||
|     //if (g.IO.KeyCtrl) { GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(0, 255, 0, 255)); } |     //if (g.IO.KeyCtrl) { GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(0, 255, 0, 255)); } | ||||||
|  |  | ||||||
|     // Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackgroundChannel for every Selectable.. |     const bool disabled_item = (flags & ImGuiSelectableFlags_Disabled) != 0; | ||||||
|     const float backup_clip_rect_min_x = window->ClipRect.Min.x; |     const ImGuiItemFlags extra_item_flags = disabled_item ? (ImGuiItemFlags)ImGuiItemFlags_Disabled : ImGuiItemFlags_None; | ||||||
|     const float backup_clip_rect_max_x = window->ClipRect.Max.x; |     bool is_visible; | ||||||
|     if (span_all_columns) |     if (span_all_columns) | ||||||
|     { |     { | ||||||
|  |         // Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackgroundChannel for every Selectable.. | ||||||
|  |         const float backup_clip_rect_min_x = window->ClipRect.Min.x; | ||||||
|  |         const float backup_clip_rect_max_x = window->ClipRect.Max.x; | ||||||
|         window->ClipRect.Min.x = window->ParentWorkRect.Min.x; |         window->ClipRect.Min.x = window->ParentWorkRect.Min.x; | ||||||
|         window->ClipRect.Max.x = window->ParentWorkRect.Max.x; |         window->ClipRect.Max.x = window->ParentWorkRect.Max.x; | ||||||
|     } |         is_visible = ItemAdd(bb, id, NULL, extra_item_flags); | ||||||
|  |  | ||||||
|     const bool disabled_item = (flags & ImGuiSelectableFlags_Disabled) != 0; |  | ||||||
|     const bool is_visible = ItemAdd(bb, id, NULL, disabled_item ? (ImGuiItemFlags)ImGuiItemFlags_Disabled : ImGuiItemFlags_None); |  | ||||||
|  |  | ||||||
|     if (span_all_columns) |  | ||||||
|     { |  | ||||||
|         window->ClipRect.Min.x = backup_clip_rect_min_x; |         window->ClipRect.Min.x = backup_clip_rect_min_x; | ||||||
|         window->ClipRect.Max.x = backup_clip_rect_max_x; |         window->ClipRect.Max.x = backup_clip_rect_max_x; | ||||||
|     } |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |         is_visible = ItemAdd(bb, id, NULL, extra_item_flags); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     const bool is_multi_select = (g.LastItemData.InFlags & ImGuiItemFlags_IsMultiSelect) != 0; |     const bool is_multi_select = (g.LastItemData.InFlags & ImGuiItemFlags_IsMultiSelect) != 0; | ||||||
|     if (!is_visible) |     if (!is_visible) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ocornut
					ocornut