diff options
| author | Kit La Touche <kit@transneptune.net> | 2024-11-04 22:31:27 -0500 |
|---|---|---|
| committer | Kit La Touche <kit@transneptune.net> | 2024-11-04 22:31:27 -0500 |
| commit | 1614fea76a6fc1f4d70ddb14b95e3004c79365ef (patch) | |
| tree | 68dbd755d8558e7feff876f07d76a2dd7a2df8d6 /ui/routes | |
| parent | 2544de46eed6fd9493eff6e2d41a8aa5d169bf51 (diff) | |
Set up framework for testing touch events
This includes a change to tools/run that exposes the dev server on my
local network. This change should not make it into the final form of
this branch.
This is so I can use actual for real touch events on my actual for real
phone, hooked up for remote debugging to my computer so I can see
console events etc.
Diffstat (limited to 'ui/routes')
| -rw-r--r-- | ui/routes/(app)/+layout.svelte | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ui/routes/(app)/+layout.svelte b/ui/routes/(app)/+layout.svelte index ae3dc6a..acaea53 100644 --- a/ui/routes/(app)/+layout.svelte +++ b/ui/routes/(app)/+layout.svelte @@ -25,6 +25,40 @@ messages.update((value) => value.setMessages(boot.messages)); } + function setTouchEvents() { + document.addEventListener("touchstart", processTouchStart); + document.addEventListener("touchmove", processTouchMove); + document.addEventListener("touchcancel", processTouchCancel); + document.addEventListener("touchend", processTouchEnd); + } + + function processTouchStart(ev) { + ev.preventDefault(); + switch (ev.touches.length) { + case 1: + console.log("touch: single"); + break; + case 2: + console.log("touch: double"); + break; + case 3: + console.log("touch: triple"); + break; + default: + console.log("touch: unsupported"); + break; + } + } + + function processTouchMove(ev) { + } + + function processTouchCancel(ev) { + } + + function processTouchEnd(ev) { + } + onMount(async () => { let response = await boot(); switch (response.status) { @@ -45,6 +79,7 @@ break; } loading = false; + setTouchEvents(); }); onDestroy(async () => { |
