[OpenLayers-Users] Disabling a function when over the MouseToolBar or PanZoomBar or LayerSwitcher

Eric Lemoine eric.c2c at gmail.com
Mon Sep 1 15:55:25 EDT 2008


Hi. I'm not sure at all it'll work but here's what i'd try:

var ls = OpenLayers.Control.LayerSwitcher();
ls.events.fallThrough = false;

Eric

2008/8/26, Chippert <ctaylor at preparedresponse.com>:
>
> I have a simple implementation where I want to update some lat and long
> values when the user clicks the mouse.  However, we want to use the
> MouseToolBar control or the PanZoomBar control and the LayerSwitcher control
> and when the user clicks on those, we do NOT want to update the lat/long.
> Here is the essential part of my code:
>
>                                    map.addControl(new
> OpenLayers.Control.LayerSwitcher());
> 		         map.addControl(new OpenLayers.Control.MouseToolBar());
>                                    map.addControl(new
> OpenLayers.Control.MousePosition());
> 	
> 			//----------------------------------------------//
> 			map.events.register("click", map, function(e){
> 			var lonlat = map.getLonLatFromViewPortPx(e.xy);
> 			var aTemp=lonlat.toString().split(",");
> 			clickLon=aTemp[0].replace("lon=","");
> 			clickLat=aTemp[1].replace("lat=","");
> 			var tLat = document.getElementById("tbLat");
> 			var tLon = document.getElementById("tbLon");
> 			tLat.value=parseFloat(clickLat).toFixed(5);
> 			tLon.value=parseFloat(clickLon).toFixed(5);
> 			}
> 			)
> 			//---------------------------------------------//
>
> Right now, when the user clicks on the controls, the lat/lon is updated.
> Any help would be appreciated.
>
>
> --
> View this message in context:
> http://www.nabble.com/Disabling-a-function-when-over-the-MouseToolBar-or-PanZoomBar-or-LayerSwitcher-tp19169860p19169860.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list