Don't show parts of the route result UI before the user has specified a trip.
@@ -96,6 +96,9 @@ impl RoutePlanner {
self.waypoints.get_panel_widget(ctx),
])
.section(ctx),
+ if self.waypoints.get_waypoints().len() < 2 {
+ Widget::nothing()
+ } else {
Widget::col(vec![
Widget::row(vec![
Line("Slow-down factor for main roads:")
@@ -116,7 +119,8 @@ impl RoutePlanner {
])
.into_widget(ctx),
])
- .section(ctx),
+ .section(ctx)
+ },
results_widget.section(ctx),
]);
let mut panel = crate::components::LeftPanel::builder(ctx, &self.top_panel, contents)
@@ -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();
