mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-30 20:51:06 +01:00 
			
		
		
		
	Internal: ButtonBehavior: Tweak to update g.ActiveIdClickOffset more consistently
This commit is contained in:
		| @@ -6253,20 +6253,14 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool | |||||||
|             { |             { | ||||||
|                 SetActiveID(id, window); // Hold on ID |                 SetActiveID(id, window); // Hold on ID | ||||||
|                 FocusWindow(window); |                 FocusWindow(window); | ||||||
|                 g.ActiveIdClickOffset = g.IO.MousePos - bb.Min; |  | ||||||
|             } |             } | ||||||
|             if (((flags & ImGuiButtonFlags_PressedOnClick) && g.IO.MouseClicked[0]) || ((flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDoubleClicked[0])) |             if (((flags & ImGuiButtonFlags_PressedOnClick) && g.IO.MouseClicked[0]) || ((flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDoubleClicked[0])) | ||||||
|             { |             { | ||||||
|                 pressed = true; |                 pressed = true; | ||||||
|                 if (flags & ImGuiButtonFlags_NoHoldingActiveID) |                 if (flags & ImGuiButtonFlags_NoHoldingActiveID) | ||||||
|                 { |  | ||||||
|                     ClearActiveID(); |                     ClearActiveID(); | ||||||
|                 } |  | ||||||
|                 else |                 else | ||||||
|                 { |  | ||||||
|                     SetActiveID(id, window); // Hold on ID |                     SetActiveID(id, window); // Hold on ID | ||||||
|                     g.ActiveIdClickOffset = g.IO.MousePos - bb.Min; |  | ||||||
|                 } |  | ||||||
|                 FocusWindow(window); |                 FocusWindow(window); | ||||||
|             } |             } | ||||||
|             if ((flags & ImGuiButtonFlags_PressedOnRelease) && g.IO.MouseReleased[0]) |             if ((flags & ImGuiButtonFlags_PressedOnRelease) && g.IO.MouseReleased[0]) | ||||||
| @@ -6286,6 +6280,8 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool | |||||||
|     bool held = false; |     bool held = false; | ||||||
|     if (g.ActiveId == id) |     if (g.ActiveId == id) | ||||||
|     { |     { | ||||||
|  |         if (g.ActiveIdIsJustActivated) | ||||||
|  |             g.ActiveIdClickOffset = g.IO.MousePos - bb.Min; | ||||||
|         if (g.IO.MouseDown[0]) |         if (g.IO.MouseDown[0]) | ||||||
|         { |         { | ||||||
|             held = true; |             held = true; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user