feat: add locate options
This commit is contained in:
@@ -32,6 +32,10 @@ class Place(models.Model):
|
|||||||
# 'tileOptions': {
|
# 'tileOptions': {
|
||||||
# attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
# attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
||||||
# },
|
# },
|
||||||
|
# 'locate': {
|
||||||
|
# 'returnToPrevBounds': True,
|
||||||
|
# 'showPopup': False,
|
||||||
|
# },
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -44,6 +48,7 @@ class Place(models.Model):
|
|||||||
| markerZoom | Initial zoom scale (on load) – if a marker is set. (default: `18`)
|
| markerZoom | Initial zoom scale (on load) – if a marker is set. (default: `18`)
|
||||||
| tileLayer | [TileLayer](https://leafletjs.com/reference.html#tilelayer) urlTemplate (default: `"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"`)
|
| tileLayer | [TileLayer](https://leafletjs.com/reference.html#tilelayer) urlTemplate (default: `"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"`)
|
||||||
| tileOptions | [TileLayer Options](https://leafletjs.com/reference.html#tilelayer-option) (default: `{}`)
|
| tileOptions | [TileLayer Options](https://leafletjs.com/reference.html#tilelayer-option) (default: `{}`)
|
||||||
|
| locate | [Leaflet.Locate Options](https://github.com/domoritz/leaflet-locatecontrol#possible-options) (default: `{returnToPrevBounds: true, showPopup: false}`)
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ function MapLocationInit(mapId, options = {}) {
|
|||||||
L.control.locate({
|
L.control.locate({
|
||||||
returnToPrevBounds: true,
|
returnToPrevBounds: true,
|
||||||
showPopup: false,
|
showPopup: false,
|
||||||
|
...(options.locate || {})
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
function loadPos() {
|
function loadPos() {
|
||||||
|
|||||||
Reference in New Issue
Block a user