1use map_gui::tools::grey_out_map;
2use widgetry::tools::open_browser;
3use widgetry::{DrawBaselayer, EventCtx, GfxCtx, Line, Panel, SimpleState, State, Text, Widget};
4
5use crate::{App, Transition};
6
7pub struct About;
8
9impl About {
10 pub fn new_state(ctx: &mut EventCtx) -> Box<dyn State<App>> {
11 let panel = Panel::new_builder(Widget::col(vec![
12 Widget::row(vec![
13 Line("About the LTN tool").small_heading().into_widget(ctx),
14 ctx.style().btn_close_widget(ctx),
15 ]),
16 Text::from_multiline(vec![
17 Line("Created by Dustin Carlino, Madison Wang, Cindy Huang, and Jennifer Ding"),
18 Line("with major design advice from Duncan Geere"),
19 Line("Developed at the Alan Turing Institute"),
20 Line("Data from OpenStreetMap"),
21 Line("Basemap style based on Mapbox Light"),
22 Line("See below for full credits and more info"),
23 ])
24 .into_widget(ctx),
25 ctx.style()
26 .btn_outline
27 .text("ltn.abstreet.org")
28 .build_def(ctx),
29 ]))
30 .build(ctx);
31 <dyn SimpleState<_>>::new_state(panel, Box::new(About))
32 }
33}
34
35impl SimpleState<App> for About {
36 fn on_click(&mut self, _: &mut EventCtx, _: &mut App, x: &str, _: &mut Panel) -> Transition {
37 if x == "close" {
38 return Transition::Pop;
39 } else if x == "ltn.abstreet.org" {
40 open_browser("https://ltn.abstreet.org");
41 }
42 Transition::Keep
43 }
44
45 fn draw(&self, g: &mut GfxCtx, app: &App) {
46 grey_out_map(g, app);
47 }
48
49 fn draw_baselayer(&self) -> DrawBaselayer {
50 DrawBaselayer::PreviousState
51 }
52}