mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 03:35:51 +03:00
Use a larger hitbox for selecting pedestrians and bicycles.
This commit is contained in:
parent
4c1d610e4f
commit
e28b66cb5c
@ -1,10 +1,10 @@
|
||||
use geom::{ArrowCap, Circle, Distance, Line, PolyLine, Polygon};
|
||||
use geom::{ArrowCap, Circle, Distance, Line, PolyLine, Polygon, Pt2D};
|
||||
use map_model::{Map, SIDEWALK_THICKNESS};
|
||||
use sim::{CarID, DrawCarInput};
|
||||
use widgetry::{Drawable, GeomBatch, GfxCtx, Prerender};
|
||||
|
||||
use crate::colors::ColorScheme;
|
||||
use crate::render::{DrawOptions, Renderable};
|
||||
use crate::render::{DrawOptions, Renderable, OUTLINE_THICKNESS};
|
||||
use crate::{AppLike, ID};
|
||||
|
||||
pub struct DrawBike {
|
||||
@ -120,8 +120,13 @@ impl Renderable for DrawBike {
|
||||
}
|
||||
|
||||
fn get_outline(&self, _: &Map) -> Polygon {
|
||||
// TODO ideally a thin ring
|
||||
self.body_circle.to_polygon()
|
||||
Circle::new(self.body_circle.center, Distance::meters(2.0))
|
||||
.to_outline(OUTLINE_THICKNESS)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn contains_pt(&self, pt: Pt2D, _: &Map) -> bool {
|
||||
Circle::new(self.body_circle.center, Distance::meters(2.0)).contains_pt(pt)
|
||||
}
|
||||
|
||||
fn get_zorder(&self) -> isize {
|
||||
|
@ -1,4 +1,4 @@
|
||||
use geom::{ArrowCap, Circle, Distance, PolyLine, Polygon};
|
||||
use geom::{ArrowCap, Circle, Distance, PolyLine, Polygon, Pt2D};
|
||||
use map_model::{DrivingSide, Map, SIDEWALK_THICKNESS};
|
||||
use sim::{DrawPedCrowdInput, DrawPedestrianInput, PedCrowdLocation, PedestrianID};
|
||||
use widgetry::{Color, Drawable, GeomBatch, GfxCtx, Line, Prerender, Text};
|
||||
@ -177,8 +177,13 @@ impl Renderable for DrawPedestrian {
|
||||
}
|
||||
|
||||
fn get_outline(&self, _: &Map) -> Polygon {
|
||||
// TODO thin ring
|
||||
self.body_circle.to_polygon()
|
||||
Circle::new(self.body_circle.center, Distance::meters(2.0))
|
||||
.to_outline(OUTLINE_THICKNESS)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn contains_pt(&self, pt: Pt2D, _: &Map) -> bool {
|
||||
Circle::new(self.body_circle.center, Distance::meters(2.0)).contains_pt(pt)
|
||||
}
|
||||
|
||||
fn get_zorder(&self) -> isize {
|
||||
|
Loading…
Reference in New Issue
Block a user