Support left and right buttons in reader and file picker

This commit is contained in:
Dave Allie 2025-12-04 00:11:16 +11:00
parent aee239a931
commit 47eb1157ef
No known key found for this signature in database
GPG Key ID: F2FDDB3AD8D0276F
2 changed files with 7 additions and 7 deletions

View File

@ -48,7 +48,7 @@ void EpubReaderScreen::onExit() {
} }
void EpubReaderScreen::handleInput(const Input input) { void EpubReaderScreen::handleInput(const Input input) {
if (input.button == VOLUME_UP || input.button == VOLUME_DOWN) { if (input.button == VOLUME_UP || input.button == VOLUME_DOWN || input.button == LEFT || input.button == RIGHT) {
const bool skipChapter = input.pressTime > SKIP_CHAPTER_MS; const bool skipChapter = input.pressTime > SKIP_CHAPTER_MS;
// No current section, attempt to rerender the book // No current section, attempt to rerender the book
@ -57,17 +57,17 @@ void EpubReaderScreen::handleInput(const Input input) {
return; return;
} }
if (input.button == VOLUME_UP && skipChapter) { if ((input.button == VOLUME_UP || input.button == LEFT) && skipChapter) {
nextPageNumber = 0; nextPageNumber = 0;
currentSpineIndex--; currentSpineIndex--;
delete section; delete section;
section = nullptr; section = nullptr;
} else if (input.button == VOLUME_DOWN && skipChapter) { } else if ((input.button == VOLUME_DOWN || input.button == RIGHT) && skipChapter) {
nextPageNumber = 0; nextPageNumber = 0;
currentSpineIndex++; currentSpineIndex++;
delete section; delete section;
section = nullptr; section = nullptr;
} else if (input.button == VOLUME_UP) { } else if (input.button == VOLUME_UP || input.button == LEFT) {
if (section->currentPage > 0) { if (section->currentPage > 0) {
section->currentPage--; section->currentPage--;
} else { } else {
@ -78,7 +78,7 @@ void EpubReaderScreen::handleInput(const Input input) {
section = nullptr; section = nullptr;
xSemaphoreGive(sectionMutex); xSemaphoreGive(sectionMutex);
} }
} else if (input.button == VOLUME_DOWN) { } else if (input.button == VOLUME_DOWN || input.button == RIGHT) {
if (section->currentPage < section->pageCount - 1) { if (section->currentPage < section->pageCount - 1) {
section->currentPage++; section->currentPage++;
} else { } else {

View File

@ -46,10 +46,10 @@ void FileSelectionScreen::onExit() {
} }
void FileSelectionScreen::handleInput(const Input input) { void FileSelectionScreen::handleInput(const Input input) {
if (input.button == VOLUME_DOWN) { if (input.button == VOLUME_DOWN || input.button == RIGHT) {
selectorIndex = (selectorIndex + 1) % files.size(); selectorIndex = (selectorIndex + 1) % files.size();
updateRequired = true; updateRequired = true;
} else if (input.button == VOLUME_UP) { } else if (input.button == VOLUME_UP || input.button == LEFT) {
selectorIndex = (selectorIndex + files.size() - 1) % files.size(); selectorIndex = (selectorIndex + files.size() - 1) % files.size();
updateRequired = true; updateRequired = true;
} else if (input.button == CONFIRM) { } else if (input.button == CONFIRM) {