summaryrefslogtreecommitdiff
path: root/source/ui/ListDelegate.mc
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-25 13:13:39 +0100
committercirakg <cirakg@cirakg.xyz>2026-10-25 13:13:39 +0100
commit404b505a41362f340e79374ee3ad4dbd468da3e4 (patch)
tree883d4f1ecda6c30ce890b1aa4026c8ba1726804e /source/ui/ListDelegate.mc
parent096b5a4d17c85fa5f87db3e72364e9c3506d1e64 (diff)
fix(ui): vertical swipes and drags scroll the list and text screens
The Forerunner 70 sends no page behaviour for a swipe on a custom view, so the list and info screens only scrolled with the buttons. Swipes and drags now scroll them directly; one gesture scrolls once even when the device also sends the page behaviour, and a drag's release opens no row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'source/ui/ListDelegate.mc')
-rw-r--r--source/ui/ListDelegate.mc38
1 files changed, 35 insertions, 3 deletions
diff --git a/source/ui/ListDelegate.mc b/source/ui/ListDelegate.mc
index a7c8bf0..ca7cee9 100644
--- a/source/ui/ListDelegate.mc
+++ b/source/ui/ListDelegate.mc
@@ -14,14 +14,43 @@ class ListDelegate extends WatchUi.BehaviorDelegate {
}
function onNextPage() as Boolean {
- AppState.activity();
- _view.move(1);
+ if (!Gesture.recent()) {
+ AppState.activity();
+ _view.move(1);
+ }
return true;
}
function onPreviousPage() as Boolean {
+ if (!Gesture.recent()) {
+ AppState.activity();
+ _view.move(-1);
+ }
+ return true;
+ }
+
+ // The Forerunner 70 sends no page behaviour for a vertical swipe, so the
+ // swipe and the drag scroll here; Gesture makes a gesture count once.
+ function onSwipe(event as WatchUi.SwipeEvent) as Boolean {
+ if (!Gesture.isVertical(event)) {
+ return BehaviorDelegate.onSwipe(event);
+ }
+ var step = Gesture.swipeStep(event);
+ if (step != 0) {
+ AppState.activity();
+ _view.move(step);
+ }
+ return true;
+ }
+
+ // A drag scrolls by the rows it covered, at least one.
+ function onDrag(event as WatchUi.DragEvent) as Boolean {
+ var step = Gesture.dragStep(event, _view.rowHeight());
+ if (step == 0) {
+ return false;
+ }
AppState.activity();
- _view.move(-1);
+ _view.move(step);
return true;
}
@@ -55,6 +84,9 @@ class ListDelegate extends WatchUi.BehaviorDelegate {
// A tap opens the row under the finger.
function onTap(event as WatchUi.ClickEvent) as Boolean {
AppState.activity();
+ if (Gesture.tapIgnored()) {
+ return true;
+ }
var index = _view.rowAt(event.getCoordinates()[1]);
if (index < 0) {
return true;