shuding / cobe

5kB WebGL globe lib.
https://cobe.vercel.app
MIT License
3.15k stars 169 forks source link

Rotate to Location on Vue.js #46

Closed well-prado closed 1 year ago

well-prado commented 1 year ago

Hey, can anyone help me making the Rotate to Location work exactly like the React Example on:

https://cobe.vercel.app/docs/showcases/rotate-to-location

Sadly, I did everything as similar as possible, but the THETA just go nuts!

`

` I'm using Vue 2.7.10
well-prado commented 1 year ago

Hey guys, just find out my stupid error.

I was using watchEffect to pass a value inside focusRef.value and passing the return value of the funciton locationToAngles causing a loop.

To fix it, just got rid of the watchEffect and used watch instead.

watch( () => props.marker, (marker) => { focusRef.value = locationToAngles(marker.location[0], marker.location[1]); } );

watchEffect would work as well, but I thought that watch was simple enough to solve it.