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:
Justin Mitchell
2026-06-15 15:32:22 -04:00
parent a51098725d
commit 7294610894
25 changed files with 275 additions and 14 deletions
+5 -1
View File
@@ -28,14 +28,15 @@
#include "activities/Activity.h"
#include "activities/ActivityManager.h"
#include "activities/settings/SdFirmwareUpdateActivity.h"
#include "components/TouchRegistry.h"
#include "components/UITheme.h"
#include "fontIds.h"
#include "images/LoadingIcon.h"
#include "util/ButtonNavigator.h"
#include "util/ScreenshotUtil.h"
MappedInputManager mappedInputManager(gpio);
GfxRenderer renderer(display);
MappedInputManager mappedInputManager(gpio, renderer);
ActivityManager activityManager(renderer, mappedInputManager);
FontDecompressor fontDecompressor;
SdCardFontSystem sdFontSystem;
@@ -339,6 +340,9 @@ void setup() {
silentRebootTarget = 0;
gpio.begin();
// Enable touch-target registration only on boards with a touch panel (no-op cost
// on the C3). Must come after gpio.begin() so the controller has been probed.
TouchRegistry::getInstance().setEnabled(gpio.hasTouch());
powerManager.begin();
halTiltSensor.begin();
halClock.begin();