flutter_map
flutter_map copied to clipboard
multi!: rewrite gesture handling
Moved the gesture-rewrite
branch to the flutter_map repo to have pull requests for this branch on here too.
For previous discussions see https://github.com/fleaflet/flutter_map/pull/1733.
Changes in addition to the ones listed in https://github.com/fleaflet/flutter_map/pull/1733:
- tiles load continuously for
doubleTapDragZoom
gesture - fling gesture has been turned into a gesture option for the drag gesture
- now all tap gesture only emit events when they have a registered callback (before double tap gestures haven't while regular taps have emitted an event).
- all gesture animation gets cancelled on a pointer down event.
- changes to the trackpad (aka. touchpad) gestures
Bugs reported by @JaffaKetchup:
-
[ ] https://github.com/fleaflet/flutter_map/pull/1810
-
[x] https://github.com/fleaflet/flutter_map/pull/1815
-
[x] https://github.com/fleaflet/flutter_map/pull/1814
-
[x] (6) Double tap + drag gesture now loads tiles whilst zooming. master behaviour isn't correct either. ~~The correct behaviour is that new tiles shouldn't load and old ones shouldn't be pruned whilst moving, and the refresh should occur when the gesture completes.~~ Zoom levels should get skipped on fast zooming, to be added in https://github.com/fleaflet/flutter_map/issues/1748
-
[x] (7) ~~On tap events and callbacks are no longer triggered.~~ Tap callback need to be set to have its event counterpart emitted.
Things that need to be tested by @JaffaKetchup:
- [ ] trackpad zoom gesture
- [ ] touch screen gestures
- Trackpad zoom gesture toggle has no effect, and cannot zoom with trackpad. Instead, scroll gesture controls the trackpad zoom.
This is expected behaviour. Since the driver release date is 2006 I assume that your touchpad doesn't support the new gestures of flutter.
Depending on the platform and specific trackpad model, the new system might not be used, if not enough data is provided to the Flutter engine by platform APIs. This includes on Windows, where trackpad gesture support is dependent on the trackpad’s driver, and the Web platform, where not enough data is provided by browser APIs, and trackpad scrolling must still use the old PointerScrollSignal system.
https://docs.flutter.dev/release/breaking-changes/trackpad-gestures#description-of-change
- Two-finger drag checkbox doesn't appear to make any difference on Windows 11 trackpad (Lenovo). Is two-finger drag intended for mobile?
There was up to this point no intention for a two-finger drag on trackpads and I'm not able to perform this gesture on other map libraries. Is this another flutter_map specific gesture?
- The new system where events aren't emitted unless a callback is directly assigned to listen to that event kinda breaks the whole point of the onMapEvent callback.
Please note that events haven't been emitted concistently. normal tap gestures have while the double tap hasn't. The implementation in this pr only registers callbacks if they are needed and therefore only emits an event if the user listens to it. Maybe I understood the onMapEvent
callback wrong. For my understanding this callback provides all events that happen to the user, not every event that would be possible. If all callbacks are provided to the event system anyways what is the point of the gesture callbacks in the first place?
- Double tap zoom gesture has no delay when performed on mouse (which is good), but there is delay when gesture performed on trackpad.
I experience the same behaviour for master. Have you really experienced different behaviours between master and this pr?
I'm a little concerned that we're splitting the mouse, touchpad, and mobile/touchscreen gestures apart. As far as I'm concerned the touchpad gestures should be the same as the mobile/touchscreen gestures.
Touchpads and touchscreens have different gestures. For example: Run the app from the master branch and do a doubleClickDragZoom gesture. On touchpad this zooms the map in and out to allow zooming with one finger. On touchpad however this gesture moves viewport which is the expected touchpad behaviour. If your goal is it to provide the same gestures on trackpad, touchpad and mouse, a high level implementation is not sufficient and we need to use a RawGestureDetector.
For example, the pinch zoom gesture is the same pinch that's done on the trackpad.
The classic windows zoom gesture is to move two fingers vertically on the touchpad. You can use this gesture on the web live demo: https://demo.fleaflet.dev/ More advanced touchpads and mac touchpads support the pinch zoom gesture as well. But we can't assume that this gesture is supported by any touchpad.
Just a quick update to this pull request for everyone who's following along. It was decided internally to collect all gestures with their supported platforms and input devices to get a better overview. I created a spreadsheet for this: https://docs.google.com/spreadsheets/d/10N41ueX9Pr0H3gc89hFQLbRwcqKpeOMXNVrYR-FR0g4/edit?usp=sharing (note that there are multiple sites)
Looking forward for some feedback or comments to be able to continue.