mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 01:15:12 +03:00
Rearrange some LTN panels, try to make consistent and emphasize important stuff
This commit is contained in:
parent
08395624d8
commit
a4153891e2
@ -40,7 +40,21 @@ impl BrowseNeighborhoods {
|
||||
|
||||
let panel = Panel::new_builder(Widget::col(vec![
|
||||
crate::app_header(ctx, app),
|
||||
app.session.alt_proposals.to_widget(ctx, app),
|
||||
"Click a neighborhood to edit filters".text_widget(ctx),
|
||||
Widget::row(vec![
|
||||
ctx.style()
|
||||
.btn_outline
|
||||
.text("Plan a route")
|
||||
.hotkey(Key::R)
|
||||
.build_def(ctx),
|
||||
ctx.style()
|
||||
.btn_outline
|
||||
.text("Export to GeoJSON")
|
||||
.build_def(ctx),
|
||||
])
|
||||
.section(ctx),
|
||||
Line("Advanced").small_heading().into_widget(ctx),
|
||||
Widget::col(vec![
|
||||
Widget::row(vec![
|
||||
"Draw neighborhoods:".text_widget(ctx).centered_vert(),
|
||||
@ -65,26 +79,10 @@ impl BrowseNeighborhoods {
|
||||
])
|
||||
.section(ctx),
|
||||
Widget::col(vec![
|
||||
app.session.alt_proposals.to_widget(ctx, app),
|
||||
ctx.style()
|
||||
.btn_outline
|
||||
.text("Export to GeoJSON")
|
||||
.build_def(ctx),
|
||||
])
|
||||
.section(ctx),
|
||||
Widget::col(vec![ctx
|
||||
.style()
|
||||
.btn_outline
|
||||
.text("Plan a route")
|
||||
.hotkey(Key::R)
|
||||
.build_def(ctx)])
|
||||
.section(ctx),
|
||||
Widget::col(vec![
|
||||
"Predict proposal impact (experimental)".text_widget(ctx),
|
||||
"Predict proposal impact".text_widget(ctx),
|
||||
impact_widget(ctx, app),
|
||||
])
|
||||
.section(ctx),
|
||||
// TODO Consider putting some of the edit controls here, like undo?
|
||||
Widget::col(vec![Widget::row(vec![
|
||||
Widget::dropdown(
|
||||
ctx,
|
||||
@ -94,7 +92,7 @@ impl BrowseNeighborhoods {
|
||||
),
|
||||
ctx.style()
|
||||
.btn_outline
|
||||
.text("Automatically stop rat-runs")
|
||||
.text("Automatically place filters")
|
||||
.build_def(ctx),
|
||||
])])
|
||||
.section(ctx),
|
||||
@ -134,7 +132,7 @@ impl State<App> for BrowseNeighborhoods {
|
||||
"Plan a route" => {
|
||||
return Transition::Push(crate::pathfinding::RoutePlanner::new_state(ctx, app));
|
||||
}
|
||||
"Automatically stop rat-runs" => {
|
||||
"Automatically place filters" => {
|
||||
ctx.loading_screen("automatically filter all neighborhoods", |ctx, timer| {
|
||||
for id in app
|
||||
.session
|
||||
@ -352,20 +350,13 @@ fn impact_widget(ctx: &EventCtx, app: &App) -> Widget {
|
||||
Line(format!("We need to load a {} file", size)),
|
||||
])
|
||||
.into_widget(ctx),
|
||||
ctx.style()
|
||||
.btn_solid_primary
|
||||
.text("Calculate")
|
||||
.build_def(ctx),
|
||||
ctx.style().btn_outline.text("Calculate").build_def(ctx),
|
||||
]);
|
||||
}
|
||||
|
||||
if app.session.impact.change_key == app.session.modal_filters.get_change_key() {
|
||||
// Nothing to calculate!
|
||||
return ctx
|
||||
.style()
|
||||
.btn_solid_primary
|
||||
.text("Show impact")
|
||||
.build_def(ctx);
|
||||
return ctx.style().btn_outline.text("Show impact").build_def(ctx);
|
||||
}
|
||||
|
||||
// We'll need to do some pathfinding
|
||||
@ -375,9 +366,6 @@ fn impact_widget(ctx: &EventCtx, app: &App) -> Widget {
|
||||
Line("The application may freeze up during that time."),
|
||||
])
|
||||
.into_widget(ctx),
|
||||
ctx.style()
|
||||
.btn_solid_primary
|
||||
.text("Calculate")
|
||||
.build_def(ctx),
|
||||
ctx.style().btn_outline.text("Calculate").build_def(ctx),
|
||||
])
|
||||
}
|
||||
|
@ -50,6 +50,14 @@ impl Viewer {
|
||||
ctx,
|
||||
app,
|
||||
Widget::col(vec![
|
||||
ctx.style()
|
||||
.btn_outline
|
||||
.icon_text(
|
||||
"system/assets/tools/select.svg",
|
||||
"Create filters along a shape",
|
||||
)
|
||||
.hotkey(Key::F)
|
||||
.build_def(ctx),
|
||||
Widget::row(vec![
|
||||
"Draw traffic cells as".text_widget(ctx).centered_vert(),
|
||||
Toggle::choice(
|
||||
@ -75,14 +83,6 @@ impl Viewer {
|
||||
.hotkey(Key::A)
|
||||
.build_def(ctx),
|
||||
]),
|
||||
ctx.style()
|
||||
.btn_outline
|
||||
.icon_text(
|
||||
"system/assets/tools/select.svg",
|
||||
"Create filters along a shape",
|
||||
)
|
||||
.hotkey(Key::F)
|
||||
.build_def(ctx),
|
||||
]),
|
||||
)
|
||||
.build(ctx);
|
||||
|
@ -46,8 +46,14 @@ impl ShowResults {
|
||||
|
||||
let panel = Panel::new_builder(Widget::col(vec![
|
||||
crate::app_header(ctx, app),
|
||||
"Impact prediction".text_widget(ctx),
|
||||
ctx.style().btn_back("Browse neighborhoods").hotkey(Key::Escape).build_def(ctx),
|
||||
Widget::row(vec![
|
||||
Line("Impact prediction").small_heading().into_widget(ctx),
|
||||
ctx.style()
|
||||
.btn_back("Browse neighborhoods")
|
||||
.hotkey(Key::Escape)
|
||||
.build_def(ctx)
|
||||
.align_right(),
|
||||
]),
|
||||
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
|
||||
app.session.impact.filters.to_panel(ctx, app),
|
||||
|
@ -8,7 +8,7 @@ use synthpop::{TripEndpoint, TripMode};
|
||||
use widgetry::mapspace::{ToggleZoomed, World};
|
||||
use widgetry::{
|
||||
Color, EventCtx, GeomBatch, GfxCtx, HorizontalAlignment, Key, Line, Outcome, Panel, RoundedF64,
|
||||
Spinner, State, Text, TextExt, VerticalAlignment, Widget,
|
||||
Spinner, State, Text, VerticalAlignment, Widget,
|
||||
};
|
||||
|
||||
use crate::{handle_app_header_click, App, BrowseNeighborhoods, Transition};
|
||||
@ -64,12 +64,15 @@ impl RoutePlanner {
|
||||
|
||||
let mut panel = Panel::new_builder(Widget::col(vec![
|
||||
crate::app_header(ctx, app),
|
||||
"Plan a route".text_widget(ctx),
|
||||
ctx.style()
|
||||
.btn_back("Browse neighborhoods")
|
||||
.hotkey(Key::Escape)
|
||||
.build_def(ctx),
|
||||
app.session.alt_proposals.to_widget(ctx, app).section(ctx),
|
||||
app.session.alt_proposals.to_widget(ctx, app),
|
||||
Widget::row(vec![
|
||||
Line("Plan a route").small_heading().into_widget(ctx),
|
||||
ctx.style()
|
||||
.btn_back("Browse neighborhoods")
|
||||
.hotkey(Key::Escape)
|
||||
.build_def(ctx)
|
||||
.align_right(),
|
||||
]),
|
||||
Widget::col(vec![
|
||||
self.files.get_panel_widget(ctx),
|
||||
Widget::horiz_separator(ctx, 1.0),
|
||||
|
@ -3,7 +3,7 @@ use map_model::{IntersectionID, PathConstraints, RoadID};
|
||||
use widgetry::mapspace::{ObjectID, World, WorldOutcome};
|
||||
use widgetry::tools::open_browser;
|
||||
use widgetry::{
|
||||
lctrl, Color, EventCtx, HorizontalAlignment, Image, Key, Panel, PanelBuilder, TextExt,
|
||||
lctrl, Color, EventCtx, HorizontalAlignment, Image, Key, Line, Panel, PanelBuilder, TextExt,
|
||||
VerticalAlignment, Widget, DEFAULT_CORNER_RADIUS,
|
||||
};
|
||||
|
||||
@ -26,19 +26,17 @@ impl Tab {
|
||||
) -> PanelBuilder {
|
||||
Panel::new_builder(Widget::col(vec![
|
||||
crate::app_header(ctx, app),
|
||||
app.session.alt_proposals.to_widget(ctx, app),
|
||||
Widget::row(vec![
|
||||
Line("Editing neighborhood")
|
||||
.small_heading()
|
||||
.into_widget(ctx),
|
||||
ctx.style()
|
||||
.btn_back("Browse neighborhoods")
|
||||
.hotkey(Key::Escape)
|
||||
.build_def(ctx),
|
||||
ctx.style()
|
||||
.btn_outline
|
||||
.text("Adjust boundary")
|
||||
.hotkey(Key::B)
|
||||
.build_def(ctx),
|
||||
.build_def(ctx)
|
||||
.align_right(),
|
||||
]),
|
||||
app.session.alt_proposals.to_widget(ctx, app).section(ctx),
|
||||
self.make_buttons(ctx),
|
||||
Widget::col(vec![
|
||||
Widget::row(vec![
|
||||
Image::from_path("system/assets/tools/pencil.svg").into_widget(ctx),
|
||||
@ -63,6 +61,7 @@ impl Tab {
|
||||
]),
|
||||
])
|
||||
.section(ctx),
|
||||
self.make_buttons(ctx),
|
||||
per_tab_contents.section(ctx),
|
||||
]))
|
||||
.aligned(HorizontalAlignment::Left, VerticalAlignment::Top)
|
||||
@ -142,6 +141,21 @@ impl Tab {
|
||||
.build_def(ctx),
|
||||
);
|
||||
}
|
||||
// TODO The 3rd doesn't really act like a tab
|
||||
row.push(
|
||||
ctx.style()
|
||||
.btn_tab
|
||||
.text("Adjust boundary")
|
||||
.corner_rounding(geom::CornerRadii {
|
||||
top_left: DEFAULT_CORNER_RADIUS,
|
||||
top_right: DEFAULT_CORNER_RADIUS,
|
||||
bottom_left: 0.0,
|
||||
bottom_right: 0.0,
|
||||
})
|
||||
.hotkey(Key::B)
|
||||
.build_def(ctx),
|
||||
);
|
||||
|
||||
Widget::row(row)
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ use abstio::MapName;
|
||||
use abstutil::{Counter, Timer};
|
||||
use map_gui::tools::{ChooseSomething, PromptInput};
|
||||
use widgetry::tools::PopupMsg;
|
||||
use widgetry::{Choice, EventCtx, Key, State, Widget};
|
||||
use widgetry::{Choice, EventCtx, Key, Line, State, Widget};
|
||||
|
||||
use crate::partition::BlockID;
|
||||
use crate::per_neighborhood::Tab;
|
||||
@ -171,9 +171,10 @@ impl AltProposals {
|
||||
|
||||
pub fn to_widget(&self, ctx: &EventCtx, app: &App) -> Widget {
|
||||
let mut col = vec![Widget::row(vec![
|
||||
Line("Proposals").small_heading().into_widget(ctx),
|
||||
ctx.style().btn_outline.text("New").build_def(ctx),
|
||||
ctx.style().btn_outline.text("Load proposal").build_def(ctx),
|
||||
ctx.style().btn_outline.text("Save proposal").build_def(ctx),
|
||||
ctx.style().btn_outline.text("Load").build_def(ctx),
|
||||
ctx.style().btn_outline.text("Save").build_def(ctx),
|
||||
])];
|
||||
for (idx, proposal) in self.list.iter().enumerate() {
|
||||
let button = if let Some(proposal) = proposal {
|
||||
@ -208,7 +209,7 @@ impl AltProposals {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Widget::col(col)
|
||||
Widget::col(col).section(ctx)
|
||||
}
|
||||
|
||||
pub fn handle_action(
|
||||
@ -231,10 +232,10 @@ impl AltProposals {
|
||||
app.session.alt_proposals.list.push(None);
|
||||
app.session.alt_proposals.current = app.session.alt_proposals.list.len() - 1;
|
||||
}
|
||||
"Load proposal" => {
|
||||
"Load" => {
|
||||
return Some(Transition::Push(load_picker_ui(ctx, app, preserve_state)));
|
||||
}
|
||||
"Save proposal" => {
|
||||
"Save" => {
|
||||
return Some(Transition::Push(save_ui(ctx, app, preserve_state)));
|
||||
}
|
||||
_ => {
|
||||
|
@ -319,9 +319,9 @@ impl State<App> for SelectBoundary {
|
||||
fn make_panel(ctx: &mut EventCtx, app: &App) -> Panel {
|
||||
Panel::new_builder(Widget::col(vec![
|
||||
crate::app_header(ctx, app),
|
||||
"Draw a custom boundary for a neighborhood"
|
||||
.text_widget(ctx)
|
||||
.centered_vert(),
|
||||
Line("Adjusting neighborhood boundary")
|
||||
.small_heading()
|
||||
.into_widget(ctx),
|
||||
Text::from_all(vec![
|
||||
Line("Click").fg(ctx.style().text_hotkey_color),
|
||||
Line(" to add/remove a block"),
|
||||
|
Loading…
Reference in New Issue
Block a user