diff --git a/Cargo.toml b/Cargo.toml index 550b72e802..f342838faa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,6 +45,7 @@ abstutil = { path = "abstutil" } polylabel = { git = "https://github.com/urschrei/polylabel-rs", rev = "b919b8587b491b9a952a6d4c0670558bfd38e034" } # To temporarily work on dependencies locally, uncomment this +# TODO Do not commit. Update each repo [patch."https://github.com/a-b-street/osm2streets"] import_streets = { path = "/home/dabreegster/osm2streets/import_streets" } street_network = { path = "/home/dabreegster/osm2streets/street_network" } diff --git a/apps/santa/src/game.rs b/apps/santa/src/game.rs index 96086c4729..529798199a 100644 --- a/apps/santa/src/game.rs +++ b/apps/santa/src/game.rs @@ -136,15 +136,13 @@ impl Game { // TODO I couldn't quite work out how to get the partial outline from Figma working let center = Pt2D::new(0.0, 0.0); let outer = Distance::meters(30.0); - let draw = GeomBatch::from(vec![ - (Color::WHITE, Circle::new(center, outer).to_polygon()), - ( - Color::hex("#5D92C2"), - Circle::new(center, outer).to_partial_polygon(pct), - ), - ]) - .autocrop() - .into_widget(ctx); + let mut batch = GeomBatch::new(); + batch.push(Color::WHITE, Circle::new(center, outer).to_polygon()); + batch.push( + Color::hex("#5D92C2"), + Circle::new(center, outer).to_partial_tessellation(pct), + ); + let draw = batch.autocrop().into_widget(ctx); self.time_panel.replace(ctx, "time circle", draw); } diff --git a/geom/src/circle.rs b/geom/src/circle.rs index ee4c1fb2f0..c63d77113c 100644 --- a/geom/src/circle.rs +++ b/geom/src/circle.rs @@ -42,9 +42,8 @@ impl Circle { self.to_ring().into_polygon() } - /// Renders some percent, between [0, 1], of the circle as a polygon. The polygon starts from 0 - /// degrees. - pub fn to_partial_polygon(&self, percent_full: f64) -> Polygon { + /// Renders some percent, between [0, 1], of the circle. The shape starts from 0 degrees. + pub fn to_partial_tessellation(&self, percent_full: f64) -> Tessellation { #![allow(clippy::float_cmp)] assert!((0. ..=1.).contains(&percent_full)); let mut pts = vec![self.center]; @@ -65,11 +64,7 @@ impl Circle { indices.pop(); } } - // TODO use to_ring? urgh - Polygon::pretessellated( - vec![Ring::must_new(pts.clone())], - Tessellation::new(pts, indices), - ) + Tessellation::new(pts, indices) } /// Returns the ring around the circle. diff --git a/map_gui/src/render/traffic_signal.rs b/map_gui/src/render/traffic_signal.rs index 68bc9f410f..01e3381097 100644 --- a/map_gui/src/render/traffic_signal.rs +++ b/map_gui/src/render/traffic_signal.rs @@ -244,7 +244,7 @@ fn draw_time_left( ); batch.push( app.cs().signal_spinner, - Circle::new(center, radius).to_partial_polygon(percent), + Circle::new(center, radius).to_partial_tessellation(percent), ); batch.append( Text::from(format!("{}", idx + 1))