Fix forEachLayerAtPixel for the canvas renderer
This commit is contained in:
@@ -2,6 +2,7 @@ goog.provide('ol.renderer.canvas.Layer');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.functions');
|
||||
goog.require('ol.render.Event');
|
||||
goog.require('ol.render.canvas');
|
||||
goog.require('ol.render.canvas.Immediate');
|
||||
@@ -214,12 +215,21 @@ ol.renderer.canvas.Layer.prototype.prepareFrame = function(frameState, layerStat
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Pixel} pixelOnMap Pixel.
|
||||
* @param {ol.Transform} imageTransformInv The transformation matrix
|
||||
* to convert from a map pixel to a canvas pixel.
|
||||
* @return {ol.Pixel} The pixel.
|
||||
* @protected
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @param {olx.FrameState} frameState Frame state.
|
||||
* @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
|
||||
*/
|
||||
ol.renderer.canvas.Layer.prototype.getPixelOnCanvas = function(pixelOnMap, imageTransformInv) {
|
||||
return ol.transform.apply(imageTransformInv, pixelOnMap.slice());
|
||||
ol.renderer.canvas.Layer.prototype.forEachLayerAtCoordinate = function(coordinate, frameState, callback, thisArg) {
|
||||
|
||||
var hasFeature = this.forEachFeatureAtCoordinate(
|
||||
coordinate, frameState, ol.functions.TRUE, this);
|
||||
|
||||
if (hasFeature) {
|
||||
return callback.call(thisArg, this.getLayer(), null);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user