Skip to content

Commit 5407cb7

Browse files
committed
Support route origin as geocoding reference point
If available, the route origin is now used as a reference point when searching for the target of the route. Since the target search is specifically for the purpose of finding a point you want to reach from the origin, it is most likely to be the best reference. This also comes with the advantage of showing an approximate distance (as the crow flies) of the route. Closes #29.
1 parent ad3c3f8 commit 5407cb7

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1414
### Changed
1515

1616
- Default zoom on GPS location changed from level 19 to 18
17+
- Search for the route target will now use the origin as reference point
1718

1819
### Fixed
1920

src/ui/view/search.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ impl SearchView {
206206
self.geocoder.reset();
207207
} else {
208208
// Submit background query.
209-
let reference_point = self.gps.unwrap_or(self.map_center_point);
209+
let reference_point = match self.route_origin {
210+
Some(RouteOrigin::Gps) | None => self.gps.unwrap_or(self.map_center_point),
211+
Some(RouteOrigin::GeoPoint(point)) => point,
212+
};
210213
let mut query = SearchQuery::new(&self.last_query);
211214
query.set_reference(reference_point, self.map_center_zoom);
212215
self.geocoder.search(query);

0 commit comments

Comments
 (0)