Skip to main content

Polyline

GmvPolyline wraps google.maps.Polyline. It imports the Google Maps maps library internally, creates the polyline on the resolved map, binds supported props and events, exposes polylineShapePromise, and removes the polyline from the map on unmount.

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

Props

PropTypeDefaultDescription
clickablebooleantrueWhether the polyline handles mouse events.
draggablebooleanfalseWhether users can drag the polyline.
editablebooleanfalseWhether users can edit the polyline path.
geodesicbooleanfalseWhether line segments should follow geodesic segments.
iconsgoogle.maps.IconSequence[]undefinedLine symbols rendered along the polyline.
pathgoogle.maps.MVCArray<google.maps.LatLng> | (google.maps.LatLng | google.maps.LatLngLiteral)[]undefinedPolyline path.
strokeColorstringundefinedStroke color.
strokeOpacitynumberundefinedStroke opacity from 0 to 1.
strokeWeightnumberundefinedStroke width in pixels.
visiblebooleantrueWhether the polyline is visible.
zIndexnumberundefinedStacking order.
deepWatchbooleanfalseEnables deep Vue watching for the path prop.
polylineKeystringundefinedPromise key used by usePolylinePromise(key).
mapKeystringundefinedMap promise key used when the polyline is not a direct descendant of GmvMap.
optionsRecord<string, unknown>undefinedFallback for Google Polyline options not represented by explicit props. Spread after explicit props, so it can override them.

Events

EventNotes
clickGoogle Maps event.
contextmenuGoogle Maps event.
dblclickGoogle Maps event.
dragGoogle Maps event.
dragendGoogle Maps event.
dragstartGoogle Maps event.
mousedownGoogle Maps event.
mousemoveGoogle Maps event.
mouseoutGoogle Maps event.
mouseoverGoogle Maps event.
mouseupGoogle Maps event.
path_changedEmitted from Google Maps MVC path mutations. This is not v-model.

Exposed properties

PropertyTypeDescription
polylineShapePromisePromise<google.maps.Polyline | undefined>Resolves to the underlying Google Polyline instance.

Composable

Use usePolylinePromise(key?) from @gmap-vue/v3/composables. Without a key it uses the default polyline promise; with multiple polylines, pass the same value as polyline-key.

export function usePolylinePromise(
key: string | InjectionKey<Promise<google.maps.Polyline | undefined>> = $polylineShapePromise,
): Promise<google.maps.Polyline | undefined>;