diff --git a/README.md b/README.md index 62c8c89..0f579d5 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,10 @@ class Place(models.Model): # 'tileOptions': { # attribution: '© OpenStreetMap', # }, + # '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`) | 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: `{}`) +| locate | [Leaflet.Locate Options](https://github.com/domoritz/leaflet-locatecontrol#possible-options) (default: `{returnToPrevBounds: true, showPopup: false}`) ## Usage diff --git a/map_location/static/map-location.js b/map_location/static/map-location.js index 1ae9125..7b7bff5 100644 --- a/map_location/static/map-location.js +++ b/map_location/static/map-location.js @@ -17,6 +17,7 @@ function MapLocationInit(mapId, options = {}) { L.control.locate({ returnToPrevBounds: true, showPopup: false, + ...(options.locate || {}) }).addTo(map); function loadPos() {