Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions components/src/maplibre/Map/Map.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@
mapContext.map.on('load', () => {
zoom = mapContext.map?.getZoom();
center = mapContext.map?.getCenter();
pitch = mapContext.map?.getPitch();
bearing = mapContext.map?.getBearing();
pitch = mapContext.map?.getPitch() || 0;
bearing = mapContext.map?.getBearing() || 0;
});

mapContext.map.on('moveend', () => {
zoom = mapContext.map?.getZoom();
center = mapContext.map?.getCenter();
pitch = mapContext.map?.getPitch();
bearing = mapContext.map?.getBearing();
pitch = mapContext.map?.getPitch() || 0;
bearing = mapContext.map?.getBearing() || 0;
});

if (onmoveend) {
Expand Down Expand Up @@ -178,7 +178,7 @@
}
});

const debugValues = $derived(Object.entries({ zoom, pitch, allowZoom, allowPan, allowRotation }));
const debugValues = $derived(Object.entries({ zoom, pitch, bearing, allowZoom, allowPan, allowRotation }));
const handleDebugValueClick = (e: MouseEvent) => {
if (e.target) {
const t = e.target as HTMLElement;
Expand All @@ -188,7 +188,7 @@
};
const handleDebugCopyLocationClick = (e: MouseEvent) => {
if (e.target) {
const s = JSON.stringify({ lng: center?.lng, lat: center?.lat, zoom, pitch });
const s = JSON.stringify({ lng: center?.lng, lat: center?.lat, zoom, pitch, bearing });
navigator.clipboard.writeText(s);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<Map showDebug style={SWRDataLabDark()} initialLocation={locations.germany}>
<GeocoderControl languages="de" service="maptiler" key="V32kPHZjMa0Mkn6YvSzA" />
<AttributionControl position="bottom-left" />
<NavigationControl />
<NavigationControl showCompass />
</Map>
</div>
</div>
Expand Down
Loading