Created
July 28, 2021 18:57
-
-
Save feliperodriguess/e2000dc05114743d4e77f65f11bd0feb to your computer and use it in GitHub Desktop.
Toggle StreetView helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const toggleStreetView = useCallback(() => { | |
const panorama = mapRef.current.getStreetView() | |
panorama.setPosition({ | |
lat: -16.7033165, | |
lng: -49.2747676, | |
}) | |
panorama.setPov({ | |
heading: 265, | |
pitch: 0, | |
}) | |
if (!isStreetViewVisible) { | |
panorama.setVisible(true) | |
setStreetViewVisible(true) | |
return | |
} | |
panorama.setVisible(false) | |
setStreetViewVisible(false) | |
}, [isStreetViewVisible]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment