From d6a95f888580009ca06b57aa5574e22a0469036b Mon Sep 17 00:00:00 2001 From: Ismail Ali Date: Sat, 8 Mar 2025 13:26:24 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20Animiertes=20Zoomen=20mit=20dynamischer?= =?UTF-8?q?=20Dauer=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Leaflet `flyTo` für sanfte Zoom-Animationen implementiert. - Zoom-Stufen auf max. 15 und min. 6 begrenzt. - Dauer der Animation dynamisch auf 0.5s pro Zoomstufe gesetzt. - Verbesserte Benutzererfahrung durch flüssige Zoom-Bewegungen. --- .env.local | 2 +- components/useMapContextMenu.js | 20 ++++++++++++++++++-- config/appVersion.js | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.env.local b/.env.local index 8d9543dec..0eeebf47c 100644 --- a/.env.local +++ b/.env.local @@ -9,7 +9,7 @@ DB_PORT=3306 # Public Settings (Client braucht IP/Domain) NEXT_PUBLIC_SERVER_URL="http://192.168.10.33" # oder evtl. später https://nodemap.firma.de NEXT_PUBLIC_ENABLE_GEOCODER=true -NEXT_PUBLIC_USE_MOCK_API=true +NEXT_PUBLIC_USE_MOCK_API=false NEXT_PUBLIC_DEBUG_LOG=true # für Polylines/kabelstecken -> in Konextmenü "Station öffnen" " diff --git a/components/useMapContextMenu.js b/components/useMapContextMenu.js index f39996a5a..b7ae131cf 100644 --- a/components/useMapContextMenu.js +++ b/components/useMapContextMenu.js @@ -17,7 +17,15 @@ const addItemsToMapContextMenu = (map, menuItemAdded, setMenuItemAdded, openPopu text: "Reinzoomen", icon: "img/zoom_in.png", callback: (e) => { - map.setZoom(map.getZoom() + 1); + const currentZoom = map.getZoom(); + const newZoom = Math.min(15, currentZoom + 3); // Stellt sicher, dass max. 15 erreicht wird + const zoomDifference = Math.abs(newZoom - currentZoom); // Anzahl der Zoom-Stufen + const duration = zoomDifference * 0.5; // Pro Stufe 0.5 Sekunden + + map.flyTo(map.getCenter(), newZoom, { + animate: true, + duration: duration, + }); }, }); @@ -25,7 +33,15 @@ const addItemsToMapContextMenu = (map, menuItemAdded, setMenuItemAdded, openPopu text: "Rauszoomen", icon: "img/zoom_out.png", callback: () => { - map.setZoom(map.getZoom() - 1); + const currentZoom = map.getZoom(); + const newZoom = Math.max(6, currentZoom - 3); // Stellt sicher, dass min. 6 erreicht wird + const zoomDifference = Math.abs(newZoom - currentZoom); // Anzahl der Zoom-Stufen + const duration = zoomDifference * 0.5; // Pro Stufe 0.5 Sekunden + + map.flyTo(map.getCenter(), newZoom, { + animate: true, + duration: duration, + }); }, }); diff --git a/config/appVersion.js b/config/appVersion.js index e9ca62e94..b621cc1a1 100644 --- a/config/appVersion.js +++ b/config/appVersion.js @@ -1,2 +1,2 @@ // /config/appVersion -export const APP_VERSION = "1.1.29"; +export const APP_VERSION = "1.1.30";