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
Various small fixes: broken links, wrong option descriptions, grammar/typos, outdated Leaflet version references, rename `LICENSE` to `LICENSE.md`, and a note that `onLocationError` fires independently of Leaflet's `locationerror` event.
A useful control to geolocate the user with many options. Official [Leaflet](http://leafletjs.com/plugins.html#geolocation) and [MapBox plugin](https://www.mapbox.com/mapbox.js/example/v1.0.0/leaflet-locatecontrol/).
6
+
A useful control to geolocate the user with many options. Official [Leaflet](https://leafletjs.com/plugins.html#geolocation) and [MapBox plugin](https://www.mapbox.com/mapbox.js/example/v1.0.0/leaflet-locatecontrol/).
7
7
8
-
Tested with [Leaflet](https://leafletjs.com/) 1.9.2 and [Mapbox.js](https://docs.mapbox.com/mapbox.js/) 3.3.1 in Firefox, Chrome and Safari.
8
+
Tested with [Leaflet](https://leafletjs.com/) 1.9.x and 2.x and [Mapbox.js](https://docs.mapbox.com/mapbox.js/) 3.3.1 in Firefox, Chrome and Safari.
9
9
10
10
Please check for [breaking changes in the changelog](https://github.com/domoritz/leaflet-locatecontrol/blob/gh-pages/CHANGELOG.md).
11
11
@@ -73,15 +73,15 @@ Then use `new LocateControl()` instead of `L.control.locate()`.
73
73
74
74
#### Add the following snippet to your map initialization
75
75
76
-
This snippet adds the control to the map. You can pass also pass a configuration.
76
+
This snippet adds the control to the map. You can also pass a configuration.
77
77
78
78
```js
79
79
L.control.locate().addTo(map);
80
80
```
81
81
82
82
### Possible options
83
83
84
-
The locate controls inherits options from [Leaflet Controls](https://leafletjs.com/reference.html#control).
84
+
The locate control inherits options from [Leaflet Controls](https://leafletjs.com/reference.html#control).
85
85
86
86
To customize the control, pass an object with your custom options to the locate control.
87
87
@@ -95,9 +95,9 @@ Possible options are listed in the following table. More details are [in the cod
|`position`|`string`| Position of the control |`topleft`|
98
-
|`layer`|[`ILayer`](http://leafletjs.com/reference.html#ilayer)| The layer that the user's location should be drawn on. | a new layer |
98
+
|`layer`|[`Layer`](https://leafletjs.com/reference.html#layer)| The layer that the user's location should be drawn on. | a new layer |
99
99
|`setView`|`boolean` or `string`| Set the map view (zoom and pan) to the user's location as it updates. Options are `false`, `'once'`, `'always'`, `'untilPan'`, or `'untilPanOrZoom'`|`'untilPanOrZoom'`|
100
-
|`flyTo`|`boolean`| Smooth pan and zoom to the location of the marker. Only works in Leaflet 1.0+. |`false`|
100
+
|`flyTo`|`boolean`| Smooth pan and zoom to the location of the marker. |`false`|
101
101
|`keepCurrentZoomLevel`|`boolean` or `Array`| Only pan when setting the view. Set to `true` to always keep the current zoom, or provide a zoom range like `[13, 18]` to only keep the zoom when it's within that range. Outside the range, the map will zoom normally. |`false`|
102
102
|`initialZoomLevel`|`false` or `integer`| After activating the plugin by clicking on the icon, zoom to the selected zoom level, even when keepCurrentZoomLevel is true. Set to `false` to disable this feature. |`false`|
103
103
|`clickBehavior`|`object`| What to do when the user clicks on the control. Has three options `inView`, `inViewNotFollowing` and `outOfView`. Possible values are `stop` and `setView`, or the name of a behaviour to inherit from. |`{inView: 'stop', outOfView: 'setView', inViewNotFollowing: 'inView'}`|
@@ -107,13 +107,13 @@ Possible options are listed in the following table. More details are [in the cod
107
107
|`drawCircle`|`boolean`| If set, a circle that shows the location accuracy is drawn. |`true`|
108
108
|`drawMarker`|`boolean`| If set, the marker at the users' location is drawn. |`true`|
109
109
|`markerClass`|`class`| The class to be used to create the marker. |`LocationMarker`|
110
-
|`compassClass`|`class`| The class to be used to create the marker. |`CompassMarker`|
111
-
|`circleStyle`|[`Path options`](http://leafletjs.com/reference.html#path-options)| Accuracy circle style properties. | see code |
112
-
|`markerStyle`|[`Path options`](http://leafletjs.com/reference.html#path-options)| Inner marker style properties. Only works if your marker class supports `setStyle`. | see code |
113
-
|`compassStyle`|[`Path options`](http://leafletjs.com/reference.html#path-options)| Triangle compass heading marker style properties. Only works if your marker class supports `setStyle`. | see code |
114
-
|`followCircleStyle`|[`Path options`](http://leafletjs.com/reference.html#path-options)| Changes to the accuracy circle while following. Only need to provide changes. |`{}`|
115
-
|`followMarkerStyle`|[`Path options`](http://leafletjs.com/reference.html#path-options)| Changes to the inner marker while following. Only need to provide changes. |`{}`|
116
-
|`followCompassStyle`|[`Path options`](http://leafletjs.com/reference.html#path-options)| Changes to the compass marker while following. Only need to provide changes. |`{}`|
110
+
|`compassClass`|`class`| The class to be used to create the compass marker. |`CompassMarker`|
111
+
|`circleStyle`|[`Path options`](https://leafletjs.com/reference.html#path)| Accuracy circle style properties. | see code |
112
+
|`markerStyle`|[`Path options`](https://leafletjs.com/reference.html#path)| Inner marker style properties. Only works if your marker class supports `setStyle`. | see code |
113
+
|`compassStyle`|[`Path options`](https://leafletjs.com/reference.html#path)| Triangle compass heading marker style properties. Only works if your marker class supports `setStyle`. | see code |
114
+
|`followCircleStyle`|[`Path options`](https://leafletjs.com/reference.html#path)| Changes to the accuracy circle while following. Only need to provide changes. |`{}`|
115
+
|`followMarkerStyle`|[`Path options`](https://leafletjs.com/reference.html#path)| Changes to the inner marker while following. Only need to provide changes. |`{}`|
116
+
|`followCompassStyle`|[`Path options`](https://leafletjs.com/reference.html#path)| Changes to the compass marker while following. Only need to provide changes. |`{}`|
117
117
|`icon`|`string`| The CSS class for the icon. |`leaflet-control-locate-location-arrow`|
118
118
|`iconLoading`|`string`| The CSS class for the icon while loading. |`leaflet-control-locate-spinner`|
119
119
|`iconElementTag`|`string`| The element to be created for icons. |`span`|
@@ -124,10 +124,10 @@ Possible options are listed in the following table. More details are [in the cod
124
124
|`onLocationError`|`function`| Called on location errors. Receives the error and the control instance. | see code |
125
125
|`metric`|`boolean`| Use metric units. |`true`|
126
126
|`onLocationOutsideMapBounds`|`function`| Called when the user's location is outside the bounds set on the map. Called repeatedly when the user's location changes. | see code |
127
-
|`showPopup`|`boolean`| Display a pop-up when the user click on the inner marker. |`true`|
127
+
|`showPopup`|`boolean`| Display a pop-up when the user clicks on the inner marker. |`true`|
128
128
|`strings`|`object`| Strings used in the control. Options are `title`, `text`, `metersUnit`, `feetUnit`, `popup` and `outsideMapBoundsMsg`| see code |
129
129
|`strings.popup`|`string` or `function`| The string shown as popup. May contain the placeholders `{distance}`, `{unit}`, `{lat}`, `{lng}`, `{altitude}`, `{speed}` (in m/s), and `{heading}` (in degrees). If this option is specified as function, it will be executed with a single parameter `{distance, unit, lat, lng, altitude, speed, heading}` and expected to return a string. | see code |
130
-
|`locateOptions`|[`Locate options`](https://leafletjs.com/reference.html#locate-options)| The default options passed to leaflets locate method. | see code |
130
+
|`locateOptions`|[`Locate options`](https://leafletjs.com/reference.html#locate-options)| The default options passed to Leaflet's locate method. | see code |
131
131
<!-- prettier-ignore-end -->
132
132
133
133
For example, to customize the position and the title, you could write
@@ -192,7 +192,7 @@ You can keep the plugin active but stop following using `lc.stopFollowing()`.
192
192
193
193
### Events
194
194
195
-
You can leverage the native Leaflet events `locationfound` and `locationerror` to handle when geolocation is successful or produces an error. You can find out more about these events in the [Leaflet documentation](https://leafletjs.com/examples/mobile/#geolocation).
195
+
You can leverage the native Leaflet events `locationfound` and `locationerror` to handle when geolocation is successful or produces an error. You can find out more about these events in the [Leaflet documentation](https://leafletjs.com/examples/mobile/#geolocation). Note that the control's `onLocationError` callback (which shows a browser `alert()` by default) fires independently of the `locationerror` event — override it to suppress the alert.
196
196
197
197
Additionally, the locate control fires the following events on the map object:
198
198
@@ -312,7 +312,7 @@ Run `npm run lint:fix` to automatically fix style and linting issues.
312
312
313
313
1. Update `CHANGELOG.md` with the changes for the new version and commit: `git commit -am "chore: update changelog"`
314
314
2. Run `npm run bump:minor` or `npm run bump:patch` (automatically bumps the version in `package.json`, runs lint, tests, and build, then stages the `dist/` files)
315
-
3. Review what will be released: `git log $(git describe --tags --abbrev=0 HEAD~1)..HEAD --oneline`
315
+
3. Review what will be released: `git log $(git describe --tags --abbrev=0)..HEAD --oneline`
316
316
4.`git push && git push --tags`
317
317
5.`npm publish`
318
318
@@ -327,6 +327,8 @@ To all [contributors](https://github.com/domoritz/leaflet-locatecontrol/contribu
327
327
328
328
## License
329
329
330
-
MIT
330
+
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
331
+
332
+
## Attributions
331
333
332
334
SVG icons from [Font Awesome v5.15.4](https://github.com/FortAwesome/Font-Awesome/releases/tag/5.15.4): [Creative Commons Attribution 4.0](https://fontawesome.com/license/free)
0 commit comments