showCoordinates Funktion für Kontextmenü "Koordinaten" und von 15 Stellen nach Komma nur 5 anzeigen,

This commit is contained in:
ISA
2024-05-06 08:58:41 +02:00
parent dca6e3db8d
commit af89d6827a

View File

@@ -294,7 +294,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
{
text: "Koordinaten",
icon: "img/screen_same.png",
callback: lata,
callback: showCoordinates,
},
"-", // Divider
{ text: "Reinzoomen", callback: zoomIn },
@@ -399,10 +399,6 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
.focus();
};
const lata = (e) => {
alert("Breitengrad: " + e.latlng.lat);
};
const zoomIn = (e) => {
initMap.flyTo(e.latlng, 12);
//console.log("ZoomIn koordinaten in MapComponent", e.latlng);
@@ -416,7 +412,12 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
};
const showCoordinates = (e) => {
alert("Breitengrad: " + e.latlng.lat + "\nLängengrad: " + e.latlng.lng);
alert(
"Breitengrad: " +
e.latlng.lat.toFixed(5) +
"\nLängengrad: " +
e.latlng.lng.toFixed(5)
);
};
const showData = (e) => {};
const showTalas = (e) => {