mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-18 15:17:42 +03:00
Support left and right buttons in reader and file picker
This commit is contained in:
parent
aee239a931
commit
47eb1157ef
@ -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 {
|
||||||
|
|||||||
@ -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) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user