- Moved zoomIn and zoomOut functions from MapComponent.js to a new file zoomUtils.js in the utils directory. - Updated MapComponent.js to import and use the zoomIn and zoomOut functions from the new file. - This change improves code modularity and readability.
16 lines
473 B
JavaScript
16 lines
473 B
JavaScript
// utils/zoomUtils.js
|
|
export const zoomIn = (e, map) => {
|
|
map.flyTo(e.latlng, 12);
|
|
localStorage.setItem("mapZoom", map.getZoom());
|
|
localStorage.setItem("mapCenter", JSON.stringify(map.getCenter()));
|
|
};
|
|
|
|
export const zoomOut = (map) => {
|
|
const x = 51.41321407879154;
|
|
const y = 7.739617925303934;
|
|
const zoom = 7;
|
|
map.flyTo([x, y], zoom);
|
|
localStorage.setItem("mapZoom", map.getZoom());
|
|
localStorage.setItem("mapCenter", JSON.stringify(map.getCenter()));
|
|
};
|