[OpenLayers-Trac] [OpenLayers] #3217: Click handler - mouse listeners may be re-registered

OpenLayers trac-20090302 at openlayers.org
Wed Mar 30 12:20:47 EDT 2011


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

 {{{
 touchstart: function(evt) {
     if(!this.touch) {
         this.touch = true;
         this.unregisterMouseListeners();
     }
     ...
 }}}

 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 call {{{unregisterMouseListeners}}} 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;
     }
     ...
 }
 }}}

 I think that's what we were using before we introduced this
 {{{unregisterMouseListeners}}} function.

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


More information about the Trac mailing list