From f61a43b3c6abddc1b5fc11b0ae4bdb8ec1cf0134 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sat, 10 Sep 2016 11:12:10 -0600 Subject: [PATCH] Keep ol.Color as Array --- src/ol/map.js | 11 ++++++----- src/ol/renderer/canvas/imagelayer.js | 2 +- src/ol/renderer/canvas/tilelayer.js | 2 +- src/ol/renderer/layer.js | 2 +- src/ol/renderer/map.js | 2 +- src/ol/renderer/webgl/imagelayer.js | 2 +- src/ol/renderer/webgl/tilelayer.js | 4 ++-- src/ol/renderer/webgl/vectorlayer.js | 2 +- src/ol/typedefs.js | 2 +- 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/ol/map.js b/src/ol/map.js index 92093a2e6d..5323cd7172 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -603,11 +603,12 @@ ol.Map.prototype.forEachFeatureAtPixel = function(pixel, callback, opt_this, opt * execute a callback with each matching layer. Layers included in the * detection can be configured through `opt_layerFilter`. * @param {ol.Pixel} pixel Pixel. - * @param {function(this: S, ol.layer.Layer, ol.Color): T} callback Layer - * callback. This callback will recieve two arguments: first is the - * {@link ol.layer.Layer layer}, second argument is {@link ol.Color} - * and will be null for layer types that do not currently support this - * argument. To stop detection callback functions can return a truthy value. + * @param {function(this: S, ol.layer.Layer, (Uint8ClampedArray|Uint8Array)): T} callback + * Layer callback. This callback will recieve two arguments: first is the + * {@link ol.layer.Layer layer}, second argument is an array representing + * [R, G, B, A] pixel values (0 - 255) and will be `null` for layer types + * that do not currently support this argument. 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 diff --git a/src/ol/renderer/canvas/imagelayer.js b/src/ol/renderer/canvas/imagelayer.js index 472a03e4b9..828b902e80 100644 --- a/src/ol/renderer/canvas/imagelayer.js +++ b/src/ol/renderer/canvas/imagelayer.js @@ -72,7 +72,7 @@ ol.renderer.canvas.ImageLayer.prototype.forEachFeatureAtCoordinate = function(co /** * @param {ol.Pixel} pixel Pixel. * @param {olx.FrameState} frameState FrameState. - * @param {function(this: S, ol.layer.Layer, ol.Color): T} callback Layer + * @param {function(this: S, ol.layer.Layer, (Uint8ClampedArray|Uint8Array)): T} callback Layer * callback. * @param {S} thisArg Value to use as `this` when executing `callback`. * @return {T|undefined} Callback result. diff --git a/src/ol/renderer/canvas/tilelayer.js b/src/ol/renderer/canvas/tilelayer.js index a512ee8592..296a04d203 100644 --- a/src/ol/renderer/canvas/tilelayer.js +++ b/src/ol/renderer/canvas/tilelayer.js @@ -189,7 +189,7 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame = function( /** * @param {ol.Pixel} pixel Pixel. * @param {olx.FrameState} frameState FrameState. - * @param {function(this: S, ol.layer.Layer, ol.Color): T} callback Layer + * @param {function(this: S, ol.layer.Layer, (Uint8ClampedArray|Uint8Array)): T} callback Layer * callback. * @param {S} thisArg Value to use as `this` when executing `callback`. * @return {T|undefined} Callback result. diff --git a/src/ol/renderer/layer.js b/src/ol/renderer/layer.js index cf0d0be7a0..8a7483972a 100644 --- a/src/ol/renderer/layer.js +++ b/src/ol/renderer/layer.js @@ -48,7 +48,7 @@ ol.renderer.Layer.prototype.forEachFeatureAtCoordinate = ol.nullFunction; /** * @param {ol.Pixel} pixel Pixel. * @param {olx.FrameState} frameState Frame state. - * @param {function(this: S, ol.layer.Layer, ol.Color): T} callback Layer callback. + * @param {function(this: S, ol.layer.Layer, (Uint8ClampedArray|Uint8Array)): T} callback Layer callback. * @param {S} thisArg Value to use as `this` when executing `callback`. * @return {T|undefined} Callback result. * @template S,T diff --git a/src/ol/renderer/map.js b/src/ol/renderer/map.js index 744d9312e1..a8e88f804e 100644 --- a/src/ol/renderer/map.js +++ b/src/ol/renderer/map.js @@ -169,7 +169,7 @@ ol.renderer.Map.prototype.forEachFeatureAtCoordinate = function(coordinate, fram /** * @param {ol.Pixel} pixel Pixel. * @param {olx.FrameState} frameState FrameState. - * @param {function(this: S, ol.layer.Layer, ol.Color): T} callback Layer + * @param {function(this: S, ol.layer.Layer, (Uint8ClampedArray|Uint8Array)): T} callback Layer * callback. * @param {S} thisArg Value to use as `this` when executing `callback`. * @param {function(this: U, ol.layer.Layer): boolean} layerFilter Layer filter diff --git a/src/ol/renderer/webgl/imagelayer.js b/src/ol/renderer/webgl/imagelayer.js index defcd2fbf1..f85bbd4917 100644 --- a/src/ol/renderer/webgl/imagelayer.js +++ b/src/ol/renderer/webgl/imagelayer.js @@ -221,7 +221,7 @@ ol.renderer.webgl.ImageLayer.prototype.hasFeatureAtCoordinate = function(coordin /** * @param {ol.Pixel} pixel Pixel. * @param {olx.FrameState} frameState FrameState. - * @param {function(this: S, ol.layer.Layer, ol.Color): T} callback Layer + * @param {function(this: S, ol.layer.Layer, (Uint8ClampedArray|Uint8Array)): T} callback Layer * callback. * @param {S} thisArg Value to use as `this` when executing `callback`. * @return {T|undefined} Callback result. diff --git a/src/ol/renderer/webgl/tilelayer.js b/src/ol/renderer/webgl/tilelayer.js index 0a4f084a1a..248a3e27ca 100644 --- a/src/ol/renderer/webgl/tilelayer.js +++ b/src/ol/renderer/webgl/tilelayer.js @@ -367,7 +367,7 @@ ol.renderer.webgl.TileLayer.prototype.prepareFrame = function(frameState, layerS /** * @param {ol.Pixel} pixel Pixel. * @param {olx.FrameState} frameState FrameState. - * @param {function(this: S, ol.layer.Layer, ol.Color): T} callback Layer + * @param {function(this: S, ol.layer.Layer, (Uint8ClampedArray|Uint8Array)): T} callback Layer * callback. * @param {S} thisArg Value to use as `this` when executing `callback`. * @return {T|undefined} Callback result. @@ -395,7 +395,7 @@ ol.renderer.webgl.TileLayer.prototype.forEachLayerAtPixel = function(pixel, fram gl.RGBA, gl.UNSIGNED_BYTE, imageData); if (imageData[3] > 0) { - return callback.call(thisArg, this.getLayer(), imageData); + return callback.call(thisArg, this.getLayer(), imageData); } else { return undefined; } diff --git a/src/ol/renderer/webgl/vectorlayer.js b/src/ol/renderer/webgl/vectorlayer.js index 2d50ea630d..c373c721e4 100644 --- a/src/ol/renderer/webgl/vectorlayer.js +++ b/src/ol/renderer/webgl/vectorlayer.js @@ -150,7 +150,7 @@ ol.renderer.webgl.VectorLayer.prototype.hasFeatureAtCoordinate = function(coordi /** * @param {ol.Pixel} pixel Pixel. * @param {olx.FrameState} frameState FrameState. - * @param {function(this: S, ol.layer.Layer, ol.Color): T} callback Layer + * @param {function(this: S, ol.layer.Layer, (Uint8ClampedArray|Uint8Array)): T} callback Layer * callback. * @param {S} thisArg Value to use as `this` when executing `callback`. * @return {T|undefined} Callback result. diff --git a/src/ol/typedefs.js b/src/ol/typedefs.js index a4b4ac8b24..e130a9a537 100644 --- a/src/ol/typedefs.js +++ b/src/ol/typedefs.js @@ -106,7 +106,7 @@ ol.CircleRenderOptions; * red, green, and blue should be integers in the range 0..255 inclusive. * alpha should be a float in the range 0..1 inclusive. If no alpha value is * given then `1` will be used. - * @typedef {Array.|Uint8Array|Uint8ClampedArray} + * @typedef {Array.} */ ol.Color;