AnnotationManager drag event also firing a long-click on the map
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start with the CircleManager drag listener and the mapboxMap long-click listener in the minimal example, then reproduce the interaction with a draggable circle. Done means dragging the circle still reports its drag completion without firing a map-level long-click event, while the reported map long-click behavior remains available for map gestures.
Written by the indexing model from the issue text.
Description
I'm using the latest 9.6.0 Mapbox SDK and the latest annotation plugin too. I'm creating some circles on my map (using CircleManager) and have setup a drag listener for them. This all works fine, but when dragging a circle it also seems to fire a long-click event on the map as well.
I note that dragging a circle does not fire a regular click event on the map. It only fires a long-click event.
This minimal code example reproduces the issue:
@Override
public void onMapReady(@NonNull final MapboxMap mapboxMap) {
MainActivity.this.mapboxMap = mapboxMap;
mapboxMap.setStyle(
createStyleBuilder(STYLE_DEFAULT),
style -> {
initCircleManager(style);
initMapClicks();
});
}
private void initCircleManager(Style style) {
circleManager = new CircleManager(mapView, mapboxMap, style);
// snip - add a circle here, mark it as draggable
circleManager.addDragListener(new OnCircleDragListener() {
@Override
public void onAnnotationDragStarted(Circle annotation) {
}
@Override
public void onAnnotationDrag(Circle annotation) {
}
@Override
public void onAnnotationDragFinished(Circle annotation) {
System.out.println("Circle dragged to "+annotation.getLatLng());
}
});
}
private void initMapClicks() {
mapboxMap.addOnMapLongClickListener(point -> {
System.out.println("Map long-clicked at "+point);
});
}
This results in the following output:
I/System.out: Circle dragged to LatLng [latitude=51.48172356366564, longitude=0.013026118189969793, altitude=0.0]
I/System.out: Map long-clicked at LatLng [latitude=51.48312269584446, longitude=0.01208949814909488, altitude=0.0]
My expectation is that dragging the circle should not result in any events being fired at the map level.
Am I doing something wrong or is this a bug? I can't find any issue that matches this.
- Dominant language
- Java
- Stars
- 242
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mapbox/mapbox-plugins-android
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
mapbox/mapbox-plugins-android#1207 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
mapbox/mapbox-plugins-android#1206 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
mapbox/mapbox-plugins-android#1203 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
mapbox/mapbox-plugins-android#1195 · 1 comment · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
mapbox/mapbox-plugins-android#1193 · 1 comment ·
All issues in mapbox/mapbox-plugins-android
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100