aboutsummaryrefslogtreecommitdiff
path: root/src/layout/tile.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-08-12 22:34:13 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-08-14 15:58:59 +0300
commite3101ced70b908d4fc9bceef47e878d2de2b4c5d (patch)
tree60962874a6544f43a2531e064d104c150cde96b1 /src/layout/tile.rs
parentea438b21e933d45672e80ca04db42eb54050fcca (diff)
downloadniri-e3101ced70b908d4fc9bceef47e878d2de2b4c5d.tar.gz
niri-e3101ced70b908d4fc9bceef47e878d2de2b4c5d.tar.bz2
niri-e3101ced70b908d4fc9bceef47e878d2de2b4c5d.zip
layout: Offset Y animations for non-animated resizes
Diffstat (limited to 'src/layout/tile.rs')
-rw-r--r--src/layout/tile.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/layout/tile.rs b/src/layout/tile.rs
index dea2a773..a4fe8a57 100644
--- a/src/layout/tile.rs
+++ b/src/layout/tile.rs
@@ -485,6 +485,17 @@ impl<W: LayoutElement> Tile<W> {
});
}
+ pub fn offset_move_y_anim_current(&mut self, offset: f64) {
+ if let Some(move_) = self.move_y_animation.as_mut() {
+ // If the anim is almost done, there's little point trying to offset it; we can let
+ // things jump. If it turns out like a bad idea, we could restart the anim intead.
+ let value = move_.anim.value();
+ if value > 0.001 {
+ move_.from += offset / value;
+ }
+ }
+ }
+
pub fn stop_move_animations(&mut self) {
self.move_x_animation = None;
self.move_y_animation = None;