feat(display): draw hint animation at touch position instead of center
This commit is contained in:
@@ -28,18 +28,32 @@ void loop() {
|
||||
|
||||
// ── Touch handling ──
|
||||
const ScreenState& st = logic.getScreenState();
|
||||
static int holdStartX = -1;
|
||||
static int holdStartY = -1;
|
||||
|
||||
if (st.deviceState == DeviceState::ALERTING) {
|
||||
HoldState h = display.updateHold(HOLD_TO_SILENCE_MS);
|
||||
if (h.completed) {
|
||||
logic.silenceAlert();
|
||||
holdStartX = -1;
|
||||
holdStartY = -1;
|
||||
}
|
||||
if (!h.active) {
|
||||
display.updateHint();
|
||||
if (h.started) {
|
||||
TouchEvent t = display.readTouch();
|
||||
holdStartX = t.x;
|
||||
holdStartY = t.y;
|
||||
}
|
||||
if (!h.active && holdStartX >= 0) {
|
||||
display.updateHint(holdStartX, holdStartY);
|
||||
}
|
||||
} else {
|
||||
holdStartX = -1;
|
||||
holdStartY = -1;
|
||||
}
|
||||
|
||||
if (st.screen == ScreenID::DASHBOARD) {
|
||||
TouchEvent evt = display.readTouch();
|
||||
if (evt.pressed && st.screen == ScreenID::DASHBOARD) {
|
||||
if (evt.pressed) {
|
||||
int tile = display.dashboardTouch(evt.x, evt.y);
|
||||
if (tile >= 0) Serial.printf("[DASH] Tile %d tapped\n", tile);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user