Skip to content

Commit

Permalink
transition map - stc
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesliem committed Nov 8, 2023
1 parent e41681d commit 32d0def
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/features/geo-map/geo-map-space-time-cube-layer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ export function GeoMapSpaceTimeCubeLayer<T extends EmptyObject = EmptyObject>(
const scale = 250000 / 2 ** mapZoom;
setScale(scale);
setMapRotation(map!.getBearing() || 0);
const pitch = map!.getPitch();
if (pitch === 0) {
map.easeTo({ pitch: 60, essential: true });
} else {
map.easeTo({ pitch: pitch, essential: true });
}
}, []);

useEffect(() => {
Expand All @@ -69,6 +75,7 @@ export function GeoMapSpaceTimeCubeLayer<T extends EmptyObject = EmptyObject>(
return () => {
map.off('zoom', updateScale);
map.off('rotate', updateRotation);
map.easeTo({ pitch: 0, bearing: 0 });
};
}, [map]);

Expand Down
2 changes: 1 addition & 1 deletion src/features/geo-map/geo-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const GeoMap = forwardRef<MapRef, GeoMapProps>(function GeoMap(props, ref
{...props}
minPitch={0}
maxPitch={85}
reuseMaps
// reuseMaps
onZoom={(e) => {
setZoomlevel(e.viewState.zoom);
}}
Expand Down

0 comments on commit 32d0def

Please sign in to comment.