Unact / yandex_mapkit

Flutter implementation of YandexMapkit
MIT License
132 stars 151 forks source link

Gestures in the gesturesRecignizer parameter are not read #336

Closed 78Ronin78 closed 3 months ago

78Ronin78 commented 6 months ago

Hello, I'm making a food delivery app and implementing label selection in the delivery area. However, the card only recognizes one PanGestureRecouncer gesture event - onDown. Other events have no effect. Code my map:

`YandexMap( key: mapKey, fastTapEnabled: true, gestureRecognizers: <Factory>[ Factory(() => _panGestureRecognizer ..onUpdate = ((details) => print('гавно'))), ].toSet(), onMapCreated: (YandexMapController yandexMapController) async { mapControllerCompleter.complete(yandexMapController); await _fetchCurrentLocation();

            _userLocation = yandexMapController.getUserCameraPosition();
          },

          onMapTap: (argument) async {
            (await mapControllerCompleter.future).moveCamera(
              CameraUpdate.newCameraPosition(
                CameraPosition(
                  target: argument,
                  zoom: _mapZoom,
                ),
              ),
              animation: const MapAnimation(
                type: MapAnimationType.linear,
                duration: 0.3,
              ),
            );
          },
          mapObjects: mapObjects,
          onUserLocationAdded: (UserLocationView view) async {
            // _userLocation =
            // (await mapControllerCompleter.future).getUserCameraPosition();

            // if (_userLocation != null) {
            //   (await mapControllerCompleter.future).moveCamera(
            //     CameraUpdate.newCameraPosition(
            //       _userLocation.copyWith(zoom: 8),
            //     ),
            //     animation: const MapAnimation(
            //       type: MapAnimationType.linear,
            //       duration: 0.3,
            //     ),
            //   );
            // }
            return view.copyWith(
              pin: view.pin.copyWith(
                icon: PlacemarkIcon.single(
                  PlacemarkIconStyle(
                    image: BitmapDescriptor.fromAssetImage(
                      'assets/app_icon_3.png',
                    ),
                  ),
                ),
                opacity: 0,
              ),
              arrow: view.arrow.copyWith(
                icon: PlacemarkIcon.single(
                  PlacemarkIconStyle(
                    image: BitmapDescriptor.fromAssetImage(
                      'assets/app_icon_3.png',
                    ),
                  ),
                ),
                opacity: 0,
              ),
              accuracyCircle: view.accuracyCircle.copyWith(
                fillColor: Colors.green.withOpacity(0),
              ),
            );
          },
          onCameraPositionChanged: (cameraPosition, _, __) async {
            setState(() {
              _mapZoom = cameraPosition.zoom;
            });
          },
        ),`
DCrow commented 5 months ago

Hello!

Please provide an more concrete example. gestureRecognizers options is used to specify which gesture this map should consume.

For example like this:

YandexMap(
  gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
    Factory<OneSequenceGestureRecognizer>(() => EagerGestureRecognizer())
  }
)