I'm trying to add the panning & zoom functionality on web & desktop for both trackpad & touch (without a modifier, click or key).
The main issue i'm facing is that the widgets I am using i.e. GestureDetector
/onScale
, InteractiveViewer
(based on onScale
)... are always working on desktop as I expect but fail to work on web: On web, zoom is fine but the only way to pan is by a tap + a 2 fingers swipe.
I am not sure if this is a limitation of browsers/js, flutter implementation or If I am missing something.
Do you have any approach to implement this?
Relevant links:
https://github.com/flutter/engine/pull/36342
https://kenneth.io/post/detecting-multi-touch-trackpad-gestures-in-javascript
I have both behaviors implemented via onPointerSignal
but it only works because I make a difference between panning & zooming by pressing a specific key on top of a simple scroll event.
onPointerPanZoomStart
from Listener
is trackpad-specific but only works on windows.
Web/js seems to be using the ctrlKey
attached to a mouse event to filter pan zoom & zoom trackpad event.
At the moment i'm exploring MultiTapGestureRecognizer
and if supported by web and not touch specific, will allow me to get different pointer ids and calculate proper deltas.