Restoring position and size after undock
Version/Branch of Dear ImGui:
Version: 1.69 Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: custom Compiler: vc++ 2017 Operating System: windows
My Issue/Question:
I was wondering if there is anyway to keep the undocked position/size, so when you undock it can restore it. I am doing this via code, but size would be nice when draging to undock also..
I had a look through and couldn't see anything obvious. If it's not any thoughts on how it might be implemented?
Cheers
This has been requested for Size before so I'd assume it is desirable. I don't quite understand the purpose for Position since undocking is generally a manual dragging act.
Implement it would probably involve storing extra fields in ImGuiWindow and have them be stored in the .ini file. And/or technically speaking we might not need to store the current position/size in the .ini if we are being docked (as it will be rewritten by the docking), and we could consider just storing that undocked pos/size in the .ini file. So, save one or the other based on whether we are currently docked, and restore them when undocking.
Hey, is there any progress on this?
Hello,
I have a branch with it but last time I looked the flexible docking model of dear imgui made the concept of "undocked size" very ambiguous in certain use cases. I don't remember which right now, but I've recently been pinged on this topic elsewhere so I'm going to have a look at it.
Yeah, this is not as simple as it looks. The basic expectation is that you have a window of given dimensions, which you dock somewhere, and it fills the available space. Then you undock it and the original window dimensions are restored.
Now, let's assume you have docked another window in the same place, to create a tabbed dock group. Then you undock the whole group. Which window size should be restored now? What happens when you break the dock group to have the two original windows?
bump for status check (sorry)
I'd like to see it too. This causes problem when undocking while in fullscreen mode, because now the window is outside the main viewport, so it's rendered in its own desktop window instead of being rendered inside the fullscreen one.
You should probably disable multi-viewports when in fullscreen mode..
Also a few versions ago we added special code when undocking viewport-or-monitor sized window to slightly scale them down on undock to facilitate interactions.
Multi-viewport is still useful when working with dual monitors:
- an outside window for statistics and other "read-only" info about the main viewport (to not cover anything in the main viewport)
- an inside-main-viewport window for interactive widgets (so the monitor doesn't need to switch between the fullscreen app and the desktop view constantly)
Hello :)
Just wondering if this is being looked at or there are plans to be looked at sometime in the near future? I used to live with it until I got an ultrawide monitor, which magnifies the issue by a factor of 10 I'd say.
Gave it a quick try that worked, apparently (I'm probably missing something of course): https://github.com/ocornut/imgui/assets/8068377/de89391b-a701-4fdf-a722-faf9786d597f
If anyone's insterested, that's the simple idea behind:
Attached is a WIP patch from June 2020, rebased on latest.
imgui-112a7a1-WIP preserve undocked size (2576).patch
It mostly appears to work at first glance but I am pretty sure there are ambiguous cases which are tricky to settle on and may cause user confusion. I'll make an effort to write them down here if I can remember them :)
Note on the patch: the behavior described in imgui.cpp:4465/ImGui::StartMouseMovingWindowOrNode ("Alter pivot to project ourselves on undocked") wasn't working for me, I had to move it to imgui.cpp:16257/ImGui::DockNodeStartMouseMovingWindow.
I would find this feature useful as well. Docked windows in my use case are often either large or awkward shapes and if you are switching them from docked/undocked state it becomes cumbersome to always have to resize.