From 3f1abda5e2ec44ecaec38c349626b9083ca42f83 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Sat, 27 Mar 2021 09:25:06 -0700 Subject: [PATCH] Use chevrons, not arrows, to point uphill, per discussion with Yuwen. #82 --- game/src/layer/elevation.rs | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/game/src/layer/elevation.rs b/game/src/layer/elevation.rs index 3461162607..4c681a3e10 100644 --- a/game/src/layer/elevation.rs +++ b/game/src/layer/elevation.rs @@ -1,5 +1,5 @@ use abstutil::Parallelism; -use geom::{ArrowCap, Distance, FindClosest, PolyLine, Polygon, Pt2D}; +use geom::{Angle, Distance, FindClosest, PolyLine, Polygon, Pt2D}; use map_gui::tools::{ColorDiscrete, ColorScale, Grid}; use map_gui::ID; use widgetry::{Color, Drawable, EventCtx, GeomBatch, GfxCtx, Panel, Text, TextExt, Widget}; @@ -63,7 +63,7 @@ impl SteepStreets { ); let arrow_len = Distance::meters(5.0); - let thickness = Distance::meters(1.0); + let thickness = Distance::meters(2.0); let mut steepest = 0.0_f64; let mut arrows = GeomBatch::new(); for r in app.primary.map.all_roads() { @@ -96,7 +96,7 @@ impl SteepStreets { pl = pl.reversed(); } - let btwn = Distance::meters(10.0); + let btwn = Distance::meters(15.0); let len = pl.length(); let mut dist = arrow_len; @@ -105,10 +105,11 @@ impl SteepStreets { arrows.push( Color::WHITE, PolyLine::must_new(vec![ - pt.project_away(arrow_len / 2.0, angle.opposite()), - pt.project_away(arrow_len / 2.0, angle), + pt.project_away(arrow_len, angle.rotate_degs(-135.0)), + pt, + pt.project_away(arrow_len, angle.rotate_degs(135.0)), ]) - .make_arrow(thickness, ArrowCap::Triangle), + .make_polygons(thickness), ); dist += btwn; } @@ -116,20 +117,20 @@ impl SteepStreets { colorer.unzoomed.append(arrows); let (unzoomed, zoomed, legend) = colorer.build(ctx); + let pt = Pt2D::new(0.0, 0.0); + let panel_arrow = PolyLine::must_new(vec![ + pt.project_away(arrow_len, Angle::degrees(-135.0)), + pt, + pt.project_away(arrow_len, Angle::degrees(135.0)), + ]) + .make_polygons(thickness) + .scale(5.0); let panel = Panel::new(Widget::col(vec![ header(ctx, "Steep streets"), Widget::row(vec![ - GeomBatch::from(vec![( - ctx.style().text_fg_color, - PolyLine::must_new(vec![ - Pt2D::new(0.0, 0.0), - Pt2D::new(arrow_len.inner_meters(), 0.0), - ]) - .make_arrow(thickness, ArrowCap::Triangle) - .scale(10.0), - )]) - .autocrop() - .into_widget(ctx), + GeomBatch::from(vec![(ctx.style().text_fg_color, panel_arrow)]) + .autocrop() + .into_widget(ctx), "points uphill".text_widget(ctx).centered_vert(), ]), legend,