mapbox / mapbox-maps-flutter

Interactive, thoroughly customizable maps for Flutter powered by Mapbox Maps SDK
https://www.mapbox.com/mobile-maps-sdk
Other
245 stars 93 forks source link

Tap/Scroll Listeners no longer recognized #525

Closed huco closed 2 weeks ago

huco commented 2 weeks ago

Hi there.

It seems changes made in Snapshotter commit broke detection for some gestures (tap, longtap and scroll).

If I'm not mistaken _MapWidgetState.onPlatformViewCreated should add tap/scroll listeners to created controller. Something like this might work:

void onPlatformViewCreated(int id) {
    final MapboxMap controller =
        MapboxMap(mapboxMapsPlatform: _mapboxMapsPlatform);

    // setup tap/scroll listeners
    controller.setOnMapTapListener(widget.onTapListener);
    controller.setOnMapLongTapListener(widget.onLongTapListener);
    controller.setOnMapMoveListener(widget.onScrollListener);

    _controller.complete(controller);
    if (widget.onMapCreated != null) {
      widget.onMapCreated!(controller);
    }
    mapboxMap = controller;
    _updateSubscriptions();
}
maios commented 2 weeks ago

Thank you @huco for raising it, we have fixed it https://github.com/mapbox/mapbox-maps-flutter/pull/526