- if (priv->moved) {
- switch (priv->mode) {
- case HILDON_PANNABLE_AREA_MODE_PUSH:
- /* Scroll by the amount of pixels the cursor has moved
- * since the last motion event.
- */
- hildon_pannable_area_motion_event_scroll (area, x, y);
+static void
+hildon_pannable_area_handle_move (HildonPannableArea *area,
+ GdkEventMotion * event,
+ gdouble *x,
+ gdouble *y)
+{
+ HildonPannableAreaPrivate *priv = area->priv;
+ gdouble delta;
+
+ switch (priv->mode) {
+ case HILDON_PANNABLE_AREA_MODE_PUSH:
+ /* Scroll by the amount of pixels the cursor has moved
+ * since the last motion event.
+ */
+ hildon_pannable_area_motion_event_scroll (area, *x, *y);
+ priv->x = event->x;
+ priv->y = event->y;
+ break;
+ case HILDON_PANNABLE_AREA_MODE_ACCEL:
+ /* Set acceleration relative to the initial click */
+ priv->ex = event->x;
+ priv->ey = event->y;
+ priv->vel_x = ((*x > 0) ? 1 : -1) *
+ (((ABS (*x) /
+ (gdouble) GTK_WIDGET (area)->allocation.width) *
+ (priv->vmax - priv->vmin)) + priv->vmin);
+ priv->vel_y = ((*y > 0) ? 1 : -1) *
+ (((ABS (*y) /
+ (gdouble) GTK_WIDGET (area)->allocation.height) *
+ (priv->vmax - priv->vmin)) + priv->vmin);
+ break;
+ case HILDON_PANNABLE_AREA_MODE_AUTO:
+
+ delta = event->time - priv->last_time;
+
+ if (priv->mov_mode&HILDON_MOVEMENT_MODE_VERT) {
+ gdouble dist = event->y - priv->y;
+
+ hildon_pannable_area_calculate_velocity (&priv->vel_y,
+ delta,
+ dist,
+ priv->vmax,
+ priv->drag_inertia,
+ priv->force,
+ priv->sps);
+ } else {
+ *y = 0;
+ priv->vel_y = 0;
+ }
+
+ if (priv->mov_mode&HILDON_MOVEMENT_MODE_HORIZ) {
+ gdouble dist = event->x - priv->x;
+
+ hildon_pannable_area_calculate_velocity (&priv->vel_x,
+ delta,
+ dist,
+ priv->vmax,
+ priv->drag_inertia,
+ priv->force,
+ priv->sps);
+ } else {
+ *x = 0;
+ priv->vel_x = 0;
+ }
+
+ hildon_pannable_area_motion_event_scroll (area, *x, *y);
+
+ if (priv->mov_mode&HILDON_MOVEMENT_MODE_HORIZ)