summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAharon Hillel <a.hillel@partner.samsung.com>2012-01-01 12:30:49 +0000
committerTom Hacohen <tom@stosb.com>2012-01-01 12:30:49 +0000
commite9bf69a8adf1da8f1b9ccf6443bd742d4ea89ea1 (patch)
tree033b7d61094c81ca28d6f6265bd7021ae00655da /src
parent36070f43da2f2c969bc4c3c42168da883d214eb9 (diff)
Elm Glayer: Fixed momentum values This fix was required when combining rotate and momentum gestures.
Signed-off-by: Aharon Hillel <a.hillel@partner.samsung.com> SVN revision: 66716
Diffstat (limited to 'src')
-rw-r--r--src/lib/elm_gesture_layer.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/lib/elm_gesture_layer.c b/src/lib/elm_gesture_layer.c
index 6f0165cea..95ef4a574 100644
--- a/src/lib/elm_gesture_layer.c
+++ b/src/lib/elm_gesture_layer.c
@@ -1788,6 +1788,7 @@ _momentum_test(Evas_Object *obj, Pointer_Event *pe,
1788 if ((st->info.n) && (st->info.n < cnt)) 1788 if ((st->info.n) && (st->info.n < cnt))
1789 state_to_report = ELM_GESTURE_STATE_ABORT; 1789 state_to_report = ELM_GESTURE_STATE_ABORT;
1790 1790
1791
1791 if (st->info.n < cnt) 1792 if (st->info.n < cnt)
1792 st->info.n = cnt; 1793 st->info.n = cnt;
1793 1794
@@ -1820,10 +1821,21 @@ _momentum_test(Evas_Object *obj, Pointer_Event *pe,
1820 } 1821 }
1821 1822
1822 1823
1823 /* ABORT gesture if got DOWN or MOVE event after UP+timeout */ 1824 if (st->t_up)
1824 if ((st->t_up) && 1825 {
1825 ((st->t_up + ELM_GESTURE_MULTI_TIMEOUT) < pe_local.timestamp)) 1826 Eina_Bool force = EINA_TRUE; /* for move state */
1826 state_to_report = ELM_GESTURE_STATE_ABORT; 1827 if ((st->t_up + ELM_GESTURE_MULTI_TIMEOUT) < pe_local.timestamp)
1828 { /* ABORT if got DOWN or MOVE event after UP+timeout */
1829 state_to_report = ELM_GESTURE_STATE_ABORT;
1830 force = EINA_FALSE;
1831 }
1832
1833 /* We report state but don't compute momentum now */
1834 ev_flag = _set_state(gesture, state_to_report, &st->info,
1835 force);
1836 consume_event(wd, event_info, event_type, ev_flag);
1837 return; /* Stop computing when user remove finger */
1838 }
1827 1839
1828 if ((pe_local.timestamp - ELM_GESTURE_MOMENTUM_TIMEOUT) > st->t_end) 1840 if ((pe_local.timestamp - ELM_GESTURE_MOMENTUM_TIMEOUT) > st->t_end)
1829 { /* Too long of a wait, reset all values */ 1841 { /* Too long of a wait, reset all values */
@@ -1839,14 +1851,14 @@ _momentum_test(Evas_Object *obj, Pointer_Event *pe,
1839 int xdir, ydir; 1851 int xdir, ydir;
1840 xdir = _get_direction(st->line_end.x, pe_local.x); 1852 xdir = _get_direction(st->line_end.x, pe_local.x);
1841 ydir = _get_direction(st->line_end.y, pe_local.y); 1853 ydir = _get_direction(st->line_end.y, pe_local.y);
1842 if (xdir != st->xdir) 1854 if (xdir && (xdir != st->xdir))
1843 { 1855 {
1844 st->line_st.x = st->line_end.x; 1856 st->line_st.x = st->line_end.x;
1845 st->info.tx = st->t_st_x = st->t_end; 1857 st->info.tx = st->t_st_x = st->t_end;
1846 st->xdir = xdir; 1858 st->xdir = xdir;
1847 } 1859 }
1848 1860
1849 if (ydir != st->ydir) 1861 if (ydir && (ydir != st->ydir))
1850 { 1862 {
1851 st->line_st.y = st->line_end.y; 1863 st->line_st.y = st->line_end.y;
1852 st->info.ty = st->t_st_y = st->t_end; 1864 st->info.ty = st->t_st_y = st->t_end;
@@ -1857,8 +1869,10 @@ _momentum_test(Evas_Object *obj, Pointer_Event *pe,
1857 st->info.x2 = st->line_end.x = pe_local.x; 1869 st->info.x2 = st->line_end.x = pe_local.x;
1858 st->info.y2 = st->line_end.y = pe_local.y; 1870 st->info.y2 = st->line_end.y = pe_local.y;
1859 st->t_end = pe_local.timestamp; 1871 st->t_end = pe_local.timestamp;
1860 _set_momentum(&st->info, st->line_st.x, st->line_st.y, pe_local.x, pe_local.y, 1872 _set_momentum(&st->info, st->line_st.x, st->line_st.y,
1861 st->t_st_x, st->t_st_y, pe_local.timestamp); 1873 pe_local.x, pe_local.y, st->t_st_x, st->t_st_y,
1874 pe_local.timestamp);
1875
1862 ev_flag = _set_state(gesture, state_to_report, &st->info, 1876 ev_flag = _set_state(gesture, state_to_report, &st->info,
1863 EINA_TRUE); 1877 EINA_TRUE);
1864 consume_event(wd, event_info, event_type, ev_flag); 1878 consume_event(wd, event_info, event_type, ev_flag);
@@ -1886,9 +1900,6 @@ _momentum_test(Evas_Object *obj, Pointer_Event *pe,
1886 st->line_end.y = pe_local.y; 1900 st->line_end.y = pe_local.y;
1887 st->t_end = pe_local.timestamp; 1901 st->t_end = pe_local.timestamp;
1888 1902
1889 _set_momentum(&st->info, st->line_st.x, st->line_st.y, pe_local.x, pe_local.y,
1890 st->t_st_x, st->t_st_y, pe_local.timestamp);
1891
1892 if ((fabs(st->info.mx) > ELM_GESTURE_MINIMUM_MOMENTUM) || 1903 if ((fabs(st->info.mx) > ELM_GESTURE_MINIMUM_MOMENTUM) ||
1893 (fabs(st->info.my) > ELM_GESTURE_MINIMUM_MOMENTUM)) 1904 (fabs(st->info.my) > ELM_GESTURE_MINIMUM_MOMENTUM))
1894 state_to_report = ELM_GESTURE_STATE_END; 1905 state_to_report = ELM_GESTURE_STATE_END;