Skip to content

Commit

Permalink
Fix flyto in mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
AmiyaSX committed Nov 13, 2024
1 parent 2f498bf commit a43d961
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/app/student/map/_components/MapComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ export function MapComponent({
// Fly to location center on change
useEffect(() => {
const { longitude, latitude, zoom } = location.center
mapRef.current?.flyTo({
center: [longitude, latitude],
zoom: zoom
})
const timeout = setTimeout(() => {
mapRef.current?.flyTo({
center: [longitude, latitude],
zoom
})
}, 300)
return () => clearTimeout(timeout)
setMarkerScale(0.6)
}, [location])

Expand Down
4 changes: 2 additions & 2 deletions src/app/student/map/lib/locations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ const libraryCenter = {
export const locations: Location[] = [
{
id: "nymble/2",
label: "Nymble - floor 2",
label: "Nymble-F2",
center: nymbleCenter
},
{
id: "nymble/3",
label: "Nymble - floor 3",
label: "Nymble-F3",
center: nymbleCenter
},
{
Expand Down

0 comments on commit a43d961

Please sign in to comment.