diff --git a/CHANGELOG.md b/CHANGELOG.md index 40ac0d979..171e4f654 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ _Breaking developer changes, which may affect downstream projects or sites that #### :white_check_mark: Validation #### :bug: Bugfixes * Validator: Don't falsely flag certain tags as "should be a closed area" if the tag also allows both area and line geometries in two separate presets (e.g. `highway=elevator` in the "Elevator" and "Inclined Lift" presets) +* Fix sorting of nearby streets in address field dropdown #### :earth_asia: Localization #### :hourglass: Performance #### :mortar_board: Walkthrough / Help diff --git a/modules/ui/fields/address.js b/modules/ui/fields/address.js index e932571d8..19ff87d75 100644 --- a/modules/ui/fields/address.js +++ b/modules/ui/fields/address.js @@ -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;