@maplibre/maplibre-react-native 10.1.0 → 10.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/MLRN/CameraStop.h +1 -1
- package/ios/MLRN/CameraStop.m +58 -60
- package/ios/MLRN/CameraUpdateItem.h +2 -1
- package/ios/MLRN/CameraUpdateItem.m +132 -132
- package/ios/MLRN/CameraUpdateQueue.m +43 -47
- package/ios/MLRN/FilterParser.h +1 -1
- package/ios/MLRN/FilterParser.m +5 -6
- package/ios/MLRN/MLRNBackgroundLayer.m +10 -9
- package/ios/MLRN/MLRNBackgroundLayerManager.m +4 -5
- package/ios/MLRN/MLRNCallout.h +1 -1
- package/ios/MLRN/MLRNCallout.m +37 -36
- package/ios/MLRN/MLRNCalloutManager.m +2 -3
- package/ios/MLRN/MLRNCamera.h +1 -1
- package/ios/MLRN/MLRNCamera.m +169 -182
- package/ios/MLRN/MLRNCameraManager.m +4 -6
- package/ios/MLRN/MLRNCircleLayer.m +17 -14
- package/ios/MLRN/MLRNCircleLayerManager.m +4 -5
- package/ios/MLRN/MLRNCustomHeaders.h +2 -2
- package/ios/MLRN/MLRNCustomHeaders.m +63 -63
- package/ios/MLRN/MLRNEvent.h +3 -3
- package/ios/MLRN/MLRNEvent.m +19 -24
- package/ios/MLRN/MLRNEventProtocol.h +1 -1
- package/ios/MLRN/MLRNFillExtrusionLayer.m +18 -14
- package/ios/MLRN/MLRNFillExtrusionLayerManager.m +4 -5
- package/ios/MLRN/MLRNFillLayer.m +16 -14
- package/ios/MLRN/MLRNFillLayerManager.m +4 -5
- package/ios/MLRN/MLRNHeatmapLayer.m +17 -14
- package/ios/MLRN/MLRNHeatmapLayerManager.m +4 -5
- package/ios/MLRN/MLRNImageQueue.h +4 -1
- package/ios/MLRN/MLRNImageQueue.m +29 -32
- package/ios/MLRN/MLRNImageQueueOperation.h +1 -1
- package/ios/MLRN/MLRNImageQueueOperation.m +92 -91
- package/ios/MLRN/MLRNImageSource.m +36 -38
- package/ios/MLRN/MLRNImageSourceManager.m +2 -3
- package/ios/MLRN/MLRNImageUtils.h +3 -3
- package/ios/MLRN/MLRNImageUtils.m +15 -14
- package/ios/MLRN/MLRNImages.h +0 -1
- package/ios/MLRN/MLRNImages.m +89 -91
- package/ios/MLRN/MLRNImagesManager.m +4 -5
- package/ios/MLRN/MLRNLayer.h +9 -11
- package/ios/MLRN/MLRNLayer.m +170 -182
- package/ios/MLRN/MLRNLight.m +21 -23
- package/ios/MLRN/MLRNLightManager.m +2 -3
- package/ios/MLRN/MLRNLineLayer.m +17 -15
- package/ios/MLRN/MLRNLineLayerManager.m +4 -6
- package/ios/MLRN/MLRNLocation.h +1 -1
- package/ios/MLRN/MLRNLocation.m +16 -17
- package/ios/MLRN/MLRNLocationManager.m +109 -124
- package/ios/MLRN/MLRNLocationManagerDelegate.h +3 -3
- package/ios/MLRN/MLRNLocationModule.h +1 -1
- package/ios/MLRN/MLRNLocationModule.m +40 -55
- package/ios/MLRN/MLRNLogging.h +1 -4
- package/ios/MLRN/MLRNLogging.m +84 -89
- package/ios/MLRN/MLRNMapTouchEvent.h +2 -2
- package/ios/MLRN/MLRNMapTouchEvent.m +50 -49
- package/ios/MLRN/MLRNMapView.h +43 -36
- package/ios/MLRN/MLRNMapView.m +409 -440
- package/ios/MLRN/MLRNMapViewManager.m +489 -502
- package/ios/MLRN/MLRNModule.h +1 -1
- package/ios/MLRN/MLRNModule.m +111 -105
- package/ios/MLRN/MLRNNativeUserLocation.m +24 -27
- package/ios/MLRN/MLRNNativeUserLocationManager.m +4 -8
- package/ios/MLRN/MLRNOfflineModule.h +1 -1
- package/ios/MLRN/MLRNOfflineModule.m +416 -421
- package/ios/MLRN/MLRNPointAnnotation.h +2 -2
- package/ios/MLRN/MLRNPointAnnotation.m +154 -175
- package/ios/MLRN/MLRNPointAnnotationManager.m +2 -3
- package/ios/MLRN/MLRNRasterLayer.m +16 -12
- package/ios/MLRN/MLRNRasterLayerManager.m +4 -5
- package/ios/MLRN/MLRNRasterSource.m +21 -17
- package/ios/MLRN/MLRNRasterSourceManager.m +2 -3
- package/ios/MLRN/MLRNShapeSource.h +17 -16
- package/ios/MLRN/MLRNShapeSource.m +94 -102
- package/ios/MLRN/MLRNShapeSourceManager.h +2 -2
- package/ios/MLRN/MLRNShapeSourceManager.m +86 -90
- package/ios/MLRN/MLRNSnapshotModule.h +1 -1
- package/ios/MLRN/MLRNSnapshotModule.m +51 -53
- package/ios/MLRN/MLRNSource.h +12 -12
- package/ios/MLRN/MLRNSource.m +82 -88
- package/ios/MLRN/MLRNStyleValue.h +1 -1
- package/ios/MLRN/MLRNStyleValue.m +128 -128
- package/ios/MLRN/MLRNSymbolLayer.m +17 -13
- package/ios/MLRN/MLRNSymbolLayerManager.m +4 -5
- package/ios/MLRN/MLRNTileSource.h +1 -1
- package/ios/MLRN/MLRNTileSource.m +21 -20
- package/ios/MLRN/MLRNUserLocation.h +1 -1
- package/ios/MLRN/MLRNUserLocation.m +10 -12
- package/ios/MLRN/MLRNUtils.h +18 -11
- package/ios/MLRN/MLRNUtils.m +168 -160
- package/ios/MLRN/MLRNVectorLayer.m +28 -34
- package/ios/MLRN/MLRNVectorSource.h +3 -1
- package/ios/MLRN/MLRNVectorSource.m +14 -11
- package/ios/MLRN/MLRNVectorSourceManager.h +2 -2
- package/ios/MLRN/MLRNVectorSourceManager.m +36 -39
- package/ios/MLRN/ViewManager.h +1 -1
- package/ios/MLRN/ViewManager.m +29 -35
- package/lib/commonjs/components/MarkerView.js +1 -1
- package/lib/commonjs/components/UserLocation.js +8 -38
- package/lib/commonjs/components/UserLocation.js.map +1 -1
- package/lib/commonjs/components/UserLocationPuck.js +52 -0
- package/lib/commonjs/components/UserLocationPuck.js.map +1 -0
- package/lib/commonjs/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +12 -9
- package/lib/commonjs/components/UserLocationPuckHeading.js.map +1 -0
- package/lib/module/components/MarkerView.js +1 -1
- package/lib/module/components/UserLocation.js +7 -36
- package/lib/module/components/UserLocation.js.map +1 -1
- package/lib/module/components/UserLocationPuck.js +48 -0
- package/lib/module/components/UserLocationPuck.js.map +1 -0
- package/lib/module/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +11 -7
- package/lib/module/components/UserLocationPuckHeading.js.map +1 -0
- package/lib/typescript/commonjs/src/components/MarkerView.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/UserLocation.d.ts +0 -1
- package/lib/typescript/commonjs/src/components/UserLocation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts +9 -0
- package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts +9 -0
- package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts +0 -1
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +0 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts +0 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts +0 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts.map +1 -1
- package/lib/typescript/module/src/components/MarkerView.d.ts +1 -1
- package/lib/typescript/module/src/components/UserLocation.d.ts +0 -1
- package/lib/typescript/module/src/components/UserLocation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/UserLocationPuck.d.ts +9 -0
- package/lib/typescript/module/src/components/UserLocationPuck.d.ts.map +1 -0
- package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts +9 -0
- package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts +0 -1
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +0 -1
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts +0 -1
- package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts +0 -1
- package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/components/MarkerView.tsx +1 -1
- package/src/components/UserLocation.tsx +13 -51
- package/src/components/UserLocationPuck.tsx +62 -0
- package/src/components/UserLocationPuckHeading.tsx +33 -0
- package/lib/commonjs/components/HeadingIndicator.js.map +0 -1
- package/lib/module/components/HeadingIndicator.js.map +0 -1
- package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts +0 -7
- package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts.map +0 -1
- package/lib/typescript/module/src/components/HeadingIndicator.d.ts +0 -7
- package/lib/typescript/module/src/components/HeadingIndicator.d.ts.map +0 -1
- package/src/components/HeadingIndicator.tsx +0 -26
package/ios/MLRN/CameraStop.h
CHANGED
package/ios/MLRN/CameraStop.m
CHANGED
|
@@ -1,75 +1,73 @@
|
|
|
1
1
|
#import "CameraStop.h"
|
|
2
2
|
#import "CameraMode.h"
|
|
3
|
-
#import "MLRNUtils.h"
|
|
4
3
|
#import "MLRNCamera.h"
|
|
4
|
+
#import "MLRNUtils.h"
|
|
5
5
|
|
|
6
6
|
@implementation CameraStop
|
|
7
7
|
|
|
8
|
-
- (void)setMode:(NSNumber *)mode
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
8
|
+
- (void)setMode:(NSNumber *)mode {
|
|
9
|
+
int modeInt = [mode intValue];
|
|
10
|
+
|
|
11
|
+
if (modeInt == RCT_MAPBOX_CAMERA_MODE_FLIGHT) {
|
|
12
|
+
_mode = [NSNumber numberWithInt:modeInt];
|
|
13
|
+
} else if (modeInt == RCT_MAPBOX_CAMERA_MODE_NONE) {
|
|
14
|
+
_mode = [NSNumber numberWithInt:modeInt];
|
|
15
|
+
} else if (modeInt == RCT_MAPBOX_CAMERA_MODE_LINEAR) {
|
|
16
|
+
_mode = [NSNumber numberWithInt:modeInt];
|
|
17
|
+
} else {
|
|
18
|
+
_mode = [NSNumber numberWithInt:RCT_MAPBOX_CAMERA_MODE_EASE];
|
|
19
|
+
}
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
-(id)init {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
- (id)init {
|
|
23
|
+
if (self = [super init]) {
|
|
24
|
+
self.coordinate = kCLLocationCoordinate2DInvalid;
|
|
25
|
+
self.bounds =
|
|
26
|
+
MLNCoordinateBoundsMake(kCLLocationCoordinate2DInvalid, kCLLocationCoordinate2DInvalid);
|
|
27
|
+
}
|
|
28
|
+
return self;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
+ (CameraStop *)fromDictionary:(NSDictionary *)args {
|
|
32
|
+
CameraStop *stop = [[CameraStop alloc] init];
|
|
33
|
+
|
|
34
|
+
if (args[@"pitch"]) {
|
|
35
|
+
stop.pitch = args[@"pitch"];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (args[@"heading"]) {
|
|
39
|
+
stop.heading = args[@"heading"];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (args[@"centerCoordinate"]) {
|
|
43
|
+
stop.coordinate = [MLRNUtils fromFeature:args[@"centerCoordinate"]];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (args[@"zoom"]) {
|
|
47
|
+
stop.zoom = args[@"zoom"];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (args[@"mode"]) {
|
|
51
|
+
stop.mode = args[@"mode"];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (args[@"bounds"]) {
|
|
55
|
+
stop.bounds = [MLRNUtils fromFeatureCollection:args[@"bounds"]];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
CGFloat paddingTop = args[@"paddingTop"] ? [args[@"paddingTop"] floatValue] : 0.0;
|
|
59
|
+
CGFloat paddingRight = args[@"paddingRight"] ? [args[@"paddingRight"] floatValue] : 0.0;
|
|
60
|
+
CGFloat paddingBottom = args[@"paddingBottom"] ? [args[@"paddingBottom"] floatValue] : 0.0;
|
|
61
|
+
CGFloat paddingLeft = args[@"paddingLeft"] ? [args[@"paddingLeft"] floatValue] : 0.0;
|
|
62
|
+
stop.padding = UIEdgeInsetsMake(paddingTop, paddingLeft, paddingBottom, paddingRight);
|
|
31
63
|
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
stop.pitch = args[@"pitch"];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (args[@"heading"]) {
|
|
41
|
-
stop.heading = args[@"heading"];
|
|
42
|
-
}
|
|
64
|
+
NSTimeInterval duration = 2.0;
|
|
65
|
+
if (args[@"duration"]) {
|
|
66
|
+
duration = [MLRNUtils fromMS:args[@"duration"]];
|
|
67
|
+
}
|
|
68
|
+
stop.duration = duration;
|
|
43
69
|
|
|
44
|
-
|
|
45
|
-
stop.coordinate = [MLRNUtils fromFeature:args[@"centerCoordinate"]];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (args[@"zoom"]) {
|
|
49
|
-
stop.zoom = args[@"zoom"];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (args[@"mode"]) {
|
|
53
|
-
stop.mode = args[@"mode"];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (args[@"bounds"]) {
|
|
57
|
-
stop.bounds = [MLRNUtils fromFeatureCollection:args[@"bounds"]];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
CGFloat paddingTop = args[@"paddingTop"] ? [args[@"paddingTop"] floatValue] : 0.0;
|
|
61
|
-
CGFloat paddingRight = args[@"paddingRight"] ? [args[@"paddingRight"] floatValue] : 0.0;
|
|
62
|
-
CGFloat paddingBottom = args[@"paddingBottom"] ? [args[@"paddingBottom"] floatValue] : 0.0;
|
|
63
|
-
CGFloat paddingLeft = args[@"paddingLeft"] ? [args[@"paddingLeft"] floatValue] : 0.0;
|
|
64
|
-
stop.padding = UIEdgeInsetsMake(paddingTop, paddingLeft, paddingBottom, paddingRight);
|
|
65
|
-
|
|
66
|
-
NSTimeInterval duration = 2.0;
|
|
67
|
-
if (args[@"duration"]) {
|
|
68
|
-
duration = [MLRNUtils fromMS:args[@"duration"]];
|
|
69
|
-
}
|
|
70
|
-
stop.duration = duration;
|
|
71
|
-
|
|
72
|
-
return stop;
|
|
70
|
+
return stop;
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
@end
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
@property (nonatomic, strong) CameraStop* _Nonnull cameraStop;
|
|
7
7
|
|
|
8
|
-
- (void)execute:(MLRNMapView* _Nonnull)mapView
|
|
8
|
+
- (void)execute:(MLRNMapView* _Nonnull)mapView
|
|
9
|
+
withCompletionHandler:(nullable void (^)(void))completionHandler;
|
|
9
10
|
|
|
10
11
|
@end
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
#import "CameraUpdateItem.h"
|
|
2
2
|
#import "CameraMode.h"
|
|
3
3
|
|
|
4
|
-
@interface MLNMapView(FlyToWithPadding)
|
|
5
|
-
- (void)_flyToCamera:(MLNMapCamera *)camera
|
|
4
|
+
@interface MLNMapView (FlyToWithPadding)
|
|
5
|
+
- (void)_flyToCamera:(MLNMapCamera *)camera
|
|
6
|
+
edgePadding:(UIEdgeInsets)insets
|
|
7
|
+
withDuration:(NSTimeInterval)duration
|
|
8
|
+
peakAltitude:(CLLocationDistance)peakAltitude
|
|
9
|
+
completionHandler:(nullable void (^)(void))completion;
|
|
6
10
|
@end
|
|
7
11
|
|
|
8
12
|
@interface MLRNCameraWithPadding : MLNMapCamera
|
|
9
13
|
|
|
10
|
-
@property (nonatomic) MLNMapCamera*
|
|
14
|
+
@property (nonatomic) MLNMapCamera *_Nonnull camera;
|
|
11
15
|
@property (nonatomic) UIEdgeInsets boundsPadding;
|
|
12
16
|
|
|
13
17
|
@end
|
|
@@ -18,152 +22,148 @@
|
|
|
18
22
|
|
|
19
23
|
@implementation CameraUpdateItem
|
|
20
24
|
|
|
21
|
-
- (void)execute:(MLRNMapView *)mapView withCompletionHandler:(void (^)(void))completionHandler
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
25
|
+
- (void)execute:(MLRNMapView *)mapView withCompletionHandler:(void (^)(void))completionHandler {
|
|
26
|
+
if (_cameraStop.mode == [NSNumber numberWithInt:RCT_MAPBOX_CAMERA_MODE_FLIGHT]) {
|
|
27
|
+
[self _flyToCamera:mapView withCompletionHandler:completionHandler];
|
|
28
|
+
} else if (_cameraStop.mode == [NSNumber numberWithInt:RCT_MAPBOX_CAMERA_MODE_EASE]) {
|
|
29
|
+
[self _moveCamera:mapView animated:YES ease:YES withCompletionHandler:completionHandler];
|
|
30
|
+
} else if (_cameraStop.mode == [NSNumber numberWithInt:RCT_MAPBOX_CAMERA_MODE_LINEAR]) {
|
|
31
|
+
[self _moveCamera:mapView animated:YES ease:NO withCompletionHandler:completionHandler];
|
|
32
|
+
} else {
|
|
33
|
+
[self _moveCamera:mapView animated:NO ease:NO withCompletionHandler:completionHandler];
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
- (void)_flyToCamera:(MLRNMapView*)mapView
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
37
|
+
- (void)_flyToCamera:(MLRNMapView *)mapView
|
|
38
|
+
withCompletionHandler:(void (^)(void))completionHandler {
|
|
39
|
+
MLRNCameraWithPadding *nextCamera = [self _makeCamera:mapView];
|
|
40
|
+
|
|
41
|
+
if ([mapView respondsToSelector:@selector
|
|
42
|
+
(_flyToCamera:edgePadding:withDuration:peakAltitude:completionHandler:)]) {
|
|
43
|
+
[mapView _flyToCamera:nextCamera.camera
|
|
44
|
+
edgePadding:nextCamera.boundsPadding
|
|
45
|
+
withDuration:_cameraStop.duration
|
|
46
|
+
peakAltitude:-1
|
|
47
|
+
completionHandler:completionHandler];
|
|
48
|
+
} else {
|
|
49
|
+
[mapView flyToCamera:nextCamera.camera
|
|
50
|
+
withDuration:_cameraStop.duration
|
|
51
|
+
completionHandler:completionHandler];
|
|
52
|
+
}
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
- (void)_moveCamera:(MLRNMapView*)mapView
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
- (void)_moveCamera:(MLRNMapView *)mapView
|
|
56
|
+
animated:(BOOL)animated
|
|
57
|
+
ease:(BOOL)ease
|
|
58
|
+
withCompletionHandler:(void (^)(void))completionHandler {
|
|
59
|
+
MLRNCameraWithPadding *nextCamera = [self _makeCamera:mapView];
|
|
60
|
+
NSString *easeFunctionName =
|
|
61
|
+
ease ? kCAMediaTimingFunctionEaseInEaseOut : kCAMediaTimingFunctionLinear;
|
|
57
62
|
|
|
58
|
-
|
|
63
|
+
[mapView setCamera:nextCamera.camera
|
|
59
64
|
withDuration:animated ? _cameraStop.duration : 0
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
animationTimingFunction:[CAMediaTimingFunction functionWithName:easeFunctionName]
|
|
66
|
+
edgePadding:nextCamera.boundsPadding
|
|
67
|
+
completionHandler:completionHandler];
|
|
63
68
|
}
|
|
64
69
|
|
|
65
|
-
- (MLRNCameraWithPadding*)_makeCamera:(MLRNMapView*)mapView
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
cameraWithPadding.camera = nextCamera;
|
|
113
|
-
cameraWithPadding.boundsPadding = padding;
|
|
114
|
-
return cameraWithPadding;
|
|
70
|
+
- (MLRNCameraWithPadding *)_makeCamera:(MLRNMapView *)mapView {
|
|
71
|
+
MLNMapCamera *nextCamera = [mapView.camera copy];
|
|
72
|
+
|
|
73
|
+
UIEdgeInsets padding = [self _clippedPadding:_cameraStop.padding forView:mapView];
|
|
74
|
+
if (padding.top <= 0 && padding.bottom <= 0) {
|
|
75
|
+
// If all padding properties are 0 in the update, and the bounds and centerCoordinate do not
|
|
76
|
+
// change, the padding doesn't change either. This seems to be a bug in the iOS SDK.
|
|
77
|
+
padding.top = 1.0;
|
|
78
|
+
padding.bottom = 1.0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
bool hasSetAltitude = false;
|
|
82
|
+
|
|
83
|
+
if ([self _isCoordValid:_cameraStop.coordinate]) {
|
|
84
|
+
MLNCoordinateBounds boundsFromCoord = {.sw = _cameraStop.coordinate,
|
|
85
|
+
.ne = _cameraStop.coordinate};
|
|
86
|
+
MLNMapCamera *boundsCamera = [mapView camera:nextCamera
|
|
87
|
+
fittingCoordinateBounds:boundsFromCoord
|
|
88
|
+
edgePadding:padding];
|
|
89
|
+
nextCamera.centerCoordinate = boundsCamera.centerCoordinate;
|
|
90
|
+
} else if ([self _areBoundsValid:_cameraStop.bounds]) {
|
|
91
|
+
MLNMapCamera *boundsCamera = [mapView camera:nextCamera
|
|
92
|
+
fittingCoordinateBounds:_cameraStop.bounds
|
|
93
|
+
edgePadding:padding];
|
|
94
|
+
nextCamera.centerCoordinate = boundsCamera.centerCoordinate;
|
|
95
|
+
nextCamera.altitude = boundsCamera.altitude;
|
|
96
|
+
hasSetAltitude = true;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (_cameraStop.pitch != nil) {
|
|
100
|
+
nextCamera.pitch = [_cameraStop.pitch floatValue];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (_cameraStop.heading != nil) {
|
|
104
|
+
nextCamera.heading = [_cameraStop.heading floatValue];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (_cameraStop.zoom != nil && hasSetAltitude == false) {
|
|
108
|
+
nextCamera.altitude = [mapView altitudeFromZoom:[_cameraStop.zoom doubleValue]
|
|
109
|
+
atLatitude:nextCamera.centerCoordinate.latitude
|
|
110
|
+
atPitch:nextCamera.pitch];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
MLRNCameraWithPadding *cameraWithPadding = [[MLRNCameraWithPadding alloc] init];
|
|
114
|
+
cameraWithPadding.camera = nextCamera;
|
|
115
|
+
cameraWithPadding.boundsPadding = padding;
|
|
116
|
+
return cameraWithPadding;
|
|
115
117
|
}
|
|
116
118
|
|
|
117
|
-
- (UIEdgeInsets)_clippedPadding:(UIEdgeInsets)padding forView:(MLRNMapView*)mapView
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return result;
|
|
119
|
+
- (UIEdgeInsets)_clippedPadding:(UIEdgeInsets)padding forView:(MLRNMapView *)mapView {
|
|
120
|
+
UIEdgeInsets result = padding;
|
|
121
|
+
if ((padding.top + padding.bottom) >= mapView.frame.size.height) {
|
|
122
|
+
double totalPadding = padding.top + padding.bottom;
|
|
123
|
+
double extra = totalPadding - mapView.frame.size.height + 1.0;
|
|
124
|
+
result.top -= (padding.top * extra) / totalPadding;
|
|
125
|
+
result.bottom -= (padding.bottom * extra) / totalPadding;
|
|
126
|
+
}
|
|
127
|
+
if ((padding.left + padding.right) >= mapView.frame.size.width) {
|
|
128
|
+
double totalPadding = padding.left + padding.right;
|
|
129
|
+
double extra = totalPadding - mapView.frame.size.width + 1.0;
|
|
130
|
+
result.left -= (padding.left * extra) / totalPadding;
|
|
131
|
+
result.right -= (padding.right * extra) / totalPadding;
|
|
132
|
+
}
|
|
133
|
+
return result;
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
- (BOOL)_areBoundsValid:(MLNCoordinateBounds)bounds {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
BOOL isValid =
|
|
138
|
+
CLLocationCoordinate2DIsValid(bounds.ne) && CLLocationCoordinate2DIsValid(bounds.sw);
|
|
139
|
+
|
|
140
|
+
if (!isValid) {
|
|
141
|
+
return NO;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
CLLocationCoordinate2D ne = bounds.ne;
|
|
145
|
+
CLLocationCoordinate2D sw = bounds.sw;
|
|
146
|
+
return [self _isCoordValid:ne] && [self _isCoordValid:sw];
|
|
145
147
|
}
|
|
146
148
|
|
|
147
|
-
- (BOOL)_isCoordValid:(CLLocationCoordinate2D)coord
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return YES;
|
|
149
|
+
- (BOOL)_isCoordValid:(CLLocationCoordinate2D)coord {
|
|
150
|
+
BOOL isValid = CLLocationCoordinate2DIsValid(coord);
|
|
151
|
+
|
|
152
|
+
if (!isValid) {
|
|
153
|
+
return NO;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return YES;
|
|
156
157
|
}
|
|
157
158
|
|
|
158
|
-
- (BOOL)_hasCenterCoordAndZoom
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return [self _isCoordValid:_cameraStop.coordinate];
|
|
159
|
+
- (BOOL)_hasCenterCoordAndZoom {
|
|
160
|
+
BOOL isValid = CLLocationCoordinate2DIsValid(_cameraStop.coordinate) && _cameraStop.zoom != nil;
|
|
161
|
+
|
|
162
|
+
if (!isValid) {
|
|
163
|
+
return NO;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return [self _isCoordValid:_cameraStop.coordinate];
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
@end
|
|
@@ -1,66 +1,62 @@
|
|
|
1
1
|
#import "CameraUpdateQueue.h"
|
|
2
2
|
|
|
3
|
-
@implementation CameraUpdateQueue
|
|
4
|
-
|
|
5
|
-
NSMutableArray<CameraStop*> *queue;
|
|
3
|
+
@implementation CameraUpdateQueue {
|
|
4
|
+
NSMutableArray<CameraStop *> *queue;
|
|
6
5
|
}
|
|
7
6
|
|
|
8
|
-
- (instancetype)init
|
|
9
|
-
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return self;
|
|
7
|
+
- (instancetype)init {
|
|
8
|
+
if (self = [super init]) {
|
|
9
|
+
queue = [[NSMutableArray alloc] init];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return self;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
- (void)enqueue:(CameraStop*)cameraUpdateItem
|
|
18
|
-
|
|
19
|
-
[queue addObject:cameraUpdateItem];
|
|
15
|
+
- (void)enqueue:(CameraStop *)cameraUpdateItem {
|
|
16
|
+
[queue addObject:cameraUpdateItem];
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
- (CameraStop*)dequeue
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return stop;
|
|
19
|
+
- (CameraStop *)dequeue {
|
|
20
|
+
if ([self isEmpty]) {
|
|
21
|
+
return nil;
|
|
22
|
+
}
|
|
23
|
+
CameraStop *stop = queue.firstObject;
|
|
24
|
+
[queue removeObjectAtIndex:0];
|
|
25
|
+
return stop;
|
|
30
26
|
}
|
|
31
27
|
|
|
32
|
-
- (void)flush
|
|
33
|
-
|
|
34
|
-
[queue removeAllObjects];
|
|
28
|
+
- (void)flush {
|
|
29
|
+
[queue removeAllObjects];
|
|
35
30
|
}
|
|
36
31
|
|
|
37
|
-
- (BOOL)isEmpty
|
|
38
|
-
|
|
39
|
-
return queue.count == 0;
|
|
32
|
+
- (BOOL)isEmpty {
|
|
33
|
+
return queue.count == 0;
|
|
40
34
|
}
|
|
41
35
|
|
|
42
|
-
- (void)execute:(MLRNMapView*)mapView
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
- (void)execute:(MLRNMapView *)mapView {
|
|
37
|
+
if (mapView == nil) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if ([self isEmpty]) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
CameraStop *stop = [self dequeue];
|
|
46
|
+
if (stop == nil) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
CameraUpdateItem *item = [[CameraUpdateItem alloc] init];
|
|
51
|
+
item.cameraStop = stop;
|
|
47
52
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
53
|
+
__weak CameraUpdateQueue *weakSelf = self;
|
|
54
|
+
__weak MLRNMapView *weakMap = mapView;
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
CameraUpdateItem *item = [[CameraUpdateItem alloc] init];
|
|
58
|
-
item.cameraStop = stop;
|
|
59
|
-
|
|
60
|
-
__weak CameraUpdateQueue *weakSelf = self;
|
|
61
|
-
__weak MLRNMapView *weakMap = mapView;
|
|
62
|
-
|
|
63
|
-
[item execute:mapView withCompletionHandler:^{ [weakSelf execute:weakMap]; }];
|
|
56
|
+
[item execute:mapView
|
|
57
|
+
withCompletionHandler:^{
|
|
58
|
+
[weakSelf execute:weakMap];
|
|
59
|
+
}];
|
|
64
60
|
}
|
|
65
61
|
|
|
66
62
|
@end
|
package/ios/MLRN/FilterParser.h
CHANGED
package/ios/MLRN/FilterParser.m
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
@implementation FilterParser
|
|
5
5
|
|
|
6
|
-
+ (NSPredicate*)parse:(NSArray *)filterList
|
|
7
|
-
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return [NSPredicate predicateWithMLNJSONObject:filterList];
|
|
6
|
+
+ (NSPredicate *)parse:(NSArray *)filterList {
|
|
7
|
+
if (filterList == nil || filterList.count < 1) {
|
|
8
|
+
return nil;
|
|
9
|
+
}
|
|
10
|
+
return [NSPredicate predicateWithMLNJSONObject:filterList];
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
@end
|
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
@implementation MLRNBackgroundLayer
|
|
5
5
|
|
|
6
|
-
- (MLNStyleLayer*)makeLayer:(MLNStyle*)style
|
|
7
|
-
|
|
8
|
-
return [[MLNBackgroundStyleLayer alloc] initWithIdentifier:self.id];
|
|
6
|
+
- (MLNStyleLayer *)makeLayer:(MLNStyle *)style {
|
|
7
|
+
return [[MLNBackgroundStyleLayer alloc] initWithIdentifier:self.id];
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
- (void)addStyles
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
- (void)addStyles {
|
|
11
|
+
MLRNStyle *style = [[MLRNStyle alloc] initWithMLNStyle:self.style];
|
|
12
|
+
style.bridge = self.bridge;
|
|
13
|
+
[style backgroundLayer:(MLNBackgroundStyleLayer *)self.styleLayer
|
|
14
|
+
withReactStyle:self.reactStyle
|
|
15
|
+
isValid:^{
|
|
16
|
+
return [self isAddedToMap];
|
|
17
|
+
}];
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
@end
|
|
@@ -17,11 +17,10 @@ RCT_EXPORT_VIEW_PROPERTY(reactStyle, NSDictionary);
|
|
|
17
17
|
RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, NSNumber);
|
|
18
18
|
RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, NSNumber);
|
|
19
19
|
|
|
20
|
-
- (UIView*)view
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return layer;
|
|
20
|
+
- (UIView *)view {
|
|
21
|
+
MLRNBackgroundLayer *layer = [[MLRNBackgroundLayer alloc] init];
|
|
22
|
+
layer.bridge = self.bridge;
|
|
23
|
+
return layer;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
@end
|