m1k1o / neko

A self hosted virtual browser that runs in docker and uses WebRTC.
https://neko.m1k1o.net/
Apache License 2.0
5.96k stars 449 forks source link

add touch events on touch monitor #261 #263

Closed urbanekpj closed 1 year ago

urbanekpj commented 1 year ago

see #261 on my touch device i can't 'drag' (eg. select text). i added onTouch events to onMouse events and it is working now. but im not sure if it is relay not working or it should work but my setup is broken.

m1k1o commented 1 year ago

It's not broken for you, instead there is no touch support yet. Thanks for adding it!

m1k1o commented 1 year ago

Touch events should be added as { passive: false } listeners, according to this: https://stackoverflow.com/a/37721906 But vue.js does not seem to support that yet.

m1k1o commented 1 year ago

This is novnc's implementation, quite extended.

urbanekpj commented 1 year ago

hi i fixed two minor issues. don'y know what should be done with this prevent( add listeners manually or simply ignore it for now?)

and as you raised, touch events are more complex. my changes simply map touch to mouse. which is not touchscreen support. (my current changes are sufficient for my use case )

full support require more integration on server side also. i'm not sure if im capable to adding this full support on browser site not mentioning changes in back end code. i'm on edge if this PR is valid. on one hand it is not worse than current support ( it adds select and drag, draw support, what i needed) but is not consistent with general touch user experience.
what your take on this?

m1k1o commented 1 year ago

Also novnc does not seem to use { prevent: false } in their event listeners, so we can leave it out for now and will see.

Given example from novnc is only client side code, they try to convert touch events to mouse events. So only client needs to be altered. Adding full touch passthrough with touch app on the server side would be another approach, yes.

It is good to have at least some touch support, and gestures support would be considered as another feature, so yes your changes are welcome. You can push changes if you have some.

urbanekpj commented 1 year ago

i pushed changes with replacing deprecated function. (I forgot to push it before)