@guardian/interactive-component-library 0.1.0-alpha.50 → 0.1.0-alpha.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -302,9 +302,9 @@
302
302
  children: [content2, labelType === LabelType.hanging && !hideLabels && hangingLabelConfig.map((config, i) => renderLabel(config, i))]
303
303
  });
304
304
  }
305
- const svg$8 = "_svg_1cajk_6";
306
- const previous = "_previous_1cajk_12";
307
- const next = "_next_1cajk_16";
305
+ const svg$8 = "_svg_ihy3w_6";
306
+ const previous = "_previous_ihy3w_12";
307
+ const next = "_next_ihy3w_16";
308
308
  const defaultStyles$u = {
309
309
  svg: svg$8,
310
310
  previous,
@@ -6893,7 +6893,14 @@
6893
6893
  }
6894
6894
  getFeaturesAtCoordinate(coordinate) {
6895
6895
  const [lon, lat] = coordinate;
6896
- return knn$1(this._featuresRtree, lon, lat, 1, (d2) => d2.feature.containsCoordinate(coordinate)).map((d2) => d2.feature);
6896
+ const features = knn$1(this._featuresRtree, lon, lat, 10, (d2) => d2.feature.containsCoordinate(coordinate)).map((d2) => {
6897
+ const midX = d2.minX + (d2.minX + d2.maxX) / 2;
6898
+ const midY = d2.minY + (d2.minY + d2.maxY) / 2;
6899
+ d2.distance = Math.hypot(midX - lon, midY - lat);
6900
+ return d2;
6901
+ });
6902
+ features.sort((a, b) => a.distance - b.distance);
6903
+ return features.map((d2) => d2.feature);
6897
6904
  }
6898
6905
  getFeaturesInExtent(extent) {
6899
6906
  const [minX, minY, maxX, maxY] = extent;