-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Position inside child window when border width changes #7887
Copy link
Copy link
Open
Description
Version/Branch of Dear ImGui:
1.90.8
Back-ends:
Raylib
Compiler, OS:
Windows10
Full config/build information:
No response
Details:
I draw a child window and inside this child window another child window at coordinates {1,1} and everything is fine - the child is adjacent directly to the sides of the outer child window.
However, when I set the frame width of the outer child window to 2 or more, then I can no longer draw the inner child window directly adjacent to the sides of the outer child window - now there is always a gap of 1 pixel. I took a screenshot.
Why is that? Is this correct?
ImGui::Begin("Main Window");
//---------------------------------------------------------------------------
float border_thickness1 = 1;
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, border_thickness1);
ImGui::BeginChild("Child Window 1", ImVec2(180, 180), true);
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 1.0f);
ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(255,0,0,255));
ImGui::SetCursorPos({ 1,1 });
ImGui::BeginChild("SUBChild Window 1", ImVec2(100, 100), true);
ImGui::EndChild();
ImGui::PopStyleColor();
ImGui::PopStyleVar();
ImGui::EndChild();
ImGui::PopStyleVar();
//---------------------------------------------------------------------------
ImGui::SameLine();
//---------------------------------------------------------------------------
float border_thickness2 = 2;
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, border_thickness2);
ImGui::BeginChild("Child Window 2", ImVec2(180, 180), true);
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 1.0f);
ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(255, 0, 0, 255));
ImGui::SetCursorPos({ 1,1 });
ImGui::BeginChild("SUBChild Window 2", ImVec2(100, 100), true);
ImGui::EndChild();
ImGui::PopStyleColor();
ImGui::PopStyleVar();
ImGui::EndChild();
ImGui::PopStyleVar();
//---------------------------------------------------------------------------
ImGui::SameLine();
//---------------------------------------------------------------------------
float border_thickness3 = 2;
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, border_thickness3);
ImGui::BeginChild("Child Window 3", ImVec2(180, 180), true);
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 1.0f);
ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(255, 0, 0, 255));
ImGui::SetCursorPos({ 2,2 });
ImGui::BeginChild("SUBChild Window 3", ImVec2(100, 100), true);
ImGui::EndChild();
ImGui::PopStyleColor();
ImGui::PopStyleVar();
ImGui::EndChild();
ImGui::PopStyleVar();
//---------------------------------------------------------------------------
ImGui::SameLine();
//---------------------------------------------------------------------------
float border_thickness4 = 3;
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, border_thickness4);
ImGui::BeginChild("Child Window 4", ImVec2(180, 180), true);
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 1.0f);
ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(255, 0, 0, 255));
ImGui::SetCursorPos({ 1,1 });
ImGui::BeginChild("SUBChild Window 4", ImVec2(100, 100), true);
ImGui::EndChild();
ImGui::PopStyleColor();
ImGui::PopStyleVar();
ImGui::EndChild();
ImGui::PopStyleVar();
//---------------------------------------------------------------------------
ImGui::SameLine();
//---------------------------------------------------------------------------
float border_thickness5 = 3;
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, border_thickness5);
ImGui::BeginChild("Child Window 5", ImVec2(180, 180), true);
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 1.0f);
ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(255, 0, 0, 255));
ImGui::SetCursorPos({ 2,2 });
ImGui::BeginChild("SUBChild Window 5", ImVec2(100, 100), true);
ImGui::EndChild();
ImGui::PopStyleColor();
ImGui::PopStyleVar();
ImGui::EndChild();
ImGui::PopStyleVar();
//---------------------------------------------------------------------------
ImGui::SameLine();
//---------------------------------------------------------------------------
float border_thickness6 = 3;
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, border_thickness6);
ImGui::BeginChild("Child Window 6", ImVec2(180, 180), true);
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 1.0f);
ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(255, 0, 0, 255));
ImGui::SetCursorPos({ 3,3 });
ImGui::BeginChild("SUBChild Window 6", ImVec2(100, 100), true);
ImGui::EndChild();
ImGui::PopStyleColor();
ImGui::PopStyleVar();
ImGui::EndChild();
ImGui::PopStyleVar();
//---------------------------------------------------------------------------
ImGui::End();
Screenshots/Video:
Reactions are currently unavailable
