I found some redundant code blocks, unnessacery recursive logics and optimize way for interface_scrollable
so that I want to know nice opinions from community.
I made a.k.a summary diagram as below. and I am going to introduce it.
because bar is closely related with pan and also content, calculation related with bar should take place iniside pan_changed_cb. however, bar_size_adjust on pan_changed_cb will be invoked only when content is changed. it should be called when position/size of pan is changed, not only size of content is changed.
- redundancy of bar_size_adjust
bar_size_adjust is called from reconfigure and also pan_changed_cb now. but both edje_resize and edje_move have nothing to do with bar, and also pan_smart_resize(which invoke pan_changed_cb) will be invoked soon so that I think we can cut the way from reconfigure.
- Invalid internal state while calculating
In case of scroller resizing, edje resize/pan_smart_resize/content_resize will be called in order. however calculations of both bar size or page size on the edje resize could not be valid because size of pan or content could be changed. I think we have to postpone calculating of xxx_adjust once calculations are done so that we can calculate just once with valid states.
- Invalid logic
elm_obj_pan_pos_get(sid->pan_obj, &px, &py); if (vx != mx) x = px; if (vy != my) y = py; elm_obj_pan_pos_set(sid->pan_obj, x, y);
There is the logic like above in bar_size_adjust, but I don't really think the logic is reasonable. vx/y are double values of drag and mx/y are int values of pan_pos_max. The statement which compares ratio and pixel looks invalid for me. It will be false when content smaller than viewport (v==0.0 m==0px) or set position of pan which is a just 1px larger than content to the bottom.(v==1.0, m==1px) In almost case, this logic work like setting pan pos by current pan pos except really really rere case like above. That's the reason why I think we can remove it.
I can make result as below.
In this scenario, calculations are reduced to 1/20 in maximum case.
I am going to write a patch for this task.