mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-29 17:34:58 +03:00
zoom limits
This commit is contained in:
parent
f6274e566d
commit
1d379e8315
@ -80,7 +80,12 @@ impl Canvas {
|
||||
|
||||
if let Some(scroll) = input.get_mouse_scroll() {
|
||||
let old_zoom = self.cam_zoom;
|
||||
self.cam_zoom = 1.1_f64.powf(old_zoom.log(1.1) + scroll);
|
||||
// By popular request, some limits ;)
|
||||
// TODO But based on map size
|
||||
self.cam_zoom = 1.1_f64
|
||||
.powf(old_zoom.log(1.1) + scroll)
|
||||
.max(0.05)
|
||||
.min(150.0);
|
||||
|
||||
// Make screen_to_map of cursor_{x,y} still point to the same thing after zooming.
|
||||
self.cam_x =
|
||||
|
Loading…
Reference in New Issue
Block a user