You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param {Object} [options.showUserLocation=true] By default a dot will be shown on the map at the user's location. Set to `false` to disable.
83
88
* @param {Object} [options.showUserHeading=false] If `true` an arrow will be drawn next to the user location dot indicating the device's heading. This only has affect when `trackUserLocation` is `true`.
84
89
* @param {Object} [options.geolocation=window.navigator.geolocation] `window.navigator.geolocation` by default; you can provide an object with the same shape to customize geolocation handling.
90
+
* @param {boolean} [options.showButton=true] If `false`, the control button will be hidden. The user location dot can still be shown by setting `showUserLocation` to `true` and calling {@link GeolocateControl#trigger} programmatically.
85
91
*
86
92
* @example
87
93
* map.addControl(new mapboxgl.GeolocateControl({
@@ -91,6 +97,16 @@ type GeolocateControlEvents = {
91
97
* trackUserLocation: true,
92
98
* showUserHeading: true
93
99
* }));
100
+
*
101
+
* @example
102
+
* // Tracking without visible button - call trigger() to start
103
+
* const geolocate = new mapboxgl.GeolocateControl({
104
+
* trackUserLocation: true,
105
+
* showUserLocation: true,
106
+
* showButton: false
107
+
* });
108
+
* map.addControl(geolocate);
109
+
* geolocate.trigger();
94
110
* @see [Example: Locate the user](https://www.mapbox.com/mapbox-gl-js/example/locate-user/)
// @ts-expect-error - TS2339 - Property 'requestPermission' does not exist on type '{ new (type: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent; prototype: DeviceMotionEvent; }'.
// @ts-expect-error - TS2339 - Property 'requestPermission' does not exist on type '{ new (type: string, eventInitDict?: DeviceOrientationEventInit): DeviceOrientationEvent; prototype: DeviceOrientationEvent; }'.
0 commit comments