1010/*
1111MIT License
1212
13- Copyright (c) 2019-2020 Stephane Cuillerdier (aka aiekick)
13+ Copyright (c) 2019-2024 Stephane Cuillerdier (aka aiekick)
1414
1515Permission is hereby granted, free of charge, to any person obtaining a copy
1616of this software and associated documentation files (the "Software"), to deal
@@ -3387,8 +3387,7 @@ bool IGFD::KeyExplorerFeature::m_FlashableSelectable(const char* label, bool sel
33873387 ItemSize (size, 0 .0f );
33883388
33893389 // Fill horizontal space
3390- // We don't support (size < 0.0f) in Selectable() because the ItemSpacing extension would make explicitly right-aligned sizes not visibly match
3391- // other widgets.
3390+ // We don't support (size < 0.0f) in Selectable() because the ItemSpacing extension would make explicitly right-aligned sizes not visibly match other widgets.
33923391 const bool span_all_columns = (flags & ImGuiSelectableFlags_SpanAllColumns) != 0 ;
33933392 const float min_x = span_all_columns ? window->ParentWorkRect .Min .x : pos.x ;
33943393 const float max_x = span_all_columns ? window->ParentWorkRect .Max .x : window->WorkRect .Max .x ;
@@ -3412,7 +3411,7 @@ bool IGFD::KeyExplorerFeature::m_FlashableSelectable(const char* label, bool sel
34123411 }
34133412 // if (g.IO.KeyCtrl) { GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(0, 255, 0, 255)); }
34143413
3415- // Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackground for every Selectable..
3414+ // Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackgroundChannel for every Selectable..
34163415 const float backup_clip_rect_min_x = window->ClipRect .Min .x ;
34173416 const float backup_clip_rect_max_x = window->ClipRect .Max .x ;
34183417 if (span_all_columns) {
@@ -3435,10 +3434,14 @@ bool IGFD::KeyExplorerFeature::m_FlashableSelectable(const char* label, bool sel
34353434
34363435 // FIXME: We can standardize the behavior of those two, we could also keep the fast path of override ClipRect + full push on render only,
34373436 // which would be advantageous since most selectable are not selected.
3438- if (span_all_columns && window->DC .CurrentColumns )
3439- PushColumnsBackground ();
3440- else if (span_all_columns && g.CurrentTable )
3441- TablePushBackgroundChannel ();
3437+ if (span_all_columns) {
3438+ if (g.CurrentTable )
3439+ TablePushBackgroundChannel ();
3440+ else if (window->DC .CurrentColumns )
3441+ PushColumnsBackground ();
3442+ g.LastItemData .StatusFlags |= ImGuiItemStatusFlags_HasClipRect;
3443+ g.LastItemData .ClipRect = window->ClipRect ;
3444+ }
34423445
34433446 // We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries
34443447 ImGuiButtonFlags button_flags = 0 ;
@@ -3498,12 +3501,14 @@ bool IGFD::KeyExplorerFeature::m_FlashableSelectable(const char* label, bool sel
34983501 const ImU32 col = GetColorU32 ((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
34993502 RenderFrame (bb.Min , bb.Max , col, false , 0 .0f );
35003503 }
3501- if (g.NavId == id) RenderNavHighlight (bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding);
3504+ if (g.NavId == id) RenderNavHighlight (bb, id, ImGuiNavHighlightFlags_Compact | ImGuiNavHighlightFlags_NoRounding);
35023505
3503- if (span_all_columns && window->DC .CurrentColumns )
3504- PopColumnsBackground ();
3505- else if (span_all_columns && g.CurrentTable )
3506- TablePopBackgroundChannel ();
3506+ if (span_all_columns) {
3507+ if (g.CurrentTable )
3508+ TablePopBackgroundChannel ();
3509+ else if (window->DC .CurrentColumns )
3510+ PopColumnsBackground ();
3511+ }
35073512
35083513 RenderTextClipped (text_min, text_max, label, NULL , &label_size, style.SelectableTextAlign , &bb);
35093514
0 commit comments