Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] MacOS: GestureDetectors stop responding after zooming #1572

Closed
Tracked by #1529
SheenaJacob opened this issue Jun 29, 2023 · 14 comments
Closed
Tracked by #1529

[BUG] MacOS: GestureDetectors stop responding after zooming #1572

SheenaJacob opened this issue Jun 29, 2023 · 14 comments
Labels
bug This issue reports broken functionality or another error external The issue lies in a dependency or Flutter itself S: core Scoped to the core flutter_map functionality
Milestone

Comments

@SheenaJacob
Copy link

SheenaJacob commented Jun 29, 2023

What is the bug?

Problem
When zooming in and out of flutter maps sometimes it occurs that widgets that use Gesture detectors internally such as Buttons, Attribution Widgets, and Draggable markers stop responding. I initially noticed this problem when using flutter draggable markers, so I reported an issue here: ibrierley/flutter_map_dragmarker#27, and after some help and testing, I realized there was a problem with other widgets that use Gesture Detectors on Flutter Maps as well.

There is no specific trigger as to when this happens. I have tested it on macOS and Windows with the latest version of flutter maps and the problem still exists.

Flutter and Dart version used:
Flutter 3.10.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 796c8ef792 (2 weeks ago) • 2023-06-13 15:51:02 -0700
Engine • revision 45f6e00911
Tools • Dart 3.0.5 • DevTools 2.23.1

Plugins:
flutter_map: 5.0.0
latlong2: 0.9.0
url_launcher: 6.1.10

Example
Here's a minimalistic example to expose what's happening.
I've included a button at the bottom (+) that displays an alert dialog and also a SimpleAttributionWidget with the link to open Open Street Maps Contributors like this:

example_flutter_maps

I'm using the mousepad to zoom in and out of the maps, and in the first video below you'll notice, that in the beginning, I click the + button and a pop-up button appears, but at around 7 seconds I try clicking the same button and there is no response. Also when clicking on OpenStreetMap Contributors the link doesn't open.

zoom_in_bug_compressed.mp4

A similar example is in the video below. I click the + and it works as expected at the beginning and at around 3 seconds, but at 8 seconds it doesn't work again.

zoom_in_bug_2.mp4

How can we reproduce it?

To reproduce the bug in the example shown above use the code below:

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:latlong2/latlong.dart';
import 'package:url_launcher/url_launcher.dart';

void main() {
  runApp(
    const MaterialApp(
      home: ZoomTest(),
    ),
  );
}

class ZoomTest extends StatelessWidget {
  const ZoomTest({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter Maps Zoom Test'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(8),
        child: Center(
          child: FlutterMap(
            options: MapOptions(
              center: const LatLng(51.5, -0.09),
              zoom: 5,
              maxZoom: 19,
              maxBounds: LatLngBounds(
                const LatLng(-90, -180),
                const LatLng(90, 180),
              ),
            ),
            nonRotatedChildren: [
              Align(
                alignment: Alignment.bottomLeft,
                child: IconButton(
                  onPressed: () {
                    showDialog(
                      context: context,
                      builder: (context) {
                        return const AlertDialog(
                          content: Text(
                            'Button Pressed',
                            textAlign: TextAlign.center,
                          ),
                        );
                      },
                    );
                  },
                  icon: const Icon(Icons.add),
                ),
              ),
              SimpleAttributionWidget(
                source: const Text('OpenStreetMap contributors'),
                onTap: () => launchUrl(
                  Uri.parse('https://openstreetmap.org/copyright'),
                ),
              )
            ],
            children: [
              TileLayer(
                urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
                userAgentPackageName: 'dev.fleaflet.flutter_map.example',
              )
            ],
          ),
        ),
      ),
    );
  }
}

As an alternative, this can be tested on the example app of flutter_maps and even the example of flutter_map_dragmarker.

Do you have a potential solution?

No response

Platforms

Windows 11(x64), macOS

Severity

Minimum: Allows normal functioning

@SheenaJacob SheenaJacob added the bug This issue reports broken functionality or another error label Jun 29, 2023
@ibrierley
Copy link
Contributor

Out of interest, could you try the examples on the LatLngToScreenPoint flutter_map example (that examples places an icon where you click on the screen).
I'm wondering whether it's not registering events, or if the events are somehow misaligned and registering elsewhere. So I'd be curious if you click on the screen and the images end up offset a bit, or if they don't register at all.

