diff options
author | Sangpyo Kim <sangpyo7.kim@samsung.com> | 2012-09-13 20:03:09 +0900 |
---|---|---|
committer | Sangpyo Kim <sangpyo7.kim@samsung.com> | 2012-09-14 09:56:25 +0900 |
commit | e374a623776df3a9d3694acff37b8f4ba2478e8b (patch) | |
tree | 9300c4789d0e1bae97e6c60f39cf6939452d7312 | |
parent | 54360a70f2aafefa7cf8dbd7e578185320521cf1 (diff) | |
download | browser-e374a623776df3a9d3694acff37b8f4ba2478e8b.tar.gz browser-e374a623776df3a9d3694acff37b8f4ba2478e8b.tar.bz2 browser-e374a623776df3a9d3694acff37b8f4ba2478e8b.zip |
[Title] show appropriate zoom buttons when zoom level is changed
[Issue#] N_SE-9986
[Problem] Zoom In/out button doesn't work at the mobile site.
[Cause] there was no proper scale factor comparing code.
[Solution] hiding the buttons if min/max zoom level is same
[Team] Browser UI
[Developer] sangpyo7.kim
[Request] N/A
Change-Id: I017ff37dde47e4a83af065da6bffc8652cb059d7
-rwxr-xr-x | edc/browser-view-main.edc | 20 | ||||
-rwxr-xr-x | src/browser-view/browser-view.cpp | 31 |
2 files changed, 48 insertions, 3 deletions
diff --git a/edc/browser-view-main.edc b/edc/browser-view-main.edc index 7bda44b1..53d23309 100755 --- a/edc/browser-view-main.edc +++ b/edc/browser-view-main.edc @@ -645,6 +645,26 @@ collections { target: "elm.swallow.zoom_out_button"; target: "elm.swallow.zoom_in_button"; } + program { name: "show,zoom_in_buttons"; + signal: "show,zoom_in_buttons,signal"; + action: STATE_SET "visible" 0.0; + target: "elm.swallow.zoom_in_button"; + } + program { name: "hide,zoom_in_buttons"; + signal: "hide,zoom_in_buttons,signal"; + action: STATE_SET "default" 0.0; + target: "elm.swallow.zoom_in_button"; + } + program { name: "show,zoom_out_buttons"; + signal: "show,zoom_out_buttons,signal"; + action: STATE_SET "visible" 0.0; + target: "elm.swallow.zoom_out_button"; + } + program { name: "hide,zoom_out_buttons"; + signal: "hide,zoom_out_buttons,signal"; + action: STATE_SET "default" 0.0; + target: "elm.swallow.zoom_out_button"; + } /* endif ZOOM_BUTTON */ ///////////////////////////// diff --git a/src/browser-view/browser-view.cpp b/src/browser-view/browser-view.cpp index 59a39ebb..cf5d6360 100755 --- a/src/browser-view/browser-view.cpp +++ b/src/browser-view/browser-view.cpp @@ -1307,13 +1307,17 @@ void Browser_View::__ewk_view_mouse_down_cb(void* data, Evas* evas, Evas_Object* if (zoom_button_flag == false) return; - ewk_view_scale_range_get(browser_view->m_focused_window->m_ewk_view, &min_scale, &max_scale); + + if (min_scale < scale_factor) + edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "show,zoom_out_buttons,signal", ""); + if (max_scale > scale_factor) + edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "show,zoom_in_buttons,signal", ""); + if (browser_view->m_zoom_button_timer) ecore_timer_del(browser_view->m_zoom_button_timer); browser_view->m_zoom_button_timer = ecore_timer_add(3, __zoom_button_timeout_cb, browser_view); - edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "show,zoom_buttons,signal", ""); #endif } @@ -4004,7 +4008,8 @@ Eina_Bool Browser_View::__zoom_button_timeout_cb(void *data) Browser_View *browser_view = (Browser_View *)data; browser_view->m_zoom_button_timer = NULL; - edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "hide,zoom_buttons,signal", ""); + edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "hide,zoom_in_buttons,signal", ""); + edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "hide,zoom_out_buttons,signal", ""); return ECORE_CALLBACK_CANCEL; } @@ -4016,8 +4021,18 @@ void Browser_View::__zoom_out_clicked_cb(void *data, Evas_Object *obj, void *eve return; Browser_View *browser_view = (Browser_View *)data; + double min_scale = 0; + double max_scale = 0; double scale_factor = ewk_view_scale_get(browser_view->m_focused_window->m_ewk_view); ewk_view_scale_set(browser_view->m_focused_window->m_ewk_view, scale_factor - 0.5f, 0, 0); + ewk_view_scale_range_get(browser_view->m_focused_window->m_ewk_view, + &min_scale, &max_scale); + + if ((scale_factor - 0.5f) <= min_scale) + edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "hide,zoom_out_buttons,signal", ""); + + if (scale_factor == max_scale) + edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "show,zoom_in_buttons,signal", ""); if (browser_view->m_zoom_button_timer) ecore_timer_del(browser_view->m_zoom_button_timer); @@ -4031,8 +4046,18 @@ void Browser_View::__zoom_in_clicked_cb(void *data, Evas_Object *obj, void *even return; Browser_View *browser_view = (Browser_View *)data; + double min_scale = 0; + double max_scale = 0; double scale_factor = ewk_view_scale_get(browser_view->m_focused_window->m_ewk_view); ewk_view_scale_set(browser_view->m_focused_window->m_ewk_view, scale_factor + 0.5f, 0, 0); + ewk_view_scale_range_get(browser_view->m_focused_window->m_ewk_view, + &min_scale, &max_scale); + + if ((scale_factor + 0.5f) >= max_scale) + edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "hide,zoom_in_buttons,signal", ""); + + if (scale_factor == min_scale) + edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "show,zoom_out_buttons,signal", ""); if (browser_view->m_zoom_button_timer) ecore_timer_del(browser_view->m_zoom_button_timer); |