Fix scrolling wrap-around in settings menu (#249)

## Summary

Fixes a bug in the settings menu, where previously wrap-around only
worked when scrolling upwards. Now, scrolling downwards on the last list
element wraps around to the top as expected.

Resolves #236.
This commit is contained in:
Justin 2026-01-05 03:25:27 -05:00 committed by GitHub
parent 14972b34cb
commit 881aa2e005
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -114,13 +114,11 @@ void SettingsActivity::loop() {
updateRequired = true; updateRequired = true;
} else if (mappedInput.wasPressed(MappedInputManager::Button::Down) || } else if (mappedInput.wasPressed(MappedInputManager::Button::Down) ||
mappedInput.wasPressed(MappedInputManager::Button::Right)) { mappedInput.wasPressed(MappedInputManager::Button::Right)) {
// Move selection down // Move selection down (with wrap around)
if (selectedSettingIndex < settingsCount - 1) { selectedSettingIndex = (selectedSettingIndex < settingsCount - 1) ? (selectedSettingIndex + 1) : 0;
selectedSettingIndex++;
updateRequired = true; updateRequired = true;
} }
} }
}
void SettingsActivity::toggleCurrentSetting() { void SettingsActivity::toggleCurrentSetting() {
// Validate index // Validate index