Fix crash on Windows when minimizing window

This commit is contained in:
Dustin Carlino 2020-09-28 19:23:54 -07:00
parent 823297b71e
commit e7e3a30a25

View File

@ -123,7 +123,9 @@ impl Minimap {
// size at startup is incorrect and immediately corrected by the window manager after
// Minimap::new happens.
let bounds = app.primary.map.get_bounds();
self.base_zoom = 0.15 * ctx.canvas.window_width / bounds.width().min(bounds.height());
// On Windows, apparently minimizing can cause some resize events with 0, 0 dimensions!
self.base_zoom =
(0.15 * ctx.canvas.window_width / bounds.width().min(bounds.height())).max(0.0001);
self.zoom = self.base_zoom;
if self.zoomed {
self.recenter(ctx, app);