]> source.dussan.org Git - vaadin-framework.git/commitdiff
Handle touch events in Window (#18042)
authorAnna Koskinen <anna@vaadin.com>
Mon, 9 May 2016 09:08:39 +0000 (12:08 +0300)
committerTeemu Suo-Anttila <teemusa@vaadin.com>
Wed, 11 May 2016 09:15:26 +0000 (12:15 +0300)
- fixes dragging not working from Window header

Change-Id: I1b325db908a2cf9c003ede144105f26d0846aa31

client/src/com/vaadin/client/ui/VWindow.java

index f037d74f910db9de0a3efa80aecc4a9dff890696..737af90b1f41117870797c706ff4adf3ab58df23 100644 (file)
@@ -989,7 +989,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
         } else if (header.isOrHasChild(target) && !dragging) {
             // dblclick handled in connector
             if (type != Event.ONDBLCLICK && draggable) {
-                if (type == Event.ONMOUSEDOWN) {
+                if (type == Event.ONMOUSEDOWN || type == Event.ONTOUCHSTART) {
                     /**
                      * Prevents accidental selection of window caption or
                      * content. (#12726)
@@ -997,7 +997,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
                     event.preventDefault();
 
                     headerDragPending = event;
-                } else if (type == Event.ONMOUSEMOVE
+                } else if ((type == Event.ONMOUSEMOVE || type == Event.ONTOUCHMOVE)
                         && headerDragPending != null) {
                     // ie won't work unless this is set here
                     dragging = true;
@@ -1023,7 +1023,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
          * If clicking on other than the content, move focus to the window.
          * After that this windows e.g. gets all keyboard shortcuts.
          */
-        if (type == Event.ONMOUSEDOWN
+        if ((type == Event.ONMOUSEDOWN || type == Event.ONTOUCHSTART)
                 && !contentPanel.getElement().isOrHasChild(target)
                 && target != closeBox && target != maximizeRestoreBox) {
             contentPanel.focus();