maplibre-gl 2.0.5 → 2.1.0
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/dist/maplibre-gl.css +1 -1
- package/dist/maplibre-gl.d.ts +38 -12
- package/dist/maplibre-gl.js +3 -3
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +21 -33
- package/src/css/maplibre-gl.css +21 -21
- package/src/data/bucket/symbol_bucket.test.ts +1 -1
- package/src/data/bucket/symbol_bucket.ts +3 -3
- package/src/data/program_configuration.ts +1 -1
- package/src/render/draw_debug.ts +1 -1
- package/src/render/glyph_manager.ts +1 -1
- package/src/render/painter.ts +5 -3
- package/src/render/program/circle_program.ts +1 -1
- package/src/render/program/line_program.ts +3 -3
- package/src/render/program/symbol_program.ts +1 -1
- package/src/source/geojson_source.test.ts +2 -1
- package/src/source/geojson_source.ts +1 -1
- package/src/source/raster_dem_tile_source.test.ts +2 -1
- package/src/source/raster_dem_tile_source.ts +1 -1
- package/src/source/raster_tile_source.test.ts +2 -1
- package/src/source/raster_tile_source.ts +1 -1
- package/src/source/source_cache.test.ts +1 -1
- package/src/source/tile.test.ts +1 -1
- package/src/source/tile_id.test.ts +10 -12
- package/src/source/tile_id.ts +2 -2
- package/src/source/vector_tile_source.test.ts +2 -1
- package/src/source/vector_tile_source.ts +2 -2
- package/src/style/load_sprite.ts +2 -1
- package/src/style/properties.ts +1 -1
- package/src/style/style.test.ts +4 -0
- package/src/style/style.ts +1 -1
- package/src/style/style_layer/custom_style_layer.ts +2 -2
- package/src/style/style_layer/fill_extrusion_style_layer.ts +1 -1
- package/src/style/style_layer/symbol_style_layer.ts +19 -0
- package/src/style/style_layer/symbol_style_layer_properties.ts +6 -0
- package/src/style-spec/CHANGELOG.md +6 -0
- package/src/style-spec/package.json +1 -1
- package/src/style-spec/reference/v8.json +68 -2
- package/src/style-spec/types.ts +2 -0
- package/src/symbol/collision_index.ts +19 -19
- package/src/symbol/grid_index.test.ts +42 -19
- package/src/symbol/grid_index.ts +62 -33
- package/src/symbol/placement.ts +82 -53
- package/src/symbol/symbol_style_layer.test.ts +48 -1
- package/src/ui/map.test.ts +61 -0
- package/src/ui/map.ts +31 -6
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.1.0",
|
|
5
5
|
"main": "dist/maplibre-gl.js",
|
|
6
6
|
"style": "dist/maplibre-gl.css",
|
|
7
7
|
"license": "BSD-3-Clause",
|
|
@@ -20,10 +20,6 @@
|
|
|
20
20
|
"@mapbox/unitbezier": "^0.0.1",
|
|
21
21
|
"@mapbox/vector-tile": "^1.3.1",
|
|
22
22
|
"@mapbox/whoots-js": "^3.1.0",
|
|
23
|
-
"@types/geojson": "^7946.0.7",
|
|
24
|
-
"@types/mapbox__point-geometry": "^0.1.2",
|
|
25
|
-
"@types/mapbox__vector-tile": "^1.3.0",
|
|
26
|
-
"@types/pbf": "^3.0.2",
|
|
27
23
|
"csscolorparser": "~1.0.3",
|
|
28
24
|
"earcut": "^2.2.2",
|
|
29
25
|
"geojson-vt": "^3.2.1",
|
|
@@ -41,8 +37,6 @@
|
|
|
41
37
|
"@mapbox/gazetteer": "^5.1.0",
|
|
42
38
|
"@mapbox/mapbox-gl-rtl-text": "^0.2.1",
|
|
43
39
|
"@mapbox/mvt-fixtures": "^3.6.0",
|
|
44
|
-
"@octokit/rest": "^18.10.0",
|
|
45
|
-
"@rollup/plugin-buble": "^0.21.3",
|
|
46
40
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
47
41
|
"@rollup/plugin-json": "^4.1.0",
|
|
48
42
|
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
@@ -54,22 +48,24 @@
|
|
|
54
48
|
"@types/benchmark": "^2.1.0",
|
|
55
49
|
"@types/browserify": "^12.0.36",
|
|
56
50
|
"@types/cssnano": "^5.0.0",
|
|
57
|
-
"@types/d3": "^
|
|
51
|
+
"@types/d3": "^5.16.4",
|
|
58
52
|
"@types/diff": "^4.0.2",
|
|
59
53
|
"@types/earcut": "^2.1.1",
|
|
60
54
|
"@types/ejs": "^3.1.0",
|
|
61
55
|
"@types/eslint": "^8.2.1",
|
|
56
|
+
"@types/geojson": "^7946.0.8",
|
|
62
57
|
"@types/gl": "^4.1.0",
|
|
63
58
|
"@types/glob": "^7.1.3",
|
|
64
59
|
"@types/jest": "^27.0.2",
|
|
65
|
-
"@types/jsdom": "^16.2.
|
|
66
|
-
"@types/jsonwebtoken": "^8.5.5",
|
|
60
|
+
"@types/jsdom": "^16.2.14",
|
|
67
61
|
"@types/lodash.template": "^4.5.0",
|
|
62
|
+
"@types/mapbox__point-geometry": "^0.1.2",
|
|
63
|
+
"@types/mapbox__vector-tile": "^1.3.0",
|
|
68
64
|
"@types/minimist": "^1.2.1",
|
|
69
65
|
"@types/murmurhash-js": "^1.0.3",
|
|
70
66
|
"@types/node-notifier": "^8.0.0",
|
|
71
|
-
"@types/npm-packlist": "^1.1.1",
|
|
72
67
|
"@types/offscreencanvas": "^2019.6.3",
|
|
68
|
+
"@types/pbf": "^3.0.2",
|
|
73
69
|
"@types/pixelmatch": "^5.2.2",
|
|
74
70
|
"@types/pngjs": "^6.0.1",
|
|
75
71
|
"@types/puppeteer": "^5.4.4",
|
|
@@ -80,7 +76,7 @@
|
|
|
80
76
|
"@types/selenium-webdriver": "^4.0.16",
|
|
81
77
|
"@types/shuffle-seed": "^1.1.0",
|
|
82
78
|
"@types/sinon": "^10.0.2",
|
|
83
|
-
"@types/stylelint": "^
|
|
79
|
+
"@types/stylelint": "^14.0.0",
|
|
84
80
|
"@types/supercluster": "^5.0.2",
|
|
85
81
|
"@types/tape": "^4.13.2",
|
|
86
82
|
"@types/window-or-global": "^1.0.4",
|
|
@@ -95,16 +91,17 @@
|
|
|
95
91
|
"canvas": "^2.9.0",
|
|
96
92
|
"chokidar": "^3.0.2",
|
|
97
93
|
"cssnano": "^5.0.8",
|
|
98
|
-
"d3": "^
|
|
94
|
+
"d3": "^5.16.0",
|
|
95
|
+
"d3-queue": "^3.0.7",
|
|
99
96
|
"diff": "^4.0.1",
|
|
100
97
|
"documentation": "^12.3.0",
|
|
101
98
|
"dts-bundle-generator": "^6.0.0",
|
|
102
99
|
"ejs": "^3.1.6",
|
|
103
|
-
"eslint": "^7.
|
|
100
|
+
"eslint": "^8.7.0",
|
|
104
101
|
"eslint-config-mourner": "^3.0.0",
|
|
105
102
|
"eslint-plugin-html": "^6.1.2",
|
|
106
103
|
"eslint-plugin-import": "^2.24.2",
|
|
107
|
-
"eslint-plugin-jest": "^
|
|
104
|
+
"eslint-plugin-jest": "^26.0.0",
|
|
108
105
|
"eslint-plugin-jsdoc": "^37.0.3",
|
|
109
106
|
"eslint-plugin-react": "^7.25.1",
|
|
110
107
|
"gl": "^5.0.0",
|
|
@@ -112,13 +109,9 @@
|
|
|
112
109
|
"is-builtin-module": "^3.0.0",
|
|
113
110
|
"jest": "^27.2.4",
|
|
114
111
|
"jest-canvas-mock": "^2.3.1",
|
|
115
|
-
"jest-codemods": "^0.25.0",
|
|
116
112
|
"jest-raw-loader": "^1.0.1",
|
|
117
|
-
"
|
|
118
|
-
"jsdom": "^13.0.0",
|
|
113
|
+
"jsdom": "^19.0.0",
|
|
119
114
|
"json-stringify-pretty-compact": "^3.0.0",
|
|
120
|
-
"jsonwebtoken": "^8.3.0",
|
|
121
|
-
"list-npm-contents": "^1.0.2",
|
|
122
115
|
"lodash": "^4.17.19",
|
|
123
116
|
"lodash.template": "^4.5.0",
|
|
124
117
|
"mapbox-gl-styles": "^2.0.2",
|
|
@@ -127,10 +120,9 @@
|
|
|
127
120
|
"node-notifier": "^10.0.0",
|
|
128
121
|
"node-plantuml": "^0.9.0",
|
|
129
122
|
"npm-font-open-sans": "^1.1.0",
|
|
130
|
-
"npm-packlist": "^3.0.0",
|
|
131
123
|
"npm-run-all": "^4.1.5",
|
|
132
124
|
"nyc": "^15.1.0",
|
|
133
|
-
"
|
|
125
|
+
"pdf-merger-js": "^3.2.1",
|
|
134
126
|
"pixelmatch": "^5.1.0",
|
|
135
127
|
"pngjs": "^6.0.0",
|
|
136
128
|
"postcss": "^8.3.11",
|
|
@@ -138,10 +130,8 @@
|
|
|
138
130
|
"postcss-inline-svg": "^5.0.0",
|
|
139
131
|
"pretty-bytes": "^5.1.0",
|
|
140
132
|
"puppeteer": "^13.0.1",
|
|
141
|
-
"qrcode-terminal": "^0.12.0",
|
|
142
133
|
"react": "^17.0.2",
|
|
143
134
|
"react-dom": "^17.0.2",
|
|
144
|
-
"replace-in-file": "^6.2.0",
|
|
145
135
|
"request": "^2.88.0",
|
|
146
136
|
"rollup": "^2.56.3",
|
|
147
137
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
@@ -155,13 +145,12 @@
|
|
|
155
145
|
"sinon": "^12.0.1",
|
|
156
146
|
"source-map-explorer": "^2.5.1",
|
|
157
147
|
"st": "^3.0.0",
|
|
158
|
-
"stylelint": "^
|
|
159
|
-
"stylelint-config-standard": "^
|
|
160
|
-
"tap": "~12.4.1",
|
|
148
|
+
"stylelint": "^14.3.0",
|
|
149
|
+
"stylelint-config-standard": "^24.0.0",
|
|
161
150
|
"tap-parser": "^10.0.1",
|
|
162
151
|
"tape": "^5.3.1",
|
|
163
152
|
"tape-filter": "^1.0.4",
|
|
164
|
-
"testem": "^3.
|
|
153
|
+
"testem": "^3.6.0",
|
|
165
154
|
"ts-jest": "^27.0.5",
|
|
166
155
|
"ts-node": "^10.4.0",
|
|
167
156
|
"typescript": "^4.5.4"
|
|
@@ -197,17 +186,16 @@
|
|
|
197
186
|
"test": "run-s lint lint-css lint-docs test-unit",
|
|
198
187
|
"test-suite": "run-s test-render test-query test-expressions",
|
|
199
188
|
"test-suite-clean": "find test/integration/{render,query, expressions}-tests -mindepth 2 -type d -exec test -e \"{}/actual.png\" \\; -not \\( -exec test -e \"{}/style.json\" \\; \\) -print | xargs -t rm -r",
|
|
200
|
-
"test-
|
|
201
|
-
"test-
|
|
202
|
-
"test-build": "tap --node-arg --no-warnings --node-arg --experimental-specifier-resolution=node --node-arg --experimental-json-modules --reporter classic --no-coverage test/build/**/*.test.js",
|
|
203
|
-
"test-browser": "tap --node-arg --no-warnings --node-arg --experimental-specifier-resolution=node --node-arg --experimental-json-modules --reporter classic --no-coverage test/browser/**/*.test.js",
|
|
189
|
+
"test-build": "jest ./test/build",
|
|
190
|
+
"test-browser": "jest ./test/browser",
|
|
204
191
|
"test-render": "node --experimental-specifier-resolution=node --experimental-json-modules --max-old-space-size=2048 test/render.test.js",
|
|
205
192
|
"watch-query": "testem -f test/integration/testem.cjs",
|
|
206
193
|
"test-query": "testem ci -f test/integration/testem.cjs -R xunit > test/integration/query-tests/test-results.xml",
|
|
207
194
|
"test-expressions": "node --experimental-specifier-resolution=node test/expression.test.js",
|
|
208
195
|
"test-cov": "nyc --reporter=text-summary --reporter=lcov --cache run-s test-unit test-expressions test-query test-render",
|
|
209
|
-
"test-
|
|
196
|
+
"test-unit": "jest ./src",
|
|
210
197
|
"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",
|
|
198
|
+
"benchmark": "node bench/run-benchmarks.js",
|
|
211
199
|
"gl-stats": "node bench/gl-stats.js"
|
|
212
200
|
},
|
|
213
201
|
"files": [
|
package/src/css/maplibre-gl.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.maplibregl-map,
|
|
2
2
|
.mapboxgl-map {
|
|
3
|
-
font: 12px/20px
|
|
3
|
+
font: 12px/20px "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
4
4
|
overflow: hidden;
|
|
5
5
|
position: relative;
|
|
6
6
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
@@ -224,75 +224,75 @@
|
|
|
224
224
|
|
|
225
225
|
.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon,
|
|
226
226
|
.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon {
|
|
227
|
-
background-image: svg-load(
|
|
227
|
+
background-image: svg-load("svg/maplibregl-ctrl-zoom-out.svg", fill: #333);
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
|
|
231
231
|
.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon {
|
|
232
|
-
background-image: svg-load(
|
|
232
|
+
background-image: svg-load("svg/maplibregl-ctrl-zoom-in.svg", fill: #333);
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
@media (-ms-high-contrast: active) {
|
|
236
236
|
.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon,
|
|
237
237
|
.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon {
|
|
238
|
-
background-image: svg-load(
|
|
238
|
+
background-image: svg-load("svg/maplibregl-ctrl-zoom-out.svg", fill: #fff);
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
|
|
242
242
|
.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon {
|
|
243
|
-
background-image: svg-load(
|
|
243
|
+
background-image: svg-load("svg/maplibregl-ctrl-zoom-in.svg", fill: #fff);
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
@media (-ms-high-contrast: black-on-white) {
|
|
248
248
|
.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon,
|
|
249
249
|
.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon {
|
|
250
|
-
background-image: svg-load(
|
|
250
|
+
background-image: svg-load("svg/maplibregl-ctrl-zoom-out.svg", fill: #000);
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
|
|
254
254
|
.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon {
|
|
255
|
-
background-image: svg-load(
|
|
255
|
+
background-image: svg-load("svg/maplibregl-ctrl-zoom-in.svg", fill: #000);
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon,
|
|
260
260
|
.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon {
|
|
261
|
-
background-image: svg-load(
|
|
261
|
+
background-image: svg-load("svg/maplibregl-ctrl-fullscreen.svg", fill: #333);
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon,
|
|
265
265
|
.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon {
|
|
266
|
-
background-image: svg-load(
|
|
266
|
+
background-image: svg-load("svg/maplibregl-ctrl-shrink.svg");
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
@media (-ms-high-contrast: active) {
|
|
270
270
|
.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon,
|
|
271
271
|
.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon {
|
|
272
|
-
background-image: svg-load(
|
|
272
|
+
background-image: svg-load("svg/maplibregl-ctrl-fullscreen.svg", fill: #fff);
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon,
|
|
276
276
|
.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon {
|
|
277
|
-
background-image: svg-load(
|
|
277
|
+
background-image: svg-load("svg/maplibregl-ctrl-shrink.svg", fill: #fff);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
@media (-ms-high-contrast: black-on-white) {
|
|
282
282
|
.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon,
|
|
283
283
|
.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon {
|
|
284
|
-
background-image: svg-load(
|
|
284
|
+
background-image: svg-load("svg/maplibregl-ctrl-fullscreen.svg", fill: #000);
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon,
|
|
288
288
|
.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon {
|
|
289
|
-
background-image: svg-load(
|
|
289
|
+
background-image: svg-load("svg/maplibregl-ctrl-shrink.svg", fill: #000);
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon,
|
|
294
294
|
.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon {
|
|
295
|
-
background-image: svg-load(
|
|
295
|
+
background-image: svg-load("svg/maplibregl-ctrl-compass.svg", fill: #333);
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
@media (-ms-high-contrast: active) {
|
|
@@ -310,7 +310,7 @@
|
|
|
310
310
|
@media (-ms-high-contrast: black-on-white) {
|
|
311
311
|
.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon,
|
|
312
312
|
.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon {
|
|
313
|
-
background-image: svg-load(
|
|
313
|
+
background-image: svg-load("svg/maplibregl-ctrl-compass.svg", fill: #000);
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
|
|
@@ -483,7 +483,7 @@ a.mapboxgl-ctrl-logo {
|
|
|
483
483
|
background-repeat: no-repeat;
|
|
484
484
|
cursor: pointer;
|
|
485
485
|
overflow: hidden;
|
|
486
|
-
background-image: svg-load(
|
|
486
|
+
background-image: svg-load("svg/maplibregl-ctrl-logo.svg");
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
a.maplibregl-ctrl-logo.maplibregl-compact,
|
|
@@ -558,7 +558,7 @@ a.mapboxgl-ctrl-logo.mapboxgl-compact {
|
|
|
558
558
|
display: none;
|
|
559
559
|
cursor: pointer;
|
|
560
560
|
position: absolute;
|
|
561
|
-
background-image: svg-load(
|
|
561
|
+
background-image: svg-load("svg/maplibregl-ctrl-attrib.svg");
|
|
562
562
|
background-color: rgba(255, 255, 255, 0.5);
|
|
563
563
|
width: 24px;
|
|
564
564
|
height: 24px;
|
|
@@ -617,14 +617,14 @@ a.mapboxgl-ctrl-logo.mapboxgl-compact {
|
|
|
617
617
|
@media screen and (-ms-high-contrast: active) {
|
|
618
618
|
.maplibregl-ctrl-attrib.maplibregl-compact::after,
|
|
619
619
|
.mapboxgl-ctrl-attrib.mapboxgl-compact::after {
|
|
620
|
-
background-image: svg-load(
|
|
620
|
+
background-image: svg-load("svg/maplibregl-ctrl-attrib.svg", fill=#fff);
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
623
|
|
|
624
624
|
@media screen and (-ms-high-contrast: black-on-white) {
|
|
625
625
|
.maplibregl-ctrl-attrib.maplibregl-compact::after,
|
|
626
626
|
.mapboxgl-ctrl-attrib.mapboxgl-compact::after {
|
|
627
|
-
background-image: svg-load(
|
|
627
|
+
background-image: svg-load("svg/maplibregl-ctrl-attrib.svg");
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
630
|
|
|
@@ -862,7 +862,7 @@ a.mapboxgl-ctrl-logo.mapboxgl-compact {
|
|
|
862
862
|
.maplibregl-user-location-dot::before,
|
|
863
863
|
.mapboxgl-user-location-dot::before {
|
|
864
864
|
background-color: #1da1f2;
|
|
865
|
-
content:
|
|
865
|
+
content: "";
|
|
866
866
|
width: 15px;
|
|
867
867
|
height: 15px;
|
|
868
868
|
border-radius: 50%;
|
|
@@ -877,7 +877,7 @@ a.mapboxgl-ctrl-logo.mapboxgl-compact {
|
|
|
877
877
|
.mapboxgl-user-location-dot::after {
|
|
878
878
|
border-radius: 50%;
|
|
879
879
|
border: 2px solid #fff;
|
|
880
|
-
content:
|
|
880
|
+
content: "";
|
|
881
881
|
height: 19px;
|
|
882
882
|
left: -2px;
|
|
883
883
|
position: absolute;
|
|
@@ -11,7 +11,7 @@ import {OverscaledTileID} from '../../source/tile_id';
|
|
|
11
11
|
import Tile from '../../source/tile';
|
|
12
12
|
import CrossTileSymbolIndex from '../../symbol/cross_tile_symbol_index';
|
|
13
13
|
import FeatureIndex from '../../data/feature_index';
|
|
14
|
-
import {createSymbolBucket, createSymbolIconBucket} from '../../../test/util/
|
|
14
|
+
import {createSymbolBucket, createSymbolIconBucket} from '../../../test/util/create_symbol_layer';
|
|
15
15
|
import {RGBAImage} from '../../util/image';
|
|
16
16
|
import {ImagePosition} from '../../render/image_atlas';
|
|
17
17
|
import {IndexedFeature, PopulateParameters} from '../bucket';
|
|
@@ -48,7 +48,7 @@ import type {
|
|
|
48
48
|
} from '../bucket';
|
|
49
49
|
import type {CollisionBoxArray, CollisionBox, SymbolInstance} from '../array_types';
|
|
50
50
|
import type {StructArray, StructArrayMember, ViewType} from '../../util/struct_array';
|
|
51
|
-
import SymbolStyleLayer from '../../style/style_layer/symbol_style_layer';
|
|
51
|
+
import SymbolStyleLayer, {getOverlapMode} from '../../style/style_layer/symbol_style_layer';
|
|
52
52
|
import type Context from '../../gl/context';
|
|
53
53
|
import type IndexBuffer from '../../gl/index_buffer';
|
|
54
54
|
import type VertexBuffer from '../../gl/vertex_buffer';
|
|
@@ -388,8 +388,8 @@ class SymbolBucket implements Bucket {
|
|
|
388
388
|
const sortKey = layout.get('symbol-sort-key');
|
|
389
389
|
const zOrder = layout.get('symbol-z-order');
|
|
390
390
|
this.canOverlap =
|
|
391
|
-
layout
|
|
392
|
-
layout
|
|
391
|
+
getOverlapMode(layout, 'text-overlap', 'text-allow-overlap') !== 'never' ||
|
|
392
|
+
getOverlapMode(layout, 'icon-overlap', 'icon-allow-overlap') !== 'never' ||
|
|
393
393
|
layout.get('text-ignore-placement') ||
|
|
394
394
|
layout.get('icon-ignore-placement');
|
|
395
395
|
this.sortFeaturesByKey = zOrder !== 'viewport-y' && !sortKey.isConstant();
|
|
@@ -129,7 +129,7 @@ class ConstantBinder implements UniformBinder {
|
|
|
129
129
|
|
|
130
130
|
class CrossFadedConstantBinder implements UniformBinder {
|
|
131
131
|
uniformNames: Array<string>;
|
|
132
|
-
patternFrom: Array<number
|
|
132
|
+
patternFrom: Array<number>;
|
|
133
133
|
patternTo: Array<number>;
|
|
134
134
|
pixelRatioFrom: number;
|
|
135
135
|
pixelRatioTo: number;
|
package/src/render/draw_debug.ts
CHANGED
|
@@ -55,7 +55,7 @@ function drawDebugSSRect(painter: Painter, x: number, y: number, width: number,
|
|
|
55
55
|
const gl = context.gl;
|
|
56
56
|
|
|
57
57
|
gl.enable(gl.SCISSOR_TEST);
|
|
58
|
-
gl.scissor(x *
|
|
58
|
+
gl.scissor(x * painter.pixelRatio, y * painter.pixelRatio, width * painter.pixelRatio, height * painter.pixelRatio);
|
|
59
59
|
context.clear({color});
|
|
60
60
|
gl.disable(gl.SCISSOR_TEST);
|
|
61
61
|
}
|
|
@@ -103,7 +103,7 @@ export default class GlyphManager {
|
|
|
103
103
|
let requests = entry.requests[range];
|
|
104
104
|
if (!requests) {
|
|
105
105
|
requests = entry.requests[range] = [];
|
|
106
|
-
GlyphManager.loadGlyphRange(stack, range, this.url
|
|
106
|
+
GlyphManager.loadGlyphRange(stack, range, this.url, this.requestManager,
|
|
107
107
|
(err, response?: {
|
|
108
108
|
[_: number]: StyleGlyph | null;
|
|
109
109
|
} | null) => {
|
package/src/render/painter.ts
CHANGED
|
@@ -92,6 +92,7 @@ class Painter {
|
|
|
92
92
|
emptyProgramConfiguration: ProgramConfiguration;
|
|
93
93
|
width: number;
|
|
94
94
|
height: number;
|
|
95
|
+
pixelRatio: number;
|
|
95
96
|
tileExtentBuffer: VertexBuffer;
|
|
96
97
|
tileExtentSegments: SegmentVector;
|
|
97
98
|
debugBuffer: VertexBuffer;
|
|
@@ -146,9 +147,10 @@ class Painter {
|
|
|
146
147
|
* Update the GL viewport, projection matrix, and transforms to compensate
|
|
147
148
|
* for a new width and height value.
|
|
148
149
|
*/
|
|
149
|
-
resize(width: number, height: number) {
|
|
150
|
-
this.width = width *
|
|
151
|
-
this.height = height *
|
|
150
|
+
resize(width: number, height: number, pixelRatio: number) {
|
|
151
|
+
this.width = width * pixelRatio;
|
|
152
|
+
this.height = height * pixelRatio;
|
|
153
|
+
this.pixelRatio = pixelRatio;
|
|
152
154
|
this.context.viewport.set([0, 0, this.width, this.height]);
|
|
153
155
|
|
|
154
156
|
if (this.style) {
|
|
@@ -53,7 +53,7 @@ const circleUniformValues = (
|
|
|
53
53
|
layer.paint.get('circle-translate'),
|
|
54
54
|
layer.paint.get('circle-translate-anchor')),
|
|
55
55
|
'u_pitch_with_map': +(pitchWithMap),
|
|
56
|
-
'u_device_pixel_ratio':
|
|
56
|
+
'u_device_pixel_ratio': painter.pixelRatio,
|
|
57
57
|
'u_extrude_scale': extrudeScale
|
|
58
58
|
};
|
|
59
59
|
};
|
|
@@ -99,7 +99,7 @@ const lineUniformValues = (painter: Painter, tile: Tile, layer: LineStyleLayer):
|
|
|
99
99
|
return {
|
|
100
100
|
'u_matrix': calculateMatrix(painter, tile, layer),
|
|
101
101
|
'u_ratio': 1 / pixelsToTileUnits(tile, 1, transform.zoom),
|
|
102
|
-
'u_device_pixel_ratio':
|
|
102
|
+
'u_device_pixel_ratio': painter.pixelRatio,
|
|
103
103
|
'u_units_to_pixels': [
|
|
104
104
|
1 / transform.pixelsToGLUnits[0],
|
|
105
105
|
1 / transform.pixelsToGLUnits[1]
|
|
@@ -127,7 +127,7 @@ const linePatternUniformValues = (
|
|
|
127
127
|
'u_texsize': tile.imageAtlasTexture.size,
|
|
128
128
|
// camera zoom ratio
|
|
129
129
|
'u_ratio': 1 / pixelsToTileUnits(tile, 1, transform.zoom),
|
|
130
|
-
'u_device_pixel_ratio':
|
|
130
|
+
'u_device_pixel_ratio': painter.pixelRatio,
|
|
131
131
|
'u_image': 0,
|
|
132
132
|
'u_scale': [tileZoomRatio, crossfade.fromScale, crossfade.toScale],
|
|
133
133
|
'u_fade': crossfade.t,
|
|
@@ -160,7 +160,7 @@ const lineSDFUniformValues = (
|
|
|
160
160
|
return extend(lineUniformValues(painter, tile, layer), {
|
|
161
161
|
'u_patternscale_a': [tileRatio / widthA, -posA.height / 2],
|
|
162
162
|
'u_patternscale_b': [tileRatio / widthB, -posB.height / 2],
|
|
163
|
-
'u_sdfgamma': lineAtlas.width / (Math.min(widthA, widthB) * 256 *
|
|
163
|
+
'u_sdfgamma': lineAtlas.width / (Math.min(widthA, widthB) * 256 * painter.pixelRatio) / 2,
|
|
164
164
|
'u_image': 0,
|
|
165
165
|
'u_tex_y_a': posA.y,
|
|
166
166
|
'u_tex_y_b': posB.y,
|
|
@@ -195,7 +195,7 @@ const symbolSDFUniformValues = (
|
|
|
195
195
|
rotateInShader, pitchWithMap, painter, matrix, labelPlaneMatrix,
|
|
196
196
|
glCoordMatrix, isText, texSize), {
|
|
197
197
|
'u_gamma_scale': (pitchWithMap ? Math.cos(transform._pitch) * transform.cameraToCenterDistance : 1),
|
|
198
|
-
'u_device_pixel_ratio':
|
|
198
|
+
'u_device_pixel_ratio': painter.pixelRatio,
|
|
199
199
|
'u_is_halo': +isHalo
|
|
200
200
|
});
|
|
201
201
|
};
|
|
@@ -318,7 +318,8 @@ describe('GeoJSONSource#update', () => {
|
|
|
318
318
|
|
|
319
319
|
const source = new GeoJSONSource('id', {data: {}} as GeoJSONSourceOptions, mockDispatcher, undefined);
|
|
320
320
|
source.map = {
|
|
321
|
-
transform: {} as Transform
|
|
321
|
+
transform: {} as Transform,
|
|
322
|
+
getPixelRatio() { return 1; }
|
|
322
323
|
} as any;
|
|
323
324
|
|
|
324
325
|
source.on('data', (e) => {
|
|
@@ -299,7 +299,7 @@ class GeoJSONSource extends Evented implements Source {
|
|
|
299
299
|
maxZoom: this.maxzoom,
|
|
300
300
|
tileSize: this.tileSize,
|
|
301
301
|
source: this.id,
|
|
302
|
-
pixelRatio:
|
|
302
|
+
pixelRatio: this.map.getPixelRatio(),
|
|
303
303
|
showCollisionBoxes: this.map.showCollisionBoxes,
|
|
304
304
|
promoteId: this.promoteId
|
|
305
305
|
};
|
|
@@ -10,7 +10,8 @@ function createSource(options, transformCallback?) {
|
|
|
10
10
|
source.onAdd({
|
|
11
11
|
transform: {angle: 0, pitch: 0, showCollisionBoxes: false},
|
|
12
12
|
_getMapId: () => 1,
|
|
13
|
-
_requestManager: new RequestManager(transformCallback)
|
|
13
|
+
_requestManager: new RequestManager(transformCallback),
|
|
14
|
+
getPixelRatio() { return 1; }
|
|
14
15
|
} as any);
|
|
15
16
|
|
|
16
17
|
source.on('error', (e) => {
|
|
@@ -37,7 +37,7 @@ class RasterDEMTileSource extends RasterTileSource implements Source {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
loadTile(tile: Tile, callback: Callback<void>) {
|
|
40
|
-
const url = tile.tileID.canonical.url(this.tiles, this.scheme);
|
|
40
|
+
const url = tile.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);
|
|
41
41
|
tile.request = getImage(this.map._requestManager.transformRequest(url, ResourceType.Tile), imageLoaded.bind(this));
|
|
42
42
|
|
|
43
43
|
tile.neighboringTiles = this._getNeighboringTiles(tile.tileID);
|
|
@@ -10,7 +10,8 @@ function createSource(options, transformCallback?) {
|
|
|
10
10
|
source.onAdd({
|
|
11
11
|
transform: {angle: 0, pitch: 0, showCollisionBoxes: false},
|
|
12
12
|
_getMapId: () => 1,
|
|
13
|
-
_requestManager: new RequestManager(transformCallback)
|
|
13
|
+
_requestManager: new RequestManager(transformCallback),
|
|
14
|
+
getPixelRatio() { return 1; }
|
|
14
15
|
} as any);
|
|
15
16
|
|
|
16
17
|
source.on('error', (e) => {
|
|
@@ -104,7 +104,7 @@ class RasterTileSource extends Evented implements Source {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
loadTile(tile: Tile, callback: Callback<void>) {
|
|
107
|
-
const url = tile.tileID.canonical.url(this.tiles, this.scheme);
|
|
107
|
+
const url = tile.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);
|
|
108
108
|
tile.request = getImage(this.map._requestManager.transformRequest(url, ResourceType.Tile), (err, img) => {
|
|
109
109
|
delete tile.request;
|
|
110
110
|
|
|
@@ -15,7 +15,7 @@ class SourceMock extends Evented {
|
|
|
15
15
|
id: string;
|
|
16
16
|
minzoom: number;
|
|
17
17
|
maxzoom: number;
|
|
18
|
-
hasTile: (tileID: OverscaledTileID) => boolean
|
|
18
|
+
hasTile: (tileID: OverscaledTileID) => boolean;
|
|
19
19
|
sourceOptions: any;
|
|
20
20
|
|
|
21
21
|
constructor(id: string, sourceOptions: any, _dispatcher, eventedParent: Evented) {
|
package/src/source/tile.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {createSymbolBucket} from '../../test/util/
|
|
1
|
+
import {createSymbolBucket} from '../../test/util/create_symbol_layer';
|
|
2
2
|
import Tile from '../source/tile';
|
|
3
3
|
import GeoJSONWrapper, {Feature} from '../source/geojson_wrapper';
|
|
4
4
|
import {OverscaledTileID} from '../source/tile_id';
|
|
@@ -33,35 +33,33 @@ describe('CanonicalTileID', () => {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
test('.url replaces {z}/{x}/{y}', () => {
|
|
36
|
-
expect(new CanonicalTileID(2, 1, 0).url(['{z}/{x}/{y}.json'])).toBe('2/1/0.json');
|
|
36
|
+
expect(new CanonicalTileID(2, 1, 0).url(['{z}/{x}/{y}.json'], 1)).toBe('2/1/0.json');
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
test('.url replaces {quadkey}', () => {
|
|
40
|
-
expect(new CanonicalTileID(1, 0, 0).url(['quadkey={quadkey}'])).toBe('quadkey=0');
|
|
41
|
-
expect(new CanonicalTileID(2, 0, 0).url(['quadkey={quadkey}'])).toBe('quadkey=00');
|
|
42
|
-
expect(new CanonicalTileID(2, 1, 1).url(['quadkey={quadkey}'])).toBe('quadkey=03');
|
|
43
|
-
expect(new CanonicalTileID(17, 22914, 52870).url(['quadkey={quadkey}'])).toBe('quadkey=02301322130000230');
|
|
40
|
+
expect(new CanonicalTileID(1, 0, 0).url(['quadkey={quadkey}'], 1)).toBe('quadkey=0');
|
|
41
|
+
expect(new CanonicalTileID(2, 0, 0).url(['quadkey={quadkey}'], 1)).toBe('quadkey=00');
|
|
42
|
+
expect(new CanonicalTileID(2, 1, 1).url(['quadkey={quadkey}'], 1)).toBe('quadkey=03');
|
|
43
|
+
expect(new CanonicalTileID(17, 22914, 52870).url(['quadkey={quadkey}'], 1)).toBe('quadkey=02301322130000230');
|
|
44
44
|
|
|
45
45
|
// Test case confirmed by quadkeytools package
|
|
46
46
|
// https://bitbucket.org/steele/quadkeytools/rollup/build/tsc/src/master/test/quadkey.js?fileviewer=file-view-default#quadkey.js-57
|
|
47
|
-
expect(new CanonicalTileID(6, 29, 3).url(['quadkey={quadkey}'])).toBe('quadkey=011123');
|
|
47
|
+
expect(new CanonicalTileID(6, 29, 3).url(['quadkey={quadkey}'], 1)).toBe('quadkey=011123');
|
|
48
48
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
test('.url replaces {bbox-epsg-3857}', () => {
|
|
52
|
-
expect(new CanonicalTileID(1, 0, 0).url(['bbox={bbox-epsg-3857}'])).toBe('bbox=-20037508.342789244,0,0,20037508.342789244');
|
|
52
|
+
expect(new CanonicalTileID(1, 0, 0).url(['bbox={bbox-epsg-3857}'], 1)).toBe('bbox=-20037508.342789244,0,0,20037508.342789244');
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
test('.url replaces {ratio}', () => {
|
|
56
|
-
|
|
57
|
-
expect(new CanonicalTileID(1, 0, 0).url(['r={ratio}'])).toBe('r
|
|
58
|
-
devicePixelRatio = 1;
|
|
59
|
-
expect(new CanonicalTileID(1, 0, 0).url(['r={ratio}'])).toBe('r=');
|
|
56
|
+
expect(new CanonicalTileID(1, 0, 0).url(['r={ratio}'], 2)).toBe('r=@2x');
|
|
57
|
+
expect(new CanonicalTileID(1, 0, 0).url(['r={ratio}'], 1)).toBe('r=');
|
|
60
58
|
});
|
|
61
59
|
|
|
62
60
|
//Tests that multiple values of the same placeholder are replaced.
|
|
63
61
|
test('.url replaces {z}/{x}/{y}/{z}/{x}/{y}', () => {
|
|
64
|
-
expect(new CanonicalTileID(2, 1, 0).url(['{z}/{x}/{y}/{z}/{x}/{y}.json'])).toBe('2/1/0/2/1/0.json');
|
|
62
|
+
expect(new CanonicalTileID(2, 1, 0).url(['{z}/{x}/{y}/{z}/{x}/{y}.json'], 1)).toBe('2/1/0/2/1/0.json');
|
|
65
63
|
});
|
|
66
64
|
|
|
67
65
|
});
|
package/src/source/tile_id.ts
CHANGED
|
@@ -28,7 +28,7 @@ export class CanonicalTileID {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// given a list of urls, choose a url template and return a tile URL
|
|
31
|
-
url(urls: Array<string>, scheme?: string | null) {
|
|
31
|
+
url(urls: Array<string>, pixelRatio: number, scheme?: string | null) {
|
|
32
32
|
const bbox = getTileBBox(this.x, this.y, this.z);
|
|
33
33
|
const quadkey = getQuadkey(this.z, this.x, this.y);
|
|
34
34
|
|
|
@@ -37,7 +37,7 @@ export class CanonicalTileID {
|
|
|
37
37
|
.replace(/{z}/g, String(this.z))
|
|
38
38
|
.replace(/{x}/g, String(this.x))
|
|
39
39
|
.replace(/{y}/g, String(scheme === 'tms' ? (Math.pow(2, this.z) - this.y - 1) : this.y))
|
|
40
|
-
.replace(/{ratio}/g,
|
|
40
|
+
.replace(/{ratio}/g, pixelRatio > 1 ? '@2x' : '')
|
|
41
41
|
.replace(/{quadkey}/g, quadkey)
|
|
42
42
|
.replace(/{bbox-epsg-3857}/g, bbox);
|
|
43
43
|
}
|
|
@@ -15,7 +15,8 @@ function createSource(options, transformCallback?) {
|
|
|
15
15
|
transform: {showCollisionBoxes: false},
|
|
16
16
|
_getMapId: () => 1,
|
|
17
17
|
_requestManager: new RequestManager(transformCallback),
|
|
18
|
-
style: {sourceCaches: {id: {clearTiles: () => {}}}}
|
|
18
|
+
style: {sourceCaches: {id: {clearTiles: () => {}}}},
|
|
19
|
+
getPixelRatio() { return 1; }
|
|
19
20
|
} as any as Map);
|
|
20
21
|
|
|
21
22
|
source.on('error', (e) => {
|
|
@@ -178,7 +178,7 @@ class VectorTileSource extends Evented implements Source {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
loadTile(tile: Tile, callback: Callback<void>) {
|
|
181
|
-
const url = tile.tileID.canonical.url(this.tiles, this.scheme);
|
|
181
|
+
const url = tile.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);
|
|
182
182
|
const params = {
|
|
183
183
|
request: this.map._requestManager.transformRequest(url, ResourceType.Tile),
|
|
184
184
|
uid: tile.uid,
|
|
@@ -187,7 +187,7 @@ class VectorTileSource extends Evented implements Source {
|
|
|
187
187
|
tileSize: this.tileSize * tile.tileID.overscaleFactor(),
|
|
188
188
|
type: this.type,
|
|
189
189
|
source: this.id,
|
|
190
|
-
pixelRatio:
|
|
190
|
+
pixelRatio: this.map.getPixelRatio(),
|
|
191
191
|
showCollisionBoxes: this.map.showCollisionBoxes,
|
|
192
192
|
promoteId: this.promoteId
|
|
193
193
|
};
|