Skip to content

Commit

Permalink
solved the click event duplciated issues
Browse files Browse the repository at this point in the history
  • Loading branch information
CloudLun committed Mar 1, 2024
1 parent 99669a0 commit 6f9998e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions hooks/useOnClickSites.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const useOnClickSites = () => {
useEffect(() => {

map?.on("click", 'sites', (e: MapMouseEvent) => {
console.log('aaa')
if (!openStreetView) {
setOpenStreetView(prevOpenStreetView => {
if (!prevOpenStreetView) {
Expand All @@ -34,10 +33,17 @@ const useOnClickSites = () => {
}



const { direction, marker } = markerCreator(e, map)
setDirectionDegree(0)
setDirection(direction)
setMarker(marker)
setDirection(prevdirection => {
prevdirection?.remove()
return direction
})
setMarker(prevmarker => {
prevmarker?.remove()
return marker
})
});


Expand Down

0 comments on commit 6f9998e

Please sign in to comment.