Implement hasFeatureAtPixel for canvas
This commit is contained in:
@@ -54,6 +54,14 @@ goog.inherits(ol.renderer.Layer, goog.Disposable);
|
||||
ol.renderer.Layer.prototype.forEachFeatureAtPixel = goog.nullFunction;
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @param {olx.FrameState} frameState Frame state.
|
||||
* @return {boolean} Is there a feature at the given pixel?
|
||||
*/
|
||||
ol.renderer.Layer.prototype.hasFeatureAtPixel = goog.functions.FALSE;
|
||||
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @return {ol.layer.Layer} Layer.
|
||||
|
||||
@@ -169,6 +169,26 @@ ol.renderer.Map.prototype.forEachFeatureAtPixel =
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @param {olx.FrameState} frameState FrameState.
|
||||
* @param {function(this: U, ol.layer.Layer): boolean} layerFilter Layer filter
|
||||
* function, 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} thisArg Value to use as `this` when executing `layerFilter`.
|
||||
* @return {boolean} Is there a feature at the given pixel?
|
||||
* @template U
|
||||
*/
|
||||
ol.renderer.Map.prototype.hasFeatureAtPixel =
|
||||
function(coordinate, frameState, layerFilter, thisArg) {
|
||||
var hasFeature = this.forEachFeatureAtPixel(
|
||||
coordinate, frameState, goog.functions.TRUE, this, layerFilter, thisArg);
|
||||
|
||||
return goog.isDef(hasFeature) ? hasFeature : false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.layer.Layer} layer Layer.
|
||||
* @protected
|
||||
|
||||
Reference in New Issue
Block a user