Add new Station go to newMap instead initialMap

This commit is contained in:
2024-04-21 14:42:26 +02:00
parent 50863d3015
commit bba29e04ea

View File

@@ -403,7 +403,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
//-----Kontextmenu----ende------------
// Ensure this function is only called when map is initialized and available
const showAddStationPopup = (e) => {
if (!initialMap) {
if (!newMap) {
return;
}
@@ -465,7 +465,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
</form>
`;
L.popup().setLatLng(e.latlng).setContent(popupContent).openOn(initialMap);
L.popup().setLatLng(e.latlng).setContent(popupContent).openOn(newMap);
// Attach event listener here
L.DomEvent.on(popupContent, "submit", handleSubmit);