Skip to content

Commit

Permalink
When we can help it, don't shift road polylines twice. #860
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Feb 23, 2022
1 parent 2890e6e commit 95434e9
Show file tree
Hide file tree
Showing 7 changed files with 615 additions and 611 deletions.
7 changes: 2 additions & 5 deletions apps/game/src/edit/roads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,14 +1026,11 @@ fn draw_drop_position(app: &App, r: RoadID, from: usize, to: usize) -> GeomBatch
if from == to {
return batch;
}
let mut width = Distance::ZERO;
let map = &app.primary.map;
let road = map.get_r(r);
let take_num = if from < to { to + 1 } else { to };
for l in road.lanes.iter().take(take_num) {
width += l.width;
}
if let Ok(pl) = road.get_left_side().shift_right(width) {
let width = road.lanes.iter().take(take_num).map(|x| x.width).sum();
if let Ok(pl) = road.shift_from_left_side(width) {
batch.push(app.cs.selected, pl.make_polygons(OUTLINE_THICKNESS));
}
batch
Expand Down
Loading

0 comments on commit 95434e9

Please sign in to comment.