}
static void _elm_scroll_scroll_bar_size_adjust(
- Elm_Scrollable_Smart_Interface_Data *);
-static void _elm_scroll_wanted_region_set(Evas_Object *);
+ Elm_Scrollable_Smart_Interface_Data *);
+//TIZEN_ONLY(20151012): Separate logic which calculate for bar size and logic which calculate for bar position.
+static void _elm_scroll_scroll_bar_pos_adjust(
+ Elm_Scrollable_Smart_Interface_Data *);
+//
static Eina_Bool _paging_is_enabled(Elm_Scrollable_Smart_Interface_Data *sid);
static Evas_Coord _elm_scroll_page_x_get(
Elm_Scrollable_Smart_Interface_Data *sid, int offset, Eina_Bool limit);
}
}
+//TIZEN_ONLY(20151012): Separate logic which calculate for bar size and logic which calculate for bar position.
+#if 0
static void
_elm_scroll_scroll_bar_size_adjust(Elm_Scrollable_Smart_Interface_Data *sid)
{
edje_object_part_drag_size_set
(sid->edje_obj, "elm.dragable.vbar", 1.0, size);
- edje_object_part_drag_value_get
- (sid->edje_obj, "elm.dragable.hbar", &vx, NULL);
- edje_object_part_drag_value_get
- (sid->edje_obj, "elm.dragable.vbar", NULL, &vy);
+ //TIZEN_ONLY(20150909) : Use the specific bar_chagnged_bar_pos_adjust func only for gengrid.
+ //edje_object_part_drag_value_get
+ // (sid->edje_obj, "elm.dragable.hbar", &vx, NULL);
+ //edje_object_part_drag_value_get
+ // (sid->edje_obj, "elm.dragable.vbar", NULL, &vy);
+ //
eo_do(sid->pan_obj, elm_obj_pan_pos_max_get(&mx, &my));
eo_do(sid->pan_obj, elm_obj_pan_pos_min_get(&minx, &miny));
- x = vx * mx + minx;
- y = vy * my + miny;
+ //TIZEN_ONLY(20150909) : Use the specific bar_chagnged_bar_pos_adjust func only for gengrid.
+ //x = vx * mx + minx;
+ //y = vy * my + miny;
+ //
edje_object_part_drag_step_set
(sid->edje_obj, "elm.dragable.hbar", (double)sid->step.x /
(sid->edje_obj, "elm.dragable.vbar", 0.0,
-((double)sid->page.y * ((double)vh / (double)h)) / 100.0);
- eo_do(sid->pan_obj, elm_obj_pan_pos_get(&px, &py));
- if (vx != mx) x = px;
- if (vy != my) y = py;
+ //TIZEN_ONLY(20150909) : Use the specific bar_chagnged_bar_pos_adjust func only for gengrid.
+ //eo_do(sid->pan_obj, elm_obj_pan_pos_get(&px, &py));
+ //
+ //if (vx != mx) x = px;
+ //if (vy != my) y = py;
+ //
+ eo_do(sid->obj, elm_interface_scrollable_custom_pan_pos_adjust(&x, &y));
+ //
+
eo_do(sid->pan_obj, elm_obj_pan_pos_set(x, y));
if (mx > 0) vx = (double)(x - minx) / (double)mx;
sid->size_adjust_recurse_abort = EINA_FALSE;
}
}
+#endif
+//Calculate size of bar and position of bar must be separated two different functions.
+//So we divided a function into the elm_scroll_scroll_bar_pos_adjust and elm_scroll_scroll_bar_size_adjust.
+//A elm_scroll_scroll_bar_pos_adjust is called when size of content is changed.
+//If size of pan is changed only, A elm_scroll_scroll_bar_pos_adjust isn`t called. Only a elm_scroll_scroll_bar_size_adjust is called.
+//
+//This function adjusts the size of the bar.
+static void
+_elm_scroll_scroll_bar_size_adjust(Elm_Scrollable_Smart_Interface_Data *sid)
+{
+ if (!sid->pan_obj || !sid->edje_obj) return;
+
+ if (sid->size_adjust_recurse_abort) return;
+ if (sid->size_adjust_recurse > 20)
+ {
+ sid->size_adjust_recurse_abort = EINA_TRUE;
+ return;
+ }
+ sid->size_adjust_recurse++;
+ if ((sid->content) || (sid->extern_pan))
+ {
+ Evas_Coord w, h, vw = 0, vh = 0;
+ double size;
+
+ edje_object_part_geometry_get
+ (sid->edje_obj, "elm.swallow.content", NULL, NULL, &vw, &vh);
+ w = sid->content_info.w;
+ if (w < 1) w = 1;
+ size = (double)vw / (double)w;
+ if (size > 1.0) size = 1.0;
+ edje_object_part_drag_size_set
+ (sid->edje_obj, "elm.dragable.hbar", size, 1.0);
+
+ h = sid->content_info.h;
+ if (h < 1) h = 1;
+ size = (double)vh / (double)h;
+ if (size > 1.0) size = 1.0;
+ edje_object_part_drag_size_set
+ (sid->edje_obj, "elm.dragable.vbar", 1.0, size);
+
+ edje_object_part_drag_step_set
+ (sid->edje_obj, "elm.dragable.hbar", (double)sid->step.x /
+ (double)w, 0.0);
+ edje_object_part_drag_step_set
+ (sid->edje_obj, "elm.dragable.vbar", 0.0, (double)sid->step.y /
+ (double)h);
+ if (sid->page.x > 0)
+ edje_object_part_drag_page_set
+ (sid->edje_obj, "elm.dragable.hbar", (double)sid->page.x /
+ (double)w, 0.0);
+ else
+ edje_object_part_drag_page_set
+ (sid->edje_obj, "elm.dragable.hbar",
+ -((double)sid->page.x * ((double)vw / (double)w)) / 100.0, 0.0);
+ if (sid->page.y > 0)
+ edje_object_part_drag_page_set
+ (sid->edje_obj, "elm.dragable.vbar", 0.0,
+ (double)sid->page.y / (double)h);
+ else
+ edje_object_part_drag_page_set
+ (sid->edje_obj, "elm.dragable.vbar", 0.0,
+ -((double)sid->page.y * ((double)vh / (double)h)) / 100.0);
+ }
+ else
+ {
+ edje_object_part_drag_size_set
+ (sid->edje_obj, "elm.dragable.vbar", 1.0, 1.0);
+ edje_object_part_drag_size_set
+ (sid->edje_obj, "elm.dragable.hbar", 1.0, 1.0);
+ }
+ _elm_scroll_scroll_bar_visibility_adjust(sid);
+ sid->size_adjust_recurse--;
+ if (sid->size_adjust_recurse <= 0)
+ {
+ sid->size_adjust_recurse = 0;
+ sid->size_adjust_recurse_abort = EINA_FALSE;
+ }
+}
+//This function adjusts the position of the bar.
+static void
+_elm_scroll_scroll_bar_pos_adjust(Elm_Scrollable_Smart_Interface_Data *sid)
+{
+ if (!sid->pan_obj || !sid->edje_obj) return;
+
+ if ((sid->content) || (sid->extern_pan))
+ {
+ Evas_Coord x, y, w, h, mx = 0, my = 0, vw = 0, vh = 0,
+ minx = 0, miny = 0;
+ double vx, vy, size;
+
+ edje_object_part_geometry_get
+ (sid->edje_obj, "elm.swallow.content", NULL, NULL, &vw, &vh);
+ w = sid->content_info.w;
+ if (w < 1) w = 1;
+ size = (double)vw / (double)w;
+ if (size > 1.0)
+ {
+ size = 1.0;
+ edje_object_part_drag_value_set
+ (sid->edje_obj, "elm.dragable.hbar", 0.0, 0.0);
+ }
+
+ h = sid->content_info.h;
+ if (h < 1) h = 1;
+ size = (double)vh / (double)h;
+ if (size > 1.0)
+ {
+ size = 1.0;
+ edje_object_part_drag_value_set
+ (sid->edje_obj, "elm.dragable.vbar", 0.0, 0.0);
+ }
+
+ eo_do(sid->pan_obj, elm_obj_pan_pos_max_get(&mx, &my));
+ eo_do(sid->pan_obj, elm_obj_pan_pos_min_get(&minx, &miny));
+ eo_do(sid->obj, elm_interface_scrollable_custom_pan_pos_adjust(&x, &y));
+ eo_do(sid->pan_obj, elm_obj_pan_pos_set(x, y));
+
+ if (mx > 0) vx = (double)(x - minx) / (double)mx;
+ else vx = 0.0;
+
+ if (vx < 0.0) vx = 0.0;
+ else if (vx > 1.0)
+ vx = 1.0;
+
+ if (my > 0) vy = (double)(y - miny) / (double)my;
+ else vy = 0.0;
+
+ if (vy < 0.0) vy = 0.0;
+ else if (vy > 1.0)
+ vy = 1.0;
+
+ edje_object_part_drag_value_set
+ (sid->edje_obj, "elm.dragable.vbar", 0.0, vy);
+ edje_object_part_drag_value_set
+ (sid->edje_obj, "elm.dragable.hbar", vx, 0.0);
+ }
+ else
+ {
+ Evas_Coord px = 0, py = 0, minx = 0, miny = 0;
+
+ eo_do(sid->pan_obj, elm_obj_pan_pos_min_get(&minx, &miny));
+ eo_do(sid->pan_obj, elm_obj_pan_pos_get(&px, &py));
+ eo_do(sid->pan_obj, elm_obj_pan_pos_set(minx, miny));
+ if ((px != minx) || (py != miny))
+ edje_object_signal_emit(sid->edje_obj, "elm,action,scroll", "elm");
+ }
+}
+//
+
+//TIZEN_ONLY(20150909) : Use the specific bar_chagnged_bar_pos_adjust func only for gengrid.
+//When position of scrollbar is changed, you can adjust a position of custom pan by using this function.
+//
+EOLIAN static void
+_elm_interface_scrollable_custom_pan_pos_adjust(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *sid, Evas_Coord *x, Evas_Coord *y)
+{
+ Evas_Coord mx, my, minx, miny, px, py;
+ double vx, vy;
+
+ edje_object_part_drag_value_get
+ (sid->edje_obj, "elm.dragable.hbar", &vx, NULL);
+ edje_object_part_drag_value_get
+ (sid->edje_obj, "elm.dragable.vbar", NULL, &vy);
+
+ eo_do(sid->pan_obj, elm_obj_pan_pos_max_get(&mx, &my));
+ eo_do(sid->pan_obj, elm_obj_pan_pos_min_get(&minx, &miny));
+
+ *x = _round(vx * (double)mx + minx, 1);
+ *y = _round(vy * (double)my + miny, 1);
+
+ eo_do(sid->pan_obj, elm_obj_pan_pos_get(&px, &py));
+
+ if (vx != mx) *x = px;
+ if (vy != my) *y = py;
+}
+//
static void
_elm_scroll_scroll_bar_read_and_update(
{
Evas_Coord w = 0, h = 0;
Elm_Scrollable_Smart_Interface_Data *sid = data;
+ //TIZEN_ONLY(20151013): Check the validity of pan value
+ Evas_Coord pan_x = 0, pan_y = 0, minx = 0, miny = 0, mx = 0, my = 0;
+
+ eo_do(sid->pan_obj, elm_obj_pan_pos_get(&pan_x, &pan_y));
+ eo_do(sid->pan_obj, elm_obj_pan_pos_min_get(&minx, &miny));
+ eo_do(sid->pan_obj, elm_obj_pan_pos_max_get(&mx, &my));
+ if (pan_x < minx) pan_x = minx;
+ else if (pan_x > mx + minx) pan_x = mx + minx;
+
+ if (pan_y < miny) pan_y = miny;
+ else if (pan_y > my + miny) pan_y = my + miny;
+
+ eo_do(sid->pan_obj, elm_obj_pan_pos_set(pan_x, pan_y));
+ //
if (sid->cb_func.content_viewport_resize)
{
sid->content_info.w = w;
sid->content_info.h = h;
_elm_scroll_scroll_bar_size_adjust(sid);
+ //TIZEN_ONLY(20151012): Separate logic which calculate for bar size and logic which calculate for bar position.
+ //A elm_scroll_scroll_bar_pos_adjust is called when size of content is changed.
+ //If size of pan is changed only, A elm_scroll_scroll_bar_pos_adjust isn`t called. Only a elm_scroll_scroll_bar_size_adjust is called.
+ _elm_scroll_scroll_bar_pos_adjust(sid);
+ //
evas_object_size_hint_min_set
(sid->edje_obj, sid->content_info.w, sid->content_info.h);
sid->content = NULL;
_elm_scroll_scroll_bar_size_adjust(sid);
+ //TIZEN_ONLY(20151012): Separate logic which calculate for bar size and logic which calculate for bar position.
+ //A elm_scroll_scroll_bar_pos_adjust is called when size of content is changed.
+ //If size of pan is changed only, A elm_scroll_scroll_bar_pos_adjust isn`t called. Only a elm_scroll_scroll_bar_size_adjust is called.
+ _elm_scroll_scroll_bar_pos_adjust(sid);
+ //
_elm_scroll_scroll_bar_reset(sid);
}
sid->content_info.h = h;
_elm_scroll_scroll_bar_size_adjust(sid);
+ //TIZEN_ONLY(20151012): Separate logic which calculate for bar size and logic which calculate for bar position.
+ //A elm_scroll_scroll_bar_pos_adjust is called when size of content is changed.
+ //If size of pan is changed only, A elm_scroll_scroll_bar_pos_adjust isn`t called. Only a elm_scroll_scroll_bar_size_adjust is called.
+ _elm_scroll_scroll_bar_pos_adjust(sid);
+ //
_elm_scroll_scroll_bar_reset(sid);
}