mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 22:57:50 +03:00
refactor: Simplify reader menu activity handling by removing suppression logic
This commit is contained in:
parent
606b20d9d0
commit
78e9c7c733
@ -136,19 +136,7 @@ void EpubReaderActivity::loop() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enter reader menu activity (suppressed after slider confirm/cancel).
|
// Enter reader menu activity.
|
||||||
if (suppressMenuOpenOnce) {
|
|
||||||
// If we're seeing the confirm release that closed the slider, consume it and return.
|
|
||||||
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
|
|
||||||
suppressMenuOpenOnce = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// If confirm is no longer pressed and no release is pending, clear suppression.
|
|
||||||
if (!mappedInput.isPressed(MappedInputManager::Button::Confirm)) {
|
|
||||||
suppressMenuOpenOnce = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
|
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
|
||||||
// Don't start activity transition while rendering
|
// Don't start activity transition while rendering
|
||||||
xSemaphoreTake(renderingMutex, portMAX_DELAY);
|
xSemaphoreTake(renderingMutex, portMAX_DELAY);
|
||||||
@ -382,13 +370,11 @@ void EpubReaderActivity::onReaderMenuConfirm(EpubReaderMenuActivity::MenuAction
|
|||||||
[this](const int percent) {
|
[this](const int percent) {
|
||||||
// Apply the new position and exit back to the reader.
|
// Apply the new position and exit back to the reader.
|
||||||
jumpToPercent(percent);
|
jumpToPercent(percent);
|
||||||
suppressMenuOpenOnce = true;
|
|
||||||
exitActivity();
|
exitActivity();
|
||||||
updateRequired = true;
|
updateRequired = true;
|
||||||
},
|
},
|
||||||
[this]() {
|
[this]() {
|
||||||
// Cancel selection and return to the reader.
|
// Cancel selection and return to the reader.
|
||||||
suppressMenuOpenOnce = true;
|
|
||||||
exitActivity();
|
exitActivity();
|
||||||
updateRequired = true;
|
updateRequired = true;
|
||||||
}));
|
}));
|
||||||
|
|||||||
@ -23,8 +23,6 @@ class EpubReaderActivity final : public ActivityWithSubactivity {
|
|||||||
bool pendingPercentJump = false;
|
bool pendingPercentJump = false;
|
||||||
// Normalized 0.0-1.0 progress within the target spine item, computed from book percentage.
|
// Normalized 0.0-1.0 progress within the target spine item, computed from book percentage.
|
||||||
float pendingSpineProgress = 0.0f;
|
float pendingSpineProgress = 0.0f;
|
||||||
// Prevents the reader menu from reopening due to the confirm button used to exit the slider.
|
|
||||||
bool suppressMenuOpenOnce = false;
|
|
||||||
bool updateRequired = false;
|
bool updateRequired = false;
|
||||||
const std::function<void()> onGoBack;
|
const std::function<void()> onGoBack;
|
||||||
const std::function<void()> onGoHome;
|
const std::function<void()> onGoHome;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user