@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.
- 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/ShapeSource.js +2 -1
- package/lib/commonjs/components/ShapeSource.js.map +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/commonjs/utils/animated/AbstractAnimatedCoordinates.js +8 -7
- package/lib/commonjs/utils/animated/AbstractAnimatedCoordinates.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedExtractCoordinateFromArray.js +1 -2
- package/lib/commonjs/utils/animated/AnimatedExtractCoordinateFromArray.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js +28 -38
- package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedShape.js +11 -7
- package/lib/commonjs/utils/animated/AnimatedShape.js.map +1 -1
- package/lib/module/components/MarkerView.js +1 -1
- package/lib/module/components/ShapeSource.js +2 -1
- package/lib/module/components/ShapeSource.js.map +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/module/utils/animated/AbstractAnimatedCoordinates.js +8 -7
- package/lib/module/utils/animated/AbstractAnimatedCoordinates.js.map +1 -1
- package/lib/module/utils/animated/AnimatedExtractCoordinateFromArray.js +1 -3
- package/lib/module/utils/animated/AnimatedExtractCoordinateFromArray.js.map +1 -1
- package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js +29 -39
- package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
- package/lib/module/utils/animated/AnimatedShape.js +11 -7
- package/lib/module/utils/animated/AnimatedShape.js.map +1 -1
- package/lib/typescript/commonjs/src/components/MarkerView.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +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 +12 -13
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +5 -4
- 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/AnimatedRouteCoordinatesArray.d.ts +33 -21
- package/lib/typescript/commonjs/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts +8 -5
- 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/ShapeSource.d.ts +1 -1
- package/lib/typescript/module/src/components/ShapeSource.d.ts.map +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 +12 -13
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +5 -4
- 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/AnimatedRouteCoordinatesArray.d.ts +33 -21
- package/lib/typescript/module/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts +8 -5
- 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/ShapeSource.tsx +58 -53
- package/src/components/UserLocation.tsx +13 -51
- package/src/components/UserLocationPuck.tsx +62 -0
- package/src/components/UserLocationPuckHeading.tsx +33 -0
- package/src/utils/animated/AbstractAnimatedCoordinates.ts +26 -15
- package/src/utils/animated/AnimatedExtractCoordinateFromArray.ts +10 -6
- package/src/utils/animated/AnimatedRouteCoordinatesArray.ts +63 -51
- package/src/utils/animated/AnimatedShape.ts +22 -13
- 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
|
@@ -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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
|
|
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
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
132
|
+
- (void)_setCenterOffset:(CGRect)frame {
|
|
133
|
+
if (frame.size.width == 0 || frame.size.height == 0 || _anchor == nil) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
153
136
|
|
|
154
|
-
|
|
155
|
-
|
|
137
|
+
float x = [_anchor[@"x"] floatValue];
|
|
138
|
+
float y = [_anchor[@"y"] floatValue];
|
|
156
139
|
|
|
157
|
-
|
|
158
|
-
|
|
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
|
-
|
|
143
|
+
// special cases 0 and 1
|
|
161
144
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
|
|
157
|
+
self.centerOffset = CGVectorMake(dx, dy);
|
|
175
158
|
}
|
|
176
159
|
|
|
160
|
+
- (void)_updateCoordinate {
|
|
161
|
+
if (_reactCoordinate == nil) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
177
164
|
|
|
178
|
-
|
|
179
|
-
{
|
|
180
|
-
|
|
181
|
-
|
|
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
|
-
|
|
190
|
-
|
|
191
|
-
|
|
170
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
171
|
+
self.coordinate = feature.coordinate;
|
|
172
|
+
});
|
|
192
173
|
}
|
|
193
174
|
|
|
194
|
-
- (void)_addAnnotation
|
|
195
|
-
{
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
175
|
+
- (void)_addAnnotation {
|
|
176
|
+
if ([_map.annotations containsObject:self]) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
199
179
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
23
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
@@ -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)
|
|
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
|
|
27
|
-
- (nonnull NSArray<id
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- (nonnull NSArray<id
|
|
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
|
|