Pass layer to forEachFeatureAtPixel callback
This commit is contained in:
@@ -457,7 +457,8 @@ ol.Map.prototype.disposeInternal = function() {
|
||||
|
||||
/**
|
||||
* @param {ol.Pixel} pixel Pixel.
|
||||
* @param {function(this: S, ol.Feature): T} callback Feature callback.
|
||||
* @param {function(this: S, ol.Feature, ol.layer.Layer): T} callback Feature
|
||||
* callback.
|
||||
* @param {S=} opt_obj Scope.
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template S,T
|
||||
|
||||
@@ -92,6 +92,7 @@ ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtPixel =
|
||||
goog.asserts.assert(!ol.extent.isEmpty(this.renderedExtent_));
|
||||
goog.asserts.assert(!isNaN(this.renderedResolution_));
|
||||
var coordinate = this.getMap().getCoordinateFromPixel(pixel);
|
||||
var layer = this.getLayer();
|
||||
var renderGeometryFunction = this.getRenderGeometryFunction_();
|
||||
goog.asserts.assert(goog.isFunction(renderGeometryFunction));
|
||||
return this.replayGroup_.forEachGeometryAtCoordinate(this.renderedExtent_,
|
||||
@@ -103,7 +104,7 @@ ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtPixel =
|
||||
function(geometry, data) {
|
||||
var feature = /** @type {ol.Feature} */ (data);
|
||||
goog.asserts.assert(goog.isDef(feature));
|
||||
return callback.call(opt_obj, feature);
|
||||
return callback.call(opt_obj, feature, layer);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -44,7 +44,8 @@ goog.inherits(ol.renderer.Layer, goog.Disposable);
|
||||
|
||||
/**
|
||||
* @param {ol.Pixel} pixel Pixel.
|
||||
* @param {function(this: S, ol.Feature): T} callback Feature callback.
|
||||
* @param {function(this: S, ol.Feature, ol.layer.Layer): T} callback Feature
|
||||
* callback.
|
||||
* @param {S=} opt_obj Scope.
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template S,T
|
||||
|
||||
@@ -80,7 +80,8 @@ ol.renderer.Map.prototype.disposeInternal = function() {
|
||||
|
||||
/**
|
||||
* @param {ol.Pixel} pixel Pixel.
|
||||
* @param {function(this: S, ol.Feature): T} callback Feature callback.
|
||||
* @param {function(this: S, ol.Feature, ol.layer.Layer): T} callback Feature
|
||||
* callback.
|
||||
* @param {S=} opt_obj Scope.
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template S,T
|
||||
|
||||
Reference in New Issue
Block a user