mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-27 00:12:55 +03:00
Fix crash on Windows when minimizing window
This commit is contained in:
parent
823297b71e
commit
e7e3a30a25
@ -123,7 +123,9 @@ impl Minimap {
|
|||||||
// size at startup is incorrect and immediately corrected by the window manager after
|
// size at startup is incorrect and immediately corrected by the window manager after
|
||||||
// Minimap::new happens.
|
// Minimap::new happens.
|
||||||
let bounds = app.primary.map.get_bounds();
|
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;
|
self.zoom = self.base_zoom;
|
||||||
if self.zoomed {
|
if self.zoomed {
|
||||||
self.recenter(ctx, app);
|
self.recenter(ctx, app);
|
||||||
|
Loading…
Reference in New Issue
Block a user