Hyena.Widgets.SmoothScrolledWindow.OnTimeout C# (CSharp) Méthode

OnTimeout() private méthode

private OnTimeout ( ) : bool
Résultat bool
        private bool OnTimeout ()
        {
            double delta = target_value - value;
            if (delta == 0) {
                velocity = 0;
                timeout = 0;
                return false;
            }

            int sign = Math.Sign (delta);
            delta = Math.Abs (delta);

            double hypothetical = delta;
            double v = Accelerate (velocity);
            while (v > 0 && hypothetical > 0) {
                hypothetical -= v;
                v = Decelerate (v);
            }

            velocity = hypothetical <= 0 ? Decelerate (velocity) : Accelerate (velocity);

            // Minimum speed: 2 px / 20 ms = 100px / second
            value = Math.Round (value + Math.Max (velocity, 2) * sign);

            // Don't go past the target value
            value = (sign == 1) ? Math.Min (value, target_value) : Math.Max (value, target_value);

            ignore_value_changed = true;
            Vadjustment.Value = Math.Round (value);
            ignore_value_changed = false;

            return true;
        }