From 4c2626ad56b871cf3b12cdfa786e632b3f29a71e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 30 Nov 2011 09:43:09 +0100 Subject: Make sure we don't 'bounce' around when animating to the same height. --- client/collapser.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'client') diff --git a/client/collapser.cc b/client/collapser.cc index 599397f..a802396 100644 --- a/client/collapser.cc +++ b/client/collapser.cc @@ -110,8 +110,14 @@ void Collapser::anim() placeholder.setWeight(x); - int height = (int)((1 - y) * placeholder.fromHeight() + - y * placeholder.toHeight()); + // Make sure we don't 'bounce' around when animating to the same height. + int height; + if(placeholder.fromHeight() == placeholder.toHeight()) { + height = placeholder.fromHeight(); + } else { + height = (int)((1 - y) * placeholder.fromHeight() + + y * placeholder.toHeight()); + } setFixedHeight(height); -- cgit v1.2.3