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

Chippert ctaylor at preparedresponse.com
Tue Aug 26 16:36:19 EDT 2008


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.




More information about the Users mailing list