Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_ops.c
| Context not available. | |||||
| } | } | ||||
| else { | else { | ||||
| const int mouse_sq = SQUARE(xy[0] - az->x2) + SQUARE(xy[1] - az->y2); | const int mouse_sq = SQUARE(xy[0] - az->x2) + SQUARE(xy[1] - az->y2); | ||||
| const int spot_sq = SQUARE(AZONESPOT); | const int spot_sq = SQUARE(AZONESPOTW); | ||||
| const int fadein_sq = SQUARE(AZONEFADEIN); | const int fadein_sq = SQUARE(AZONEFADEIN); | ||||
| const int fadeout_sq = SQUARE(AZONEFADEOUT); | const int fadeout_sq = SQUARE(AZONEFADEOUT); | ||||
| Context not available. | |||||
| const int delta_x = (event->x - sad->x); | const int delta_x = (event->x - sad->x); | ||||
| const int delta_y = (event->y - sad->y); | const int delta_y = (event->y - sad->y); | ||||
| /* calculate gesture direction */ | /* movement in dominant direction */ | ||||
| const int delta_max = MAX2(ABS(delta_x), ABS(delta_y)); | |||||
| /* movement in secondary direction */ | |||||
| const int delta_min = MIN2(ABS(delta_x), ABS(delta_y)); | |||||
| /* movement required in dominant direction */ | |||||
| const int delta_threshold = (0.2 * U.widget_unit); | |||||
| /* must be over threshold and 2:1 ratio or more */ | |||||
| const int delta_okay = (delta_max > delta_threshold) && (delta_min * 2 <= delta_max); | |||||
| /* calculate gesture cardinal direction */ | |||||
| if (delta_y > ABS(delta_x)) | if (delta_y > ABS(delta_x)) | ||||
| sad->gesture_dir = 'n'; | sad->gesture_dir = 'n'; | ||||
| else if (delta_x > ABS(delta_y)) | else if (delta_x >= ABS(delta_y)) | ||||
| sad->gesture_dir = 'e'; | sad->gesture_dir = 'e'; | ||||
| else if (delta_y < -ABS(delta_x)) | else if (delta_y < -ABS(delta_x)) | ||||
| sad->gesture_dir = 's'; | sad->gesture_dir = 's'; | ||||
| Context not available. | |||||
| WM_window_screen_rect_calc(win, &screen_rect); | WM_window_screen_rect_calc(win, &screen_rect); | ||||
| /* once we drag outside the actionzone, register a gesture | /* once we drag outside the actionzone, register a gesture | ||||
| * check we're not on an edge so join finds the other area */ | * check we're not on an edge so join finds the other area */ | ||||
| is_gesture = ((ED_area_actionzone_find_xy(sad->sa1, &event->x) != sad->az) && | is_gesture = (delta_okay && (ED_area_actionzone_find_xy(sad->sa1, &event->x) != sad->az) && | ||||
| (screen_geom_area_map_find_active_scredge( | (screen_geom_area_map_find_active_scredge( | ||||
| AREAMAP_FROM_SCREEN(sc), &screen_rect, event->x, event->y) == NULL)); | AREAMAP_FROM_SCREEN(sc), &screen_rect, event->x, event->y) == NULL)); | ||||
| } | } | ||||
| else { | else { | ||||
| const int delta_min = 1; | is_gesture = delta_okay; | ||||
| is_gesture = (ABS(delta_x) > delta_min || ABS(delta_y) > delta_min); | |||||
| } | } | ||||
| /* gesture is large enough? */ | /* gesture is large enough? */ | ||||
| Context not available. | |||||