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: Mouse scrolling doesn't zoom #1414

Closed
5 tasks done
rohanjariwala03 opened this issue Dec 6, 2022 · 27 comments
Closed
5 tasks done

[BUG] MacOS: Mouse scrolling doesn't zoom #1414

rohanjariwala03 opened this issue Dec 6, 2022 · 27 comments
Labels
bug This issue reports broken functionality or another error

Comments

@rohanjariwala03
Copy link

What is the bug?

  • In macOS when I tried to zoom in or out with the mouse scrolling button then it's not working.
  • It's moving the up, down, left, right.
  • Whereas the same class working when I tried to run on Web.

What is the expected behaviour?

  • When I scroll it should be zoom in or out same as web.

How can we reproduce this issue?

- Launch app in any MacOs and scroll with the help of mouse.

Do you have a potential solution?

No response

Can you provide any other information?

Below video is of MacOs which have issue while scrolling

Screen.Recording.2022-12-06.at.3.02.21.PM.mov

Below Video is for Web where with the help of scrolling it's working

Screen.Recording.2022-12-06.at.3.05.38.PM.mov

Platforms Affected

MacOS

Severity

Minimum: Allows normal functioning

Frequency

Consistently: Always occurs at the same time and location

Requirements

  • I agree to follow this project's Code of Conduct
  • My Flutter/Dart installation is unaltered, and flutter doctor finds no relevant issues
  • I am using the latest stable version of this package
  • I have checked the FAQs section on the documentation website
  • I have checked for similar issues which may be duplicates
@rohanjariwala03 rohanjariwala03 added bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing labels Dec 6, 2022
@JosefWN
Copy link
Contributor

JosefWN commented Dec 7, 2022

Probably related to the general issues with #1354, i.e. something to do with the new multitouch support on macOS introduced in the latest major version of Flutter.

For debugging purposes: what if you disable the pinch to zoom gesture?

@rohanjariwala03
Copy link
Author

rohanjariwala03 commented Dec 7, 2022

Even after disabling pinch to zoom gesture, it's still not working.

@JaffaKetchup JaffaKetchup added non-fatal and removed needs triage This new bug report needs reproducing and prioritizing labels Dec 20, 2022
@JaffaKetchup
Copy link
Member

(verified)

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jan 20, 2023
@JaffaKetchup JaffaKetchup changed the title MacOs Zoom In and Out not working with mouse scrolling [BUG] MacOS: Mouse scrolling doesn't zoom May 20, 2023
@JaffaKetchup
Copy link
Member

This needs to be re-evaluated.
@rohanjariwala03 When you get a moment, can you re-evaluate whether this issue is still applicable in the 'master' branch with the latest Flutter 3.10 version?
Thanks!

@JosefWN
Copy link
Contributor

JosefWN commented May 21, 2023

Tried to connect a mouse with a scroll wheel today on flutter_map v4 running on Ventura 13.4 and this seems to be working. It zooms, and it zooms on the pointer location.

@JaffaKetchup
Copy link
Member

@JosefWN Thanks, we'll close this for now. Does this also change the status of #1354?

@JosefWN
Copy link
Contributor

JosefWN commented May 21, 2023

Unfortunately not, #1354 is still an issue :(

@rohanjariwala03
Copy link
Author

rohanjariwala03 commented May 23, 2023

Unfortunately, still it's an issue.

@JosefWN
Copy link
Contributor

JosefWN commented May 23, 2023

Unfortunately, still it's an issue.

I think you will need to provide a minimal reproducible code example then, so we can more easily debug/reproduce the issue.

@rohanjariwala03
Copy link
Author

rohanjariwala03 commented May 23, 2023

Here is the Minimal reproduce code

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

class MapWidget extends StatefulWidget {
  const MapWidget({Key? key}) : super(key: key);

  @override
  State<MapWidget> createState() => _MapWidgetState();
}

class _MapWidgetState extends State<MapWidget> {
  final mapController = MapController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: FlutterMap(
        mapController: mapController,
        options: MapOptions(
          center: LatLng(43.3853848896305, -72.61913458653878),
          zoom: 12,
          maxZoom: 19,
          minZoom: 4,
          keepAlive: true,
          onMapEvent: (ev) async {},
        ),
        children: [
          TileLayer(
            urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
            userAgentPackageName: 'dev.fleaflet.flutter_map.example',
          ),
          const MarkerLayer(rotate: true),
        ],
      ),
    );
  }
}

I can zoom perfectly with web version when I scroll over the map but when I do the same for macOS, it's not zooming in or out.

Flutter_map version
image

@JosefWN
Copy link
Contributor

JosefWN commented May 23, 2023

Can you make it a complete example that actually runs? Then I can try again with that exact code.

@rohanjariwala03
Copy link
Author

Can you make it a complete example that actually runs? Then I can try again with that exact code.

I've updated my last comment. (#1414 (comment))

@JosefWN
Copy link
Contributor

JosefWN commented May 23, 2023

That code also works for me with a mouse, using the scroll wheel to zoom in/out. Did you try running the example code you sent me as well (after the edit), just to see 100% that it's not something else related to your code.

