ui: Non-circular overlays and less buttons

Part-of: <https://gitlab.gnome.org/GNOME/loupe/-/merge_requests/450>
This commit is contained in:
Sophie Herold 2024-09-09 22:55:39 +02:00
parent e5930b134c
commit 0b4c69459f
18 changed files with 470 additions and 93 deletions

View file

@ -167,10 +167,12 @@ pub enum Action {
ZoomInCursor,
#[strum(to_string = "win.zoom-best-fit")]
ZoomBestFit,
#[strum(to_string = "win.zoom-to-exact-1")]
ZoomToExact1,
#[strum(to_string = "win.zoom-to-exact-2")]
ZoomToExact2,
#[strum(to_string = "win.zoom-to-exact-100")]
ZoomToExact100,
#[strum(to_string = "win.zoom-to-exact-200")]
ZoomToExact200,
#[strum(to_string = "win.zoom-to-exact-300")]
ZoomToExact300,
// Misc
#[strum(to_string = "win.open")]
Open,
@ -332,7 +334,7 @@ impl Action {
);
}
Action::ZoomToExact1 => {
Action::ZoomToExact100 => {
klass.install_action(&action, None, move |win, _, _| {
win.zoom_to_exact(1.);
});
@ -350,7 +352,7 @@ impl Action {
);
}
Action::ZoomToExact2 => {
Action::ZoomToExact200 => {
klass.install_action(&action, None, move |win, _, _| {
win.zoom_to_exact(2.);
});
@ -368,6 +370,24 @@ impl Action {
);
}
Action::ZoomToExact300 => {
klass.install_action(&action, None, move |win, _, _| {
win.zoom_to_exact(2.);
});
klass.add_binding_action(gdk::Key::_3, gdk::ModifierType::empty(), &action);
klass.add_binding_action(gdk::Key::KP_3, gdk::ModifierType::empty(), &action);
klass.add_binding_action(
gdk::Key::_3,
gdk::ModifierType::CONTROL_MASK,
&action,
);
klass.add_binding_action(
gdk::Key::KP_3,
gdk::ModifierType::CONTROL_MASK,
&action,
);
}
// Misc
Action::Open => {
klass.install_action_async(&action, None, |win, _, _| async move {
@ -427,12 +447,13 @@ impl Action {
klass.install_action_async(&action, None, |win, _, _| async move {
win.trash().await;
});
klass.add_binding_action(gdk::Key::Delete, gdk::ModifierType::empty(), &action);
klass.add_binding_action(
gdk::Key::KP_Delete,
gdk::ModifierType::empty(),
&action,
);
// The binding added last is shown in menus
klass.add_binding_action(gdk::Key::Delete, gdk::ModifierType::empty(), &action);
}
Action::Delete => {

View file

@ -129,7 +129,7 @@ impl LpWindow {
/// Start animation to hide controls
pub fn hide_controls(&self) {
if self.are_controls_visible() {
if self.are_controls_visible() && !self.image_view().zoom_menu_button().is_active() {
self.show_controls_animation().pause();
self.hide_controls_animation()
.set_value_from(self.controls_opacity());