~bratsche/oif/evince-move-gestures-into-view

« back to all changes in this revision

Viewing changes to libview/ev-view.c

  • Committer: Cody Russell
  • Date: 2011-01-07 16:45:25 UTC
  • Revision ID: crussell@canonical.com-20110107164525-a8qyvspc56q8lfi9
Set some #define constants for velocity and angle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
#define ZOOM_IN_FACTOR  1.2
85
85
#define ZOOM_OUT_FACTOR (1.0/ZOOM_IN_FACTOR)
86
86
 
 
87
#define GESTURE_DRAG_VELOCITY  1.0
 
88
#define GESTURE_ROTATE_ANGLE   1.0
 
89
 
87
90
#define SCROLL_TIME 150
88
91
 
89
92
/*** Scrolling ***/
3034
3037
                case GRIP_GESTURE_DRAG: {
3035
3038
                        GripEventGestureDrag *drag = (GripEventGestureDrag *)event;
3036
3039
 
3037
 
                        if (drag->velocity_y >= 1.0 &&
 
3040
                        if (drag->velocity_y >= GESTURE_DRAG_VELOCITY &&
3038
3041
                            drag->position_y > view->drag_start_y) {
3039
3042
                                ev_view_previous_page (view);
3040
 
                        } else if (drag->velocity_y <= -1.0 &&
 
3043
                        } else if (drag->velocity_y <= -GESTURE_DRAG_VELOCITY &&
3041
3044
                                   drag->position_y < view->drag_start_y) {
3042
3045
                                ev_view_next_page (view);
3043
 
                        } else if (drag->velocity_x >= 1.0 &&
 
3046
                        } else if (drag->velocity_x >= GESTURE_DRAG_VELOCITY &&
3044
3047
                                   drag->position_x > view->drag_start_x) {
3045
3048
                                ev_view_previous_page (view);
3046
 
                        } else if (drag->velocity_x <= -1.0 &&
 
3049
                        } else if (drag->velocity_x <= -GESTURE_DRAG_VELOCITY &&
3047
3050
                                   drag->position_x < view->drag_start_x) {
3048
3051
                                ev_view_next_page (view);
3049
3052
                        }
3055
3058
                        GripEventGestureRotate *rotate = (GripEventGestureRotate *)event;
3056
3059
                        gint rotation = ev_document_model_get_rotation (view->model);
3057
3060
 
3058
 
                        if (rotate->angle >= 1.0) {
 
3061
                        if (rotate->angle >= GESTURE_ROTATE_ANGLE) {
3059
3062
                                ev_document_model_set_rotation (view->model,
3060
3063
                                                                rotation + 90);
3061
 
                        } else if (rotate->angle <= -1.0) {
 
3064
                        } else if (rotate->angle <= -GESTURE_ROTATE_ANGLE) {
3062
3065
                                ev_document_model_set_rotation (view->model,
3063
3066
                                                                rotation - 90);
3064
3067
                        }