Style function takes a resolution arg
This commit is contained in:
@@ -98,8 +98,9 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
|
|||||||
var vectorLayer = this.getVectorLayer();
|
var vectorLayer = this.getVectorLayer();
|
||||||
var vectorSource = vectorLayer.getVectorSource();
|
var vectorSource = vectorLayer.getVectorSource();
|
||||||
var frameStateExtent = frameState.extent;
|
var frameStateExtent = frameState.extent;
|
||||||
|
var frameStateResolution = frameState.view2DState.resolution;
|
||||||
|
|
||||||
if (this.renderedResolution_ == frameState.view2DState.resolution &&
|
if (this.renderedResolution_ == frameStateResolution &&
|
||||||
this.renderedRevision_ == vectorSource.getRevision() &&
|
this.renderedRevision_ == vectorSource.getRevision() &&
|
||||||
ol.extent.containsExtent(this.renderedExtent_, frameStateExtent)) {
|
ol.extent.containsExtent(this.renderedExtent_, frameStateExtent)) {
|
||||||
return;
|
return;
|
||||||
@@ -124,7 +125,7 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
|
|||||||
* @param {ol.Feature} feature Feature.
|
* @param {ol.Feature} feature Feature.
|
||||||
*/
|
*/
|
||||||
function(feature) {
|
function(feature) {
|
||||||
var styles = styleFunction(feature);
|
var styles = styleFunction(feature, frameStateResolution);
|
||||||
var i, ii = styles.length;
|
var i, ii = styles.length;
|
||||||
for (i = 0; i < ii; ++i) {
|
for (i = 0; i < ii; ++i) {
|
||||||
ol.renderer.vector.renderFeature(replayGroup, feature, styles[i]);
|
ol.renderer.vector.renderFeature(replayGroup, feature, styles[i]);
|
||||||
@@ -132,7 +133,7 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
|
|||||||
}, this);
|
}, this);
|
||||||
replayGroup.finish();
|
replayGroup.finish();
|
||||||
|
|
||||||
this.renderedResolution_ = frameState.view2DState.resolution;
|
this.renderedResolution_ = frameStateResolution;
|
||||||
this.renderedRevision_ = vectorSource.getRevision();
|
this.renderedRevision_ = vectorSource.getRevision();
|
||||||
if (!replayGroup.isEmpty()) {
|
if (!replayGroup.isEmpty()) {
|
||||||
this.replayGroup_ = replayGroup;
|
this.replayGroup_ = replayGroup;
|
||||||
|
|||||||
@@ -41,6 +41,6 @@ ol.style.Style = function(options) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {function(ol.Feature): Array.<ol.style.Style>}
|
* @typedef {function(ol.Feature, number): Array.<ol.style.Style>}
|
||||||
*/
|
*/
|
||||||
ol.style.StyleFunction;
|
ol.style.StyleFunction;
|
||||||
|
|||||||
Reference in New Issue
Block a user