hoversel: fix hover position in hoversel, when it goes out of the viewport 76/84376/2
authorJee-Yong Um <jc9.um@samsung.com>
Thu, 18 Aug 2016 08:40:57 +0000 (17:40 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Fri, 19 Aug 2016 01:56:07 +0000 (18:56 -0700)
=============================================================================
   hoversel: fix hover position in hoversel, when it goes out of the viewport

    Summary:
    Hoversel Widget is designed in such a way that it accepts top/bottom/left/right directions , internally it uses hover widget which does not take care if its content goes of it's parent (Elm_Win in most c~
Signed-off-by: divyesh purohit <div.purohit@samsung.com>
Signed-off-by: Jee-Yong Um <conr2d@gmail.com>
    Test Plan:
    Open entry widget and right click to show a hoversel widget, check if the hoversel or hover content goes out of the window.

    this is what hoversel would look like after this patch {F27551}

    Screenshots of top-left / top-right/ bottom-left and bottom-right corners in entry after this patch

    {F27553}

    {F27554}

    {F27555}

    {F27557}

    Reviewers: shilpasingh, conr2d, raster, cedric, Hermet

    Subscribers: rajeshps, govi

    Projects: #elementary

    Maniphest Tasks: T2965

    Differential Revision: https://phab.enlightenment.org/D3513
=============================================================================

Signed-Off-By: Jee-Yong Um <jc9.um@samsung.com>
Change-Id: I8bd12abb425234ad15edec30281987905dbdbd85

src/lib/elc_hoversel.c

index 50fdecb..9a2aa6c 100644 (file)
@@ -333,9 +333,20 @@ _resizing_eval(Evas_Object *obj, Elm_Hoversel_Data *sd)
 
         if (xx < 0) xx = x;
         if ((xx + ww) > (x + w))
-          ww = (x + w) - xx;
+          {
+             if ((obj_x + obj_w - x) > ((x + w) - obj_x))
+               {
+                  elm_layout_signal_emit(sd->hover, "elm,state,align,right", "elm");
+                  if ((obj_x + obj_w - ww) < x)
+                    ww = obj_x + obj_w - x;
+               }
+             else
+               {
+                  elm_layout_signal_emit(sd->hover, "elm,state,align,default", "elm");
+                  ww = (x + w) - xx;
+               }
+          }
      }
-
    evas_object_size_hint_min_set(sd->spacer, ww, hh);
 
    // TIZEN_ONLY(20150828): shrink item width expanding over hover parent