openlayers: updateWhileInteracting not working in VectorImageLayer

Features in VectorImageLayer are not updated when interacting with the map (dragging, zooming etc…).

Steps to reproduce:

  1. create a feature and update its coordinate every interval.
  2. create a new VectorSource and add the feature to it.
  3. create a new VectorImageLayer with updateWhileInteracting: true and add the vectorSource to it
  4. Open the application and start zooming and dragging the map.
  5. The feature will only update its coordinates when the map is not interacted with

Expected behavior Like in VectorLayer, I expect the feature to update even the map is been interacted with.

const source = new VectorSource({});
const layer = new VectorImageLayer({ // bug will not happen if using VectorLayer
    source,
    updateWhileInteracting: true,
    updateWhileAnimating: true,
)};

map.addLayer(layer);

const feature  = new Feature(new Point(randomLocation());
source.addFeature(feature);

setInterval(() => {
    feature.getGeomtry().setCoordinates(randomLocation());
}, 500);

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 18 (9 by maintainers)

Most upvoted comments

Well, I guess you need to set updateWhileAnimating/Interacting to true to have it update during a pan…