-
Notifications
You must be signed in to change notification settings - Fork 187
The longPress event is fired only after the finger is released #1118
Copy link
Copy link
Open
Description
Here’s what I want to achieve: I want to create a map object (using PointAnnotationManager) on a long tap. However, the action doesn't trigger until I release my finger, which isn't very intuitive for the user. The PointAnnotationManager behaves the same way. I would like to implement a long press that, once triggered, allows the user to immediately drag the object across the map. Is there an option to make the long press behave in a more traditional way?
MapWidget(
key: const Key('AppMap--MapWidget'),
styleUri:
controller.repository.localStorage.load<String>(
'map_type',
) ??
MapboxStyles.OUTDOORS,
cameraOptions: controller.initialCameraOptions,
onMapCreated: controller.onMapCreated,
onCameraChangeListener: controller.onCameraChangeListener,
onLongTapListener: controller.onLongTapListener,
onTapListener: controller.onTapListener,
onStyleLoadedListener: controller.onStyleLoadedListener,
),
Future<void> initAnnotations({
required PointAnnotationManager pointManagerIcon,
required PointAnnotationManager pointManagerLabel,
}) async {
await pointManagerIcon.setIconRotationAlignment(
IconRotationAlignment.MAP,
);
await pointManagerLabel.setIconRotationAlignment(
IconRotationAlignment.VIEWPORT,
);
_pointManagerIcon = pointManagerIcon;
_pointManagerLabel = pointManagerLabel;
_pointManagerLabel.tapEvents(
onTap: _onTapMapLabel,
);
_pointManagerIcon.dragEvents(
onEnd: _onDragEnd,
);
_pointManagerIcon.longPressEvents(
onLongPress: _onLongPress,
);
}
Future<PointAnnotation> _createIconPointAnnotation({
required LatLng location,
required Uint8List image,
required String imageId,
required LocatedObjectModel locatedObject,
}) async {
final annotation = PointAnnotationOptions(
customData: {
"image_id": imageId,
},
geometry: Point(
coordinates: Position(location.longitude, location.latitude),
),
image: image,
iconRotate: _iconRotateFromAzimuth(locatedObject.directionAzimuthDegree),
//isDraggable: user.isAdmin || user.isOperator,
);
return _pointManagerIcon.create(annotation);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels