Hit detection respects min and maxResolution

This commit is contained in:
Éric Lemoine
2014-05-23 16:44:43 +02:00
parent 81523091f0
commit fd8a46dcae
5 changed files with 72 additions and 9 deletions

View File

@@ -37,6 +37,20 @@ ol.layer.Layer = function(options) {
goog.inherits(ol.layer.Layer, ol.layer.Base);
/**
* Return `true` if the layer is visible, and if the passed resolution is
* between the layer's minResolution and maxResolution. The comparison is
* inclusive for `minResolution` and exclusive for `maxResolution`.
* @param {ol.layer.LayerState} layerState Layer state.
* @param {number} resolution Resolution.
* @return {boolean} The layer is visible at the given resolution.
*/
ol.layer.Layer.visibleAtResolution = function(layerState, resolution) {
return layerState.visible && resolution >= layerState.minResolution &&
resolution < layerState.maxResolution;
};
/**
* @inheritDoc
*/