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

Docking without a central node? #7698

Closed
nikitablack opened this issue Jun 17, 2024 · 1 comment
Closed

Docking without a central node? #7698

nikitablack opened this issue Jun 17, 2024 · 1 comment
Labels

Comments

@nikitablack
Copy link

nikitablack commented Jun 17, 2024

Version/Branch of Dear ImGui:

Version v1.90.5, Branch: docking

Back-ends:

custom

Compiler, OS:

Ubuntu 20.04

Full config/build information:

No response

Details:

In my application I don't want to have the central node in a main docking area. I.e., when I start the application for the first time, the area should be empty. Next, I want to create multiple windows and arrange them whatever I want, but there should be no empty spaces in the main area as soon as I add at least one window. With the default implementation, I can drop a window to one of the 5 predefined sections, like this:

imgui1

If I drop a window to a left side there's an empty space to the right:

imgui2

I'd like to avoid that empty space and make the very first window to fill the complete docking area. For this, I created a dockspace with the ImGuiDockNodeFlags_NoDockingSplit flag:

    ImGuiWindowClass windowClass{};
    windowClass.DockNodeFlagsOverrideSet = ImGuiDockNodeFlags_NoUndocking | ImGuiDockNodeFlags_NoTabBar;
    ImGui::SetNextWindowClass(&windowClass);

    ImGui::Begin(viewerContainerName.c_str(), nullptr, ImGuiWindowFlags_None | ImGuiWindowFlags_NoBringToFrontOnFocus);

    auto viewerDockspace = ImGui::GetID("viewerDockspace");

    ImGui::DockSpace(viewerDockspace, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_NoDockingSplit);
    ImGui::End();

Now I can drop a window only to the central node, which seems like what I want:

imgui3

But now I can't split the newly added window, i.e. I can't arrange windows in rows and columns, only stacking works:

imgui4

(if I move the mouse cursor exactly on border, the side dropping areas appear, but I can't use them - as soon as I move the mouse, they disappear again).

To be honest, I don't fully understand how the docking works - how it keeps the state, why there are multiple DockBuilderXXX functions. Is it possible at all to achieve what I want without modifying the source code?

@nikitablack
Copy link
Author

For now, the solution from 3834 works for me (i.e. changing the dockspace's LocalFlags). It basically removes the central dropping area leaving only sides and any docked window takes the complete space.

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