The pixel distance could be small enough between tick() calls that
this kind of checks might potentially become a problem. Rely only on
the calculated velocity to trigger the STOPPED phase, and use a lower
threshold to avoid cutting the animation too early.
Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/4725
{
case GTK_KINETIC_SCROLLING_PHASE_DECELERATING:
{
- double last_position = data->position;
- double last_time = data->t;
double exp_part;
data->t += time_delta;
{
gtk_kinetic_scrolling_init_overshoot(data, data->upper, data->position, data->velocity);
}
- else if (fabs(data->velocity) < 1 ||
- (last_time != 0.0 && fabs(data->position - last_position) < 1))
+ else if (fabs(data->velocity) < 0.1)
{
gtk_kinetic_scrolling_stop (data);
}