forked from enlightenment/efl
focus: Fixed the animation issue related to bring_in.
Summary: Calculating the coordinate of the object to retain the focus with in view port. Earlier focus was moving out of view port. Test Plan: elementary_test-> "Focus 3". Enable the Focus Auto scroll bring in and use keys to move focused item. Reviewers: raster, seoz, singh.amitesh, nirajkr Differential Revision: https://phab.enlightenment.org/D822
This commit is contained in:
parent
5f54c3d85a
commit
94bc3ce471
|
@ -714,6 +714,21 @@ _focus_highlight_clip_disable_changed_cb(void *data EINA_UNUSED,
|
||||||
elm_config_focus_highlight_clip_disabled_set(disable);
|
elm_config_focus_highlight_clip_disabled_set(disable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_focus_bring_in_changed_cb(void *data EINA_UNUSED,
|
||||||
|
Evas_Object *obj,
|
||||||
|
void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
elm_config_focus_auto_scroll_bring_in_enabled_set(elm_check_state_get(obj));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_horizontal_btn(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Evas_Object *box_btn = data;
|
||||||
|
elm_box_horizontal_set(box_btn, elm_check_state_get(obj));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_focus3(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
test_focus3(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
@ -791,6 +806,21 @@ test_focus3(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
|
||||||
_focus_highlight_clip_disable_changed_cb,
|
_focus_highlight_clip_disable_changed_cb,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
ck = elm_check_add(box);
|
||||||
|
elm_object_text_set(ck, "Focus Auto scroll bring in enable");
|
||||||
|
evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
evas_object_smart_callback_add(ck, "changed", _focus_bring_in_changed_cb,
|
||||||
|
NULL);
|
||||||
|
elm_check_state_set(ck, elm_config_focus_auto_scroll_bring_in_enabled_get());
|
||||||
|
elm_box_pack_end(box, ck);
|
||||||
|
evas_object_show(ck);
|
||||||
|
|
||||||
|
ck = elm_check_add(box);
|
||||||
|
elm_object_text_set(ck, "Horizontal Mode");
|
||||||
|
evas_object_smart_callback_add(ck, "changed", _horizontal_btn, box_btn);
|
||||||
|
elm_box_pack_end(box, ck);
|
||||||
|
evas_object_show(ck);
|
||||||
|
|
||||||
evas_object_show(win);
|
evas_object_show(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3789,8 +3789,35 @@ elm_widget_focus_highlight_focus_part_geometry_get(const Evas_Object *obj,
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_elm_widget_focus_highlight_geometry_get(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
_elm_widget_focus_highlight_geometry_get(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
||||||
{
|
{
|
||||||
|
Evas_Coord ox = 0, oy = 0, ow = 0, oh = 0;
|
||||||
|
Evas_Object *scroller = obj;
|
||||||
|
|
||||||
evas_object_geometry_get(obj, x, y, w, h);
|
evas_object_geometry_get(obj, x, y, w, h);
|
||||||
elm_widget_focus_highlight_focus_part_geometry_get(sd->resize_obj, x, y, w, h);
|
elm_widget_focus_highlight_focus_part_geometry_get(sd->resize_obj, x, y, w, h);
|
||||||
|
|
||||||
|
if (!_elm_config->focus_auto_scroll_bring_in_enable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
while (scroller)
|
||||||
|
{
|
||||||
|
if (_elm_scrollable_is(scroller))
|
||||||
|
{
|
||||||
|
eo_do(scroller,
|
||||||
|
elm_interface_scrollable_content_viewport_geometry_get(&ox, &oy, &ow, &oh));
|
||||||
|
|
||||||
|
if (*y < oy)
|
||||||
|
*y = oy;
|
||||||
|
else if ((oy + oh) < (*y + *h))
|
||||||
|
*y = (oy + oh - *h);
|
||||||
|
else if (*x < ox)
|
||||||
|
*x = ox;
|
||||||
|
else if ((ox + ow) < (*x + *w))
|
||||||
|
*x = (ox + ow - *w);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
scroller = elm_widget_parent_get(scroller);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Elm_Object_Item*
|
EOLIAN static Elm_Object_Item*
|
||||||
|
|
Loading…
Reference in New Issue