blob: 3acbb2c1d9fce82df9feaededc11ac82596ff28a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
use crate::AppModel;
use crate::constants;
/// Sets the zoom level and updates the rendered image.
pub fn zoom(model: &mut AppModel, level: f64) {
model.zoom = level;
model.update_image();
}
/// Decreases zoom by one step if above minimum.
pub fn zoom_out(model: &mut AppModel) {
let new_zoom = model.zoom - constants::ZOOM_STEP;
if new_zoom >= constants::MIN_ZOOM {
model.zoom = new_zoom;
model.update_image();
}
}
/// Increases zoom by one step if below maximum.
pub fn zoom_in(model: &mut AppModel) {
if model.zoom < constants::MAX_ZOOM {
model.zoom += constants::ZOOM_STEP;
model.update_image();
}
}
|