fix sorting of nearby streets in address field dropdown

This commit is contained in:
Martin Raifer
2023-07-17 14:09:36 +02:00
parent bb5e9e063d
commit 7b44dfaa1b
2 changed files with 3 additions and 2 deletions
+2 -2
View File
@@ -46,13 +46,13 @@ export function uiFieldAddress(field, context) {
.map(d => {
let dist = geoSphericalDistance(d.extent(context.graph()).center(), l);
if (d.type === 'way') {
if (d.geometry(context.graph()) === 'line') {
var loc = context.projection([
(extent[0][0] + extent[1][0]) / 2,
(extent[0][1] + extent[1][1]) / 2
]);
var choice = geoChooseEdge(context.graph().childNodes(d), loc, context.projection);
dist = Math.min(dist, choice.distance);
dist = geoSphericalDistance(choice.loc, l);
}
const value = resultProp && d.tags[resultProp] ? d.tags[resultProp] : d.tags.name;