diff --git a/abstio/src/lib.rs b/abstio/src/lib.rs index d224ccb9db..6dcf5fad88 100644 --- a/abstio/src/lib.rs +++ b/abstio/src/lib.rs @@ -36,5 +36,5 @@ mod io; /// and reading files in different environments. pub fn slurp_bytes(filename: &str) -> Vec { let path = path(filename); - slurp_file(&path).unwrap_or_else(|_| panic!("Can't read {}", path)) + slurp_file(&path).unwrap_or_else(|err| panic!("Can't read {}: {}", path, err)) } diff --git a/apps/ltn/src/components/about.rs b/apps/ltn/src/components/about.rs index 3ec7ae623b..657e316c44 100644 --- a/apps/ltn/src/components/about.rs +++ b/apps/ltn/src/components/about.rs @@ -18,6 +18,7 @@ impl About { Line("with major design advice from Duncan Geere"), Line("Developed at the Alan Turing Institute"), Line("Data from OpenStreetMap"), + Line("Basemap style based on Mapbox Light"), Line("See below for full credits and more info"), ]) .into_widget(ctx), diff --git a/apps/ltn/src/connectivity.rs b/apps/ltn/src/connectivity.rs index 3bd1584f82..2f55cdc5c3 100644 --- a/apps/ltn/src/connectivity.rs +++ b/apps/ltn/src/connectivity.rs @@ -93,6 +93,17 @@ impl Viewer { .neighbourhood_area_km2(self.neighbourhood.id) ) .text_widget(ctx), + Widget::row(vec![ + "Draw traffic cells as".text_widget(ctx).centered_vert(), + Toggle::choice( + ctx, + "draw cells", + "areas", + "outlines", + Key::D, + app.session.draw_cells_as_areas, + ), + ]), warning, advanced_panel(ctx, app), ]), @@ -171,25 +182,29 @@ impl State for Viewer { ) .unwrap(); } - Outcome::Changed(x) => { - if x == "Advanced features" { + Outcome::Changed(x) => match x.as_ref() { + "Advanced features" => { app.opts.dev = self.left_panel.is_checked("Advanced features"); self.update(ctx, app); return Transition::Keep; } + "heuristic" => { + app.session.heuristic = self.left_panel.dropdown_value("heuristic"); + return Transition::Keep; + } + "areas" | "outlines" => { + app.session.draw_cells_as_areas = self.left_panel.is_checked("draw cells"); - app.session.draw_cells_as_areas = self.left_panel.is_checked("draw cells"); - app.session.heuristic = self.left_panel.dropdown_value("heuristic"); - - if x != "heuristic" { let (edit, draw_top_layer, draw_under_roads_layer, _, highlight_cell) = setup_editing(ctx, app, &self.neighbourhood); self.edit = edit; self.draw_top_layer = draw_top_layer; self.draw_under_roads_layer = draw_under_roads_layer; self.highlight_cell = highlight_cell; + return Transition::Keep; } - } + _ => unreachable!(), + }, _ => {} } @@ -378,17 +393,6 @@ fn advanced_panel(ctx: &EventCtx, app: &App) -> Widget { .btn_outline .text("Customize boundary") .build_def(ctx), - Widget::row(vec![ - "Draw traffic cells as".text_widget(ctx).centered_vert(), - Toggle::choice( - ctx, - "draw cells", - "areas", - "streets", - Key::D, - app.session.draw_cells_as_areas, - ), - ]), ctx.style() .btn_outline .text("Automatically place filters")