On 16/03/2010 17:46, Eric Lemoine wrote: > On Tuesday, March 16, 2010, Dylan Parry<m...@dylanparry.com> wrote: >> Hi, >> >> I’ve set up a click handler on my map to handle double-clicks. I did >> this by bastardising the demo for click handlers, so the code I have is >> as follows: >> >> --- start --- >> OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { >> >> defaultHandlerOptions: { >> 'single': true, >> 'double': true, >> 'pixelTolerance': 0, >> 'stopSingle': false, >> 'stopDouble': true >> }, >> >> initialize: function(options) { >> this.handlerOptions = OpenLayers.Util.extend( >> {}, this.defaultHandlerOptions >> ); >> OpenLayers.Control.prototype.initialize.apply( >> this, arguments >> ); >> this.handler = new OpenLayers.Handler.Click( >> this, { >> 'dblclick': this.onDblclick >> }, this.handlerOptions >> ); >> }, >> >> onDblclick: function(evt) { >> // A jQuery function that isn’t relevant here >> } >> }); >> >> // Double click handler >> var doubleClick = new OpenLayers.Control.Click({ >> handlerOptions: { >> "single": false, >> "double": true, >> "stopDouble": true >> } >> }); >> map.addControl(doubleClick); >> doubleClick.activate(); >> --- end --- >> >> All this code lives in the function that initialises the map. I’ve also >> got an editing toolbar on the map, which is added to the map controls >> during initialisation. >> >> The double click handler works just fine, but if I click on any of the >> buttons in the editing toolbar, then click back to the “move” button, it >> no longer handles the double click events and the map then zooms in when >> I double click, instead of running my custom function. >> >> Any ideas what I can do to stop this from happening? Is there maybe an >> event that fires when you click the edit toolbar buttons that I can >> re-register my click handler in? > > Hi. Do you have a live example showing this? It'd really help help you.
Yes, the page I’m working on at the moment is at http://sheffield.devplan.org.uk/demo/. If you ignore the fact that the mapping isn’t tiling correctly (a server-side problem, and not the fastest mapping in the world either!), it works well other than the problem described above. Thanks, -- Dylan Parry _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users