Skip to content

Commit

Permalink
more typing
Browse files Browse the repository at this point in the history
  • Loading branch information
ericrobskyhuntley committed Feb 27, 2024
1 parent 3eacc27 commit 48b4e75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/components/Globe.astro
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const { lng, lat, zoom, mapstyle, bearing, accesstoken, interactive = false, sec
constructor() {
super()
let dest = [-80, 42]
let sec = Number(this.dataset.sec);
mapboxgl.accessToken = this.dataset.accesstoken
const map = new mapboxgl.Map({
container: 'map',
Expand All @@ -42,17 +43,17 @@ const { lng, lat, zoom, mapstyle, bearing, accesstoken, interactive = false, sec
style: this.dataset.mapstyle
})

if(this.dataset.sec > 0) {
if(sec > 0) {
function spinGlobe(sec: number) {
let distancePerSecond = 360 / sec;
let cnt = map.getCenter();
cnt.lng -= distancePerSecond;
map.easeTo({ cnt, duration: 1000, easing: (n) => n });
}
map.on('moveend', () => {
spinGlobe(this.dataset.sec);
spinGlobe(sec);
});
spinGlobe(this.dataset.sec);
spinGlobe(sec);
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/components/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
import Navbar from '@components/Navbar.astro';
interface Props {
navItems: object[];
navItems: [{
path: string;
title: string;
}];
}
const {navItems} = Astro.props;
Expand Down

0 comments on commit 48b4e75

Please sign in to comment.