Recalculate pathfinding before starting the route tool, since we lazily avoid doing that in the other ungap edit modes. This may become unnecessary when the route tool always does Dijkstra's with custom routing params, but we're not there yet, so it crashes currently

This commit is contained in:
Dustin Carlino 2021-08-25 12:31:47 -07:00
parent ae80eb2509
commit 25b5ac2037

View File

@ -17,6 +17,7 @@ use crate::ungap::layers::Layers;
pub struct RoutePlanner {
layers: Layers,
once: bool,
// All of this manages the waypoint input
input_panel: Panel,
@ -60,6 +61,7 @@ impl RoutePlanner {
let mut rp = RoutePlanner {
layers,
once: true,
input_panel: Panel::empty(ctx),
waypoints: Vec::new(),
@ -310,6 +312,15 @@ impl RoutePlanner {
impl State<App> for RoutePlanner {
fn event(&mut self, ctx: &mut EventCtx, app: &mut App) -> Transition {
if self.once {
self.once = false;
ctx.loading_screen("apply edits", |_, mut timer| {
app.primary
.map
.recalculate_pathfinding_after_edits(&mut timer);
});
}
if self.dragging {
if ctx.redo_mouseover() {
self.update_dragging(ctx, app);