miniview: click on it to scroll to that position

This commit is contained in:
Boris Faure 2014-05-04 17:15:39 +02:00
parent ec8d5ac98e
commit 2e2862dd22
1 changed files with 23 additions and 0 deletions

View File

@ -131,6 +131,27 @@ _smart_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED,
mv->to_render = 1;
}
static void
_smart_cb_mouse_down(void *data, Evas *e EINA_UNUSED,
Evas_Object *obj EINA_UNUSED, void *event)
{
Evas_Event_Mouse_Down *ev = event;
Miniview *mv= evas_object_smart_data_get(data);
int pos;
Evas_Coord oy;
EINA_SAFETY_ON_NULL_RETURN(mv);
evas_object_geometry_get(mv->img, NULL, &oy, NULL, NULL);
pos = oy - ev->canvas.y;
pos -= mv->img_hist;
if (pos < 0)
pos = 0;
else
pos += mv->rows / 2;
termio_scroll_set(mv->termio, pos);
}
static void
_smart_add(Evas_Object *obj)
{
@ -155,6 +176,8 @@ _smart_add(Evas_Object *obj)
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL,
_smart_cb_mouse_wheel, obj);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_smart_cb_mouse_down, obj);
}
static void