[OpenLayers-Dev] Pan with left, Zoom(Box) with right mouse button

Dirk Hamberger Dirk.Hamberger at ptv.de
Wed Jan 13 10:24:00 EST 2010


I don't expect this to be that easy as
just rewriting / subclassing the Navigation control ...

Especially, I wonder if any native Drag Operation within
OpenLayers is limited to the left mouse button for some
reason ...

All the way down the inheritance and aggregation chain down from ...

OpenLayers.Control.Navigation -> 
OpenLayers.Control.ZoomBox ->
OpenLayers.Handler.Box ->
OpenLayers.Handler.Drag

... I see the following line in the Drag Handler:

   mousedown: function (evt) {
        var propagate = true;
        this.dragging = false;
        if (this.checkModifiers(evt) && OpenLayers.Event.isLeftClick(evt)) {
            this.started = true;
            ...
        } else {
            this.started = false;
            ...

And on the way down my source sniffing, there's always the 
construct "keyMask" (e.g. OpenLayers.Handler.MOD_SHIFT) /
"checkModifiers(evt)"

As ZoomBox and the Panning both depend on the Drag Handler
I suppose neither of both could be installed on the right mouse button
without writing and patchin a whole bunch of OpenLayers Code ...

Or am I mislead - for some reason I can't find any drag operation
in OpenLayers that resides on the right mouse button ...!?


Regards,
Dirk.



 


Dan Little wrote:
> 
> I think all of the code is there for the options you want to create but
> you'll need to spend some time writing a custom Control.  You can probably
> start with the OpenLayers.Control.Navigation class.
> 
> 
>>
>>From: Dirk Hamberger <Dirk.Hamberger at ptv.de>
>>To: "dev at openlayers.org" <dev at openlayers.org>
>>Sent: Wed, January 13, 2010 1:44:44 AM
>>Subject: [OpenLayers-Dev] Pan with left, Zoom(Box) with right mouse button
>>
>> >
>>
>>
>>>
>>Hi everyone, 
>> 
>>has anybody already tried to alter the way
>>OpenLayers handles
>>panning and dragging a zoombox?
>> 
>>I don’t want to have a “modifier
>>key” to switch the Navigation-Control
>>to zoombox mode, instead I want to have the
>>ZoomBox feature on 
>>the right mousebutton.
>> 
>>What is even trickier – at the same
>>time I still want to be able to
>>Intercept a “normal” right
>>mouse click (say mousedown or mouseup 
>>Event) in order to install a custom context
>>menu when the right mouse
>>Is just clicked and not dragged a few
>>pixels …
>> 
>>Any solution or approaches to that kind of
>>challenge?
>> 
>> 
>>CheerZ, 
>>Dirk Hamberger.
> 
> 
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
> 
> 

-- 
View this message in context: http://n2.nabble.com/Pan-with-left-Zoom-Box-with-right-mouse-button-tp4326380p4349240.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.



More information about the Dev mailing list