Reputation: 641
How to disable map rotation in flutter_map while zooming?
I tried this way:
MapOptions(
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
zoom: 15.0,
),
But this always disable rotation. I only want to temporarily disable rotation when zooming. Is this possible?
Upvotes: 4
Views: 1491
Reputation: 124
With the release of V6, you can achieve this via the interactionOptions parameter.
Here is a code sample for reference:
FlutterMap(
options: MapOptions(
//...
interactionOptions: const InteractionOptions(
enableMultiFingerGestureRace: true,
flags: InteractiveFlag.doubleTapDragZoom |
InteractiveFlag.doubleTapZoom |
InteractiveFlag.drag |
InteractiveFlag.flingAnimation |
InteractiveFlag.pinchZoom |
InteractiveFlag.scrollWheelZoom,
),
// ...
Upvotes: 4
Reputation: 21
You need to add this
MapOptions(
enableMultiFingerGestureRace: true,
),
Found solution in flutter_map
issues here.
Upvotes: 2
Reputation: 21
Add "InteractiveFlag.rotate" inside.
MapOptions(
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag |
InteractiveFlag.rotate,
zoom: 15.0,
),
Upvotes: 0