[e-mod-screen-reader] Check direction of flick based on angle 84/90384/1
authorPrasoon Singh <prasoon.16@samsung.com>
Thu, 29 Sep 2016 15:39:07 +0000 (21:09 +0530)
committerPrasoon Singh <prasoon.16@samsung.com>
Thu, 29 Sep 2016 15:39:07 +0000 (21:09 +0530)
Change-Id: I81f905d11ba87f4dc0e5af45954f7ece003a91df

src/e_screen_reader_gestures.c

index b6eea32..8c13517 100644 (file)
@@ -289,6 +289,20 @@ _flick_gesture_direction_get(int x, int y, int x_org, int y_org)
 {
    int dx = x - x_org;
    int dy = y - y_org;
+   int tmp;
+
+   switch (cover->angle) {
+      case 90:
+         tmp = dx;
+         dx = -dy;
+         dy = tmp;
+         break;
+      case 270:
+         tmp = dx;
+         dx = dy;
+         dy = -tmp;
+         break;
+   }
 
    if ((dy < 0) && (abs(dx) < -dy))
      return FLICK_DIRECTION_UP;
@@ -571,10 +585,23 @@ _flick_gesture_mouse_move(Ecore_Event_Mouse_Move *ev, Cover *cov)
                   return;
                }
           }
-         int dxx = ev->root.x - cov->flick_gesture.x_org[i];
-         int dyy = ev->root.y - cov->flick_gesture.y_org[i];
+         int dx = ev->root.x - cov->flick_gesture.x_org[i];
+         int dy = ev->root.y - cov->flick_gesture.y_org[i];
+         int tmp;
+         switch (cov->angle) {
+            case 90:
+               tmp = dx;
+               dx = -dy;
+               dy = tmp;
+               break;
+            case 270:
+               tmp = dx;
+               dx = dy;
+               dy = -tmp;
+               break;
+         }
          if (i == 1 && cov->n_taps == 2) {
-            if ((cov->flick_gesture.flick_to_scroll || _flick_to_scroll_gesture_conditions_met(ev, cov->flick_gesture.timestamp[i], dxx, dyy)) && scrolling) {
+            if ((cov->flick_gesture.flick_to_scroll || _flick_to_scroll_gesture_conditions_met(ev, cov->flick_gesture.timestamp[i], dx, dy)) && scrolling) {
                if (!cov->flick_gesture.flick_to_scroll) {
                   start_scroll(ev->x, ev->y, cov);
                   cov->flick_gesture.flick_to_scroll = EINA_TRUE;
@@ -582,12 +609,9 @@ _flick_gesture_mouse_move(Ecore_Event_Mouse_Move *ev, Cover *cov)
                return;
             }
          }
-         if(!cov->flick_gesture.finger_out[i])
-            {
-               int dx = ev->root.x - cov->flick_gesture.x_org[i];
-               int dy = ev->root.y - cov->flick_gesture.y_org[i];
-
-               if (dx < 0) dx *= -1;
+         if (!cov->flick_gesture.finger_out[i])
+           {
+              if (dx < 0) dx *= -1;
               if (dy < 0) dy *= -1;
 
               if (dx > _e_mod_config->one_finger_flick_min_length)