ButtonBehavior: Fixed ImGuiButtonFlags_NoHoldingActiveID from incorrectly setting ActiveIdClickOffset, which probably have no known effect, but it is more correct this way. (#1418)

This commit is contained in:
omar 2017-11-07 16:41:58 +01:00
parent aae52522c3
commit 41862b8c0e

View File

@ -5835,11 +5835,15 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
{ {
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);
g.ActiveIdClickOffset = g.IO.MousePos - bb.Min;
} }
if ((flags & ImGuiButtonFlags_PressedOnRelease) && g.IO.MouseReleased[0]) if ((flags & ImGuiButtonFlags_PressedOnRelease) && g.IO.MouseReleased[0])
{ {