mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-01-15 14:18:41 +00:00
fix loading style font
This commit is contained in:
@@ -101,9 +101,7 @@
|
|||||||
acc: Record<string, ImportSpecification>,
|
acc: Record<string, ImportSpecification>,
|
||||||
imprt: ImportSpecification
|
imprt: ImportSpecification
|
||||||
) => {
|
) => {
|
||||||
if (
|
if (!['basemap', 'overlays'].includes(imprt.id)) {
|
||||||
!['basemap', 'overlays', 'glyphs-and-sprite'].includes(imprt.id)
|
|
||||||
) {
|
|
||||||
acc[imprt.id] = imprt;
|
acc[imprt.id] = imprt;
|
||||||
}
|
}
|
||||||
return acc;
|
return acc;
|
||||||
|
|||||||
@@ -35,17 +35,6 @@ export class MapboxGLMap {
|
|||||||
sources: {},
|
sources: {},
|
||||||
layers: [],
|
layers: [],
|
||||||
imports: [
|
imports: [
|
||||||
{
|
|
||||||
id: 'glyphs-and-sprite', // make Mapbox glyphs and sprite available to other styles
|
|
||||||
url: '',
|
|
||||||
data: {
|
|
||||||
version: 8,
|
|
||||||
sources: {},
|
|
||||||
layers: [],
|
|
||||||
glyphs: 'mapbox://fonts/mapbox/{fontstack}/{range}.pbf',
|
|
||||||
sprite: 'mapbox://sprites/mapbox/outdoors-v12',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 'basemap',
|
id: 'basemap',
|
||||||
url: '',
|
url: '',
|
||||||
@@ -163,6 +152,12 @@ export class MapboxGLMap {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
map.on('style.import.load', () => {
|
||||||
|
const basemap = map.getStyle().imports?.find((imprt) => imprt.id === 'basemap');
|
||||||
|
if (basemap && basemap.data && basemap.data.glyphs) {
|
||||||
|
map.setGlyphsUrl(basemap.data.glyphs);
|
||||||
|
}
|
||||||
|
});
|
||||||
map.on('load', () => {
|
map.on('load', () => {
|
||||||
this._map.set(map); // only set the store after the map has loaded
|
this._map.set(map); // only set the store after the map has loaded
|
||||||
window._map = map; // entry point for extensions
|
window._map = map; // entry point for extensions
|
||||||
|
|||||||
Reference in New Issue
Block a user