@nativescript-community/ui-mapbox 6.2.13 → 6.2.14
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/CHANGELOG.md +8 -0
- package/common.d.ts +22 -1
- package/common.js +3 -0
- package/index.android.d.ts +4 -0
- package/index.android.js +11 -0
- package/index.d.ts +2 -1
- package/index.ios.d.ts +4 -0
- package/index.ios.js +15 -0
- package/layers/layer-factory.android.d.ts +2 -1
- package/layers/layer-factory.android.js +30 -0
- package/layers/layer-factory.d.ts +3 -2
- package/layers/layer-factory.ios.d.ts +3 -2
- package/layers/layer-factory.ios.js +30 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.2.14](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.13...v6.2.14) (2022-02-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @nativescript-community/ui-mapbox
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [6.2.13](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.12...v6.2.13) (2022-01-19)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @nativescript-community/ui-mapbox
|
package/common.d.ts
CHANGED
|
@@ -120,11 +120,13 @@ export interface AddGeoJsonClusteredOptions {
|
|
|
120
120
|
clusterRadius?: number;
|
|
121
121
|
clusters?: MapboxCluster[];
|
|
122
122
|
}
|
|
123
|
+
export declare type LayerType = "fill" | "line" | "symbol" | "circle" | "heatmap" | "fill-extrusion" | "raster" | "hillshade" | "background" | "sky";
|
|
124
|
+
export declare type SupportedLayerType = LayerType & ("line" | "circle" | "fill" | "symbol" | "raster");
|
|
123
125
|
export interface AddLayerOptions {
|
|
124
126
|
id: string;
|
|
125
127
|
source: string;
|
|
126
128
|
sourceLayer: string;
|
|
127
|
-
type:
|
|
129
|
+
type: SupportedLayerType;
|
|
128
130
|
circleColor?: string | Color;
|
|
129
131
|
circleOpacity?: number;
|
|
130
132
|
circleRadius?: number;
|
|
@@ -167,6 +169,7 @@ export interface GeoJSONSource extends Source {
|
|
|
167
169
|
data?: any;
|
|
168
170
|
minzoom?: number;
|
|
169
171
|
maxzoom?: number;
|
|
172
|
+
lineMetrics?: boolean;
|
|
170
173
|
cluster?: {
|
|
171
174
|
radius: any;
|
|
172
175
|
maxZoom: any;
|
|
@@ -253,6 +256,7 @@ export interface LayerCommon {
|
|
|
253
256
|
getNativeInstance(): any;
|
|
254
257
|
setFilter(filter: any[]): void;
|
|
255
258
|
getFilter(): any[];
|
|
259
|
+
type(): LayerType;
|
|
256
260
|
}
|
|
257
261
|
export interface MapboxCommonApi {
|
|
258
262
|
requestFineLocationPermission(): Promise<any>;
|
|
@@ -330,6 +334,10 @@ export interface MapboxApi {
|
|
|
330
334
|
x: number;
|
|
331
335
|
y: number;
|
|
332
336
|
};
|
|
337
|
+
projectBack(point: {
|
|
338
|
+
x: number;
|
|
339
|
+
y: number;
|
|
340
|
+
}): LatLng;
|
|
333
341
|
}
|
|
334
342
|
export declare abstract class MapboxCommon implements MapboxCommonApi {
|
|
335
343
|
view?: MapboxViewCommonBase;
|
|
@@ -390,6 +398,7 @@ export interface MapboxViewApi {
|
|
|
390
398
|
changeUserLocationMarkerMode(renderModeString: any, cameraModeString: UserLocationCameraMode): void;
|
|
391
399
|
forceUserLocationUpdate(location: any): void;
|
|
392
400
|
addSource(id: string, options: AddSourceOptions): Promise<any>;
|
|
401
|
+
updateSource(id: string, options: UpdateSourceOptions): Promise<any>;
|
|
393
402
|
removeSource(id: string, nativeMap?: any): Promise<any>;
|
|
394
403
|
addLayer(style: any, belowLayerId?: string): Promise<any>;
|
|
395
404
|
removeLayer(id: string): Promise<any>;
|
|
@@ -411,6 +420,14 @@ export interface MapboxViewApi {
|
|
|
411
420
|
onStop(): Promise<any>;
|
|
412
421
|
onLowMemory(): Promise<any>;
|
|
413
422
|
onDestroy(): Promise<any>;
|
|
423
|
+
project(data: LatLng): {
|
|
424
|
+
x: number;
|
|
425
|
+
y: number;
|
|
426
|
+
};
|
|
427
|
+
projectBack(screenCoordinate: {
|
|
428
|
+
x: number;
|
|
429
|
+
y: number;
|
|
430
|
+
}): LatLng;
|
|
414
431
|
}
|
|
415
432
|
export declare abstract class MapboxViewCommonBase extends ContentView implements MapboxViewApi {
|
|
416
433
|
protected mapbox: MapboxApi;
|
|
@@ -473,6 +490,10 @@ export declare abstract class MapboxViewCommonBase extends ContentView implement
|
|
|
473
490
|
x: number;
|
|
474
491
|
y: number;
|
|
475
492
|
};
|
|
493
|
+
projectBack(screenCoordinate: {
|
|
494
|
+
x: number;
|
|
495
|
+
y: number;
|
|
496
|
+
}): LatLng;
|
|
476
497
|
}
|
|
477
498
|
export declare const mapReadyProperty: Property<MapboxViewCommonBase, string>;
|
|
478
499
|
export declare const zoomLevelProperty: Property<MapboxViewCommonBase, number>;
|
package/common.js
CHANGED
|
@@ -236,6 +236,9 @@ export class MapboxViewCommonBase extends ContentView {
|
|
|
236
236
|
project(data) {
|
|
237
237
|
return this.mapbox && this.mapbox.project(data);
|
|
238
238
|
}
|
|
239
|
+
projectBack(screenCoordinate) {
|
|
240
|
+
return this.mapbox && this.mapbox.projectBack(screenCoordinate);
|
|
241
|
+
}
|
|
239
242
|
}
|
|
240
243
|
export const mapReadyProperty = new Property({ name: 'mapReady' });
|
|
241
244
|
mapReadyProperty.register(MapboxViewCommonBase);
|
package/index.android.d.ts
CHANGED
package/index.android.js
CHANGED
|
@@ -1850,6 +1850,9 @@ export class Mapbox extends MapboxCommon {
|
|
|
1850
1850
|
if (options.maxzoom) {
|
|
1851
1851
|
geojsonOptions.withMaxZoom(options.maxzoom);
|
|
1852
1852
|
}
|
|
1853
|
+
if (options.lineMetrics !== undefined) {
|
|
1854
|
+
geojsonOptions.withLineMetrics(options.lineMetrics);
|
|
1855
|
+
}
|
|
1853
1856
|
if (options.cluster) {
|
|
1854
1857
|
geojsonOptions
|
|
1855
1858
|
.withCluster(true)
|
|
@@ -2490,5 +2493,13 @@ export class Mapbox extends MapboxCommon {
|
|
|
2490
2493
|
const screenLocation = this._mapboxMapInstance.getProjection().toScreenLocation(mapboxPoint);
|
|
2491
2494
|
return { x: Utils.layout.toDeviceIndependentPixels(screenLocation.x), y: Utils.layout.toDeviceIndependentPixels(screenLocation.y) };
|
|
2492
2495
|
}
|
|
2496
|
+
projectBack(screenCoordinate) {
|
|
2497
|
+
const pointf = new android.graphics.PointF(screenCoordinate.x, screenCoordinate.y);
|
|
2498
|
+
const coordinate = this._mapboxMapInstance.getProjection().fromScreenLocation(pointf);
|
|
2499
|
+
return {
|
|
2500
|
+
lat: coordinate.getLatitude(),
|
|
2501
|
+
lng: coordinate.getLongitude()
|
|
2502
|
+
};
|
|
2503
|
+
}
|
|
2493
2504
|
}
|
|
2494
2505
|
//# sourceMappingURL=index.android.js.map
|
package/index.d.ts
CHANGED
package/index.ios.d.ts
CHANGED
package/index.ios.js
CHANGED
|
@@ -2139,6 +2139,9 @@ export class Mapbox extends MapboxCommon {
|
|
|
2139
2139
|
if (options.maxzoom !== undefined) {
|
|
2140
2140
|
sourceOptions[MGLShapeSourceOptionMaximumZoomLevel] = options.maxzoom;
|
|
2141
2141
|
}
|
|
2142
|
+
if (options.lineMetrics !== undefined) {
|
|
2143
|
+
sourceOptions[MGLShapeSourceOptionLineDistanceMetrics] = options.lineMetrics;
|
|
2144
|
+
}
|
|
2142
2145
|
if (options.cluster) {
|
|
2143
2146
|
sourceOptions[MGLShapeSourceOptionClustered] = true;
|
|
2144
2147
|
sourceOptions[MGLShapeSourceOptionClusterRadius] = options.cluster.radius || 40;
|
|
@@ -2369,6 +2372,18 @@ export class Mapbox extends MapboxCommon {
|
|
|
2369
2372
|
const { x, y } = theMap.convertCoordinateToPointToView({ latitude: data.lat, longitude: data.lng }, theMap);
|
|
2370
2373
|
return { x, y };
|
|
2371
2374
|
}
|
|
2375
|
+
projectBack(screenCoordinate) {
|
|
2376
|
+
const theMap = this._mapboxViewInstance;
|
|
2377
|
+
const cgPoint = {
|
|
2378
|
+
x: screenCoordinate.x,
|
|
2379
|
+
y: screenCoordinate.y
|
|
2380
|
+
};
|
|
2381
|
+
const coordinate = theMap.convertPointToCoordinateFromView(cgPoint, theMap);
|
|
2382
|
+
return {
|
|
2383
|
+
lat: coordinate.latitude,
|
|
2384
|
+
lng: coordinate.longitude
|
|
2385
|
+
};
|
|
2386
|
+
}
|
|
2372
2387
|
}
|
|
2373
2388
|
const _addObserver = (eventName, callback) => NSNotificationCenter.defaultCenter.addObserverForNameObjectQueueUsingBlock(eventName, null, NSOperationQueue.mainQueue, callback);
|
|
2374
2389
|
function _downloadImage(marker) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LayerCommon } from
|
|
1
|
+
import { LayerCommon, LayerType } from "../common";
|
|
2
2
|
export declare class Layer implements LayerCommon {
|
|
3
3
|
id: string;
|
|
4
4
|
private instance;
|
|
@@ -11,6 +11,7 @@ export declare class Layer implements LayerCommon {
|
|
|
11
11
|
getFilter(): any[];
|
|
12
12
|
setProperty(name: string, value: any): void;
|
|
13
13
|
getProperty(name: string): any;
|
|
14
|
+
type(): LayerType;
|
|
14
15
|
}
|
|
15
16
|
export declare class LayerFactory {
|
|
16
17
|
static createLayer(style: any, source: any): Promise<LayerCommon>;
|
|
@@ -30,6 +30,36 @@ export class Layer {
|
|
|
30
30
|
getProperty(name) {
|
|
31
31
|
return PropertyParser.propertyValueFromLayer(this.instance, name);
|
|
32
32
|
}
|
|
33
|
+
type() {
|
|
34
|
+
if (this.instance instanceof com.mapbox.mapboxsdk.style.layers.FillLayer) {
|
|
35
|
+
return "fill";
|
|
36
|
+
}
|
|
37
|
+
if (this.instance instanceof com.mapbox.mapboxsdk.style.layers.LineLayer) {
|
|
38
|
+
return "line";
|
|
39
|
+
}
|
|
40
|
+
if (this.instance instanceof com.mapbox.mapboxsdk.style.layers.SymbolLayer) {
|
|
41
|
+
return "symbol";
|
|
42
|
+
}
|
|
43
|
+
if (this.instance instanceof com.mapbox.mapboxsdk.style.layers.CircleLayer) {
|
|
44
|
+
return "circle";
|
|
45
|
+
}
|
|
46
|
+
if (this.instance instanceof com.mapbox.mapboxsdk.style.layers.HeatmapLayer) {
|
|
47
|
+
return "heatmap";
|
|
48
|
+
}
|
|
49
|
+
if (this.instance instanceof com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer) {
|
|
50
|
+
return "fill-extrusion";
|
|
51
|
+
}
|
|
52
|
+
if (this.instance instanceof com.mapbox.mapboxsdk.style.layers.RasterLayer) {
|
|
53
|
+
return "raster";
|
|
54
|
+
}
|
|
55
|
+
if (this.instance instanceof com.mapbox.mapboxsdk.style.layers.HillshadeLayer) {
|
|
56
|
+
return "hillshade";
|
|
57
|
+
}
|
|
58
|
+
if (this.instance instanceof com.mapbox.mapboxsdk.style.layers.BackgroundLayer) {
|
|
59
|
+
return "background";
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
33
63
|
}
|
|
34
64
|
export class LayerFactory {
|
|
35
65
|
static async createLayer(style, source) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LayerCommon } from
|
|
1
|
+
import { LayerCommon, LayerType } from "../common"
|
|
2
2
|
|
|
3
3
|
declare class LayerFactory {
|
|
4
4
|
static createLayer(style, source): Promise<LayerCommon>;
|
|
@@ -16,4 +16,5 @@ export declare class Layer implements LayerCommon {
|
|
|
16
16
|
getFilter(): any[];
|
|
17
17
|
setProperty(name: string, value: any): void;
|
|
18
18
|
getProperty(name: string): any;
|
|
19
|
-
|
|
19
|
+
type(): LayerType;
|
|
20
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LayerCommon } from
|
|
1
|
+
import { LayerCommon, LayerType } from "../common";
|
|
2
2
|
export declare class LayerFactory {
|
|
3
3
|
static createLayer(style: any, source: any): Promise<LayerCommon>;
|
|
4
4
|
private static parseProperties;
|
|
@@ -6,7 +6,8 @@ export declare class LayerFactory {
|
|
|
6
6
|
export declare class Layer implements LayerCommon {
|
|
7
7
|
id: string;
|
|
8
8
|
private instance;
|
|
9
|
-
constructor(instance:
|
|
9
|
+
constructor(instance: MGLStyleLayer);
|
|
10
|
+
type(): LayerType;
|
|
10
11
|
visibility(): boolean;
|
|
11
12
|
show(): void;
|
|
12
13
|
hide(): void;
|
|
@@ -49,6 +49,36 @@ export class Layer {
|
|
|
49
49
|
this.instance = instance;
|
|
50
50
|
this.id = instance.identifier;
|
|
51
51
|
}
|
|
52
|
+
type() {
|
|
53
|
+
if (this.instance instanceof MGLFillStyleLayer) {
|
|
54
|
+
return "fill";
|
|
55
|
+
}
|
|
56
|
+
if (this.instance instanceof MGLLineStyleLayer) {
|
|
57
|
+
return "line";
|
|
58
|
+
}
|
|
59
|
+
if (this.instance instanceof MGLSymbolStyleLayer) {
|
|
60
|
+
return "symbol";
|
|
61
|
+
}
|
|
62
|
+
if (this.instance instanceof MGLCircleStyleLayer) {
|
|
63
|
+
return "circle";
|
|
64
|
+
}
|
|
65
|
+
if (this.instance instanceof MGLHeatmapStyleLayer) {
|
|
66
|
+
return "heatmap";
|
|
67
|
+
}
|
|
68
|
+
if (this.instance instanceof MGLFillExtrusionStyleLayer) {
|
|
69
|
+
return "fill-extrusion";
|
|
70
|
+
}
|
|
71
|
+
if (this.instance instanceof MGLRasterStyleLayer) {
|
|
72
|
+
return "raster";
|
|
73
|
+
}
|
|
74
|
+
if (this.instance instanceof MGLHillshadeStyleLayer) {
|
|
75
|
+
return "hillshade";
|
|
76
|
+
}
|
|
77
|
+
if (this.instance instanceof MGLBackgroundStyleLayer) {
|
|
78
|
+
return "background";
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
52
82
|
visibility() {
|
|
53
83
|
return this.instance.visible;
|
|
54
84
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nativescript-community/ui-mapbox",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.14",
|
|
4
4
|
"description": "Interactive, thoroughly customizable maps powered by vector tiles and OpenGL.",
|
|
5
5
|
"main": "index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@nativescript-community/perms": "^2.2.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "f3399295d88474fe637cacc301445c977a91540d"
|
|
58
58
|
}
|