add destroy on Globe + startRoation option

This commit is contained in:
2020-04-19 16:13:29 +02:00
parent 094614f83c
commit caa84e10e3
4 changed files with 4705 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
<script>
import { onMount } from 'svelte'
import { onMount, onDestroy } from 'svelte'
import { continents, locations } from 'utils/store'
import { getPosition } from 'utils/functions'
// Dependencies
@@ -42,6 +42,10 @@
}
onDestroy(async ()=>{
globe && globe.destroy()
})
/*
** Run code when mounted
*/
@@ -53,7 +57,8 @@
globe = new InteractiveGlobe({
el: scope,
cameraDistance: size, // Smaller number == larger globe
// autoRotationSpeed: -0.0025,
autoRotationSpeed: -0.0025,
rotationStart: 90, //in degrees
scrollSmoothing: 0.5,
texture: `/img/globe/map-${window.innerWidth > 1440 && window.devicePixelRatio > 1 ? '4k' : '2k'}.png`,
markers: [ ...$locations.map(location => {
@@ -68,9 +73,8 @@
}
}) ],
centerPositions: [ ...$continents.map(continent => continent.countries) ],
onLinkClicked: () => {}
onLinkClicked: () => { }
})
console.log(globe.options.centerPositions)
// Run the globe
onResize()