@@ -836,8 +836,9 @@ class View extends THREE.EventDispatcher {
836
836
}
837
837
838
838
/**
839
- * Searches for {@link Feature} in {@link ColorLayer}, under the mouse of at
840
- * a specified coordinates, in this view.
839
+ * Searches for {@link FeatureGeometry} in {@link ColorLayer}, under the mouse or at
840
+ * the specified coordinates, in this view. Combining them per layer and in a Feature
841
+ * like format.
841
842
*
842
843
* @param {Object } mouseOrEvt - Mouse position in window coordinates (from
843
844
* the top left corner of the window) or `MouseEvent` or `TouchEvent`.
@@ -847,10 +848,15 @@ class View extends THREE.EventDispatcher {
847
848
* into. If not specified, all {@link ColorLayer} and {@link GeometryLayer}
848
849
* layers of this view will be looked in.
849
850
*
850
- * @return {Object } - An object, with a property per layer. For example,
851
- * looking for features on layers `wfsBuilding` and `wfsRoads` will give an
852
- * object like `{ wfsBuilding: [...], wfsRoads: [] }`. Each property is made
853
- * of an array, that can be empty or filled with found features.
851
+ * @return {Object } - An object, having one property per layer.
852
+ * For example, looking for features on layers `wfsBuilding` and `wfsRoads`
853
+ * will give an object like `{ wfsBuilding: [...], wfsRoads: [] }`.
854
+ * Each property is made of an array, that can be empty or filled with
855
+ * Feature like objects composed of:
856
+ * - the FeatureGeometry
857
+ * - the feature type
858
+ * - the style
859
+ * - the coordinate if the FeatureGeometry is a point
854
860
*
855
861
* @example
856
862
* view.pickFeaturesAt({ x, y });
@@ -924,8 +930,12 @@ class View extends THREE.EventDispatcher {
924
930
925
931
precision = CRS . isMetricUnit ( texture . features . crs ) ? precisions . M : precisions . D ;
926
932
927
- result [ materialLayer . id ] = result [ materialLayer . id ] . concat (
928
- FeaturesUtils . filterFeaturesUnderCoordinate ( coordinates , texture . features , precision ) ) ;
933
+ const featuresUnderCoor = FeaturesUtils . filterFeaturesUnderCoordinate ( coordinates , texture . features , precision ) ;
934
+ featuresUnderCoor . forEach ( ( feature ) => {
935
+ if ( ! result [ materialLayer . id ] . find ( f => f . geometry === feature . geometry ) ) {
936
+ result [ materialLayer . id ] . push ( feature ) ;
937
+ }
938
+ } ) ;
929
939
}
930
940
}
931
941
}
0 commit comments