[Mapbender-commits] r2001 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 21 11:31:07 EST 2008


Author: nimix
Date: 2008-01-21 11:31:07 -0500 (Mon, 21 Jan 2008)
New Revision: 2001

Modified:
   trunk/mapbender/http/javascripts/mod_tab.js
Log:
add getCoords function for Help module

Modified: trunk/mapbender/http/javascripts/mod_tab.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_tab.js	2008-01-21 09:19:43 UTC (rev 2000)
+++ trunk/mapbender/http/javascripts/mod_tab.js	2008-01-21 16:31:07 UTC (rev 2001)
@@ -207,6 +207,32 @@
 			var e = new Mb_warning("mod_tab.js: could not activate tab, opening or closing in progress!");
 		}
 	};
+	
+	/**
+	 * Returns the absolute coordinates of tab by the module ID
+	 * 
+	 * @param {String} id the ID of the GUI element within the tab.
+	 * @return {String} String with "left,top,right,bottom"
+	 */
+	 
+	 this.getCoords = function(id) {
+	 	var coords=[];
+	 	//get indixes
+	 	if(activeTabId)
+	 		var indexOfOpeningTab = getIndexById(activeTabId);
+		var index = getIndexById(id);
+	 	
+	 	//left
+	 	coords[0] = tabLeftOffset;
+	 	//top
+	 	coords[1] = tabTopOffset + index*tabHeight + (activeTabId&&indexOfOpeningTab<index?this.get(indexOfOpeningTab).height:0);
+	 	//right
+	 	coords[2] = coords[0] + tabWidth;
+	 	//bottom
+	 	coords[3] = coords[1] + (id==activeTabId?this.get(indexOfOpeningTab).height+tabHeight:tabHeight);
+	 	
+	 	return coords.join(",");
+	 }
 
 	/**
 	 * Animated opening and closing of the tab with the given id.



More information about the Mapbender_commits mailing list