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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed May 5 07:05:51 EDT 2010


Author: christoph
Date: 2010-05-05 07:05:46 -0400 (Wed, 05 May 2010)
New Revision: 6082

Modified:
   trunk/mapbender/http/javascripts/map_obj.js
Log:
bugfixes:
correct mouse position if map is in overflowing div
prevent js error if no wms is in map

Modified: trunk/mapbender/http/javascripts/map_obj.js
===================================================================
--- trunk/mapbender/http/javascripts/map_obj.js	2010-05-05 07:41:57 UTC (rev 6081)
+++ trunk/mapbender/http/javascripts/map_obj.js	2010-05-05 11:05:46 UTC (rev 6082)
@@ -197,14 +197,18 @@
     
 	// using the normalized jQuery event
 	this.getPos = function (e) {
-		var dom = this.getDomElement();
+		var $dom = $(this.getDomElement());
 		return new Mapbender.Point(
-			e.pageX - parseInt(dom.style.left, 10),
-			e.pageY - parseInt(dom.style.top, 10)
+			e.pageX - $dom.offset().left,
+			e.pageY - $dom.offset().top
 		);
 	};
 	
   	this.getMousePosition = function (event) {
+		if (typeof event.originalEvent !== "undefined") {
+			return this.getPos(event);
+		}
+		
 		var pageX, pageY, offsetX, offsetY;
 		var e = event || window.event;
 		var target = e.target || e.srcElement;
@@ -1069,7 +1073,10 @@
 					position: "absolute",
 					top: "0px",
 					left: "0px"
-				}).append($(newMapRequest));
+				})
+			if (newMapRequest !== "") {
+				$currentRequest.append(newMapRequest);	
+			}
 			
 	        $("#" + that.elementName + "_maps").append($currentRequest);
 			for (i = 0; i < requestCnt; i++) {



More information about the Mapbender_commits mailing list