Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Re-render on vector change #1831

Open
crepererum opened this Issue · 5 comments

4 participants

@crepererum

Environment:

  • ol3 version: HEAD
  • renderer: canvas
  • layer: vector, driven by a vector source
  • vector source: just a list of some features (also tested with only 1 feature)

What my script does:

  1. Update the feature vector by removing and adding a feature
  2. Fix: call map.renderSync()
  3. Start a pan animation to a new center using ol.animation.pan and map.beforeRender
source.removeFeature(last);
last = new ol.Feature({
    geometry: new ol.geom.Point(nextCenter)
});
source.addFeature(map.olfeature);

map.renderSync(); // fix

pan = ol.animation.pan({
    duration: 1000,
    source: view.getCenter(),
    start: nextCenter
});
map.olmap.beforeRender(pan);
view.setCenter(nextCenter);

Expected behavior without fix (step 2):
Feature changes get immediately shown on the map and animation just plays.

Actual behavior without the fix:
Animation plays and after it has finished the feature changes are shown. So during the animation the old feature vector is displayed.

Notes:
The fix works well if the feature has a ol.geom.Point geometry but sometimes does not when using ol.geom.Circle.


Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.

@elemoine
Owner

It sounds to me that the problem is related to ol.renderer.canvas.VectorLayer#prepareFrame quickly bailing out when interacting or animating. See https://github.com/openlayers/ol3/blob/master/src/ol/renderer/canvas/canvasvectorlayerrenderer.js#L212. Maybe we should always re-render when the revision number has changed, even when interacting or animating. What do others think?

@twpayne

#1629 address this same problem.

@tschaub
Owner

Maybe we should always re-render when the revision number has changed

This sounds reasonable to me.

@elemoine
Owner

#1629 address this same problem.

It looks to me that the patch attached to #1629 is a superset of what's needed to fix that bug.

@elemoine
Owner

Changing milestone to v3.0.0-gamma.2. I'll try to have a look at that issue next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.