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