-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Help With Overlapped Widgets #5312
Labels
Comments
You could try this: static ImDrawListSplitter splitter;
splitter.Split(ImGui::GetWindowDrawList(), 2);
// Render button first, however, put it to the top layer so it is rendered on top of viewport image.
splitter.SetCurrentChannel(ImGui::GetWindowDrawList(), 1);
if (ImGui::Button("Button"))
printf("Button pressed\n"); // Interacting with the button will prevent interacting with the image.
// Render viewport image later, but it wont cover previously rendered button.
splitter.SetCurrentChannel(ImGui::GetWindowDrawList(), 0);
ImGui::SetCursorPos(ImGui::GetWindowContentRegionMin());
ImGui::Image(io.Fonts->TexID, ImVec2(200, 200));
if (ImGui::IsItemClicked())
printf("Viewport pressed\n");
// Debug info: image is hovered when hovering "Button", but hovered state gets reset when "Button" is pressed down.
ImGui::Text("Viewport hovered: %d", ImGui::IsItemHovered());
splitter.Merge(ImGui::GetWindowDrawList()); |
I tried what you suggested, but it still does not give me the functionality I am looking for. The texture is still seen as hovered even if the button is on top of it. However, I did learn about the splitter now, so thanks for that! Pretty cool. |
Hello, This should now all be fixed by changes outlined here:
Thanks for your patience. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version/Branch of Dear ImGui:
Version: 1.88
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Operating System: Windows 10
My Issue/Question:
I am trying to create an overlay for my scene, as seen here. Notice the button in the top left and the child in the bottom right.
I want the button to block events to the scene. Basically, I just need to know if the texture is hovered and then I can respond accordingly. I have tried the following:
The child seems to be working correctly, but I suspect this has nothing to do with overlapping and just how children work in Dear ImGui.
m_engine->m_isHovered
is being set to true, even if the button is being hovered. Am I missing something?The text was updated successfully, but these errors were encountered: