From e8018c93e645b9a6230407c241fa3e39c8716f83 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Mon, 27 Sep 2021 12:22:58 -0700 Subject: [PATCH] Disable the predict impact tab on maps without scenarios. #448 --- game/src/ungap/predict.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/game/src/ungap/predict.rs b/game/src/ungap/predict.rs index c7a8be09b4..dfa30b177d 100644 --- a/game/src/ungap/predict.rs +++ b/game/src/ungap/predict.rs @@ -132,6 +132,17 @@ impl State for ShowGaps { fn make_top_panel(ctx: &mut EventCtx, app: &App) -> Panel { let data = app.session.mode_shift.value().unwrap(); + + if data.all_candidate_trips.is_empty() { + return Tab::PredictImpact.make_left_panel( + ctx, + app, + Widget::col(vec![ + "This city doesn't have travel demand model data available".text_widget(ctx), + ]), + ); + } + let col = vec![ // TODO Info button with popup explaining all the assumptions... (where scenario data comes // from, only driving -> cycling, no off-map starts or ends, etc) @@ -141,7 +152,7 @@ fn make_top_panel(ctx: &mut EventCtx, app: &App) -> Panel { "{} total driving trips in this area", prettyprint_usize(data.all_candidate_trips.len()) ))), - 1.0, + 0.0, ), Widget::col(vec![ "Who might cycle if it was safer?".text_widget(ctx),