mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-25 15:33:44 +03:00
Fix standard app buttons from LTN impact tool that weren't wired up
This commit is contained in:
parent
ba84d564b8
commit
bac81d25b8
@ -1,11 +1,11 @@
|
|||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
|
|
||||||
use map_gui::load::FileLoader;
|
use map_gui::load::FileLoader;
|
||||||
use map_gui::tools::{checkbox_per_mode, PopupMsg};
|
use map_gui::tools::{checkbox_per_mode, CityPicker, Navigator, PopupMsg};
|
||||||
use synthpop::{Scenario, TripMode};
|
use synthpop::{Scenario, TripMode};
|
||||||
use widgetry::{
|
use widgetry::{
|
||||||
Drawable, EventCtx, GeomBatch, GfxCtx, HorizontalAlignment, Line, Panel, SimpleState, Slider,
|
Drawable, EventCtx, GeomBatch, GfxCtx, HorizontalAlignment, Key, Line, Panel, SimpleState,
|
||||||
State, Text, TextExt, Toggle, VerticalAlignment, Widget,
|
Slider, State, Text, TextExt, Toggle, VerticalAlignment, Widget,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{end_of_day, Filters, Impact};
|
use super::{end_of_day, Filters, Impact};
|
||||||
@ -47,15 +47,13 @@ impl ShowResults {
|
|||||||
|
|
||||||
let panel = Panel::new_builder(Widget::col(vec![
|
let panel = Panel::new_builder(Widget::col(vec![
|
||||||
map_gui::tools::app_header(ctx, app, "Low traffic neighborhoods"),
|
map_gui::tools::app_header(ctx, app, "Low traffic neighborhoods"),
|
||||||
Widget::row(vec![
|
|
||||||
"Impact prediction".text_widget(ctx),
|
"Impact prediction".text_widget(ctx),
|
||||||
ctx.style().btn_close_widget(ctx),
|
ctx.style().btn_outline.text("Browse neighborhoods").hotkey(Key::Escape).build_def(ctx),
|
||||||
]),
|
|
||||||
Text::from(Line("This tool starts with a travel demand model, calculates the route every trip takes before and after changes, and displays volumes along roads and intersections")).wrap_to_pct(ctx, 20).into_widget(ctx),
|
Text::from(Line("This tool starts with a travel demand model, calculates the route every trip takes before and after changes, and displays volumes along roads and intersections")).wrap_to_pct(ctx, 20).into_widget(ctx),
|
||||||
// TODO Dropdown for the scenario, and explain its source/limitations
|
// TODO Dropdown for the scenario, and explain its source/limitations
|
||||||
app.session.impact.filters.to_panel(ctx, app),
|
app.session.impact.filters.to_panel(ctx, app),
|
||||||
app.session.impact.compare_counts.get_panel_widget(ctx).named("compare counts"),
|
app.session.impact.compare_counts.get_panel_widget(ctx).named("compare counts"),
|
||||||
ctx.style().btn_plain.text("Save before/after counts to files").build_def(ctx),
|
ctx.style().btn_outline.text("Save before/after counts to files").build_def(ctx),
|
||||||
]))
|
]))
|
||||||
.aligned(HorizontalAlignment::Left, VerticalAlignment::Top)
|
.aligned(HorizontalAlignment::Left, VerticalAlignment::Top)
|
||||||
.build(ctx);
|
.build(ctx);
|
||||||
@ -84,7 +82,27 @@ impl SimpleState<App> for ShowResults {
|
|||||||
panel: &mut Panel,
|
panel: &mut Panel,
|
||||||
) -> Transition {
|
) -> Transition {
|
||||||
match x {
|
match x {
|
||||||
"close" => {
|
"Home" => {
|
||||||
|
return Transition::Clear(vec![map_gui::tools::TitleScreen::new_state(
|
||||||
|
ctx,
|
||||||
|
app,
|
||||||
|
map_gui::tools::Executable::LTN,
|
||||||
|
Box::new(|ctx, app, _| BrowseNeighborhoods::new_state(ctx, app)),
|
||||||
|
)]);
|
||||||
|
}
|
||||||
|
"change map" => {
|
||||||
|
return Transition::Push(CityPicker::new_state(
|
||||||
|
ctx,
|
||||||
|
app,
|
||||||
|
Box::new(|ctx, app| {
|
||||||
|
Transition::Replace(BrowseNeighborhoods::new_state(ctx, app))
|
||||||
|
}),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
"search" => {
|
||||||
|
return Transition::Push(Navigator::new_state(ctx, app));
|
||||||
|
}
|
||||||
|
"Browse neighborhoods" => {
|
||||||
// Don't just Pop; if we updated the results, the UI won't warn the user about a slow
|
// Don't just Pop; if we updated the results, the UI won't warn the user about a slow
|
||||||
// loading
|
// loading
|
||||||
Transition::Replace(BrowseNeighborhoods::new_state(ctx, app))
|
Transition::Replace(BrowseNeighborhoods::new_state(ctx, app))
|
||||||
|
Loading…
Reference in New Issue
Block a user