mirror of
https://github.com/status-im/react-native-mapbox-gl.git
synced 2026-08-31 04:51:15 +00:00
add setVisibleCoordinateBounds to js module.
This commit is contained in:
@@ -24,6 +24,9 @@ var MapMixins = {
|
||||
},
|
||||
removeAnnotation(mapRef, annotationInArray) {
|
||||
NativeModules.MapboxGLManager.removeAnnotation(React.findNodeHandle(this.refs[mapRef]), annotationInArray);
|
||||
},
|
||||
setVisibleCoordinateBoundsAnimated(mapRef, latitudeSW, longitudeSW, latitudeNE, longitudeNE, edge) {
|
||||
NativeModules.MapboxGLManager.setVisibleCoordinateBoundsAnimated(React.findNodeHandle(this.refs[mapRef]), latitudeSW, longitudeSW, latitudeNE, longitudeNE, edge);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
- (void)setCenterCoordinateZoomLevelAnimated:(CLLocationCoordinate2D)coordinates zoomLevel:(double)zoomLevel;
|
||||
- (void)selectAnnotationAnimated:(NSUInteger)annotationInArray;
|
||||
- (void)removeAnnotation:(NSUInteger)annotationInArray;
|
||||
- (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)padding animated:(BOOL)animated;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -242,6 +242,11 @@ RCT_EXPORT_MODULE();
|
||||
[_map setCenterCoordinate:coordinates zoomLevel:zoomLevel animated:YES];
|
||||
}
|
||||
|
||||
- (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)padding animated:(BOOL)animated
|
||||
{
|
||||
[_map setVisibleCoordinateBounds:bounds edgePadding:padding animated:animated];
|
||||
}
|
||||
|
||||
- (void)mapView:(MGLMapView *)mapView didUpdateUserLocation:(MGLUserLocation *)userLocation;
|
||||
{
|
||||
NSDictionary *event = @{ @"target": self.reactTag,
|
||||
|
||||
@@ -100,6 +100,22 @@ RCT_EXPORT_METHOD(setCenterCoordinateZoomLevelAnimated:(nonnull NSNumber *)react
|
||||
}];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(setVisibleCoordinateBoundsAnimated:(nonnull NSNumber *)reactTag
|
||||
latitudeSW:(float) latitudeSW
|
||||
longitudeSW:(float) longitudeSW
|
||||
latitudeNE:(float) latitudeNE
|
||||
longitudeNE:(float) longitudeNE
|
||||
edgePadding:(double) edgePadding)
|
||||
{
|
||||
[_bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, RCTSparseArray *viewRegistry) {
|
||||
RCTMapboxGL *mapView = viewRegistry[reactTag];
|
||||
if ([mapView isKindOfClass:[RCTMapboxGL class]]) {
|
||||
MGLCoordinateBounds coordinatesBounds = MGLCoordinateBoundsMake(CLLocationCoordinate2DMake(latitudeSW, longitudeSW), CLLocationCoordinate2DMake(latitudeNE, longitudeNE));
|
||||
[mapView setVisibleCoordinateBounds:coordinatesBounds edgePadding:UIEdgeInsetsMake(edgePadding, edgePadding, edgePadding, edgePadding) animated:YES];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(selectAnnotationAnimated:(nonnull NSNumber *) reactTag
|
||||
annotationInArray:(NSUInteger)annotationInArray)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user