diff --git a/rustdoc/game/all.html b/rustdoc/game/all.html index be75f42e96..1f4ff27604 100644 --- a/rustdoc/game/all.html +++ b/rustdoc/game/all.html @@ -3,4 +3,4 @@

[] - List of all items

Structs

Enums

Traits

Functions

Typedefs

Constants

\ No newline at end of file + List of all items

Structs

Enums

Traits

Functions

Typedefs

Constants

\ No newline at end of file diff --git a/rustdoc/game/app/struct.App.html b/rustdoc/game/app/struct.App.html index 633ac02159..06bcb86586 100644 --- a/rustdoc/game/app/struct.App.html +++ b/rustdoc/game/app/struct.App.html @@ -62,8 +62,8 @@

impl State<App> for Viewer[src]

impl State<App> for Viewer[src]

impl State<App> for AllCityPicker[src]

[][src]Function game::devtools::fifteen_min::build_panel

fn build_panel(
    ctx: &mut EventCtx<'_>,
    start: &Building,
    isochrone: &Isochrone
) -> Panel
\ No newline at end of file diff --git a/rustdoc/game/devtools/fifteen_min/fn.draw_star.html b/rustdoc/game/devtools/fifteen_min/fn.draw_star.html index da186aa076..b5c2e71963 100644 --- a/rustdoc/game/devtools/fifteen_min/fn.draw_star.html +++ b/rustdoc/game/devtools/fifteen_min/fn.draw_star.html @@ -1,5 +1,5 @@ game::devtools::fifteen_min::draw_star - Rust

[][src]Function game::devtools::fifteen_min::draw_star

fn draw_star(ctx: &mut EventCtx<'_>, center: Pt2D) -> Drawable

Draw a star on the start building.

+ Change settings

[][src]Function game::devtools::fifteen_min::draw_star

fn draw_star(ctx: &mut EventCtx<'_>, center: Pt2D) -> Drawable

Draw a star on the start building.

\ No newline at end of file diff --git a/rustdoc/game/devtools/fifteen_min/index.html b/rustdoc/game/devtools/fifteen_min/index.html index 2b295d5c7e..ac0c03c5a0 100644 --- a/rustdoc/game/devtools/fifteen_min/index.html +++ b/rustdoc/game/devtools/fifteen_min/index.html @@ -1,13 +1,13 @@ game::devtools::fifteen_min - Rust

[][src]Module game::devtools::fifteen_min

This is a tool to experiment with the concept of 15-minute neighborhoods. Can you access your + Change settings

[][src]Module game::devtools::fifteen_min

This is a tool to experiment with the concept of 15-minute neighborhoods. Can you access your daily needs (like groceries, a cafe, a library) within a 15-minute walk, bike ride, or public transit ride of your home?

See https://github.com/dabreegster/abstreet/issues/393 for more context.

Modules

isochrone

Structs

-
Viewer

This is the UI state for exploring the isochrone/walkshed from a single building.

+
HoverOnBuilding
Viewer

This is the UI state for exploring the isochrone/walkshed from a single building.

Functions

build_panel
draw_star

Draw a star on the start building.

\ No newline at end of file diff --git a/rustdoc/game/devtools/fifteen_min/sidebar-items.js b/rustdoc/game/devtools/fifteen_min/sidebar-items.js index 8fee219e6b..bb22049a6c 100644 --- a/rustdoc/game/devtools/fifteen_min/sidebar-items.js +++ b/rustdoc/game/devtools/fifteen_min/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["build_panel",""],["draw_star","Draw a star on the start building."]],"mod":[["isochrone",""]],"struct":[["Viewer","This is the UI state for exploring the isochrone/walkshed from a single building."]]}); \ No newline at end of file +initSidebarItems({"fn":[["build_panel",""],["draw_star","Draw a star on the start building."]],"mod":[["isochrone",""]],"struct":[["HoverOnBuilding",""],["Viewer","This is the UI state for exploring the isochrone/walkshed from a single building."]]}); \ No newline at end of file diff --git a/rustdoc/game/devtools/fifteen_min/struct.HoverOnBuilding.html b/rustdoc/game/devtools/fifteen_min/struct.HoverOnBuilding.html new file mode 100644 index 0000000000..7fd58924ad --- /dev/null +++ b/rustdoc/game/devtools/fifteen_min/struct.HoverOnBuilding.html @@ -0,0 +1,36 @@ +game::devtools::fifteen_min::HoverOnBuilding - Rust + +

[][src]Struct game::devtools::fifteen_min::HoverOnBuilding

struct HoverOnBuilding {
+    id: BuildingID,
+    tooltip: Text,
+}

+ Fields

id: BuildingIDtooltip: Text

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

