From 8d0313b664f23cd9e461c0af83745a8761706e8b Mon Sep 17 00:00:00 2001 From: Wermeille Bastien Date: Sat, 18 Jul 2020 10:40:36 +0200 Subject: [PATCH] [annotation] Consume event when drag end to prevent click event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I wrote a seperate PR for this issue such as to simplify the review of #1125. - Fixes #883 Any review and comment would be much appreciated 👍 @LukasPaczos and @langsmith. --- .../plugins/annotation/DraggableAnnotationController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/DraggableAnnotationController.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/DraggableAnnotationController.java index 153f1fd19..c3ce91f74 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/DraggableAnnotationController.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/DraggableAnnotationController.java @@ -50,9 +50,10 @@ public DraggableAnnotationController(MapView mapView, MapboxMap mapboxMap, mapView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { + Annotation oldAnnotation = draggedAnnotation; androidGesturesManager.onTouchEvent(event); - // if drag is started, don't pass motion events further - return draggedAnnotation != null; + // if drag is started or drag is finished, don't pass motion events further + return draggedAnnotation != null || oldAnnotation != draggedAnnotation; } }); }