diff options
| author | Rubén Beltrán del Río <jj@r.bdr.sh> | 2026-03-26 23:18:11 +0100 |
|---|---|---|
| committer | Rubén Beltrán del Río <jj@r.bdr.sh> | 2026-03-26 23:26:01 +0100 |
| commit | 1f28cbdf1dbe26e4c7da27323a0202a3276cb3a7 (patch) | |
| tree | f5a707ed5671d0345b21c935f5a46099b12b8f19 /src/handlers/zoom.rs | |
| parent | 9a472115e594e28f4e3bd95b10800bf2b690febf (diff) | |
Move footer to its own component
Diffstat (limited to 'src/handlers/zoom.rs')
| -rw-r--r-- | src/handlers/zoom.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/handlers/zoom.rs b/src/handlers/zoom.rs index 575f5f9..59a54a7 100644 --- a/src/handlers/zoom.rs +++ b/src/handlers/zoom.rs @@ -13,28 +13,30 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. +use relm4::prelude::*; + use crate::AppModel; use crate::constants; +use crate::components::footer::FooterAction; /// 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 { - model.zoom = new_zoom; - model.update_image(); + 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 { - model.zoom += constants::ZOOM_STEP; - model.update_image(); + zoom(model, model.zoom + constants::ZOOM_STEP); } } |