lib/edj_viewer: fix the cursor position scale to view scale

This commit is contained in:
ChunEon Park 2015-02-28 14:21:59 +09:00
parent 7720ce5cf5
commit cf3ad3a914
1 changed files with 10 additions and 2 deletions

View File

@ -129,11 +129,19 @@ rect_mouse_move_cb(void *data, Evas *e EINA_UNUSED,
Evas_Coord x, y, w, h;
evas_object_geometry_get(obj, &x, &y, &w, &h);
cursor.x = ev->cur.canvas.x - x;
cursor.y = ev->cur.canvas.y - y;
cursor.relx = (float) ((ev->cur.canvas.x - x) / (float) w);
cursor.rely = (float) ((ev->cur.canvas.y - y) / (float) h);
if (vd->view_config_size.w > 0)
cursor.x = (((double)vd->view_config_size.w) * cursor.relx);
else
cursor.x = (ev->cur.canvas.x - x);
if (vd->view_config_size.h > 0)
cursor.y = (((double)vd->view_config_size.h) * cursor.rely);
else
cursor.y = (ev->cur.canvas.y - y);
evas_object_smart_callback_call(vd->enventor, SIG_LIVE_VIEW_CURSOR_MOVED,
&cursor);
}