[Mapbender-commits] r2003 - branches/2.5/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 21 11:37:33 EST 2008


Author: nimix
Date: 2008-01-21 11:37:33 -0500 (Mon, 21 Jan 2008)
New Revision: 2003

Modified:
   branches/2.5/http/javascripts/mod_tab.js
Log:
add getCoords function for Help module

Modified: branches/2.5/http/javascripts/mod_tab.js
===================================================================
--- branches/2.5/http/javascripts/mod_tab.js	2008-01-21 16:33:42 UTC (rev 2002)
+++ branches/2.5/http/javascripts/mod_tab.js	2008-01-21 16:37:33 UTC (rev 2003)
@@ -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