Skip to content

Commit e1d005d

Browse files
philmozpfeerick
authored andcommitted
fix(color): number edit control does not size properly when width set to a percentage (#6870)
1 parent f73bd88 commit e1d005d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

radio/src/gui/colorlcd/libui/numberedit.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,15 @@ NumberEdit::NumberEdit(Window* parent, const rect_t& rect, int vmin, int vmax,
214214
vmin(vmin),
215215
vmax(vmax)
216216
{
217-
if (rect.w == 0) setWidth(EdgeTxStyles::EDIT_FLD_WIDTH);
217+
if (rect.w == 0 || rect.w == LV_SIZE_CONTENT) setWidth(EdgeTxStyles::EDIT_FLD_WIDTH);
218218

219219
setTextFlag(textFlags);
220220

221-
lv_obj_set_width(label, width() - PAD_MEDIUM * 2 - 2);
221+
padLeft(PAD_MEDIUM);
222+
padRight(PAD_SMALL);
223+
224+
lv_obj_set_width(label, LV_PCT(100));
225+
222226
if (textFlags & CENTERED)
223227
etx_obj_add_style(label, styles->text_align_center, LV_PART_MAIN);
224228
else

0 commit comments

Comments
 (0)