maplibre-gl 2.0.2 → 2.0.3
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/build/generate-struct-arrays.ts +1 -1
- package/build/post-ts-build.js +0 -9
- package/build/release-notes.js +7 -32
- package/dist/maplibre-gl.d.ts +8 -204
- package/dist/maplibre-gl.js +4 -4
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +14 -11
- package/src/data/array_types.ts +1 -1
- package/src/data/bucket/circle_bucket.ts +1 -1
- package/src/data/bucket/fill_bucket.test.ts +1 -1
- package/src/data/bucket/fill_bucket.ts +1 -1
- package/src/data/bucket/fill_extrusion_bucket.ts +1 -1
- package/src/data/bucket/line_bucket.test.ts +1 -1
- package/src/data/bucket/line_bucket.ts +1 -1
- package/src/data/bucket/symbol_bucket.ts +1 -1
- package/src/data/bucket.ts +1 -1
- package/src/data/evaluation_feature.ts +1 -1
- package/src/data/feature_index.ts +1 -1
- package/src/data/load_geometry.ts +1 -1
- package/src/geo/edge_insets.ts +1 -1
- package/src/geo/transform.test.ts +1 -1
- package/src/geo/transform.ts +1 -1
- package/src/index.ts +1 -1
- package/src/render/draw_symbol.ts +1 -1
- package/src/source/geojson_source.test.ts +27 -0
- package/src/source/geojson_source.ts +1 -3
- package/src/source/geojson_wrapper.ts +1 -1
- package/src/source/query_features.test.ts +1 -1
- package/src/source/query_features.ts +1 -1
- package/src/source/source_cache.test.ts +1 -1
- package/src/source/source_cache.ts +1 -1
- package/src/source/tile.ts +1 -1
- package/src/source/tile_id.ts +1 -1
- package/src/source/vector_tile_worker_source.test.ts +306 -0
- package/src/style/query_utils.ts +1 -1
- package/src/style/style_layer/circle_style_layer.ts +1 -1
- package/src/style/style_layer/fill_extrusion_style_layer.ts +1 -1
- package/src/style/style_layer/fill_style_layer.ts +1 -1
- package/src/style/style_layer/line_style_layer.ts +1 -1
- package/src/style/style_layer.ts +1 -1
- package/src/style-spec/expression/index.ts +1 -1
- package/src/style-spec/feature_filter/feature_filter.test.ts +1 -1
- package/src/style-spec/migrate.test.ts +112 -0
- package/src/style-spec/style-spec.ts +0 -3
- package/src/style-spec/validate_spec.test.ts +29 -0
- package/src/symbol/anchor.ts +1 -1
- package/src/symbol/check_max_angle.test.ts +1 -1
- package/src/symbol/check_max_angle.ts +1 -1
- package/src/symbol/clip_line.test.ts +1 -1
- package/src/symbol/clip_line.ts +1 -1
- package/src/symbol/collision_feature.test.ts +1 -1
- package/src/symbol/collision_feature.ts +1 -1
- package/src/symbol/collision_index.ts +1 -1
- package/src/symbol/get_anchors.test.ts +1 -1
- package/src/symbol/get_anchors.ts +1 -1
- package/src/symbol/mergelines.test.ts +1 -1
- package/src/symbol/path_interpolator.test.ts +1 -1
- package/src/symbol/path_interpolator.ts +1 -1
- package/src/symbol/placement.ts +1 -1
- package/src/symbol/projection.ts +1 -1
- package/src/symbol/quads.ts +1 -1
- package/src/symbol/symbol_layout.ts +1 -1
- package/src/ui/camera.test.ts +0 -8
- package/src/ui/camera.ts +5 -3
- package/src/ui/control/navigation_control.ts +1 -1
- package/src/ui/events.ts +1 -1
- package/src/ui/handler/box_zoom.ts +1 -1
- package/src/ui/handler/click_zoom.ts +1 -1
- package/src/ui/handler/handler_util.ts +1 -1
- package/src/ui/handler/map_event.ts +1 -1
- package/src/ui/handler/mouse.ts +1 -1
- package/src/ui/handler/scroll_zoom.ts +1 -1
- package/src/ui/handler/tap_drag_zoom.ts +1 -1
- package/src/ui/handler/tap_recognizer.ts +1 -1
- package/src/ui/handler/tap_zoom.ts +1 -1
- package/src/ui/handler/touch_pan.ts +1 -1
- package/src/ui/handler/touch_zoom_rotate.ts +1 -1
- package/src/ui/handler_inertia.ts +1 -1
- package/src/ui/handler_manager.ts +1 -1
- package/src/ui/map.ts +2 -2
- package/src/ui/marker.test.ts +1 -1
- package/src/ui/marker.ts +2 -1
- package/src/ui/popup.test.ts +1 -1
- package/src/ui/popup.ts +2 -2
- package/src/util/classify_rings.test.ts +1 -1
- package/src/util/classify_rings.ts +1 -1
- package/src/util/dom.ts +1 -1
- package/src/util/find_pole_of_inaccessibility.test.ts +1 -1
- package/src/util/find_pole_of_inaccessibility.ts +1 -1
- package/src/util/intersection_tests.ts +1 -1
- package/src/util/smart_wrap.ts +1 -1
- package/src/util/util.test.ts +1 -1
- package/src/util/util.ts +1 -1
- package/CHANGELOG.md +0 -2585
- package/dist/package.json +0 -1
- package/src/types/packages-types/vector-tile/index.d.ts +0 -27
- package/src/util/point.ts +0 -349
package/dist/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{ "type": "commonjs" }
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
declare module '@mapbox/vector-tile' {
|
|
2
|
-
import '@mapbox/vector-tile';
|
|
3
|
-
import type Pbf from 'pbf';
|
|
4
|
-
|
|
5
|
-
export class VectorTileLayer {
|
|
6
|
-
version?: number;
|
|
7
|
-
name: string;
|
|
8
|
-
extent: number;
|
|
9
|
-
length: number;
|
|
10
|
-
feature(i: number): VectorTileFeature;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class VectorTile {
|
|
14
|
-
constructor(pbf: Pbf);
|
|
15
|
-
layers: {[_: string]: VectorTileLayer};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class VectorTileFeature {
|
|
19
|
-
static types: ['Unknown', 'Point', 'LineString', 'Polygon'];
|
|
20
|
-
extent: number;
|
|
21
|
-
type: 1 | 2 | 3;
|
|
22
|
-
id: number;
|
|
23
|
-
properties: {[_: string]: string | number | boolean};
|
|
24
|
-
loadGeometry(): Array<Array<Point>>;
|
|
25
|
-
toGeoJSON(x: number, y: number, z: number): GeoJSON.Feature;
|
|
26
|
-
}
|
|
27
|
-
}
|
package/src/util/point.ts
DELETED
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
// based on '@mapbox/point-geometry';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
Copyright (c) 2015, Mapbox <>
|
|
5
|
-
|
|
6
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
8
|
-
copyright notice and this permission notice appear in all copies.
|
|
9
|
-
|
|
10
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
11
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
12
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
13
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
14
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
15
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
16
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import {register} from './web_worker_transfer';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* A {@link Point} or an array of two numbers representing `x` and `y` screen coordinates in pixels.
|
|
23
|
-
*
|
|
24
|
-
* @typedef {(Point | [number, number])} PointLike
|
|
25
|
-
* @example
|
|
26
|
-
* var p1 = new maplibregl.Point(-77, 38); // a PointLike which is a Point
|
|
27
|
-
* var p2 = [-77, 38]; // a PointLike which is an array of two numbers
|
|
28
|
-
*/
|
|
29
|
-
export type PointLike = Point | [number, number];
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* A standalone point geometry with useful accessor, comparison, and
|
|
33
|
-
* modification methods.
|
|
34
|
-
*
|
|
35
|
-
* @class Point
|
|
36
|
-
* @param {Number} x the x-coordinate. this could be longitude or screen
|
|
37
|
-
* pixels, or any other sort of unit.
|
|
38
|
-
* @param {Number} y the y-coordinate. this could be latitude or screen
|
|
39
|
-
* pixels, or any other sort of unit.
|
|
40
|
-
* @example
|
|
41
|
-
* var point = new Point(-77, 38);
|
|
42
|
-
*/
|
|
43
|
-
class Point {
|
|
44
|
-
x: number;
|
|
45
|
-
y: number;
|
|
46
|
-
|
|
47
|
-
constructor(x: number, y: number) {
|
|
48
|
-
this.x = x;
|
|
49
|
-
this.y = y;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Clone this point, returning a new point that can be modified
|
|
54
|
-
* without affecting the old one.
|
|
55
|
-
* @returns {Point} the clone
|
|
56
|
-
*/
|
|
57
|
-
clone() { return new Point(this.x, this.y); }
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Add this point's x & y coordinates to another point,
|
|
61
|
-
* yielding a new point.
|
|
62
|
-
* @param {Point} p the other point
|
|
63
|
-
* @returns {Point} output point
|
|
64
|
-
*/
|
|
65
|
-
add(p) { return this.clone()._add(p); }
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Subtract this point's x & y coordinates to from point,
|
|
69
|
-
* yielding a new point.
|
|
70
|
-
* @param {Point} p the other point
|
|
71
|
-
* @returns {Point} output point
|
|
72
|
-
*/
|
|
73
|
-
sub(p) { return this.clone()._sub(p); }
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Multiply this point's x & y coordinates by point,
|
|
77
|
-
* yielding a new point.
|
|
78
|
-
* @param {Point} p the other point
|
|
79
|
-
* @returns {Point} output point
|
|
80
|
-
*/
|
|
81
|
-
multByPoint(p) { return this.clone()._multByPoint(p); }
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Divide this point's x & y coordinates by point,
|
|
85
|
-
* yielding a new point.
|
|
86
|
-
* @param {Point} p the other point
|
|
87
|
-
* @returns {Point} output point
|
|
88
|
-
*/
|
|
89
|
-
divByPoint(p) { return this.clone()._divByPoint(p); }
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Multiply this point's x & y coordinates by a factor,
|
|
93
|
-
* yielding a new point.
|
|
94
|
-
* @param {Point} k factor
|
|
95
|
-
* @returns {Point} output point
|
|
96
|
-
*/
|
|
97
|
-
mult(k) { return this.clone()._mult(k); }
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Divide this point's x & y coordinates by a factor,
|
|
101
|
-
* yielding a new point.
|
|
102
|
-
* @param {Point} k factor
|
|
103
|
-
* @returns {Point} output point
|
|
104
|
-
*/
|
|
105
|
-
div(k) { return this.clone()._div(k); }
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Rotate this point around the 0, 0 origin by an angle a,
|
|
109
|
-
* given in radians
|
|
110
|
-
* @param {Number} a angle to rotate around, in radians
|
|
111
|
-
* @returns {Point} output point
|
|
112
|
-
*/
|
|
113
|
-
rotate(a) { return this.clone()._rotate(a); }
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Rotate this point around p point by an angle a,
|
|
117
|
-
* given in radians
|
|
118
|
-
* @param {Number} a angle to rotate around, in radians
|
|
119
|
-
* @param {Point} p Point to rotate around
|
|
120
|
-
* @returns {Point} output point
|
|
121
|
-
*/
|
|
122
|
-
rotateAround(a, p) { return this.clone()._rotateAround(a, p); }
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Multiply this point by a 4x1 transformation matrix
|
|
126
|
-
* @param {Array<Number>} m transformation matrix
|
|
127
|
-
* @returns {Point} output point
|
|
128
|
-
*/
|
|
129
|
-
matMult(m) { return this.clone()._matMult(m); }
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Calculate this point but as a unit vector from 0, 0, meaning
|
|
133
|
-
* that the distance from the resulting point to the 0, 0
|
|
134
|
-
* coordinate will be equal to 1 and the angle from the resulting
|
|
135
|
-
* point to the 0, 0 coordinate will be the same as before.
|
|
136
|
-
* @returns {Point} unit vector point
|
|
137
|
-
*/
|
|
138
|
-
unit() { return this.clone()._unit(); }
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Compute a perpendicular point, where the new y coordinate
|
|
142
|
-
* is the old x coordinate and the new x coordinate is the old y
|
|
143
|
-
* coordinate multiplied by -1
|
|
144
|
-
* @returns {Point} perpendicular point
|
|
145
|
-
*/
|
|
146
|
-
perp() { return this.clone()._perp(); }
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Return a version of this point with the x & y coordinates
|
|
150
|
-
* rounded to integers.
|
|
151
|
-
* @returns {Point} rounded point
|
|
152
|
-
*/
|
|
153
|
-
round() { return this.clone()._round(); }
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Return the magitude of this point: this is the Euclidean
|
|
157
|
-
* distance from the 0, 0 coordinate to this point's x and y
|
|
158
|
-
* coordinates.
|
|
159
|
-
* @returns {Number} magnitude
|
|
160
|
-
*/
|
|
161
|
-
mag() {
|
|
162
|
-
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Judge whether this point is equal to another point, returning
|
|
167
|
-
* true or false.
|
|
168
|
-
* @param {Point} other the other point
|
|
169
|
-
* @returns {boolean} whether the points are equal
|
|
170
|
-
*/
|
|
171
|
-
equals(other) {
|
|
172
|
-
return this.x === other.x &&
|
|
173
|
-
this.y === other.y;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Calculate the distance from this point to another point
|
|
178
|
-
* @param {Point} p the other point
|
|
179
|
-
* @returns {Number} distance
|
|
180
|
-
*/
|
|
181
|
-
dist(p) {
|
|
182
|
-
return Math.sqrt(this.distSqr(p));
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Calculate the distance from this point to another point,
|
|
187
|
-
* without the square root step. Useful if you're comparing
|
|
188
|
-
* relative distances.
|
|
189
|
-
* @param {Point} p the other point
|
|
190
|
-
* @returns {Number} distance
|
|
191
|
-
*/
|
|
192
|
-
distSqr(p) {
|
|
193
|
-
const dx = p.x - this.x;
|
|
194
|
-
const dy = p.y - this.y;
|
|
195
|
-
return dx * dx + dy * dy;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Get the angle from the 0, 0 coordinate to this point, in radians
|
|
200
|
-
* coordinates.
|
|
201
|
-
* @returns {Number} angle
|
|
202
|
-
*/
|
|
203
|
-
angle() {
|
|
204
|
-
return Math.atan2(this.y, this.x);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Get the angle from this point to another point, in radians
|
|
209
|
-
* @param {Point} b the other point
|
|
210
|
-
* @returns {Number} angle
|
|
211
|
-
*/
|
|
212
|
-
angleTo(b) {
|
|
213
|
-
return Math.atan2(this.y - b.y, this.x - b.x);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Get the angle between this point and another point, in radians
|
|
218
|
-
* @param {Point} b the other point
|
|
219
|
-
* @returns {Number} angle
|
|
220
|
-
*/
|
|
221
|
-
angleWith(b) {
|
|
222
|
-
return this.angleWithSep(b.x, b.y);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/*
|
|
226
|
-
* Find the angle of the two vectors, solving the formula for
|
|
227
|
-
* the cross product a x b = |a||b|sin(θ) for θ.
|
|
228
|
-
* @param {Number} x the x-coordinate
|
|
229
|
-
* @param {Number} y the y-coordinate
|
|
230
|
-
* @returns {Number} the angle in radians
|
|
231
|
-
*/
|
|
232
|
-
angleWithSep(x, y) {
|
|
233
|
-
return Math.atan2(
|
|
234
|
-
this.x * y - this.y * x,
|
|
235
|
-
this.x * x + this.y * y);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
_matMult(m) {
|
|
239
|
-
const x = m[0] * this.x + m[1] * this.y;
|
|
240
|
-
const y = m[2] * this.x + m[3] * this.y;
|
|
241
|
-
this.x = x;
|
|
242
|
-
this.y = y;
|
|
243
|
-
return this;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
_add(p) {
|
|
247
|
-
this.x += p.x;
|
|
248
|
-
this.y += p.y;
|
|
249
|
-
return this;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
_sub(p) {
|
|
253
|
-
this.x -= p.x;
|
|
254
|
-
this.y -= p.y;
|
|
255
|
-
return this;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
_mult(k) {
|
|
259
|
-
this.x *= k;
|
|
260
|
-
this.y *= k;
|
|
261
|
-
return this;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
_div(k) {
|
|
265
|
-
this.x /= k;
|
|
266
|
-
this.y /= k;
|
|
267
|
-
return this;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
_multByPoint(p) {
|
|
271
|
-
this.x *= p.x;
|
|
272
|
-
this.y *= p.y;
|
|
273
|
-
return this;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
_divByPoint(p) {
|
|
277
|
-
this.x /= p.x;
|
|
278
|
-
this.y /= p.y;
|
|
279
|
-
return this;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
_unit() {
|
|
283
|
-
this._div(this.mag());
|
|
284
|
-
return this;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
_perp() {
|
|
288
|
-
const y = this.y;
|
|
289
|
-
this.y = this.x;
|
|
290
|
-
this.x = -y;
|
|
291
|
-
return this;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
_rotate(angle) {
|
|
295
|
-
const cos = Math.cos(angle);
|
|
296
|
-
const sin = Math.sin(angle);
|
|
297
|
-
const x = cos * this.x - sin * this.y;
|
|
298
|
-
const y = sin * this.x + cos * this.y;
|
|
299
|
-
|
|
300
|
-
this.x = x;
|
|
301
|
-
this.y = y;
|
|
302
|
-
return this;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
_rotateAround(angle, p) {
|
|
306
|
-
const cos = Math.cos(angle);
|
|
307
|
-
const sin = Math.sin(angle);
|
|
308
|
-
const x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y);
|
|
309
|
-
const y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
|
|
310
|
-
|
|
311
|
-
this.x = x;
|
|
312
|
-
this.y = y;
|
|
313
|
-
return this;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
_round() {
|
|
317
|
-
this.x = Math.round(this.x);
|
|
318
|
-
this.y = Math.round(this.y);
|
|
319
|
-
return this;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Construct a point from an array if necessary, otherwise if the input
|
|
324
|
-
* is already a Point, or an unknown type, return it unchanged
|
|
325
|
-
* @param {Array<Number>|Point|*} a any kind of input value
|
|
326
|
-
* @returns {Point} constructed point, or passed-through value.
|
|
327
|
-
* @example
|
|
328
|
-
* // this
|
|
329
|
-
* var point = Point.convert([0, 1]);
|
|
330
|
-
* // is equivalent to
|
|
331
|
-
* var point = new Point(0, 1);
|
|
332
|
-
*/
|
|
333
|
-
static convert(a: PointLike | {x: number; y: number}): Point {
|
|
334
|
-
if (a instanceof Point) {
|
|
335
|
-
return a;
|
|
336
|
-
}
|
|
337
|
-
if (Array.isArray(a)) {
|
|
338
|
-
return new Point(a[0], a[1]);
|
|
339
|
-
}
|
|
340
|
-
if (typeof a.x === 'number') {
|
|
341
|
-
return new Point(a.x, a.y);
|
|
342
|
-
}
|
|
343
|
-
throw new Error(`Unable to convert to point: ${JSON.stringify(a)}`);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
register('Point', Point);
|
|
348
|
-
|
|
349
|
-
export default Point;
|