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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Mar 12 07:21:07 EDT 2009


Author: christoph
Date: 2009-03-12 07:21:07 -0400 (Thu, 12 Mar 2009)
New Revision: 3673

Modified:
   trunk/mapbender/http/javascripts/map_obj.js
Log:
mousePosition

IE

only return coordinates on the map, otherwise null

Modified: trunk/mapbender/http/javascripts/map_obj.js
===================================================================
--- trunk/mapbender/http/javascripts/map_obj.js	2009-03-12 10:58:07 UTC (rev 3672)
+++ trunk/mapbender/http/javascripts/map_obj.js	2009-03-12 11:21:07 UTC (rev 3673)
@@ -75,7 +75,17 @@
 	};
 	
 	this.getMousePosition = function (e) {
-		mb_getMousePos(e, this.frameName);
+		var clickX, clickY;
+
+		if ($.browser.msie) {
+			clickX = e.clientX;
+			clickY = e.clientY;
+		}
+		else{
+			clickX = e.pageX;
+			clickY = e.pageY;
+		}
+
 		var currentPos = null;
 		if (this.type == "DIV") {
 			var mapDomElement = this.getDomElement();
@@ -83,6 +93,11 @@
 				clickX - parseInt(mapDomElement.style.left), 
 				clickY - parseInt(mapDomElement.style.top)
 			);
+			// if the mouse position is not on top of the map, return null
+			if (currentPos.x < 0 || currentPos.x > this.width || 
+				currentPos.y < 0 || currentPos.y > this.height) {
+				return null;
+			}
 		}
 		else {
 			currentPos = new Point(



More information about the Mapbender_commits mailing list