mirror of
https://github.com/ocornut/imgui.git
synced 2025-02-02 12:37:20 +01:00
Selectable: Fixed horizontal label alignment when combined with using ImGuiSelectableFlags_SpanAllColumns. (#8338)
This commit is contained in:
parent
bbf957875b
commit
ed7551c1d4
@ -139,6 +139,8 @@ Other changes:
|
|||||||
the label (not only the highlight/frame) also spans all columns. This is
|
the label (not only the highlight/frame) also spans all columns. This is
|
||||||
useful for table rows where you know nothing else is submitted. (#8318, #3565)
|
useful for table rows where you know nothing else is submitted. (#8318, #3565)
|
||||||
Obviously best used with ImGuiTableFlags_NoBordersInBodyUntilResize.
|
Obviously best used with ImGuiTableFlags_NoBordersInBodyUntilResize.
|
||||||
|
- Selectable: Fixed horizontal label alignment when combined with using
|
||||||
|
ImGuiSelectableFlags_SpanAllColumns. (#8338)
|
||||||
- Drags: Added ImGuiSliderFlags_NoSpeedTweaks flag to disable keyboard
|
- Drags: Added ImGuiSliderFlags_NoSpeedTweaks flag to disable keyboard
|
||||||
modifiers altering the tweak speed. Useful if you want to alter tweak speed
|
modifiers altering the tweak speed. Useful if you want to alter tweak speed
|
||||||
yourself based on your own logic. (#8223)
|
yourself based on your own logic. (#8223)
|
||||||
|
@ -6943,13 +6943,9 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|||||||
if (size_arg.x == 0.0f || (flags & ImGuiSelectableFlags_SpanAvailWidth))
|
if (size_arg.x == 0.0f || (flags & ImGuiSelectableFlags_SpanAvailWidth))
|
||||||
size.x = ImMax(label_size.x, max_x - min_x);
|
size.x = ImMax(label_size.x, max_x - min_x);
|
||||||
|
|
||||||
// Text stays at the submission position, but bounding box may be extended on both sides
|
|
||||||
const ImVec2 text_min = pos;
|
|
||||||
const ImVec2 text_max(min_x + size.x, pos.y + size.y);
|
|
||||||
|
|
||||||
// Selectables are meant to be tightly packed together with no click-gap, so we extend their box to cover spacing between selectable.
|
// Selectables are meant to be tightly packed together with no click-gap, so we extend their box to cover spacing between selectable.
|
||||||
// FIXME: Not part of layout so not included in clipper calculation, but ItemSize currently doesn't allow offsetting CursorPos.
|
// FIXME: Not part of layout so not included in clipper calculation, but ItemSize currently doesn't allow offsetting CursorPos.
|
||||||
ImRect bb(min_x, pos.y, text_max.x, text_max.y);
|
ImRect bb(min_x, pos.y, min_x + size.x, pos.y + size.y);
|
||||||
if ((flags & ImGuiSelectableFlags_NoPadWithHalfSpacing) == 0)
|
if ((flags & ImGuiSelectableFlags_NoPadWithHalfSpacing) == 0)
|
||||||
{
|
{
|
||||||
const float spacing_x = span_all_columns ? 0.0f : style.ItemSpacing.x;
|
const float spacing_x = span_all_columns ? 0.0f : style.ItemSpacing.x;
|
||||||
@ -7085,8 +7081,9 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|||||||
PopColumnsBackground();
|
PopColumnsBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Text stays at the submission position. Alignment/clipping extents ignore SpanAllColumns.
|
||||||
if (is_visible)
|
if (is_visible)
|
||||||
RenderTextClipped(text_min, text_max, label, NULL, &label_size, style.SelectableTextAlign, &bb);
|
RenderTextClipped(pos, ImVec2(window->WorkRect.Max.x, pos.y + size.y), label, NULL, &label_size, style.SelectableTextAlign, &bb);
|
||||||
|
|
||||||
// Automatically close popups
|
// Automatically close popups
|
||||||
if (pressed && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_NoAutoClosePopups) && (g.LastItemData.ItemFlags & ImGuiItemFlags_AutoClosePopups))
|
if (pressed && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_NoAutoClosePopups) && (g.LastItemData.ItemFlags & ImGuiItemFlags_AutoClosePopups))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user