fix: Bereich ausgewählt dann könnte nicht mit der Maus die Kartenansicht verschieben
This commit is contained in:
@@ -704,14 +704,14 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
callback: showCoordinates,
|
callback: showCoordinates,
|
||||||
},
|
},
|
||||||
"-", // Divider
|
"-", // Divider
|
||||||
/* { text: "Reinzoomen", icon: "img/zoom_in.png", callback: zoomIn },
|
{ text: "Reinzoomen", icon: "img/zoom_in.png", callback: zoomIn },
|
||||||
{ text: "Rauszoomen", icon: "img/zoom_out.png", callback: zoomOut },
|
{ text: "Rauszoomen", icon: "img/zoom_out.png", callback: zoomOut },
|
||||||
{
|
{
|
||||||
text: "Hier zentrieren",
|
text: "Hier zentrieren",
|
||||||
icon: "img/center_focus.png",
|
icon: "img/center_focus.png",
|
||||||
callback: (e) => centerHere(e, map),
|
callback: (e) => centerHere(e, map),
|
||||||
},
|
},
|
||||||
"-", */ // Divider
|
"-", // Divider
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -746,7 +746,19 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
//console.log("trigger in MapComponent.js:", poiReadTrigger);
|
//console.log("trigger in MapComponent.js:", poiReadTrigger);
|
||||||
}, [mapRef, map, poiReadTrigger, contextMenuItems]); // Prüfe die Abhängigkeiten sorgfältig
|
}, [mapRef, map, poiReadTrigger, contextMenuItems]); // Prüfe die Abhängigkeiten sorgfältig
|
||||||
|
|
||||||
useEffect(() => {
|
/* const zoomIn = (e) => {
|
||||||
|
initMap.flyTo(e.latlng, 12);
|
||||||
|
//console.log("ZoomIn koordinaten in MapComponent", e.latlng);
|
||||||
|
};
|
||||||
|
|
||||||
|
const zoomOut = (e) => {
|
||||||
|
fly();
|
||||||
|
};
|
||||||
|
const centerHere = (e) => {
|
||||||
|
initMap.panTo(e.latlng);
|
||||||
|
}; */
|
||||||
|
|
||||||
|
/* useEffect(() => {
|
||||||
if (map) {
|
if (map) {
|
||||||
map.on("contextmenu", (e) => {
|
map.on("contextmenu", (e) => {
|
||||||
const contextMenuItems = [
|
const contextMenuItems = [
|
||||||
@@ -783,7 +795,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
.openOn(map);
|
.openOn(map);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [map]);
|
}, [map]); */
|
||||||
|
|
||||||
// poiTyp Daten hinzufügen
|
// poiTyp Daten hinzufügen
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
@@ -1707,14 +1719,14 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
//------------------------------------------ */
|
//------------------------------------------ */
|
||||||
|
|
||||||
// Effect to handle navigation to selected area
|
// Effect to handle navigation to selected area
|
||||||
useEffect(() => {
|
/* useEffect(() => {
|
||||||
if (selectedArea && map) {
|
if (selectedArea && map) {
|
||||||
const marker = findMyMarker(selectedArea);
|
const marker = findMyMarker(selectedArea);
|
||||||
if (marker) {
|
if (marker) {
|
||||||
map.flyTo(marker.getLatLng(), 14); // Adjust zoom level as needed
|
map.flyTo(marker.getLatLng(), 14); // Adjust zoom level as needed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [selectedArea, map, allMarkers]); // Include allMarkers in the dependencies
|
}, [selectedArea, map, allMarkers]); // Include allMarkers in the dependencies */
|
||||||
|
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
|
||||||
@@ -2146,6 +2158,36 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
}
|
}
|
||||||
}, [map]);
|
}, [map]);
|
||||||
|
|
||||||
|
//------------------------------------------ */hier ist das Bug
|
||||||
|
|
||||||
|
// Effect to handle navigation to selected area
|
||||||
|
/* useEffect(() => {
|
||||||
|
if (selectedArea && map) {
|
||||||
|
const marker = findMyMarker(selectedArea);
|
||||||
|
if (marker) {
|
||||||
|
map.flyTo(marker.getLatLng(), 14); // Adjust zoom level as needed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [selectedArea, map, allMarkers]); // Include allMarkers in the dependencies */
|
||||||
|
|
||||||
|
//------------------------------------------
|
||||||
|
//--------------------------------------------------------- Kein Bug
|
||||||
|
useEffect(() => {
|
||||||
|
if (selectedArea && map) {
|
||||||
|
const station = GisStationsStaticDistrict.find(
|
||||||
|
(s) => s.Area_Name === selectedArea
|
||||||
|
);
|
||||||
|
if (station) {
|
||||||
|
map.flyTo([station.X, station.Y], 14);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [selectedArea, map, GisStationsStaticDistrict]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (zoomTrigger && map) {
|
||||||
|
map.flyTo([51.41321407879154, 7.739617925303934], 7);
|
||||||
|
}
|
||||||
|
}, [zoomTrigger, map]);
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
// utils/zoomAndCenterUtils.js
|
|
||||||
export const zoomIn = (e, map) => {
|
export const zoomIn = (e, map) => {
|
||||||
if (!map) {
|
if (!map) {
|
||||||
console.error("map is not defined in zoomIn");
|
console.error("map is not defined in zoomIn");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
map.flyTo(e.latlng, 12);
|
map.flyTo(e.latlng, map.getZoom() + 1);
|
||||||
localStorage.setItem("mapZoom", map.getZoom());
|
localStorage.setItem("mapZoom", map.getZoom());
|
||||||
localStorage.setItem("mapCenter", JSON.stringify(map.getCenter()));
|
localStorage.setItem("mapCenter", JSON.stringify(map.getCenter()));
|
||||||
};
|
};
|
||||||
@@ -28,4 +27,6 @@ export const centerHere = (e, map) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
map.panTo(e.latlng);
|
map.panTo(e.latlng);
|
||||||
|
localStorage.setItem("mapZoom", map.getZoom());
|
||||||
|
localStorage.setItem("mapCenter", JSON.stringify(map.getCenter()));
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user