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

[improvement] Zoom listener feature #437

Closed
tranquoctrungcntt opened this issue Oct 4, 2019 · 2 comments
Closed

[improvement] Zoom listener feature #437

tranquoctrungcntt opened this issue Oct 4, 2019 · 2 comments

Comments

@tranquoctrungcntt
Copy link

How can I know when user zoom the map? thanks

@ibosev
Copy link

ibosev commented Oct 21, 2019

in MapOptions there is a onPositionChanged callback function. I think this is what you are looking for.

@maRci002
Copy link
Contributor

#719 - MapController has mapEventStream.

  @override
  void initState() {
    super.initState();
    mapController = MapController();

    subscription = mapController.mapEventStream.listen(onMapEvent);
  }

  void onMapEvent(MapEvent mapEvent) {
    if (mapEvent is MapEventWithMove) {
      if (mapEvent.source == MapEventSource.onDrag ||
          mapEvent.source == MapEventSource.onMultiFinger ||
          mapEvent.source == MapEventSource.doubleTapZoomAnimationController) {
        if (mapEvent.targetZoom != mapEvent.zoom) {
          // zoom changed
        }
      }
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants