[OpenLayers-Users] {'zoomWheelEnabled':false}

André Matos andre.matos at co.sapo.pt
Thu Dec 18 11:21:59 EST 2008


You could simply don't add Navigation Control... Then with the map instance
you can get the reference for the Navigation control:

var controls = map.getControlsByClass('OpenLayers.Control.Navigation');

and then disable the zoom wheel:

for(var i = 0; i<controls.length; ++i){
	map.removeControl(controls[i]);
}


Ps: This code also works if you want to add the Navigation control :D.

Regards

-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
Behalf Of Christopher Schmidt
Sent: quinta-feira, 18 de Dezembro de 2008 15:53
To: Didrik Pinte
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] {'zoomWheelEnabled':false}

On Thu, Dec 18, 2008 at 04:43:56PM +0100, Didrik Pinte wrote:
> Hi,
> 
> I'm trying to disable the mouse wheel interaction.
> 
> I've followed the navigation control example but it does not work. 
> 
> I initialise my map without controls, then I add ScaleLine, PanZoomBar,
> NavToolBar, LayerSwitcher, MousePosition  and KeyboardDefaults
> 
> Finally, I add my Navigation and explicitely call disableZoomWheel() on
> it BUT the zoom wheel stays activated on the loaded map.

You have added two Navigation controls to your map. The NavToolbar
creates a Navigation control (internally).

If you want different behavior of the NavToolbar, you'll need to create
a custom toolbar control -- copying the code from the NavToolbar, and
change the options of the Navigation control in the initialize.

> Is there any interaction between the Navigation and the other controls
> that could force the zoom wheel to stay activated ? 
> 
> Thanks
> 
> Didrik



> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users


-- 
Christopher Schmidt
MetaCarta
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list