maplibre-gl 2.1.0 → 2.1.1
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/rollup_plugins.js +1 -0
- package/dist/maplibre-gl-dev.js +54589 -0
- package/dist/maplibre-gl.css +1 -1
- package/dist/maplibre-gl.d.ts +1 -1
- package/dist/maplibre-gl.js +2 -2
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +56 -59
- package/src/css/maplibre-gl.css +15 -15
- package/src/source/tile_cache.test.ts +6 -4
- package/src/source/vector_tile_source.test.ts +13 -2
- package/src/source/vector_tile_source.ts +1 -2
- package/src/style/load_glyph_range.test.ts +0 -2
- package/src/style/style.test.ts +20 -13
- package/src/ui/camera.test.ts +4 -4
- package/src/ui/control/logo_control.test.ts +1 -0
- package/src/ui/handler/scroll_zoom.test.ts +2 -1
- package/src/ui/map.test.ts +16 -10
- package/src/ui/map.ts +1 -1
package/src/ui/map.test.ts
CHANGED
|
@@ -134,15 +134,17 @@ describe('Map', () => {
|
|
|
134
134
|
test('emits load event after a style is set', done => {
|
|
135
135
|
const map = new Map({container: window.document.createElement('div')} as any as MapOptions);
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
const fail = () => done('test failed');
|
|
138
|
+
const pass = () => done();
|
|
139
|
+
|
|
140
|
+
map.on('load', fail);
|
|
138
141
|
|
|
139
142
|
setTimeout(() => {
|
|
140
|
-
map.off('load',
|
|
141
|
-
map.on('load',
|
|
142
|
-
done();
|
|
143
|
-
});
|
|
143
|
+
map.off('load', fail);
|
|
144
|
+
map.on('load', pass);
|
|
144
145
|
map.setStyle(createStyle());
|
|
145
146
|
}, 1);
|
|
147
|
+
|
|
146
148
|
});
|
|
147
149
|
|
|
148
150
|
describe('#setStyle', () => {
|
|
@@ -918,7 +920,7 @@ describe('Map', () => {
|
|
|
918
920
|
test('does not fire "webglcontextlost" after #remove has been called', done => {
|
|
919
921
|
const map = createMap();
|
|
920
922
|
const canvas = map.getCanvas();
|
|
921
|
-
map.once('webglcontextlost', () => done
|
|
923
|
+
map.once('webglcontextlost', () => done('"webglcontextlost" fired after #remove has been called'));
|
|
922
924
|
map.remove();
|
|
923
925
|
// Dispatch the event manually because at the time of this writing, gl does not support
|
|
924
926
|
// the WEBGL_lose_context extension.
|
|
@@ -931,7 +933,7 @@ describe('Map', () => {
|
|
|
931
933
|
const canvas = map.getCanvas();
|
|
932
934
|
|
|
933
935
|
map.once('webglcontextlost', () => {
|
|
934
|
-
map.once('webglcontextrestored', () => done
|
|
936
|
+
map.once('webglcontextrestored', () => done('"webglcontextrestored" fired after #remove has been called'));
|
|
935
937
|
map.remove();
|
|
936
938
|
canvas.dispatchEvent(new window.Event('webglcontextrestored'));
|
|
937
939
|
done();
|
|
@@ -1885,7 +1887,9 @@ describe('Map', () => {
|
|
|
1885
1887
|
if (timer) clearTimeout(timer);
|
|
1886
1888
|
timer = setTimeout(() => {
|
|
1887
1889
|
map.off('render', undefined);
|
|
1888
|
-
map.on('render',
|
|
1890
|
+
map.on('render', () => {
|
|
1891
|
+
done('test failed');
|
|
1892
|
+
});
|
|
1889
1893
|
expect((map as any)._frameId).toBeFalsy();
|
|
1890
1894
|
done();
|
|
1891
1895
|
}, 100);
|
|
@@ -1896,7 +1900,9 @@ describe('Map', () => {
|
|
|
1896
1900
|
const style = createStyle();
|
|
1897
1901
|
const map = createMap({style});
|
|
1898
1902
|
map.on('idle', () => {
|
|
1899
|
-
map.on('render',
|
|
1903
|
+
map.on('render', () => {
|
|
1904
|
+
done('test failed');
|
|
1905
|
+
});
|
|
1900
1906
|
setTimeout(() => {
|
|
1901
1907
|
done();
|
|
1902
1908
|
}, 100);
|
|
@@ -2043,7 +2049,7 @@ describe('Map', () => {
|
|
|
2043
2049
|
});
|
|
2044
2050
|
|
|
2045
2051
|
map.on('styleimagemissing', ({id}) => {
|
|
2046
|
-
done
|
|
2052
|
+
done(`styleimagemissing fired for value ${id}`);
|
|
2047
2053
|
});
|
|
2048
2054
|
});
|
|
2049
2055
|
});
|
package/src/ui/map.ts
CHANGED
|
@@ -618,7 +618,7 @@ class Map extends Camera {
|
|
|
618
618
|
* Sets the map's pixel ratio. This allows to override `devicePixelRatio`.
|
|
619
619
|
* After this call, the canvas' `width` attribute will be `container.clientWidth * pixelRatio`
|
|
620
620
|
* and its height attribute will be `container.clientHeight * pixelRatio`.
|
|
621
|
-
* @param
|
|
621
|
+
* @param {number} pixelRatio The pixel ratio.
|
|
622
622
|
*/
|
|
623
623
|
setPixelRatio(pixelRatio: number) {
|
|
624
624
|
const [width, height] = this._containerDimensions();
|