avoid 3d effect when no pitch but keep elevation queries working
This commit is contained in:
parent
703c331d44
commit
7eb3dc07a0
2 changed files with 18 additions and 2 deletions
|
@ -79,13 +79,29 @@
|
|||
tileSize: 512,
|
||||
maxzoom: 14
|
||||
});
|
||||
newMap.setTerrain({ source: 'mapbox-dem' });
|
||||
newMap.setTerrain({
|
||||
source: 'mapbox-dem',
|
||||
exaggeration: 0
|
||||
});
|
||||
newMap.setFog({
|
||||
color: 'rgb(186, 210, 235)',
|
||||
'high-color': 'rgb(36, 92, 223)',
|
||||
'horizon-blend': 0.1,
|
||||
'space-color': 'rgb(156, 240, 255)'
|
||||
});
|
||||
newMap.on('pitch', () => {
|
||||
if (newMap.getPitch() > 0) {
|
||||
newMap.setTerrain({
|
||||
source: 'mapbox-dem',
|
||||
exaggeration: 1
|
||||
});
|
||||
} else {
|
||||
newMap.setTerrain({
|
||||
source: 'mapbox-dem',
|
||||
exaggeration: 0
|
||||
});
|
||||
}
|
||||
});
|
||||
// add dummy layer to place the overlay layers below
|
||||
newMap.addLayer({
|
||||
id: 'overlays',
|
||||
|
|
|
@ -124,7 +124,7 @@ function getIntermediatePoints(points: Coordinates[]): Promise<TrackPoint[]> {
|
|||
|
||||
route.forEach((point) => {
|
||||
point.setSurface("unknown");
|
||||
point.ele = get(map)?.queryTerrainElevation(point.getCoordinates()) ?? undefined;
|
||||
point.ele = get(map)?.queryTerrainElevation(point.getCoordinates(), { exaggerated: false }) ?? undefined;
|
||||
});
|
||||
|
||||
return new Promise((resolve) => resolve(route));
|
||||
|
|
Loading…
Reference in a new issue