feat(gui): Ctrl+scroll changes the icon size in My files

Scrolling with Ctrl held over the icon grid steps the icon size, as it
does in Photos. Touchpad deltas add up to a whole notch before each
step, so a small swipe does not jump through every size.
This commit is contained in:
nvrl committed 2026-11-14 02:49:41 +01:00
1 parent e571f22d5d
commit f2a9a0f64b
2 files changed
+29 -2

No files matched your search

+27
View File
@@ -807,6 +807,33 @@ pub(crate) fn wire_browser(ui: &Rc<Ui>) {
ui_zoom.browser.files.set_thumbnail_size(size);
save_icon_size(&ui_zoom, size);
});
// Ctrl+scroll steps the icon size, as in Photos. Capture phase so the
// scrolled window does not scroll the grid as well. A touchpad sends many
// small deltas, so they add up to a whole notch before each step.
if let Some(grid_scroll) = files.views.child_by_name("grid") {
let wheel = gtk4::EventControllerScroll::new(gtk4::EventControllerScrollFlags::VERTICAL);
wheel.set_propagation_phase(gtk4::PropagationPhase::Capture);
let ui_wheel = ui.clone();
let pending = Cell::new(0.0_f64);
wheel.connect_scroll(move |controller, _dx, dy| {
if !controller
.current_event_state()
.contains(gtk4::gdk::ModifierType::CONTROL_MASK)
{
pending.set(0.0);
return glib::Propagation::Proceed;
}
let total = pending.get() + dy;
let steps = total.trunc();
pending.set(total - steps);
if steps != 0.0 {
// Scrolling up (negative dy) makes the icons bigger.
zoom_files(&ui_wheel, -(steps as i32));
}
glib::Propagation::Stop
});
grid_scroll.add_controller(wheel);
}
files
.column_view
+2 -2
View File
@@ -62,8 +62,8 @@ Existing folders remain device backups; older builds cannot open the upgraded da
- In the photo viewer, the details panel lies over the photo when the window is
narrow instead of squeezing it.
- **Larger icons in My files.** The icon size slider goes up to 256 px, big enough to
tell photos apart by their thumbnail. Ctrl+plus, Ctrl+minus and Ctrl+0 change it from
the keyboard, and the size is remembered between runs.
tell photos apart by their thumbnail. Ctrl+scroll, Ctrl+plus, Ctrl+minus and Ctrl+0
change it too, and the size is remembered between runs.
### Fixed