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(); } }