[Mapbender-commits] r8474 - branches/2.7/lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Aug 28 11:19:01 PDT 2012


Author: marc
Date: 2012-08-28 11:19:00 -0700 (Tue, 28 Aug 2012)
New Revision: 8474

Modified:
   branches/2.7/lib/printbox.js
Log:
#876

Modified: branches/2.7/lib/printbox.js
===================================================================
--- branches/2.7/lib/printbox.js	2012-08-28 15:18:54 UTC (rev 8473)
+++ branches/2.7/lib/printbox.js	2012-08-28 18:19:00 UTC (rev 8474)
@@ -4,10 +4,11 @@
 	}
 
 	var target = options.target || "mapframe1";
+	
 	var map = getMapObjByName(target);
 //	var map = Mapbender.modules[target];
 	var map_el = map.getDomElement();
-
+		
 	// Default is portrait, A4, unit seems to be cm
 	var printWidth = options.printWidth || 21;
 	var printHeight = options.printHeight || 29.7;
@@ -41,7 +42,7 @@
 	// The pointArray is moved by the center vector.
 	// default: place box in the center of the map
 	//var center = options.center || new Point(map.width/2,map.height/2);
-        var center = options.center || new Point(map.getWidth()/2,map.getHeight()/2);
+	var center = options.center || new Point(map.getWidth()/2,map.getHeight()/2);
 
 	// the center in real world coordinates
 	var centerMap = null;
@@ -90,7 +91,7 @@
 			
 			angle = Math.ceil(getAngle(vectorA, vectorCurrent));
 			
-			$(document).mousemove(function (e) {
+			$("#" + target).mousemove(function (e) {
 				var currentPos = map.getMousePos(e);
 				var vectorCurrent = currentPos.minus(newCenter);
 				var currentAngle = Math.ceil(getAngle(vectorA, vectorCurrent));
@@ -103,8 +104,8 @@
 				return false;
 			}).mouseup(function (e) {
 				angle = 0;
-				$(document).unbind("mousemove");
-				$(document).unbind("mouseup");
+				$("#" + target).unbind("mousemove");
+				$("#" + target).unbind("mouseup");
 				afterChangeAngle({
 					angle: totalAngle,
 					coordinates: that.getStartCoordinates()
@@ -128,8 +129,8 @@
 			);
 
 			var diff;
-	
-			$(document).mousemove(function (e) {
+			
+			$("#" + target).mousemove(function (e) {
 				diff = (map.getMousePos(e)).minus(mouseMoveStart);
 	
 				$container.css({
@@ -139,8 +140,8 @@
 				return false;
 	
 			}).mouseup(function (e) {
-				$(document).unbind("mousemove");
-				$(document).unbind("mouseup");
+				$("#" + target).unbind("mousemove");
+				$("#" + target).unbind("mouseup");
 				recalculateMapPositions();
 				that.rotate(totalAngle);
 				that.paintBox();
@@ -158,7 +159,7 @@
 	
 			resizeRatio = 1;
 			mouseMoveStart = map.getMousePos(e);
-			$(document).mousemove(function (e) {
+			$("#" + target).mousemove(function (e) {
 				var newRadius = vectorA.dist(map.getMousePos(e));
 				var resizeRatio = newRadius / radius;
 				if (resizeRatio < 0.98 || resizeRatio > 1.02) {
@@ -173,9 +174,9 @@
 				}
 				return false;
 			});
-			$(document).mouseup(function (e) {
-				$(document).unbind("mousemove");
-				$(document).unbind("mouseup");
+			$("#" + target).mouseup(function (e) {
+				$("#" + target).unbind("mousemove");
+				$("#" + target).unbind("mouseup");
 
 				recalculateMapPositions();
 				recalculatePixPositions();



More information about the Mapbender_commits mailing list