Skip to content

Commit

Permalink
Don't show parts of the route result UI before the user has specified…
Browse files Browse the repository at this point in the history
… a trip. #951
  • Loading branch information
dabreegster committed Sep 5, 2022
1 parent c5a110b commit 74b90b7
Showing 1 changed file with 29 additions and 20 deletions.
49 changes: 29 additions & 20 deletions apps/ltn/src/route_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,27 +96,31 @@ impl RoutePlanner {
self.waypoints.get_panel_widget(ctx),
])
.section(ctx),
Widget::col(vec![
Widget::row(vec![
Line("Slow-down factor for main roads:")
.into_widget(ctx)
.centered_vert(),
Spinner::f64_widget(
ctx,
"main road penalty",
(1.0, 10.0),
app.session.main_road_penalty,
0.5,
),
]),
Text::from_multiline(vec![
Line("1 means free-flow traffic conditions").secondary(),
Line("Increase to see how drivers may try to detour in heavy traffic")
.secondary(),
if self.waypoints.get_waypoints().len() < 2 {
Widget::nothing()
} else {
Widget::col(vec![
Widget::row(vec![
Line("Slow-down factor for main roads:")
.into_widget(ctx)
.centered_vert(),
Spinner::f64_widget(
ctx,
"main road penalty",
(1.0, 10.0),
app.session.main_road_penalty,
0.5,
),
]),
Text::from_multiline(vec![
Line("1 means free-flow traffic conditions").secondary(),
Line("Increase to see how drivers may try to detour in heavy traffic")
.secondary(),
])
.into_widget(ctx),
])
.into_widget(ctx),
])
.section(ctx),
.section(ctx)
},
results_widget.section(ctx),
]);
let mut panel = crate::components::LeftPanel::builder(ctx, &self.top_panel, contents)
Expand All @@ -142,6 +146,11 @@ impl RoutePlanner {

// Returns a widget to display
fn recalculate_paths(&mut self, ctx: &mut EventCtx, app: &App) -> Widget {
if self.waypoints.get_waypoints().len() < 2 {
self.draw_routes = Drawable::empty(ctx);
return Widget::nothing();
}

let map = &app.map;

let mut paths: Vec<(PathV2, Color)> = Vec::new();
Expand Down

0 comments on commit 74b90b7

Please sign in to comment.