feat: Set default polyline visibility to true if not defined in localStorage
- Added logic to check if 'polylineVisible' exists in localStorage on page load. - If not present, set the default value to 'true' to ensure polylines are displayed by default. - Updated `setupPolylines` function to handle polyline visibility based on localStorage value.
This commit is contained in:
38
.env.local
38
.env.local
@@ -1,32 +1,32 @@
|
|||||||
#.env.local
|
#.env.local
|
||||||
#je nach dem Mysql Server, ob localhost freigegeben ist oder die IP Adresse des Servers, manchmal die beide und manchmal nur eine
|
#je nach dem Mysql Server, ob localhost freigegeben ist oder die IP Adresse des Servers, manchmal die beide und manchmal nur eine
|
||||||
|
|
||||||
DB_HOST=10.10.0.30
|
#DB_HOST=10.10.0.13
|
||||||
DB_USER=root
|
|
||||||
DB_PASSWORD="root#$"
|
|
||||||
DB_NAME=talas_v5
|
|
||||||
DB_PORT=3306
|
|
||||||
#########################
|
|
||||||
|
|
||||||
NEXT_PUBLIC_BASE_URL="http://10.10.0.30/talas5/devices/"
|
|
||||||
NEXT_PUBLIC_SERVER_URL="http://10.10.0.30"
|
|
||||||
NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.30"
|
|
||||||
NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.30:3000/mapTiles/{z}/{x}/{y}.png"
|
|
||||||
#########################
|
|
||||||
|
|
||||||
|
|
||||||
#DB_HOST=10.10.0.70
|
|
||||||
#DB_USER=root
|
#DB_USER=root
|
||||||
#DB_PASSWORD="root#$"
|
#DB_PASSWORD="root#$"
|
||||||
#DB_NAME=talas_v5
|
#DB_NAME=talas_v5
|
||||||
#DB_PORT=3306
|
#DB_PORT=3306
|
||||||
|
#########################
|
||||||
|
|
||||||
|
#NEXT_PUBLIC_BASE_URL="http://10.10.0.13/talas5/devices/"
|
||||||
|
#NEXT_PUBLIC_SERVER_URL="http://10.10.0.13"
|
||||||
|
#NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.13"
|
||||||
|
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
|
||||||
|
#########################
|
||||||
|
|
||||||
|
|
||||||
|
DB_HOST=10.10.0.70
|
||||||
|
DB_USER=root
|
||||||
|
DB_PASSWORD="root#$"
|
||||||
|
DB_NAME=talas_v5
|
||||||
|
DB_PORT=3306
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
|
|
||||||
#NEXT_PUBLIC_BASE_URL="http://10.10.0.30/talas5/devices/"
|
NEXT_PUBLIC_BASE_URL="http://10.10.0.30/talas5/devices/"
|
||||||
#NEXT_PUBLIC_SERVER_URL="http://10.10.0.70"
|
NEXT_PUBLIC_SERVER_URL="http://10.10.0.70"
|
||||||
#NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.70"
|
NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.70"
|
||||||
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
|
NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
|
||||||
#########################
|
#########################
|
||||||
|
|
||||||
#DB_HOST=192.168.10.168
|
#DB_HOST=192.168.10.168
|
||||||
|
|||||||
@@ -47,7 +47,13 @@ export function enablePolylineEvents(polylines, lineColors) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const setupPolylines = (map, linePositions, lineColors, tooltipContents, setNewCoords, tempMarker, currentZoom, currentCenter, polylineVisible) => {
|
export const setupPolylines = (map, linePositions, lineColors, tooltipContents, setNewCoords, tempMarker, currentZoom, currentCenter, polylineVisible) => {
|
||||||
polylineVisible = localStorage.getItem("polylineVisible") === "true";
|
if (localStorage.getItem("polylineVisible") === null) {
|
||||||
|
localStorage.setItem("polylineVisible", "true"); // Standardwert setzen
|
||||||
|
polylineVisible = true; // Wert in der Funktion initialisieren
|
||||||
|
} else {
|
||||||
|
polylineVisible = localStorage.getItem("polylineVisible") === "true";
|
||||||
|
}
|
||||||
|
|
||||||
if (!polylineVisible) {
|
if (!polylineVisible) {
|
||||||
// Entferne alle Polylinien, wenn sie ausgeblendet werden sollen
|
// Entferne alle Polylinien, wenn sie ausgeblendet werden sollen
|
||||||
if (window.polylines) {
|
if (window.polylines) {
|
||||||
|
|||||||
Reference in New Issue
Block a user