maplibre-gl 2.0.0 → 2.0.4
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 +4 -4
- package/build/post-ts-build.js +1 -0
- package/build/release-notes.js +7 -32
- package/dist/maplibre-gl.d.ts +69 -195
- package/dist/maplibre-gl.js +4 -4
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +16 -15
- package/src/data/array_types.ts +21 -21
- package/src/data/bucket/circle_bucket.ts +1 -1
- package/src/data/bucket/fill_bucket.test.ts +2 -2
- 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 +2 -2
- 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 +3 -3
- 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 +5 -9
- 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.ts +2 -2
- package/src/source/source_cache.test.ts +3 -3
- 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/source/worker_tile.test.ts +2 -1
- package/src/style/query_utils.ts +1 -1
- package/src/style/style.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 +13 -16
- 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/transferable_grid_index.test.ts +56 -0
- package/src/util/transferable_grid_index.ts +216 -0
- package/src/util/util.test.ts +1 -1
- package/src/util/util.ts +1 -1
- package/src/util/web_worker_transfer.ts +1 -17
- package/CHANGELOG.md +0 -2572
- package/src/types/non-typed-modules.d.ts +0 -47
- package/src/util/point.ts +0 -349
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maplibre-gl",
|
|
3
3
|
"description": "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.4",
|
|
5
5
|
"main": "dist/maplibre-gl.js",
|
|
6
6
|
"style": "dist/maplibre-gl.css",
|
|
7
7
|
"license": "BSD-3-Clause",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "git://github.com/maplibre/maplibre-gl-js.git"
|
|
11
11
|
},
|
|
12
12
|
"engines": {
|
|
13
|
-
"node": ">=
|
|
13
|
+
"node": ">=16.0.0"
|
|
14
14
|
},
|
|
15
15
|
"types": "dist/maplibre-gl.d.ts",
|
|
16
16
|
"type": "module",
|
|
@@ -18,20 +18,24 @@
|
|
|
18
18
|
"@mapbox/geojson-rewind": "^0.5.0",
|
|
19
19
|
"@mapbox/jsonlint-lines-primitives": "^2.0.2",
|
|
20
20
|
"@mapbox/mapbox-gl-supported": "^2.0.1",
|
|
21
|
+
"@mapbox/point-geometry": "^0.1.0",
|
|
21
22
|
"@mapbox/tiny-sdf": "^2.0.4",
|
|
22
23
|
"@mapbox/unitbezier": "^0.0.1",
|
|
23
24
|
"@mapbox/vector-tile": "^1.3.1",
|
|
24
25
|
"@mapbox/whoots-js": "^3.1.0",
|
|
26
|
+
"@types/geojson": "^7946.0.7",
|
|
27
|
+
"@types/mapbox__point-geometry": "^0.1.2",
|
|
28
|
+
"@types/mapbox__vector-tile": "^1.3.0",
|
|
29
|
+
"@types/pbf": "^3.0.2",
|
|
25
30
|
"csscolorparser": "~1.0.3",
|
|
26
31
|
"earcut": "^2.2.2",
|
|
27
32
|
"geojson-vt": "^3.2.1",
|
|
28
33
|
"gl-matrix": "^3.2.1",
|
|
29
|
-
"grid-index": "^1.1.0",
|
|
30
34
|
"murmurhash-js": "^1.0.0",
|
|
31
35
|
"pbf": "^3.2.1",
|
|
32
36
|
"potpack": "^1.0.1",
|
|
33
37
|
"quickselect": "^2.0.0",
|
|
34
|
-
"supercluster": "^7.1.
|
|
38
|
+
"supercluster": "^7.1.4",
|
|
35
39
|
"tinyqueue": "^2.0.3",
|
|
36
40
|
"vt-pbf": "^3.1.1"
|
|
37
41
|
},
|
|
@@ -57,7 +61,6 @@
|
|
|
57
61
|
"@types/earcut": "^2.1.1",
|
|
58
62
|
"@types/ejs": "^3.1.0",
|
|
59
63
|
"@types/eslint": "^8.2.1",
|
|
60
|
-
"@types/geojson": "^7946.0.7",
|
|
61
64
|
"@types/gl": "^4.1.0",
|
|
62
65
|
"@types/glob": "^7.1.3",
|
|
63
66
|
"@types/jest": "^27.0.2",
|
|
@@ -69,7 +72,6 @@
|
|
|
69
72
|
"@types/node-notifier": "^8.0.0",
|
|
70
73
|
"@types/npm-packlist": "^1.1.1",
|
|
71
74
|
"@types/offscreencanvas": "^2019.6.3",
|
|
72
|
-
"@types/pbf": "^3.0.2",
|
|
73
75
|
"@types/pixelmatch": "^5.2.2",
|
|
74
76
|
"@types/pngjs": "^6.0.1",
|
|
75
77
|
"@types/puppeteer": "^5.4.4",
|
|
@@ -84,16 +86,15 @@
|
|
|
84
86
|
"@types/supercluster": "^5.0.2",
|
|
85
87
|
"@types/tape": "^4.13.2",
|
|
86
88
|
"@types/window-or-global": "^1.0.4",
|
|
87
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
88
|
-
"@typescript-eslint/parser": "^
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
|
90
|
+
"@typescript-eslint/parser": "^5.9.1",
|
|
89
91
|
"address": "^1.1.2",
|
|
90
92
|
"babel-eslint": "^10.0.1",
|
|
91
93
|
"babel-jest": "^27.2.5",
|
|
92
94
|
"babelify": "^10.0.0",
|
|
93
95
|
"benchmark": "^2.1.4",
|
|
94
96
|
"browserify": "^17.0.0",
|
|
95
|
-
"canvas": "^2.
|
|
96
|
-
"chalk": "^4.1.2",
|
|
97
|
+
"canvas": "^2.9.0",
|
|
97
98
|
"chokidar": "^3.0.2",
|
|
98
99
|
"cssnano": "^5.0.8",
|
|
99
100
|
"d3": "^4.12.0",
|
|
@@ -108,7 +109,7 @@
|
|
|
108
109
|
"eslint-plugin-jest": "^25.2.2",
|
|
109
110
|
"eslint-plugin-jsdoc": "^37.0.3",
|
|
110
111
|
"eslint-plugin-react": "^7.25.1",
|
|
111
|
-
"gl": "^
|
|
112
|
+
"gl": "^5.0.0",
|
|
112
113
|
"glob": "^7.1.4",
|
|
113
114
|
"is-builtin-module": "^3.0.0",
|
|
114
115
|
"jest": "^27.2.4",
|
|
@@ -169,7 +170,7 @@
|
|
|
169
170
|
"testem": "^3.5.0",
|
|
170
171
|
"ts-jest": "^27.0.5",
|
|
171
172
|
"ts-node": "^10.2.1",
|
|
172
|
-
"typescript": "^4.4
|
|
173
|
+
"typescript": "^4.5.4"
|
|
173
174
|
},
|
|
174
175
|
"browser": {
|
|
175
176
|
"./rollup/build/tsc/src/util/web_worker.js": "./build/web_worker_replacement.js"
|
|
@@ -212,12 +213,12 @@
|
|
|
212
213
|
"test-expressions": "node --experimental-specifier-resolution=node test/expression.test.js",
|
|
213
214
|
"test-cov": "nyc --reporter=text-summary --reporter=lcov --cache run-s test-unit test-expressions test-query test-render",
|
|
214
215
|
"test-jest": "jest",
|
|
215
|
-
"codegen": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-style-code.ts && node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-struct-arrays.ts && node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-style-spec.ts"
|
|
216
|
+
"codegen": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-style-code.ts && node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-struct-arrays.ts && node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-style-spec.ts",
|
|
217
|
+
"gl-stats": "node bench/gl-stats.js"
|
|
216
218
|
},
|
|
217
219
|
"files": [
|
|
218
220
|
"build/",
|
|
219
|
-
"dist
|
|
220
|
-
"dist/style-spec/",
|
|
221
|
+
"dist/*",
|
|
221
222
|
"src/"
|
|
222
223
|
]
|
|
223
224
|
}
|
package/src/data/array_types.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import assert from 'assert';
|
|
4
4
|
import {Struct, StructArray} from '../util/struct_array';
|
|
5
5
|
import {register} from '../util/web_worker_transfer';
|
|
6
|
-
import Point from '
|
|
6
|
+
import Point from '@mapbox/point-geometry';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Implementation of the StructArray layout:
|
|
@@ -1031,6 +1031,25 @@ export class FeatureIndexArray extends StructArrayLayout1ul2ui8 {
|
|
|
1031
1031
|
|
|
1032
1032
|
register('FeatureIndexArray', FeatureIndexArray);
|
|
1033
1033
|
|
|
1034
|
+
export class PosArray extends StructArrayLayout2i4 {}
|
|
1035
|
+
export class RasterBoundsArray extends StructArrayLayout4i8 {}
|
|
1036
|
+
export class CircleLayoutArray extends StructArrayLayout2i4 {}
|
|
1037
|
+
export class FillLayoutArray extends StructArrayLayout2i4 {}
|
|
1038
|
+
export class FillExtrusionLayoutArray extends StructArrayLayout2i4i12 {}
|
|
1039
|
+
export class HeatmapLayoutArray extends StructArrayLayout2i4 {}
|
|
1040
|
+
export class LineLayoutArray extends StructArrayLayout2i4ub8 {}
|
|
1041
|
+
export class LineExtLayoutArray extends StructArrayLayout2f8 {}
|
|
1042
|
+
export class PatternLayoutArray extends StructArrayLayout10ui20 {}
|
|
1043
|
+
export class SymbolLayoutArray extends StructArrayLayout4i4ui4i24 {}
|
|
1044
|
+
export class SymbolDynamicLayoutArray extends StructArrayLayout3f12 {}
|
|
1045
|
+
export class SymbolOpacityArray extends StructArrayLayout1ul4 {}
|
|
1046
|
+
export class CollisionBoxLayoutArray extends StructArrayLayout2i2i2i12 {}
|
|
1047
|
+
export class CollisionCircleLayoutArray extends StructArrayLayout2f1f2i16 {}
|
|
1048
|
+
export class CollisionVertexArray extends StructArrayLayout2ub2f12 {}
|
|
1049
|
+
export class QuadTriangleArray extends StructArrayLayout3ui6 {}
|
|
1050
|
+
export class TriangleIndexArray extends StructArrayLayout3ui6 {}
|
|
1051
|
+
export class LineIndexArray extends StructArrayLayout2ui4 {}
|
|
1052
|
+
export class LineStripIndexArray extends StructArrayLayout1ui2 {}
|
|
1034
1053
|
export {
|
|
1035
1054
|
StructArrayLayout2i4,
|
|
1036
1055
|
StructArrayLayout4i8,
|
|
@@ -1053,24 +1072,5 @@ export {
|
|
|
1053
1072
|
StructArrayLayout1ul2ui8,
|
|
1054
1073
|
StructArrayLayout2ui4,
|
|
1055
1074
|
StructArrayLayout1ui2,
|
|
1056
|
-
StructArrayLayout4f16
|
|
1057
|
-
StructArrayLayout2i4 as PosArray,
|
|
1058
|
-
StructArrayLayout4i8 as RasterBoundsArray,
|
|
1059
|
-
StructArrayLayout2i4 as CircleLayoutArray,
|
|
1060
|
-
StructArrayLayout2i4 as FillLayoutArray,
|
|
1061
|
-
StructArrayLayout2i4i12 as FillExtrusionLayoutArray,
|
|
1062
|
-
StructArrayLayout2i4 as HeatmapLayoutArray,
|
|
1063
|
-
StructArrayLayout2i4ub8 as LineLayoutArray,
|
|
1064
|
-
StructArrayLayout2f8 as LineExtLayoutArray,
|
|
1065
|
-
StructArrayLayout10ui20 as PatternLayoutArray,
|
|
1066
|
-
StructArrayLayout4i4ui4i24 as SymbolLayoutArray,
|
|
1067
|
-
StructArrayLayout3f12 as SymbolDynamicLayoutArray,
|
|
1068
|
-
StructArrayLayout1ul4 as SymbolOpacityArray,
|
|
1069
|
-
StructArrayLayout2i2i2i12 as CollisionBoxLayoutArray,
|
|
1070
|
-
StructArrayLayout2f1f2i16 as CollisionCircleLayoutArray,
|
|
1071
|
-
StructArrayLayout2ub2f12 as CollisionVertexArray,
|
|
1072
|
-
StructArrayLayout3ui6 as QuadTriangleArray,
|
|
1073
|
-
StructArrayLayout3ui6 as TriangleIndexArray,
|
|
1074
|
-
StructArrayLayout2ui4 as LineIndexArray,
|
|
1075
|
-
StructArrayLayout1ui2 as LineStripIndexArray
|
|
1075
|
+
StructArrayLayout4f16
|
|
1076
1076
|
};
|
|
@@ -23,7 +23,7 @@ import type HeatmapStyleLayer from '../../style/style_layer/heatmap_style_layer'
|
|
|
23
23
|
import type Context from '../../gl/context';
|
|
24
24
|
import type IndexBuffer from '../../gl/index_buffer';
|
|
25
25
|
import type VertexBuffer from '../../gl/vertex_buffer';
|
|
26
|
-
import type Point from '
|
|
26
|
+
import type Point from '@mapbox/point-geometry';
|
|
27
27
|
import type {FeatureStates} from '../../source/source_state';
|
|
28
28
|
import type {ImagePosition} from '../../render/image_atlas';
|
|
29
29
|
import type {VectorTileLayer} from '@mapbox/vector-tile';
|
|
@@ -3,7 +3,7 @@ import fs from 'fs';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import Protobuf from 'pbf';
|
|
5
5
|
import {VectorTile} from '@mapbox/vector-tile';
|
|
6
|
-
import Point from '
|
|
6
|
+
import Point from '@mapbox/point-geometry';
|
|
7
7
|
import segment from '../segment';
|
|
8
8
|
import FillBucket from './fill_bucket';
|
|
9
9
|
import FillStyleLayer from '../../style/style_layer/fill_style_layer';
|
|
@@ -42,7 +42,7 @@ test('FillBucket', () => {
|
|
|
42
42
|
new Point(10, 20)
|
|
43
43
|
]], undefined, undefined, undefined);
|
|
44
44
|
|
|
45
|
-
bucket.addFeature(feature, feature.loadGeometry(), undefined, undefined, undefined);
|
|
45
|
+
bucket.addFeature(feature as any, feature.loadGeometry(), undefined, undefined, undefined);
|
|
46
46
|
}).not.toThrow();
|
|
47
47
|
});
|
|
48
48
|
|
|
@@ -26,7 +26,7 @@ import type FillStyleLayer from '../../style/style_layer/fill_style_layer';
|
|
|
26
26
|
import type Context from '../../gl/context';
|
|
27
27
|
import type IndexBuffer from '../../gl/index_buffer';
|
|
28
28
|
import type VertexBuffer from '../../gl/vertex_buffer';
|
|
29
|
-
import type Point from '
|
|
29
|
+
import type Point from '@mapbox/point-geometry';
|
|
30
30
|
import type {FeatureStates} from '../../source/source_state';
|
|
31
31
|
import type {ImagePosition} from '../../render/image_atlas';
|
|
32
32
|
import type {VectorTileLayer} from '@mapbox/vector-tile';
|
|
@@ -30,7 +30,7 @@ import type FillExtrusionStyleLayer from '../../style/style_layer/fill_extrusion
|
|
|
30
30
|
import type Context from '../../gl/context';
|
|
31
31
|
import type IndexBuffer from '../../gl/index_buffer';
|
|
32
32
|
import type VertexBuffer from '../../gl/vertex_buffer';
|
|
33
|
-
import type Point from '
|
|
33
|
+
import type Point from '@mapbox/point-geometry';
|
|
34
34
|
import type {FeatureStates} from '../../source/source_state';
|
|
35
35
|
import type {ImagePosition} from '../../render/image_atlas';
|
|
36
36
|
import type {VectorTileLayer} from '@mapbox/vector-tile';
|
|
@@ -2,7 +2,7 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import Protobuf from 'pbf';
|
|
4
4
|
import {VectorTile} from '@mapbox/vector-tile';
|
|
5
|
-
import Point from '
|
|
5
|
+
import Point from '@mapbox/point-geometry';
|
|
6
6
|
import segment from '../segment';
|
|
7
7
|
import LineBucket from './line_bucket';
|
|
8
8
|
import LineStyleLayer from '../../style/style_layer/line_style_layer';
|
|
@@ -96,7 +96,7 @@ describe('LineBucket', () => {
|
|
|
96
96
|
new Point(0, 0)
|
|
97
97
|
], polygon, undefined, undefined, undefined, undefined);
|
|
98
98
|
|
|
99
|
-
bucket.addFeature(feature, feature.loadGeometry(), undefined, undefined, undefined);
|
|
99
|
+
bucket.addFeature(feature as any, feature.loadGeometry(), undefined, undefined, undefined);
|
|
100
100
|
}).not.toThrow();
|
|
101
101
|
});
|
|
102
102
|
|
|
@@ -23,7 +23,7 @@ import type {
|
|
|
23
23
|
PopulateParameters
|
|
24
24
|
} from '../bucket';
|
|
25
25
|
import type LineStyleLayer from '../../style/style_layer/line_style_layer';
|
|
26
|
-
import type Point from '
|
|
26
|
+
import type Point from '@mapbox/point-geometry';
|
|
27
27
|
import type {Segment} from '../segment';
|
|
28
28
|
import {RGBAImage} from '../../util/image';
|
|
29
29
|
import type Context from '../../gl/context';
|
|
@@ -16,7 +16,7 @@ import {SymbolLayoutArray,
|
|
|
16
16
|
SymbolLineVertexArray
|
|
17
17
|
} from '../array_types';
|
|
18
18
|
|
|
19
|
-
import Point from '
|
|
19
|
+
import Point from '@mapbox/point-geometry';
|
|
20
20
|
import SegmentVector from '../segment';
|
|
21
21
|
import {ProgramConfigurationSet} from '../program_configuration';
|
|
22
22
|
import {TriangleIndexArray, LineIndexArray} from '../index_array_type';
|
package/src/data/bucket.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type {FeatureStates} from '../source/source_state';
|
|
|
7
7
|
import type {ImagePosition} from '../render/image_atlas';
|
|
8
8
|
import type {CanonicalTileID} from '../source/tile_id';
|
|
9
9
|
import type {VectorTileFeature, VectorTileLayer} from '@mapbox/vector-tile';
|
|
10
|
-
import Point from '
|
|
10
|
+
import Point from '@mapbox/point-geometry';
|
|
11
11
|
|
|
12
12
|
export type BucketParameters<Layer extends TypedStyleLayer> = {
|
|
13
13
|
index: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Point from '
|
|
1
|
+
import Point from '@mapbox/point-geometry';
|
|
2
2
|
import loadGeometry from './load_geometry';
|
|
3
3
|
import toEvaluationFeature from './evaluation_feature';
|
|
4
4
|
import EXTENT from './extent';
|
|
5
5
|
import featureFilter from '../style-spec/feature_filter';
|
|
6
|
-
import TransferableGridIndex from '
|
|
6
|
+
import TransferableGridIndex from '../util/transferable_grid_index';
|
|
7
7
|
import DictionaryCoder from '../util/dictionary_coder';
|
|
8
8
|
import vt from '@mapbox/vector-tile';
|
|
9
9
|
import Protobuf from 'pbf';
|
|
@@ -296,7 +296,7 @@ class FeatureIndex {
|
|
|
296
296
|
let id: string | number = feature.id;
|
|
297
297
|
if (this.promoteId) {
|
|
298
298
|
const propName = typeof this.promoteId === 'string' ? this.promoteId : this.promoteId[sourceLayerId];
|
|
299
|
-
id = feature.properties[propName];
|
|
299
|
+
id = feature.properties[propName] as string | number;
|
|
300
300
|
if (typeof id === 'boolean') id = Number(id);
|
|
301
301
|
}
|
|
302
302
|
return id;
|
|
@@ -2,7 +2,7 @@ import {warnOnce, clamp} from '../util/util';
|
|
|
2
2
|
|
|
3
3
|
import EXTENT from './extent';
|
|
4
4
|
|
|
5
|
-
import type Point from '
|
|
5
|
+
import type Point from '@mapbox/point-geometry';
|
|
6
6
|
import type {VectorTileFeature} from '@mapbox/vector-tile';
|
|
7
7
|
|
|
8
8
|
// These bounds define the minimum and maximum supported coordinate values.
|
package/src/geo/edge_insets.ts
CHANGED
package/src/geo/transform.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import LngLat from './lng_lat';
|
|
2
2
|
import LngLatBounds from './lng_lat_bounds';
|
|
3
3
|
import MercatorCoordinate, {mercatorXfromLng, mercatorYfromLat, mercatorZfromAltitude} from './mercator_coordinate';
|
|
4
|
-
import Point from '
|
|
4
|
+
import Point from '@mapbox/point-geometry';
|
|
5
5
|
import {wrap, clamp} from '../util/util';
|
|
6
6
|
import {number as interpolate} from '../style-spec/util/interpolate';
|
|
7
7
|
import EXTENT from '../data/extent';
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference path="./types/glsl.d.ts" />
|
|
2
|
-
/// <reference path="./types/non-typed-modules.d.ts" />
|
|
3
2
|
import assert from 'assert';
|
|
4
3
|
import {supported} from '@mapbox/mapbox-gl-supported';
|
|
5
4
|
|
|
@@ -14,7 +13,7 @@ import Marker from './ui/marker';
|
|
|
14
13
|
import Style from './style/style';
|
|
15
14
|
import LngLat from './geo/lng_lat';
|
|
16
15
|
import LngLatBounds from './geo/lng_lat_bounds';
|
|
17
|
-
import Point from '
|
|
16
|
+
import Point from '@mapbox/point-geometry';
|
|
18
17
|
import MercatorCoordinate from './geo/mercator_coordinate';
|
|
19
18
|
import {Evented} from './util/evented';
|
|
20
19
|
import config from './util/config';
|
|
@@ -144,6 +143,8 @@ const exported = {
|
|
|
144
143
|
* The example below will be triggered for custom:// urls defined in the sources list in the style definitions.
|
|
145
144
|
* The function passed will receive the request parameters and should call the callback with the resulting request,
|
|
146
145
|
* for example a pbf vector tile, non-compressed, represented as ArrayBuffer.
|
|
146
|
+
*
|
|
147
|
+
* @function addProtocol
|
|
147
148
|
* @param {string} customProtocol - the protocol to hook, for example 'custom'
|
|
148
149
|
* @param {Function} loadFn - the function to use when trying to fetch a tile specified by the customProtocol
|
|
149
150
|
* @example
|
|
@@ -176,6 +177,8 @@ const exported = {
|
|
|
176
177
|
|
|
177
178
|
/**
|
|
178
179
|
* Removes a previusly added protocol
|
|
180
|
+
*
|
|
181
|
+
* @function removeProtocol
|
|
179
182
|
* @param {string} customProtocol - the custom protocol to remove registration for
|
|
180
183
|
* @example
|
|
181
184
|
* maplibregl.removeProtocol('custom');
|
|
@@ -188,13 +191,6 @@ const exported = {
|
|
|
188
191
|
//This gets automatically stripped out in production builds.
|
|
189
192
|
Debug.extend(exported, {isSafari, getPerformanceMetrics: PerformanceUtils.getPerformanceMetrics});
|
|
190
193
|
|
|
191
|
-
/**
|
|
192
|
-
* The version of MapLibre GL JS in use as specified in `package.json`,
|
|
193
|
-
* `CHANGELOG.md`, and the GitHub release.
|
|
194
|
-
*
|
|
195
|
-
* @var {string} version
|
|
196
|
-
*/
|
|
197
|
-
|
|
198
194
|
/**
|
|
199
195
|
* Test whether the browser supports MapLibre GL JS.
|
|
200
196
|
*
|
|
@@ -227,6 +227,33 @@ describe('GeoJSONSource#update', () => {
|
|
|
227
227
|
} as GeoJSONSourceOptions, mockDispatcher, undefined).load();
|
|
228
228
|
});
|
|
229
229
|
|
|
230
|
+
test('forwards Supercluster options with worker request, ignore max zoom of source', done => {
|
|
231
|
+
const mockDispatcher = wrapDispatcher({
|
|
232
|
+
send(message, params) {
|
|
233
|
+
expect(message).toBe('geojson.loadData');
|
|
234
|
+
expect(params.superclusterOptions).toEqual({
|
|
235
|
+
maxZoom: 12,
|
|
236
|
+
minPoints: 3,
|
|
237
|
+
extent: 8192,
|
|
238
|
+
radius: 1600,
|
|
239
|
+
log: false,
|
|
240
|
+
generateId: true
|
|
241
|
+
});
|
|
242
|
+
done();
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
new GeoJSONSource('id', {
|
|
247
|
+
data: {},
|
|
248
|
+
maxzoom: 10,
|
|
249
|
+
cluster: true,
|
|
250
|
+
clusterMaxZoom: 12,
|
|
251
|
+
clusterRadius: 100,
|
|
252
|
+
clusterMinPoints: 3,
|
|
253
|
+
generateId: true
|
|
254
|
+
} as GeoJSONSourceOptions, mockDispatcher, undefined).load();
|
|
255
|
+
});
|
|
256
|
+
|
|
230
257
|
test('transforms url before making request', () => {
|
|
231
258
|
const mapStub = {
|
|
232
259
|
_requestManager: {
|
|
@@ -136,9 +136,7 @@ class GeoJSONSource extends Evented implements Source {
|
|
|
136
136
|
generateId: options.generateId || false
|
|
137
137
|
},
|
|
138
138
|
superclusterOptions: {
|
|
139
|
-
maxZoom: options.clusterMaxZoom !== undefined ?
|
|
140
|
-
Math.min(options.clusterMaxZoom, this.maxzoom - 1) :
|
|
141
|
-
(this.maxzoom - 1),
|
|
139
|
+
maxZoom: options.clusterMaxZoom !== undefined ? options.clusterMaxZoom : this.maxzoom - 1,
|
|
142
140
|
minPoints: Math.max(2, options.clusterMinPoints || 2),
|
|
143
141
|
extent: EXTENT,
|
|
144
142
|
radius: (options.clusterRadius || 50) * scale,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from './query_features';
|
|
5
5
|
import SourceCache from './source_cache';
|
|
6
6
|
import Transform from '../geo/transform';
|
|
7
|
-
import Point from '
|
|
7
|
+
import Point from '@mapbox/point-geometry';
|
|
8
8
|
import Dispatcher from '../util/dispatcher';
|
|
9
9
|
|
|
10
10
|
describe('QueryFeatures#rendered', () => {
|
|
@@ -4,7 +4,7 @@ import type CollisionIndex from '../symbol/collision_index';
|
|
|
4
4
|
import type Transform from '../geo/transform';
|
|
5
5
|
import type {RetainedQueryData} from '../symbol/placement';
|
|
6
6
|
import type {FilterSpecification} from '../style-spec/types';
|
|
7
|
-
import type Point from '
|
|
7
|
+
import type Point from '@mapbox/point-geometry';
|
|
8
8
|
import assert from 'assert';
|
|
9
9
|
import {mat4} from 'gl-matrix';
|
|
10
10
|
|
package/src/source/source.ts
CHANGED
|
@@ -117,11 +117,11 @@ export const create = function(id: string, specification: SourceSpecification, d
|
|
|
117
117
|
return source;
|
|
118
118
|
};
|
|
119
119
|
|
|
120
|
-
export const
|
|
120
|
+
export const getSourceType = function (name: string) {
|
|
121
121
|
return sourceTypes[name];
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
-
export const
|
|
124
|
+
export const setSourceType = function (name: string, type: {
|
|
125
125
|
new (...args: any): Source;
|
|
126
126
|
}) {
|
|
127
127
|
sourceTypes[name] = type;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import SourceCache from './source_cache';
|
|
2
|
-
import {
|
|
2
|
+
import {setSourceType} from './source';
|
|
3
3
|
import Tile from './tile';
|
|
4
4
|
import {OverscaledTileID} from './tile_id';
|
|
5
5
|
import Transform from '../geo/transform';
|
|
6
6
|
import LngLat from '../geo/lng_lat';
|
|
7
|
-
import Point from '
|
|
7
|
+
import Point from '@mapbox/point-geometry';
|
|
8
8
|
import {Event, ErrorEvent, Evented} from '../util/evented';
|
|
9
9
|
import {extend} from '../util/util';
|
|
10
10
|
import browser from '../util/browser';
|
|
@@ -63,7 +63,7 @@ function createSource(id: string, sourceOptions: any, _dispatcher: any, eventedP
|
|
|
63
63
|
return source;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
setSourceType('mock-source-type', createSource as any);
|
|
67
67
|
|
|
68
68
|
function createSourceCache(options?, used?) {
|
|
69
69
|
const sc = new SourceCache('id', extend({
|
|
@@ -7,7 +7,7 @@ import MercatorCoordinate from '../geo/mercator_coordinate';
|
|
|
7
7
|
import {keysDifference} from '../util/util';
|
|
8
8
|
import EXTENT from '../data/extent';
|
|
9
9
|
import Context from '../gl/context';
|
|
10
|
-
import Point from '
|
|
10
|
+
import Point from '@mapbox/point-geometry';
|
|
11
11
|
import browser from '../util/browser';
|
|
12
12
|
import {OverscaledTileID} from './tile_id';
|
|
13
13
|
import assert from 'assert';
|
package/src/source/tile.ts
CHANGED
|
@@ -30,7 +30,7 @@ import type Transform from '../geo/transform';
|
|
|
30
30
|
import type {LayerFeatureStates} from './source_state';
|
|
31
31
|
import type {Cancelable} from '../types/cancelable';
|
|
32
32
|
import type {FilterSpecification} from '../style-spec/types';
|
|
33
|
-
import type Point from '
|
|
33
|
+
import type Point from '@mapbox/point-geometry';
|
|
34
34
|
import {mat4} from 'gl-matrix';
|
|
35
35
|
import type {VectorTileLayer} from '@mapbox/vector-tile';
|
|
36
36
|
|
package/src/source/tile_id.ts
CHANGED