Skip to content

Instantly share code, notes, and snippets.

@feliperodriguess
Created July 28, 2021 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feliperodriguess/e2000dc05114743d4e77f65f11bd0feb to your computer and use it in GitHub Desktop.
Save feliperodriguess/e2000dc05114743d4e77f65f11bd0feb to your computer and use it in GitHub Desktop.
Toggle StreetView helper
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