@fusion.dev/helix-map 0.108.0 → 0.108.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.
package/README.md
CHANGED
|
@@ -61,6 +61,7 @@ bun run --filter @fusion.dev/helix-map test
|
|
|
61
61
|
|
|
62
62
|
The specs drive stand-ins for each renderer. What they cannot show, that the
|
|
63
63
|
real libraries move the way the stand-ins are told, was checked against
|
|
64
|
-
MapLibre 5.24 and Leaflet 1.9.4 in Chromium on September 25, 2026
|
|
64
|
+
MapLibre 5.24 and Leaflet 1.9.4 in Chromium on September 25, 2026, and against
|
|
65
|
+
MapLibre 6.11 on September 28, 2026.
|
|
65
66
|
|
|
66
67
|
MIT
|
|
@@ -225,6 +225,21 @@ export interface MapLibreMap {
|
|
|
225
225
|
lng: number;
|
|
226
226
|
}): boolean;
|
|
227
227
|
};
|
|
228
|
+
/**
|
|
229
|
+
* MapLibre 6's camera, which holds the transform `transform` was in 5. Not
|
|
230
|
+
* public in 6, which removed `transform` and gave no other way to ask
|
|
231
|
+
* whether a place is behind the globe; read only for that.
|
|
232
|
+
*/
|
|
233
|
+
_camera?: {
|
|
234
|
+
transform?: {
|
|
235
|
+
isLocationOccluded?(place: {
|
|
236
|
+
lat: number;
|
|
237
|
+
lng: number;
|
|
238
|
+
}): boolean;
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
/** Draws each image a style names as it is asked for. MapLibre 6. */
|
|
242
|
+
setMissingStyleImageResolver?(resolver: ((id: string) => void) | null): unknown;
|
|
228
243
|
/** Sets one paint property of one layer, which is how a points layer takes a new color. */
|
|
229
244
|
setPaintProperty(layer: string, name: string, value: unknown): unknown;
|
|
230
245
|
/** Sets one layout property of one layer, which is how the buildings are shown and hidden. */
|
|
@@ -214,10 +214,19 @@ const supplyImage = (holder, id) => {
|
|
|
214
214
|
holder.addImage?.(id, drawn, { pixelRatio: IMAGE_RATIO });
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
|
+
const answerImages = (holder) => {
|
|
218
|
+
if (typeof holder.setMissingStyleImageResolver === 'function') {
|
|
219
|
+
holder.setMissingStyleImageResolver((id) => supplyImage(holder, id));
|
|
220
|
+
return () => holder.setMissingStyleImageResolver?.(null);
|
|
221
|
+
}
|
|
222
|
+
const missing = (event) => supplyImage(holder, event?.id);
|
|
223
|
+
holder.on('styleimagemissing', missing);
|
|
224
|
+
return () => holder.off?.('styleimagemissing', missing);
|
|
225
|
+
};
|
|
217
226
|
const PICTURE = { height: 90, width: 120 };
|
|
218
227
|
export const mapLibreDriver = (map) => ({
|
|
219
228
|
bearing: () => map.getBearing(),
|
|
220
|
-
behind: ({ lat, lng }) => map.transform?.isLocationOccluded?.({ lat, lng }) === true,
|
|
229
|
+
behind: ({ lat, lng }) => (map.transform ?? map._camera?.transform)?.isLocationOccluded?.({ lat, lng }) === true,
|
|
221
230
|
credits(changed) {
|
|
222
231
|
const control = map.getContainer().querySelector(CONTROL);
|
|
223
232
|
const display = control?.style.display ?? '';
|
|
@@ -883,8 +892,7 @@ export const mapLibreDriver = (map) => ({
|
|
|
883
892
|
map.on('mousemove', pointing);
|
|
884
893
|
map.on('idle', settled);
|
|
885
894
|
map.on('move', stood);
|
|
886
|
-
const
|
|
887
|
-
map.on('styleimagemissing', missing);
|
|
895
|
+
const stopImages = answerImages(map);
|
|
888
896
|
const moved = () => {
|
|
889
897
|
if (traced.size > 0) {
|
|
890
898
|
void trace();
|
|
@@ -902,7 +910,7 @@ export const mapLibreDriver = (map) => ({
|
|
|
902
910
|
map.off('mousemove', pointing);
|
|
903
911
|
map.off('idle', settled);
|
|
904
912
|
map.off('move', stood);
|
|
905
|
-
|
|
913
|
+
stopImages();
|
|
906
914
|
map.off('moveend', moved);
|
|
907
915
|
for (const id of drawnPoints.keys()) {
|
|
908
916
|
takeOff(id);
|
|
@@ -995,7 +1003,7 @@ export const mapLibreDriver = (map) => ({
|
|
|
995
1003
|
style: { ...base, layers, sources },
|
|
996
1004
|
zoom: Math.max(0, zoom - 1.5),
|
|
997
1005
|
});
|
|
998
|
-
|
|
1006
|
+
answerImages(picture);
|
|
999
1007
|
await new Promise((done) => {
|
|
1000
1008
|
const late = setTimeout(done, 6000);
|
|
1001
1009
|
picture.once('idle', () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VectorTile } from '@mapbox/vector-tile';
|
|
2
|
-
import
|
|
2
|
+
import { PbfReader } from 'pbf';
|
|
3
3
|
import { cameraOf } from './camera.js';
|
|
4
4
|
export const SNAPSHOT_LAYERS = [
|
|
5
5
|
{
|
|
@@ -246,7 +246,7 @@ export const mapSnapshot = async (view, options = {}) => {
|
|
|
246
246
|
if (!bytes) {
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
|
-
const tile = new VectorTile(new
|
|
249
|
+
const tile = new VectorTile(new PbfReader(new Uint8Array(bytes)));
|
|
250
250
|
for (const layer of shown) {
|
|
251
251
|
const source = tile.layers[layer.source];
|
|
252
252
|
if (!source) {
|
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.108.
|
|
4
|
+
"version": "0.108.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
7
|
"repository": {
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
},
|
|
44
44
|
"bugs": "https://github.com/project-fusion/fusion/issues",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@fusion.dev/helix-core": "0.108.
|
|
47
|
-
"@fusion.dev/helix-icons": "0.108.
|
|
48
|
-
"@mapbox/vector-tile": "^
|
|
49
|
-
"pbf": "^
|
|
46
|
+
"@fusion.dev/helix-core": "0.108.1",
|
|
47
|
+
"@fusion.dev/helix-icons": "0.108.1",
|
|
48
|
+
"@mapbox/vector-tile": "^3.0.0",
|
|
49
|
+
"pbf": "^5.1.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@fusion.dev/helix-headless": "0.108.
|
|
53
|
-
"@fusion.dev/helix-testing": "0.108.
|
|
54
|
-
"@maplibre/maplibre-gl-style-spec": "^
|
|
52
|
+
"@fusion.dev/helix-headless": "0.108.1",
|
|
53
|
+
"@fusion.dev/helix-testing": "0.108.1",
|
|
54
|
+
"@maplibre/maplibre-gl-style-spec": "^26.4.4",
|
|
55
55
|
"@types/bun": "^1.3.0",
|
|
56
56
|
"@types/leaflet": "^1.9.20",
|
|
57
57
|
"leaflet": "^1.9.4",
|
|
58
|
-
"maplibre-gl": "^
|
|
58
|
+
"maplibre-gl": "^6.11.2"
|
|
59
59
|
},
|
|
60
60
|
"homepage": "https://fusion.dev",
|
|
61
61
|
"keywords": [
|