-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opening a popup only when the mouse hasn't dragged #2419
Comments
Hello Rick,
You may be able to query io.MouseDragMaxDistanceSqr[] if it hasn’t been cleared.
It would be preferable if you also described the nature of your use case in more details. A large portion of questions are better answered and solved knowing more about the context.
…-Omar
|
The context is a node graph. I use the left mouse button for selecting nodes, and the right mouse drag to scroll. But I also want the right mouse button to open a popup menu when all the user did was right click without scrolling. So that is why I need to know if the right mouse button was dragging when it was released. |
I would prefer it if |
…sed frame. Verify that mouse positions are valid otherwise returns zero. Removed obsolete comment. Tweaked demo. (#2419)
I made that change, it makes sense to me. (I wish I had access to more large codebase to better study how people use functions xx and xx, but a quick survey of users of this on public github repo confirms the side-effect seem harmless). Let me know if that indeeed solve your issue! |
It works great! But I just noticed that it is now inconsistent with |
I think they are better left as is.
IsMouseDragging() handle a very explicit request and changing it would probably break things.
We are just making the delta available a little longer because it makes sense to query that information exactly as you do.
|
Version/Branch of Dear ImGui:
Version: 1.69 WIP (16899)
Branch: docking
My Issue/Question:
I want to open a popup when the user right clicks with the mouse, but ONLY if the user hasn't dragged the mouse while holding the right mouse button.
I have tried combining
ImGui::IsMouseReleased(1)
with a check to see ifImGui::GetMouseDragDelta(1)
returned a zero length vector, but the drag delta seems to already have been reset at that point.Is there a way to check if the mouse was dragging when it was released? I would like to avoid keeping track of this myself.
The text was updated successfully, but these errors were encountered: