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

Missing right & bottom table outer borders when inside a window without padding (1.90 regression) #7428

Closed
cfillion opened this issue Mar 22, 2024 · 4 comments

Comments

@cfillion
Copy link
Contributor

cfillion commented Mar 22, 2024

Version/Branch of Dear ImGui:

1.90 - 1.90.4, since a340718

Back-ends:

Tested with example_glfw_metal, example_glfw_opengl3 & custom

Compiler, OS:

macOS

Full config/build information:

No response

Details:

Commit a340718 (1.90) draws the bottom and right borders of tables offset by 1px, beyond the expected area and potentially past the window's clip rect.

They're invisible when the table spans all available space within a child window or a normal window with no padding.

BeginTable(outer_size = ImVec2(100, 100)) produces a 101x101px table.

Screenshots/Video:

Invisible/clipped borders:
Missing borders

1px bigger than child window borders and item frames = invading into window padding and item spacing:
Inconsistent pixel
(Zoomed 3x)

Minimal, Complete and Verifiable Example code:

auto table = [] (ImVec2 size = {}) {
  if(ImGui::BeginTable("table", 2, ImGuiTableFlags_Borders /* with an S */ | ImGuiTableFlags_ScrollY, size)) {
    ImGui::TableNextRow();
    ImGui::TableNextColumn();
    ImGui::Text("Hello, world!");
    ImGui::EndTable();
  }
};

ImGui::Begin("Case 1");
ImGui::BeginChild("child");
table();
ImGui::EndChild();
ImGui::End();

ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0);
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, { 0, 0 });
ImGui::Begin("Case 2");
table();
ImGui::End();
ImGui::PopStyleVar(2);

ImGui::Begin("Case 3");
ImGui::BeginChild("child", { 0, 16 }, ImGuiChildFlags_Border /* without an S */); ImGui::EndChild();
table({ 0, 24 });
ImGui::Button("Test", { -FLT_MIN, 0 });
ImGui::End();
cfillion added a commit to cfillion/imgui that referenced this issue Apr 12, 2024
cfillion added a commit to cfillion/imgui that referenced this issue Apr 14, 2024
cfillion added a commit to cfillion/imgui that referenced this issue May 8, 2024
cfillion added a commit to cfillion/imgui that referenced this issue Jun 13, 2024
cfillion added a commit to cfillion/imgui that referenced this issue Jul 3, 2024
JVital2013 added a commit to SatDump/SatDump that referenced this issue Jul 22, 2024
Uses the commit from ocornut/imgui#7428 to work around table borders being clipped when filling the space in child windows. This is the 2nd patch we made to ImGui (the first one being 51970f0)
@ocornut
Copy link
Owner

ocornut commented Aug 23, 2024

if(ImGui::BeginTable("table", 2, ImGuiTableFlags_Borders /* with an S /
ImGui::BeginChild("child", { 0, 16 }, ImGuiChildFlags_Border /
without an S */);

You win :)
0b9adc2

@ocornut
Copy link
Owner

ocornut commented Aug 23, 2024

For now I have reverted a340718 with a131c3e.
I am trying to work on a better solution as this exhibit other minor visual issues, but I believe this one is more damaging currently.
I'll keep this open until I am satisfied with a solution for #6765 and #3752.

ocornut added a commit that referenced this issue Aug 23, 2024
@ocornut
Copy link
Owner

ocornut commented Aug 23, 2024

Pushed new fix 864a2bf
Please see #6765 (comment) for details.
Hope it works this time!

@cfillion
Copy link
Contributor Author

Thank you!

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

No branches or pull requests

2 participants