[fusion-commits] r1873 - trunk/widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Jul 21 17:54:29 EDT 2009


Author: pagameba
Date: 2009-07-21 17:54:28 -0400 (Tue, 21 Jul 2009)
New Revision: 1873

Modified:
   trunk/widgets/Measure.js
Log:
fix bug in IE 7, 'this' is not defined in the scope of createEntry so use a closure instead.

Modified: trunk/widgets/Measure.js
===================================================================
--- trunk/widgets/Measure.js	2009-07-21 18:40:55 UTC (rev 1872)
+++ trunk/widgets/Measure.js	2009-07-21 21:54:28 UTC (rev 1873)
@@ -303,8 +303,13 @@
         var size = marker.getSize();
         var t = at.y - size.height/2 ;
         var l = at.x - size.width/2;
-        marker.domObj.style.top = t + 'px';
-        marker.domObj.style.left = l + 'px';
+        if (!isNaN(t) && !isNaN(l)) {
+            marker.domObj.style.top = t + 'px';
+            marker.domObj.style.left = l + 'px';
+            marker.domObj.style.display = 'block';
+        } else {
+            marker.domObj.style.display = 'none';
+        }
     },
     
     onKeyPress: function(e) {
@@ -449,7 +454,7 @@
         this.clearDisplay(outputWin);
         var units = Fusion.unitAbbr(this.units);
         var value;
-        
+        var distPrecision = this.distPrecision;
         var createEntry = function(idx, distance) {
             if (distance < 1) {
                 return;
@@ -459,11 +464,11 @@
             td.innerHTML = OpenLayers.i18n('segment',{'seg':idx});
             tr.appendChild(td);
             td = outputDoc.createElement('td');
-            if (this.distPrecision == 0) {
+            if (distPrecision == 0) {
               value = Math.floor(distance);
             }
             else {
-              value = distance.toPrecision(this.distPrecision);
+              value = distance.toPrecision(distPrecision);
             }
             td.innerHTML = value + ' ' + units;
             tr.appendChild(td);
@@ -504,9 +509,9 @@
         }
     },
     
-  /*
-      * updates the summary display if it is loaded in a window somewhere
-      */
+    /*
+     * updates the summary display if it is loaded in a window somewhere
+     */
     updateTotalDistance: function() {
       if (this.distanceMarkers.length > 1) {
         var totalDistance = 0;



More information about the fusion-commits mailing list