chore(color): fix minor issues when moving controls to select a source (#7782)

Co-authored-by: 3djc <3djc@gh.com>
Co-authored-by: philmoz <phil.a.mitchell@gmail.com>
This commit is contained in:
philmoz
2026-09-13 13:44:42 +10:00
committed by GitHub
co-authored by 3djc philmoz
parent 9bab4ec0cf
commit 710e92d0b5
4 changed files with 9 additions and 9 deletions
@@ -181,7 +181,7 @@ void SourceChoice::openMenu()
#if defined(AUTOSOURCE) #if defined(AUTOSOURCE)
menu->setWaitHandler([=]() { menu->setWaitHandler([=]() {
int16_t val = getMovedSource(vmin); int16_t val = getMovedSource(vmin);
if (val) { if (val && (!isValueAvailable || isValueAvailable(val))) {
tb->resetFilter(); tb->resetFilter();
menu->select(getIndexFromValue(val)); menu->select(getIndexFromValue(val));
} }
@@ -190,7 +190,7 @@ void SourceChoice::openMenu()
swsrc_t swtch = abs(getMovedSwitch()); swsrc_t swtch = abs(getMovedSwitch());
if (swtch && !IS_SWITCH_MULTIPOS(swtch)) { if (swtch && !IS_SWITCH_MULTIPOS(swtch)) {
val = switchToMix(swtch); val = switchToMix(swtch);
if (val && (val >= vmin) && (val <= vmax)) { if (val && (val >= vmin) && (val <= vmax) && (!isValueAvailable || isValueAvailable(val))) {
tb->resetFilter(); tb->resetFilter();
menu->select(getIndexFromValue(val)); menu->select(getIndexFromValue(val));
} }
+1 -1
View File
@@ -202,7 +202,7 @@ class MenuBody : public TableField
void onDrawBegin(uint16_t row, uint16_t col, void onDrawBegin(uint16_t row, uint16_t col,
lv_obj_draw_part_dsc_t* dsc) override lv_obj_draw_part_dsc_t* dsc) override
{ {
if (lines.size() == 0) return; if (row >= lines.size()) return;
lv_canvas_t* icon = (lv_canvas_t*)lines[row]->getIcon(); lv_canvas_t* icon = (lv_canvas_t*)lines[row]->getIcon();
if (!icon) return; if (!icon) return;
+3 -5
View File
@@ -93,11 +93,9 @@ MenuToolbar::~MenuToolbar() { lv_group_del(group); }
void MenuToolbar::resetFilter() void MenuToolbar::resetFilter()
{ {
if (lv_group_get_focused(group) != lvobj) { // Nothing to do if no filter is active
lv_group_focus_obj(lvobj); if (allBtn && !allBtn->checked())
choice->fillMenu(menu); lv_event_send(allBtn->getLvObj(), LV_EVENT_CLICKED, nullptr);
menu->setTitle(choice->getTitle());
}
} }
void MenuToolbar::nextFilter() void MenuToolbar::nextFilter()
+3 -1
View File
@@ -197,7 +197,7 @@ void TableField::setColumnWidth(uint16_t col, coord_t w)
void TableField::select(uint16_t row, uint16_t col, bool force) void TableField::select(uint16_t row, uint16_t col, bool force)
{ {
lv_table_t* table = (lv_table_t*)lvobj; lv_table_t* table = (lv_table_t*)lvobj;
if (!force && table->row_act == row && table->col_act == row) return; if (!force && table->row_act == row && table->col_act == col) return;
if (row >= table->row_cnt || col >= table->col_cnt) { if (row >= table->row_cnt || col >= table->col_cnt) {
table->col_act = LV_TABLE_CELL_NONE; table->col_act = LV_TABLE_CELL_NONE;
@@ -215,6 +215,8 @@ void TableField::adjustScroll()
{ {
lv_table_t* table = (lv_table_t*)lvobj; lv_table_t* table = (lv_table_t*)lvobj;
if (table->row_act >= table->row_cnt) return;
// only vertical scroll for now // only vertical scroll for now
lv_coord_t h_before = 0; lv_coord_t h_before = 0;
for (uint16_t i = 0; i < table->row_act; i++) h_before += table->row_h[i]; for (uint16_t i = 0; i < table->row_act; i++) h_before += table->row_h[i];