mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 21:21:06 +01:00 
			
		
		
		
	Added ImGui::GetItemActiveDragDelta() helpers for drag operations
This commit is contained in:
		
							
								
								
									
										11
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -2551,6 +2551,17 @@ bool ImGui::IsAnyItemActive() | |||||||
|     return g.ActiveId != 0; |     return g.ActiveId != 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | ImVec2 ImGui::GetItemActiveDragDelta() | ||||||
|  | { | ||||||
|  |     if (ImGui::IsItemActive()) | ||||||
|  |     { | ||||||
|  |         ImGuiState& g = *GImGui; | ||||||
|  |         if (g.IO.MouseDown[0]) | ||||||
|  |             return g.IO.MousePos - g.IO.MouseClickedPos[0];     // Assume we can only get active with left-mouse button (at the moment). | ||||||
|  |     } | ||||||
|  |     return ImVec2(0.0f, 0.0f); | ||||||
|  | } | ||||||
|  |  | ||||||
| ImVec2 ImGui::GetItemRectMin() | ImVec2 ImGui::GetItemRectMin() | ||||||
| { | { | ||||||
|     ImGuiWindow* window = GetCurrentWindow(); |     ImGuiWindow* window = GetCurrentWindow(); | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								imgui.h
									
									
									
									
									
								
							| @@ -354,12 +354,13 @@ namespace ImGui | |||||||
|     IMGUI_API bool          IsItemHovered();                                                    // was the last item hovered by mouse? |     IMGUI_API bool          IsItemHovered();                                                    // was the last item hovered by mouse? | ||||||
|     IMGUI_API bool          IsItemActive();                                                     // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false) |     IMGUI_API bool          IsItemActive();                                                     // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false) | ||||||
|     IMGUI_API bool          IsAnyItemActive();                                                  //  |     IMGUI_API bool          IsAnyItemActive();                                                  //  | ||||||
|     IMGUI_API bool          IsWindowFocused();                                                  // is current window focused (differentiate child windows from each others) |     IMGUI_API ImVec2        GetItemActiveDragDelta();                                           // mouse delta from the time the item first got active | ||||||
|     IMGUI_API bool          IsRootWindowFocused();                                              // is current root window focused |  | ||||||
|     IMGUI_API bool          IsRootWindowOrAnyChildFocused();                                    // is current root window or any of its child (including current window) focused |  | ||||||
|     IMGUI_API ImVec2        GetItemRectMin();                                                   // get bounding rect of last item |     IMGUI_API ImVec2        GetItemRectMin();                                                   // get bounding rect of last item | ||||||
|     IMGUI_API ImVec2        GetItemRectMax();                                                   // " |     IMGUI_API ImVec2        GetItemRectMax();                                                   // " | ||||||
|     IMGUI_API ImVec2        GetItemRectSize();                                                  // " |     IMGUI_API ImVec2        GetItemRectSize();                                                  // " | ||||||
|  |     IMGUI_API bool          IsWindowFocused();                                                  // is current window focused (differentiate child windows from each others) | ||||||
|  |     IMGUI_API bool          IsRootWindowFocused();                                              // is current root window focused | ||||||
|  |     IMGUI_API bool          IsRootWindowOrAnyChildFocused();                                    // is current root window or any of its child (including current window) focused | ||||||
|     IMGUI_API bool          IsClipped(const ImVec2& item_size);                                 // to perform coarse clipping on user's side (as an optimization) |     IMGUI_API bool          IsClipped(const ImVec2& item_size);                                 // to perform coarse clipping on user's side (as an optimization) | ||||||
|     IMGUI_API bool          IsKeyPressed(int key_index, bool repeat = true);                    // key_index into the keys_down[512] array, imgui doesn't know the semantic of each entry |     IMGUI_API bool          IsKeyPressed(int key_index, bool repeat = true);                    // key_index into the keys_down[512] array, imgui doesn't know the semantic of each entry | ||||||
|     IMGUI_API bool          IsMouseClicked(int button, bool repeat = false); |     IMGUI_API bool          IsMouseClicked(int button, bool repeat = false); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user