Skip to content

MglGeolocateControl ​

Render GeolocateControl

See GeolocateControl

typescript
import { MglGeolocateControl } from '@indoorequal/vue-maplibre-gl';

Props ​

position ​

  • Type: ControlPosition
  • Required: false
  • Default: Position.TOP_RIGHT

Position on the map to which the control will be added. Valid values are 'top-left', 'top-right', 'bottom-left', and 'bottom-right'. Defaults to 'top-right'.

positionOptions ​

  • Type: PositionOptions
  • Required: false
  • Default: () => (({ enableHighAccuracy: false, timeout: 6000 }) as PositionOptions)

A Geolocation API PositionOptions object.

fitBoundsOptions ​

  • Type: FitBoundsOptions
  • Required: false
  • Default: () => (({ maxZoom: 15 }) as FitBoundsOptions)

A options object to use when the map is panned and zoomed to the user's location. The default is to use a maxZoom of 15 to limit how far the map will zoom in for very accurate locations.

trackUserLocation ​

  • Type: boolean
  • Required: false
  • Default: false

If true the GeolocateControl becomes a toggle button and when active the map will receive updates to the user's location as it changes.

showAccuracyCircle ​

  • Type: boolean
  • Required: false
  • Default: true

By default, if showUserLocation is true, a transparent circle will be drawn around the user location indicating the accuracy (95% confidence level) of the user's location. Set to false to disable. Always disabled when showUserLocation is false.

showUserLocation ​

  • Type: boolean
  • Required: false
  • Default: true

By default a dot will be shown on the map at the user's location. Set to false to disable.

Events ​

trackuserlocationstart ​

trackuserlocationend ​

userlocationlostfocus ​

userlocationfocus ​

geolocate ​

error ​

outofmaxbounds ​

Source ​

See source.

Released under the MIT License.