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:
Justin Mitchell
2026-06-15 15:47:33 -04:00
parent 7294610894
commit 9176e76f5a
9 changed files with 92 additions and 3 deletions
+11
View File
@@ -419,10 +419,16 @@ void BaseTheme::drawTabBar(const GfxRenderer& renderer, const Rect rect, const s
int currentX = rect.x + BaseMetrics::values.contentSidePadding;
int tabIndex = 0;
for (const auto& tab : tabs) {
const int textWidth =
renderer.getTextWidth(UI_12_FONT_ID, tab.label, tab.selected ? EpdFontFamily::BOLD : EpdFontFamily::REGULAR);
// Tap target spans the label plus the inter-tab gap, full bar height.
TouchRegistry::getInstance().add(
Rect{currentX - 3, rect.y, textWidth + BaseMetrics::values.tabSpacing, rect.height}, tabIndex++,
TouchRegistry::Tab);
// Draw underline for selected tab
if (tab.selected) {
if (selected) {
@@ -495,6 +501,11 @@ void BaseTheme::drawRecentBookCover(GfxRenderer& renderer, Rect rect, const std:
const int bookY = rect.y;
const int bookHeight = baseHeight;
// Tapping the continue-reading cover opens recentBooks[0] (home selector 0).
if (hasContinueReading) {
TouchRegistry::getInstance().add(Rect{bookX, bookY, bookWidth, bookHeight}, 0, TouchRegistry::Cover);
}
// Bookmark dimensions (used in multiple places)
const int bookmarkWidth = bookWidth / 8;
const int bookmarkHeight = bookHeight / 5;