From 18fa8e1c7ea256ce518771aa9f56e8c752c94376 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sat, 4 Jul 2015 16:46:30 -0600 Subject: [PATCH] Fixed IsMouseDragging() (fix #260) --- imgui.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index 2c3458b79..c902fbdcd 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2978,6 +2978,8 @@ bool ImGui::IsMouseDragging(int button, float lock_threshold) { ImGuiState& g = *GImGui; IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + if (!g.IO.MouseDown[button]) + return false; if (lock_threshold < 0.0f) lock_threshold = g.IO.MouseDragThreshold; return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold;