New Layer#getFeatures method with fast hit detection for VectorLayer
This commit is contained in:
@@ -135,6 +135,24 @@ class BaseVectorLayer extends Layer {
|
||||
return this.declutter_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the topmost feature that intersects the given pixel on the viewport. Returns a promise
|
||||
* that resolves with an array of features. The array will either contain the topmost feature
|
||||
* when a hit was detected, or it will be empty.
|
||||
*
|
||||
* The hit detection algorithm used for this method is optimized for performance, but is less
|
||||
* accurate than the one used in {@link import("../PluggableMap.js").default#getFeaturesAtPixel}: Text
|
||||
* is not considered, and icons are only represented by their bounding box instead of the exact
|
||||
* image.
|
||||
*
|
||||
* @param {import("../pixel.js").Pixel} pixel Pixel.
|
||||
* @return {Promise<Array<import("../Feature").default>>} Promise that resolves with an array of features.
|
||||
* @api
|
||||
*/
|
||||
getFeatures(pixel) {
|
||||
return super.getFeatures(pixel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number|undefined} Render buffer.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user