slightly refactor some zoom stuff

This commit is contained in:
Dustin Carlino 2018-06-22 10:50:38 -07:00
parent d54bce01ac
commit 915ad9f7fe
3 changed files with 27 additions and 16 deletions

15
POLISH.md Normal file
View File

@ -0,0 +1,15 @@
# Polish
Overlapping with TODO.md and docs/backlog.md, we have... a new list of visible
things needing polish!
- sometimes UI zooms in at once, then unzooms slowly
- sidewalk paths start in building centers and end in sidewalk centers
- this is probably fine to show agents moving, but at least draw
building layer before sidewalk layer
- the colors are awful
- different lane markings
- sidewalks with little horizontal lines
- parking with... circled P's and maybe partial horizontal lines to
show spots?
- copy the green Seattle color scheme for bike lanes

View File

@ -71,7 +71,6 @@
- line type / ditch vec2d / settle on types
- one-at-a-time UI plugins
- UI plugins track their own active state
- UI colors in one place
- cleaner pipeline of map construction

View File

@ -131,15 +131,8 @@ impl UI {
}
}
// TODO or make a custom event for zoom change
let old_zoom = -1.0;
let new_zoom = ui.canvas.cam_zoom;
ui.show_roads.handle_zoom(old_zoom, new_zoom);
ui.show_buildings.handle_zoom(old_zoom, new_zoom);
ui.show_intersections.handle_zoom(old_zoom, new_zoom);
ui.show_parcels.handle_zoom(old_zoom, new_zoom);
ui.show_icons.handle_zoom(old_zoom, new_zoom);
ui.debug_mode.handle_zoom(old_zoom, new_zoom);
ui.zoom_for_toggleable_layers(-1.0, new_zoom);
ui
}
@ -199,13 +192,7 @@ impl UI {
let old_zoom = self.canvas.cam_zoom;
self.canvas.handle_event(input.use_event_directly());
let new_zoom = self.canvas.cam_zoom;
self.show_roads.handle_zoom(old_zoom, new_zoom);
self.show_buildings.handle_zoom(old_zoom, new_zoom);
self.show_intersections.handle_zoom(old_zoom, new_zoom);
self.show_parcels.handle_zoom(old_zoom, new_zoom);
self.show_icons.handle_zoom(old_zoom, new_zoom);
self.debug_mode.handle_zoom(old_zoom, new_zoom);
self.zoom_for_toggleable_layers(old_zoom, new_zoom);
if !edit_mode {
if self.show_roads.handle_event(input) {
@ -399,6 +386,16 @@ impl UI {
self.canvas.draw_osd_notification(g, &osd_lines);
}
// TODO or make a custom event for zoom change
fn zoom_for_toggleable_layers(&mut self, old_zoom: f64, new_zoom: f64) {
self.show_roads.handle_zoom(old_zoom, new_zoom);
self.show_buildings.handle_zoom(old_zoom, new_zoom);
self.show_intersections.handle_zoom(old_zoom, new_zoom);
self.show_parcels.handle_zoom(old_zoom, new_zoom);
self.show_icons.handle_zoom(old_zoom, new_zoom);
self.debug_mode.handle_zoom(old_zoom, new_zoom);
}
fn mouseover_something(&self, window_size: &Size) -> Option<ID> {
let (x, y) = self.canvas.get_cursor_in_map_space();