efl_ui/pan: add position info to pan,content_position,changed event
Summary: changed events should always send the related data when possible ref T7708 Depends on D9789 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl_widgets Maniphest Tasks: T7708 Differential Revision: https://phab.enlightenment.org/D9790
This commit is contained in:
parent
e50cf9b2a2
commit
7142acd19c
|
@ -198,17 +198,17 @@ _pan_viewport_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_pan_position_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
_pan_position_changed_cb(void *data, const Efl_Event *ev)
|
||||||
{
|
{
|
||||||
MY_DATA_GET(data, pd);
|
MY_DATA_GET(data, pd);
|
||||||
Eina_Position2D pos = efl_ui_pan_position_get(pd->pan);
|
Eina_Position2D *pos = ev->info;
|
||||||
Eina_Position2D max = efl_ui_pan_position_max_get(pd->pan);
|
Eina_Position2D max = efl_ui_pan_position_max_get(pd->pan);
|
||||||
Eina_Vector2 rpos = {0.0, 0.0};
|
Eina_Vector2 rpos = {0.0, 0.0};
|
||||||
|
|
||||||
if (max.x > 0.0)
|
if (max.x > 0.0)
|
||||||
rpos.x = (double)pos.x/(double)max.x;
|
rpos.x = (double)pos->x/(double)max.x;
|
||||||
if (max.y > 0.0)
|
if (max.y > 0.0)
|
||||||
rpos.y = (double)pos.y/(double)max.y;
|
rpos.y = (double)pos->y/(double)max.y;
|
||||||
|
|
||||||
efl_ui_position_manager_entity_scroll_position_set(pd->pos_man, rpos.x, rpos.y);
|
efl_ui_position_manager_entity_scroll_position_set(pd->pos_man, rpos.x, rpos.y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,7 +402,7 @@ _efl_ui_image_zoomable_pan_efl_ui_pan_pan_position_set(Eo *obj, Efl_Ui_Image_Zoo
|
||||||
psd->wsd->pan_y = pos.y;
|
psd->wsd->pan_y = pos.y;
|
||||||
evas_object_smart_changed(obj);
|
evas_object_smart_changed(obj);
|
||||||
|
|
||||||
efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, NULL);
|
efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, &pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Position2D
|
EOLIAN static Eina_Position2D
|
||||||
|
|
|
@ -59,7 +59,7 @@ _efl_ui_list_view_pan_efl_ui_pan_pan_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Li
|
||||||
psd->gmt.x = pos.x;
|
psd->gmt.x = pos.x;
|
||||||
psd->gmt.y = pos.y;
|
psd->gmt.y = pos.y;
|
||||||
|
|
||||||
efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, NULL);
|
efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, &pos);
|
||||||
evas_object_smart_changed(psd->wobj);
|
evas_object_smart_changed(psd->wobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ _efl_ui_pan_pan_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Pan_Data *psd, Eina_Pos
|
||||||
psd->py = pos.y;
|
psd->py = pos.y;
|
||||||
|
|
||||||
evas_object_smart_changed(obj);
|
evas_object_smart_changed(obj);
|
||||||
efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, NULL);
|
efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, &pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Position2D
|
EOLIAN static Eina_Position2D
|
||||||
|
|
|
@ -65,7 +65,7 @@ class @beta Efl.Ui.Pan extends Efl.Canvas.Group implements Efl.Content
|
||||||
}
|
}
|
||||||
events {
|
events {
|
||||||
pan,viewport,changed: void; [[This widget's position or size has changed.]]
|
pan,viewport,changed: void; [[This widget's position or size has changed.]]
|
||||||
pan,content_position,changed: void; [[The content's position has changed.]]
|
pan,content_position,changed: Eina.Position2D; [[The content's position has changed, its position in the event is the new position.]]
|
||||||
pan,content_size,changed: Eina.Size2D; [[The content's size has changed, its size in the event is the new size]]
|
pan,content_size,changed: Eina.Size2D; [[The content's size has changed, its size in the event is the new size]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue