fix: only use location bias in search for close zoom

And add a lower location bias
This commit is contained in:
Yohan Boniface 2024-03-14 14:45:39 +01:00
parent 6396ee5e58
commit 375ef69b1b
2 changed files with 3 additions and 1 deletions

View file

@ -58,7 +58,7 @@
"leaflet.locatecontrol": "^0.79.0",
"leaflet.markercluster": "^1.5.3",
"leaflet.path.drag": "0.0.6",
"leaflet.photon": "0.9.0",
"leaflet.photon": "0.9.1",
"osmtogeojson": "^3.0.0-beta.3",
"simple-statistics": "^7.8.3",
"togpx": "^0.5.4",

View file

@ -1237,6 +1237,7 @@ U.StarControl = L.Control.extend({
U.Search = L.PhotonSearch.extend({
initialize: function (map, input, options) {
this.options.placeholder = L._('Type a place name or coordinates')
this.options.location_bias_scale = 0.5
L.PhotonSearch.prototype.initialize.call(this, map, input, options)
this.options.url = map.options.urls.search
if (map.options.maxBounds) this.options.bbox = map.options.maxBounds.toBBoxString()
@ -1276,6 +1277,7 @@ U.Search = L.PhotonSearch.extend({
// Only numbers, abort.
if (/^[\d .,]*$/.test(this.input.value)) return
// Do normal search
this.options.includePosition = this.map.getZoom() > 10
L.PhotonSearch.prototype.search.call(this)
},