Skip to content

Commit

Permalink
Selectable: Fixed horizontal label alignment with SelectableTextAlign…
Browse files Browse the repository at this point in the history
….x > 0 and specifying a selectable size. (ocornut#8338)

Regression from ed7551c
  • Loading branch information
ocornut committed Feb 14, 2025
1 parent 474305c commit 2860d7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ Breaking changes:
Note that it was also added to ImGui_ImplVulkan_InitInfo but for the later it is optional.
(#8326, #8365, #8400)


Other changes:

- Fixed IsItemDeactivatedAfterEdit() signal being broken for Checkbox(),
Expand All @@ -71,6 +70,8 @@ Other changes:
- Tables: tamed some .ini settings optimizations to more accurately allow
overwriting/hot-reloading settings in more situations. (#7934)
- Tables, Error Handling: Recovery from invalid index in TableSetColumnIndex(). (#1651)
- Selectable: Fixed horizontal label alignment with SelectableTextAlign.x > 0 and
specifying a selectable size. (#8338)
- Styles, Tabs: made the Close Button of selected tabs always visible by default,
without requiring to hover the tab. (#8387)
- Added style.TabCloseButtonMinWidthSelected/TabCloseButtonMinWidthUnselected settings
Expand Down
2 changes: 1 addition & 1 deletion imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7101,7 +7101,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl

// Text stays at the submission position. Alignment/clipping extents ignore SpanAllColumns.
if (is_visible)
RenderTextClipped(pos, ImVec2(window->WorkRect.Max.x, pos.y + size.y), label, NULL, &label_size, style.SelectableTextAlign, &bb);
RenderTextClipped(pos, ImVec2(ImMin(pos.x + size.x, window->WorkRect.Max.x), pos.y + size.y), label, NULL, &label_size, style.SelectableTextAlign, &bb);

// Automatically close popups
if (pressed && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_NoAutoClosePopups) && (g.LastItemData.ItemFlags & ImGuiItemFlags_AutoClosePopups))
Expand Down

0 comments on commit 2860d7b

Please sign in to comment.