From e85cc8b80eac48d342862c891acbe8c24137192b Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Wed, 29 Jan 2014 20:40:48 +0100 Subject: [PATCH] Improve type checking in ol.interaction.Select --- src/ol/interaction/selectinteraction.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ol/interaction/selectinteraction.js b/src/ol/interaction/selectinteraction.js index b1ff72c6be..8f339129d0 100644 --- a/src/ol/interaction/selectinteraction.js +++ b/src/ol/interaction/selectinteraction.js @@ -38,12 +38,22 @@ ol.interaction.Select = function(opt_options) { layerFilter = options.layerFilter; } else if (goog.isDef(options.layer)) { var layer = options.layer; - layerFilter = function(l) { + layerFilter = + /** + * @param {ol.layer.Layer} l Layer. + * @return {boolean} Include. + */ + function(l) { return l === layer; }; } else if (goog.isDef(options.layers)) { var layers = options.layers; - layerFilter = function(layer) { + layerFilter = + /** + * @param {ol.layer.Layer} layer Layer. + * @return {boolean} Include. + */ + function(layer) { return goog.array.indexOf(layers, layer) != -1; }; } else { @@ -102,6 +112,7 @@ ol.interaction.Select.prototype.handleMapBrowserEvent = } }, undefined, this.layerFilter_); } else { + /** @type {ol.Feature|undefined} */ var feature = map.forEachFeatureAtPixel(mapBrowserEvent.pixel, /** * @param {ol.Feature} feature Feature.