@mapsindoors/react-native-maps-indoors-mapbox 2.2.0 → 2.3.0
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/README.md +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/mapsindoorsrn/MapsIndoorsViewManager.java +4 -0
- package/android/src/main/java/com/mapsindoorsrn/core/UtilsModule.java +13 -0
- package/ios/MapsIndoorsViewManager.swift +13 -1
- package/ios/MapsIndoorsViewManagerBridge.m +2 -1
- package/ios/core/MapControlModule.swift +13 -4
- package/ios/core/UtilsBridge.m +5 -0
- package/ios/core/UtilsModule.swift +9 -0
- package/package.json +1 -1
- package/react-native-maps-indoors-mapbox.podspec +2 -2
- package/src/core/MPBuilding.ts +1 -2
- package/src/core/MPFilterBehavior.ts +21 -1
- package/src/core/MPFloor.ts +1 -1
- package/src/core/MPHighlightBehavior.ts +21 -1
- package/src/core/MPLocation.ts +2 -2
- package/src/core/MPMapConfig.ts +15 -0
- package/src/core/MPSelectionBehavior.ts +22 -1
- package/src/core/MPSolutionConfig.ts +26 -0
- package/src/core/MPUtils.ts +5 -1
- package/src/core/MPVenue.ts +1 -1
- package/src/core/MapControl.ts +5 -2
- package/src/core/MapView.tsx +6 -5
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Documentation
|
|
4
4
|
|
|
5
|
-
Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/2.
|
|
5
|
+
Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/2.3.0/index.html) to get an overview of what the MapsIndoors SDK offers.
|
|
6
6
|
|
|
7
7
|
## Getting started
|
|
8
8
|
|
package/android/build.gradle
CHANGED
|
@@ -93,7 +93,7 @@ dependencies {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
implementation 'com.mapbox.maps:android:11.7.0'
|
|
96
|
-
implementation 'com.mapspeople.mapsindoors:mapbox-v11:4.
|
|
96
|
+
implementation 'com.mapspeople.mapsindoors:mapbox-v11:4.10.0'
|
|
97
97
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
98
98
|
implementation 'androidx.core:core-ktx:1.3.2'
|
|
99
99
|
implementation 'com.github.bumptech.glide:glide:4.16.0'
|
|
@@ -211,4 +211,17 @@ public class UtilsModule extends ReactContextBaseJavaModule {
|
|
|
211
211
|
|
|
212
212
|
promise.resolve(null);
|
|
213
213
|
}
|
|
214
|
+
|
|
215
|
+
@ReactMethod
|
|
216
|
+
public void setAutomatedZoomLimit(Double zoomLimit, final Promise promise) {
|
|
217
|
+
MPSolution solution = MapsIndoors.getSolution();
|
|
218
|
+
if (solution != null) {
|
|
219
|
+
if (zoomLimit == -1) {
|
|
220
|
+
solution.getConfig().setAutomatedZoomLimit(null);
|
|
221
|
+
}else {
|
|
222
|
+
solution.getConfig().setAutomatedZoomLimit(zoomLimit);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
promise.resolve(null);
|
|
226
|
+
}
|
|
214
227
|
}
|
|
@@ -20,8 +20,10 @@ class MapsIndoorsViewManager : RCTViewManager {
|
|
|
20
20
|
zoom: 2,
|
|
21
21
|
pitch: 0
|
|
22
22
|
)
|
|
23
|
+
|
|
23
24
|
let options = MapInitOptions(cameraOptions: cameraOptions)
|
|
24
25
|
|
|
26
|
+
|
|
25
27
|
mapView = MapView(frame: CGRect(x: 0, y: 0, width: 64, height: 64), mapInitOptions: options)
|
|
26
28
|
|
|
27
29
|
|
|
@@ -30,7 +32,7 @@ class MapsIndoorsViewManager : RCTViewManager {
|
|
|
30
32
|
return mapView!
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
@objc func create(_ node: NSNumber, nodeAgain: NSNumber, camera: String, showCompass: Bool) {
|
|
35
|
+
@objc func create(_ node: NSNumber, nodeAgain: NSNumber, camera: String, showCompass: Bool, mapboxMapStyle: String?) {
|
|
34
36
|
let decoder = JSONDecoder()
|
|
35
37
|
|
|
36
38
|
DispatchQueue.main.async {
|
|
@@ -45,6 +47,13 @@ class MapsIndoorsViewManager : RCTViewManager {
|
|
|
45
47
|
return
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
if mapboxMapStyle != nil {
|
|
51
|
+
DispatchQueue.main.async {
|
|
52
|
+
self.mapView?.mapboxMap.mapStyle = MapStyle(uri: StyleURI(rawValue: mapboxMapStyle!)!)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
48
57
|
DispatchQueue.main.async {
|
|
49
58
|
var update: CameraOptions
|
|
50
59
|
if let mapCamera = self.mapView?.mapboxMap.cameraState {
|
|
@@ -167,6 +176,9 @@ class MapBoxView: RCMapView {
|
|
|
167
176
|
if let showRoadLabels = config["showRoadLabels"] as? Bool {
|
|
168
177
|
mapConfig.setShowRoadLabels(show: showRoadLabels)
|
|
169
178
|
}
|
|
179
|
+
if let useMapsIndoorsStyle = config["useDefaultMapsIndoorsStyle"] as? Bool {
|
|
180
|
+
mapConfig.useMapsIndoorsStyle(value: useMapsIndoorsStyle)
|
|
181
|
+
}
|
|
170
182
|
return mapConfig
|
|
171
183
|
}
|
|
172
184
|
}
|
|
@@ -7,5 +7,6 @@ RCT_EXTERN_METHOD(requiresMainQueueSetup)
|
|
|
7
7
|
RCT_EXTERN_METHOD(create:(nonnull NSNumber) node
|
|
8
8
|
nodeAgain:(nonnull NSNumber) nodeAgain
|
|
9
9
|
camera: (NSString*) camera
|
|
10
|
-
showCompass: (BOOL) showCompass
|
|
10
|
+
showCompass: (BOOL) showCompass
|
|
11
|
+
mapboxMapStyle: (NSString*) mapboxMapStyle)
|
|
11
12
|
@end
|
|
@@ -85,6 +85,9 @@ public class MapControlModule: RCTEventEmitter {
|
|
|
85
85
|
do {
|
|
86
86
|
let filter: MPFilter = try fromJSON(filterJSON)
|
|
87
87
|
let filterBehavior: MPFilterBehavior = try fromJSON(filterBehaviorJSON)
|
|
88
|
+
if filterBehavior.maxZoom == 999 {
|
|
89
|
+
filterBehavior.maxZoom = Double.nan
|
|
90
|
+
}
|
|
88
91
|
|
|
89
92
|
MapsIndoorsData.sharedInstance.mapView?.getMapControl()?.setFilter(filter: filter, behavior: filterBehavior)
|
|
90
93
|
return resolve(true)
|
|
@@ -118,6 +121,10 @@ public class MapControlModule: RCTEventEmitter {
|
|
|
118
121
|
let locations: [String] = try fromJSON(locationIdsJSON)
|
|
119
122
|
let highlightBehavior: MPHighlightBehavior = try fromJSON(highlightBehaviorJSON)
|
|
120
123
|
let locs = (locations.compactMap{MPMapsIndoors.shared.locationWith(locationId: $0)})
|
|
124
|
+
|
|
125
|
+
if (highlightBehavior.maxZoom == 999) {
|
|
126
|
+
highlightBehavior.maxZoom = Double.nan
|
|
127
|
+
}
|
|
121
128
|
|
|
122
129
|
MapsIndoorsData.sharedInstance.mapView?.getMapControl()?.setHighlight(locations: locs, behavior: highlightBehavior)
|
|
123
130
|
|
|
@@ -151,8 +158,7 @@ public class MapControlModule: RCTEventEmitter {
|
|
|
151
158
|
entityType: String,
|
|
152
159
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
153
160
|
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
154
|
-
var entity: MPEntity
|
|
155
|
-
|
|
161
|
+
var entity: MPEntity? = nil
|
|
156
162
|
do {
|
|
157
163
|
switch entityType {
|
|
158
164
|
case "MPLocation":
|
|
@@ -169,7 +175,7 @@ public class MapControlModule: RCTEventEmitter {
|
|
|
169
175
|
}
|
|
170
176
|
|
|
171
177
|
DispatchQueue.main.async {
|
|
172
|
-
MapsIndoorsData.sharedInstance.mapView?.getMapControl()!.goTo(entity: entity)
|
|
178
|
+
MapsIndoorsData.sharedInstance.mapView?.getMapControl()!.goTo(entity: entity!)
|
|
173
179
|
return resolve(nil)
|
|
174
180
|
}
|
|
175
181
|
} catch let e {
|
|
@@ -237,6 +243,9 @@ public class MapControlModule: RCTEventEmitter {
|
|
|
237
243
|
do {
|
|
238
244
|
let location: MPLocationCodable = try fromJSON(locationJSON)
|
|
239
245
|
let behavior: MPSelectionBehavior = try fromJSON(behaviorJSON)
|
|
246
|
+
if (behavior.maxZoom == 999) {
|
|
247
|
+
behavior.maxZoom = Double.nan
|
|
248
|
+
}
|
|
240
249
|
|
|
241
250
|
Task {
|
|
242
251
|
let loc = MPMapsIndoors.shared.locationWith(locationId: location.locationId)
|
|
@@ -682,4 +691,4 @@ public class MapControlModule: RCTEventEmitter {
|
|
|
682
691
|
|
|
683
692
|
return resolve(String(data: hiddenFeatures, encoding: String.Encoding.utf8))
|
|
684
693
|
}
|
|
685
|
-
}
|
|
694
|
+
}
|
package/ios/core/UtilsBridge.m
CHANGED
|
@@ -68,4 +68,9 @@
|
|
|
68
68
|
value: (BOOL) value
|
|
69
69
|
resolver:(RCTPromiseResolveBlock) resolve
|
|
70
70
|
rejecter:(RCTPromiseRejectBlock) reject)
|
|
71
|
+
|
|
72
|
+
RCT_EXTERN_METHOD(setAutomatedZoomLimit: (double) limit
|
|
73
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
74
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
75
|
+
|
|
71
76
|
@end
|
|
@@ -169,4 +169,13 @@ public class UtilsModule: NSObject {
|
|
|
169
169
|
}
|
|
170
170
|
return resolve(nil)
|
|
171
171
|
}
|
|
172
|
+
|
|
173
|
+
@objc public func setAutomatedZoomLimit(_ value: Double, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
174
|
+
if value == -1 {
|
|
175
|
+
MPMapsIndoors.shared.solution?.config.automatedZoomLimit = nil
|
|
176
|
+
} else {
|
|
177
|
+
MPMapsIndoors.shared.solution?.config.automatedZoomLimit = value
|
|
178
|
+
}
|
|
179
|
+
return resolve(nil)
|
|
180
|
+
}
|
|
172
181
|
}
|
package/package.json
CHANGED
|
@@ -24,6 +24,6 @@ Pod::Spec.new do |s|
|
|
|
24
24
|
s.requires_arc = true
|
|
25
25
|
|
|
26
26
|
s.dependency "React"
|
|
27
|
-
s.dependency "MapsIndoorsMapbox11", "4.
|
|
28
|
-
s.dependency "MapsIndoorsCodable", "4.
|
|
27
|
+
s.dependency "MapsIndoorsMapbox11", "4.9.1"
|
|
28
|
+
s.dependency "MapsIndoorsCodable", "4.9.1"
|
|
29
29
|
end
|
package/src/core/MPBuilding.ts
CHANGED
|
@@ -66,7 +66,7 @@ export default class MPBuilding extends MPEntity {
|
|
|
66
66
|
var polygon;
|
|
67
67
|
|
|
68
68
|
if(Platform.OS === 'ios') {
|
|
69
|
-
polygon = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.boundingBox?.
|
|
69
|
+
polygon = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.boundingBox?.southwest, object?.boundingBox?.northeast)});
|
|
70
70
|
}else {
|
|
71
71
|
polygon = MPPolygon.create(object?.geometry);
|
|
72
72
|
}
|
|
@@ -117,7 +117,6 @@ export default class MPBuilding extends MPEntity {
|
|
|
117
117
|
public get position(): MPPoint {
|
|
118
118
|
return this.anchor;
|
|
119
119
|
}
|
|
120
|
-
|
|
121
120
|
|
|
122
121
|
/**
|
|
123
122
|
* Overload from MPEntity, will return false.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import MapControl from "../../index";
|
|
2
|
+
import { Platform } from 'react-native';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Sets a behavior for the map when calling {@link MapControl#setFilter}.
|
|
@@ -26,6 +27,7 @@ export default class MPFilterBehavior {
|
|
|
26
27
|
* @param {number} animationDuration How long the camera movement should be animated for, set to 0 disables animation.
|
|
27
28
|
* @param {boolean} showInfoWindow Whether to open the info window if a single result is returned.
|
|
28
29
|
* @param {boolean} zoomToFit Whether the filtering is allowed to zoom in/out the camera.
|
|
30
|
+
* @param {number} maxZoom The maximum zoom level to zoom to when zoomToFit is enabled.
|
|
29
31
|
*/
|
|
30
32
|
private constructor(
|
|
31
33
|
public allowFloorChange: boolean,
|
|
@@ -33,6 +35,7 @@ export default class MPFilterBehavior {
|
|
|
33
35
|
public animationDuration: number,
|
|
34
36
|
public showInfoWindow: boolean,
|
|
35
37
|
public zoomToFit: boolean,
|
|
38
|
+
public maxZoom?: number
|
|
36
39
|
) { }
|
|
37
40
|
|
|
38
41
|
/**
|
|
@@ -44,12 +47,23 @@ export default class MPFilterBehavior {
|
|
|
44
47
|
* @returns {MPFilterBehavior}
|
|
45
48
|
*/
|
|
46
49
|
public static create(object?: MPFilterBehaviorParams): MPFilterBehavior {
|
|
50
|
+
if(Platform.OS === 'ios') {
|
|
51
|
+
return new MPFilterBehavior(
|
|
52
|
+
object?.allowFloorChange ?? false,
|
|
53
|
+
object?.moveCamera ?? false,
|
|
54
|
+
object?.animationDuration ?? 0,
|
|
55
|
+
object?.showInfoWindow ?? false,
|
|
56
|
+
object?.zoomToFit ?? true,
|
|
57
|
+
object?.maxZoom ?? 999
|
|
58
|
+
);
|
|
59
|
+
}
|
|
47
60
|
return new MPFilterBehavior(
|
|
48
61
|
object?.allowFloorChange ? object.allowFloorChange : false,
|
|
49
62
|
object?.moveCamera ? object.moveCamera : false,
|
|
50
63
|
object?.animationDuration ? object.animationDuration : 0,
|
|
51
64
|
object?.showInfoWindow ? object.showInfoWindow : false,
|
|
52
|
-
object?.zoomToFit ? object?.zoomToFit : true
|
|
65
|
+
object?.zoomToFit ? object?.zoomToFit : true,
|
|
66
|
+
object?.maxZoom
|
|
53
67
|
);
|
|
54
68
|
};
|
|
55
69
|
}
|
|
@@ -92,4 +106,10 @@ export interface MPFilterBehaviorParams {
|
|
|
92
106
|
* @type {?boolean}
|
|
93
107
|
*/
|
|
94
108
|
zoomToFit?: boolean,
|
|
109
|
+
/**
|
|
110
|
+
* The maximum zoom level to zoom to when zoomToFit is enabled.
|
|
111
|
+
*
|
|
112
|
+
* @type {?number}
|
|
113
|
+
*/
|
|
114
|
+
maxZoom?: number
|
|
95
115
|
}
|
package/src/core/MPFloor.ts
CHANGED
|
@@ -61,7 +61,7 @@ export default class MPFloor extends MPEntity {
|
|
|
61
61
|
public static create(object: MPFloorParams): MPFloor {
|
|
62
62
|
var multiPolygon;
|
|
63
63
|
if (Platform.OS === 'ios') {
|
|
64
|
-
multiPolygon = MPMultiPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.
|
|
64
|
+
multiPolygon = MPMultiPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.southwest, object?.entityBounds?.northeast)});
|
|
65
65
|
}else {
|
|
66
66
|
multiPolygon = MPMultiPolygon.create(object?.geometry);
|
|
67
67
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import MapControl from "../../index";
|
|
2
|
+
import { Platform } from 'react-native';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Sets a behavior for the map when calling {@link MapControl#setHighlight}.
|
|
@@ -26,6 +27,7 @@ export default class MPHighlightBehavior {
|
|
|
26
27
|
* @param {number} animationDuration How long the camera movement should be animated for, set to 0 disables animation.
|
|
27
28
|
* @param {boolean} showInfoWindow Whether to open the info window if a single result is returned.
|
|
28
29
|
* @param {boolean} zoomToFit Whether the highlighting is allowed to zoom in/out the camera.
|
|
30
|
+
* @param {number} maxZoom The maximum zoom level to zoom to when zoomToFit is enabled.
|
|
29
31
|
*/
|
|
30
32
|
private constructor(
|
|
31
33
|
public allowFloorChange: boolean,
|
|
@@ -33,6 +35,7 @@ export default class MPHighlightBehavior {
|
|
|
33
35
|
public animationDuration: number,
|
|
34
36
|
public showInfoWindow: boolean,
|
|
35
37
|
public zoomToFit: boolean,
|
|
38
|
+
public maxZoom?: number
|
|
36
39
|
) { }
|
|
37
40
|
|
|
38
41
|
/**
|
|
@@ -44,12 +47,23 @@ export default class MPHighlightBehavior {
|
|
|
44
47
|
* @returns {MPFilterBehavior}
|
|
45
48
|
*/
|
|
46
49
|
public static create(object?: MPHighlightBehaviorParams): MPHighlightBehavior {
|
|
50
|
+
if(Platform.OS === 'ios') {
|
|
51
|
+
return new MPHighlightBehavior(
|
|
52
|
+
object?.allowFloorChange ?? false,
|
|
53
|
+
object?.moveCamera ?? false,
|
|
54
|
+
object?.animationDuration ?? 0,
|
|
55
|
+
object?.showInfoWindow ?? false,
|
|
56
|
+
object?.zoomToFit ?? true,
|
|
57
|
+
object?.maxZoom ?? 999
|
|
58
|
+
);
|
|
59
|
+
}
|
|
47
60
|
return new MPHighlightBehavior(
|
|
48
61
|
object?.allowFloorChange ?? false,
|
|
49
62
|
object?.moveCamera ?? false,
|
|
50
63
|
object?.animationDuration ?? 0,
|
|
51
64
|
object?.showInfoWindow ?? false,
|
|
52
|
-
object?.zoomToFit ?? true
|
|
65
|
+
object?.zoomToFit ?? true,
|
|
66
|
+
object?.maxZoom
|
|
53
67
|
);
|
|
54
68
|
};
|
|
55
69
|
}
|
|
@@ -92,4 +106,10 @@ export interface MPHighlightBehaviorParams {
|
|
|
92
106
|
* @type {?boolean}
|
|
93
107
|
*/
|
|
94
108
|
zoomToFit?: boolean,
|
|
109
|
+
/**
|
|
110
|
+
* The maximum zoom level to zoom to when zoomToFit is enabled.
|
|
111
|
+
*
|
|
112
|
+
* @type {?number}
|
|
113
|
+
*/
|
|
114
|
+
maxZoom?: number
|
|
95
115
|
}
|
package/src/core/MPLocation.ts
CHANGED
|
@@ -95,10 +95,10 @@ export default class MPLocation extends MPEntity {
|
|
|
95
95
|
geo = MPPoint.create(object?.geometry);
|
|
96
96
|
break;
|
|
97
97
|
case MPGeometry.polygon:
|
|
98
|
-
geo = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.
|
|
98
|
+
geo = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.southwest, object?.entityBounds?.northeast)});
|
|
99
99
|
break;
|
|
100
100
|
case MPGeometry.multiPolygon:
|
|
101
|
-
geo = MPMultiPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.
|
|
101
|
+
geo = MPMultiPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.southwest, object?.entityBounds?.northeast)})
|
|
102
102
|
break;
|
|
103
103
|
default:
|
|
104
104
|
break;
|
package/src/core/MPMapConfig.ts
CHANGED
|
@@ -126,6 +126,13 @@ export default class MPMapConfig {
|
|
|
126
126
|
*/
|
|
127
127
|
public readonly showRoadLabels?: boolean;
|
|
128
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Set a specific map style for Mapbox
|
|
131
|
+
* Mapbox specific
|
|
132
|
+
* The default value is undefined, and uses the default style. useDefaultMapsIndoorsStyle should be false for this to take effect.
|
|
133
|
+
*/
|
|
134
|
+
public mapboxMapStyle?: string;
|
|
135
|
+
|
|
129
136
|
/**
|
|
130
137
|
* Creates an instance of MPMapConfig.
|
|
131
138
|
*
|
|
@@ -147,6 +154,7 @@ export default class MPMapConfig {
|
|
|
147
154
|
this.mapsIndoorsTransitionLevel = params.mapsIndoorsTransitionLevel;
|
|
148
155
|
this.showMapMarkers = params.showMapMarkers;
|
|
149
156
|
this.showRoadLabels = params.showRoadLabels;
|
|
157
|
+
this.mapboxMapStyle = params.mapboxMapStyle;
|
|
150
158
|
}
|
|
151
159
|
}
|
|
152
160
|
|
|
@@ -262,4 +270,11 @@ export interface MPMapConfigParams {
|
|
|
262
270
|
* @type {boolean}
|
|
263
271
|
*/
|
|
264
272
|
showRoadLabels?: boolean,
|
|
273
|
+
/**
|
|
274
|
+
* Set a specific map style for Mapbox
|
|
275
|
+
* Mapbox specific
|
|
276
|
+
* The default value is undefined, and uses the default style. useDefaultMapsIndoorsStyle should be false for this to take effect.
|
|
277
|
+
* @type {string}
|
|
278
|
+
*/
|
|
279
|
+
mapboxMapStyle?: string,
|
|
265
280
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import MapControl from "../../index";
|
|
2
|
+
import { Platform } from 'react-native';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Sets a behavior for the map when calling {@link MapControl#selectLocation}.
|
|
@@ -25,6 +26,7 @@ export default class MPSelectionBehavior {
|
|
|
25
26
|
* @param {number} animationDuration
|
|
26
27
|
* @param {boolean} showInfoWindow
|
|
27
28
|
* @param {boolean} zoomToFit
|
|
29
|
+
* @param {number} maxZoom
|
|
28
30
|
*/
|
|
29
31
|
private constructor(
|
|
30
32
|
public allowFloorChange: boolean,
|
|
@@ -32,6 +34,7 @@ export default class MPSelectionBehavior {
|
|
|
32
34
|
public animationDuration: number,
|
|
33
35
|
public showInfoWindow: boolean,
|
|
34
36
|
public zoomToFit: boolean,
|
|
37
|
+
public maxZoom?: number
|
|
35
38
|
) { }
|
|
36
39
|
|
|
37
40
|
/**
|
|
@@ -42,12 +45,23 @@ export default class MPSelectionBehavior {
|
|
|
42
45
|
* @returns {MPSelectionBehavior}
|
|
43
46
|
*/
|
|
44
47
|
static create(object: MPSelectionBehaviorParams): MPSelectionBehavior {
|
|
48
|
+
if(Platform.OS === 'ios') {
|
|
49
|
+
return new MPSelectionBehavior(
|
|
50
|
+
object?.allowFloorChange ?? false,
|
|
51
|
+
object?.moveCamera ?? false,
|
|
52
|
+
object?.animationDuration ?? 0,
|
|
53
|
+
object?.showInfoWindow ?? false,
|
|
54
|
+
object?.zoomToFit ?? true,
|
|
55
|
+
object?.maxZoom ?? 999
|
|
56
|
+
);
|
|
57
|
+
}
|
|
45
58
|
return new MPSelectionBehavior(
|
|
46
59
|
object?.allowFloorChange ?? true,
|
|
47
60
|
object?.moveCamera ?? true,
|
|
48
61
|
object?.animationDuration ?? 500,
|
|
49
62
|
object?.showInfoWindow ?? true,
|
|
50
|
-
object?.zoomToFit ?? true
|
|
63
|
+
object?.zoomToFit ?? true,
|
|
64
|
+
object?.maxZoom
|
|
51
65
|
);
|
|
52
66
|
}
|
|
53
67
|
}
|
|
@@ -90,4 +104,11 @@ export interface MPSelectionBehaviorParams {
|
|
|
90
104
|
* @type {?boolean}
|
|
91
105
|
*/
|
|
92
106
|
zoomToFit?: boolean,
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The maximum zoom level to zoom to when zoomToFit is enabled.
|
|
110
|
+
*
|
|
111
|
+
* @type {?number}
|
|
112
|
+
*/
|
|
113
|
+
maxZoom?: number
|
|
93
114
|
}
|
|
@@ -24,6 +24,8 @@ export default class MPSolutionConfig {
|
|
|
24
24
|
* @param {MPSettings3D} settings3D
|
|
25
25
|
* @param {?boolean} [_enableClustering]
|
|
26
26
|
* @param {?MPCollisionHandling} [_mpCollisionHandling]
|
|
27
|
+
* @param {?boolean} [_isNewSelection]
|
|
28
|
+
* @param {?number} [_automatedZoomLimit]
|
|
27
29
|
*/
|
|
28
30
|
private constructor(
|
|
29
31
|
public readonly id: string,
|
|
@@ -32,6 +34,7 @@ export default class MPSolutionConfig {
|
|
|
32
34
|
private _enableClustering?: boolean,
|
|
33
35
|
private _mpCollisionHandling?: MPCollisionHandling,
|
|
34
36
|
private _isNewSelection?: boolean,
|
|
37
|
+
private _automatedZoomLimit?: number,
|
|
35
38
|
) { }
|
|
36
39
|
|
|
37
40
|
|
|
@@ -51,6 +54,7 @@ export default class MPSolutionConfig {
|
|
|
51
54
|
object?.enableClustering,
|
|
52
55
|
object?.collisionHandling,
|
|
53
56
|
object?.isNewSelection,
|
|
57
|
+
object?.automatedZoomLimit,
|
|
54
58
|
);
|
|
55
59
|
}
|
|
56
60
|
|
|
@@ -65,6 +69,21 @@ export default class MPSolutionConfig {
|
|
|
65
69
|
MPUtils.setCollisionHandling(collisionHandling);
|
|
66
70
|
}
|
|
67
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Set the automated zoom limit.
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
* @type {number}
|
|
77
|
+
*/
|
|
78
|
+
public set automatedZoomLimit(automatedZoomLimit: number) {
|
|
79
|
+
this._automatedZoomLimit = automatedZoomLimit;
|
|
80
|
+
if (automatedZoomLimit == null) {
|
|
81
|
+
MPUtils.setAutomatedZoomLimit(-1);
|
|
82
|
+
}else {
|
|
83
|
+
MPUtils.setAutomatedZoomLimit(automatedZoomLimit);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
68
87
|
/**
|
|
69
88
|
* Get the type of collisionHandling that is set.
|
|
70
89
|
*
|
|
@@ -159,4 +178,11 @@ export interface MPSolutionConfigParams {
|
|
|
159
178
|
* @type {MPLocationSettings}
|
|
160
179
|
*/
|
|
161
180
|
locationSettings: MPLocationSettings,
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Automated zoom limit
|
|
184
|
+
*
|
|
185
|
+
* @type {number}
|
|
186
|
+
*/
|
|
187
|
+
automatedZoomLimit?: number,
|
|
162
188
|
}
|
package/src/core/MPUtils.ts
CHANGED
|
@@ -170,5 +170,9 @@ export default class MPUtils {
|
|
|
170
170
|
static async setSelectable(id: string, selectable: boolean): Promise<void> {
|
|
171
171
|
return UtilsModule.setSelectable(id, selectable);
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
|
|
174
|
+
static async setAutomatedZoomLimit(automatedZoomLimit?: number): Promise<void> {
|
|
175
|
+
return UtilsModule.setAutomatedZoomLimit(automatedZoomLimit);
|
|
176
|
+
}
|
|
177
|
+
|
|
174
178
|
}
|
package/src/core/MPVenue.ts
CHANGED
|
@@ -58,7 +58,7 @@ export default class MPVenue extends MPEntity {
|
|
|
58
58
|
var polygon;
|
|
59
59
|
|
|
60
60
|
if (Platform.OS === 'ios') {
|
|
61
|
-
polygon = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.bbox?.
|
|
61
|
+
polygon = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.bbox?.southwest, object?.bbox?.northeast)});
|
|
62
62
|
}else {
|
|
63
63
|
polygon = MPPolygon.create(object?.geometry);
|
|
64
64
|
}
|
package/src/core/MapControl.ts
CHANGED
|
@@ -316,8 +316,11 @@ export default class MapControl {
|
|
|
316
316
|
* @param {MPEntity} entity The entity to move to.
|
|
317
317
|
* @returns {Promise<void>}
|
|
318
318
|
*/
|
|
319
|
-
public async goTo(entity: MPEntity): Promise<void> {
|
|
320
|
-
|
|
319
|
+
public async goTo(entity: MPEntity, maxZoom?: number): Promise<void> {
|
|
320
|
+
if (maxZoom) {
|
|
321
|
+
return MapControlModule.goTo(JSON.stringify(entity), entity.type, maxZoom);
|
|
322
|
+
}
|
|
323
|
+
return MapControlModule.goTo(JSON.stringify(entity), entity.type);
|
|
321
324
|
}
|
|
322
325
|
|
|
323
326
|
/**
|
package/src/core/MapView.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { useEffect, useRef } from 'react';
|
|
|
3
3
|
import { Platform, UIManager, findNodeHandle, requireNativeComponent } from "react-native";
|
|
4
4
|
import MPCameraPosition from './MPCameraPosition';
|
|
5
5
|
|
|
6
|
-
const createFragment = (viewId: number | null, camera?: MPCameraPosition, showCompass?: boolean) => {
|
|
6
|
+
const createFragment = (viewId: number | null, camera?: MPCameraPosition, showCompass?: boolean, mapboxMapStyle?: String) => {
|
|
7
7
|
let command = (UIManager as any).MapsIndoorsView.Commands.create;
|
|
8
8
|
if (Platform.OS === 'android') {
|
|
9
9
|
command = command.toString();
|
|
@@ -12,23 +12,24 @@ const createFragment = (viewId: number | null, camera?: MPCameraPosition, showCo
|
|
|
12
12
|
viewId,
|
|
13
13
|
// we are calling the 'create' command
|
|
14
14
|
command,
|
|
15
|
-
[viewId, JSON.stringify(camera), showCompass],
|
|
15
|
+
[viewId, JSON.stringify(camera), showCompass, mapboxMapStyle],
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const MapView = ({ style, camera, showCompass }: { style: any, camera?: MPCameraPosition, showCompass?: boolean}) => {
|
|
19
|
+
const MapView = ({ style, camera, showCompass, mapboxMapStyle }: { style: any, camera?: MPCameraPosition, showCompass?: boolean, mapboxMapStyle?: string}) => {
|
|
20
20
|
const ref = useRef(null);
|
|
21
21
|
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
const viewId = findNodeHandle(ref.current);
|
|
24
|
-
createFragment(viewId, camera, showCompass !== undefined ? showCompass : true);
|
|
24
|
+
createFragment(viewId, camera, showCompass !== undefined ? showCompass : true, mapboxMapStyle);
|
|
25
25
|
}, []);
|
|
26
26
|
|
|
27
27
|
return (<MapsIndoorsViewManager
|
|
28
28
|
style={style}
|
|
29
29
|
ref={ref}
|
|
30
30
|
camera={camera}
|
|
31
|
-
showCompass={showCompass}
|
|
31
|
+
showCompass={showCompass}
|
|
32
|
+
mapboxMapStyle={mapboxMapStyle} />);
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
const MapsIndoorsViewManager = requireNativeComponent('MapsIndoorsView');
|