mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-05-26 06:15:07 +02:00
Addressed further pr comments about the api, onSave async, and adding a comment about rehypeRaw
This commit is contained in:
parent
cc789c1863
commit
ff764e2b2d
|
|
@ -46,6 +46,29 @@ export default function MapComponent() {
|
|||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
|
||||
const lat = Number(params.get('lat'))
|
||||
const lng = Number(params.get('lng'))
|
||||
const zoom = Number(params.get('zoom') ?? 12)
|
||||
|
||||
if (
|
||||
Number.isFinite(lat) &&
|
||||
Number.isFinite(lng) &&
|
||||
lat >= -90 &&
|
||||
lat <= 90 &&
|
||||
lng >= -180 &&
|
||||
lng <= 180
|
||||
) {
|
||||
mapRef.current?.flyTo({
|
||||
center: [lng, lat],
|
||||
zoom: Number.isFinite(zoom) ? zoom : 12,
|
||||
duration: 1500,
|
||||
})
|
||||
}
|
||||
}, [])
|
||||
|
||||
const handleMapClick = useCallback((e: MapLayerMouseEvent) => {
|
||||
setPlacingMarker({ lng: e.lngLat.lng, lat: e.lngLat.lat })
|
||||
setMarkerName('')
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user