Viglino / ol-ext

Cool extensions for Openlayers (ol) - animated clusters, CSS popup, Font Awesome symbol renderer, charts for statistical map (pie/bar), layer switcher, wikipedia layer, animations, canvas filters.
https://viglino.github.io/ol-ext/
Other
1.22k stars 464 forks source link

Animation stopping when zoom or drag the map #1055

Open petya0812 opened 4 months ago

petya0812 commented 4 months ago

Hello. I'm beginner in ol-ext. I try to animate some features routes and make a track behind it. So I create a map with: 1) default osm layer; 2) empty vector layer.

Then I create features, and add their into the layer. Then for each feature I create animation from Path class and starting vectorLayer.animateFeature(feature, animation) But when I drag the map or zoom it animation stopping. And when I leave drag features make teleport.

Viglino commented 4 months ago

It seems to work fine on the example page: https://viglino.github.io/ol-ext/examples/animation/map.featureanimation.path.html. Do you have a example online to show the issue?

petya0812 commented 4 months ago

Thank you for answer, i will do example and return with it

petya0812 commented 4 months ago

I have some problems with implementation it into sandbox. Thats why i created the github repository: https://github.com/petya0812/map If it not hard for you, may you try it locale, please. It is really important to me. Anyway, thank you so much!

Viglino commented 4 months ago

You have to add options updateWhileAnimating and updateWhileInteracting to your layer to fix it:

const vectorLayer = new VectorLayer({
  source: new VectorSource({
    features: features.map(f => [f.baloon, f.track]).flat()
  }),
  updateWhileAnimating: true,
  updateWhileInteracting: true,
...
petya0812 commented 4 months ago

You are the best. Thank you so much!