diff --git a/data/gtk/image_view.ui b/data/gtk/image_view.ui
index 44159d1..3cfc4b5 100644
--- a/data/gtk/image_view.ui
+++ b/data/gtk/image_view.ui
@@ -45,6 +45,9 @@
+
+
+
@@ -96,6 +99,9 @@
+
+
+
diff --git a/data/gtk/window.ui b/data/gtk/window.ui
index 7e42abc..2fcdb94 100644
--- a/data/gtk/window.ui
+++ b/data/gtk/window.ui
@@ -203,5 +203,12 @@
+
+
+
diff --git a/src/widgets/image_view.rs b/src/widgets/image_view.rs
index d553d7e..4f8e506 100644
--- a/src/widgets/image_view.rs
+++ b/src/widgets/image_view.rs
@@ -65,9 +65,14 @@ mod imp {
/// overlayed controls
#[template_child]
pub(super) controls_box_start: TemplateChild,
+ #[template_child]
+ pub(super) controls_box_start_events: TemplateChild,
/// overlayed controls
#[template_child]
pub(super) controls_box_end: TemplateChild,
+ #[template_child]
+ pub(super) controls_box_end_events: TemplateChild,
+
#[template_child]
pub sliding_view: TemplateChild,
@@ -413,6 +418,22 @@ impl LpImageView {
self.imp().sliding_view.clone()
}
+ pub fn controls_box_start(&self) -> gtk::Widget {
+ self.imp().controls_box_start.clone()
+ }
+
+ pub fn controls_box_start_events(&self) -> gtk::EventControllerMotion {
+ self.imp().controls_box_start_events.clone()
+ }
+
+ pub fn controls_box_end(&self) -> gtk::Widget {
+ self.imp().controls_box_end.clone()
+ }
+
+ pub fn controls_box_end_events(&self) -> gtk::EventControllerMotion {
+ self.imp().controls_box_end_events.clone()
+ }
+
fn model(&self) -> LpFileModel {
self.imp().model.borrow().clone()
}
diff --git a/src/window.rs b/src/window.rs
index eaa6930..aaaea67 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -28,12 +28,22 @@ use adw::subclass::prelude::*;
use glib::clone;
use gtk::CompositeTemplate;
+use once_cell::sync::OnceCell;
+
+use std::cell::RefCell;
use std::path::{Path, PathBuf};
use crate::config;
use crate::util::{self, Direction, Position};
use crate::widgets::{LpImage, LpImageView, LpPropertiesView};
+/// Animation duration for showing overlay buttons in milliseconds
+const SHOW_CONTROLS_ANIMATION_DURATION: u32 = 200;
+/// Animation duration for hiding overlay buttons in milliseconds
+const HIDE_CONTROLS_ANIMATION_DURATION: u32 = 1000;
+/// Time of inactivity after which controls will be hidden in seconds
+const HIDE_CONTROLS_IDLE_TIMEOUT: u32 = 3;
+
mod imp {
use super::*;
@@ -77,6 +87,12 @@ mod imp {
pub(super) properties_view: TemplateChild,
#[template_child]
pub(super) drop_target: TemplateChild,
+ #[template_child]
+ pub(super) motion_controller: TemplateChild,
+
+ pub(super) show_controls_animation: OnceCell,
+ pub(super) hide_controls_animation: OnceCell,
+ pub(super) hide_controls_timeout: RefCell