From 41862b8c0e9f651a253de45c2b7e982c19c9ea9d Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 7 Nov 2017 16:41:58 +0100 Subject: [PATCH] ButtonBehavior: Fixed ImGuiButtonFlags_NoHoldingActiveID from incorrectly setting ActiveIdClickOffset, which probably have no known effect, but it is more correct this way. (#1418) --- imgui.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 69ee04d9..ba212d73 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5835,11 +5835,15 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool { pressed = true; if (flags & ImGuiButtonFlags_NoHoldingActiveID) + { ClearActiveID(); + } else + { SetActiveID(id, window); // Hold on ID + g.ActiveIdClickOffset = g.IO.MousePos - bb.Min; + } FocusWindow(window); - g.ActiveIdClickOffset = g.IO.MousePos - bb.Min; } if ((flags & ImGuiButtonFlags_PressedOnRelease) && g.IO.MouseReleased[0]) {