fix(magnifier): smooth mouse wheel zoom and respect natural scroll direction
- Disable animation for mouse wheel zoom to eliminate the timing race that causes lag and sudden jumps. Each wheel tick now zooms instantly. - Invert zoom direction when natural scrolling is enabled so that forward scroll zooms in, matching macOS/Windows behavior.
This commit is contained in:
parent
b5186ef21a
commit
92fcceba54
1 changed files with 13 additions and 6 deletions
|
|
@ -37,11 +37,12 @@ use cosmic_settings_config::shortcuts;
|
|||
use cosmic_settings_config::shortcuts::action::{Direction, ResizeDirection};
|
||||
use smithay::{
|
||||
backend::input::{
|
||||
AbsolutePositionEvent, Axis, AxisSource, Device, DeviceCapability, GestureBeginEvent,
|
||||
GestureEndEvent, GesturePinchUpdateEvent as _, GestureSwipeUpdateEvent as _, InputBackend,
|
||||
InputEvent, KeyState, KeyboardKeyEvent, PointerAxisEvent, ProximityState, Switch,
|
||||
SwitchState, SwitchToggleEvent, TabletToolButtonEvent, TabletToolEvent,
|
||||
TabletToolProximityEvent, TabletToolTipEvent, TabletToolTipState, TouchEvent,
|
||||
AbsolutePositionEvent, Axis, AxisRelativeDirection, AxisSource, Device, DeviceCapability,
|
||||
GestureBeginEvent, GestureEndEvent, GesturePinchUpdateEvent as _,
|
||||
GestureSwipeUpdateEvent as _, InputBackend, InputEvent, KeyState, KeyboardKeyEvent,
|
||||
PointerAxisEvent, ProximityState, Switch, SwitchState, SwitchToggleEvent,
|
||||
TabletToolButtonEvent, TabletToolEvent, TabletToolProximityEvent, TabletToolTipEvent,
|
||||
TabletToolTipState, TouchEvent,
|
||||
},
|
||||
desktop::{PopupKeyboardGrab, WindowSurfaceType, utils::under_from_surface_tree},
|
||||
input::{
|
||||
|
|
@ -914,12 +915,18 @@ impl State {
|
|||
.or_else(|| event.amount(Axis::Vertical))
|
||||
.map(|val| val * scroll_factor)
|
||||
{
|
||||
if event.relative_direction(Axis::Vertical)
|
||||
== AxisRelativeDirection::Inverted
|
||||
{
|
||||
percentage *= -1.;
|
||||
}
|
||||
|
||||
if event.source() == AxisSource::Wheel {
|
||||
percentage *= 5.;
|
||||
}
|
||||
|
||||
let change = -(percentage / 100.);
|
||||
self.update_zoom(&seat, change, event.source() == AxisSource::Wheel);
|
||||
self.update_zoom(&seat, change, false);
|
||||
}
|
||||
} else {
|
||||
let mut frame = AxisFrame::new(event.time_msec()).source(event.source());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue