mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 12:12:00 +03:00
fixing pedestrian mouseover
This commit is contained in:
parent
9ce7309c3e
commit
f54d581016
@ -211,17 +211,6 @@ impl UI {
|
||||
|
||||
if self.show_roads.is_enabled() {
|
||||
for r in &roads_onscreen {
|
||||
for c in &self.sim_ctrl.sim.get_draw_cars_on_road(r.id, &self.map) {
|
||||
if c.contains_pt(x, y) {
|
||||
return Some(ID::Car(c.id));
|
||||
}
|
||||
}
|
||||
for p in &self.sim_ctrl.sim.get_draw_peds_on_road(r.id, &self.map) {
|
||||
if p.contains_pt(x, y) {
|
||||
return Some(ID::Pedestrian(p.id));
|
||||
}
|
||||
}
|
||||
|
||||
if r.road_contains_pt(x, y) {
|
||||
return Some(ID::Road(r.id));
|
||||
}
|
||||
|
@ -26,6 +26,11 @@ impl DrawPedestrian {
|
||||
}
|
||||
|
||||
pub fn contains_pt(&self, x: f64, y: f64) -> bool {
|
||||
geometry::point_in_circle(x, y, [self.circle[0], self.circle[1]], RADIUS)
|
||||
geometry::point_in_circle(
|
||||
x,
|
||||
y,
|
||||
[self.circle[0] + RADIUS, self.circle[1] + RADIUS],
|
||||
RADIUS,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user