mysql createPool
This commit is contained in:
@@ -131,40 +131,7 @@ export const setupMarkers = async (
|
||||
export const setupPolylines = (map, linePositions, lineColors, tooltipContents, setNewCoords, tempMarker, currentZoom, currentCenter) => {
|
||||
const markers = [];
|
||||
const polylines = [];
|
||||
let isMouseOverMenuItem = false;
|
||||
|
||||
const checkMouseOverMenu = () => {
|
||||
if (!isMouseOverMenuItem) {
|
||||
//showContextMenuItemByIndex(map, 0);
|
||||
//showContextMenuItemByIndex(map, 1);
|
||||
//closeContextMenu(); // Kontextmenü schließen, wenn die Maus nicht mehr darüber ist
|
||||
}
|
||||
};
|
||||
|
||||
const handleMouseOverMenuItem = () => {
|
||||
isMouseOverMenuItem = true;
|
||||
};
|
||||
|
||||
const handleMouseOutMenuItem = () => {
|
||||
isMouseOverMenuItem = false;
|
||||
setTimeout(checkMouseOverMenu, 500); // kleine Verzögerung, um sicherzustellen, dass es keine schnellen Bewegungen sind
|
||||
};
|
||||
|
||||
const closeContextMenu = () => {
|
||||
const contextMenuElement = document.querySelector(".leaflet-contextmenu");
|
||||
if (contextMenuElement) {
|
||||
contextMenuElement.style.display = "none"; // Kontextmenü ausblenden
|
||||
}
|
||||
};
|
||||
|
||||
const handleOutsideClick = (event) => {
|
||||
const contextMenuElement = document.querySelector(".leaflet-contextmenu");
|
||||
if (contextMenuElement && !contextMenuElement.contains(event.target)) {
|
||||
//closeContextMenu(); // Kontextmenü schließen, wenn der Klick außerhalb stattfindet
|
||||
}
|
||||
};
|
||||
|
||||
//document.addEventListener("mousedown", handleOutsideClick);
|
||||
linePositions.forEach((lineData, lineIndex) => {
|
||||
const lineMarkers = [];
|
||||
lineData.coordinates.forEach((coord, index) => {
|
||||
@@ -269,8 +236,6 @@ export const setupPolylines = (map, linePositions, lineColors, tooltipContents,
|
||||
const polyline = L.polyline(lineData.coordinates, {
|
||||
color: lineColors[`${lineData.idLD}-${lineData.idModul}`] || "#000000",
|
||||
contextmenu: true,
|
||||
idLD: lineData.idLD, // Füge die idLD zur Polyline hinzu
|
||||
idModul: lineData.idModul, // Füge die idModul zur Polyline hinzu
|
||||
contextmenuItems: [
|
||||
{
|
||||
text: "Stützpunkt hinzufügen",
|
||||
@@ -290,21 +255,12 @@ export const setupPolylines = (map, linePositions, lineColors, tooltipContents,
|
||||
}).addTo(map);
|
||||
|
||||
polyline.on("mouseover", (e) => {
|
||||
polyline.setStyle({ weight: 15 });
|
||||
});
|
||||
|
||||
polyline.on("mousedown", (e) => {
|
||||
polyline.setStyle({ weight: 15 });
|
||||
});
|
||||
|
||||
polyline.on("mouseup", (e) => {
|
||||
polyline.setStyle({ weight: 15 });
|
||||
polyline.setStyle({ weight: 10 });
|
||||
});
|
||||
|
||||
polyline.on("mouseout", (e) => {
|
||||
polyline.setStyle({ weight: 3 });
|
||||
polyline.setStyle({ color: lineColors[`${lineData.idLD}-${lineData.idModul}`] || "#000000" });
|
||||
//setTimeout(checkMouseOverMenu, 500);
|
||||
});
|
||||
|
||||
polyline.bindTooltip(tooltipContents[`${lineData.idLD}-${lineData.idModul}`] || "Standard-Tooltip-Inhalt", {
|
||||
@@ -316,7 +272,5 @@ export const setupPolylines = (map, linePositions, lineColors, tooltipContents,
|
||||
markers.push(...lineMarkers);
|
||||
});
|
||||
|
||||
// Add listeners to the context menu items
|
||||
const contextMenuElement = document.querySelector(".leaflet-contextmenu"); // Assuming the context menu class is 'leaflet-contextmenu'
|
||||
return { markers, polylines };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user