@fusion.dev/helix-map 0.109.2 → 0.110.0
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.
|
@@ -137,6 +137,11 @@ export interface MapDriver {
|
|
|
137
137
|
by?: number | undefined;
|
|
138
138
|
to?: number | undefined;
|
|
139
139
|
}, motion: MapMotion | null): void;
|
|
140
|
+
/**
|
|
141
|
+
* How far the view is zoomed, in the renderer's own levels. The frame says
|
|
142
|
+
* it after a zoom, so a reader hears where a step took them.
|
|
143
|
+
*/
|
|
144
|
+
zoom?(): number;
|
|
140
145
|
/** Zooms one step in, `1`, or out, `-1`, by whatever a step is to this renderer. */
|
|
141
146
|
zoomBy(direction: 1 | -1, motion: MapMotion | null): void;
|
|
142
147
|
}
|
|
@@ -128,6 +128,16 @@ export const connectMap = (frame, driver, options = {}) => {
|
|
|
128
128
|
};
|
|
129
129
|
syncBearing();
|
|
130
130
|
const stopBearing = driver.bearing || driver.pitch ? driver.onView?.(syncBearing) : undefined;
|
|
131
|
+
const viewed = frame;
|
|
132
|
+
const syncView = () => {
|
|
133
|
+
const zoom = driver.zoom ? Math.round(driver.zoom() * 10) / 10 : undefined;
|
|
134
|
+
if ('zoomLevel' in viewed && viewed.zoomLevel !== zoom) {
|
|
135
|
+
viewed.zoomLevel = zoom;
|
|
136
|
+
}
|
|
137
|
+
viewed.moved?.();
|
|
138
|
+
};
|
|
139
|
+
syncView();
|
|
140
|
+
const stopView = driver.onView?.(syncView);
|
|
131
141
|
let bare = false;
|
|
132
142
|
const syncType = () => {
|
|
133
143
|
const next = frame.mapType === 'satellite';
|
|
@@ -803,6 +813,7 @@ export const connectMap = (frame, driver, options = {}) => {
|
|
|
803
813
|
frame.removeEventListener(HelixMapRotateEvent.eventName, handleRotate);
|
|
804
814
|
frame.removeEventListener(HelixMapTiltEvent.eventName, handleTilt);
|
|
805
815
|
stopBearing?.();
|
|
816
|
+
stopView?.();
|
|
806
817
|
stopWatchingPreviews?.();
|
|
807
818
|
if (bare) {
|
|
808
819
|
driver.labels?.(true);
|
|
@@ -1065,6 +1065,7 @@ export const mapLibreDriver = (map) => ({
|
|
|
1065
1065
|
const { bearing, pitch } = aimFrom(map);
|
|
1066
1066
|
turn(map, bearing, Math.max(0, to ?? pitch + (by ?? 0)), motion);
|
|
1067
1067
|
},
|
|
1068
|
+
...(map.getZoom ? { zoom: () => map.getZoom?.() ?? 0 } : {}),
|
|
1068
1069
|
zoomBy: (direction, motion) => {
|
|
1069
1070
|
if (direction > 0) {
|
|
1070
1071
|
map.zoomIn(animation(motion));
|
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.
|
|
4
|
+
"version": "0.110.0",
|
|
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.
|
|
47
|
-
"@fusion.dev/helix-icons": "0.
|
|
46
|
+
"@fusion.dev/helix-core": "0.110.0",
|
|
47
|
+
"@fusion.dev/helix-icons": "0.110.0",
|
|
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.
|
|
53
|
-
"@fusion.dev/helix-testing": "0.
|
|
52
|
+
"@fusion.dev/helix-headless": "0.110.0",
|
|
53
|
+
"@fusion.dev/helix-testing": "0.110.0",
|
|
54
54
|
"@maplibre/maplibre-gl-style-spec": "^26.4.4",
|
|
55
55
|
"@types/bun": "^1.3.0",
|
|
56
56
|
"@types/leaflet": "^1.9.20",
|