[Mapbender-commits] r5803 - branches/2.6/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Mar 17 09:20:02 EDT 2010


Author: christoph
Date: 2010-03-17 09:20:00 -0400 (Wed, 17 Mar 2010)
New Revision: 5803

Modified:
   branches/2.6/http/javascripts/map_obj.js
   branches/2.6/http/javascripts/mod_box1.js
Log:
faulty mouse position

Modified: branches/2.6/http/javascripts/map_obj.js
===================================================================
--- branches/2.6/http/javascripts/map_obj.js	2010-03-17 13:00:37 UTC (rev 5802)
+++ branches/2.6/http/javascripts/map_obj.js	2010-03-17 13:20:00 UTC (rev 5803)
@@ -1081,26 +1081,13 @@
 	};
 	
 	this.getMousePos = function(e){
-		if(ie){
-			if(this.frameName){
-				clickX = window.frames[fName].event.clientX;
-				clickY = window.frames[fName].event.clientY;
-			}
-			else{
-				clickX = event.clientX;
-				clickY = event.clientY;
-			}
+		var pt = this.getMousePosition(e);
+		// set the globals for backwards compatibility
+		if (pt !== null) {
+			clickX = pt.x;
+			clickY = pt.y;
 		}
-		else{
-			clickX = e.pageX;
-			clickY = e.pageY;
-		}
-		
-		//remove divtag offset
-		clickX -= parseInt(this.getDomElement().style.left, 10);
-		clickY -= parseInt(this.getDomElement().style.top, 10);
-		
-		return new Point(clickX, clickY);
+		return pt;
 	};
 
 	eventAfterMapObjectConstruction.trigger();

Modified: branches/2.6/http/javascripts/mod_box1.js
===================================================================
--- branches/2.6/http/javascripts/mod_box1.js	2010-03-17 13:00:37 UTC (rev 5802)
+++ branches/2.6/http/javascripts/mod_box1.js	2010-03-17 13:20:00 UTC (rev 5803)
@@ -17,9 +17,12 @@
 function  mod_box_start(e){
 	mb_boxMapObj = getMapObjByName(mb_isBF);
 	mb_isActive = true;
-	mb_boxMapObj.getMousePos(e);
-	mb_start_x = clickX;
-	mb_start_y = clickY;
+	var pt = mb_boxMapObj.getMousePosition(e);
+	if (pt === null) {
+		return false;
+	}	
+	mb_start_x = pt.x;
+	mb_start_y = pt.y;
 	mb_end_x = mb_start_x+1;
 	mb_end_y = mb_start_y+1;
 	mb_offset_left = mb_start_x;
@@ -31,10 +34,14 @@
 }
 function mod_box_run(e){
 	if(mb_isActive){
-		mb_boxMapObj.getMousePos(e);
+		var pt = mb_boxMapObj.getMousePosition(e);
+		if (pt === null) {
+			return false;
+		}
 		var width = mb_boxMapObj.width;
 		var height = mb_boxMapObj.height;
-
+		var clickX = pt.x;
+		var clickY = pt.y;
 		if (((clickX>width) || (clickY>height) || (clickX<=0) ||(clickY<=0))){
 			isActive = false;  
 			mod_box_stop(e);



More information about the Mapbender_commits mailing list