Skip to content

When you hover over a ImageButton or a Button and hold down left click the ImGui::IsWindowHovered function returns false. #6021

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

Closed
jkatsanis opened this issue Dec 24, 2022 · 2 comments

Comments

@jkatsanis
Copy link

jkatsanis commented Dec 24, 2022

If you hover over a button and hold down right click it returns true this is why i think this is a issue. Here is example code

ImGui::Begin("Windw");
if(ImGui::Button("IH", ImVec2(100, 100)))
{

}
std::cout << ImGui::IsWindowHovered();
ImGui::End();
@jkatsanis jkatsanis changed the title When you hover over a ImageButton or a Button and hold down left click the ImGui::IsWindowHovered returns false. When you hover over a ImageButton or a Button and hold down left click the ImGui::IsWindowHovered function returns false. Dec 24, 2022
@ocornut
Copy link
Owner

ocornut commented Dec 25, 2022

This is intended as the desirable default behavior. activating an item inhibit hovering over other things by default. You can see the effect eg: other buttons are not highlighted while dragging from a first button. Same thing happens with windows.

If you look at the flags for IsWindowHovered() you will find among them various ways to disable those behaviors, eg:

ImGuiHoveredFlags_AllowWhenBlockedByActiveItem  = 1 << 7,   // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.

@ocornut
Copy link
Owner

ocornut commented Dec 25, 2022

Closing and linking to same issue #5810 #5637 #1479 and #1382

@ocornut ocornut closed this as completed Dec 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants