Style function takes a resolution arg

This commit is contained in:
Éric Lemoine
2013-11-25 17:12:16 +01:00
parent 3820caade1
commit 317294756a
2 changed files with 5 additions and 4 deletions

View File

@@ -98,8 +98,9 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
var vectorLayer = this.getVectorLayer();
var vectorSource = vectorLayer.getVectorSource();
var frameStateExtent = frameState.extent;
var frameStateResolution = frameState.view2DState.resolution;
if (this.renderedResolution_ == frameState.view2DState.resolution &&
if (this.renderedResolution_ == frameStateResolution &&
this.renderedRevision_ == vectorSource.getRevision() &&
ol.extent.containsExtent(this.renderedExtent_, frameStateExtent)) {
return;
@@ -124,7 +125,7 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
* @param {ol.Feature} feature Feature.
*/
function(feature) {
var styles = styleFunction(feature);
var styles = styleFunction(feature, frameStateResolution);
var i, ii = styles.length;
for (i = 0; i < ii; ++i) {
ol.renderer.vector.renderFeature(replayGroup, feature, styles[i]);
@@ -132,7 +133,7 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
}, this);
replayGroup.finish();
this.renderedResolution_ = frameState.view2DState.resolution;
this.renderedResolution_ = frameStateResolution;
this.renderedRevision_ = vectorSource.getRevision();
if (!replayGroup.isEmpty()) {
this.replayGroup_ = replayGroup;