flutter_map icon indicating copy to clipboard operation
flutter_map copied to clipboard

[BUG] pinchZoomWinGestures, rotationThreshold (etc.?) not working

Open micheljung opened this issue 1 year ago • 1 comments

What is the bug?

Based on the default options (see below), I would expect that when I pinch-zoom, the map doesn't rotate (because of pinchZoomWinGestures: MultiFingerGesture.pinchZoom | MultiFingerGesture.pinchMove) and that when I pinch-rotate, I need to rotate at least 20° before rotation starts (because of rotationThreshold: 20.0).

However, these settings don't seem to be respected as it's practically impossible to zoom the map without rotating it.

I'm doubting myself because 6.1.0 is 5 months old. This is super basic, and it would surely have been noticed and fixed, but I can't find an open issue.

How can we reproduce it?

flutter_map: 6.1.0
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';

void main() async {
  runApp(
    MaterialApp(
      builder: (context, child) => FlutterMap(
        options: const MapOptions(
          // These are the default options
          interactionOptions: InteractionOptions(
            flags: InteractiveFlag.all,
            debugMultiFingerGestureWinner: false,
            enableMultiFingerGestureRace: false,
            rotationThreshold: 20.0,
            rotationWinGestures: MultiFingerGesture.rotate,
            pinchZoomThreshold: 0.5,
            pinchZoomWinGestures:
                MultiFingerGesture.pinchZoom | MultiFingerGesture.pinchMove,
            pinchMoveThreshold: 40.0,
            pinchMoveWinGestures:
                MultiFingerGesture.pinchZoom | MultiFingerGesture.pinchMove,
            enableScrollWheel: false,
            scrollWheelVelocity: 0.005,
            cursorKeyboardRotationOptions: CursorKeyboardRotationOptions(),
          ),
        ),
        children: [
          TileLayer(
            urlTemplate: "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
            userAgentPackageName: "com.example",
          ),
        ],
      ),
    ),
  );
}
  1. Run on Android
  2. Try zooming without rotating the map

Do you have a potential solution?

No response

Platforms

Android 13 (Galaxy A51)

Severity

Obtrusive: Prevents normal functioning but causes no errors in the console

micheljung avatar May 22 '24 17:05 micheljung

You need to set enableMultiFingerGestureRace to true

nkming2 avatar Sep 17 '24 14:09 nkming2

If this issue still persists after setting enableMultiFingerGestureRace, please ping me! I'll try to remember to document this somewhere.

JaffaKetchup avatar Dec 03 '24 11:12 JaffaKetchup