\ No newline at end of file diff --git a/rustdoc/game/devtools/fifteen_min/struct.Viewer.html b/rustdoc/game/devtools/fifteen_min/struct.Viewer.html index bd5d6bfd24..c53883bd01 100644 --- a/rustdoc/game/devtools/fifteen_min/struct.Viewer.html +++ b/rustdoc/game/devtools/fifteen_min/struct.Viewer.html @@ -1,15 +1,16 @@ game::devtools::fifteen_min::Viewer - Rust -

[][src]Struct game::devtools::fifteen_min::Viewer

pub struct Viewer {
+

[][src]Struct game::devtools::fifteen_min::Viewer

pub struct Viewer {
     panel: Panel,
     highlight_start: Drawable,
     isochrone: Isochrone,
+    hovering_on_bldg: Option<HoverOnBuilding>,
 }

This is the UI state for exploring the isochrone/walkshed from a single building.

- Fields

panel: Panelhighlight_start: Drawableisochrone: Isochrone

Implementations

impl Viewer[src]

pub fn random_start(ctx: &mut EventCtx<'_>, app: &App) -> Box<dyn State<App>>[src]

Start with a random building

-

pub fn new(
    ctx: &mut EventCtx<'_>,
    app: &App,
    start: BuildingID
) -> Box<dyn State<App>>
[src]

Trait Implementations

impl State<App> for Viewer[src]

 //! This is a tool to experiment with the concept of 15-minute neighborhoods. Can you access your
 //! daily needs (like groceries, a cafe, a library) within a 15-minute walk, bike ride, or public
@@ -166,6 +197,14 @@
     panel: Panel,
     highlight_start: Drawable,
     isochrone: Isochrone,
+
+    hovering_on_bldg: Option<HoverOnBuilding>,
+}
+
+struct HoverOnBuilding {
+    id: BuildingID,
+    tooltip: Text,
+    // TODO Draw a route preview
 }
 
 impl Viewer {
@@ -186,6 +225,8 @@
             panel,
             highlight_start: highlight_start,
             isochrone,
+
+            hovering_on_bldg: None,
         })
     }
 }
@@ -195,9 +236,27 @@
         // Allow panning and zooming
         ctx.canvas_movement();
 
+        if ctx.redo_mouseover() {
+            self.hovering_on_bldg = match app.mouseover_unzoomed_buildings(ctx) {
+                Some(ID::Building(id)) => Some(HoverOnBuilding {
+                    id,
+                    tooltip: if let Some(time) = self.isochrone.time_to_reach_building.get(&id) {
+                        Text::from(Line(format!("{} away", time)))
+                    } else {
+                        Text::from(Line("This is more than 15 minutes away"))
+                    },
+                }),
+                _ => None,
+            };
+
+            // Also update this to conveniently get an outline drawn
+            app.primary.current_selection =
+                self.hovering_on_bldg.as_ref().map(|h| ID::Building(h.id));
+        }
+
         if ctx.input.left_mouse_button_pressed() {
-            if let Some(ID::Building(start)) = app.mouseover_unzoomed_buildings(ctx) {
-                let start = app.primary.map.get_b(start);
+            if let Some(ref hover) = self.hovering_on_bldg {
+                let start = app.primary.map.get_b(hover.id);
                 self.isochrone = Isochrone::new(ctx, app, start.id);
                 self.highlight_start = draw_star(ctx, start.polygon.center());
                 self.panel = build_panel(ctx, start, &self.isochrone);
@@ -239,6 +298,9 @@
         g.redraw(&self.isochrone.draw);
         g.redraw(&self.highlight_start);
         self.panel.draw(g);
+        if let Some(ref hover) = self.hovering_on_bldg {
+            g.draw_mouse_tooltip(hover.tooltip.clone());
+        }
     }
 }
 
diff --git a/rustdoc/src/game/home/runner/work/abstreet/abstreet/target/debug/build/game-bbdb22a3d9582b8a/out/built.rs.html b/rustdoc/src/game/home/runner/work/abstreet/abstreet/target/debug/build/game-bbdb22a3d9582b8a/out/built.rs.html
index a580dd28f3..5664ff1bfc 100644
--- a/rustdoc/src/game/home/runner/work/abstreet/abstreet/target/debug/build/game-bbdb22a3d9582b8a/out/built.rs.html
+++ b/rustdoc/src/game/home/runner/work/abstreet/abstreet/target/debug/build/game-bbdb22a3d9582b8a/out/built.rs.html
@@ -114,7 +114,7 @@
 /// The output of `rustdoc -V`
 pub const RUSTDOC_VERSION: &str = "rustdoc 1.48.0 (7eac88abb 2020-11-16)";
 /// The built-time in RFC2822, UTC
-pub const BUILT_TIME_UTC: &str = "Sat, 21 Nov 2020 21:02:09 +0000";
+pub const BUILT_TIME_UTC: &str = "Sat, 21 Nov 2020 21:36:40 +0000";
 /// The target architecture, given by `cfg!(target_arch)`.
 pub const CFG_TARGET_ARCH: &str = "x86_64";
 /// The endianness, given by `cfg!(target_endian)`.