mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-11 08:15:34 +03:00
open info panels focus on peope better, even inside buildings. and dont focus on parked cars.
This commit is contained in:
parent
57240b9b6d
commit
5ea58c0e49
@ -7,7 +7,7 @@ use ezgui::{
|
||||
};
|
||||
use geom::{Circle, Distance, Polygon, Pt2D, Statistic, Time};
|
||||
use map_model::{BusRouteID, BusStopID};
|
||||
use sim::CarID;
|
||||
use sim::{AgentID, CarID};
|
||||
|
||||
pub fn stop(ctx: &mut EventCtx, app: &App, details: &mut Details, id: BusStopID) -> Vec<Widget> {
|
||||
let mut rows = vec![];
|
||||
@ -80,7 +80,7 @@ pub fn bus_delays(ctx: &mut EventCtx, app: &App, details: &mut Details, id: CarI
|
||||
}
|
||||
|
||||
fn bus_header(
|
||||
ctx: &EventCtx,
|
||||
ctx: &mut EventCtx,
|
||||
app: &App,
|
||||
details: &mut Details,
|
||||
id: CarID,
|
||||
@ -88,6 +88,14 @@ fn bus_header(
|
||||
) -> Vec<Widget> {
|
||||
let route = app.primary.sim.bus_route_id(id).unwrap();
|
||||
|
||||
if let Some(pt) = app
|
||||
.primary
|
||||
.sim
|
||||
.canonical_pt_for_agent(AgentID::Car(id), &app.primary.map)
|
||||
{
|
||||
ctx.canvas.center_on_map_pt(pt);
|
||||
}
|
||||
|
||||
let mut rows = vec![];
|
||||
rows.push(Widget::row(vec![
|
||||
Line(format!(
|
||||
|
@ -287,15 +287,6 @@ impl InfoPanel {
|
||||
}
|
||||
}
|
||||
|
||||
// Follow the agent. When the sim is paused, this lets the player naturally pan away,
|
||||
// because the InfoPanel isn't being updated.
|
||||
if let Some(pt) = maybe_id
|
||||
.and_then(|id| id.agent_id())
|
||||
.and_then(|a| app.primary.sim.canonical_pt_for_agent(a, &app.primary.map))
|
||||
{
|
||||
ctx.canvas.center_on_map_pt(pt);
|
||||
}
|
||||
|
||||
InfoPanel {
|
||||
tab,
|
||||
time: app.primary.sim.time(),
|
||||
|
@ -174,7 +174,7 @@ pub fn trips(
|
||||
}
|
||||
|
||||
pub fn bio(
|
||||
ctx: &EventCtx,
|
||||
ctx: &mut EventCtx,
|
||||
app: &App,
|
||||
details: &mut Details,
|
||||
id: PersonID,
|
||||
@ -266,7 +266,7 @@ pub fn parked_car(ctx: &EventCtx, app: &App, details: &mut Details, id: CarID) -
|
||||
}
|
||||
|
||||
fn header(
|
||||
ctx: &EventCtx,
|
||||
ctx: &mut EventCtx,
|
||||
app: &App,
|
||||
details: &mut Details,
|
||||
id: PersonID,
|
||||
@ -277,6 +277,8 @@ fn header(
|
||||
|
||||
let (current_trip, (descr, maybe_icon)) = match app.primary.sim.get_person(id).state {
|
||||
PersonState::Inside(b) => {
|
||||
ctx.canvas
|
||||
.center_on_map_pt(app.primary.map.get_b(b).label_center);
|
||||
building::draw_occupants(details, app, b, Some(id));
|
||||
(
|
||||
None,
|
||||
@ -285,18 +287,28 @@ fn header(
|
||||
}
|
||||
PersonState::Trip(t) => (
|
||||
Some(t),
|
||||
match app.primary.sim.trip_to_agent(t).ok() {
|
||||
Some(AgentID::Pedestrian(_)) => (
|
||||
"walking",
|
||||
Some("../data/system/assets/meters/pedestrian.svg"),
|
||||
),
|
||||
Some(AgentID::Car(c)) => match c.1 {
|
||||
VehicleType::Car => ("driving", Some("../data/system/assets/meters/car.svg")),
|
||||
VehicleType::Bike => ("biking", Some("../data/system/assets/meters/bike.svg")),
|
||||
VehicleType::Bus => unreachable!(),
|
||||
},
|
||||
if let Some(a) = app.primary.sim.trip_to_agent(t).ok() {
|
||||
if let Some(pt) = app.primary.sim.canonical_pt_for_agent(a, &app.primary.map) {
|
||||
ctx.canvas.center_on_map_pt(pt);
|
||||
}
|
||||
match a {
|
||||
AgentID::Pedestrian(_) => (
|
||||
"walking",
|
||||
Some("../data/system/assets/meters/pedestrian.svg"),
|
||||
),
|
||||
AgentID::Car(c) => match c.1 {
|
||||
VehicleType::Car => {
|
||||
("driving", Some("../data/system/assets/meters/car.svg"))
|
||||
}
|
||||
VehicleType::Bike => {
|
||||
("biking", Some("../data/system/assets/meters/bike.svg"))
|
||||
}
|
||||
VehicleType::Bus => unreachable!(),
|
||||
},
|
||||
}
|
||||
} else {
|
||||
// TODO Really should clean up the TripModeChange issue
|
||||
None => ("...", None),
|
||||
("...", None)
|
||||
},
|
||||
),
|
||||
PersonState::OffMap => (None, ("off map", None)),
|
||||
|
Loading…
Reference in New Issue
Block a user