|
@@ -11221,28 +11221,28 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|
|
ImVec2 size(size_arg.x != 0.0f ? size_arg.x : label_size.x, size_arg.y != 0.0f ? size_arg.y : label_size.y);
|
|
|
ImVec2 pos = window->DC.CursorPos;
|
|
|
pos.y += window->DC.CurrentLineTextBaseOffset;
|
|
|
- ImRect bb(pos, pos + size);
|
|
|
- ItemSize(bb);
|
|
|
+ ImRect bb_inner(pos, pos + size);
|
|
|
+ ItemSize(bb_inner);
|
|
|
|
|
|
// Fill horizontal space.
|
|
|
ImVec2 window_padding = window->WindowPadding;
|
|
|
float max_x = (flags & ImGuiSelectableFlags_SpanAllColumns) ? GetWindowContentRegionMax().x : GetContentRegionMax().x;
|
|
|
float w_draw = ImMax(label_size.x, window->Pos.x + max_x - window_padding.x - window->DC.CursorPos.x);
|
|
|
ImVec2 size_draw((size_arg.x != 0 && !(flags & ImGuiSelectableFlags_DrawFillAvailWidth)) ? size_arg.x : w_draw, size_arg.y != 0.0f ? size_arg.y : size.y);
|
|
|
- ImRect bb_with_spacing(pos, pos + size_draw);
|
|
|
+ ImRect bb(pos, pos + size_draw);
|
|
|
if (size_arg.x == 0.0f || (flags & ImGuiSelectableFlags_DrawFillAvailWidth))
|
|
|
- bb_with_spacing.Max.x += window_padding.x;
|
|
|
+ bb.Max.x += window_padding.x;
|
|
|
|
|
|
// Selectables are tightly packed together, we extend the box to cover spacing between selectable.
|
|
|
float spacing_L = (float)(int)(style.ItemSpacing.x * 0.5f);
|
|
|
float spacing_U = (float)(int)(style.ItemSpacing.y * 0.5f);
|
|
|
float spacing_R = style.ItemSpacing.x - spacing_L;
|
|
|
float spacing_D = style.ItemSpacing.y - spacing_U;
|
|
|
- bb_with_spacing.Min.x -= spacing_L;
|
|
|
- bb_with_spacing.Min.y -= spacing_U;
|
|
|
- bb_with_spacing.Max.x += spacing_R;
|
|
|
- bb_with_spacing.Max.y += spacing_D;
|
|
|
- if (!ItemAdd(bb_with_spacing, (flags & ImGuiSelectableFlags_Disabled) ? 0 : id))
|
|
|
+ bb.Min.x -= spacing_L;
|
|
|
+ bb.Min.y -= spacing_U;
|
|
|
+ bb.Max.x += spacing_R;
|
|
|
+ bb.Max.y += spacing_D;
|
|
|
+ if (!ItemAdd(bb, (flags & ImGuiSelectableFlags_Disabled) ? 0 : id))
|
|
|
{
|
|
|
if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsSet)
|
|
|
PushColumnClipRect();
|
|
@@ -11257,7 +11257,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|
|
if (flags & ImGuiSelectableFlags_Disabled) button_flags |= ImGuiButtonFlags_Disabled;
|
|
|
if (flags & ImGuiSelectableFlags_AllowDoubleClick) button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick;
|
|
|
bool hovered, held;
|
|
|
- bool pressed = ButtonBehavior(bb_with_spacing, id, &hovered, &held, button_flags);
|
|
|
+ bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags);
|
|
|
if (flags & ImGuiSelectableFlags_Disabled)
|
|
|
selected = false;
|
|
|
|
|
@@ -11273,18 +11273,18 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|
|
if (hovered || selected)
|
|
|
{
|
|
|
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
|
|
|
- RenderFrame(bb_with_spacing.Min, bb_with_spacing.Max, col, false, 0.0f);
|
|
|
- RenderNavHighlight(bb_with_spacing, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding);
|
|
|
+ RenderFrame(bb.Min, bb.Max, col, false, 0.0f);
|
|
|
+ RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding);
|
|
|
}
|
|
|
|
|
|
if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsSet)
|
|
|
{
|
|
|
PushColumnClipRect();
|
|
|
- bb_with_spacing.Max.x -= (GetContentRegionMax().x - max_x);
|
|
|
+ bb.Max.x -= (GetContentRegionMax().x - max_x);
|
|
|
}
|
|
|
|
|
|
if (flags & ImGuiSelectableFlags_Disabled) PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);
|
|
|
- RenderTextClipped(bb.Min, bb_with_spacing.Max, label, NULL, &label_size, ImVec2(0.0f,0.0f));
|
|
|
+ RenderTextClipped(bb_inner.Min, bb.Max, label, NULL, &label_size, ImVec2(0.0f,0.0f));
|
|
|
if (flags & ImGuiSelectableFlags_Disabled) PopStyleColor();
|
|
|
|
|
|
// Automatically close popups
|