Skip to content

Commit e032a40

Browse files
authored
Improve MarkerView flick behavior (#1165)
1 parent ea10eec commit e032a40

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

plugin-markerview/src/main/java/com/mapbox/mapboxsdk/plugins/markerview/MarkerViewManager.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* Class responsible for synchronising views at a LatLng on top of a Map.
1515
*/
16-
public class MarkerViewManager implements MapView.OnCameraDidChangeListener {
16+
public class MarkerViewManager implements MapView.OnCameraDidChangeListener, MapView.OnCameraIsChangingListener {
1717

1818
private final MapView mapView;
1919
private final MapboxMap mapboxMap;
@@ -41,6 +41,7 @@ public MarkerViewManager(MapView mapView, MapboxMap mapboxMap) {
4141
public void onDestroy() {
4242
markers.clear();
4343
mapView.removeOnCameraDidChangeListener(this);
44+
mapView.removeOnCameraIsChangingListener(this);
4445
initialised = false;
4546
}
4647

@@ -58,6 +59,7 @@ public void addMarker(@NonNull MarkerView markerView) {
5859
if (!initialised) {
5960
initialised = true;
6061
mapView.addOnCameraDidChangeListener(this);
62+
mapView.addOnCameraIsChangingListener(this);
6163
}
6264
markerView.setProjection(mapboxMap.getProjection());
6365
mapView.addView(markerView.getView());
@@ -90,4 +92,9 @@ private void update() {
9092
public void onCameraDidChange(boolean animated) {
9193
update();
9294
}
95+
96+
@Override
97+
public void onCameraIsChanging() {
98+
update();
99+
}
93100
}

0 commit comments

Comments
 (0)