EAPI Eina_Bool elm_webview_auto_fitting_get();
EAPI Evas_Object *elm_webview_minimap_get(Evas_Object *obj);
EAPI void elm_webview_uri_set(Evas_Object *obj, const char *uri);
+ EAPI void elm_webview_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
/* NoContents */
EAPI Evas_Object *elm_nocontents_add(Evas_Object *parent);
if (!wd) return;
_elm_smart_webview_uri_set(wd->webkit, uri);
}
+
+/**
+ * Set bouncing behavior
+ *
+ * When scrolling, the WebView may "bounce" when reaching an edge of contents
+ * This is a visual way to indicate the end has been reached. This is enabled
+ * by default for both axes. This will set if it is enabled for that axis with
+ * the boolean parameers for each axis.
+ *
+ * @param obj The WebView object
+ * @param h_bounce Will the WebView bounce horizontally or not
+ * @param v_bounce Will the WebView bounce vertically or not
+ *
+ * @ingroup WebView
+ */
+EAPI void
+elm_webview_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ _elm_smart_webview_bounce_allow_set(wd->webkit, h_bounce, v_bounce);
+}
#endif
Evas_Object* widget;
int locked_dx;
int locked_dy;
+ unsigned char bounce_horiz : 1;
+ unsigned char bounce_vert : 1;
/* ewk functions */
void (*ewk_view_theme_set)(Evas_Object *, const char *);
sd->widget = wid;
}
+void
+_elm_smart_webview_bounce_allow_set(Evas_Object* obj, Eina_Bool horiz, Eina_Bool vert)
+{
+ API_ENTRY return;
+ sd->bounce_horiz = horiz;
+ sd->bounce_vert = vert;
+}
+
/* local subsystem functions */
static void
_smart_show(Evas_Object* obj)
content_h *= zoom;
DBG("<< ========content [%d, %d] new pos [%d, %d] >>\n", content_w, content_h, old_x + dx, old_y + dy);
+#if 0
if ((old_x + dx) >= 0 && (old_x + dx) <= content_w && !elm_widget_drag_lock_x_get(sd->widget))
elm_widget_drag_lock_x_set(sd->widget, EINA_TRUE);
if ((old_y + dy) >= 0 && (old_y + dy) <= content_h && !elm_widget_drag_lock_y_get(sd->widget))
locked = EINA_TRUE;
}
}
+#else
+ Eina_Bool locked = EINA_FALSE;
+ if (!sd->bounce_horiz)
+ {
+ if (!elm_widget_drag_lock_x_get(sd->widget))
+ {
+ if ((old_x + dx) >= 0 && (old_x + dx) <=content_w)
+ elm_widget_drag_lock_x_set(sd->widget, EINA_TRUE);
+ else if ((sd->locked_dx > 0 && (sd->locked_dx + dx) <= 0)
+ || (sd->locked_dx < 0 && (sd->locked_dx + dx) >= 0))
+ {
+ elm_widget_drag_lock_x_set(sd->widget, EINA_TRUE);
+ DBG("===============<< widget x lock >>\n");
+ dx += sd->locked_dx;
+ }
+ else
+ {
+ sd->locked_dx += dx;
+ locked = EINA_TRUE;
+ }
+ }
+ }
+ if (!sd->bounce_vert)
+ {
+ if (!elm_widget_drag_lock_y_get(sd->widget))
+ {
+ if ((old_y + dy) >= 0 && (old_y + dy) <= content_h)
+ elm_widget_drag_lock_y_set(sd->widget, EINA_TRUE);
+ else if ((sd->locked_dy > 0 && (sd->locked_dy + dy) <= 0)
+ || (sd->locked_dy < 0 && (sd->locked_dy + dy) >= 0))
+ {
+ elm_widget_drag_lock_y_set(sd->widget, EINA_TRUE);
+ DBG("===============<< widget y lock >>\n");
+ dy += sd->locked_dy;
+
+ }
+ else
+ {
+ sd->locked_dy += dy;
+ locked = EINA_TRUE;
+ }
+ }
+ }
+#endif
if (locked) return;