-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Drag & Drop with other mouse button than LMB #3885
Comments
Since you may be waiting for a response, i will explain this a bit. I took a look at |
As hinted above there's are two sides to this. (A.1) The first is that (A.2) // Regular button
ImGui::Button("Button");
// Extend to react middle and right mouse buttons.
ImGuiWindow* window = ImGui::GetCurrentWindow();
ImGui::ButtonBehavior(window->DC.LastItemRect, window->DC.LastItemId, NULL, NULL,
ImGuiButtonFlags_MouseButtonMiddle | ImGuiButtonFlags_MouseButtonRight); (B)
Since drag and drop was added, active buttons now record the mouse button that activated them so we should be able to link those two now... |
Pushed 954b06a which now works with it: ImGui::Button("Button");
ImGuiWindow* window = ImGui::GetCurrentWindow();
ImGui::ButtonBehavior(window->DC.LastItemRect, window->DC.LastItemId, NULL, NULL, ImGuiButtonFlags_MouseButtonMiddle | ImGuiButtonFlags_MouseButtonRight);
if (ImGui::BeginDragDropSource())
{
ImGui::Text("dragged button");
ImGui::EndDragDropSource();
} I think down the line we will need to explicit mouse button choice/mask in ImGuiDragDropFlags but for items with ID we can detect it, so that should solve the issue. (cc same issue #1637) |
Version/Branch of Dear ImGui:
Version: 1.82 WIP
Branch: Docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler: VS 2019
Operating System: Windows 10
My Issue/Question:
I am implementing to move bones inside the hierarchy via drag & drop. In Maya this happens by dragging with the middle mouse button and I like to follow the established UI rules from there. I noticed that ImGui is hard coded to use the LMB. Can we make the desired mouse button optional?
The text was updated successfully, but these errors were encountered: