@maplibre/maplibre-react-native 10.1.0 → 10.1.2

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 (185) hide show
  1. package/ios/MLRN/CameraStop.h +1 -1
  2. package/ios/MLRN/CameraStop.m +58 -60
  3. package/ios/MLRN/CameraUpdateItem.h +2 -1
  4. package/ios/MLRN/CameraUpdateItem.m +132 -132
  5. package/ios/MLRN/CameraUpdateQueue.m +43 -47
  6. package/ios/MLRN/FilterParser.h +1 -1
  7. package/ios/MLRN/FilterParser.m +5 -6
  8. package/ios/MLRN/MLRNBackgroundLayer.m +10 -9
  9. package/ios/MLRN/MLRNBackgroundLayerManager.m +4 -5
  10. package/ios/MLRN/MLRNCallout.h +1 -1
  11. package/ios/MLRN/MLRNCallout.m +37 -36
  12. package/ios/MLRN/MLRNCalloutManager.m +2 -3
  13. package/ios/MLRN/MLRNCamera.h +1 -1
  14. package/ios/MLRN/MLRNCamera.m +169 -182
  15. package/ios/MLRN/MLRNCameraManager.m +4 -6
  16. package/ios/MLRN/MLRNCircleLayer.m +17 -14
  17. package/ios/MLRN/MLRNCircleLayerManager.m +4 -5
  18. package/ios/MLRN/MLRNCustomHeaders.h +2 -2
  19. package/ios/MLRN/MLRNCustomHeaders.m +63 -63
  20. package/ios/MLRN/MLRNEvent.h +3 -3
  21. package/ios/MLRN/MLRNEvent.m +19 -24
  22. package/ios/MLRN/MLRNEventProtocol.h +1 -1
  23. package/ios/MLRN/MLRNFillExtrusionLayer.m +18 -14
  24. package/ios/MLRN/MLRNFillExtrusionLayerManager.m +4 -5
  25. package/ios/MLRN/MLRNFillLayer.m +16 -14
  26. package/ios/MLRN/MLRNFillLayerManager.m +4 -5
  27. package/ios/MLRN/MLRNHeatmapLayer.m +17 -14
  28. package/ios/MLRN/MLRNHeatmapLayerManager.m +4 -5
  29. package/ios/MLRN/MLRNImageQueue.h +4 -1
  30. package/ios/MLRN/MLRNImageQueue.m +29 -32
  31. package/ios/MLRN/MLRNImageQueueOperation.h +1 -1
  32. package/ios/MLRN/MLRNImageQueueOperation.m +92 -91
  33. package/ios/MLRN/MLRNImageSource.m +36 -38
  34. package/ios/MLRN/MLRNImageSourceManager.m +2 -3
  35. package/ios/MLRN/MLRNImageUtils.h +3 -3
  36. package/ios/MLRN/MLRNImageUtils.m +15 -14
  37. package/ios/MLRN/MLRNImages.h +0 -1
  38. package/ios/MLRN/MLRNImages.m +89 -91
  39. package/ios/MLRN/MLRNImagesManager.m +4 -5
  40. package/ios/MLRN/MLRNLayer.h +9 -11
  41. package/ios/MLRN/MLRNLayer.m +170 -182
  42. package/ios/MLRN/MLRNLight.m +21 -23
  43. package/ios/MLRN/MLRNLightManager.m +2 -3
  44. package/ios/MLRN/MLRNLineLayer.m +17 -15
  45. package/ios/MLRN/MLRNLineLayerManager.m +4 -6
  46. package/ios/MLRN/MLRNLocation.h +1 -1
  47. package/ios/MLRN/MLRNLocation.m +16 -17
  48. package/ios/MLRN/MLRNLocationManager.m +109 -124
  49. package/ios/MLRN/MLRNLocationManagerDelegate.h +3 -3
  50. package/ios/MLRN/MLRNLocationModule.h +1 -1
  51. package/ios/MLRN/MLRNLocationModule.m +40 -55
  52. package/ios/MLRN/MLRNLogging.h +1 -4
  53. package/ios/MLRN/MLRNLogging.m +84 -89
  54. package/ios/MLRN/MLRNMapTouchEvent.h +2 -2
  55. package/ios/MLRN/MLRNMapTouchEvent.m +50 -49
  56. package/ios/MLRN/MLRNMapView.h +43 -36
  57. package/ios/MLRN/MLRNMapView.m +409 -440
  58. package/ios/MLRN/MLRNMapViewManager.m +489 -502
  59. package/ios/MLRN/MLRNModule.h +1 -1
  60. package/ios/MLRN/MLRNModule.m +111 -105
  61. package/ios/MLRN/MLRNNativeUserLocation.m +24 -27
  62. package/ios/MLRN/MLRNNativeUserLocationManager.m +4 -8
  63. package/ios/MLRN/MLRNOfflineModule.h +1 -1
  64. package/ios/MLRN/MLRNOfflineModule.m +416 -421
  65. package/ios/MLRN/MLRNPointAnnotation.h +2 -2
  66. package/ios/MLRN/MLRNPointAnnotation.m +154 -175
  67. package/ios/MLRN/MLRNPointAnnotationManager.m +2 -3
  68. package/ios/MLRN/MLRNRasterLayer.m +16 -12
  69. package/ios/MLRN/MLRNRasterLayerManager.m +4 -5
  70. package/ios/MLRN/MLRNRasterSource.m +21 -17
  71. package/ios/MLRN/MLRNRasterSourceManager.m +2 -3
  72. package/ios/MLRN/MLRNShapeSource.h +17 -16
  73. package/ios/MLRN/MLRNShapeSource.m +94 -102
  74. package/ios/MLRN/MLRNShapeSourceManager.h +2 -2
  75. package/ios/MLRN/MLRNShapeSourceManager.m +86 -90
  76. package/ios/MLRN/MLRNSnapshotModule.h +1 -1
  77. package/ios/MLRN/MLRNSnapshotModule.m +51 -53
  78. package/ios/MLRN/MLRNSource.h +12 -12
  79. package/ios/MLRN/MLRNSource.m +82 -88
  80. package/ios/MLRN/MLRNStyleValue.h +1 -1
  81. package/ios/MLRN/MLRNStyleValue.m +128 -128
  82. package/ios/MLRN/MLRNSymbolLayer.m +17 -13
  83. package/ios/MLRN/MLRNSymbolLayerManager.m +4 -5
  84. package/ios/MLRN/MLRNTileSource.h +1 -1
  85. package/ios/MLRN/MLRNTileSource.m +21 -20
  86. package/ios/MLRN/MLRNUserLocation.h +1 -1
  87. package/ios/MLRN/MLRNUserLocation.m +10 -12
  88. package/ios/MLRN/MLRNUtils.h +18 -11
  89. package/ios/MLRN/MLRNUtils.m +168 -160
  90. package/ios/MLRN/MLRNVectorLayer.m +28 -34
  91. package/ios/MLRN/MLRNVectorSource.h +3 -1
  92. package/ios/MLRN/MLRNVectorSource.m +14 -11
  93. package/ios/MLRN/MLRNVectorSourceManager.h +2 -2
  94. package/ios/MLRN/MLRNVectorSourceManager.m +36 -39
  95. package/ios/MLRN/ViewManager.h +1 -1
  96. package/ios/MLRN/ViewManager.m +29 -35
  97. package/lib/commonjs/components/MarkerView.js +1 -1
  98. package/lib/commonjs/components/ShapeSource.js +2 -1
  99. package/lib/commonjs/components/ShapeSource.js.map +1 -1
  100. package/lib/commonjs/components/UserLocation.js +8 -38
  101. package/lib/commonjs/components/UserLocation.js.map +1 -1
  102. package/lib/commonjs/components/UserLocationPuck.js +52 -0
  103. package/lib/commonjs/components/UserLocationPuck.js.map +1 -0
  104. package/lib/commonjs/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +12 -9
  105. package/lib/commonjs/components/UserLocationPuckHeading.js.map +1 -0
  106. package/lib/commonjs/utils/animated/AbstractAnimatedCoordinates.js +8 -7
  107. package/lib/commonjs/utils/animated/AbstractAnimatedCoordinates.js.map +1 -1
  108. package/lib/commonjs/utils/animated/AnimatedExtractCoordinateFromArray.js +1 -2
  109. package/lib/commonjs/utils/animated/AnimatedExtractCoordinateFromArray.js.map +1 -1
  110. package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js +28 -38
  111. package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
  112. package/lib/commonjs/utils/animated/AnimatedShape.js +11 -7
  113. package/lib/commonjs/utils/animated/AnimatedShape.js.map +1 -1
  114. package/lib/module/components/MarkerView.js +1 -1
  115. package/lib/module/components/ShapeSource.js +2 -1
  116. package/lib/module/components/ShapeSource.js.map +1 -1
  117. package/lib/module/components/UserLocation.js +7 -36
  118. package/lib/module/components/UserLocation.js.map +1 -1
  119. package/lib/module/components/UserLocationPuck.js +48 -0
  120. package/lib/module/components/UserLocationPuck.js.map +1 -0
  121. package/lib/module/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +11 -7
  122. package/lib/module/components/UserLocationPuckHeading.js.map +1 -0
  123. package/lib/module/utils/animated/AbstractAnimatedCoordinates.js +8 -7
  124. package/lib/module/utils/animated/AbstractAnimatedCoordinates.js.map +1 -1
  125. package/lib/module/utils/animated/AnimatedExtractCoordinateFromArray.js +1 -3
  126. package/lib/module/utils/animated/AnimatedExtractCoordinateFromArray.js.map +1 -1
  127. package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js +29 -39
  128. package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
  129. package/lib/module/utils/animated/AnimatedShape.js +11 -7
  130. package/lib/module/utils/animated/AnimatedShape.js.map +1 -1
  131. package/lib/typescript/commonjs/src/components/MarkerView.d.ts +1 -1
  132. package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +1 -1
  133. package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
  134. package/lib/typescript/commonjs/src/components/UserLocation.d.ts +0 -1
  135. package/lib/typescript/commonjs/src/components/UserLocation.d.ts.map +1 -1
  136. package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts +9 -0
  137. package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts.map +1 -0
  138. package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts +9 -0
  139. package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts.map +1 -0
  140. package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts +12 -13
  141. package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
  142. package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +5 -4
  143. package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
  144. package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts +0 -1
  145. package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
  146. package/lib/typescript/commonjs/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts +33 -21
  147. package/lib/typescript/commonjs/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
  148. package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts +8 -5
  149. package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts.map +1 -1
  150. package/lib/typescript/module/src/components/MarkerView.d.ts +1 -1
  151. package/lib/typescript/module/src/components/ShapeSource.d.ts +1 -1
  152. package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
  153. package/lib/typescript/module/src/components/UserLocation.d.ts +0 -1
  154. package/lib/typescript/module/src/components/UserLocation.d.ts.map +1 -1
  155. package/lib/typescript/module/src/components/UserLocationPuck.d.ts +9 -0
  156. package/lib/typescript/module/src/components/UserLocationPuck.d.ts.map +1 -0
  157. package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts +9 -0
  158. package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts.map +1 -0
  159. package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts +12 -13
  160. package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
  161. package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +5 -4
  162. package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
  163. package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts +0 -1
  164. package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
  165. package/lib/typescript/module/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts +33 -21
  166. package/lib/typescript/module/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
  167. package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts +8 -5
  168. package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts.map +1 -1
  169. package/package.json +8 -8
  170. package/src/components/MarkerView.tsx +1 -1
  171. package/src/components/ShapeSource.tsx +58 -53
  172. package/src/components/UserLocation.tsx +13 -51
  173. package/src/components/UserLocationPuck.tsx +62 -0
  174. package/src/components/UserLocationPuckHeading.tsx +33 -0
  175. package/src/utils/animated/AbstractAnimatedCoordinates.ts +26 -15
  176. package/src/utils/animated/AnimatedExtractCoordinateFromArray.ts +10 -6
  177. package/src/utils/animated/AnimatedRouteCoordinatesArray.ts +63 -51
  178. package/src/utils/animated/AnimatedShape.ts +22 -13
  179. package/lib/commonjs/components/HeadingIndicator.js.map +0 -1
  180. package/lib/module/components/HeadingIndicator.js.map +0 -1
  181. package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts +0 -7
  182. package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts.map +0 -1
  183. package/lib/typescript/module/src/components/HeadingIndicator.d.ts +0 -7
  184. package/lib/typescript/module/src/components/HeadingIndicator.d.ts.map +0 -1
  185. package/src/components/HeadingIndicator.tsx +0 -26
@@ -1,11 +1,11 @@
1
1
  #import <React/RCTComponent.h>
2
- #import <UIKit/UIKit.h>
3
2
  #import <React/RCTView.h>
3
+ #import <UIKit/UIKit.h>
4
4
  #import "MLRNCallout.h"
5
5
 
6
6
  @import MapLibre;
7
7
 
8
- @interface MLRNPointAnnotation : MLNAnnotationView<MLNAnnotation>
8
+ @interface MLRNPointAnnotation : MLNAnnotationView <MLNAnnotation>
9
9
 
10
10
  @property (nonatomic, weak) MLNMapView *map;
11
11
  @property (nonatomic, strong) MLRNCallout *calloutView;
@@ -1,243 +1,222 @@
1
1
  #import "MLRNPointAnnotation.h"
2
+ #import <React/UIView+React.h>
2
3
  #import "MLRNMapTouchEvent.h"
3
4
  #import "MLRNUtils.h"
4
- #import <React/UIView+React.h>
5
5
 
6
6
  const float CENTER_X_OFFSET_BASE = -0.5f;
7
7
  const float CENTER_Y_OFFSET_BASE = -0.5f;
8
8
 
9
- @implementation MLRNPointAnnotation
10
- {
11
- UITapGestureRecognizer *customViewTap;
9
+ @implementation MLRNPointAnnotation {
10
+ UITapGestureRecognizer *customViewTap;
12
11
  }
13
12
 
14
- - (id)init
15
- {
16
- if (self = [super init]) {
17
- customViewTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_handleTap:)];
18
- }
19
- return self;
13
+ - (id)init {
14
+ if (self = [super init]) {
15
+ customViewTap = [[UITapGestureRecognizer alloc] initWithTarget:self
16
+ action:@selector(_handleTap:)];
17
+ }
18
+ return self;
20
19
  }
