Seemingly fix the first screenshot of some maps by double drawing the first tile. Not sure what the problem is or why this appears to fix it.
@@ -31,8 +31,6 @@ pub(crate) fn screenshot_everything<A: SharedAppState>(
state.canvas.cam_zoom = zoom;
std::fs::create_dir_all(dir_path)?;
- // TODO Sometimes the very first image captured is of the debug mode used to launch this. Not
- // sure why, and it's not so reproducible.
for tile_y in 0..num_tiles_y {
for tile_x in 0..num_tiles_x {
timer.next();
@@ -40,6 +38,13 @@ pub(crate) fn screenshot_everything<A: SharedAppState>(
state.canvas.cam_y = (tile_y as f64) * dims.height;
let suffix = state.draw(prerender, true).unwrap_or_else(String::new);
+
+ // Sometimes the very first image captured is of the debug mode used to launch this. Not
+ // sure why, and it's not so reproducible. But double-drawing seems to help.
+ if tile_x == 0 && tile_y == 0 {
+ state.draw(prerender, true);
+ }
+
let filename = if leaflet_naming {
format!("{}/{}_{}.png", dir_path, tile_x, tile_y)
} else {
