From a91359a66f49cb9bb45ff106168ee14136da1c30 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Mon, 30 Jul 2018 20:45:23 -0700 Subject: [PATCH] render buildings earlier so paths dont overlap sidewalks --- editor/src/plugins/sim_controls.rs | 1 + editor/src/plugins/warp.rs | 4 ++++ editor/src/ui.rs | 19 ++++++++++--------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/editor/src/plugins/sim_controls.rs b/editor/src/plugins/sim_controls.rs index 8d26c1be13..9ae2f15b0d 100644 --- a/editor/src/plugins/sim_controls.rs +++ b/editor/src/plugins/sim_controls.rs @@ -46,6 +46,7 @@ impl SimController { } if input.unimportant_key_pressed(Key::P, "load sim state") { self.sim = abstutil::read_json("sim_state").expect("sim state failed"); + println!("Loaded sim_state"); } if self.last_step.is_some() { if input.unimportant_key_pressed(Key::Space, "pause sim") { diff --git a/editor/src/plugins/warp.rs b/editor/src/plugins/warp.rs index a908a60714..8ac3d748ac 100644 --- a/editor/src/plugins/warp.rs +++ b/editor/src/plugins/warp.rs @@ -59,21 +59,25 @@ fn warp(line: String, map: &Map, canvas: &mut Canvas, selection_state: &mut Sele Ok(idx) => match line.chars().next().unwrap() { 'l' => { let id = LaneID(idx); + println!("Warping to {}", id); *selection_state = SelectionState::SelectedLane(id, None); map.get_l(id).first_pt() } 'i' => { let id = IntersectionID(idx); + println!("Warping to {}", id); *selection_state = SelectionState::SelectedIntersection(id); map.get_i(id).point } 'b' => { let id = BuildingID(idx); + println!("Warping to {}", id); *selection_state = SelectionState::SelectedBuilding(id); geometry::center(&map.get_b(id).points) } 'p' => { let id = ParcelID(idx); + println!("Warping to {}", id); geometry::center(&map.get_p(id).points) } _ => { diff --git a/editor/src/ui.rs b/editor/src/ui.rs index 1803b65859..ea1b181387 100644 --- a/editor/src/ui.rs +++ b/editor/src/ui.rs @@ -558,15 +558,7 @@ impl gui::GUI for UI { } } - for l in &lanes_onscreen { - for c in &self.sim_ctrl.sim.get_draw_cars_on_lane(l.id, &self.map) { - c.draw(g, self.color_car(c.id)); - } - for p in &self.sim_ctrl.sim.get_draw_peds_on_lane(l.id, &self.map) { - p.draw(g, self.color_ped(p.id)); - } - } - + // Building paths overlap sidewalks, so do these first to not look messy if self.show_buildings.is_enabled() { for b in &self.draw_map .get_buildings_onscreen(screen_bbox, &self.hider) @@ -579,6 +571,15 @@ impl gui::GUI for UI { } } + for l in &lanes_onscreen { + for c in &self.sim_ctrl.sim.get_draw_cars_on_lane(l.id, &self.map) { + c.draw(g, self.color_car(c.id)); + } + for p in &self.sim_ctrl.sim.get_draw_peds_on_lane(l.id, &self.map) { + p.draw(g, self.color_ped(p.id)); + } + } + self.current_selection_state.draw( &self.map, &self.canvas,