Skip to content

Commit

Permalink
add zoomin for the click site event
Browse files Browse the repository at this point in the history
  • Loading branch information
CloudLun committed Mar 23, 2024
1 parent 3cddd58 commit 2940cfb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions hooks/useOnClickSites.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,20 @@ const useOnClickSites = () => {
useEffect(() => {

map?.on("click", 'sites', (e: MapMouseEvent & EventData) => {

setId(e.features[0].properties.ID)
if (!openStreetView) {
setOpenStreetView(prevOpenStreetView => {
if (!prevOpenStreetView) {
setTimeout(() => {
map?.flyTo({
center: [e.lngLat.lng, e.lngLat.lat-0.08],
center: [e.lngLat.lng, e.lngLat.lat-0.05],
duration: 1500,
zoom:12
});
// map?.zoomIn({
// duration:1500
// })
}, 1500);
}
return true;
Expand Down

0 comments on commit 2940cfb

Please sign in to comment.