Skip to main content

Street View Panorama

GmvStreetViewPanorama wraps google.maps.StreetViewPanorama. It creates a standalone panorama element and imports the Google streetView library internally.

The component is exported as StreetViewPanorama from @gmap-vue/v3/components and registered by the plugin as GmvStreetViewPanorama.

Props

StreetViewPanorama props interface
export interface StreetViewPanoramaProps {
addressControl?: boolean;
addressControlOptions?: google.maps.StreetViewAddressControlOptions;
clickToGo?: boolean;
controlSize?: number;
disableDefaultUI?: boolean;
disableDoubleClickZoom?: boolean;
enableCloseButton?: boolean;
fullscreenControl?: boolean;
fullscreenControlOptions?: google.maps.FullscreenControlOptions;
imageDateControl?: boolean;
linksControl?: boolean;
motionTracking?: boolean;
motionTrackingControl?: boolean;
motionTrackingControlOptions?: google.maps.MotionTrackingControlOptions;
panControl?: boolean;
panControlOptions?: google.maps.PanControlOptions;
pano?: string;
position?: google.maps.LatLng | google.maps.LatLngLiteral;
pov?: google.maps.StreetViewPov;
scrollwheel?: boolean;
showRoadLabels?: boolean;
visible?: boolean;
zoom?: number;
zoomControl?: boolean;
zoomControlOptions?: google.maps.ZoomControlOptions;
streetViewKey?: string;
options?: Record<string, unknown>;
}
PropTypeDefaultDescription
addressControlbooleanundefinedShows or hides the address control.
addressControlOptionsgoogle.maps.StreetViewAddressControlOptionsundefinedAddress control options.
clickToGobooleantrueEnables click-to-go navigation.
controlSizenumberundefinedControl size in pixels.
disableDefaultUIbooleanundefinedDisables the default Street View UI.
disableDoubleClickZoombooleantrueDisables zoom on double click.
enableCloseButtonbooleanfalseShows the close button.
fullscreenControlbooleanundefinedShows or hides the fullscreen control.
fullscreenControlOptionsgoogle.maps.FullscreenControlOptionsundefinedFullscreen control options.
imageDateControlbooleanundefinedShows or hides the image date control.
linksControlbooleanundefinedShows or hides navigation links.
motionTrackingbooleanundefinedEnables motion tracking where supported.
motionTrackingControlbooleanundefinedShows or hides the motion tracking control.
motionTrackingControlOptionsgoogle.maps.MotionTrackingControlOptionsundefinedMotion tracking control options.
panControlbooleanundefinedShows or hides the pan control.
panControlOptionsgoogle.maps.PanControlOptionsundefinedPan control options.
panostringundefinedStreet View panorama ID.
positiongoogle.maps.LatLng | google.maps.LatLngLiteralundefinedStreet View position.
povgoogle.maps.StreetViewPovundefinedCamera heading and pitch.
scrollwheelbooleantrueEnables scrollwheel zoom.
showRoadLabelsbooleantrueShows road labels in the panorama.
visiblebooleantrueShows or hides the panorama.
zoomnumberundefinedStreet View zoom level.
zoomControlbooleanundefinedShows or hides the zoom control.
zoomControlOptionsgoogle.maps.ZoomControlOptionsundefinedZoom control options.
streetViewKeystringundefinedPromise key used by useStreetViewPanoramaPromise(key).
optionsRecord<string, unknown>undefinedFallback for Google StreetViewPanorama options not represented by explicit props. Spread after explicit props, so it can override them.

Events

EventPayloadDescription
closeclickGoogle event payloadFired when the close button is clicked.
pano_changedcurrent pano valueFired when the panorama ID changes.
position_changedgoogle.maps.LatLng | nullFired when the panorama position changes.
pov_changedcurrent POV valueFired when the point of view changes.
resizeGoogle event payloadFired when the Google panorama resize event is triggered.
visible_changedcurrent visible valueFired when visibility changes.

These events are not v-model updates. Use them to update your own state only when needed.

Exposed properties and methods

Exposed memberTypeDescription
streetViewPanoramaPromisePromise<google.maps.StreetViewPanorama | undefined>Resolves to the underlying Google StreetViewPanorama instance.
resize()() => Promise<void>Triggers the Google resize event on the panorama instance.
resizePreserveCenter()() => Promise<void>Triggers resize and restores the previous Street View position when available.
currentResizeBus() => voidResize bus callback.
_resizeCallback() => voidInternal resize callback exposed by the component.
_delayedResizeCallback() => Promise<void>Delayed resize callback exposed by the component.
gmvStreetViewPanoramaReadonly<ShallowRef<HTMLDivElement | null>>Template ref for the panorama container element.
<script setup lang="ts">
import { StreetViewPanorama } from "@gmap-vue/v3/components";
import { ref } from "vue";

const panoramaRef = ref<InstanceType<typeof StreetViewPanorama> | null>(null);

async function resizePanorama() {
await panoramaRef.value?.resizePreserveCenter();
}
</script>

<template>
<GmvStreetViewPanorama
ref="panoramaRef"
style="position: relative; width: 100%; height: 500px"
:position="{ lat: 40.758, lng: -73.9855 }"
/>

<button @click="resizePanorama">Resize</button>
</template>

Composable access

Use useStreetViewPanoramaPromise(key?) when direct component refs are inconvenient.

import { useStreetViewPanoramaPromise } from "@gmap-vue/v3/composables";

const streetViewPanoramaPromise = useStreetViewPanoramaPromise("main-street-view");

For a single panorama, the key is optional and defaults to the shared $streetViewPanoramaPromise key. Use a unique streetViewKey for every simultaneously mounted panorama so instances do not share the same global promise key.

Layout requirements

The component renders an absolutely positioned panorama element inside its own root element. Give GmvStreetViewPanorama itself an explicit height and positioning context, for example with a class or inline style on the component.