On Monday, May 4, 2009, Greg Ederer <[email protected]> wrote: > For reference, here's my code so far: > > OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { > defaultHandlerOptions: { > 'single': true, > 'double': false, > 'mousedown' : false, > 'pixelTolerance': 0, > 'stopSingle': false, > 'stopDouble': false > }, > > initialize: function(options) > { > this.handlerOptions = OpenLayers.Util.extend( > {}, this.defaultHandlerOptions > ); > OpenLayers.Control.prototype.initialize.apply( > this, arguments > ); > this.handler = new OpenLayers.Handler.Click( > this, { > 'click': this.onClick, > 'dblclick': this.onDblclick, > 'mousedown' : this.onMouseDown > }, this.handlerOptions > ); > }, > > onMouseDown : function(evt) > { > alert('hi'); > }, > > ... > > var controls = { > "single": new OpenLayers.Control.Click({ > hanlerOptions: { > "single": true > } > }), > "mousedown": new OpenLayers.Control.Click({ > hanlerOptions: { > "single": true > } > }), > "double": new OpenLayers.Control.Click({ > handlerOptions: { > "single": false, > "double": true > } > }), > "both": new OpenLayers.Control.Click({ > handlerOptions: { > "single": true, > "double": true > } > }), > "drag": new OpenLayers.Control.Click({ > handlerOptions: { > "single": true, > "pixelTolerance": null > } > }), > "stopsingle": new OpenLayers.Control.Click({ > handlerOptions: { > "single": true, > "stopSingle": true > } > }), > "stopdouble": new OpenLayers.Control.Click({ > handlerOptions: { > "single": false, > "double": true, > "stopDouble": true > } > }) > }; > > var control; > for(var key in controls) { > control = controls[key]; > // only to route output here > control.key = key; > this.map.addControl(control); > //console.log('added control: ' + key); > } > > But, onMouseDown never gets called.
This is expected. The Click handler can be passed "click" and "dblclick" callbacks only. Cheers, > > Greg > > On May 4, 2009, at 10:16 AM, Greg Ederer wrote: > >> Hi, >> >> I need to capture mousedown events on a Map. I'm using a custom >> OpenLayers.Control.Click for click and dblclick. But, Click does not >> appear to handle mousedown events. Any suggestions? >> >> Thanks! >> >> Greg >> _______________________________________________ >> Users mailing list >> [email protected] >> http://openlayers.org/mailman/listinfo/users > > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users > -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : [email protected] http://www.camptocamp.com _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
