aboutsummaryrefslogtreecommitdiff
path: root/src/handlers/zoom.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/handlers/zoom.rs')
-rw-r--r--src/handlers/zoom.rs10
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);
}
}