zoomIn, zoomOut and centerHere, fixed the variable assignment to ensure the code functions correctly.
This commit is contained in:
@@ -206,7 +206,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
||||
const Sonstige = new L.layerGroup();
|
||||
const TALASICL = new L.layerGroup();
|
||||
|
||||
let initialMap = [];
|
||||
let newMap = [];
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
@@ -223,7 +223,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
||||
// Initialisierung der karte und hinzuügen der Layers
|
||||
useEffect(() => {
|
||||
if (mapRef.current && !map) {
|
||||
const newMap = L.map(mapRef.current, {
|
||||
newMap = L.map(mapRef.current, {
|
||||
center: [53.111111, 8.4625],
|
||||
zoom: 8,
|
||||
layers: [
|
||||
@@ -370,14 +370,14 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
||||
};
|
||||
|
||||
const zoomIn = (e) => {
|
||||
initialMap.flyTo(e.latlng, 12);
|
||||
newMap.flyTo(e.latlng, 12);
|
||||
};
|
||||
|
||||
const zoomOut = (e) => {
|
||||
fly();
|
||||
};
|
||||
const centerHere = (e) => {
|
||||
initialMap.panTo(e.latlng);
|
||||
newMap.panTo(e.latlng);
|
||||
};
|
||||
|
||||
const showCoordinates = (e) => {
|
||||
@@ -513,7 +513,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
||||
var y = 7.739617925303934;
|
||||
var zoom = 7;
|
||||
|
||||
initialMap.flyTo([x, y], zoom);
|
||||
newMap.flyTo([x, y], zoom);
|
||||
}
|
||||
|
||||
function getIconPath(status, iconNumber, marker) {
|
||||
|
||||
Reference in New Issue
Block a user