adjust roads when moving intersections

This commit is contained in:
Dustin Carlino 2019-09-17 14:02:02 -07:00
parent e32b540f54
commit ed29a208e4

View File

@ -210,7 +210,15 @@ impl Model {
// Now update all the roads.
for r in self.roads_per_intersection.get(id).clone() {
self.road_deleted(r);
// TODO Do the mutation
let road = self.map.roads.get_mut(&r).unwrap();
if road.i1 == id {
road.center_points[0] = point;
} else {
assert_eq!(road.i2, id);
*road.center_points.last_mut().unwrap() = point;
}
self.road_added(r, prerender);
}
}