add destroy on Globe + startRoation option
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user