forked from AuroraMiddleware/gtk
kineticscrolling: Add stop function
Move the logic to stop kinetic scrolling to its own function and allow to call it from the outside. Part-of: <!3454>
This commit is contained in:
parent
f09338c8de
commit
62808722d2
@ -202,9 +202,7 @@ gtk_kinetic_scrolling_tick (GtkKineticScrolling *data,
|
||||
else if (fabs(data->velocity) < 1 ||
|
||||
(last_time != 0.0 && fabs(data->position - last_position) < 1))
|
||||
{
|
||||
data->phase = GTK_KINETIC_SCROLLING_PHASE_FINISHED;
|
||||
data->position = round(data->position);
|
||||
data->velocity = 0;
|
||||
gtk_kinetic_scrolling_stop (data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -249,3 +247,13 @@ gtk_kinetic_scrolling_tick (GtkKineticScrolling *data,
|
||||
return data->phase != GTK_KINETIC_SCROLLING_PHASE_FINISHED;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_kinetic_scrolling_stop (GtkKineticScrolling *data)
|
||||
{
|
||||
if (data->phase == GTK_KINETIC_SCROLLING_PHASE_DECELERATING)
|
||||
{
|
||||
data->phase = GTK_KINETIC_SCROLLING_PHASE_FINISHED;
|
||||
data->position = round (data->position);
|
||||
data->velocity = 0;
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ gboolean gtk_kinetic_scrolling_tick (GtkKineticScrolling *data,
|
||||
double *position,
|
||||
double *velocity);
|
||||
|
||||
void gtk_kinetic_scrolling_stop (GtkKineticScrolling *data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_KINETIC_SCROLLING_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user