vasturiano / globe.gl

UI component for Globe Data Visualization using ThreeJS/WebGL
https://vasturiano.github.io/globe.gl/example/world-population/
MIT License
1.97k stars 293 forks source link

Point of view jumping on click #151

Closed jackkemmish closed 1 year ago

jackkemmish commented 1 year ago

Describe the bug I am using the pointOfView() function to rotate the globe on click which works as expected. The issue lies when clicking on a few different pins, with a slight delay before clicking on another pin, the globe spins out of control then goes to the selected pin.

To Reproduce Steps to reproduce the behavior:

  1. Have a few pins on the globe all with lat/lng values.
  2. These pins are clickable, so when clicking use world.pointOfView({ lat: d.lat, lng: d.lng, altitude: 1.4 }, 1000) which will rotate the globe to the clicked pin.
  3. Click a few different pins, then have a slight delay before clicking another one, the globe will spin uncontrollably before finsihing on the pin you just clicked.

Expected behavior I'd assume the globe would just rotate naturally - but I do think there might be a potential build up as I have tried without a duration value and it just jumps, there's no uncontrolable rotation, however for the smooth effect I need the duration.

Screenshots Below are some screenshots of the lat/lng I am logging to the console. The first 2 are as expected, then the 3rd one is much greater which results in the spinning before reaching the target pin.

Screenshot 2023-04-11 at 15 47 53 Screenshot 2023-04-11 at 15 47 58 Screenshot 2023-04-11 at 15 48 10

Any help would be appreciated on this one!

Thanks, Jack

vasturiano commented 1 year ago

@jackkemmish thanks for reaching out.

The easiest would be if you have a repro link with a simplified example, say at https://codepen.io/. This could be many things and it's difficult to say without looking more closely.