mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-01 08:12:32 +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,18 +69,21 @@
|
|||||||
if (!$map.getSource(id)) {
|
if (!$map.getSource(id)) {
|
||||||
$map.addSource(id, overlays[id]);
|
$map.addSource(id, overlays[id]);
|
||||||
}
|
}
|
||||||
$map.addLayer({
|
$map.addLayer(
|
||||||
id,
|
{
|
||||||
type: overlays[id].type === 'raster' ? 'raster' : 'line',
|
id,
|
||||||
source: id,
|
type: overlays[id].type === 'raster' ? 'raster' : 'line',
|
||||||
paint: {
|
source: id,
|
||||||
...(id in opacities
|
paint: {
|
||||||
? overlays[id].type === 'raster'
|
...(id in opacities
|
||||||
? { 'raster-opacity': opacities[id] }
|
? overlays[id].type === 'raster'
|
||||||
: { 'line-opacity': opacities[id] }
|
? { 'raster-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