-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Splitters weird padding #7706
Comments
Why don’t you simply use resizable child windows? |
I am open to any solution. |
See Demo>Layout>Child Windows In the previous topic I already suggested two times to use BeginChild() with resizing flags and you have not reacted to that. |
Hi, Now I switched to the master branch so that I could give it a try. Here I am putting the latest version of the code, which seems to me to be a very good end point. Screen.Recording.2024-06-18.at.17.31.11.movThe only strange things that remain and that I see in the video are:
I hope I can solve the problem, but right now I'm stuck.
|
That's strange. These flags are in docking for quite some time now. They were introduced in master in 1.90.0 (8 months ago) and got merged into docking around the same time. |
It's my fault. |
I am continuing to try to understand the problem. I see this issue #7541
this is whit the bb.movthis is whit the aa.movIn both cases I'm able to move the separator under the blue part (I couldn't do it before) |
Hello everyone,
I still can't drag the Splitters from the blue side of the layout test.mov
|
(When pasting repro feel free to ignore the app init/closure, in that situation we only the middle part that I can past in any existing example.) There seems to be various issues and this isn't as trivial as I expected it to be :( If you move the bottom part to the top it's a more natural fit: {
ImGuiWindowFlags windowFlags = 0;
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
ImGui::Begin("MainWindow", NULL, windowFlags);
ImGui::PopStyleVar();
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(5.0f, 5.0f));
// top part green
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.0f, 1.0f, 0.0f, 0.5f));
ImGui::BeginChild("green", ImVec2(0, 0), ImGuiChildFlags_Border | ImGuiChildFlags_ResizeY);
ImGui::PopStyleColor();
ImGui::EndChild();
// left part blue
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.0f, 0.0f, 1.0f, 0.5f));
ImGui::BeginChild("blue", ImVec2(0, 0), ImGuiChildFlags_ResizeX | ImGuiChildFlags_Border);
ImGui::PopStyleColor();
ImGui::EndChild();
ImGui::SameLine();
// right part red
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(1.0f, 0.0f, 0.0f, 0.5f));
ImGui::BeginChild("red", ImVec2(0, 0), ImGuiChildFlags_Border);
ImGui::PopStyleColor();
ImGui::EndChild();
ImGui::PopStyleVar();
ImGui::End();
} However it bothers me that clicking on horizontal line creates a small glitch in upper part (investigating this now). However this logic need an extra container (as you found out) if you move top to bottom: {
ImGuiWindowFlags windowFlags = 0;
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
ImGui::Begin("MainWindow", NULL, windowFlags);
ImGui::PopStyleVar();
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(5.0f, 0.0f));
// container blue-red
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.0f, 1.0f, 1.0f, 0.5f));
ImGui::BeginChild("container", ImVec2(0, 0), ImGuiChildFlags_ResizeY | ImGuiChildFlags_Border);
ImGui::PopStyleColor();
// left part blue
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.0f, 0.0f, 1.0f, 0.5f));
ImGui::BeginChild("blue", ImVec2(0, 0), ImGuiChildFlags_ResizeX | ImGuiChildFlags_Border);
ImGui::PopStyleColor();
ImGui::EndChild();
ImGui::SameLine();
// right part red
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(1.0f, 0.0f, 0.0f, 0.5f));
ImGui::BeginChild("red", ImVec2(0, 0), ImGuiChildFlags_Border);
ImGui::PopStyleColor();
ImGui::EndChild();
ImGui::EndChild();
ImGui::PopStyleVar();
// bottom part green
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.0f, 1.0f, 0.0f, 0.5f));
ImGui::BeginChild("green", ImVec2(0, 0), ImGuiChildFlags_Border);
ImGui::PopStyleColor();
ImGui::EndChild();
ImGui::End();
} I may investigate further but it may be more sane that you use DockBuilder as you did initially in #7631. |
… window which is tightly close to the boundaries of its parent. (#7706)
I have pushed a fix 77d582f for the glitch I mentioned. ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
ImGui::Begin("MainWindow");
ImGui::PopStyleVar();
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.0f, 1.0f, 0.0f, 0.5f));
ImGui::BeginChild("green", ImVec2(0, 0), ImGuiChildFlags_Border | ImGuiChildFlags_ResizeY);
ImGui::PopStyleColor();
ImGui::EndChild();
ImGui::End(); This part at least is fixed :) |
Hi, @ocornut I include here the shortened version of the code.
This way everything works. The processing of drag the horizontal splitter is smooth.
the drag of the splitter under the blue part stop to work. test.movIf I change the border size in this way:
the drag of the splitter starts working again but I end up with unwanted margins. test2.movI try to figure out how to react. I can think about going back to the docking branch. |
Version/Branch of Dear ImGui:
Version 1.90.5, Branch: docking
Back-ends:
ImGui_ImplGlfw ImGui_ImplOpenGL3
Compiler, OS:
macOS
Full config/build information:
No response
Details:
My Issue/Question:
Most likely I will ask the usual idiotic question.
This issue is part of issue #7631
Anyway I'm trying to implement an interface with splitters but I can't get the border around the splitter off.
I tried playing with padding but couldn't get it off completely.
I started from the code found here: #319
Screenshots/Video:
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: