Skip to content

Commit 169d054

Browse files
committed
fix(menu): tighten icon-to-text gap for wrapped portrait menu items
1 parent 885589d commit 169d054

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

main/ui/menu.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,16 @@ static void apply_entry_content_layout(ui_menu_t *menu, int index) {
161161
int32_t natural_label_width =
162162
measure_label_text_width(view->label, UI_MENU_TEXT_MEASURE_MAX) +
163163
UI_MENU_TEXT_WIDTH_PAD;
164-
int32_t label_width = LV_MIN(label_max_width, natural_label_width);
164+
int32_t label_width;
165+
if (natural_label_width <= label_max_width) {
166+
label_width = natural_label_width;
167+
} else {
168+
/* Text wraps: size the label to its widest wrapped line, not the full
169+
max width, so centered multi-line text stays tight against the icon
170+
instead of leaving a gap on the left. */
171+
label_width = measure_label_text_width(view->label, label_max_width) +
172+
UI_MENU_TEXT_WIDTH_PAD;
173+
}
165174
int32_t content_width = label_width;
166175

167176
if (has_icon)

0 commit comments

Comments
 (0)