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

Separator not clipped to current table cell (spans entire row) #4787

Closed
BobbyAnguelov opened this issue Dec 5, 2021 · 2 comments
Closed

Comments

@BobbyAnguelov
Copy link

Version/Branch of Dear ImGui:

Dear ImGui 1.86 WIP (18514)
--------------------------------
sizeof(size_t): 4, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _MSC_VER=1929
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx11
io.ConfigFlags: 0x00000441
 NavEnableKeyboard
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C0E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 1264.00,761.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
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

My Issue/Question:

Seperators dont seems to be correctly clipped against their table cell and so span the entire table, I found this issue regarding columns: #205 , but i dont know if it's related since this is with the tables code?

Screenshots/Video

image

Standalone, minimal, complete and verifiable example: (see #2261)

ImGui::Begin( "Bug Repro" );
        if ( ImGui::BeginTable( "DialogTable", 2, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_Resizable | ImGuiTableFlags_PadOuterX | ImGuiTableFlags_NoSavedSettings, ImVec2( -1, -1 ) ) )
        {
            ImGui::TableSetupColumn( "Info", ImGuiTableColumnFlags_NoHide | ImGuiTableColumnFlags_WidthStretch );
            ImGui::TableSetupColumn( "Creator", ImGuiTableColumnFlags_NoHide | ImGuiTableColumnFlags_WidthStretch );

            ImGui::TableNextRow();

            ImGui::TableSetColumnIndex( 0 );
            ImGui::Text( "Some TExt " );
            ImGui::Separator();
            ImGui::Text( "Some More TExt " );

            ImGui::TableSetColumnIndex( 1 );
            ImGui::Text( "Some More Text Other col " );

            ImGui::EndTable();
        }
        ImGui::End();
@ocornut
Copy link
Owner

ocornut commented Dec 5, 2021

I pushed a smelly/hacky work-around for this (which likely bite back when mixing groups and tables).

git cherry-pick aa41f16589cb78adee1553eccce5f02458ccef16

Some details for our own future reference:

In theory Separator() would simply be pulling its range from window's WorkRect.MinX/MaxX, it's almost what we want but not 100%, that need to be taken into account when finishing the transition to use WorkRect.

The inconsistent clipping is something else (we haven't merged AABB in ImDrawCmd yet so tables are using CursorMaxPos to evaluate submitted contents, which is also fed back for auto-resizing. We need an alternative (just like IdealMaxPos was added next to CursorMaxPos) but I guess I was hoping the AABB in ImDrawCmd thing would be merged earlier, maybe I'll look at that first, anyhow Separator() won't trigger that anyone but it's a more general thing.

@ocornut
Copy link
Owner

ocornut commented Oct 3, 2023

I went ahead and removed some of the legacy stuff in there, it's a small change but been hesitant to do it for a while as I worried it would cause troubles but better moving onward. For standardization this also means some slight changes with how things are positioning, explained in the changelog of 28b237f.

@ocornut ocornut closed this as completed Oct 3, 2023
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