more improvements

This commit is contained in:
Daniel Vinci 2021-04-30 14:33:02 -06:00
parent fb78deeed4
commit 643c9e3106
No known key found for this signature in database
GPG key ID: 7A700C29916C26CA

View file

@ -1,13 +1,15 @@
<script> <script>
import * as d3 from "d3"; import * as d3 from "d3";
import * as sjs from "satellite.js"; import * as sjs from "satellite.js";
import { onMount } from "svelte"; import { onDestroy, onMount } from "svelte";
import tles from "../../static/tle.js"; import tles from "../../static/tle.js";
import world110m from "../../static/world-110m.js"; import world110m from "../../static/world-110m.js";
import * as topojson from "topojson"; import * as topojson from "topojson";
export let width = 300; export let width = 300;
let shouldLoop = true;
async function doThing() { async function doThing() {
let satelliteJs = sjs; let satelliteJs = sjs;
var RADIANS = Math.PI / 180; var RADIANS = Math.PI / 180;
@ -338,7 +340,7 @@
}) })
); );
window.requestAnimationFrame(animateSats); if (shouldLoop) window.requestAnimationFrame(animateSats);
return sats; return sats;
} }
@ -407,7 +409,7 @@
updateSats(date); updateSats(date);
draw(); draw();
window.requestAnimationFrame(animateSats); if (shouldLoop) window.requestAnimationFrame(animateSats);
} }
initGlobe(); initGlobe();
@ -418,6 +420,10 @@
onMount(async () => { onMount(async () => {
doThing(); doThing();
}); });
onDestroy(() => {
shouldLoop = false;
});
</script> </script>
<div class="globeContainer"> <div class="globeContainer">