mapbox / mapbox-plugins-android

Mapbox Android Plugins are a collection of libraries that extend our other SDKs, helping you design powerful mapping features while the plugins handle most of the heavy lifting.
https://www.mapbox.com/android-docs/plugins/overview/
BSD 2-Clause "Simplified" License
241 stars 119 forks source link

Dragging annotation after orientation change causes drag to stop at wrong times #1189

Closed jenz0rw00t closed 1 year ago

jenz0rw00t commented 3 years ago

After an orientation change it seems like DraggableAnnotationController doesn't update its touchAreaMaxX and touchAreaMaxY. This causes the dragging of the annotation to stop efter reaching the X value of the screen width in portrait mode when in landscape (if the map is started in portrait and vice versa if started in landscape but with the Y value).

this is what triggers the stopDragging in DraggableAnnotationController:

if (pointF.x < 0 || pointF.y < 0 || pointF.x > touchAreaMaxX || pointF.y > touchAreaMaxY) {
        stopDragging(draggedAnnotation, draggedAnnotationManager);
        return true;
      }

Should it instead check the mapView.width and mapView.height instead of the touchAreaMaxX/touchAreaMaxY?