From 643d0b8fa3808d7f6006ae23e8ba794ae8db1e4b Mon Sep 17 00:00:00 2001 From: stonio Date: Sun, 1 Jan 2017 03:53:04 +0100 Subject: [PATCH] [openlayers] Update method forEachFeatureAtPixel (#13640) * Update method forEachFeatureAtPixel * Move definition of interface AtPixelOptions --- openlayers/index.d.ts | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/openlayers/index.d.ts b/openlayers/index.d.ts index 551f8fa2eb..5f30540d5a 100644 --- a/openlayers/index.d.ts +++ b/openlayers/index.d.ts @@ -6669,20 +6669,13 @@ declare module ol { * the {@link ol.layer.Layer layer} of the feature and will be null for * unmanaged layers. To stop detection, callback functions can return a * truthy value. - * @param {S=} opt_this Value to use as `this` when executing `callback`. - * @param {(function(this: U, ol.layer.Layer): boolean)=} opt_layerFilter Layer - * filter function. The filter function will receive one argument, the - * {@link ol.layer.Layer layer-candidate} and it should return a boolean - * value. Only layers which are visible and for which this function returns - * `true` will be tested for features. By default, all visible layers will - * be tested. - * @param {U=} opt_this2 Value to use as `this` when executing `layerFilter`. + * @param {olx.AtPixelOptions=} opt_options Optional options. * @return {T|undefined} Callback result, i.e. the return value of last * callback execution, or the first truthy callback return value. - * @template S,T,U + * @template S,T * @api stable */ - forEachFeatureAtPixel(pixel: ol.Pixel, callback: ((feature: (ol.Feature | ol.render.Feature), layer: ol.layer.Layer) => T), opt_this?: S, opt_layerFilter?: ((layer: ol.layer.Layer) => boolean), opt_this2?: U): (T); + forEachFeatureAtPixel(pixel: ol.Pixel, callback: ((feature: (ol.Feature | ol.render.Feature), layer: ol.layer.Layer) => T), opt_options?: olx.AtPixelOptions): (T); /** * Detect layers that have a color value at a pixel on the viewport, and @@ -11778,7 +11771,6 @@ declare module olx { easing?: ((t: number) => number); } - } /** @@ -13779,7 +13771,17 @@ declare module olx { zoom?: number; zoomFactor?: number; } - + + /** + * Object literal with options for the {@link ol.Map#forEachFeatureAtPixel} and + * {@link ol.Map#hasFeatureAtPixel} methods. + * @typedef {{layerFilter: ((function(ol.layer.Layer): boolean)|undefined), + * hitTolerance: (number|undefined)}} + */ + interface AtPixelOptions { + layerFilter?: ((layer: ol.layer.Layer) => boolean) + hitTolerance?: number + } /** * @typedef {{animate: boolean,