Improvements to indicators and button interaction

This commit is contained in:
Kenneth 2026-01-13 13:33:45 -05:00
parent c2d0dce438
commit 5d81d7cac3
3 changed files with 36 additions and 39 deletions

View File

@ -99,19 +99,18 @@ void ScreenComponents::drawScrollIndicator(const GfxRenderer &renderer,
contentTop + 60; // Offset to avoid overlapping side button hints contentTop + 60; // Offset to avoid overlapping side button hints
const int indicatorBottom = contentTop + contentHeight - 30; const int indicatorBottom = contentTop + contentHeight - 30;
// Draw up arrow at top (triangle pointing up - wide at bottom, narrow at top) // Draw up arrow at top (^) - narrow point at top, wide base at bottom
for (int i = 0; i < arrowSize; ++i) { for (int i = 0; i < arrowSize; ++i) {
const int lineWidth = 1 + (arrowSize - 1 - i) * 2; const int lineWidth = 1 + i * 2;
const int startX = centerX - (arrowSize - 1 - i); const int startX = centerX - i;
renderer.drawLine(startX, indicatorTop + i, startX + lineWidth - 1, renderer.drawLine(startX, indicatorTop + i, startX + lineWidth - 1,
indicatorTop + i); indicatorTop + i);
} }
// Draw down arrow at bottom (triangle pointing down - narrow at top, wide at // Draw down arrow at bottom (v) - wide base at top, narrow point at bottom
// bottom)
for (int i = 0; i < arrowSize; ++i) { for (int i = 0; i < arrowSize; ++i) {
const int lineWidth = 1 + i * 2; const int lineWidth = 1 + (arrowSize - 1 - i) * 2;
const int startX = centerX - i; const int startX = centerX - (arrowSize - 1 - i);
renderer.drawLine(startX, indicatorBottom - arrowSize + 1 + i, renderer.drawLine(startX, indicatorBottom - arrowSize + 1 + i,
startX + lineWidth - 1, startX + lineWidth - 1,
indicatorBottom - arrowSize + 1 + i); indicatorBottom - arrowSize + 1 + i);

View File

@ -269,8 +269,7 @@ void MyLibraryActivity::loop() {
return; return;
} }
// Tab switching: Left/Right when selectorIndex == 0 // Tab switching: Left/Right always control tabs
if (selectorIndex == 0) {
if (leftReleased && currentTab == Tab::Files) { if (leftReleased && currentTab == Tab::Files) {
currentTab = Tab::Recent; currentTab = Tab::Recent;
selectorIndex = 0; selectorIndex = 0;
@ -283,11 +282,10 @@ void MyLibraryActivity::loop() {
updateRequired = true; updateRequired = true;
return; return;
} }
}
// Navigation: Up/Down moves through items, Left/Right also work as prev/next // Navigation: Up/Down moves through items only
const bool prevReleased = upReleased || leftReleased; const bool prevReleased = upReleased;
const bool nextReleased = downReleased || rightReleased; const bool nextReleased = downReleased;
if (prevReleased && itemCount > 0) { if (prevReleased && itemCount > 0) {
if (skipPage) { if (skipPage) {

View File

@ -23,7 +23,8 @@ class MyLibraryActivity final : public Activity {
// Recent tab state (from RecentBooksActivity) // Recent tab state (from RecentBooksActivity)
std::vector<std::string> bookTitles; // Display titles for each book std::vector<std::string> bookTitles; // Display titles for each book
std::vector<std::string> bookPaths; // Paths for each visible book (excludes missing) std::vector<std::string>
bookPaths; // Paths for each visible book (excludes missing)
// Files tab state (from FileSelectionActivity) // Files tab state (from FileSelectionActivity)
std::string basepath = "/"; std::string basepath = "/";
@ -51,14 +52,13 @@ class MyLibraryActivity final : public Activity {
void renderFilesTab() const; void renderFilesTab() const;
public: public:
explicit MyLibraryActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, explicit MyLibraryActivity(
GfxRenderer &renderer, MappedInputManager &mappedInput,
const std::function<void()> &onGoHome, const std::function<void()> &onGoHome,
const std::function<void(const std::string &path)> &onSelectBook, const std::function<void(const std::string &path)> &onSelectBook,
Tab initialTab = Tab::Recent) Tab initialTab = Tab::Recent)
: Activity("MyLibrary", renderer, mappedInput), : Activity("MyLibrary", renderer, mappedInput), currentTab(initialTab),
currentTab(initialTab), onGoHome(onGoHome), onSelectBook(onSelectBook) {}
onGoHome(onGoHome),
onSelectBook(onSelectBook) {}
void onEnter() override; void onEnter() override;
void onExit() override; void onExit() override;
void loop() override; void loop() override;