feat: swipe to score/undo, tap to set server / new match

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-04 11:24:29 +02:00
parent 8dab8183d7
commit ae101d1b88
2 changed files with 26 additions and 22 deletions

View File

@@ -3,13 +3,36 @@ import Toybox.WatchUi;
class garmin_padelDelegate extends WatchUi.BehaviorDelegate { class garmin_padelDelegate extends WatchUi.BehaviorDelegate {
function initialize() { public function initialize() {
BehaviorDelegate.initialize(); BehaviorDelegate.initialize();
} }
function onMenu() as Boolean { public function onSwipe(swipeEvent as WatchUi.SwipeEvent) as Boolean {
WatchUi.pushView(new Rez.Menus.MainMenu(), new garmin_padelMenuDelegate(), WatchUi.SLIDE_UP); var m = getApp().getMatch();
var dir = swipeEvent.getDirection();
if (dir == WatchUi.SWIPE_UP) {
m.pointTo(US);
} else if (dir == WatchUi.SWIPE_DOWN) {
m.pointTo(THEM);
} else if (dir == WatchUi.SWIPE_LEFT) {
m.undo();
} else {
return false;
}
WatchUi.requestUpdate();
return true; return true;
} }
public function onTap(clickEvent as WatchUi.ClickEvent) as Boolean {
var m = getApp().getMatch();
if (m.isMatchOver()) {
getApp().resetMatch();
} else if (m.canSetServer()) {
m.toggleStartingServer();
} else {
return false;
}
WatchUi.requestUpdate();
return true;
}
} }

View File

@@ -1,19 +0,0 @@
import Toybox.Lang;
import Toybox.System;
import Toybox.WatchUi;
class garmin_padelMenuDelegate extends WatchUi.MenuInputDelegate {
function initialize() {
MenuInputDelegate.initialize();
}
function onMenuItem(item as Symbol) as Void {
if (item == :item_1) {
System.println("item 1");
} else if (item == :item_2) {
System.println("item 2");
}
}
}