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

Pause all animation on arc hover with pauseAnimation? #153

Closed triblondon closed 1 year ago

triblondon commented 1 year ago

I'm not sure if this is a bug or if I'm just misinterpreting what this method does:

  const g = Globe()(el)
    .onArcHover((a) => {
      g.controls().autoRotate = !a // works as expected :-)
      if (a) {
        g.pauseAnimation() // Doesn't do what I expected :-(
      } else {
        g.resumeAnimation()
      }
    })

This causes the globe to stop rotating when you hover an arc, but the arcs still animate (ie the line dash animation). Ideally I'd like all motion to freeze, allowing the user to inspect the arc before it vanishes.

Is there a way to do that?

vasturiano commented 1 year ago

@triblondon thanks for reaching out.

I've just pushed an update that also freezes all the layer animations when you invoke pauseAnimation. Please upgrade to the latest published version.

triblondon commented 1 year ago

It works! That's really kind of you, thank you :-)