views/month: Rename a function
We'll introduce a variant of this function that operates directly on row offsets, instead of pixel values.
This commit is contained in:
@@ -461,8 +461,8 @@ get_grid_height (GcalMonthView *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
offset_and_shuffle_rows (GcalMonthView *self,
|
offset_and_shuffle_rows_by_pixels (GcalMonthView *self,
|
||||||
gdouble dy)
|
gdouble dy_pixels)
|
||||||
{
|
{
|
||||||
gdouble row_height;
|
gdouble row_height;
|
||||||
gint grid_height;
|
gint grid_height;
|
||||||
@@ -471,7 +471,7 @@ offset_and_shuffle_rows (GcalMonthView *self,
|
|||||||
|
|
||||||
grid_height = get_grid_height (self);
|
grid_height = get_grid_height (self);
|
||||||
row_height = grid_height / (gdouble) N_ROWS_PER_PAGE;
|
row_height = grid_height / (gdouble) N_ROWS_PER_PAGE;
|
||||||
self->row_offset += dy / row_height;
|
self->row_offset += dy_pixels / row_height;
|
||||||
|
|
||||||
if (fabs (self->row_offset) > 0.5)
|
if (fabs (self->row_offset) > 0.5)
|
||||||
{
|
{
|
||||||
@@ -602,7 +602,7 @@ on_scroll_controller_scroll_cb (GtkEventControllerScroll *scroll_controller,
|
|||||||
case GDK_SCROLL_SMOOTH:
|
case GDK_SCROLL_SMOOTH:
|
||||||
cancel_row_offset_animation (self);
|
cancel_row_offset_animation (self);
|
||||||
cancel_deceleration (self);
|
cancel_deceleration (self);
|
||||||
offset_and_shuffle_rows (self, dy);
|
offset_and_shuffle_rows_by_pixels (self, dy);
|
||||||
GCAL_RETURN (GDK_EVENT_STOP);
|
GCAL_RETURN (GDK_EVENT_STOP);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -672,7 +672,7 @@ decelerate_scroll_cb (gdouble value,
|
|||||||
self->last_velocity = value;
|
self->last_velocity = value;
|
||||||
|
|
||||||
if (fabs (value) > (get_grid_height (self) / (gdouble) N_ROWS_PER_PAGE / 5.0))
|
if (fabs (value) > (get_grid_height (self) / (gdouble) N_ROWS_PER_PAGE / 5.0))
|
||||||
offset_and_shuffle_rows (self, dy);
|
offset_and_shuffle_rows_by_pixels (self, dy);
|
||||||
else
|
else
|
||||||
adw_animation_skip (self->kinetic_scroll_animation);
|
adw_animation_skip (self->kinetic_scroll_animation);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user