Merge pull request #1598 from elemoine/detect-style-changes

Changing the style function doesn't redraw the layer
This commit is contained in:
Éric Lemoine
2014-01-30 02:54:42 -08:00
4 changed files with 15 additions and 3 deletions

View File

@@ -77,6 +77,9 @@ goog.exportProperty(
/**
* If the styles are changed by setting a new style function or by changing the
* value returned by the style function then `dispatchChangeEvent` should be
* called on the layer for the layer to be refreshed on the screen.
* @param {ol.feature.StyleFunction|undefined} styleFunction Style function.
*/
ol.layer.Vector.prototype.setStyleFunction = function(styleFunction) {

View File

@@ -1,4 +1,5 @@
@exportSymbol ol.Observable
@exportProperty ol.Observable.prototype.dispatchChangeEvent
@exportProperty ol.Observable.prototype.on
@exportProperty ol.Observable.prototype.once
@exportProperty ol.Observable.prototype.un

View File

@@ -189,10 +189,11 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
var frameStateExtent = frameState.extent;
var frameStateResolution = frameState.view2DState.resolution;
var pixelRatio = frameState.pixelRatio;
var vectorLayerRevision = vectorLayer.getRevision();
if (!this.dirty_ &&
this.renderedResolution_ == frameStateResolution &&
this.renderedRevision_ == vectorSource.getRevision() &&
this.renderedRevision_ == vectorLayerRevision &&
ol.extent.containsExtent(this.renderedExtent_, frameStateExtent)) {
return;
}
@@ -230,7 +231,7 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
replayGroup.finish();
this.renderedResolution_ = frameStateResolution;
this.renderedRevision_ = vectorSource.getRevision();
this.renderedRevision_ = vectorLayerRevision;
if (!replayGroup.isEmpty()) {
this.replayGroup_ = replayGroup;
}