Avoid crashing when trying to draw really short turns. Fixes
@@ -46,6 +46,9 @@ impl DrawMovement {
}
} else if stage.yield_movements.contains(&movement.id) {
let pl = &movement.geom;
+ // We currently always assume the turn intersects a crosswalk at the beginning and
+ // end, so draw without overlaps if the polyline is long enough.
+ if pl.length() >= 2.0 * SIDEWALK_THICKNESS {
batch.extend(
Color::BLACK,
pl.exact_slice(
@@ -68,6 +71,20 @@ impl DrawMovement {
ArrowCap::Triangle,
);
batch.extend(cs.signal_protected_turn, arrow.clone());
+ } else {
+ // TODO These turns are often too small to even dash the arrow. So they'll just
+ // look like solid protected turns...
+ warn!("{:?} is too short to render as a yield movement", movement.id);
+ batch.extend(
+ cs.signal_protected_turn,
+ pl.dashed_arrow(
+ BIG_ARROW_THICKNESS / 2.0,
+ Distance::meters(1.0),
+ Distance::meters(0.5),
+ ArrowCap::Triangle,
+ ),
+ );
+ }
// Bit weird, but don't use the dashed arrow as the hitbox. The gaps in between
// should still be clickable.
movement
