[OpenLayers-Users] mousedown
Greg Ederer
greg at ergonosis.com
Tue May 5 13:02:05 EDT 2009
Is there some way to register a callback to handle mousedown? I
really need this to get my user interface working properly.
Cheers,
Greg
On May 5, 2009, at 9:59 AM, Eric Lemoine wrote:
> On Monday, May 4, 2009, Greg Ederer <greg at ergonosis.com> 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
>>> Users at openlayers.org
>>> http://openlayers.org/mailman/listinfo/users
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> 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 : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
>
More information about the Users
mailing list