@SheenaJacob
Copy link
Author

So I tried it out and in this case, it doesn't register the event at all. So in the video below. it seems to register the first three tap events, but at 0:12 I try clicking an area and there is no response whatsoever. The same goes for the two points clicked on at 0:16 & 0:18 seconds.

lat_lng_to_screen_bug.mp4

@JaffaKetchup JaffaKetchup added the needs triage This new bug report needs reproducing and prioritizing label Jun 29, 2023
@JaffaKetchup
Copy link
Member

Hmm, I can't seem to reproduce this. Running on Windows 11 (x64) and the live web demo, zoom does not seem affect the tap response.

I can't figure out why this might be, but the only difference I can immediately see is your zoom seems to be smoothed - other than the MacOS platform, but you said you could reproduce on Windows. Is there zoom smoothing on Windows as well? Can you also try on the live web demo?

@SheenaJacob
Copy link
Author

My sincere apologies @JaffaKetchup . I was testing it on Windows but on an older version of an example app that wasn't working on the latest version of flutter or flutter maps, and I can't seem to reproduce the error on Windows 11 now. I also tried the live demo app and I used the double click to zoom but I also did not run into an error here. Sorry for the confusion.

@JaffaKetchup
Copy link
Member

No problem. Does this still occur on MacOS?

@SheenaJacob
Copy link
Author

Yes. I tested it again to make sure, and I still have the problem.

The summary from running flutter doctor:
jshe@MacBook-Pro flutter_map % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.5, on macOS 12.5.1 21G83 darwin-arm64, locale en-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.76.2)
[✓] Connected device (2 available)
[✓] Network resources

• No issues found!

@JaffaKetchup
Copy link
Member

Ok, is there any way you can test without zoom smoothing? I'm assuming that's part of the mouse or its drivers.
I'll track this with the other MacOS gesture issues.

@JaffaKetchup JaffaKetchup changed the title Widgets that use underlying Gesture Detectors don't register drag or tap events sometimes after zooming [BUG] MacOS: GestureDetectors stop responding after zooming Jun 29, 2023
@SheenaJacob
Copy link
Author

I'll check if there is a workaround without the zoom smoothing and let you know.

@SheenaJacob
Copy link
Author

So I tried disabling the smoothing when zooming on macOS but the problem still exists.
zoom_settings

Another thing I noticed is that if I pan the screen when this happens, it works again. So at around 6 seconds, I try tapping the screen and it doesn't work, and at 11 seconds I pan the screen, and then it works as expected.

lat_lng_to_screen.mp4

@JaffaKetchup JaffaKetchup added P: 2 (soon™?) and removed needs triage This new bug report needs reproducing and prioritizing labels Jul 13, 2023
@nelzaatari
Copy link

nelzaatari commented Aug 5, 2023

im facing the same issue on IOS/Android, ontap on markers doesnt work anymore after i zoom in.

And I have just noticed something new, scroll zoomin(when I tap my finger once and then drag the map) taps wokrs, after scroll zoom in and scroll zoom out but not with double finger zoom in

@josxha josxha added this to the v7.0 milestone Dec 2, 2023
@JaffaKetchup JaffaKetchup added the S: core Scoped to the core flutter_map functionality label Dec 10, 2023
@JosefWN
Copy link
Contributor

JosefWN commented Jan 10, 2024

Could flutter/flutter#140730 be related? In general flutter itself seems quite messy on the touch/gesture side right now.

@JaffaKetchup
Copy link
Member

Good spot, certainly seems very similar!

@JaffaKetchup JaffaKetchup added external The issue lies in a dependency or Flutter itself and removed P: 2 (soon™?) labels Jan 10, 2024
@moffatman
Copy link

moffatman commented Jan 18, 2024

It could be fixed by my patch flutter/engine#49424, although this is only for trackpad pinch, if you have any problem with iOS/Android touchscreen, it is something else...

@JaffaKetchup
Copy link
Member

We're going to close this for now, as it will be assumed fix and will require re-verification if the issue still occurs. Thanks @moffatman!

@JaffaKetchup JaffaKetchup closed this as not planned Won't fix, can't repro, duplicate, stale Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue reports broken functionality or another error external The issue lies in a dependency or Flutter itself S: core Scoped to the core flutter_map functionality
Projects
None yet
Development

No branches or pull requests

7 participants