[OpenLayers-Users] Click handler not handling clicks after
using editing toolbar
Eric Lemoine
eric.lemoine at camptocamp.com
Tue Mar 16 13:46:37 EDT 2010
On Tuesday, March 16, 2010, Dylan Parry <me at 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.
--
Eric Lemoine
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com
More information about the Users
mailing list