[OpenLayers-Trac] [OpenLayers] #3120: click handler should not store event associated with touchstart

OpenLayers trac-20090302 at openlayers.org
Fri Feb 25 08:43:07 EST 2011


#3120: click handler should not store event associated with touchstart
---------------------------+------------------------------------------------
 Reporter:  tschaub        |       Owner:  tschaub     
     Type:  feature        |      Status:  new         
 Priority:  minor          |   Milestone:  2.11 Release
Component:  Handler.Click  |     Version:  2.10        
 Keywords:                 |       State:              
---------------------------+------------------------------------------------
 The event we get with touchstart is the same event we get with every
 subsequent touchmove.  The click handler currently stores the touchstart
 event as "down" - making the assumption that this is not modified.

 The example below demonstrates the issue:
 {{{
 <!DOCTYPE html>
 <html>
     <head>
         <meta name="viewport" content="width=device-width; initial-
 scale=1.0; maximum-scale=1.0; user-scalable=0;" />
         <meta name="apple-mobile-web-app-capable" content="yes" />
         <title>single event</title>
     </head>
     <body>
         <h1 id="title">setCenter</h1>
         <div id="block" style="width: 200px; height: 100px; border: 1px
 solid black"></div>
         <div id="out"></div>
         <script>
             var last;
             var el = document.getElementById("block");
             el.addEventListener("touchstart", function(evt) {
                 evt.preventDefault();
                 evt.stopPropagation();
                 last = evt;
             }, false)
             el.addEventListener("touchmove", function(move) {
                 document.getElementById("out").innerHTML += "same: " +
 (move === last) + "<br>";
             }, false);

         </script>
     </body>
 </html>
 }}}

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3120>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list