mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-15 03:47:42 +00:00
WFM bandwidth widget dial direction (clockwise==increasing) & OptionsField widget change (circular list) (#1109)
* Put WFM bandwidth options in ascending order * Put WFM bandwidth options in ascending order * Put WFM bandwidth options in ascending order * Put WFM bandwidth options in ascending order * Put WFM bandwidth options in ascending order * Clang formatting attempt * OptionsField wrapping - for your consideration Perhaps if OptionsWidget supported wrapping, then it would be easier to dial through all available options without having to know which direction to turn the dial.
This commit is contained in:
@@ -1477,7 +1477,13 @@ void OptionsField::on_focus() {
|
||||
}
|
||||
|
||||
bool OptionsField::on_encoder(const EncoderEvent delta) {
|
||||
set_selected_index(selected_index() + delta);
|
||||
int32_t new_value = selected_index() + delta;
|
||||
if (new_value < 0)
|
||||
new_value = options.size() - 1;
|
||||
else if ((size_t)new_value >= options.size())
|
||||
new_value = 0;
|
||||
|
||||
set_selected_index(new_value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user