fixing pedestrian mouseover

This commit is contained in:
Dustin Carlino 2018-07-14 13:35:53 -05:00
parent 9ce7309c3e
commit f54d581016
2 changed files with 6 additions and 12 deletions

View File

@ -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));
}

View File

@ -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,
)
}
}