diff --git a/src/camera.rs b/src/camera.rs index 468e4de..32168a5 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -138,10 +138,10 @@ pub fn update_map_camera( // Update zoom level if keyboard_input.pressed(settings.key_map_zoom_out) { - mapcam.target_zoom_level *= 1.1; + mapcam.target_zoom_level = (mapcam.target_zoom_level * 1.1).min(17e18); } if keyboard_input.pressed(settings.key_map_zoom_in) { - mapcam.target_zoom_level /= 1.1; + mapcam.target_zoom_level = (mapcam.target_zoom_level / 1.1).max(2.0); } let zoom_speed = 0.05; // should be between 0.0001 (slow) and 1.0 (instant) mapcam.zoom_level = zoom_speed * mapcam.target_zoom_level + (1.0 - zoom_speed) * mapcam.zoom_level;