]> source.dussan.org Git - vaadin-framework.git/commitdiff
Improved TouchScrollHandler helper
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Fri, 4 May 2012 13:41:04 +0000 (13:41 +0000)
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Fri, 4 May 2012 13:41:04 +0000 (13:41 +0000)
svn changeset:23679/svn branch:6.8

src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java

index a2a94489e49789db84c79a7a33aae8dc9e606d93..ac9527e3ef0806e2c248fd720668c6a00612f30a 100644 (file)
@@ -100,37 +100,30 @@ public class TouchScrollDelegate implements NativePreviewHandler {
                 widget.addDomHandler(this, TouchStartEvent.getType());
             } else {
                 delegate = null;
-                widget.addDomHandler(new TouchStartHandler() {
-
-                    public void onTouchStart(TouchStartEvent event) {
-                        // TODO Auto-generated method stub
-
-                    }
-                }, TouchStartEvent.getType());
             }
             setElements(scrollables);
         }
 
         public void onTouchStart(TouchStartEvent event) {
-            VConsole.log("TouchScrollHandler onTouchStart");
             assert delegate != null;
             delegate.onTouchStart(event);
         }
 
         public void setElements(Element... scrollables) {
+            for (Element scrollable : scrollables) {
+                scrollable.addClassName("v-scrollable");
+            }
             if (requiresDelegate) {
                 delegate.setElements(scrollables);
-            } else if (BrowserInfo.get().isTouchDevice()) {
-                for (Element e : scrollables) {
-                    e.getStyle().setProperty("overflow", "auto");
-                    e.getStyle().setProperty("-webkit-overflow-scrolling",
-                            "touch");
-                    e.getStyle().setProperty("-webkit-user-select", "none");
-                }
             }
         }
     }
 
+    public static TouchScrollHandler enableTouchScrolling(Widget widget,
+            Element... scrollables) {
+        return new TouchScrollHandler(widget, scrollables);
+    }
+
     public TouchScrollDelegate(Element... elements) {
         scrollableElements = elements;
     }