ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
61.15k stars 10.31k forks source link

Inconsistent docking behavior when clicking on window titlebar vs tab-button when 2 windows docked in a dockspace vs docked into each other? #3536

Open vexe opened 4 years ago

vexe commented 4 years ago

Version/Branch of Dear ImGui:

Version: 1.79 WIP (17803) Branch: docking

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_win32.cpp + imgui_impl_dx11.cpp Compiler: MSVC Operating System: Win10

My Issue/Question:

The behavior of docking when clicking/dragging the titlebar or tab-button is inconsistent depending on whether the windows are docked in a dockspace or docked into each other.

If you have two separate windows and you dock one into the other, and then move either the windows' title bar, it moves the windows as a whole unit, and if you click and drag the window from its tab, it moves it independently/splits it from being docked.

However, if you create a dockspace (like in the Dockspace example), and dock both windows under it, you can then click either the window title bar OR the tab and they will both split the window (as opposed to the previous behavior where the title bar moved everything as a whole, and the tab area did the split)

Screenshots/Video

Here's a video demonstrating this behavior https://youtu.be/2whaaqgU3Mc

You can see at 0:04 there's two windows docked into each other, I grabbed the titlebar of the right window and it moved both windows as a single unit. Then I grabbed the right window by its tab button and moved it out, it split the windows. Then I docked both windows under the dockspace, and grabbed the window by its title bar, it did the split.

I'm not saying its a bad thing but just having control over that behavior would be ideal. In my case it would be ideal that click-dragging the title bar would move everything as a unit in both cases.

Standalone, minimal, complete and verifiable example:

ImGui::ShowDemoWIndow(); // everything can be done in the demo, go Examples/Dockspace, then spawn any other window e.g. 'Examples/Console' and try what I did in the video
frink commented 4 years ago

So if I'm understanding correctly, what you would expect is that when grabbing the title bar it should move the dab group rather than the whole split window (whereas right now it moves the whole window including multiple docked split windows...) and when grabbing the tab it should move only the window which the tab represents. (Exactly how it works now...) Do I understand correctly?

vexe commented 4 years ago

Yeah I just didn't expect it to behave differently. Either behavior works fine as long as its consistent.

i.e. it does the split whether I moved the titlebar or tab-button (in both cases, whether the two windows are docked to each other or in a dockspace)

OR it does the split when I move the tab-button, but moves everything when I move the titlebar

frink commented 4 years ago

The only inconsistency I can see is that it pulls out just the one when you drag the title bar from dock space but it moves both windows when you have a floating split window. So the only case that may be acting weird is the floating split window fringe case...

I believe the way it is supposed to work is that you move the tab group when dragging the bar and move the tab when dragging the tab. Therefore, it should work the same with tab and title bar when you have one tab but when you have a group it should be different. The initial thing where you drag the title bar of a split window and it moves the window should not happen. Instead, the right docked window group (in this case only one tab) should move...

I think that is how it is supposed to work. You'd have to ask @ocornut for more clarification...