[OpenLayers-Trac] [OpenLayers] #3218: Drag handler - mouse listeners may be re-registered

OpenLayers trac-20090302 at openlayers.org
Wed Mar 30 12:23:33 EDT 2011


#3218: Drag handler - mouse listeners may be re-registered
--------------------------+-------------------------------------------------
 Reporter:  erilem        |       Owner:              
     Type:  bug           |      Status:  new         
 Priority:  major         |   Milestone:  2.11 Release
Component:  Handler.Drag  |     Version:  2.10        
 Keywords:                |       State:              
--------------------------+-------------------------------------------------
 Currently the touchstart function of the drag handler unregisters the
 mouse listeners when it is executed the first time:

 {{{
 touchstart: function(evt) {
     if(!this.touch) {
         this.touch = true;
         this.map.events.un({
             mousedown: this.mousedown,
             ...
         });
     }
     ...
 }}}

 The problem is that the mouse listeners will be re-registered if the
 handler is deactivated and re-activated, and touchstart won't unregister
 them again because of the touch flag.

 We could unconditionally unregiser the mouse listeners in touchstart, but
 we would incur a for loop over every mouse listener on each touchstart,
 which doesn't sound too good to me.

 Another solution involves having touchstart set touch to true, and
 immediately returning from the mouse listeners when touch is true. E.g.

 mousedown: function(evt) {
     if(this.true) {
         return;
     }
     ...
 }

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


More information about the Trac mailing list