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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Mar 8 08:58:57 EST 2007


Author: christoph
Date: 2007-03-08 08:58:56 -0500 (Thu, 08 Mar 2007)
New Revision: 1205

Modified:
   trunk/mapbender/http/javascripts/map.php
Log:
calculateExtent has to cast input values to float; otherwise a string concatenation occurs (no addition);  Thanks to Armin Retterath

Modified: trunk/mapbender/http/javascripts/map.php
===================================================================
--- trunk/mapbender/http/javascripts/map.php	2007-03-08 13:56:58 UTC (rev 1204)
+++ trunk/mapbender/http/javascripts/map.php	2007-03-08 13:58:56 UTC (rev 1205)
@@ -1152,14 +1152,14 @@
 function mb_calculateExtent(frameName,minx,miny,maxx,maxy){
   var ind = getMapObjIndexByName(frameName);
   
-  var extenty = maxy - miny;
-  var extentx = maxx - minx;
+  var extenty = parseFloat(maxy) - parseFloat(miny);
+  var extentx = parseFloat(maxx) - parseFloat(minx);
 
   var relation_px_x = mb_mapObj[ind].width / mb_mapObj[ind].height;
   var relation_px_y = mb_mapObj[ind].height / mb_mapObj[ind].width;
   var relation_bbox_x = extentx / extenty;     
-  var centerx = minx + (extentx/2);
-  var centery = miny + (extenty/2);
+  var centerx = parseFloat(minx) + (extentx/2);
+  var centery = parseFloat(miny) + (extenty/2);
   if(relation_bbox_x <= relation_px_x){                
     minx = centerx - relation_px_x * extenty / 2;
     maxx = centerx + relation_px_x * extenty / 2;



More information about the Mapbender_commits mailing list