tiny-pilot / tinypilot

Use your Raspberry Pi as a browser-based KVM.
https://tinypilotkvm.com
MIT License
2.89k stars 244 forks source link

POC for rudimentary touch event support #1779

Closed jotaen4tinypilot closed 2 months ago

jotaen4tinypilot commented 2 months ago

Related https://github.com/tiny-pilot/tinypilot/issues/270.

This PR demonstrates an approach for how we could introduce/improve support for touch events. There is some complexity to this task, however, so I wanted to discuss my findings and how to proceed.

Notes on the code

Mouse / touch actions

With this PR, the TinyPilot web UI would become generally usable on a touch device (as in: it’s not immediately and obviously broken). However: the only thing that currently works somewhat reliably with this PR is issuing a single left click if you touch somewhere. There are quite a few things left that we’d have to figure out:

Testing

Another note is the hurdle of testing touch events. Browser dev tools have some basic support for emulating touch input, but that’s quite limited. At least in Chrome, I don’t think it’s possible to emulate multi-finger gestures, and there are also other quirks on mobile operating systems which we have to account for, for example the native keyboard potentially showing up, or the mobile OS or browser app intercepting certain gestures and trying to do its own thing.

As far as I see, the only reliable way of testing touch support is on an actual touch device. For the test to be meaningful, this probably has to be a tablet, not a smartphone, due to the screen size.

Discussion

I’m basically wondering how far we want to take this, and how much effort we want to invest:

jotaen4tinypilot commented 2 months ago

I thought it would be worthwhile to preserve this proof-of-concept as is, so I’ve created a separate branch/PR for the first iteration → https://github.com/tiny-pilot/tinypilot/pull/1783.