Flix01 / imgui

Dear ImGui Addons Branch = plain unmodified dear imgui plus some extra addon.
https://github.com/Flix01/imgui/wiki/ImGui-Addons-Branch-Home
MIT License
396 stars 34 forks source link

[imguidock] Dock splits aren't draggable any more #62

Closed tom-seddon closed 2 years ago

tom-seddon commented 2 years ago

Upgraded my imgui submodule for the first time in a while and the dock splits aren't draggable!

Affects 54509c59590c721e54ac7459ec84497766c64049, the revision I'm currently using in my project. (I am a bit behind! I will be upgrading, just not yet. Dealing with the dear imgui input changes will mean a bit of work.)

Also affects 008d358ea2bf61fb07a63b34a8f72e2f8906dc64 (current head revision), I think, as I can reproduce it in Chrome with https://rawgit.com/Flix01/imgui/imgui_with_addons/examples/addons_examples/html/main.html

After a bit of poking about it looks like the invisible buttons (e.g., https://github.com/Flix01/imgui/blob/54509c59590c721e54ac7459ec84497766c64049/addons/imguidock/imguidock.cpp#L362) are never getting classed as hovered, even when the mouse is over them.

I'm going to attempt to fix this, but I thought I'd raise an issue anyway. I haven't been paying much attention to recent dear imgui changes, so maybe it's actually something pretty obvious...

Thanks,

--Tom

Flix01 commented 2 years ago

Thanks for the report. I can reproduce the issue. I'll see if it's something general or related to the SDL binding only (used in the emscripten build).

Flix01 commented 2 years ago

@tom-seddon: It should be fixed now. It seems that ImGui::IsItemHovered() now requires the 'AllowWhenOverlapped' flag when used after ImGui::InvisibleButton(...) (not sure if it's a general rule or not, but it seems to fix imguidock).

P.S. ATM the emscripten build is not up to date.

tom-seddon commented 2 years ago

Thanks very much - that will have saved me a bit of time! I've applied this change to the version I'm using and it's working again now.

--Tom

tom-seddon commented 2 years ago

Just noticed that the splits are draggable even if something overlaps them.

I'm not going to get to look at this straight away, but it's on my to do list.

Thanks,

--Tom

Flix01 commented 2 years ago

Just noticed that the splits are draggable even if something overlaps them.

I can reproduce it.

One quick fix I've just found is to replace this line: https://github.com/Flix01/imgui/blob/b900eefd1849a26fe563e87610d90829206e85be/addons/imguidock/imguidock.cpp#L395 with:

const bool hovered = IsWindowFocused(ImGuiFocusedFlags_RootWindow) && IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlapped);

But I'm not sure if there are further issues... and the flag ImGuiFocusedFlags_RootWindow it's just the first I've tried... Anyway it seems to work.

If there aren't further problems, I'll use this fix in next commit.

Flix01 commented 2 years ago

I've just added a fix using the IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) flag.

https://rawgit.com/Flix01/imgui/imgui_with_addons/examples/addons_examples/html/main.html should be up to date now.