From c2ddb7587b48a95c877f115af2d982a3daff465a Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Mon, 22 Apr 2019 12:39:09 -0700 Subject: [PATCH] make neighborhood polygon points easier to see and manipulate at all zoom levels --- editor/src/plugins/edit/draw_neighborhoods.rs | 35 ++++++++----------- editor/src/ui.rs | 2 +- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/editor/src/plugins/edit/draw_neighborhoods.rs b/editor/src/plugins/edit/draw_neighborhoods.rs index 8e81e7119f..7468a99faa 100644 --- a/editor/src/plugins/edit/draw_neighborhoods.rs +++ b/editor/src/plugins/edit/draw_neighborhoods.rs @@ -4,7 +4,7 @@ use ezgui::{Color, GfxCtx, Key, Wizard, WrappedWizard}; use geom::{Circle, Distance, Line, Polygon, Pt2D}; use map_model::{Map, NeighborhoodBuilder}; -const POINT_RADIUS: Distance = Distance::const_meters(2.0); +const POINT_RADIUS: Distance = Distance::const_meters(10.0); pub enum DrawNeighborhoodState { PickNeighborhood(Wizard), @@ -65,8 +65,11 @@ impl BlockingPlugin for DrawNeighborhoodState { if let Some(cursor) = ctx.canvas.get_cursor_in_map_space() { *current_idx = n.points.iter().position(|pt| { - Circle::new(Pt2D::from_gps(*pt, gps_bounds).unwrap(), POINT_RADIUS) - .contains_pt(cursor) + Circle::new( + Pt2D::from_gps(*pt, gps_bounds).unwrap(), + POINT_RADIUS / ctx.canvas.cam_zoom, + ) + .contains_pt(cursor) }); } else { *current_idx = None; @@ -135,24 +138,16 @@ impl BlockingPlugin for DrawNeighborhoodState { &Polygon::new(&pts), ); } - for pt in &pts { - g.draw_circle( - ctx.cs.get("neighborhood point"), - &Circle::new(*pt, POINT_RADIUS), - ); - } - if let Some(last) = pts.last() { - g.draw_circle( + for (idx, pt) in pts.iter().enumerate() { + let color = if Some(idx) == current_idx { + ctx.cs.get_def("neighborhood point to move", Color::CYAN) + } else if idx == pts.len() - 1 { ctx.cs - .get_def("neighborhood last placed point", Color::GREEN), - &Circle::new(*last, POINT_RADIUS), - ); - } - if let Some(idx) = current_idx { - g.draw_circle( - ctx.cs.get_def("neighborhood point to move", Color::CYAN), - &Circle::new(pts[idx], POINT_RADIUS), - ); + .get_def("neighborhood last placed point", Color::GREEN) + } else { + ctx.cs.get("neighborhood point") + }; + g.draw_circle(color, &Circle::new(*pt, POINT_RADIUS / g.canvas.cam_zoom)); } } } diff --git a/editor/src/ui.rs b/editor/src/ui.rs index 76ccf66078..3049352494 100644 --- a/editor/src/ui.rs +++ b/editor/src/ui.rs @@ -133,7 +133,7 @@ impl GUI for UI { "Neighborhood Editor", vec![ (Key::Enter, "save"), - (Key::Escape, "quit"), + (Key::Q, "quit"), (Key::X, "export as an Osmosis polygon filter"), (Key::P, "add a new point"), ],