mirror of
https://github.com/status-im/react-native-mapbox-gl.git
synced 2026-08-31 04:51:15 +00:00
Merge branch 'master' into deselectHidePopUp
This commit is contained in:
+14
-5
@@ -9,6 +9,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.mapbox.mapboxsdk.annotations.Annotation;
|
||||
import com.mapbox.mapboxsdk.annotations.Icon;
|
||||
import com.mapbox.mapboxsdk.annotations.IconFactory;
|
||||
@@ -172,11 +173,19 @@ public class RNMGLAnnotationOptionsFactory {
|
||||
static RNMGLAnnotationOptions polylineOptionsFromJS(ReadableMap annotation) {
|
||||
PolylineOptions polyline = new PolylineOptions();
|
||||
|
||||
int coordSize = annotation.getArray("coordinates").size();
|
||||
for (int p = 0; p < coordSize; p++) {
|
||||
double latitude = annotation.getArray("coordinates").getArray(p).getDouble(0);
|
||||
double longitude = annotation.getArray("coordinates").getArray(p).getDouble(1);
|
||||
polyline.add(new LatLng(latitude, longitude));
|
||||
ReadableArray coordinates = annotation.getArray("coordinates");
|
||||
int coordinatesSize = coordinates.size();
|
||||
if (coordinatesSize > 0) {
|
||||
LatLng[] points = new LatLng[coordinatesSize];
|
||||
ReadableArray coordinate;
|
||||
for (int p = 0; p < coordinatesSize; p++) {
|
||||
coordinate = coordinates.getArray(p);
|
||||
points[p] = new LatLng(
|
||||
coordinate.getDouble(0),
|
||||
coordinate.getDouble(1)
|
||||
);
|
||||
}
|
||||
polyline.add(points);
|
||||
}
|
||||
|
||||
if (annotation.hasKey("alpha")) {
|
||||
|
||||
+6
-1
@@ -131,6 +131,11 @@ public class ReactNativeMapboxGLManager extends SimpleViewManager<ReactNativeMap
|
||||
view.setZoomEnabled(value);
|
||||
}
|
||||
|
||||
@ReactProp(name = "pitchEnabled")
|
||||
public void setPitchEnabled(ReactNativeMapboxGLView view, boolean value) {
|
||||
view.setPitchEnabled(value);
|
||||
}
|
||||
|
||||
@ReactProp(name = "annotationsPopUpEnabled")
|
||||
public void setAnnotationsPopUpEnabled(ReactNativeMapboxGLView view, boolean value) {
|
||||
view.setAnnotationsPopUpEnabled(value);
|
||||
@@ -381,7 +386,7 @@ public class ReactNativeMapboxGLManager extends SimpleViewManager<ReactNativeMap
|
||||
public void selectAnnotation(ReactNativeMapboxGLView view, String annotationId, boolean animated) {
|
||||
view.selectAnnotation(annotationId, animated);
|
||||
}
|
||||
|
||||
|
||||
public void deselectAnnotation(ReactNativeMapboxGLView view) {
|
||||
view.deselectAnnotation();
|
||||
}
|
||||
|
||||
@@ -55,8 +55,9 @@ public class ReactNativeMapboxGLView extends RelativeLayout implements
|
||||
private int _bearingTrackingMode;
|
||||
private boolean _trackingModeUpdateScheduled = false;
|
||||
private boolean _showsUserLocation;
|
||||
private boolean _zoomEnabled = true;
|
||||
private boolean _annotationsPopUpEnabled = true;
|
||||
private boolean _zoomEnabled = true;
|
||||
private boolean _pitchEnabled = true;
|
||||
private boolean _scrollEnabled = true;
|
||||
private boolean _rotateEnabled = true;
|
||||
private boolean _enableOnRegionWillChange = false;
|
||||
@@ -148,6 +149,7 @@ public class ReactNativeMapboxGLView extends RelativeLayout implements
|
||||
uiSettings.setZoomGesturesEnabled(_zoomEnabled);
|
||||
uiSettings.setScrollGesturesEnabled(_scrollEnabled);
|
||||
uiSettings.setRotateGesturesEnabled(_rotateEnabled);
|
||||
uiSettings.setTiltGesturesEnabled(_pitchEnabled);
|
||||
|
||||
// If these settings changed between setupMapView() and onMapReady(), coerce them to their right values
|
||||
// This doesn't happen in the current implementation of MapView, but let's be future proof
|
||||
@@ -252,6 +254,14 @@ public class ReactNativeMapboxGLView extends RelativeLayout implements
|
||||
}
|
||||
}
|
||||
|
||||
public void setPitchEnabled(boolean value) {
|
||||
if (_pitchEnabled == value) { return; }
|
||||
_pitchEnabled = value;
|
||||
if (_map != null) {
|
||||
_map.getUiSettings().setTiltGesturesEnabled(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void setAnnotationsPopUpEnabled(boolean value) {
|
||||
_annotationsPopUpEnabled = value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user