forked from enlightenment/efl
tests/elm: add util function for doing a multi-press drag around
same as existing function, but takes a finger id Differential Revision: https://phab.enlightenment.org/D11389
This commit is contained in:
parent
7f6dfbac80
commit
db5fcd13db
|
@ -754,6 +754,32 @@ drag_object_around(Eo *obj, int cx, int cy, int radius, int degrees)
|
|||
return num;
|
||||
}
|
||||
|
||||
int
|
||||
multi_drag_object_around(Eo *obj, int touch_point, int cx, int cy, int radius, int degrees)
|
||||
{
|
||||
Evas *e = evas_object_evas_get(obj);
|
||||
/* clamp num mouse moves to a vaguely sane value */
|
||||
int i, num = MIN(abs(degrees), DRAG_OBJECT_AROUND_NUM_MOVES);
|
||||
int last_x = round(cx + radius);
|
||||
int last_y = round(cy);
|
||||
/* start at 0 degrees */
|
||||
evas_event_feed_multi_down(e, touch_point, last_x, last_y, 1, 1, 1, 1, 0, last_x, last_y, 0, ts++, NULL);
|
||||
for (i = 1; i < num; i++)
|
||||
{
|
||||
/* x = cx + r * cos(a), y = cy + r * sin(a) */
|
||||
int ax, ay;
|
||||
/* each iteration is 1 degree */
|
||||
double angle = (i * (degrees / DRAG_OBJECT_AROUND_NUM_MOVES)) * M_PI / 180.0;
|
||||
ax = round(cx + radius * cos(angle));
|
||||
ay = round(cy + radius * sin(angle));
|
||||
if ((ax == last_x) && (ay == last_y)) continue;
|
||||
evas_event_feed_multi_move(e, touch_point, ax, ay, 1, 1, 1, 1, 0, ax, ay, ts++, NULL);
|
||||
last_x = ax, last_y = ay;
|
||||
}
|
||||
evas_event_feed_multi_up(e, touch_point, last_x, last_y, 1, 1, 1, 1, 0, last_x, last_y, 0, ts++, NULL);
|
||||
/* only count arc motion: subtract initial move, mouse down, mouse up */
|
||||
return num;
|
||||
}
|
||||
|
||||
int
|
||||
pinch_object(Eo *obj, int x, int y, int x2, int y2, int dx, int dy, int dx2, int dy2)
|
||||
|
|
|
@ -34,6 +34,7 @@ void multi_click_object(Eo *obj, int ids);
|
|||
void multi_press_object(Eo *obj, int ids);
|
||||
void multi_click_object_at(Eo *obj, int x, int y, int ids);
|
||||
void multi_press_object_at(Eo *obj, int x, int y, int ids);
|
||||
int multi_drag_object_around(Eo *obj, int touch_point, int cx, int cy, int radius, int degrees);
|
||||
void drag_object(Eo *obj, int x, int y, int dx, int dy, Eina_Bool iterate);
|
||||
int drag_object_around(Eo *obj, int cx, int cy, int radius, int degrees);
|
||||
int pinch_object(Eo *obj, int x, int y, int x2, int y2, int dx, int dy, int dx2, int dy2);
|
||||
|
|
Loading…
Reference in New Issue