// Map, wardley map editor for linux // Copyright (C) 2026 Rubén Beltrán del Río // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . use relm4::prelude::*; use crate::AppModel; use crate::components::footer::FooterAction; 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(); model.footer.emit(FooterAction::SetZoom(level)); } /// 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 { zoom(model, new_zoom); } } /// Increases zoom by one step if below maximum. pub fn zoom_in(model: &mut AppModel) { if model.zoom < constants::MAX_ZOOM { zoom(model, model.zoom + constants::ZOOM_STEP); } }