Hit detection respects min and maxResolution
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user