Add a width spinner to map_editor to easily play around with possible new implementations of PolyLine shifting/thickening
@@ -130,6 +130,10 @@ impl EditRoad {
Choice::strings(vec!["both", "none", "left", "right"]),
),
]),
+ Widget::row(vec![
+ "Width scale".text_widget(ctx).margin_right(20),
+ Spinner::widget(ctx, "width_scale", (0.5, 10.0), 1.0, 0.5),
+ ]),
]);
let col = vec![
@@ -211,6 +215,10 @@ impl SimpleState<App> for EditRoad {
road.lane_specs_ltr =
osm2streets::get_lane_specs_ltr(&road.osm_tags, &app.model.map.streets.config);
+ let scale = panel.spinner("width_scale");
+ for lane in &mut road.lane_specs_ltr {
+ lane.width *= scale;
+ }
app.model.road_added(ctx, self.r);
Transition::Pop
@@ -219,6 +227,24 @@ impl SimpleState<App> for EditRoad {
}
}
+ fn panel_changed(
+ &mut self,
+ ctx: &mut EventCtx,
+ app: &mut App,
+ panel: &mut Panel,
+ ) -> Option<Transition<App>> {
+ let scale = panel.spinner("width_scale");
+ app.model.road_deleted(self.r);
+ let road = app.model.map.streets.roads.get_mut(&self.r).unwrap();
+ road.lane_specs_ltr =
+ osm2streets::get_lane_specs_ltr(&road.osm_tags, &app.model.map.streets.config);
+ for lane in &mut road.lane_specs_ltr {
+ lane.width *= scale;
+ }
+ app.model.road_added(ctx, self.r);
+ Some(Transition::Keep)
+ }
+
fn other_event(&mut self, ctx: &mut EventCtx, _: &mut App) -> Transition<App> {
ctx.canvas_movement();
Transition::Keep
