Eliminate unneeded screen flashing when scrolling menu (#1900)

This commit is contained in:
Mark Thompson 2024-02-15 07:59:30 -06:00 committed by GitHub
parent 8b5adb6bc1
commit a442971b81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -173,13 +173,15 @@ bool BtnGridView::set_highlighted(int32_t new_value) {
highlighted_item = new_value; highlighted_item = new_value;
offset += rows_; offset += rows_;
update_items(); update_items();
set_dirty(); // refresh whole screen (display flickers) only if scrolling last row up and a blank button is needed at the bottom
if ((new_value + rows_ > item_count) && (item_count % rows_) != 0)
set_dirty();
} else if ((uint32_t)new_value < offset) { } else if ((uint32_t)new_value < offset) {
// Shift BtnGridView down // Shift BtnGridView down
highlighted_item = new_value; highlighted_item = new_value;
offset = (new_value / rows_) * rows_; offset = (new_value / rows_) * rows_;
update_items(); update_items();
set_dirty(); // no need to set_dirty() here since all buttons have been repainted
} else { } else {
// Just update highlight // Just update highlight
highlighted_item = new_value; highlighted_item = new_value;