@rnmapbox/maps 10.0.0-beta.74 → 10.0.0-beta.75
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/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/CameraStop.kt +61 -46
- package/index.d.ts +28 -257
- package/javascript/components/ImageSource.tsx +81 -0
- package/javascript/components/{MapView.js → MapView.tsx} +456 -383
- package/javascript/components/NativeBridgeComponent.tsx +1 -1
- package/javascript/components/RasterDemSource.tsx +105 -0
- package/javascript/components/RasterSource.tsx +124 -0
- package/javascript/modules/offline/{OfflineCreatePackOptions.js → OfflineCreatePackOptions.ts} +21 -6
- package/javascript/modules/offline/{OfflinePack.js → OfflinePack.ts} +19 -4
- package/javascript/modules/offline/{offlineManager.js → offlineManager.ts} +77 -21
- package/javascript/modules/snapshot/{SnapshotOptions.js → SnapshotOptions.ts} +27 -3
- package/javascript/modules/snapshot/{snapshotManager.js → snapshotManager.ts} +1 -1
- package/javascript/utils/geoUtils.ts +91 -0
- package/javascript/utils/{index.js → index.ts} +41 -19
- package/lib/commonjs/components/ImageSource.js +8 -25
- package/lib/commonjs/components/ImageSource.js.map +1 -1
- package/lib/commonjs/components/MapView.js +30 -289
- package/lib/commonjs/components/MapView.js.map +1 -1
- package/lib/commonjs/components/NativeBridgeComponent.js.map +1 -1
- package/lib/commonjs/components/RasterDemSource.js +3 -37
- package/lib/commonjs/components/RasterDemSource.js.map +1 -1
- package/lib/commonjs/components/RasterSource.js +2 -46
- package/lib/commonjs/components/RasterSource.js.map +1 -1
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js +2 -4
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js.map +1 -1
- package/lib/commonjs/modules/offline/OfflinePack.js.map +1 -1
- package/lib/commonjs/modules/offline/offlineManager.js +1 -2
- package/lib/commonjs/modules/offline/offlineManager.js.map +1 -1
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js.map +1 -1
- package/lib/commonjs/modules/snapshot/snapshotManager.js.map +1 -1
- package/lib/commonjs/utils/geoUtils.js +15 -23
- package/lib/commonjs/utils/geoUtils.js.map +1 -1
- package/lib/commonjs/utils/index.js +3 -6
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/components/ImageSource.js +8 -25
- package/lib/module/components/ImageSource.js.map +1 -1
- package/lib/module/components/MapView.js +31 -290
- package/lib/module/components/MapView.js.map +1 -1
- package/lib/module/components/NativeBridgeComponent.js.map +1 -1
- package/lib/module/components/RasterDemSource.js +4 -38
- package/lib/module/components/RasterDemSource.js.map +1 -1
- package/lib/module/components/RasterSource.js +3 -47
- package/lib/module/components/RasterSource.js.map +1 -1
- package/lib/module/modules/offline/OfflineCreatePackOptions.js +2 -4
- package/lib/module/modules/offline/OfflineCreatePackOptions.js.map +1 -1
- package/lib/module/modules/offline/OfflinePack.js.map +1 -1
- package/lib/module/modules/offline/offlineManager.js +0 -1
- package/lib/module/modules/offline/offlineManager.js.map +1 -1
- package/lib/module/modules/snapshot/SnapshotOptions.js.map +1 -1
- package/lib/module/modules/snapshot/snapshotManager.js.map +1 -1
- package/lib/module/utils/geoUtils.js +7 -18
- package/lib/module/utils/geoUtils.js.map +1 -1
- package/lib/module/utils/index.js +3 -5
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/components/ImageSource.d.ts +32 -0
- package/lib/typescript/components/ImageSource.d.ts.map +1 -0
- package/lib/typescript/components/MapView.d.ts +472 -0
- package/lib/typescript/components/MapView.d.ts.map +1 -0
- package/lib/typescript/components/NativeBridgeComponent.d.ts +1 -1
- package/lib/typescript/components/NativeBridgeComponent.d.ts.map +1 -1
- package/lib/typescript/components/PointAnnotation.d.ts +1 -1
- package/lib/typescript/components/RasterDemSource.d.ts +46 -0
- package/lib/typescript/components/RasterDemSource.d.ts.map +1 -0
- package/lib/typescript/components/RasterSource.d.ts +59 -0
- package/lib/typescript/components/RasterSource.d.ts.map +1 -0
- package/lib/typescript/components/ShapeSource.d.ts +1 -1
- package/lib/typescript/components/VectorSource.d.ts +1 -1
- package/lib/typescript/modules/offline/OfflineCreatePackOptions.d.ts +22 -0
- package/lib/typescript/modules/offline/OfflineCreatePackOptions.d.ts.map +1 -0
- package/lib/typescript/modules/offline/OfflinePack.d.ts +24 -0
- package/lib/typescript/modules/offline/OfflinePack.d.ts.map +1 -0
- package/lib/typescript/modules/offline/offlineManager.d.ts +219 -0
- package/lib/typescript/modules/offline/offlineManager.d.ts.map +1 -0
- package/lib/typescript/modules/snapshot/SnapshotOptions.d.ts +41 -0
- package/lib/typescript/modules/snapshot/SnapshotOptions.d.ts.map +1 -0
- package/lib/typescript/modules/snapshot/snapshotManager.d.ts +51 -0
- package/lib/typescript/modules/snapshot/snapshotManager.d.ts.map +1 -0
- package/lib/typescript/utils/geoUtils.d.ts +23 -0
- package/lib/typescript/utils/geoUtils.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts +48 -0
- package/lib/typescript/utils/index.d.ts.map +1 -0
- package/package.json +3 -1
- package/javascript/components/ImageSource.js +0 -82
- package/javascript/components/RasterDemSource.js +0 -106
- package/javascript/components/RasterSource.js +0 -124
- package/javascript/utils/geoUtils.d.ts +0 -10
- package/javascript/utils/geoUtils.js +0 -73
- package/javascript/utils/index.d.ts +0 -27
- package/lib/commonjs/utils/geoUtils.d.js +0 -2
- package/lib/commonjs/utils/geoUtils.d.js.map +0 -1
- package/lib/commonjs/utils/index.d.js +0 -2
- package/lib/commonjs/utils/index.d.js.map +0 -1
- package/lib/module/utils/geoUtils.d.js +0 -2
- package/lib/module/utils/geoUtils.d.js.map +0 -1
- package/lib/module/utils/index.d.js +0 -2
- package/lib/module/utils/index.d.js.map +0 -1
|
@@ -2,42 +2,31 @@ package com.mapbox.rctmgl.components.camera
|
|
|
2
2
|
|
|
3
3
|
import android.animation.Animator
|
|
4
4
|
import android.content.Context
|
|
5
|
-
import com.mapbox.maps.MapView
|
|
6
|
-
import com.mapbox.maps.MapboxMap
|
|
7
5
|
import com.mapbox.rctmgl.utils.GeoJSONUtils.toPointGeometry
|
|
8
6
|
import com.mapbox.rctmgl.utils.GeoJSONUtils.toLatLng
|
|
9
7
|
import com.mapbox.rctmgl.utils.GeoJSONUtils.toLatLngBounds
|
|
10
8
|
import com.mapbox.rctmgl.utils.LatLngBounds
|
|
11
9
|
import com.mapbox.rctmgl.components.mapview.RCTMGLMapView
|
|
12
|
-
import com.mapbox.rctmgl.components.camera.CameraUpdateItem
|
|
13
|
-
import com.mapbox.maps.CameraState
|
|
14
10
|
import com.mapbox.maps.CameraOptions
|
|
15
|
-
import com.mapbox.rctmgl.components.camera.CameraStop
|
|
16
11
|
import com.facebook.react.bridge.ReadableMap
|
|
17
|
-
import com.mapbox.rctmgl.utils.GeoJSONUtils
|
|
18
|
-
import android.util.DisplayMetrics
|
|
19
12
|
import com.mapbox.geojson.FeatureCollection
|
|
20
13
|
import com.mapbox.maps.EdgeInsets
|
|
21
14
|
import com.mapbox.rctmgl.components.camera.constants.CameraMode
|
|
22
15
|
import com.mapbox.rctmgl.utils.LatLng
|
|
23
16
|
|
|
24
|
-
|
|
25
|
-
import com.mapbox.mapboxsdk.camera.CameraPosition;
|
|
26
|
-
import com.mapbox.mapboxsdk.camera.CameraUpdate;
|
|
27
|
-
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
|
|
28
|
-
import com.mapbox.mapboxsdk.geometry.LatLng;
|
|
29
|
-
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
|
|
30
|
-
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
|
31
|
-
*/ class CameraStop {
|
|
17
|
+
class CameraStop {
|
|
32
18
|
private var mBearing: Double? = null
|
|
33
19
|
private var mTilt: Double? = null
|
|
34
20
|
private var mZoom: Double? = null
|
|
21
|
+
|
|
35
22
|
private var mLatLng: LatLng? = null
|
|
36
23
|
private var mBounds: LatLngBounds? = null
|
|
37
|
-
|
|
38
|
-
private var
|
|
39
|
-
private var
|
|
40
|
-
private var
|
|
24
|
+
|
|
25
|
+
private var mPaddingLeft: Int? = null
|
|
26
|
+
private var mPaddingRight: Int? = null
|
|
27
|
+
private var mPaddingBottom: Int? = null
|
|
28
|
+
private var mPaddingTop: Int? = null
|
|
29
|
+
|
|
41
30
|
private var mMode = CameraMode.EASE
|
|
42
31
|
private var mDuration = 2000
|
|
43
32
|
private var mCallback: Animator.AnimatorListener? = null
|
|
@@ -65,6 +54,18 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
|
|
|
65
54
|
mCallback = callback
|
|
66
55
|
}
|
|
67
56
|
|
|
57
|
+
fun setPadding(
|
|
58
|
+
paddingLeft: Int?,
|
|
59
|
+
paddingRight: Int?,
|
|
60
|
+
paddingTop: Int?,
|
|
61
|
+
paddingBottom: Int?
|
|
62
|
+
) {
|
|
63
|
+
mPaddingLeft = paddingLeft
|
|
64
|
+
mPaddingRight = paddingRight
|
|
65
|
+
mPaddingTop = paddingTop
|
|
66
|
+
mPaddingBottom = paddingBottom
|
|
67
|
+
}
|
|
68
|
+
|
|
68
69
|
fun setBounds(
|
|
69
70
|
bounds: LatLngBounds?,
|
|
70
71
|
paddingLeft: Int?,
|
|
@@ -73,21 +74,18 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
|
|
|
73
74
|
paddingBottom: Int?
|
|
74
75
|
) {
|
|
75
76
|
mBounds = bounds
|
|
76
|
-
|
|
77
|
-
mBoundsPaddingRight = paddingRight
|
|
78
|
-
mBoundsPaddingTop = paddingTop
|
|
79
|
-
mBoundsPaddingBottom = paddingBottom
|
|
77
|
+
this.setPadding(paddingLeft, paddingRight, paddingTop, paddingBottom)
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
fun setMode(@CameraMode.Mode mode: Int) {
|
|
83
81
|
mMode = mode
|
|
84
82
|
}
|
|
85
83
|
|
|
86
|
-
fun convert(value: IntArray): EdgeInsets {
|
|
87
|
-
val left = value[0].toDouble()
|
|
88
|
-
val top = value[1].toDouble()
|
|
89
|
-
val right = value[2].toDouble()
|
|
90
|
-
val bottom = value[3].toDouble()
|
|
84
|
+
private fun convert(value: IntArray): EdgeInsets {
|
|
85
|
+
val left = value[0].toDouble()
|
|
86
|
+
val top = value[1].toDouble()
|
|
87
|
+
val right = value[2].toDouble()
|
|
88
|
+
val bottom = value[3].toDouble()
|
|
91
89
|
return EdgeInsets(
|
|
92
90
|
top, left, bottom, right
|
|
93
91
|
)
|
|
@@ -100,7 +98,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
|
|
|
100
98
|
builder.center(currentCamera.center)
|
|
101
99
|
builder.bearing(currentCamera.bearing)
|
|
102
100
|
|
|
103
|
-
val currentPadding = currentCamera.padding
|
|
101
|
+
val currentPadding = currentCamera.padding
|
|
104
102
|
|
|
105
103
|
builder.padding(currentCamera.padding)
|
|
106
104
|
builder.zoom(currentCamera.zoom)
|
|
@@ -110,33 +108,39 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
|
|
|
110
108
|
if (mTilt != null) {
|
|
111
109
|
builder.pitch(mTilt)
|
|
112
110
|
}
|
|
111
|
+
|
|
112
|
+
val paddingLeft: Int = mPaddingLeft ?: currentPadding.left.toInt()
|
|
113
|
+
val paddingTop: Int = mPaddingTop ?: currentPadding.top.toInt()
|
|
114
|
+
val paddingRight: Int = mPaddingRight ?: currentPadding.right.toInt()
|
|
115
|
+
val paddingBottom: Int = mPaddingBottom ?: currentPadding.bottom.toInt()
|
|
116
|
+
val cameraPadding = intArrayOf(paddingLeft, paddingTop, paddingRight, paddingBottom)
|
|
117
|
+
val cameraPaddingClipped = clippedPadding(cameraPadding, mapView)
|
|
118
|
+
val cameraPaddingEdgeInsets = convert(cameraPaddingClipped)
|
|
119
|
+
|
|
113
120
|
if (mLatLng != null) {
|
|
114
121
|
builder.center(mLatLng!!.point)
|
|
122
|
+
builder.padding(cameraPaddingEdgeInsets)
|
|
115
123
|
} else if (mBounds != null) {
|
|
116
124
|
val tilt = if (mTilt != null) mTilt!! else currentCamera.pitch
|
|
117
125
|
val bearing = if (mBearing != null) mBearing!! else currentCamera.bearing
|
|
118
126
|
|
|
119
|
-
val paddingLeft: Int = mBoundsPaddingLeft ?: currentPadding.left.toInt()
|
|
120
|
-
val paddingTop: Int = mBoundsPaddingTop ?: currentPadding.top.toInt()
|
|
121
|
-
val paddingRight: Int = mBoundsPaddingRight ?: currentPadding.right.toInt()
|
|
122
|
-
val paddingBottom: Int = mBoundsPaddingBottom ?: currentPadding.bottom.toInt()
|
|
123
|
-
|
|
124
|
-
val cameraPadding = intArrayOf(paddingLeft, paddingTop, paddingRight, paddingBottom)
|
|
125
|
-
val cameraPaddingClipped = clippedPadding(cameraPadding, mapView)
|
|
126
127
|
val boundsCamera = map.cameraForCoordinateBounds(
|
|
127
128
|
mBounds!!.toBounds(),
|
|
128
|
-
|
|
129
|
+
cameraPaddingEdgeInsets,
|
|
129
130
|
bearing,
|
|
130
131
|
tilt
|
|
131
132
|
)
|
|
133
|
+
|
|
132
134
|
builder.center(boundsCamera.center)
|
|
133
135
|
builder.anchor(boundsCamera.anchor)
|
|
134
136
|
builder.zoom(boundsCamera.zoom)
|
|
135
137
|
builder.padding(boundsCamera.padding)
|
|
136
138
|
}
|
|
139
|
+
|
|
137
140
|
if (mZoom != null) {
|
|
138
141
|
builder.zoom(mZoom)
|
|
139
142
|
}
|
|
143
|
+
|
|
140
144
|
return CameraUpdateItem(map, builder.build(), mDuration, mCallback, mMode)
|
|
141
145
|
}
|
|
142
146
|
|
|
@@ -148,35 +152,44 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
|
|
|
148
152
|
callback: Animator.AnimatorListener?
|
|
149
153
|
): CameraStop {
|
|
150
154
|
val stop = CameraStop()
|
|
155
|
+
|
|
151
156
|
if (readableMap.hasKey("pitch")) {
|
|
152
157
|
stop.setTilt(readableMap.getDouble("pitch"))
|
|
153
158
|
}
|
|
159
|
+
|
|
154
160
|
if (readableMap.hasKey("heading")) {
|
|
155
161
|
stop.setBearing(readableMap.getDouble("heading"))
|
|
156
162
|
}
|
|
163
|
+
|
|
157
164
|
if (readableMap.hasKey("centerCoordinate")) {
|
|
158
165
|
val target = toPointGeometry(readableMap.getString("centerCoordinate"))
|
|
159
166
|
stop.setLatLng(toLatLng(target!!))
|
|
160
167
|
}
|
|
168
|
+
|
|
161
169
|
if (readableMap.hasKey("zoom")) {
|
|
162
170
|
stop.setZoom(readableMap.getDouble("zoom"))
|
|
163
171
|
}
|
|
172
|
+
|
|
164
173
|
if (readableMap.hasKey("duration")) {
|
|
165
174
|
stop.setDuration(readableMap.getInt("duration"))
|
|
166
175
|
}
|
|
167
|
-
if (readableMap.hasKey("bounds")) {
|
|
168
|
-
val metrics = context.resources.displayMetrics
|
|
169
|
-
var paddingTop = getBoundsPaddingByKey(readableMap, metrics.density, "paddingTop")
|
|
170
|
-
var paddingRight = getBoundsPaddingByKey(readableMap, metrics.density, "paddingRight")
|
|
171
|
-
var paddingBottom = getBoundsPaddingByKey(readableMap, metrics.density, "paddingBottom")
|
|
172
|
-
var paddingLeft = getBoundsPaddingByKey(readableMap, metrics.density, "paddingLeft")
|
|
173
176
|
|
|
177
|
+
val metrics = context.resources.displayMetrics
|
|
178
|
+
val paddingTop = getBoundsPaddingByKey(readableMap, metrics.density, "paddingTop")
|
|
179
|
+
val paddingRight = getBoundsPaddingByKey(readableMap, metrics.density, "paddingRight")
|
|
180
|
+
val paddingBottom = getBoundsPaddingByKey(readableMap, metrics.density, "paddingBottom")
|
|
181
|
+
val paddingLeft = getBoundsPaddingByKey(readableMap, metrics.density, "paddingLeft")
|
|
182
|
+
|
|
183
|
+
if (readableMap.hasKey("bounds")) {
|
|
174
184
|
val collection = FeatureCollection.fromJson(readableMap.getString("bounds")!!)
|
|
175
185
|
stop.setBounds(
|
|
176
186
|
toLatLngBounds(collection), paddingLeft, paddingRight,
|
|
177
187
|
paddingTop, paddingBottom
|
|
178
188
|
)
|
|
189
|
+
} else {
|
|
190
|
+
stop.setPadding(paddingLeft, paddingRight, paddingTop, paddingBottom)
|
|
179
191
|
}
|
|
192
|
+
|
|
180
193
|
if (readableMap.hasKey("mode")) {
|
|
181
194
|
when (readableMap.getInt("mode")) {
|
|
182
195
|
CameraMode.FLIGHT -> stop.setMode(CameraMode.FLIGHT)
|
|
@@ -185,7 +198,9 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
|
|
|
185
198
|
else -> stop.setMode(CameraMode.EASE)
|
|
186
199
|
}
|
|
187
200
|
}
|
|
201
|
+
|
|
188
202
|
stop.setCallback(callback)
|
|
203
|
+
|
|
189
204
|
return stop
|
|
190
205
|
}
|
|
191
206
|
|
|
@@ -218,10 +233,10 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
|
|
|
218
233
|
}
|
|
219
234
|
|
|
220
235
|
private fun getBoundsPaddingByKey(map: ReadableMap, density: Float, key: String): Int? {
|
|
221
|
-
if (map.hasKey(key)) {
|
|
222
|
-
|
|
236
|
+
return if (map.hasKey(key)) {
|
|
237
|
+
(map.getInt(key) * density).toInt()
|
|
223
238
|
} else {
|
|
224
|
-
|
|
239
|
+
null
|
|
225
240
|
}
|
|
226
241
|
}
|
|
227
242
|
}
|
package/index.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ import type {
|
|
|
20
20
|
SymbolLayerStyleProps,
|
|
21
21
|
CircleLayerStyleProps,
|
|
22
22
|
FillExtrusionLayerStyleProps,
|
|
23
|
-
SkyLayerStyleProps,
|
|
24
23
|
RasterLayerStyleProps,
|
|
25
24
|
HeatmapLayerStyleProps,
|
|
26
25
|
FillLayerStyleProps,
|
|
@@ -43,6 +42,7 @@ import {
|
|
|
43
42
|
} from './javascript/components/Camera';
|
|
44
43
|
import _Images from './javascript/components/Images';
|
|
45
44
|
import _Image from './javascript/components/Image';
|
|
45
|
+
import _MapView, { _MapState } from './javascript/components/MapView';
|
|
46
46
|
import { MarkerView as _MarkerView } from './javascript/components/MarkerView';
|
|
47
47
|
import { PointAnnotation as _PointAnnotation } from './javascript/components/PointAnnotation';
|
|
48
48
|
import { Atmosphere as _Atmosphere } from './javascript/components/Atmosphere';
|
|
@@ -53,17 +53,22 @@ import {
|
|
|
53
53
|
import _LineLayer, {
|
|
54
54
|
Props as _LineLayerProps,
|
|
55
55
|
} from './javascript/components/LineLayer';
|
|
56
|
+
import _SkyLater from './javascript/components/SkyLayer';
|
|
56
57
|
import { Props as _BackgroundLayerProps } from './javascript/components/BackgroundLayer';
|
|
57
58
|
import { Props as _CircleLayerProps } from './javascript/components/CircleLayer';
|
|
58
59
|
import { Props as _FillLayerProps } from './javascript/components/FillLayer';
|
|
59
60
|
import { Props as _FillExtrusionLayerProps } from './javascript/components/FillExtrusionLayer';
|
|
60
61
|
import { Props as _RasterLayerProps } from './javascript/components/RasterLayer';
|
|
61
62
|
import { Props as _HeatmapLayerProps } from './javascript/components/HeatmapLayer';
|
|
62
|
-
import {
|
|
63
|
+
import _SkyLayer, {
|
|
64
|
+
Props as _SkyLayerProps,
|
|
65
|
+
} from './javascript/components/SkyLayer';
|
|
63
66
|
import {
|
|
64
67
|
ShapeSource as _ShapeSource,
|
|
65
68
|
Props as _ShapeSourceProps,
|
|
66
69
|
} from './javascript/components/ShapeSource';
|
|
70
|
+
import _RasterSource from './javascript/components/RasterSource';
|
|
71
|
+
import _RasterDemSource from './javascript/components/RasterDemSource';
|
|
67
72
|
import _VectorSource from './javascript/components/VectorSource';
|
|
68
73
|
import _Light from './javascript/components/Light';
|
|
69
74
|
import type {
|
|
@@ -84,55 +89,6 @@ import {
|
|
|
84
89
|
Logger as _Logger,
|
|
85
90
|
} from './javascript/utils/Logger';
|
|
86
91
|
|
|
87
|
-
// prettier-ignore
|
|
88
|
-
type ExpressionName =
|
|
89
|
-
// Types
|
|
90
|
-
| 'array' | 'boolean' | 'collator' | 'format' | 'image' | 'literal' | 'number' | 'number-format' | 'object' | 'string'
|
|
91
|
-
| 'to-boolean' | 'to-color' | 'to-number' | 'to-string' | 'typeof'
|
|
92
|
-
// Feature data
|
|
93
|
-
| 'accumulated' | 'feature-state' | 'geometry-type' | 'id' | 'line-progress' | 'properties'
|
|
94
|
-
// Lookup
|
|
95
|
-
| 'at' | 'get' | 'has' | 'in' | 'index-of' | 'length' | 'slice'
|
|
96
|
-
// Decision
|
|
97
|
-
| '!' | '!=' | '<' | '<=' | '==' | '>' | '>=' | 'all' | 'any' | 'case' | 'match' | 'coalesce' | 'within'
|
|
98
|
-
// Ramps, scales, curves
|
|
99
|
-
| 'interpolate' | 'interpolate-hcl' | 'interpolate-lab' | 'step'
|
|
100
|
-
// Variable binding
|
|
101
|
-
| 'let' | 'var'
|
|
102
|
-
// String
|
|
103
|
-
| 'concat' | 'downcase' | 'is-supported-script' | 'resolved-locale' | 'upcase'
|
|
104
|
-
// Color
|
|
105
|
-
| 'rgb' | 'rgba' | 'to-rgba'
|
|
106
|
-
// Math
|
|
107
|
-
| '-' | '*' | '/' | '%' | '^' | '+' | 'abs' | 'acos' | 'asin' | 'atan' | 'ceil' | 'cos' | 'distance' | 'e'
|
|
108
|
-
| 'floor' | 'ln' | 'ln2' | 'log10' | 'log2' | 'max' | 'min' | 'pi' | 'round' | 'sin' | 'sqrt' | 'tan'
|
|
109
|
-
// Zoom, Heatmap
|
|
110
|
-
| 'zoom' | 'heatmap-density';
|
|
111
|
-
|
|
112
|
-
type ExpressionField =
|
|
113
|
-
| string
|
|
114
|
-
| number
|
|
115
|
-
| boolean
|
|
116
|
-
| Expression
|
|
117
|
-
| ExpressionField[]
|
|
118
|
-
| { [key: string]: ExpressionField };
|
|
119
|
-
|
|
120
|
-
export type Expression = [ExpressionName, ...ExpressionField[]];
|
|
121
|
-
|
|
122
|
-
type Anchor =
|
|
123
|
-
| 'center'
|
|
124
|
-
| 'left'
|
|
125
|
-
| 'right'
|
|
126
|
-
| 'top'
|
|
127
|
-
| 'bottom'
|
|
128
|
-
| 'top-left'
|
|
129
|
-
| 'top-right'
|
|
130
|
-
| 'bottom-left'
|
|
131
|
-
| 'bottom-right';
|
|
132
|
-
type Visibility = 'visible' | 'none';
|
|
133
|
-
type Alignment = 'map' | 'viewport';
|
|
134
|
-
type AutoAlignment = Alignment | 'auto';
|
|
135
|
-
|
|
136
92
|
export type OnPressEvent = _OnPressEvent;
|
|
137
93
|
|
|
138
94
|
declare namespace MapboxGL {
|
|
@@ -167,8 +123,14 @@ declare namespace MapboxGL {
|
|
|
167
123
|
const PointAnnotation = _PointAnnotation;
|
|
168
124
|
const SymbolLayer = _SymbolLayer;
|
|
169
125
|
const LineLayer = _LineLayer;
|
|
126
|
+
type LineLayer = _LineLayer;
|
|
170
127
|
const ShapeSource = _ShapeSource;
|
|
171
128
|
type ShapeSource = _ShapeSource;
|
|
129
|
+
const SkyLayer = _SkyLayer;
|
|
130
|
+
type SkyLayer = _SkyLayer;
|
|
131
|
+
|
|
132
|
+
const MapView = _MapView;
|
|
133
|
+
type MapView = _MapView;
|
|
172
134
|
|
|
173
135
|
type MapboxGLEvent = _MapboxGLEvent;
|
|
174
136
|
type UserTrackingMode = _UserTrackingMode;
|
|
@@ -290,41 +252,12 @@ declare namespace MapboxGL {
|
|
|
290
252
|
// layers
|
|
291
253
|
class FillLayer extends Component<_FillLayerProps> {}
|
|
292
254
|
class FillExtrusionLayer extends Component<_FillExtrusionLayerProps> {}
|
|
293
|
-
class LineLayer extends Component<_LineLayerProps> {}
|
|
294
255
|
class CircleLayer extends Component<_CircleLayerProps> {}
|
|
295
256
|
class SymbolLayer extends Component<_SymbolLayerProps> {}
|
|
296
257
|
class RasterLayer extends Component<_RasterLayerProps> {}
|
|
297
258
|
class BackgroundLayer extends Component<_BackgroundLayerProps> {}
|
|
298
259
|
}
|
|
299
260
|
|
|
300
|
-
/**
|
|
301
|
-
* Components
|
|
302
|
-
*/
|
|
303
|
-
export class MapView extends Component<MapViewProps> {
|
|
304
|
-
getPointInView(coordinate: GeoJSON.Position): Promise<GeoJSON.Position>;
|
|
305
|
-
getCoordinateFromView(point: GeoJSON.Position): Promise<GeoJSON.Position>;
|
|
306
|
-
getVisibleBounds(): Promise<GeoJSON.Position[]>;
|
|
307
|
-
queryRenderedFeaturesAtPoint(
|
|
308
|
-
coordinate: GeoJSON.Position,
|
|
309
|
-
filter?: Expression,
|
|
310
|
-
layerIds?: Array<string>,
|
|
311
|
-
): Promise<GeoJSON.FeatureCollection | undefined>;
|
|
312
|
-
queryRenderedFeaturesInRect(
|
|
313
|
-
coordinate: GeoJSON.Position,
|
|
314
|
-
filter?: Expression,
|
|
315
|
-
layerIds?: Array<string>,
|
|
316
|
-
): Promise<GeoJSON.FeatureCollection | undefined>;
|
|
317
|
-
takeSnap(writeToDisk?: boolean): Promise<string>;
|
|
318
|
-
getZoom(): Promise<number>;
|
|
319
|
-
getCenter(): Promise<GeoJSON.Position>;
|
|
320
|
-
showAttribution(): void;
|
|
321
|
-
setSourceVisibility(
|
|
322
|
-
visible: boolean,
|
|
323
|
-
sourceId: string,
|
|
324
|
-
sourceLayerId?: string,
|
|
325
|
-
): void;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
261
|
type Padding = number | [number, number] | [number, number, number, number];
|
|
329
262
|
|
|
330
263
|
class UserLocation extends Component<UserLocationProps> {}
|
|
@@ -332,15 +265,16 @@ declare namespace MapboxGL {
|
|
|
332
265
|
const Light = _Light;
|
|
333
266
|
|
|
334
267
|
class Callout extends Component<CalloutProps> {}
|
|
335
|
-
type Style = FC<StyleProps>;
|
|
336
268
|
|
|
337
269
|
/**
|
|
338
270
|
* Sources
|
|
339
271
|
*/
|
|
340
|
-
type VectorSource =
|
|
272
|
+
type VectorSource = _VectorSource;
|
|
341
273
|
const VectorSource = _VectorSource;
|
|
342
|
-
|
|
343
|
-
|
|
274
|
+
type RasterSource = _RasterSource;
|
|
275
|
+
const RasterSource = _RasterSource;
|
|
276
|
+
type RasterDemSource = RasterDemSource;
|
|
277
|
+
const RasterDemSource = _RasterDemSource;
|
|
344
278
|
|
|
345
279
|
/**
|
|
346
280
|
* Layers
|
|
@@ -349,11 +283,11 @@ declare namespace MapboxGL {
|
|
|
349
283
|
class CircleLayer extends Component<_CircleLayerProps> {}
|
|
350
284
|
class FillExtrusionLayer extends Component<_FillExtrusionLayerProps> {}
|
|
351
285
|
class FillLayer extends Component<_FillLayerProps> {}
|
|
352
|
-
class LineLayer extends Component<_LineLayerProps> {}
|
|
353
286
|
class RasterLayer extends Component<_RasterLayerProps> {}
|
|
354
287
|
class HeatmapLayer extends Component<_HeatmapLayerProps> {}
|
|
355
288
|
class ImageSource extends Component<ImageSourceProps> {}
|
|
356
|
-
|
|
289
|
+
type SkyLayer = _SkyLayer;
|
|
290
|
+
const SkyLayer = _SkyLayer;
|
|
357
291
|
|
|
358
292
|
type Images = _Images;
|
|
359
293
|
const Images = _Images;
|
|
@@ -454,99 +388,6 @@ declare namespace MapboxGL {
|
|
|
454
388
|
}
|
|
455
389
|
}
|
|
456
390
|
|
|
457
|
-
export type OrnamentPosition =
|
|
458
|
-
| { top: number; left: number }
|
|
459
|
-
| { top: number; right: number }
|
|
460
|
-
| { bottom: number; left: number }
|
|
461
|
-
| { bottom: number; right: number };
|
|
462
|
-
|
|
463
|
-
export interface RegionPayload {
|
|
464
|
-
zoomLevel: number;
|
|
465
|
-
heading: number;
|
|
466
|
-
animated: boolean;
|
|
467
|
-
isUserInteraction: boolean;
|
|
468
|
-
visibleBounds: GeoJSON.Position[];
|
|
469
|
-
pitch: number;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* v10 only - experimental
|
|
474
|
-
*/
|
|
475
|
-
export interface MapState {
|
|
476
|
-
properties: {
|
|
477
|
-
center: GeoJSON.Position;
|
|
478
|
-
bounds: {
|
|
479
|
-
ne: GeoJSON.Position;
|
|
480
|
-
sw: GeoJSON.Position;
|
|
481
|
-
};
|
|
482
|
-
zoom: number;
|
|
483
|
-
heading: number;
|
|
484
|
-
pitch: number;
|
|
485
|
-
};
|
|
486
|
-
gestures: {
|
|
487
|
-
isGestureActive: boolean;
|
|
488
|
-
isAnimatingFromGesture: boolean;
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
export interface MapViewProps extends ViewProps {
|
|
493
|
-
animated?: boolean;
|
|
494
|
-
userTrackingMode?: MapboxGL.UserTrackingModes;
|
|
495
|
-
contentInset?: Array<number>;
|
|
496
|
-
projection?: 'mercator' | 'globe';
|
|
497
|
-
style?: StyleProp<ViewStyle>;
|
|
498
|
-
styleURL?: string;
|
|
499
|
-
styleJSON?: string;
|
|
500
|
-
preferredFramesPerSecond?: number;
|
|
501
|
-
localizeLabels?: boolean;
|
|
502
|
-
zoomEnabled?: boolean;
|
|
503
|
-
scrollEnabled?: boolean;
|
|
504
|
-
pitchEnabled?: boolean;
|
|
505
|
-
rotateEnabled?: boolean;
|
|
506
|
-
attributionEnabled?: boolean;
|
|
507
|
-
attributionPosition?: OrnamentPosition;
|
|
508
|
-
logoEnabled?: boolean;
|
|
509
|
-
logoPosition?: OrnamentPosition;
|
|
510
|
-
compassEnabled?: boolean;
|
|
511
|
-
compassFadeWhenNorth?: boolean;
|
|
512
|
-
compassPosition?: OrnamentPosition;
|
|
513
|
-
compassViewPosition?: number;
|
|
514
|
-
compassViewMargins?: Point;
|
|
515
|
-
compassImage?: string;
|
|
516
|
-
scaleBarEnabled?: boolean;
|
|
517
|
-
scaleBarPosition?: OrnamentPosition;
|
|
518
|
-
surfaceView?: boolean;
|
|
519
|
-
regionWillChangeDebounceTime?: number;
|
|
520
|
-
regionDidChangeDebounceTime?: number;
|
|
521
|
-
tintColor?: string;
|
|
522
|
-
|
|
523
|
-
onPress?: (feature: GeoJSON.Feature) => void;
|
|
524
|
-
onLongPress?: (feature: GeoJSON.Feature) => void;
|
|
525
|
-
onRegionWillChange?: (
|
|
526
|
-
feature: GeoJSON.Feature<GeoJSON.Point, RegionPayload>,
|
|
527
|
-
) => void;
|
|
528
|
-
onRegionIsChanging?: (
|
|
529
|
-
feature: GeoJSON.Feature<GeoJSON.Point, RegionPayload>,
|
|
530
|
-
) => void;
|
|
531
|
-
onRegionDidChange?: (
|
|
532
|
-
feature: GeoJSON.Feature<GeoJSON.Point, RegionPayload>,
|
|
533
|
-
) => void;
|
|
534
|
-
onCameraChanged?: (state: MapState) => void;
|
|
535
|
-
onMapIdle?: (state: MapState) => void;
|
|
536
|
-
onUserLocationUpdate?: (feature: Location) => void;
|
|
537
|
-
onWillStartLoadingMap?: () => void;
|
|
538
|
-
onDidFinishLoadingMap?: () => void;
|
|
539
|
-
onDidFailLoadingMap?: () => void;
|
|
540
|
-
onWillStartRenderingFrame?: () => void;
|
|
541
|
-
onDidFinishRenderingFrame?: () => void;
|
|
542
|
-
onDidFinishRenderingFrameFully?: () => void;
|
|
543
|
-
onWillStartRenderingMap?: () => void;
|
|
544
|
-
onDidFinishRenderingMap?: () => void;
|
|
545
|
-
onDidFinishRenderingMapFully?: () => void;
|
|
546
|
-
onDidFinishLoadingStyle?: () => void;
|
|
547
|
-
onUserTrackingModeChange?: () => void;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
391
|
export interface UserLocationProps {
|
|
551
392
|
androidRenderMode?: 'normal' | 'compass' | 'gps';
|
|
552
393
|
animated?: boolean;
|
|
@@ -560,20 +401,6 @@ export interface UserLocationProps {
|
|
|
560
401
|
visible?: boolean;
|
|
561
402
|
}
|
|
562
403
|
|
|
563
|
-
export type WithExpression<T> = {
|
|
564
|
-
[P in keyof T]: T[P] | Expression;
|
|
565
|
-
};
|
|
566
|
-
|
|
567
|
-
export interface LightStyle {
|
|
568
|
-
anchor?: Alignment | Expression;
|
|
569
|
-
position?: GeoJSON.Position | Expression;
|
|
570
|
-
positionTransition?: Transition | Expression;
|
|
571
|
-
color?: string | Expression;
|
|
572
|
-
colorTransition?: Transition | Expression;
|
|
573
|
-
intensity?: number | Expression;
|
|
574
|
-
intensityTransition?: Transition | Expression;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
404
|
export interface Transition {
|
|
578
405
|
duration: number;
|
|
579
406
|
delay: number;
|
|
@@ -593,17 +420,6 @@ export type LineLayerStyle = LineLayerStyleProps;
|
|
|
593
420
|
|
|
594
421
|
export type RasterLayerStyle = RasterLayerStyleProps;
|
|
595
422
|
|
|
596
|
-
export type TextVariableAnchorValues =
|
|
597
|
-
| 'center'
|
|
598
|
-
| 'left'
|
|
599
|
-
| 'right'
|
|
600
|
-
| 'top'
|
|
601
|
-
| 'bottom'
|
|
602
|
-
| 'top-left'
|
|
603
|
-
| 'top-right'
|
|
604
|
-
| 'bottom-left'
|
|
605
|
-
| 'bottom-right';
|
|
606
|
-
|
|
607
423
|
export type SymbolLayerStyle = SymbolLayerStyleProps;
|
|
608
424
|
export type LineLayerStyle = LineLayerStyleProps;
|
|
609
425
|
|
|
@@ -614,56 +430,13 @@ export interface Point {
|
|
|
614
430
|
y: number;
|
|
615
431
|
}
|
|
616
432
|
|
|
617
|
-
export interface LightProps extends Omit<ViewProps, 'style'> {
|
|
618
|
-
style?: LightStyle;
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
export interface StyleProps {
|
|
622
|
-
json: any;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
433
|
export interface CalloutProps extends Omit<ViewProps, 'style'> {
|
|
626
434
|
title?: string;
|
|
627
|
-
style?: StyleProp<
|
|
628
|
-
containerStyle?: StyleProp<
|
|
629
|
-
contentStyle?: StyleProp<
|
|
630
|
-
tipStyle?: StyleProp<
|
|
631
|
-
textStyle?: StyleProp<
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
export interface TileSourceProps extends ViewProps {
|
|
635
|
-
id: string;
|
|
636
|
-
url?: string;
|
|
637
|
-
tileUrlTemplates?: Array<string>;
|
|
638
|
-
minZoomLevel?: number;
|
|
639
|
-
maxZoomLevel?: number;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
export interface RasterSourceProps extends TileSourceProps {
|
|
643
|
-
tileSize?: number;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
export interface LayerBaseProps<T = object> extends Omit<ViewProps, 'style'> {
|
|
647
|
-
id: string;
|
|
648
|
-
sourceID?: string;
|
|
649
|
-
sourceLayerID?: string;
|
|
650
|
-
aboveLayerID?: string;
|
|
651
|
-
belowLayerID?: string;
|
|
652
|
-
layerIndex?: number;
|
|
653
|
-
filter?: Expression;
|
|
654
|
-
minZoomLevel?: number;
|
|
655
|
-
maxZoomLevel?: number;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
export interface ImageSourceProps extends ViewProps {
|
|
659
|
-
id: string;
|
|
660
|
-
url?: number | string;
|
|
661
|
-
coordinates: [
|
|
662
|
-
GeoJSON.Position,
|
|
663
|
-
GeoJSON.Position,
|
|
664
|
-
GeoJSON.Position,
|
|
665
|
-
GeoJSON.Position,
|
|
666
|
-
];
|
|
435
|
+
style?: StyleProp<ViewStyle>;
|
|
436
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
437
|
+
contentStyle?: StyleProp<ViewStyle>;
|
|
438
|
+
tipStyle?: StyleProp<ViewStyle>;
|
|
439
|
+
textStyle?: StyleProp<TextStyle>;
|
|
667
440
|
}
|
|
668
441
|
|
|
669
442
|
export interface OfflineCreatePackOptions {
|
|
@@ -686,11 +459,6 @@ export interface SnapshotOptions {
|
|
|
686
459
|
writeToDisk?: boolean;
|
|
687
460
|
}
|
|
688
461
|
|
|
689
|
-
export interface SkyLayerProps extends LayerBaseProps {
|
|
690
|
-
id: string;
|
|
691
|
-
style?: StyleProp<SkyLayerStyle>;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
462
|
export import Logger = MapboxGL.Logger;
|
|
695
463
|
|
|
696
464
|
export import MapView = MapboxGL.MapView;
|
|
@@ -737,6 +505,9 @@ export import Images = MapboxGL.Images;
|
|
|
737
505
|
export import Image = MapboxGL.Image;
|
|
738
506
|
export import Light = MapboxGL.Light;
|
|
739
507
|
export import VectorSource = MapboxGL.VectorSource;
|
|
508
|
+
export import MapView = MapboxGL.MapView;
|
|
509
|
+
export import SkyLayer = MapboxGL.SkyLayer;
|
|
510
|
+
export import MapState = _MapState;
|
|
740
511
|
|
|
741
512
|
export const { offlineManager } = MapboxGL;
|
|
742
513
|
|