imgui icon indicating copy to clipboard operation
imgui copied to clipboard

IsMouseDragging with lock_threshold does NOT working

Open DickyQi opened this issue 2 months ago • 4 comments

Version/Branch of Dear ImGui:

Version 1.9242, Branch: docking

Back-ends:

imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

macOS + clang17

Full config/build information:

No response

Details:

ImGui::IsMouseDragging(ImGuiMouseButton_Left, 0.f) set lock_threshold param not any effect

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

// Here's some code anyone can copy and paste to reproduce your issue
ImGui::Begin("Example Bug");
MoreCodeToExplainMyIssue();
ImGui::End();

DickyQi avatar Oct 24 '25 16:10 DickyQi

It doesn't make sense to use ImGui::IsMouseDragging(0, 0.0f)); it would be the same as ImGui::IsMouseDown(0). What are you trying to do, you have not explained?

Perhaps use a threshold that's not zero if you want to detect any movement:

ImGui::Text("IsMouseDragging: %d", ImGui::IsMouseDragging(0, 0.001f));

ocornut avatar Oct 24 '25 16:10 ocornut

I am try to do image edit tools, which is add brush tools with mouse dragging to draw line. When I stop dragging mouse and released button, there are small delay. it will case brush more pixel at the end of dragging point. Also I notice at imgui_demo.cpp line 8120: ImGui::Text("IsMouseDragging(%d):", button); ImGui::Text(" w/ default threshold: %d,", ImGui::IsMouseDragging(button)); ImGui::Text(" w/ zero threshold: %d,", ImGui::IsMouseDragging(button, 0.0f)); ImGui::Text(" w/ large threshold: %d,", ImGui::IsMouseDragging(button, 20.0f)); IsMouseDragging return 0 at the same time, is it any issue here?

DickyQi avatar Oct 24 '25 18:10 DickyQi

It shouldn’t happen on the same time. Please provide a video capture with this section o the demo + debug log open with [X] IO enabled.

ocornut avatar Oct 24 '25 19:10 ocornut

Sorry, I overlooked a question. I found that the problem is that I use MacBook touchpad gestures to drag and drop with the mouse. This method is the reason for the delay in drag and drop. If normal drag and drop operations are used, the program will perform normally. I will try other hardware mice more. Thank you for your prompt response.

DickyQi avatar Oct 25 '25 05:10 DickyQi