diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-03-05 13:32:30 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-03-05 13:32:52 +0400 |
| commit | ae89b2e514fd4c22a38c2dce258707c369ca944a (patch) | |
| tree | 743448567dbc92843b46fc677b39336df3406a58 /src/layout/monitor.rs | |
| parent | 732f7f6f33595924654d23a380cc2a48bf9f3257 (diff) | |
| download | niri-ae89b2e514fd4c22a38c2dce258707c369ca944a.tar.gz niri-ae89b2e514fd4c22a38c2dce258707c369ca944a.tar.bz2 niri-ae89b2e514fd4c22a38c2dce258707c369ca944a.zip | |
Implement spring animations
Diffstat (limited to 'src/layout/monitor.rs')
| -rw-r--r-- | src/layout/monitor.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs index ac9f3ff9..f2e4c30e 100644 --- a/src/layout/monitor.rs +++ b/src/layout/monitor.rs @@ -94,6 +94,7 @@ impl<W: LayoutElement> Monitor<W> { return; } + // FIXME: also compute and use current velocity. let current_idx = self .workspace_switch .as_ref() @@ -105,6 +106,7 @@ impl<W: LayoutElement> Monitor<W> { self.workspace_switch = Some(WorkspaceSwitch::Animation(Animation::new( current_idx, idx as f64, + 0., self.options.animations.workspace_switch, niri_config::Animation::default_workspace_switch(), ))); @@ -781,6 +783,7 @@ impl<W: LayoutElement> Monitor<W> { return true; } + let velocity = gesture.tracker.velocity() / WORKSPACE_GESTURE_MOVEMENT; let pos = gesture.tracker.projected_end_pos() / WORKSPACE_GESTURE_MOVEMENT; let min = gesture.center_idx.saturating_sub(1) as f64; @@ -792,6 +795,7 @@ impl<W: LayoutElement> Monitor<W> { self.workspace_switch = Some(WorkspaceSwitch::Animation(Animation::new( gesture.current_idx, new_idx as f64, + velocity, self.options.animations.workspace_switch, niri_config::Animation::default_workspace_switch(), ))); |
