Skip to content
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

Constrain the docking direction of a window #5907

Open
dimateos opened this issue Nov 22, 2022 · 2 comments
Open

Constrain the docking direction of a window #5907

dimateos opened this issue Nov 22, 2022 · 2 comments
Labels

Comments

@dimateos
Copy link
Contributor

dimateos commented Nov 22, 2022

Version/Branch of Dear ImGui:

Version: 1.89.1 WIP
Branch: Docking

Back-end/Renderer/Compiler/OS: (ANY)

Back-ends: QtImGui
Compiler: MSVC_2017 / INTEL_2018
Operating System: Windows 10

My Issue/Question:

I think it would be useful to be able to limit the dock direction either horizontally or vertically for certain windows. Looking at the source (e.g. DockNodePreviewDockSetup function) I see that based on flags and more, ImGui checks that the center and the sides are available. Maybe the sides could be split into vertical and horizontal directions. I saw some relation in #3492

The rationale behind this could be, for example, a window that may be designed as a "column" with a fixed width, which requires a large vertical area to fit information displayed. Then if the user is able to dock it at the top/bottom of a dockspace most of the horizontal space is wasted and the user has to scroll. At least for dockspaces this would makes sense, for docking windows into other windows is harder to define as one could dock a "column" window on top of another. Maybe this issue can expand on the discussion.

This is also not a vital feature, but seems appropiate to reduce the user option to the one that makes sense, other UI frameworks offer it (e.g. QT as in my example). I have started recently using the docking API and I am no where close to knowing how non-trivial this could be, maybe it is not worth after all.

Thanks for the amazing work!

Screenshots/Video

2022-11-22_(161839)_viewer

Standalone, minimal, complete and verifiable example:

Open the demo example Dockspace, in Options you can set the flags for NoDockingInCentralNode and NoSplit (to disable all sides)

@dimateos dimateos changed the title Cons Constrain the docking direction of a window Nov 22, 2022
@ocornut
Copy link
Owner

ocornut commented Nov 22, 2022

Hello,
I likely won't be able to answer/fix that fully for a while.
Linking to #2648 which deals with the issue of docking axis (it has code but doesn't solve your problem).

@dimateos
Copy link
Contributor Author

No problem!

It is also not a very high priority for me. I wanted to post it to suggest a possible future feature, or something to keep in mind the axis direction. Thanks for the link, if I eventually write a workaround I will post it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants