@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
package/ios/MLRN/MLRNCallout.m
CHANGED
|
@@ -1,66 +1,67 @@
|
|
|
1
1
|
#import "MLRNCallout.h"
|
|
2
2
|
#import <React/UIView+React.h>
|
|
3
3
|
|
|
4
|
-
@implementation MLRNCallout
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
BOOL _anchoredToAnnotation;
|
|
4
|
+
@implementation MLRNCallout {
|
|
5
|
+
id<MLNAnnotation> _representedObject;
|
|
6
|
+
__unused UIView *_leftAccessoryView; /* unused */
|
|
7
|
+
__unused UIView *_rightAccessoryView; /* unused */
|
|
8
|
+
__weak id<MLNCalloutViewDelegate> _delegate;
|
|
9
|
+
BOOL _dismissesAutomatically;
|
|
10
|
+
BOOL _anchoredToAnnotation;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
@synthesize representedObject = _representedObject;
|
|
15
|
-
@synthesize leftAccessoryView = _leftAccessoryView
|
|
16
|
-
@synthesize rightAccessoryView = _rightAccessoryView
|
|
14
|
+
@synthesize leftAccessoryView = _leftAccessoryView; /* unused */
|
|
15
|
+
@synthesize rightAccessoryView = _rightAccessoryView; /* unused */
|
|
17
16
|
@synthesize delegate = _delegate;
|
|
18
17
|
@synthesize anchoredToAnnotation = _anchoredToAnnotation;
|
|
19
18
|
@synthesize dismissesAutomatically = _dismissesAutomatically;
|
|
20
19
|
|
|
21
|
-
- (instancetype)init
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
- (instancetype)init {
|
|
21
|
+
if (self = [super init]) {
|
|
22
|
+
// prevent tap from bubbling up to it's superview
|
|
23
|
+
UITapGestureRecognizer *captureTap = [[UITapGestureRecognizer alloc] initWithTarget:self
|
|
24
|
+
action:nil];
|
|
25
|
+
[self addGestureRecognizer:captureTap];
|
|
26
|
+
}
|
|
27
|
+
return self;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
// https://github.com/mapbox/mapbox-gl-native/issues/9228
|
|
32
31
|
- (void)setCenter:(CGPoint)center {
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
center.y = center.y - CGRectGetMidY(self.bounds);
|
|
33
|
+
[super setCenter:center];
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
- (void)presentCalloutFromRect:(CGRect)rect
|
|
36
|
+
- (void)presentCalloutFromRect:(CGRect)rect
|
|
37
|
+
inView:(UIView *)view
|
|
38
|
+
constrainedToRect:(CGRect)constrainedRect
|
|
39
|
+
animated:(BOOL)animated;
|
|
38
40
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
// we want to attach to our parents parent to be on the same zPosition stack, so the callout will
|
|
42
|
+
// appear over other custom views
|
|
43
|
+
[view.superview addSubview:self];
|
|
44
|
+
|
|
45
|
+
// adjust frame
|
|
46
|
+
double centerX = rect.origin.x + (rect.size.width / 2);
|
|
47
|
+
CGPoint center = CGPointMake(centerX, rect.origin.y);
|
|
48
|
+
[self setCenter:center];
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
- (void)dismissCalloutAnimated:(BOOL)animated
|
|
49
|
-
|
|
50
|
-
[self removeFromSuperview];
|
|
51
|
+
- (void)dismissCalloutAnimated:(BOOL)animated {
|
|
52
|
+
[self removeFromSuperview];
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
- (BOOL)dismissesAutomatically {
|
|
54
|
-
|
|
56
|
+
return NO;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
- (BOOL)isAnchoredToAnnotation {
|
|
58
|
-
|
|
60
|
+
return YES;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
- (void)update
|
|
62
|
-
|
|
63
|
-
[self setCenter:self.center];
|
|
63
|
+
- (void)update {
|
|
64
|
+
[self setCenter:self.center];
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
@end
|
package/ios/MLRN/MLRNCamera.h
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
@class MLRNMapView;
|
|
6
6
|
|
|
7
|
-
@interface MLRNCamera : UIView<MLRNMapViewCamera>
|
|
7
|
+
@interface MLRNCamera : UIView <MLRNMapViewCamera>
|
|
8
8
|
|
|
9
9
|
@property (nonatomic, strong) NSDictionary<NSString *, id> *stop;
|
|
10
10
|
@property (nonatomic, strong) NSDictionary<NSString *, id> *defaultStop;
|
package/ios/MLRN/MLRNCamera.m
CHANGED
|
@@ -1,249 +1,236 @@
|
|
|
1
1
|
#import "MLRNCamera.h"
|
|
2
|
+
#import "CameraMode.h"
|
|
2
3
|
#import "CameraStop.h"
|
|
3
4
|
#import "CameraUpdateQueue.h"
|
|
4
|
-
#import "MLRNLocation.h"
|
|
5
|
-
#import "MLRNUtils.h"
|
|
6
|
-
#import "MLRNLocationManager.h"
|
|
7
5
|
#import "MLRNEvent.h"
|
|
8
6
|
#import "MLRNEventTypes.h"
|
|
9
|
-
#import "
|
|
7
|
+
#import "MLRNLocation.h"
|
|
8
|
+
#import "MLRNLocationManager.h"
|
|
9
|
+
#import "MLRNUtils.h"
|
|
10
10
|
|
|
11
|
-
@implementation MLRNCamera
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
MLRNCamera *followCamera;
|
|
11
|
+
@implementation MLRNCamera {
|
|
12
|
+
CameraUpdateQueue *cameraUpdateQueue;
|
|
13
|
+
MLRNCamera *followCamera;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
- (instancetype)init
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return self;
|
|
16
|
+
- (instancetype)init {
|
|
17
|
+
if (self = [super init]) {
|
|
18
|
+
cameraUpdateQueue = [[CameraUpdateQueue alloc] init];
|
|
19
|
+
}
|
|
20
|
+
return self;
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
- (void)dealloc {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
if (_map) {
|
|
25
|
+
_map.reactCamera = nil;
|
|
26
|
+
}
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
- (void)setMaxZoomLevel:(NSNumber *)maxZoomLevel {
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
_maxZoomLevel = maxZoomLevel;
|
|
31
|
+
[self _updateMinMaxZoomLevel];
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
- (void)setMinZoomLevel:(NSNumber *)minZoomLevel {
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
_minZoomLevel = minZoomLevel;
|
|
36
|
+
[self _updateMinMaxZoomLevel];
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
- (void)setMaxBounds:(NSString *)maxBounds {
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
_maxBounds = maxBounds;
|
|
41
|
+
[self _updateMaxBounds];
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
- (void)setDefaultStop:(NSDictionary<NSString *,id> *)stop
|
|
47
|
-
|
|
48
|
-
_defaultStop = stop;
|
|
44
|
+
- (void)setDefaultStop:(NSDictionary<NSString *, id> *)stop {
|
|
45
|
+
_defaultStop = stop;
|
|
49
46
|
}
|
|
50
47
|
|
|
51
|
-
- (void)setStop:(NSDictionary<NSString *,id> *)stop
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
[self _updateCamera];
|
|
48
|
+
- (void)setStop:(NSDictionary<NSString *, id> *)stop {
|
|
49
|
+
_stop = stop;
|
|
50
|
+
|
|
51
|
+
[self _updateCamera];
|
|
56
52
|
}
|
|
57
53
|
|
|
58
|
-
- (void)setMap:(MLRNMapView *)map
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
_map.reactCamera = self;
|
|
54
|
+
- (void)setMap:(MLRNMapView *)map {
|
|
55
|
+
if (_map != nil) {
|
|
56
|
+
_map.reactCamera = nil;
|
|
57
|
+
}
|
|
58
|
+
_map = map;
|
|
59
|
+
_map.reactCamera = self;
|
|
65
60
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
[self _setInitialCamera];
|
|
62
|
+
[self _updateMinMaxZoomLevel];
|
|
63
|
+
[self _updateMaxBounds];
|
|
64
|
+
[self _updateCamera];
|
|
70
65
|
}
|
|
71
66
|
|
|
72
|
-
- (void)setFollowUserLocation:(BOOL)followUserLocation
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
[self _updateCameraFromTrackingMode];
|
|
67
|
+
- (void)setFollowUserLocation:(BOOL)followUserLocation {
|
|
68
|
+
_followUserLocation = followUserLocation;
|
|
69
|
+
[self _updateCameraFromTrackingMode];
|
|
76
70
|
}
|
|
77
71
|
|
|
78
|
-
- (void)setFollowUserMode:(NSString *)followUserMode
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
[self _updateCameraFromTrackingMode];
|
|
72
|
+
- (void)setFollowUserMode:(NSString *)followUserMode {
|
|
73
|
+
_followUserMode = followUserMode;
|
|
74
|
+
[self _updateCameraFromTrackingMode];
|
|
82
75
|
}
|
|
83
76
|
|
|
84
|
-
- (void)setFollowPitch:(NSNumber *)followPitch
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
[self _updateCameraFromTrackingMode];
|
|
77
|
+
- (void)setFollowPitch:(NSNumber *)followPitch {
|
|
78
|
+
_followPitch = followPitch;
|
|
79
|
+
[self _updateCameraFromTrackingMode];
|
|
88
80
|
}
|
|
89
81
|
|
|
90
|
-
- (void)setFollowZoomLevel:(NSNumber *)followZoomLevel
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
[self _updateCameraFromTrackingMode];
|
|
82
|
+
- (void)setFollowZoomLevel:(NSNumber *)followZoomLevel {
|
|
83
|
+
_followZoomLevel = followZoomLevel;
|
|
84
|
+
[self _updateCameraFromTrackingMode];
|
|
94
85
|
}
|
|
95
86
|
|
|
96
|
-
- (void)setFollowHeading:(NSNumber *)followHeading
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
[self _updateCameraFromTrackingMode];
|
|
87
|
+
- (void)setFollowHeading:(NSNumber *)followHeading {
|
|
88
|
+
_followHeading = followHeading;
|
|
89
|
+
[self _updateCameraFromTrackingMode];
|
|
100
90
|
}
|
|
101
91
|
|
|
102
|
-
- (void)_updateCameraFromJavascript
|
|
103
|
-
{
|
|
104
|
-
|
|
105
|
-
|
|
92
|
+
- (void)_updateCameraFromJavascript {
|
|
93
|
+
if (_stop == nil) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (_followUserLocation) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (_map != nil && _map.userTrackingMode != MLNUserTrackingModeNone) {
|
|
102
|
+
_map.userTrackingMode = MLNUserTrackingModeNone;
|
|
103
|
+
}
|
|
104
|
+
if (_stop[@"stops"]) {
|
|
105
|
+
NSArray *stops = _stop[@"stops"];
|
|
106
|
+
for (NSDictionary *stop in stops) {
|
|
107
|
+
[cameraUpdateQueue enqueue:[CameraStop fromDictionary:stop]];
|
|
106
108
|
}
|
|
107
|
-
|
|
109
|
+
} else {
|
|
110
|
+
[cameraUpdateQueue enqueue:[CameraStop fromDictionary:_stop]];
|
|
111
|
+
}
|
|
112
|
+
[cameraUpdateQueue execute:_map];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
- (void)_setInitialCamera {
|
|
116
|
+
if (!_defaultStop) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
CameraStop *stop = [CameraStop fromDictionary:_defaultStop];
|
|
121
|
+
stop.duration = 0;
|
|
122
|
+
stop.mode = [NSNumber numberWithInt:RCT_MAPBOX_CAMERA_MODE_NONE];
|
|
123
|
+
CameraUpdateItem *item = [[CameraUpdateItem alloc] init];
|
|
124
|
+
item.cameraStop = stop;
|
|
125
|
+
[item execute:_map
|
|
126
|
+
withCompletionHandler:^{
|
|
127
|
+
}];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
- (void)_updateCamera {
|
|
131
|
+
if (_map != nil) {
|
|
108
132
|
if (_followUserLocation) {
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (_map != nil && _map.userTrackingMode != MLNUserTrackingModeNone) {
|
|
113
|
-
_map.userTrackingMode = MLNUserTrackingModeNone;
|
|
114
|
-
}
|
|
115
|
-
if (_stop[@"stops"]) {
|
|
116
|
-
NSArray* stops = _stop[@"stops"];
|
|
117
|
-
for (NSDictionary* stop in stops) {
|
|
118
|
-
[cameraUpdateQueue enqueue:[CameraStop fromDictionary:stop]];
|
|
119
|
-
}
|
|
133
|
+
[self _updateCameraFromTrackingMode];
|
|
120
134
|
} else {
|
|
121
|
-
|
|
135
|
+
[self _updateCameraFromJavascript];
|
|
122
136
|
}
|
|
123
|
-
|
|
137
|
+
}
|
|
124
138
|
}
|
|
125
139
|
|
|
126
|
-
- (void)
|
|
127
|
-
{
|
|
128
|
-
if (
|
|
129
|
-
|
|
140
|
+
- (void)_updateMinMaxZoomLevel {
|
|
141
|
+
if (_map != nil) {
|
|
142
|
+
if (_maxZoomLevel) {
|
|
143
|
+
_map.maximumZoomLevel = [_maxZoomLevel doubleValue];
|
|
130
144
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
stop.duration = 0;
|
|
134
|
-
stop.mode = [NSNumber numberWithInt:RCT_MAPBOX_CAMERA_MODE_NONE];
|
|
135
|
-
CameraUpdateItem *item = [[CameraUpdateItem alloc] init];
|
|
136
|
-
item.cameraStop = stop;
|
|
137
|
-
[item execute:_map withCompletionHandler:^{ }];
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
- (void)_updateCamera
|
|
141
|
-
{
|
|
142
|
-
if (_map != nil) {
|
|
143
|
-
if (_followUserLocation) {
|
|
144
|
-
[self _updateCameraFromTrackingMode];
|
|
145
|
-
} else {
|
|
146
|
-
[self _updateCameraFromJavascript];
|
|
147
|
-
}
|
|
145
|
+
if (_minZoomLevel) {
|
|
146
|
+
_map.minimumZoomLevel = [_minZoomLevel doubleValue];
|
|
148
147
|
}
|
|
148
|
+
}
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
- (void)
|
|
152
|
-
{
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
_map.maximumZoomLevel = [_maxZoomLevel doubleValue];
|
|
156
|
-
}
|
|
157
|
-
if (_minZoomLevel) {
|
|
158
|
-
_map.minimumZoomLevel = [_minZoomLevel doubleValue];
|
|
159
|
-
}
|
|
151
|
+
- (void)_updateMaxBounds {
|
|
152
|
+
if (_map != nil) {
|
|
153
|
+
if (_maxBounds) {
|
|
154
|
+
_map.maxBounds = [MLRNUtils fromFeatureCollection:_maxBounds];
|
|
160
155
|
}
|
|
156
|
+
}
|
|
161
157
|
}
|
|
162
158
|
|
|
163
|
-
- (void)
|
|
164
|
-
{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
159
|
+
- (void)_updateCameraFromTrackingMode {
|
|
160
|
+
if (_map == nil) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (!_followUserLocation) {
|
|
164
|
+
_map.userTrackingMode = MLNUserTrackingModeNone;
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
171
167
|
|
|
172
|
-
|
|
173
|
-
{
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
} else if (_stop != nil && _stop[@"pitch"] != nil) {
|
|
186
|
-
camera.pitch = [_stop[@"pitch"] floatValue];
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if ([self _userTrackingMode] != MLNUserTrackingModeFollowWithCourse && [self _userTrackingMode] != MLNUserTrackingModeFollowWithHeading) {
|
|
190
|
-
if (_followHeading != nil && [_followHeading floatValue] >= 0.0) {
|
|
191
|
-
camera.heading = [_followHeading floatValue];
|
|
192
|
-
} else if (_stop != nil && _stop[@"heading"] != nil) {
|
|
193
|
-
camera.heading = [_stop[@"heading"] floatValue];
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (_followZoomLevel != nil && [_followZoomLevel doubleValue] >= 0.0) {
|
|
198
|
-
camera.altitude = [_map altitudeFromZoom:[_followZoomLevel doubleValue]];
|
|
168
|
+
MLNMapCamera *camera = _map.camera;
|
|
169
|
+
if (_followPitch != nil && [_followPitch floatValue] >= 0.0) {
|
|
170
|
+
camera.pitch = [_followPitch floatValue];
|
|
171
|
+
} else if (_stop != nil && _stop[@"pitch"] != nil) {
|
|
172
|
+
camera.pitch = [_stop[@"pitch"] floatValue];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if ([self _userTrackingMode] != MLNUserTrackingModeFollowWithCourse &&
|
|
176
|
+
[self _userTrackingMode] != MLNUserTrackingModeFollowWithHeading) {
|
|
177
|
+
if (_followHeading != nil && [_followHeading floatValue] >= 0.0) {
|
|
178
|
+
camera.heading = [_followHeading floatValue];
|
|
179
|
+
} else if (_stop != nil && _stop[@"heading"] != nil) {
|
|
180
|
+
camera.heading = [_stop[@"heading"] floatValue];
|
|
199
181
|
}
|
|
182
|
+
}
|
|
200
183
|
|
|
201
|
-
|
|
184
|
+
if (_followZoomLevel != nil && [_followZoomLevel doubleValue] >= 0.0) {
|
|
185
|
+
camera.altitude = [_map altitudeFromZoom:[_followZoomLevel doubleValue]];
|
|
186
|
+
}
|
|
202
187
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
188
|
+
[_map setCamera:camera animated:NO];
|
|
189
|
+
|
|
190
|
+
if (_map.userTrackingMode != [self _userTrackingMode]) {
|
|
191
|
+
[_map setUserTrackingMode:[self _userTrackingMode] animated:NO completionHandler:nil];
|
|
192
|
+
}
|
|
206
193
|
}
|
|
207
194
|
|
|
208
|
-
- (NSUInteger)_userTrackingMode
|
|
209
|
-
{
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
195
|
+
- (NSUInteger)_userTrackingMode {
|
|
196
|
+
if ([_followUserMode isEqualToString:@"compass"]) {
|
|
197
|
+
return MLNUserTrackingModeFollowWithHeading;
|
|
198
|
+
} else if ([_followUserMode isEqualToString:@"course"]) {
|
|
199
|
+
return MLNUserTrackingModeFollowWithCourse;
|
|
200
|
+
} else if (_followUserLocation) {
|
|
201
|
+
return MLNUserTrackingModeFollow;
|
|
202
|
+
} else {
|
|
203
|
+
return MLNUserTrackingModeNone;
|
|
204
|
+
}
|
|
219
205
|
}
|
|
220
206
|
|
|
221
|
-
- (id)_trackingModeToString:(MLNUserTrackingMode)
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
207
|
+
- (id)_trackingModeToString:(MLNUserTrackingMode)mode {
|
|
208
|
+
switch (mode) {
|
|
209
|
+
case MLNUserTrackingModeFollowWithHeading:
|
|
210
|
+
return @"compass";
|
|
211
|
+
case MLNUserTrackingModeFollowWithCourse:
|
|
212
|
+
return @"course";
|
|
213
|
+
case MLNUserTrackingModeFollow:
|
|
214
|
+
return @"normal";
|
|
215
|
+
case MLNUserTrackingModeNone:
|
|
216
|
+
return [NSNull null];
|
|
217
|
+
}
|
|
232
218
|
}
|
|
233
219
|
|
|
234
|
-
- (void)initialLayout
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
[self _updateCamera];
|
|
220
|
+
- (void)initialLayout {
|
|
221
|
+
[self _setInitialCamera];
|
|
222
|
+
[self _updateCamera];
|
|
238
223
|
}
|
|
239
224
|
|
|
240
|
-
- (void)didChangeUserTrackingMode:(MLNUserTrackingMode)mode animated:(BOOL)animated
|
|
241
|
-
{
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
225
|
+
- (void)didChangeUserTrackingMode:(MLNUserTrackingMode)mode animated:(BOOL)animated {
|
|
226
|
+
NSDictionary *payload = @{
|
|
227
|
+
@"followUserMode" : [self _trackingModeToString:mode],
|
|
228
|
+
@"followUserLocation" : @((BOOL)(mode != MLNUserTrackingModeNone))
|
|
229
|
+
};
|
|
230
|
+
MLRNEvent *event = [MLRNEvent makeEvent:RCT_MAPBOX_USER_TRACKING_MODE_CHANGE withPayload:payload];
|
|
231
|
+
if (_onUserTrackingModeChange) {
|
|
232
|
+
_onUserTrackingModeChange([event toJSON]);
|
|
233
|
+
}
|
|
247
234
|
}
|
|
248
235
|
|
|
249
236
|
@end
|
|
@@ -28,14 +28,12 @@ RCT_EXPORT_VIEW_PROPERTY(defaultStop, NSDictionary)
|
|
|
28
28
|
|
|
29
29
|
#pragma Methods
|
|
30
30
|
|
|
31
|
-
- (BOOL)requiresMainQueueSetup
|
|
32
|
-
|
|
33
|
-
return YES;
|
|
31
|
+
- (BOOL)requiresMainQueueSetup {
|
|
32
|
+
return YES;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
- (UIView *)view
|
|
37
|
-
|
|
38
|
-
return [[MLRNCamera alloc] init];
|
|
35
|
+
- (UIView *)view {
|
|
36
|
+
return [[MLRNCamera alloc] init];
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
@end
|
|
@@ -5,22 +5,25 @@
|
|
|
5
5
|
|
|
6
6
|
@implementation MLRNCircleLayer
|
|
7
7
|
|
|
8
|
-
- (MLNCircleStyleLayer*)makeLayer:(MLNStyle*)style
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
- (MLNCircleStyleLayer *)makeLayer:(MLNStyle *)style {
|
|
9
|
+
MLNSource *source = [self layerWithSourceIDInStyle:style];
|
|
10
|
+
if (source == nil) {
|
|
11
|
+
return nil;
|
|
12
|
+
}
|
|
13
|
+
MLNCircleStyleLayer *layer = [[MLNCircleStyleLayer alloc] initWithIdentifier:self.id
|
|
14
|
+
source:source];
|
|
15
|
+
layer.sourceLayerIdentifier = self.sourceLayerID;
|
|
16
|
+
return layer;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
- (void)addStyles
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
- (void)addStyles {
|
|
20
|
+
MLRNStyle *style = [[MLRNStyle alloc] initWithMLNStyle:self.style];
|
|
21
|
+
style.bridge = self.bridge;
|
|
22
|
+
[style circleLayer:(MLNCircleStyleLayer *)self.styleLayer
|
|
23
|
+
withReactStyle:self.reactStyle
|
|
24
|
+
isValid:^{
|
|
25
|
+
return [self isAddedToMap];
|
|
26
|
+
}];
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
@end
|
|
@@ -21,11 +21,10 @@ RCT_EXPORT_VIEW_PROPERTY(reactStyle, NSDictionary);
|
|
|
21
21
|
RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, NSNumber);
|
|
22
22
|
RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, NSNumber);
|
|
23
23
|
|
|
24
|
-
- (UIView*)view
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return layer;
|
|
24
|
+
- (UIView *)view {
|
|
25
|
+
MLRNCircleLayer *layer = [MLRNCircleLayer new];
|
|
26
|
+
layer.bridge = self.bridge;
|
|
27
|
+
return layer;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
@end
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
@interface MLRNCustomHeaders : NSObject
|
|
12
12
|
|
|
13
|
-
@property (nonatomic, strong) NSMutableDictionary<NSString*, NSString*> *currentHeaders;
|
|
13
|
+
@property (nonatomic, strong) NSMutableDictionary<NSString *, NSString *> *currentHeaders;
|
|
14
14
|
|
|
15
15
|
+ (id)sharedInstance;
|
|
16
16
|
- (void)initHeaders;
|
|
17
|
-
- (void)addHeader:(NSString*)value forHeaderName:(NSString *)header;
|
|
17
|
+
- (void)addHeader:(NSString *)value forHeaderName:(NSString *)header;
|
|
18
18
|
- (void)removeHeader:(NSString *)header;
|
|
19
19
|
|
|
20
20
|
@end
|