[Mapbender-commits] r8166 - trunk/mapbender/http/widgets

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Sep 23 07:47:37 EDT 2011


Author: verenadiewald
Date: 2011-09-23 04:47:37 -0700 (Fri, 23 Sep 2011)
New Revision: 8166

Modified:
   trunk/mapbender/http/widgets/w_measure.js
Log:
id for measure canvas (conflict with printbox), correctly calculated angle

Modified: trunk/mapbender/http/widgets/w_measure.js
===================================================================
--- trunk/mapbender/http/widgets/w_measure.js	2011-09-23 11:47:00 UTC (rev 8165)
+++ trunk/mapbender/http/widgets/w_measure.js	2011-09-23 11:47:37 UTC (rev 8166)
@@ -183,9 +183,10 @@
 		if (a !== null && b !== null && c !== null) {
                         function angleAt(a,b,c){
                             var vectorAB = [b.x- a.x,b.y-a.y];
-                            var vectorAC = [c.x- a.x,c.y-a.y];
-                            var cosalpha = scalarProduct(vectorAB,vectorAC)/
-                                (vectorlen(vectorAB)*vectorlen(vectorAC));
+                            //var vectorBC = [c.x- b.x,c.y-b.y];
+                            var vectorBC = [b.x- c.x,b.y-c.y];
+                            var cosalpha = scalarProduct(vectorAB,vectorBC)/
+                                (vectorlen(vectorAB)*vectorlen(vectorBC));
 
                             var acosalpha = Math.acos(cosalpha);
                             return (acosalpha/Math.PI)*180;
@@ -246,7 +247,7 @@
 				if (drawOptions.highlightFirst && k === len - 1) {
 					var p0 = this._measurePoints[0].mousePos;
 					str_path += 'L' + p0.x + ' ' + p0.y;
-					
+
 				}
 				if (drawOptions && drawOptions.highlightLast && k === len - 1) {
 					continue;
@@ -323,7 +324,7 @@
 			}
 		};
 
-		// 
+		//
 		// calculate distance
 		//
 		var len = this._measurePoints.length;
@@ -498,7 +499,7 @@
 	},
 	_create: function () {
 		this._measurePoints = [];
-		
+
 		// ":maps" is a Mapbender selector which
 		// checks if an element is a Mapbender map
 		this.element = this.element.filter(":maps");
@@ -511,9 +512,9 @@
 		this._map.events.afterMapRequest.register($.proxy(this._redraw, this));
 		this._srs = this._map.getSrs();
 
-		this._$canvas = $("<div />").css({
-			"z-index": 100,
-			"position": "relative"
+		this._$canvas = $("<div id='measure_canvas' />").css({
+			"z-index": 1000,
+			"position": "absolute"
 		}).appendTo(this.element);
 		this._canvas = Raphael(this._$canvas.get(0), this._map.getWidth(), this._map.getHeight());
 		mb_registerPanSubElement($(this._canvas.canvas).parent().get(0));



More information about the Mapbender_commits mailing list