Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ public boolean onTouch(View v, MotionEvent event) {
Annotation oldAnnotation = draggedAnnotation;
androidGesturesManager.onTouchEvent(event);
// if drag is started or drag is finished, don't pass motion events further
return draggedAnnotation != null || oldAnnotation != null;

// Note(leo): added check for MotionEvent.ACTION_MOVE,
// without this all the draggable markers will receive onLongClick event when you single tapped :/
// and that is coming from an android View (perform long click)
return draggedAnnotation != null || oldAnnotation != null
&& event.getAction() == MotionEvent.ACTION_MOVE;
}
});
}
Expand Down Expand Up @@ -134,6 +139,12 @@ boolean onMove(MoveGestureDetector detector) {
return true;
}

if (moveObject.getDistanceXSinceStart() == 0 && moveObject.getDistanceYSinceStart() == 0
&& moveObject.getDistanceXSinceLast() == 0 && moveObject.getDistanceYSinceLast() == 0) {
// fix the bug where you didn't actually touch drag with a finger but get the marker moved
return true;
}

Geometry shiftedGeometry = draggedAnnotation.getOffsetGeometry(
mapboxMap.getProjection(), moveObject, touchAreaShiftX, touchAreaShiftY
);
Expand Down