From 375ef69b1b9fc44669eaad781d10b81e7ed590b6 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 14 Mar 2024 14:45:39 +0100 Subject: [PATCH] fix: only use location bias in search for close zoom And add a lower location bias --- package.json | 2 +- umap/static/umap/js/umap.controls.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 715c152c..c48b0da3 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index cfbd78bf..160d856c 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -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) },