diff --git a/Cargo.toml b/Cargo.toml
index f34d2cb..cc6351b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ features = ["gtk4"]
[dependencies.gtk]
package = "gtk4"
version = "0.5.1"
-features = ["v4_6"]
+features = ["v4_8"]
[dependencies.gio]
package = "gio"
diff --git a/data/gtk/help_overlay.ui b/data/gtk/help_overlay.ui
index 13ff07f..7a3ad5d 100644
--- a/data/gtk/help_overlay.ui
+++ b/data/gtk/help_overlay.ui
@@ -38,6 +38,18 @@
<Primary>q
+
+
+
+
+
+
diff --git a/data/gtk/image_page.ui b/data/gtk/image_page.ui
index e5599ff..c19451c 100644
--- a/data/gtk/image_page.ui
+++ b/data/gtk/image_page.ui
@@ -57,45 +57,49 @@
-
-
+
end
+ start
18
18
18
@@ -46,9 +47,19 @@
+
+
+
+
+ end
+ end
+ 18
+ 18
+ 18
+ 18
+ 12
- True
end
@@ -65,6 +76,28 @@
+
+
+ zoom-out-symbolic
+ win.zoom-out
+ Zoom Out
+
+
+
+
+
+ zoom-in-symbolic
+ win.zoom-in
+ Zoom In
+
+
+
diff --git a/src/application.rs b/src/application.rs
index 402760d..fe1b08a 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -161,6 +161,8 @@ impl LpApplication {
self.set_accels_for_action("win.show-help-overlay", &["question"]);
self.set_accels_for_action("win.toggle-fullscreen", &["F11"]);
self.set_accels_for_action("window.close", &["W"]);
+ self.set_accels_for_action("win.zoom-to(1.0)", &["1"]);
+ self.set_accels_for_action("win.zoom-to(2.0)", &["2"]);
}
pub fn show_about(&self) {
diff --git a/src/widgets/image.rs b/src/widgets/image.rs
index caf1ecd..483852c 100644
--- a/src/widgets/image.rs
+++ b/src/widgets/image.rs
@@ -1,4 +1,3 @@
-// image.rs
//
// Copyright 2021 Christopher Davis
//
@@ -23,10 +22,18 @@ use adw::{prelude::*, subclass::prelude::*};
use once_cell::sync::Lazy;
+use once_cell::unsync::OnceCell;
use std::cell::{Cell, RefCell};
use crate::image_metadata::ImageMetadata;
+static ZOOM_ANIMATION_DURATION: u32 = 200;
+static ROTATION_ANIMATION_DURATION: u32 = 200;
+
+static ZOOM_FACTOR_BUTTON: f64 = 1.5;
+static ZOOM_FACTOR_WHEEL: f64 = 1.3;
+static ZOOM_FACTOR_WHEEL_HI_RES: f64 = 0.1;
+
mod imp {
use super::*;
@@ -39,11 +46,44 @@ mod imp {
/// Rotated presentation of original image in degrees clockwise
pub rotation: Cell,
// Animates the `rotation` property
- pub rotation_animation: RefCell