diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 80a0429..8585f4a 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -630,6 +630,22 @@ const APP = () => { return 'https://demotiles.maplibre.org/style.json'; }; + const handleLocateMe = () => { + if (!navigator.geolocation) return; + navigator.geolocation.getCurrentPosition( + (pos) => { + const { latitude: lat, longitude: lon } = pos.coords; + selectedPointRef.current = { lat, lon }; + setSelectedPoint({ lat, lon }); + if (startMarkerRef.current) { + startMarkerRef.current.setLngLat([lon, lat]); + } + mapRef.current?.flyTo({ center: [lon, lat], zoom: 5 }); + }, + (err) => console.error('Geolocation error:', err) + ); + }; + const handleShowLineOfSight = async () => { setLoading(true); setSelectedCity(null); @@ -661,7 +677,23 @@ const APP = () => { return (