21
20
 
22
- - (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex
23
- {
24
- if ([subview isKindOfClass:[MLRNCallout class]]) {
25
- self.calloutView = (MLRNCallout *)subview;
26
- self.calloutView.representedObject = self;
27
- } else {
28
- [super insertReactSubview:subview atIndex:0];
29
- }
21
+ - (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex {
22
+ if ([subview isKindOfClass:[MLRNCallout class]]) {
23
+ self.calloutView = (MLRNCallout *)subview;
24
+ self.calloutView.representedObject = self;
25
+ } else {
26
+ [super insertReactSubview:subview atIndex:0];
27
+ }
30
28
  }
31
29
 
32
- - (void)removeReactSubview:(UIView *)subview
33
- {
34
- if ([subview isKindOfClass:[MLRNCallout class]]) {
35
- self.calloutView = nil;
36
- } else {
37
- [super removeReactSubview:subview];
38
- }
30
+ - (void)removeReactSubview:(UIView *)subview {
31
+ if ([subview isKindOfClass:[MLRNCallout class]]) {
32
+ self.calloutView = nil;
33
+ } else {
34
+ [super removeReactSubview:subview];
35
+ }
39
36
  }
40
37
 
41
- - (void)reactSetFrame:(CGRect)frame
42
- {
43
- if ([_map.annotations containsObject:self]) {
44
- [_map removeAnnotation:self];
45
- }
46
- [super reactSetFrame:frame];
47
- [self _setCenterOffset:frame];
48
- [self _addAnnotation];
38
+ - (void)reactSetFrame:(CGRect)frame {
39
+ if ([_map.annotations containsObject:self]) {
40
+ [_map removeAnnotation:self];
41
+ }
42
+ [super reactSetFrame:frame];
43
+ [self _setCenterOffset:frame];
44
+ [self _addAnnotation];
49
45
  }
50
46
 
51
- - (void)setAnchor:(NSDictionary<NSString *, NSNumber *> *)anchor
52
- {
53
- _anchor = anchor;
54
- [self _setCenterOffset:self.frame];
47
+ - (void)setAnchor:(NSDictionary<NSString *, NSNumber *> *)anchor {
48
+ _anchor = anchor;
49
+ [self _setCenterOffset:self.frame];
55
50
  }
56
51
 
57
- - (void)setMap:(MLNMapView *)map
58
- {
59
- if (map == nil) {
60
- [_map removeAnnotation:self];
61
- _map = nil;
62
- } else {
63
- _map = map;
64
-
65
- // prevents annotations from flying in from the top left corner
66
- // if the frame hasn't been set yet
67
- if (![self _isFrameSet]) {
68
- return;
69
- }
52
+ - (void)setMap:(MLNMapView *)map {
53
+ if (map == nil) {
54
+ [_map removeAnnotation:self];
55
+ _map = nil;
56
+ } else {
57
+ _map = map;
70
58
 
71
- [self _addAnnotation];
59
+ // prevents annotations from flying in from the top left corner
60
+ // if the frame hasn't been set yet
61
+ if (![self _isFrameSet]) {
62
+ return;
72
63
  }
64
+
65
+ [self _addAnnotation];
66
+ }
73
67
  }
74
68
 
75
- - (void)setReactSelected:(BOOL)reactSelected
76
- {
77
- _reactSelected = reactSelected;
69
+ - (void)setReactSelected:(BOOL)reactSelected {
70
+ _reactSelected = reactSelected;
78
71
 
79
- if (_map != nil) {
80
- if (_reactSelected) {
81
- [_map selectAnnotation:self animated:NO completionHandler:nil];
82
- } else {
83
- [_map deselectAnnotation:self animated:NO];
84
- }
72
+ if (_map != nil) {
73
+ if (_reactSelected) {
74
+ [_map selectAnnotation:self animated:NO completionHandler:nil];
75
+ } else {
76
+ [_map deselectAnnotation:self animated:NO];
85
77
  }
78
+ }
86
79
  }
87
80
 
88
- - (void)setReactDraggable:(BOOL)reactDraggable
89
- {
90
- _reactDraggable = reactDraggable;
91
- self.draggable = _reactDraggable;
81
+ - (void)setReactDraggable:(BOOL)reactDraggable {
82
+ _reactDraggable = reactDraggable;
83
+ self.draggable = _reactDraggable;
92
84
  }
93
85
 
94
- - (void)setReactCoordinate:(NSString *)reactCoordinate
95
- {
96
- _reactCoordinate = reactCoordinate;
97
- [self _updateCoordinate];
86
+ - (void)setReactCoordinate:(NSString *)reactCoordinate {
87
+ _reactCoordinate = reactCoordinate;
88
+ [self _updateCoordinate];
98
89
  }
99
90
 
100
- - (NSString *)reuseIdentifier
101
- {
102
- return _id;
91
+ - (NSString *)reuseIdentifier {
92
+ return _id;
103
93
  }
104
94
 
105
- - (NSString *)title
106
- {
107
- return _reactTitle;
95
+ - (NSString *)title {
96
+ return _reactTitle;
108
97
  }
109
98
 
110
- - (NSString *)subtitle
111
- {
112
- return _reactSnippet;
99
+ - (NSString *)subtitle {
100
+ return _reactSnippet;
113
101
  }
114
102
 
115
- - (NSString *)toolTip
116
- {
117
- return _reactTitle;
103
+ - (NSString *)toolTip {
104
+ return _reactTitle;
118
105
  }
119
106
 
120
- - (MLNAnnotationView *)getAnnotationView
121
- {
122
- if (self.reactSubviews.count == 0) {
123
- // default pin view
124
- return nil;
125
- } else {
126
- // custom view
127
- self.enabled = YES;
128
- const CGFloat defaultZPosition = 0.0;
129
- if (self.layer.zPosition == defaultZPosition) {
130
- self.layer.zPosition = [self _getZPosition];
131
- }
132
- [self addGestureRecognizer:customViewTap];
133
- return self;
107
+ - (MLNAnnotationView *)getAnnotationView {
108
+ if (self.reactSubviews.count == 0) {
109
+ // default pin view
110
+ return nil;
111
+ } else {
112
+ // custom view
113
+ self.enabled = YES;
114
+ const CGFloat defaultZPosition = 0.0;
115
+ if (self.layer.zPosition == defaultZPosition) {
116
+ self.layer.zPosition = [self _getZPosition];
134
117
  }
118
+ [self addGestureRecognizer:customViewTap];
119
+ return self;
120
+ }
135
121
  }
136
122
 
137
- - (CGFloat)_getZPosition
138
- {
139
- double latitudeMax = 90.0;
140
- return latitudeMax - self.coordinate.latitude;
123
+ - (CGFloat)_getZPosition {
124
+ double latitudeMax = 90.0;
125
+ return latitudeMax - self.coordinate.latitude;
141
126
  }
142
127
 
143
- - (void)_handleTap:(UITapGestureRecognizer *)recognizer
144
- {
145
- [_map selectAnnotation:self animated:NO completionHandler:nil];
128
+ - (void)_handleTap:(UITapGestureRecognizer *)recognizer {
129
+ [_map selectAnnotation:self animated:NO completionHandler:nil];
146
130
  }
147
131
 
148
- - (void)_setCenterOffset:(CGRect)frame
149
- {
150
- if (frame.size.width == 0 || frame.size.height == 0 || _anchor == nil) {
151
- return;
152
- }
132
+ - (void)_setCenterOffset:(CGRect)frame {
133
+ if (frame.size.width == 0 || frame.size.height == 0 || _anchor == nil) {
134
+ return;
135
+ }
153
136
 
154
- float x = [_anchor[@"x"] floatValue];
155
- float y = [_anchor[@"y"] floatValue];
137
+ float x = [_anchor[@"x"] floatValue];
138
+ float y = [_anchor[@"y"] floatValue];
156
139
 
157
- float dx = -(x * frame.size.width - (frame.size.width / 2));
158
- float dy = -(y * frame.size.height - (frame.size.height / 2));
140
+ float dx = -(x * frame.size.width - (frame.size.width / 2));
141
+ float dy = -(y * frame.size.height - (frame.size.height / 2));
159
142
 
160
- // special cases 0 and 1
143
+ // special cases 0 and 1
161
144
 
162
- if (x == 0) {
163
- dx = frame.size.width / 2;
164
- } else if (x == 1) {
165
- dx = -frame.size.width / 2;
166
- }
145
+ if (x == 0) {
146
+ dx = frame.size.width / 2;
147
+ } else if (x == 1) {
148
+ dx = -frame.size.width / 2;
149
+ }
167
150
 
168
- if (y == 0) {
169
- dy = frame.size.height / 2;
170
- } else if (y == 1) {
171
- dy = -frame.size.height / 2;
172
- }
151
+ if (y == 0) {
152
+ dy = frame.size.height / 2;
153
+ } else if (y == 1) {
154
+ dy = -frame.size.height / 2;
155
+ }
173
156
 
174
- self.centerOffset = CGVectorMake(dx, dy);
157
+ self.centerOffset = CGVectorMake(dx, dy);
175
158
  }
176
159
 
160
+ - (void)_updateCoordinate {
161
+ if (_reactCoordinate == nil) {
162
+ return;
163
+ }
177
164
 
178
- - (void)_updateCoordinate
179
- {
180
- if (_reactCoordinate == nil) {
181
- return;
182
- }
183
-
184
- MLNPointFeature *feature = (MLNPointFeature *)[MLRNUtils shapeFromGeoJSON:_reactCoordinate];
185
- if (feature == nil) {
186
- return;
187
- }
165
+ MLNPointFeature *feature = (MLNPointFeature *)[MLRNUtils shapeFromGeoJSON:_reactCoordinate];
166
+ if (feature == nil) {
167
+ return;
168
+ }
188
169
 
189
- dispatch_async(dispatch_get_main_queue(), ^{
190
- self.coordinate = feature.coordinate;
191
- });
170
+ dispatch_async(dispatch_get_main_queue(), ^{
171
+ self.coordinate = feature.coordinate;
172
+ });
192
173
  }
193
174
 
194
- - (void)_addAnnotation
195
- {
196
- if ([_map.annotations containsObject:self]) {
197
- return;
198
- }
175
+ - (void)_addAnnotation {
176
+ if ([_map.annotations containsObject:self]) {
177
+ return;
178
+ }
199
179
 
200
- [_map addAnnotation:self];
201
- if (_reactSelected) {
202
- [_map selectAnnotation:self animated:NO completionHandler:nil];
203
- }
180
+ [_map addAnnotation:self];
181
+ if (_reactSelected) {
182
+ [_map selectAnnotation:self animated:NO completionHandler:nil];
183
+ }
204
184
  }
205
185
 
206
- - (BOOL)_isFrameSet
207
- {
208
- return self.frame.size.width > 0 && self.frame.size.height > 0;
186
+ - (BOOL)_isFrameSet {
187
+ return self.frame.size.width > 0 && self.frame.size.height > 0;
209
188
  }
210
189
 
211
190
  - (void)setDragState:(MLNAnnotationViewDragState)dragState animated:(BOOL)animated {
212
- [super setDragState:dragState animated:animated];
213
- switch (dragState) {
214
- case MLNAnnotationViewDragStateStarting: {
215
- if (self.onDragStart != nil) {
216
- MLRNMapTouchEvent *event = [MLRNMapTouchEvent makeAnnotationTapEvent:self];
217
- self.onDragStart([event toJSON]);
218
- }
219
- break;
220
- }
221
-
222
- case MLNAnnotationViewDragStateDragging:
223
- if (self.onDrag != nil) {
224
- MLRNMapTouchEvent *event = [MLRNMapTouchEvent makeAnnotationTapEventOnDrag:self];
225
- self.onDrag([event toJSON]);
226
- }
227
- break;
228
-
229
- case MLNAnnotationViewDragStateEnding:
230
- case MLNAnnotationViewDragStateCanceling: {
231
- if (self.onDragEnd != nil) {
232
- MLRNMapTouchEvent *event = [MLRNMapTouchEvent makeAnnotationTapEvent:self];
233
- self.onDragEnd([event toJSON]);
234
- }
235
- break;
236
- }
237
-
238
- case MLNAnnotationViewDragStateNone:
239
- return;
191
+ [super setDragState:dragState animated:animated];
192
+ switch (dragState) {
193
+ case MLNAnnotationViewDragStateStarting: {
194
+ if (self.onDragStart != nil) {
195
+ MLRNMapTouchEvent *event = [MLRNMapTouchEvent makeAnnotationTapEvent:self];
196
+ self.onDragStart([event toJSON]);
197
+ }
198
+ break;
199
+ }
200
+
201
+ case MLNAnnotationViewDragStateDragging:
202
+ if (self.onDrag != nil) {
203
+ MLRNMapTouchEvent *event = [MLRNMapTouchEvent makeAnnotationTapEventOnDrag:self];
204
+ self.onDrag([event toJSON]);
205
+ }
206
+ break;
207
+
208
+ case MLNAnnotationViewDragStateEnding:
209
+ case MLNAnnotationViewDragStateCanceling: {
210
+ if (self.onDragEnd != nil) {
211
+ MLRNMapTouchEvent *event = [MLRNMapTouchEvent makeAnnotationTapEvent:self];
212
+ self.onDragEnd([event toJSON]);
213
+ }
214
+ break;
240
215
  }
216
+
217
+ case MLNAnnotationViewDragStateNone:
218
+ return;
219
+ }
241
220
  }
242
221
 
243
222
  @end
@@ -20,9 +20,8 @@ RCT_REMAP_VIEW_PROPERTY(onMapboxPointAnnotationDragStart, onDragStart, RCTBubbli
20
20
  RCT_REMAP_VIEW_PROPERTY(onMapboxPointAnnotationDrag, onDrag, RCTBubblingEventBlock)
21
21
  RCT_REMAP_VIEW_PROPERTY(onMapboxPointAnnotationDragEnd, onDragEnd, RCTBubblingEventBlock)
22
22
 
23
- - (UIView *)view
24
- {
25
- return [[MLRNPointAnnotation alloc] init];
23
+ - (UIView *)view {
24
+ return [[MLRNPointAnnotation alloc] init];
26
25
  }
27
26
 
28
27
  @end
@@ -3,20 +3,24 @@
3
3
 
4
4
  @implementation MLRNRasterLayer
5
5
 
6
- - (MLNStyleLayer*)makeLayer:(MLNStyle*)style
7
- {
8
- MLNSource *source = [style sourceWithIdentifier:self.sourceID];
9
- if (source == nil) { return nil; }
10
- MLNRasterStyleLayer *layer = [[MLNRasterStyleLayer alloc] initWithIdentifier:self.id source:source];
11
- return layer;
6
+ - (MLNStyleLayer *)makeLayer:(MLNStyle *)style {
7
+ MLNSource *source = [style sourceWithIdentifier:self.sourceID];
8
+ if (source == nil) {
9
+ return nil;
10
+ }
11
+ MLNRasterStyleLayer *layer = [[MLNRasterStyleLayer alloc] initWithIdentifier:self.id
12
+ source:source];
13
+ return layer;
12
14
  }
13
15
 
14
- - (void)addStyles
15
- {
16
- MLRNStyle *style = [[MLRNStyle alloc] initWithMLNStyle:self.style];
17
- style.bridge = self.bridge;
18
- [style rasterLayer:(MLNRasterStyleLayer*)self.styleLayer withReactStyle:self.reactStyle isValid:^{ return [self isAddedToMap];
19
- }];
16
+ - (void)addStyles {
17
+ MLRNStyle *style = [[MLRNStyle alloc] initWithMLNStyle:self.style];
18
+ style.bridge = self.bridge;
19
+ [style rasterLayer:(MLNRasterStyleLayer *)self.styleLayer
20
+ withReactStyle:self.reactStyle
21
+ isValid:^{
22
+ return [self isAddedToMap];
23
+ }];
20
24
  }
21
25
 
22
26
  @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
- MLRNRasterLayer *layer = [[MLRNRasterLayer alloc] init];
23
- layer.bridge = self.bridge;
24
- return layer;
20
+ - (UIView *)view {
21
+ MLRNRasterLayer *layer = [[MLRNRasterLayer alloc] init];
22
+ layer.bridge = self.bridge;
23
+ return layer;
25
24
  }
26
25
 
27
26
  @end
@@ -2,26 +2,30 @@
2
2
 
3
3
  @implementation MLRNRasterSource
4
4
 
5
- - (nullable MLNSource*)makeSource
6
- {
7
- if (self.url != nil) {
8
- NSURL *url = [NSURL URLWithString:self.url];
9
- if (self.tileSize != nil) {
10
- return [[MLNRasterTileSource alloc] initWithIdentifier:self.id configurationURL:url tileSize:[self.tileSize floatValue]];
11
- }
12
- return [[MLNRasterTileSource alloc] initWithIdentifier:self.id configurationURL:url];
5
+ - (nullable MLNSource *)makeSource {
6
+ if (self.url != nil) {
7
+ NSURL *url = [NSURL URLWithString:self.url];
8
+ if (self.tileSize != nil) {
9
+ return [[MLNRasterTileSource alloc] initWithIdentifier:self.id
10
+ configurationURL:url
11
+ tileSize:[self.tileSize floatValue]];
13
12
  }
14
- return [[MLNRasterTileSource alloc] initWithIdentifier:self.id tileURLTemplates:self.tileUrlTemplates options:[self getOptions]];
13
+ return [[MLNRasterTileSource alloc] initWithIdentifier:self.id configurationURL:url];
14
+ }
15
+ return [[MLNRasterTileSource alloc] initWithIdentifier:self.id
16
+ tileURLTemplates:self.tileUrlTemplates
17
+ options:[self getOptions]];
15
18
  }
16
19
 
17
- - (NSDictionary<MLNTileSourceOption,id> *)getOptions {
18
- NSMutableDictionary<MLNTileSourceOption, id> *options = [[NSMutableDictionary alloc] initWithDictionary:[super getOptions]];
19
-
20
- if (self.tileSize != nil) {
21
- options[MLNTileSourceOptionTileSize] = _tileSize;
22
- }
23
-
24
- return options;
20
+ - (NSDictionary<MLNTileSourceOption, id> *)getOptions {
21
+ NSMutableDictionary<MLNTileSourceOption, id> *options =
22
+ [[NSMutableDictionary alloc] initWithDictionary:[super getOptions]];
23
+
24
+ if (self.tileSize != nil) {
25
+ options[MLNTileSourceOptionTileSize] = _tileSize;
26
+ }
27
+
28
+ return options;
25
29
  }
26
30
 
27
31
  @end
@@ -16,9 +16,8 @@ RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, NSNumber)
16
16
 
17
17
  RCT_EXPORT_VIEW_PROPERTY(tms, BOOL)
18
18
 
19
- - (UIView*)view
20
- {
21
- return [MLRNRasterSource new];
19
+ - (UIView*)view {
20
+ return [MLRNRasterSource new];
22
21
  }
23
22
 
24
23
  @end
@@ -7,27 +7,28 @@
7
7
 
8
8
  @property (nonatomic, weak) RCTBridge *bridge;
9
9
 
10
- @property (nonatomic, copy) NSString *url;
11
- @property (nonatomic, copy) NSString *shape;
10
+ @property (nonatomic, copy, nullable) NSString *url;
11
+ @property (nonatomic, copy, nullable) NSString *shape;
12
12
 
13
- @property (nonatomic, strong) NSNumber *cluster;
14
- @property (nonatomic, strong) NSNumber *clusterRadius;
15
- @property (nonatomic, strong) NSNumber *clusterMaxZoomLevel;
16
- @property (nonatomic, strong) NSDictionary<NSString *, NSArray<NSExpression *> *> *clusterProperties;
13
+ @property (nonatomic, strong, nullable) NSNumber *cluster;
14
+ @property (nonatomic, strong, nullable) NSNumber *clusterRadius;
15
+ @property (nonatomic, strong, nullable) NSNumber *clusterMaxZoomLevel;
16
+ @property (nonatomic, strong, nullable)
17
+ NSDictionary<NSString *, NSArray<NSExpression *> *> *clusterProperties;
17
18
 
18
- @property (nonatomic, strong) NSNumber *maxZoomLevel;
19
- @property (nonatomic, strong) NSNumber *buffer;
20
- @property (nonatomic, strong) NSNumber *tolerance;
21
- @property (nonatomic, strong) NSNumber *lineMetrics;
19
+ @property (nonatomic, strong, nullable) NSNumber *maxZoomLevel;
20
+ @property (nonatomic, strong, nullable) NSNumber *buffer;
21
+ @property (nonatomic, strong, nullable) NSNumber *tolerance;
22
+ @property (nonatomic, strong, nullable) NSNumber *lineMetrics;
22
23
 
23
- @property (nonatomic, copy) RCTBubblingEventBlock onPress;
24
+ @property (nonatomic, copy, nullable) RCTBubblingEventBlock onPress;
24
25
  @property (nonatomic, assign) BOOL hasPressListener;
25
26
 
26
- - (nonnull NSArray<id <MLNFeature>> *)featuresMatchingPredicate:(nullable NSPredicate *)predicate;
27
- - (nonnull NSArray<id <MLNFeature>> *)getClusterLeaves:(nonnull NSString *)featureJSON
28
- number:(NSUInteger)number
29
- offset:(NSUInteger)offset;
30
- - (nonnull NSArray<id <MLNFeature>> *)getClusterChildren:(nonnull NSString *)featureJSON;
27
+ - (nonnull NSArray<id<MLNFeature>> *)featuresMatchingPredicate:(nullable NSPredicate *)predicate;
28
+ - (nonnull NSArray<id<MLNFeature>> *)getClusterLeaves:(nonnull NSString *)featureJSON
29
+ number:(NSUInteger)number
30
+ offset:(NSUInteger)offset;
31
+ - (nonnull NSArray<id<MLNFeature>> *)getClusterChildren:(nonnull NSString *)featureJSON;
31
32
 
32
33
  - (double)getClusterExpansionZoom:(nonnull NSString *)featureJSON;
33
34