@nativescript-community/ui-mapbox 6.2.10 → 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 +36 -0
- package/README.md +199 -99
- package/{mapbox.common.d.ts → common.d.ts} +42 -4
- package/{mapbox.common.js → common.js} +21 -1
- package/{filter/filter-parser.android.d.ts → expression/expression-parser.android.d.ts} +1 -1
- package/{filter/filter-parser.android.js → expression/expression-parser.android.js} +2 -2
- package/expression/expression-parser.d.ts +4 -0
- package/{filter/filter-parser.ios.d.ts → expression/expression-parser.ios.d.ts} +1 -1
- package/{filter/filter-parser.ios.js → expression/expression-parser.ios.js} +2 -2
- package/{mapbox.android.d.ts → index.android.d.ts} +9 -14
- package/{mapbox.android.js → index.android.js} +152 -65
- package/index.d.ts +99 -6
- package/{mapbox.ios.d.ts → index.ios.d.ts} +7 -30
- package/{mapbox.ios.js → index.ios.js} +1977 -1912
- package/layers/layer-factory.android.d.ts +15 -1
- package/layers/layer-factory.android.js +63 -2
- package/layers/layer-factory.d.ts +17 -2
- package/layers/layer-factory.ios.d.ts +15 -1
- package/layers/layer-factory.ios.js +72 -2
- package/layers/parser/property-parser.android.d.ts +1 -0
- package/layers/parser/property-parser.android.js +25 -0
- package/layers/parser/property-parser.d.ts +4 -0
- package/layers/parser/property-parser.ios.d.ts +1 -0
- package/layers/parser/property-parser.ios.js +21 -0
- package/package.json +55 -49
- package/platforms/android/include.gradle +3 -0
- package/platforms/android/ui_mapbox.aar +0 -0
- package/platforms/ios/Podfile +2 -2
- package/typings/Mapbox.ios.d.ts +2 -0
- package/LICENSE +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,42 @@
|
|
|
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
|
+
|
|
14
|
+
## [6.2.13](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.12...v6.2.13) (2022-01-19)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @nativescript-community/ui-mapbox
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [6.2.12](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.11...v6.2.12) (2022-01-17)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @nativescript-community/ui-mapbox
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [6.2.11](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.10...v6.2.11) (2022-01-09)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* add okhttp implementation ([f73304f](https://github.com/nativescript-community/ui-mapbox/commit/f73304faf9fae447bf0e56c794ed818d2357d887))
|
|
36
|
+
* downgrade iOS Mapbox version ([3aa8196](https://github.com/nativescript-community/ui-mapbox/commit/3aa8196259497799a2f8c1019b0210b9834bb2cf))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
6
42
|
## [6.2.10](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.9...v6.2.10) (2021-09-28)
|
|
7
43
|
|
|
8
44
|
**Note:** Version bump only for package @nativescript-community/ui-mapbox
|
package/README.md
CHANGED
|
@@ -1,93 +1,127 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<!-- ⚠️ This README has been generated from the file(s) "blueprint.md" ⚠️-->
|
|
2
|
+
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
3
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
4
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
5
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
6
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
7
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
8
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
9
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
10
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
11
|
+
DO NOT EDIT THIS READEME DIRECTLY! Edit "bluesprint.md" instead.
|
|
12
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
13
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
14
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
15
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
16
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
17
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
18
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
19
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
20
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
|
21
|
+
<h1 align="center">@nativescript-community/ui-mapbox</h1>
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="https://npmcharts.com/compare/@nativescript-community/ui-mapbox?minimal=true"><img alt="Downloads per month" src="https://img.shields.io/npm/dm/@nativescript-community/ui-mapbox.svg" height="20"/></a>
|
|
24
|
+
<a href="https://www.npmjs.com/package/@nativescript-community/ui-mapbox"><img alt="NPM Version" src="https://img.shields.io/npm/v/@nativescript-community/ui-mapbox.svg" height="20"/></a>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<p align="center">
|
|
28
|
+
<b>Interactive, thoroughly customizable maps powered by vector tiles and OpenGL.</b></br>
|
|
29
|
+
<sub><sub>
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
<br />
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
[](#table-of-contents)
|
|
37
|
+
|
|
38
|
+
## Table of Contents
|
|
39
|
+
|
|
40
|
+
* [Prerequisites](#prerequisites)
|
|
41
|
+
* [Installation](#installation)
|
|
42
|
+
* [Configuration](#configuration)
|
|
43
|
+
* [Issues](#issues)
|
|
44
|
+
* [Usage](#usage)
|
|
45
|
+
* [XML](#xml)
|
|
46
|
+
* [Angular](#angular)
|
|
47
|
+
* [API](#api)
|
|
48
|
+
* [Markers](#markers)
|
|
49
|
+
* [Viewport](#viewport)
|
|
50
|
+
* [Declaring Programmatically](#declaring-programmatically)
|
|
51
|
+
* [Methods](#methods)
|
|
52
|
+
* [show](#show)
|
|
53
|
+
* [hide](#hide)
|
|
54
|
+
* [unhide](#unhide)
|
|
55
|
+
* [destroy 💥](#destroy-)
|
|
56
|
+
* [setMapStyle](#setmapstyle)
|
|
57
|
+
* [addMarkers](#addmarkers)
|
|
58
|
+
* [Updating markers](#updating-markers)
|
|
59
|
+
* [removeMarkers](#removemarkers)
|
|
60
|
+
* [setViewport](#setviewport)
|
|
61
|
+
* [getViewport](#getviewport)
|
|
62
|
+
* [setCenter](#setcenter)
|
|
63
|
+
* [getCenter](#getcenter)
|
|
64
|
+
* [setZoomLevel](#setzoomlevel)
|
|
65
|
+
* [getZoomLevel](#getzoomlevel)
|
|
66
|
+
* [animateCamera](#animatecamera)
|
|
67
|
+
* [setTilt (Android only)](#settilt-android-only)
|
|
68
|
+
* [getTilt (Android only)](#gettilt-android-only)
|
|
69
|
+
* [getUserLocation](#getuserlocation)
|
|
70
|
+
* [trackUser](#trackuser)
|
|
71
|
+
* [addSource](#addsource)
|
|
72
|
+
* [removeSource](#removesource)
|
|
73
|
+
* [addLayer](#addlayer)
|
|
74
|
+
* [removeLayer](#removelayer)
|
|
75
|
+
* [queryRenderedFeatures](#queryrenderedfeatures)
|
|
76
|
+
* [querySourceFeatures](#querysourcefeatures)
|
|
77
|
+
* [addLinePoint](#addlinepoint)
|
|
78
|
+
* [addPolygon (**deprecated**, use addLayer() instead)](#addpolygon-deprecated-use-addlayer-instead)
|
|
79
|
+
* [removePolygons](#removepolygons)
|
|
80
|
+
* [addPolyline](#addpolyline)
|
|
81
|
+
* [removePolylines](#removepolylines)
|
|
82
|
+
* [setOnMapClickListener](#setonmapclicklistener)
|
|
83
|
+
* [setOnMapLongClickListener](#setonmaplongclicklistener)
|
|
84
|
+
* [setOnScrollListener](#setonscrolllistener)
|
|
85
|
+
* [Offline maps](#offline-maps)
|
|
86
|
+
* [downloadOfflineRegion](#downloadofflineregion)
|
|
87
|
+
* [Advanced example: download the current viewport](#advanced-example-download-the-current-viewport)
|
|
88
|
+
* [listOfflineRegions](#listofflineregions)
|
|
89
|
+
* [deleteOfflineRegion](#deleteofflineregion)
|
|
90
|
+
* [Permissions](#permissions)
|
|
91
|
+
* [hasFineLocationPermission / requestFineLocationPermission](#hasfinelocationpermission--requestfinelocationpermission)
|
|
92
|
+
* [Using marker images from the internet](#using-marker-images-from-the-internet)
|
|
93
|
+
* [Demos and Development](#demos-and-development)
|
|
94
|
+
* [Setup](#setup)
|
|
95
|
+
* [Build](#build)
|
|
96
|
+
* [Demos](#demos)
|
|
97
|
+
* [Questions](#questions)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
[](#prerequisites)
|
|
101
|
+
|
|
102
|
+
## Prerequisites
|
|
4
103
|
|
|
5
|
-
# NativeScript Mapbox plugin
|
|
6
|
-
|
|
7
|
-
[npm-image]:http://img.shields.io/npm/v/@nativescript-community/ui-mapbox.svg
|
|
8
|
-
[npm-url]:https://npmjs.org/package/@nativescript-community/ui-mapbox
|
|
9
|
-
[downloads-image]:http://img.shields.io/npm/dm/@nativescript-community/ui-mapbox.svg
|
|
10
|
-
|
|
11
|
-
Awesome native OpenGL-powered maps - by Mapbox
|
|
12
|
-
|
|
13
|
-
<img src="https://raw.githubusercontent.com/nativescript-community/ui-mapbox/master/screenshots/ios-demoapp-slice.png" width="375px" height="196px" />
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# WARNING
|
|
17
|
-
|
|
18
|
-
As we switched to a community managed plugin we upgraded the version of the Mapbox SDKs. Though starting from iOS SDK 6.0 and android SDK 9.0 they need special handling for downloading the SDK:
|
|
19
|
-
[iOS](https://docs.mapbox.com/ios/maps/overview/#configure-credentials)
|
|
20
|
-
|
|
21
|
-
[Android](https://docs.mapbox.com/android/maps/overview/#configure-credentials)
|
|
22
|
-
|
|
23
|
-
On android the plugin default to 8.x. You can change it by creating a `before-plugins.gradle` in `App_Resources/Android` with (showing current versions):
|
|
24
|
-
```
|
|
25
|
-
ext {
|
|
26
|
-
okHttpVersion = "3.12.10"
|
|
27
|
-
def mapboxVersion = "8.6.6"
|
|
28
|
-
def mapboxTelemetryVersion = "6.1.0"
|
|
29
|
-
def mapboxPluginsVersion = "v9"
|
|
30
|
-
def mapboxAnnotationPluginVersion = "0.9.0"
|
|
31
|
-
def mapboxGesturesVersion = "0.7.0"
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
On iOS we dont force anything so it will get the latest one. If you want to change it create a `Podfile` in `App_Resources/iOS` with (see demo app):
|
|
37
|
-
```
|
|
38
|
-
pod 'Mapbox-iOS-SDK', '~> 5.1.1'
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## Before you begin - Prerequisites
|
|
43
104
|
You either need your own tile server such as the one provided by [openmaptiles.org](https://openmaptiles.org) or a Mapbox API access token (they have a 🆓 Starter plan!), so [sign up with Mapbox](https://www.mapbox.com/signup/).
|
|
44
105
|
Once you've registered go to your Account > Apps > New token. The 'Default Secret Token' is what you'll need.
|
|
45
106
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
$ ns plugin install @nativescript-community/ui-mapbox
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
# DEMOS
|
|
55
|
-
|
|
56
|
-
Two demo applications are available in the repository.
|
|
57
|
-
|
|
58
|
-
To run them, you'll need to clone the github repository and build the plugin. See below.
|
|
107
|
+
|
|
108
|
+
[](#installation)
|
|
109
|
+
|
|
110
|
+
## Installation
|
|
111
|
+
Run the following command from the root of your project:
|
|
59
112
|
|
|
60
|
-
|
|
113
|
+
`ns plugin add @nativescript-community/ui-mapbox`
|
|
61
114
|
|
|
62
|
-
|
|
115
|
+
|
|
116
|
+
[](#configuration)
|
|
117
|
+
|
|
118
|
+
## Configuration
|
|
63
119
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
## Demo prerequisites
|
|
67
|
-
```
|
|
68
|
-
npm i
|
|
69
|
-
npm run setup
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
## To run the Angular demo
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
npm run build
|
|
77
|
-
cd ./demo-angular
|
|
78
|
-
ns run <platform>
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## To run the plain Nativescript demo
|
|
82
|
-
```
|
|
83
|
-
npm run build
|
|
84
|
-
cd ./demo
|
|
85
|
-
ns run <platform>
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## Roadmap
|
|
89
|
-
[https://github.com/orgs/nativescript-community/projects/4](https://github.com/orgs/nativescript-community/projects/4)
|
|
120
|
+
Add any other additional configuration instructions here.
|
|
90
121
|
|
|
122
|
+
|
|
123
|
+
[](#issues)
|
|
124
|
+
|
|
91
125
|
## Issues
|
|
92
126
|
|
|
93
127
|
If you get an error during iOS build related to Podspec versions, probably the easiest fix is:
|
|
@@ -101,23 +135,17 @@ On Android the plugin adds this to the `<application>` node of `app/App_Resource
|
|
|
101
135
|
|
|
102
136
|
If you get an error related to `TelemetryService` then please check it's there.
|
|
103
137
|
|
|
138
|
+
|
|
139
|
+
[](#usage)
|
|
140
|
+
|
|
104
141
|
## Usage
|
|
105
142
|
|
|
106
|
-
### Demo app (XML + TypeScript)
|
|
107
|
-
If you want a quickstart, see the demo in this repository.
|
|
108
|
-
It shows you how to draw a map in XML and JS with almost all possible options.
|
|
109
|
-
|
|
110
|
-
### Demo app (Angular)
|
|
111
|
-
There is also the beginnings of an Angular demo in demo-angular in this repository.
|
|
112
|
-
|
|
113
|
-
## Declaring a map in the view
|
|
114
|
-
|
|
115
143
|
### XML
|
|
116
144
|
You can instantiate a map from JS or TS. As the map is yet another view component it will play nice with any NativeScript layout you throw it in. You can also easily add multiple maps to the same page or to different pages in any layout you like.
|
|
117
145
|
|
|
118
146
|
A simple layout could look like this:
|
|
119
147
|
|
|
120
|
-
<img src="https://raw.githubusercontent.com/nativescript-community/ui-mapbox/master/
|
|
148
|
+
<img src="https://raw.githubusercontent.com/nativescript-community/ui-mapbox/master/images/ios-xml-declared.png" width="373px" height="361px" />
|
|
121
149
|
|
|
122
150
|
Could be rendered by a definition like this:
|
|
123
151
|
|
|
@@ -144,7 +172,7 @@ Could be rendered by a definition like this:
|
|
|
144
172
|
Component:
|
|
145
173
|
|
|
146
174
|
```typescript
|
|
147
|
-
import { registerElement } from
|
|
175
|
+
import { registerElement } from '@nativescript/angular';
|
|
148
176
|
registerElement("Mapbox", () => require("@nativescript-community/ui-mapbox").MapboxView);
|
|
149
177
|
```
|
|
150
178
|
|
|
@@ -169,7 +197,10 @@ View:
|
|
|
169
197
|
</ContentView>
|
|
170
198
|
```
|
|
171
199
|
|
|
172
|
-
|
|
200
|
+
|
|
201
|
+
[](#api)
|
|
202
|
+
|
|
203
|
+
## API
|
|
173
204
|
All currently supported options for your XML based map are (__don't__ use other properties - if you need styling wrap the map in a `ContentView` and apply things like `width` to that container!):
|
|
174
205
|
|
|
175
206
|
|option|default|description
|
|
@@ -189,11 +220,15 @@ All currently supported options for your XML based map are (__don't__ use other
|
|
|
189
220
|
|`disableScroll`|false|Don't allow the user to move the center of the map (one finger drag)
|
|
190
221
|
|`disableTilt`|false|Don't allow the user to tilt the map (two finger drag up or down)
|
|
191
222
|
|`mapReady`|-|The name of a callback function you can declare to interact with the map after it has been drawn
|
|
192
|
-
|`moveBeginEvent`|-|The name of a function to be called when the map
|
|
223
|
+
|`moveBeginEvent`|-|The name of a function to be called when the map has begun to move.
|
|
224
|
+
|`moveEndEvent`|-|The name of a function to be called when the map has completed moving.
|
|
193
225
|
|`locationPermissionGranted`|-|The name of a callback function you can declare to get notified when the user granted location permissions
|
|
194
226
|
|`locationPermissionDenied`|-|The name of a callback function you can declare to get notified when the user denied location permissions (will never fire on iOS because there's nothing to deny)
|
|
195
227
|
|
|
196
|
-
|
|
228
|
+
|
|
229
|
+
[](#markers)
|
|
230
|
+
|
|
231
|
+
## Markers
|
|
197
232
|
This is where that last option in the table above comes in - `mapReady`.
|
|
198
233
|
It allows you to interact with the map after it has been drawn to the page.
|
|
199
234
|
|
|
@@ -223,7 +258,10 @@ function onMapReady(args) {
|
|
|
223
258
|
exports.onMapReady = onMapReady;
|
|
224
259
|
```
|
|
225
260
|
|
|
226
|
-
|
|
261
|
+
|
|
262
|
+
[](#viewport)
|
|
263
|
+
|
|
264
|
+
## Viewport
|
|
227
265
|
|
|
228
266
|
```js
|
|
229
267
|
var mapbox = require("@nativescript-community/ui-mapbox");
|
|
@@ -250,7 +288,10 @@ The methods you can invoke like this from an XML-declared map are:
|
|
|
250
288
|
|
|
251
289
|
Check out the usage details on the functions below.
|
|
252
290
|
|
|
253
|
-
|
|
291
|
+
|
|
292
|
+
[](#declaring-programmatically)
|
|
293
|
+
|
|
294
|
+
## Declaring Programmatically
|
|
254
295
|
|
|
255
296
|
Add a container to your view XML where you want to programmatically add the map. Give it an id.
|
|
256
297
|
|
|
@@ -258,6 +299,11 @@ Add a container to your view XML where you want to programmatically add the map.
|
|
|
258
299
|
<ContentView id="mapContainer" />
|
|
259
300
|
```
|
|
260
301
|
|
|
302
|
+
|
|
303
|
+
[](#methods)
|
|
304
|
+
|
|
305
|
+
## Methods
|
|
306
|
+
|
|
261
307
|
### show
|
|
262
308
|
```ts
|
|
263
309
|
|
|
@@ -404,7 +450,7 @@ You can update the map style after you've loaded it.
|
|
|
404
450
|
])
|
|
405
451
|
```
|
|
406
452
|
|
|
407
|
-
|
|
453
|
+
### Updating markers
|
|
408
454
|
Plugin version 4.2.0 added the option to update makers. Just call `update` on the `MapboxMarker` reference you created above.
|
|
409
455
|
You can update the following properties (all but the icon really):
|
|
410
456
|
|
|
@@ -853,6 +899,9 @@ Add a listener to retrieve lat and lng of where the user scrolls to on the map.
|
|
|
853
899
|
});
|
|
854
900
|
```
|
|
855
901
|
|
|
902
|
+
|
|
903
|
+
[](#offline-maps)
|
|
904
|
+
|
|
856
905
|
## Offline maps
|
|
857
906
|
For situations where you want the user to pre-load certain regions you can use these methods to create and remove offline regions.
|
|
858
907
|
|
|
@@ -947,6 +996,9 @@ You can remove regions you've previously downloaded. Any region(s) matching the
|
|
|
947
996
|
```
|
|
948
997
|
|
|
949
998
|
|
|
999
|
+
|
|
1000
|
+
[](#permissions)
|
|
1001
|
+
|
|
950
1002
|
## Permissions
|
|
951
1003
|
|
|
952
1004
|
### hasFineLocationPermission / requestFineLocationPermission
|
|
@@ -980,6 +1032,9 @@ Note that `hasFineLocationPermission` will return true when:
|
|
|
980
1032
|
Note that the `show` function will also check for permission if you passed in `showUserLocation : true`.
|
|
981
1033
|
If you didn't request permission before showing the map, and permission was needed, the plugin will ask the user permission while rendering the map.
|
|
982
1034
|
|
|
1035
|
+
|
|
1036
|
+
[](#using-marker-images-from-the-internet)
|
|
1037
|
+
|
|
983
1038
|
## Using marker images from the internet
|
|
984
1039
|
If you specify `icon: 'http(s)://some-remote-image'`, then on iOS you'll need to whitelist
|
|
985
1040
|
the domain. Google for iOS ATS for detailed options, but for a quick test you can add this to
|
|
@@ -992,3 +1047,48 @@ the domain. Google for iOS ATS for detailed options, but for a quick test you ca
|
|
|
992
1047
|
<true/>
|
|
993
1048
|
</dict>
|
|
994
1049
|
```
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
[](#demos-and-development)
|
|
1053
|
+
|
|
1054
|
+
## Demos and Development
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
### Setup
|
|
1058
|
+
|
|
1059
|
+
To run the demos, you must clone this repo **recursively**.
|
|
1060
|
+
|
|
1061
|
+
```
|
|
1062
|
+
git clone https://github.com/@nativescript-community/ui-mapbox.git --recursive
|
|
1063
|
+
```
|
|
1064
|
+
|
|
1065
|
+
**Install Dependencies:**
|
|
1066
|
+
```bash
|
|
1067
|
+
npm i # or 'yarn install' or 'pnpm install'
|
|
1068
|
+
```
|
|
1069
|
+
|
|
1070
|
+
**Interactive Menu:**
|
|
1071
|
+
|
|
1072
|
+
To start the interactive menu, run `npm start` (or `yarn start` or `pnpm start`). This will list all of the commonly used scripts.
|
|
1073
|
+
|
|
1074
|
+
### Build
|
|
1075
|
+
|
|
1076
|
+
```bash
|
|
1077
|
+
npm run build
|
|
1078
|
+
|
|
1079
|
+
npm run build.angular # or for Angular
|
|
1080
|
+
```
|
|
1081
|
+
|
|
1082
|
+
### Demos
|
|
1083
|
+
|
|
1084
|
+
```bash
|
|
1085
|
+
npm run demo.[ng|react|svelte|vue].[ios|android]
|
|
1086
|
+
|
|
1087
|
+
npm run demo.svelte.ios # Example
|
|
1088
|
+
```
|
|
1089
|
+
|
|
1090
|
+
[](#questions)
|
|
1091
|
+
|
|
1092
|
+
## Questions
|
|
1093
|
+
|
|
1094
|
+
If you have any questions/issues/comments please feel free to create an issue or start a conversation in the [NativeScript Community Discord](https://nativescript.org/discord).
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Color, ContentView, ImageSource, Property } from '@nativescript/core';
|
|
2
|
+
export * from './geo.utils';
|
|
3
|
+
export * from './expression/expression-parser';
|
|
4
|
+
export * from './layers/layer-factory';
|
|
5
|
+
export * from './layers/parser/property-parser';
|
|
2
6
|
export declare const MapboxTraceCategory = "NativescriptMapbox";
|
|
3
7
|
export declare enum CLogTypes {
|
|
4
8
|
log,
|
|
@@ -102,7 +106,8 @@ export interface SetViewportOptions {
|
|
|
102
106
|
padding?: number;
|
|
103
107
|
}
|
|
104
108
|
export interface DeleteOfflineRegionOptions {
|
|
105
|
-
|
|
109
|
+
id?: string;
|
|
110
|
+
name?: string;
|
|
106
111
|
}
|
|
107
112
|
export interface MapboxCluster {
|
|
108
113
|
points: number;
|
|
@@ -115,11 +120,13 @@ export interface AddGeoJsonClusteredOptions {
|
|
|
115
120
|
clusterRadius?: number;
|
|
116
121
|
clusters?: MapboxCluster[];
|
|
117
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");
|
|
118
125
|
export interface AddLayerOptions {
|
|
119
126
|
id: string;
|
|
120
127
|
source: string;
|
|
121
128
|
sourceLayer: string;
|
|
122
|
-
type:
|
|
129
|
+
type: SupportedLayerType;
|
|
123
130
|
circleColor?: string | Color;
|
|
124
131
|
circleOpacity?: number;
|
|
125
132
|
circleRadius?: number;
|
|
@@ -162,14 +169,19 @@ export interface GeoJSONSource extends Source {
|
|
|
162
169
|
data?: any;
|
|
163
170
|
minzoom?: number;
|
|
164
171
|
maxzoom?: number;
|
|
172
|
+
lineMetrics?: boolean;
|
|
165
173
|
cluster?: {
|
|
166
174
|
radius: any;
|
|
167
175
|
maxZoom: any;
|
|
176
|
+
properties?: {
|
|
177
|
+
[property: string]: [any, any];
|
|
178
|
+
};
|
|
168
179
|
};
|
|
169
180
|
}
|
|
170
|
-
export declare type UserLocationCameraMode = 'NONE' | 'NONE_COMPASS' | 'NONE_GPS' | 'TRACKING' | '
|
|
181
|
+
export declare type UserLocationCameraMode = 'NONE' | 'NONE_COMPASS' | 'NONE_GPS' | 'TRACKING' | 'TRACKING_COMPASS' | 'TRACKING_GPS' | 'TRACKING_GPS_NORTH';
|
|
171
182
|
export interface TrackUserOptions {
|
|
172
|
-
|
|
183
|
+
cameraMode: UserLocationCameraMode;
|
|
184
|
+
renderMode?: string;
|
|
173
185
|
animated?: boolean;
|
|
174
186
|
}
|
|
175
187
|
export interface AddExtrusionOptions {
|
|
@@ -180,6 +192,9 @@ export interface OfflineRegion {
|
|
|
180
192
|
minZoom: number;
|
|
181
193
|
maxZoom: number;
|
|
182
194
|
style: MapStyle;
|
|
195
|
+
metadata?: any;
|
|
196
|
+
pixelRatio?: any;
|
|
197
|
+
type?: any;
|
|
183
198
|
}
|
|
184
199
|
export interface DownloadProgress {
|
|
185
200
|
name: string;
|
|
@@ -241,6 +256,7 @@ export interface LayerCommon {
|
|
|
241
256
|
getNativeInstance(): any;
|
|
242
257
|
setFilter(filter: any[]): void;
|
|
243
258
|
getFilter(): any[];
|
|
259
|
+
type(): LayerType;
|
|
244
260
|
}
|
|
245
261
|
export interface MapboxCommonApi {
|
|
246
262
|
requestFineLocationPermission(): Promise<any>;
|
|
@@ -296,6 +312,7 @@ export interface MapboxApi {
|
|
|
296
312
|
setOnMapLongClickListener(listener: (data: LatLng) => boolean, nativeMap?: any): Promise<any>;
|
|
297
313
|
setOnScrollListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise<void>;
|
|
298
314
|
setOnMoveBeginListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise<void>;
|
|
315
|
+
setOnMoveEndListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise<void>;
|
|
299
316
|
setOnFlingListener(listener: () => void, nativeMap?: any): Promise<any>;
|
|
300
317
|
setOnCameraMoveListener(listener: (reason: any, animated?: boolean) => void, nativeMap?: any): Promise<any>;
|
|
301
318
|
setOnCameraMoveCancelListener(listener: () => void, nativeMap?: any): Promise<any>;
|
|
@@ -317,6 +334,10 @@ export interface MapboxApi {
|
|
|
317
334
|
x: number;
|
|
318
335
|
y: number;
|
|
319
336
|
};
|
|
337
|
+
projectBack(point: {
|
|
338
|
+
x: number;
|
|
339
|
+
y: number;
|
|
340
|
+
}): LatLng;
|
|
320
341
|
}
|
|
321
342
|
export declare abstract class MapboxCommon implements MapboxCommonApi {
|
|
322
343
|
view?: MapboxViewCommonBase;
|
|
@@ -332,6 +353,7 @@ export declare abstract class MapboxCommon implements MapboxCommonApi {
|
|
|
332
353
|
};
|
|
333
354
|
zoomLevel: number;
|
|
334
355
|
showUserLocation: boolean;
|
|
356
|
+
locationComponentOptions: {};
|
|
335
357
|
hideLogo: boolean;
|
|
336
358
|
hideAttribution: boolean;
|
|
337
359
|
hideCompass: boolean;
|
|
@@ -376,6 +398,7 @@ export interface MapboxViewApi {
|
|
|
376
398
|
changeUserLocationMarkerMode(renderModeString: any, cameraModeString: UserLocationCameraMode): void;
|
|
377
399
|
forceUserLocationUpdate(location: any): void;
|
|
378
400
|
addSource(id: string, options: AddSourceOptions): Promise<any>;
|
|
401
|
+
updateSource(id: string, options: UpdateSourceOptions): Promise<any>;
|
|
379
402
|
removeSource(id: string, nativeMap?: any): Promise<any>;
|
|
380
403
|
addLayer(style: any, belowLayerId?: string): Promise<any>;
|
|
381
404
|
removeLayer(id: string): Promise<any>;
|
|
@@ -397,6 +420,14 @@ export interface MapboxViewApi {
|
|
|
397
420
|
onStop(): Promise<any>;
|
|
398
421
|
onLowMemory(): Promise<any>;
|
|
399
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;
|
|
400
431
|
}
|
|
401
432
|
export declare abstract class MapboxViewCommonBase extends ContentView implements MapboxViewApi {
|
|
402
433
|
protected mapbox: MapboxApi;
|
|
@@ -410,6 +441,7 @@ export declare abstract class MapboxViewCommonBase extends ContentView implement
|
|
|
410
441
|
setOnMapLongClickListener(listener: (data: LatLng) => boolean): Promise<any>;
|
|
411
442
|
setOnScrollListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise<void>;
|
|
412
443
|
setOnMoveBeginListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise<void>;
|
|
444
|
+
setOnMoveEndListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise<void>;
|
|
413
445
|
setOnFlingListener(listener: () => void, nativeMap?: any): Promise<any>;
|
|
414
446
|
setOnCameraMoveListener(listener: (reason: any, animated?: boolean) => void, nativeMap?: any): Promise<any>;
|
|
415
447
|
setOnCameraMoveCancelListener(listener: () => void, nativeMap?: any): Promise<any>;
|
|
@@ -458,6 +490,10 @@ export declare abstract class MapboxViewCommonBase extends ContentView implement
|
|
|
458
490
|
x: number;
|
|
459
491
|
y: number;
|
|
460
492
|
};
|
|
493
|
+
projectBack(screenCoordinate: {
|
|
494
|
+
x: number;
|
|
495
|
+
y: number;
|
|
496
|
+
}): LatLng;
|
|
461
497
|
}
|
|
462
498
|
export declare const mapReadyProperty: Property<MapboxViewCommonBase, string>;
|
|
463
499
|
export declare const zoomLevelProperty: Property<MapboxViewCommonBase, number>;
|
|
@@ -466,6 +502,7 @@ export declare const mapStyleProperty: Property<MapboxViewCommonBase, string>;
|
|
|
466
502
|
export declare const latitudeProperty: Property<MapboxViewCommonBase, number>;
|
|
467
503
|
export declare const longitudeProperty: Property<MapboxViewCommonBase, number>;
|
|
468
504
|
export declare const showUserLocationProperty: Property<MapboxViewCommonBase, boolean>;
|
|
505
|
+
export declare const locationComponentOptionsProperty: Property<MapboxViewCommonBase, object>;
|
|
469
506
|
export declare const hideLogoProperty: Property<MapboxViewCommonBase, boolean>;
|
|
470
507
|
export declare const hideAttributionProperty: Property<MapboxViewCommonBase, boolean>;
|
|
471
508
|
export declare const telemetryProperty: Property<MapboxViewCommonBase, boolean>;
|
|
@@ -479,6 +516,7 @@ export declare abstract class MapboxViewBase extends MapboxViewCommonBase {
|
|
|
479
516
|
static mapReadyEvent: string;
|
|
480
517
|
static scrollEvent: string;
|
|
481
518
|
static moveBeginEvent: string;
|
|
519
|
+
static moveEndEvent: string;
|
|
482
520
|
static locationPermissionGrantedEvent: string;
|
|
483
521
|
static locationPermissionDeniedEvent: string;
|
|
484
522
|
protected config: any;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ContentView, Property, Trace, booleanConverter } from '@nativescript/core';
|
|
2
|
+
export * from './geo.utils';
|
|
3
|
+
export * from './expression/expression-parser';
|
|
4
|
+
export * from './layers/layer-factory';
|
|
5
|
+
export * from './layers/parser/property-parser';
|
|
2
6
|
export const MapboxTraceCategory = 'NativescriptMapbox';
|
|
3
7
|
export var CLogTypes;
|
|
4
8
|
(function (CLogTypes) {
|
|
@@ -59,6 +63,7 @@ MapboxCommon.defaults = {
|
|
|
59
63
|
},
|
|
60
64
|
zoomLevel: 0,
|
|
61
65
|
showUserLocation: false,
|
|
66
|
+
locationComponentOptions: {},
|
|
62
67
|
hideLogo: false,
|
|
63
68
|
hideAttribution: true,
|
|
64
69
|
hideCompass: false,
|
|
@@ -93,6 +98,9 @@ export class MapboxViewCommonBase extends ContentView {
|
|
|
93
98
|
setOnMoveBeginListener(listener, nativeMap) {
|
|
94
99
|
return this.mapbox.setOnMoveBeginListener(listener, this.getNativeMapView());
|
|
95
100
|
}
|
|
101
|
+
setOnMoveEndListener(listener, nativeMap) {
|
|
102
|
+
return this.mapbox.setOnMoveEndListener(listener, this.getNativeMapView());
|
|
103
|
+
}
|
|
96
104
|
setOnFlingListener(listener, nativeMap) {
|
|
97
105
|
return this.mapbox.setOnFlingListener(listener, this.getNativeMapView());
|
|
98
106
|
}
|
|
@@ -228,6 +236,9 @@ export class MapboxViewCommonBase extends ContentView {
|
|
|
228
236
|
project(data) {
|
|
229
237
|
return this.mapbox && this.mapbox.project(data);
|
|
230
238
|
}
|
|
239
|
+
projectBack(screenCoordinate) {
|
|
240
|
+
return this.mapbox && this.mapbox.projectBack(screenCoordinate);
|
|
241
|
+
}
|
|
231
242
|
}
|
|
232
243
|
export const mapReadyProperty = new Property({ name: 'mapReady' });
|
|
233
244
|
mapReadyProperty.register(MapboxViewCommonBase);
|
|
@@ -247,6 +258,11 @@ export const showUserLocationProperty = new Property({
|
|
|
247
258
|
valueConverter: booleanConverter
|
|
248
259
|
});
|
|
249
260
|
showUserLocationProperty.register(MapboxViewCommonBase);
|
|
261
|
+
export const locationComponentOptionsProperty = new Property({
|
|
262
|
+
name: 'locationComponentOptions',
|
|
263
|
+
defaultValue: MapboxCommon.defaults.locationComponentOptions
|
|
264
|
+
});
|
|
265
|
+
locationComponentOptionsProperty.register(MapboxViewCommonBase);
|
|
250
266
|
export const hideLogoProperty = new Property({
|
|
251
267
|
name: 'hideLogo',
|
|
252
268
|
defaultValue: MapboxCommon.defaults.hideLogo,
|
|
@@ -326,6 +342,9 @@ export class MapboxViewBase extends MapboxViewCommonBase {
|
|
|
326
342
|
[showUserLocationProperty.setNative](value) {
|
|
327
343
|
this.config.showUserLocation = value;
|
|
328
344
|
}
|
|
345
|
+
[locationComponentOptionsProperty.setNative](value) {
|
|
346
|
+
this.config.locationComponentOptions = value || {};
|
|
347
|
+
}
|
|
329
348
|
[hideLogoProperty.setNative](value) {
|
|
330
349
|
this.config.hideLogo = value;
|
|
331
350
|
}
|
|
@@ -351,6 +370,7 @@ export class MapboxViewBase extends MapboxViewCommonBase {
|
|
|
351
370
|
MapboxViewBase.mapReadyEvent = 'mapReady';
|
|
352
371
|
MapboxViewBase.scrollEvent = 'scrollEvent';
|
|
353
372
|
MapboxViewBase.moveBeginEvent = 'moveBeginEvent';
|
|
373
|
+
MapboxViewBase.moveEndEvent = 'moveEndEvent';
|
|
354
374
|
MapboxViewBase.locationPermissionGrantedEvent = 'locationPermissionGranted';
|
|
355
375
|
MapboxViewBase.locationPermissionDeniedEvent = 'locationPermissionDenied';
|
|
356
|
-
//# sourceMappingURL=
|
|
376
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export class
|
|
1
|
+
export class ExpressionParser {
|
|
2
2
|
static parseJson(json) {
|
|
3
3
|
const expression = com.mapbox.mapboxsdk.style.expressions.Expression.Converter.convert(JSON.stringify(json));
|
|
4
4
|
return expression;
|
|
@@ -13,4 +13,4 @@ export class FilterParser {
|
|
|
13
13
|
return JSON.parse(filter.toString());
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=expression-parser.android.js.map
|