Add Tab and Cover touch kinds to TouchRegistry
Extends the Kind enum with two new touch interaction types: Tab (2) and Cover (3), enabling support for additional UI element touch handling.
This commit is contained in:
@@ -183,9 +183,14 @@ void LyraTheme::drawTabBar(const GfxRenderer& renderer, Rect rect, const std::ve
|
||||
renderer.fillRectDither(rect.x, rect.y, rect.width, rect.height, Color::LightGray);
|
||||
}
|
||||
|
||||
int tabIndex = 0;
|
||||
for (const auto& tab : tabs) {
|
||||
const int textWidth = renderer.getTextWidth(UI_10_FONT_ID, tab.label, EpdFontFamily::REGULAR);
|
||||
|
||||
TouchRegistry::getInstance().add(
|
||||
Rect{currentX, rect.y, textWidth + 2 * hPaddingInSelection + LyraMetrics::values.tabSpacing, rect.height},
|
||||
tabIndex++, TouchRegistry::Tab);
|
||||
|
||||
if (tab.selected) {
|
||||
if (selected) {
|
||||
renderer.fillRoundedRect(currentX, rect.y + 1, textWidth + 2 * hPaddingInSelection, rect.height - 4,
|
||||
@@ -419,6 +424,14 @@ void LyraTheme::drawRecentBookCover(GfxRenderer& renderer, Rect rect, const std:
|
||||
coverWidth = LyraMetrics::values.homeCoverHeight * 0.6;
|
||||
}
|
||||
|
||||
// Tapping the continue-reading cover opens recentBooks[0] (home selector 0).
|
||||
if (hasContinueReading) {
|
||||
TouchRegistry::getInstance().add(
|
||||
Rect{LyraMetrics::values.contentSidePadding, tileY, coverWidth + 2 * hPaddingInSelection,
|
||||
LyraMetrics::values.homeCoverHeight + 2 * hPaddingInSelection},
|
||||
0, TouchRegistry::Cover);
|
||||
}
|
||||
|
||||
// Draw book card regardless, fill with message based on `hasContinueReading`
|
||||
// Draw cover image as background if available (inside the box)
|
||||
// Only load from SD on first render, then use stored buffer
|
||||
|
||||
Reference in New Issue
Block a user