fleaflet / flutter_map

A versatile mapping package for Flutter. Simple and easy to learn, yet completely customizable and configurable, it's the best choice for mapping in your Flutter app.
https://pub.dev/packages/flutter_map
BSD 3-Clause "New" or "Revised" License
2.68k stars 848 forks source link

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

Open micheljung opened 1 month ago

micheljung commented 1 month ago

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