MCPcopy Create free account
hub / github.com/Thanas-R/Virdis / saveMapPosition

Function saveMapPosition

src/components/MapView.tsx:21–24  ·  view source on GitHub ↗
(map: mapboxgl.Map)

Source from the content-addressed store, hash-verified

19
20const MAP_POS_KEY = "map-last-position";
21const DEFAULT_INDIA_VIEW = { lng: 78.9629, lat: 20.5937, zoom: 5, bearing: 0, pitch: 0 };
22
23function saveMapPosition(map: mapboxgl.Map) {
24 const center = map.getCenter();
25 localStorage.setItem(MAP_POS_KEY, JSON.stringify({ lng: center.lng, lat: center.lat, zoom: map.getZoom(), bearing: map.getBearing(), pitch: map.getPitch() }));
26}
27

Callers 1

MapViewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected