Fix input leakage: use wasReleased for action buttons in Menu and Footnotes

This commit is contained in:
Uri Tauber 2026-01-26 15:28:32 +02:00
parent 2ad75f3ebe
commit 9a8aeee5ae
2 changed files with 4 additions and 4 deletions

View File

@ -16,12 +16,12 @@ void EpubReaderFootnotesActivity::onExit() {
} }
void EpubReaderFootnotesActivity::loop() { void EpubReaderFootnotesActivity::loop() {
if (mappedInput.wasPressed(MappedInputManager::Button::Back)) { if (mappedInput.wasReleased(MappedInputManager::Button::Back)) {
onGoBack(); onGoBack();
return; return;
} }
if (mappedInput.wasPressed(MappedInputManager::Button::Confirm)) { if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
const FootnoteEntry* entry = footnotes.getEntry(selectedIndex); const FootnoteEntry* entry = footnotes.getEntry(selectedIndex);
if (entry) { if (entry) {
Serial.printf("[%lu] [FNS] Selected footnote: %s -> %s\n", millis(), entry->number, entry->href); Serial.printf("[%lu] [FNS] Selected footnote: %s -> %s\n", millis(), entry->number, entry->href);

View File

@ -44,9 +44,9 @@ void EpubReaderMenuActivity::loop() {
const bool nextReleased = const bool nextReleased =
mappedInput.wasReleased(MappedInputManager::Button::Down) || mappedInput.wasReleased(MappedInputManager::Button::Right); mappedInput.wasReleased(MappedInputManager::Button::Down) || mappedInput.wasReleased(MappedInputManager::Button::Right);
if (mappedInput.wasPressed(MappedInputManager::Button::Confirm)) { if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
onSelectOption(static_cast<MenuOption>(selectorIndex)); onSelectOption(static_cast<MenuOption>(selectorIndex));
} else if (mappedInput.wasPressed(MappedInputManager::Button::Back)) { } else if (mappedInput.wasReleased(MappedInputManager::Button::Back)) {
onGoBack(); onGoBack();
} else if (prevReleased) { } else if (prevReleased) {
selectorIndex = (selectorIndex + MENU_ITEMS_COUNT - 1) % MENU_ITEMS_COUNT; selectorIndex = (selectorIndex + MENU_ITEMS_COUNT - 1) % MENU_ITEMS_COUNT;