[OpenLayers-Commits] r11424 - sandbox/cmoullet/openlayers/examples

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Feb 24 10:48:11 EST 2011


Author: cmoullet
Date: 2011-02-24 07:48:11 -0800 (Thu, 24 Feb 2011)
New Revision: 11424

Modified:
   sandbox/cmoullet/openlayers/examples/browser.html
   sandbox/cmoullet/openlayers/examples/browser.js
Log:
Add gesture event monitoring

Modified: sandbox/cmoullet/openlayers/examples/browser.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/browser.html	2011-02-24 15:29:51 UTC (rev 11423)
+++ sandbox/cmoullet/openlayers/examples/browser.html	2011-02-24 15:48:11 UTC (rev 11424)
@@ -115,6 +115,9 @@
 <INPUT TYPE=CHECKBOX ID="touchendID">touchend<BR>
 <INPUT TYPE=CHECKBOX ID="touchmoveID">touchmove<BR>
 <INPUT TYPE=CHECKBOX ID="touchcancelID">touchcancel<BR>
+<INPUT TYPE=CHECKBOX ID="gesturestartID">gesturestart<BR>
+<INPUT TYPE=CHECKBOX ID="gesturechangeID">gesturechange<BR>
+<INPUT TYPE=CHECKBOX ID="gestureendID">gestureend<BR>
 
 <div style="height: 250px;">
     <div id="box" style="height: 225px; width: 225px; background: none repeat scroll 0% 0% red; position: absolute;"
@@ -128,7 +131,10 @@
          ontouchstart="touchstart(event)"
          ontouchend="touchend(event)"
          ontouchmove="touchmove(event)"
-         ontouchcancel="touchcancel(event)">
+         ontouchcancel="touchcancel(event)"
+         ongesturestart="gesturestart(event)"
+         ongesturechange="gesturechange(event)"
+         ongestureend="gestureend(event)">
     </div>
 </div>
 

Modified: sandbox/cmoullet/openlayers/examples/browser.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/browser.js	2011-02-24 15:29:51 UTC (rev 11423)
+++ sandbox/cmoullet/openlayers/examples/browser.js	2011-02-24 15:48:11 UTC (rev 11424)
@@ -87,18 +87,16 @@
     if (document.getElementById("clickID").checked) {
         var box = document.getElementById("box");
         log(e.type, inspect(e));
-        if (event.preventDefault) event.preventDefault();
-        return false;
-    } else {
-        return false;
+        if (e.preventDefault) e.preventDefault();
     }
+    return false;
 }
 
 function dblclick(e) {
     if (document.getElementById("dblclickID").checked) {
         var box = document.getElementById("box");
         log(e.type, inspect(e));
-        if (event.preventDefault) event.preventDefault();
+        if (e.preventDefault) e.preventDefault();
     }
     return false;
 }
@@ -107,7 +105,7 @@
     if (document.getElementById("mousedownID").checked) {
         var box = document.getElementById("box");
         log(e.type, inspect(e));
-        if (event.preventDefault) event.preventDefault();
+        if (e.preventDefault) e.preventDefault();
     }
     return false;
 }
@@ -116,7 +114,7 @@
     if (document.getElementById("mouseupID").checked) {
         var box = document.getElementById("box");
         log(e.type, inspect(e));
-        if (event.preventDefault) event.preventDefault();
+        if (e.preventDefault) e.preventDefault();
     }
     return false;
 }
@@ -125,7 +123,7 @@
     if (document.getElementById("mouseoverID").checked) {
         var box = document.getElementById("box");
         log(e.type, inspect(e));
-        if (event.preventDefault) event.preventDefault();
+        if (e.preventDefault) e.preventDefault();
     }
     return false;
 }
@@ -134,7 +132,7 @@
     if (document.getElementById("mousemoveID").checked) {
         var box = document.getElementById("box");
         log(e.type, inspect(e));
-        if (event.preventDefault) event.preventDefault();
+        if (e.preventDefault) e.preventDefault();
     }
     return false;
 }
@@ -143,7 +141,7 @@
     if (document.getElementById("mouseoutID").checked) {
         var box = document.getElementById("box");
         log(e.type, inspect(e));
-        if (event.preventDefault) event.preventDefault();
+        if (e.preventDefault) e.preventDefault();
     }
     return false;
 }
@@ -153,7 +151,7 @@
         var box = document.getElementById("box");
         log(e.type, inspect(e));
         //logDetails(inspect(e.touches.item(0)));
-        if (event.preventDefault) event.preventDefault();
+        if (e.preventDefault) e.preventDefault();
     }
     return false;
 }
@@ -163,7 +161,7 @@
         var box = document.getElementById("box");
         log(e.type, inspect(e));
         //logDetails(inspect(e.touches.item(0)));
-        if (event.preventDefault) event.preventDefault();
+        if (e.preventDefault) e.preventDefault();
     }
     return false;
 }
@@ -176,7 +174,7 @@
         box.style.top = targetEvent.clientY + "px";
         log(e.type, inspect(e));
         //logDetails(inspect(e));
-        if (event.preventDefault) event.preventDefault();
+        if (e.preventDefault) e.preventDefault();
     }
     return false;
 }
@@ -186,11 +184,41 @@
         var box = document.getElementById("box");
         log(e.type, inspect(e));
         //logDetails(inspect(e.touches.item(0)));
-        if (event.preventDefault) event.preventDefault();
+        if (e.preventDefault) e.preventDefault();
     }
     return false;
 }
 
+function gesturestart(e) {
+    if (document.getElementById("gesturestartID").checked) {
+        var box = document.getElementById("box");
+        log(e.type, inspect(e));
+        //logDetails(inspect(e.touches.item(0)));
+        if (e.preventDefault) e.preventDefault();
+    }
+    return false;
+}
+
+function gesturechange(e) {
+    if (document.getElementById("gesturechangeID").checked) {
+        var box = document.getElementById("box");
+        log(e.type, inspect(e));
+        //logDetails(inspect(e.touches.item(0)));
+        if (e.preventDefault) e.preventDefault();
+    }
+    return false;
+}
+
+function gestureend(e) {
+    if (document.getElementById("gestureendID").checked) {
+        var box = document.getElementById("box");
+        log(e.type, inspect(e));
+        //logDetails(inspect(e.touches.item(0)));
+        if (e.preventDefault) e.preventDefault();
+    }
+    return false;
+}
+
 function toggle_visibility(id) {
     var e = document.getElementById(id);
     if (e.style.display == 'block') {



More information about the Commits mailing list