Put a loading screen around the freehand block selection, since it's painfully slow due to
@@ -191,6 +191,8 @@ impl SelectBoundary {
}
fn add_blocks_freehand(&mut self, ctx: &mut EventCtx, app: &mut App, lasso_polygon: Polygon) {
+ ctx.loading_screen("expand current neighborhood boundary", |ctx, timer| {
+ timer.start("find matching blocks");
// Find all of the blocks within the polygon
let mut add_blocks = Vec::new();
for (id, block) in app.session.partitioning.all_single_blocks() {
@@ -200,8 +202,11 @@ impl SelectBoundary {
}
}
}
+ timer.stop("find matching blocks");
while !add_blocks.is_empty() {
+ let span = format!("try to add {} blocks", add_blocks.len());
+ timer.start(&span);
// Proceed in rounds. Calculate the current frontier, find all of the blocks in there,
// try to add them, repeat.
//
@@ -225,6 +230,7 @@ impl SelectBoundary {
still_todo.push(block_id);
}
}
+ timer.stop(&span);
if changed {
add_blocks = still_todo;
self.frontier = app.session.partitioning.calculate_frontier(
@@ -246,6 +252,7 @@ impl SelectBoundary {
self.add_block(ctx, app, id);
}
self.redraw_outline(ctx, app.session.partitioning.neighborhood_block(self.id));
+ });
}
}
