mapbox / mapbox/mapbox-plugins-android
AnnotationManager drag event also firing a long-click on the map
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 242
- Fork
- 116
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với drag listener của CircleManager và long-click listener của mapboxMap trong ví dụ tối thiểu, sau đó tái hiện tương tác này với một hình tròn có thể kéo. Hoàn tất khi thao tác kéo hình tròn vẫn báo cáo việc hoàn tất kéo mà không kích hoạt sự kiện long-click ở cấp bản đồ, đồng thời hành vi long-click của bản đồ được báo cáo vẫn khả dụng cho các gesture trên bản đồ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- android, java
- Lĩnh vực
- mobile
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 35/100