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

BeginGroup/EndGroup with table inside reports incorrect item size #7543

Open
thedmd opened this issue Apr 30, 2024 · 0 comments
Open

BeginGroup/EndGroup with table inside reports incorrect item size #7543

thedmd opened this issue Apr 30, 2024 · 0 comments

Comments

@thedmd
Copy link
Contributor

thedmd commented Apr 30, 2024

Version/Branch of Dear ImGui:

Version 1.90.6 WIP (r19053), Branch: master

Back-ends:

imgui_impl_win32.cpp + imgui_impl_dx11.cpp

Compiler, OS:

Windows 11, MSVC 2022, x64

Full config/build information:

Dear ImGui 1.90.6 WIP (19053)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1939
define: _MSVC_LANG=201402
--------------------------------
io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx11
io.ConfigFlags: 0x00000000
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x0000000E
 HasMouseCursors
 HasSetMousePos
 RendererHasVtxOffset
--------------------------------
io.Fonts: 2 fonts, Flags: 0x00000000, TexSize: 1024,1024
io.DisplaySize: 1905.33,987.33
io.DisplayFramebufferScale: 1.50,1.50
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:

My understanding is that groups should surround containing widgets, which isn't the case with tables.

Table surrounded by BeginGroup/EndGroup appears to be measured incorrectly.

Problem can be reproduced simply by resizing Test2 window. Green rect is expected to cover whole table.
Push shift key to enable workaround, which place 0 size dummy widget at the same line as table.

Digging into the code, table OuterRect seems to be "stuck" on minimum size. At the moment I cannot tell if this is an desired behavior or not.

Screenshots/Video:

Current Expected
image image

Minimal, Complete and Verifiable Example code:

ImGui::Begin("Test2");
ImGui::BeginGroup();
if (ImGui::BeginTable("table2", 2))
{
    ImGui::TableNextColumn();
    ImGui::Text("Thing 1");
    ImGui::TableNextColumn();
    ImGui::Text("Thing 2");
    ImGui::EndTable();
}

if (ImGui::GetIO().KeyShift)
{
    ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, 0.0f));
    ImGui::SameLine(0.0f, 0.0f);
    ImGui::Dummy(ImVec2(0.0f, 0.0f));
    ImGui::PopStyleVar();
}
ImGui::EndGroup();
ImGui::GetWindowDrawList()->AddRectFilled(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), IM_COL32(0, 255, 0, 64), 4.0f);
ImGui::End();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant