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

Closed
opened 2021-12-05 17:20:36 +00:00 by BobbyAnguelov · 2 comments
BobbyAnguelov commented 2021-12-05 17:20:36 +00:00 (Migrated from github.com)

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: https://github.com/ocornut/imgui/issues/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 https://github.com/ocornut/imgui/issues/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();
**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: https://github.com/ocornut/imgui/issues/205 , but i dont know if it's related since this is with the tables code? **Screenshots/Video** ![image](https://user-images.githubusercontent.com/10767490/144756543-df82fd1d-c76f-4d41-ace0-3887bed0c33d.png) **Standalone, minimal, complete and verifiable example:** _(see https://github.com/ocornut/imgui/issues/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 commented 2021-12-05 17:53:26 +00:00 (Migrated from github.com)

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.

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 commented 2023-10-03 13:40:11 +00:00 (Migrated from github.com)

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 28b237f94d.

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 28b237f94de4dfb26ecb353fd161765f46d31ba8.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#4787
No description provided.