瀏覽代碼

Fixed IsMouseDragging() (fix #260)

ocornut 10 年之前
父節點
當前提交
18fa8e1c7e
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      imgui.cpp

+ 2 - 0
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;