environment:
  sdk: '>=3.0.0'
  flutter: ">=3.10.0"
flutter --version                                                                                   
Flutter 3.10.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision d3d8effc68 (7 days ago) • 2023-05-16 17:59:05 -0700
Engine • revision b4fb11214d
Tools • Dart 3.0.1 • DevTools 2.23.1

MacOS: 13.4

This is my environment, what does yours look like? If you are behind on anything, could you try upgrading?

EDIT: Also, are you using some particular mouse? Mouse settings? Could you another mouse?

I'm just using a plain Lenovo mouse:
512Vdhpob2L AC_UF894,1000_QL80

@rohanjariwala03
Copy link
Author

rohanjariwala03 commented May 24, 2023

Here is the flutter --version output

image

Tried with following mouse....

Just for clarification zoom out and zoom in with mouse is working perfectly in web app and windows app and just having issue with MacOS.

@JaffaKetchup
Copy link
Member

Can you verify in some way that you're depending on the 'master' branch? See https://stackoverflow.com/a/72446556/11846040.

@rohanjariwala03
Copy link
Author

Preview of flutter pub deps for flutter_map

Screenshot 2023-05-24 at 9 48 48 AM

@JaffaKetchup
Copy link
Member

JaffaKetchup commented May 24, 2023

@rohanjariwala03 Can you try depending on 'master' instead?

EDIT: @JosefWN Not sure how this would work on v4? I thought it is currently only fixed on master, but maybe it was fixed a while ago.

@rohanjariwala03
Copy link
Author

Now I'm depending on your latest commit of master branch.

image

@JosefWN
Copy link
Contributor

JosefWN commented May 24, 2023

EDIT: @JosefWN Not sure how this would work on v4? I thought it is currently only fixed on master, but maybe it was fixed a while ago.

Without a deeper knowledge of the mouse/touch code, I think the mouse events are different from the touch events, and could possibly have been working for quite a while? But yes, this is what I have in my pubspec.yaml when I'm testing:

dependencies:
  flutter_map: ^4.0.0
  # ...
flutter pub deps | grep flutter_map
├── flutter_map 4.0.0

Just for clarification zoom out and zoom in with mouse is working perfectly in web app and windows app and just having issue with MacOS.

Yes, I'm running the app native on MacOS. Seems to be some specific triggering factor. For the Magic Mouse specifically I don't know if the gesture register as mouse two-finger touch (which is pan), that could potentially be an issue? But it should really work with the Logitech mouse.

@rohanjariwala03, what about your environment section of the pubspec.yaml? OS version?

EDIT: If it matters, which would surprise me, I'm on an ARM-based (M1) Mac.

@rohanjariwala03
Copy link
Author

I'm on the Mac M1 base as well. Don't know what's the potential issue with MacOs.

Environment :

environment:
  sdk: '>=2.16.0'
  flutter: ">=3.10.0"

@rohanjariwala03
Copy link
Author

Okay, Thanks for help. I've tried with MacBook M2 chip and it's working. So, I think there is some settings issue with My MacMini.
@JosefWN and @JaffaKetchup , Thanks for solving the issue.

Appreciated.

@JosefWN
Copy link
Contributor

JosefWN commented May 24, 2023

I figured the OS comes bundled with a set of drivers which might be slightly different from one version to another (especially major versions, if you are running a MacOS version below 13), and that there could be a potential issue/incompatibility in Flutter with a specific OS version.

What if you bump to this?

environment:
  sdk: '>=3.0.0'
  flutter: ">=3.10.0"

I'm charging a Magic Mouse now to test with, will try in both release and debug with both mice.

@JosefWN
Copy link
Contributor

JosefWN commented May 24, 2023

Okay, Thanks for help. I've tried with MacBook M2 chip and it's working. So, I think there is some settings issue with My MacMini.

Ah, cool. Something that could help: Try re-installing Flutter so you have a fresh install. Rarely, during upgrades the install can get a bit borked for some reason, has happened to me once in 3-4 years, and I've seen others encounter odd issues which were helped by a re-install.

@rohanjariwala03
Copy link
Author

Even though I'm using following environment, still that's an issue.

environment:
  sdk: '>=3.0.0'
  flutter: ">=3.10.0"

For your context, Magic Mouse still not work in MacOS for zoom in and out. But it work's with Web.

@rohanjariwala03
Copy link
Author

rohanjariwala03 commented May 24, 2023

encounter

Will try. Thanks

@JosefWN
Copy link
Contributor

JosefWN commented May 24, 2023

Scrolling with the Magic Mouse in a native app seems to be interpreted as two-finger touch, which is pan. Not sure that we should do anything about this though, this is in line with native behavior (Apple Maps works the same way for example).

Running on web it will probably work since the touch API:s seem to be less mature there, so the two-finger swipe translates into a scroll, which is interpreted as zoom in/out in Google Maps using Chrome for example.

EDIT: So even though the behavior is inconsistent between web and native with the Magic Mouse in particular, that inconsistency is consistent and not Flutter-specific, if that makes any sense.

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
Projects
None yet
Development

No branches or pull requests

3 participants