mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-04 09:32:33 +00:00
overlays below traces
This commit is contained in:
@@ -100,6 +100,17 @@
|
|||||||
|
|
||||||
newMap.on('style.load', toggleTerrain);
|
newMap.on('style.load', toggleTerrain);
|
||||||
newMap.on('pitch', toggleTerrain);
|
newMap.on('pitch', toggleTerrain);
|
||||||
|
|
||||||
|
newMap.on('style.load', () => {
|
||||||
|
// add dummy layer to place the overlay layers below
|
||||||
|
newMap.addLayer({
|
||||||
|
id: 'overlays',
|
||||||
|
type: 'background',
|
||||||
|
paint: {
|
||||||
|
'background-color': 'rgba(0, 0, 0, 0)'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$: if ($map) {
|
$: if ($map) {
|
||||||
|
@@ -69,7 +69,8 @@
|
|||||||
if (!$map.getSource(id)) {
|
if (!$map.getSource(id)) {
|
||||||
$map.addSource(id, overlays[id]);
|
$map.addSource(id, overlays[id]);
|
||||||
}
|
}
|
||||||
$map.addLayer({
|
$map.addLayer(
|
||||||
|
{
|
||||||
id,
|
id,
|
||||||
type: overlays[id].type === 'raster' ? 'raster' : 'line',
|
type: overlays[id].type === 'raster' ? 'raster' : 'line',
|
||||||
source: id,
|
source: id,
|
||||||
@@ -80,7 +81,9 @@
|
|||||||
: { 'line-opacity': opacities[id] }
|
: { 'line-opacity': opacities[id] }
|
||||||
: {})
|
: {})
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
'overlays'
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// No reliable way to check if the map is ready to add sources and layers
|
// No reliable way to check if the map is ready to add sources and layers
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user