@fusion.dev/helix-map 0.110.6 → 0.111.1

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.
@@ -249,7 +249,12 @@ export interface MapLayerSpec {
249
249
  points: MapPlace[];
250
250
  }
251
251
  /**
252
- * The stretch of the world some places cover, and their middle.
252
+ * The stretch of the world some places cover, and their middle, with at least
253
+ * `least` degrees either side where they cover less than that.
254
+ *
255
+ * **No least reach for a cluster that was pressed**, which is framed to come
256
+ * apart: widened to half a kilometer, a cluster of places a street apart was
257
+ * framed as far out as it already was, and pressing it never opened it.
253
258
  *
254
259
  * **One pass rather than `Math.max(...lats)`**, which spreads every place into
255
260
  * an argument list and throws past about 65,000 of them in Safari: a points
@@ -261,7 +266,7 @@ export interface MapLayerSpec {
261
266
  * to the globe, and their middle landed at 0. The bounds may run past 180 as
262
267
  * a result, which both renderers draw.
263
268
  */
264
- export declare const reachOf: (places: readonly MapPlace[]) => {
269
+ export declare const reachOf: (places: readonly MapPlace[], least?: number) => {
265
270
  bounds: MapBounds;
266
271
  middle: MapPlace;
267
272
  };
@@ -50,7 +50,7 @@ const UNPLACED_POSITION = {
50
50
  };
51
51
  const METERS_PER_DEGREE = 111_320;
52
52
  const LEAST_REACH = 0.005;
53
- export const reachOf = (places) => {
53
+ export const reachOf = (places, least = 0) => {
54
54
  const first = places[0]?.lng ?? 0;
55
55
  let north = -90;
56
56
  let south = 90;
@@ -69,11 +69,11 @@ export const reachOf = (places) => {
69
69
  }
70
70
  const count = Math.max(places.length, 1);
71
71
  const across = ((lngs / count + 540) % 360) - 180;
72
- if (north - south < LEAST_REACH && east - west < LEAST_REACH) {
73
- north += LEAST_REACH;
74
- south -= LEAST_REACH;
75
- east += LEAST_REACH;
76
- west -= LEAST_REACH;
72
+ if (north - south < least && east - west < least) {
73
+ north += least;
74
+ south -= least;
75
+ east += least;
76
+ west -= least;
77
77
  }
78
78
  return {
79
79
  bounds: { northEast: { lat: north, lng: east }, southWest: { lat: south, lng: west } },
@@ -952,7 +952,7 @@ export const connectMap = (frame, driver, options = {}) => {
952
952
  if (places.length === 0) {
953
953
  return;
954
954
  }
955
- driver.fit(reachOf(places).bounds, options.padding ?? 48, options.animate === false ? null : motionOf(frame, 'travel'));
955
+ driver.fit(reachOf(places, LEAST_REACH).bounds, options.padding ?? 48, options.animate === false ? null : motionOf(frame, 'travel'));
956
956
  },
957
957
  };
958
958
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-map",
3
3
  "description": "Connects the Helix Map frame to a map renderer: MapLibre, Leaflet, or a driver of your own.",
4
- "version": "0.110.6",
4
+ "version": "0.111.1",
5
5
  "license": "MIT",
6
6
  "author": "Ross Sheppard <ross.sheppard@fusion.dev>",
7
7
  "repository": {
@@ -43,14 +43,14 @@
43
43
  },
44
44
  "bugs": "https://github.com/project-fusion/fusion/issues",
45
45
  "dependencies": {
46
- "@fusion.dev/helix-core": "0.110.6",
47
- "@fusion.dev/helix-icons": "0.110.6",
46
+ "@fusion.dev/helix-core": "0.111.1",
47
+ "@fusion.dev/helix-icons": "0.111.1",
48
48
  "@mapbox/vector-tile": "^3.0.0",
49
49
  "pbf": "^5.1.2"
50
50
  },
51
51
  "devDependencies": {
52
- "@fusion.dev/helix-headless": "0.110.6",
53
- "@fusion.dev/helix-testing": "0.110.6",
52
+ "@fusion.dev/helix-headless": "0.111.1",
53
+ "@fusion.dev/helix-testing": "0.111.1",
54
54
  "@maplibre/maplibre-gl-style-spec": "^26.4.4",
55
55
  "@types/bun": "^1.3.0",
56
56
  "@types/leaflet": "^1.9.20",