image_view: Make space for always on scrollbars
Increase the margin of the overlay if scrollbars are set to always visible. Fixes #528
This commit is contained in:
parent
89b4e7a082
commit
f2dbee5ef8
6 changed files with 34 additions and 19 deletions
|
|
@ -10,6 +10,19 @@
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background-color: var(--osd-background-color);
|
background-color: var(--osd-background-color);
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
|
margin: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.always-show-scrollbars .osd-box {
|
||||||
|
margin-bottom: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.always-show-scrollbars .osd-box:dir(ltr) {
|
||||||
|
margin-right: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.always-show-scrollbars .osd-box:dir(rtl) {
|
||||||
|
margin-left: 42px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.osd-box menubutton button {
|
.osd-box menubutton button {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Fixed image navigation overlay controls conflicting with always visible scrollbars.
|
||||||
|
|
@ -290,7 +290,6 @@ mod imp {
|
||||||
} else {
|
} else {
|
||||||
LpOrientation::Landscape
|
LpOrientation::Landscape
|
||||||
};
|
};
|
||||||
dbg!("setting to", orientation);
|
|
||||||
let res = self
|
let res = self
|
||||||
.obj()
|
.obj()
|
||||||
.activate_action("edit-crop.orientation", Some(&orientation.to_variant()));
|
.activate_action("edit-crop.orientation", Some(&orientation.to_variant()));
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@
|
||||||
//!
|
//!
|
||||||
//! This widget also handles showing the context menu.
|
//! This widget also handles showing the context menu.
|
||||||
|
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
use adw::subclass::prelude::*;
|
use adw::subclass::prelude::*;
|
||||||
use glib::{Properties, clone};
|
use glib::{Properties, clone};
|
||||||
use gtk::CompositeTemplate;
|
use gtk::CompositeTemplate;
|
||||||
|
|
@ -33,8 +35,6 @@ use crate::util::gettext::*;
|
||||||
use crate::widgets::LpImage;
|
use crate::widgets::LpImage;
|
||||||
|
|
||||||
mod imp {
|
mod imp {
|
||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[derive(Debug, Default, CompositeTemplate, Properties)]
|
#[derive(Debug, Default, CompositeTemplate, Properties)]
|
||||||
|
|
@ -85,15 +85,8 @@ mod imp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::derived_properties]
|
||||||
impl ObjectImpl for LpImagePage {
|
impl ObjectImpl for LpImagePage {
|
||||||
fn properties() -> &'static [glib::ParamSpec] {
|
|
||||||
Self::derived_properties()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn property(&self, id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
|
||||||
self.derived_property(id, pspec)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn constructed(&self) {
|
fn constructed(&self) {
|
||||||
let obj = self.obj();
|
let obj = self.obj();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -329,6 +329,15 @@ mod imp {
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Adjust overlays margins to always visible scrollbars
|
||||||
|
obj.update_scrollbar_styles();
|
||||||
|
obj.settings()
|
||||||
|
.connect_gtk_overlay_scrolling_notify(glib::clone!(
|
||||||
|
#[weak]
|
||||||
|
obj,
|
||||||
|
move |_| obj.update_scrollbar_styles()
|
||||||
|
));
|
||||||
|
|
||||||
obj.add_controller(self.drag_source.clone());
|
obj.add_controller(self.drag_source.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -912,4 +921,12 @@ impl LpImageView {
|
||||||
|
|
||||||
value.parse::<f64>().ok().map(|x| x / 100.)
|
value.parse::<f64>().ok().map(|x| x / 100.)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn update_scrollbar_styles(&self) {
|
||||||
|
if self.settings().is_gtk_overlay_scrolling() {
|
||||||
|
self.remove_css_class("always-show-scrollbars");
|
||||||
|
} else {
|
||||||
|
self.add_css_class("always-show-scrollbars");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,6 @@
|
||||||
<object class="GtkBox" id="controls_box_start">
|
<object class="GtkBox" id="controls_box_start">
|
||||||
<property name="valign">end</property>
|
<property name="valign">end</property>
|
||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="margin-start">18</property>
|
|
||||||
<property name="margin-end">18</property>
|
|
||||||
<property name="margin-top">18</property>
|
|
||||||
<property name="margin-bottom">18</property>
|
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="osd-box" />
|
<class name="osd-box" />
|
||||||
|
|
@ -52,10 +48,6 @@
|
||||||
<object class="GtkBox" id="controls_box_end">
|
<object class="GtkBox" id="controls_box_end">
|
||||||
<property name="valign">end</property>
|
<property name="valign">end</property>
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="margin-start">18</property>
|
|
||||||
<property name="margin-end">18</property>
|
|
||||||
<property name="margin-top">18</property>
|
|
||||||
<property name="margin-bottom">18</property>
|
|
||||||
<style>
|
<style>
|
||||||
<class name="osd-box" />
|
<class name="osd-box" />
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue