Add touch-to-logical coordinate mapping for UI
Implements tapToLogical() to convert normalized touch coordinates to orientation-aware logical screen coordinates. Adds TouchRegistry hit testing for interactive UI elements and header back button. Touch gestures now work correctly across all screen orientations (Portrait, Landscape, etc.) by inverting the rotateCoordinates transform.
This commit is contained in:
@@ -179,7 +179,17 @@ void HomeActivity::loop() {
|
||||
requestUpdate();
|
||||
});
|
||||
|
||||
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
|
||||
// A tap on a menu button selects + activates it. The button menu registers
|
||||
// menu-local ids (it is drawn with selectorIndex offset by recentBooks.size()),
|
||||
// so map the tapped id back into the global selector space. (The recent-book
|
||||
// cover is a separate, single-item draw path — tappable in a later phase.)
|
||||
int tappedId = -1;
|
||||
const bool tapped = mappedInput.wasItemTapped(tappedId);
|
||||
if (tapped) {
|
||||
selectorIndex = static_cast<int>(recentBooks.size()) + tappedId;
|
||||
}
|
||||
|
||||
if (tapped || mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
|
||||
if (selectorIndex < recentBooks.size()) {
|
||||
onSelectBook(recentBooks[selectorIndex].path);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user