[LON-CAPA-cvs] cvs: loncom /xml londefdef.pm

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 07 Feb 2005 20:15:12 -0000


matthew		Mon Feb  7 15:15:12 2005 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  - since we are now always specifying the height in the image we need to always correctly calculate the height parameter
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.251 loncom/xml/londefdef.pm:1.252
--- loncom/xml/londefdef.pm:1.251	Wed Jan 19 13:20:12 2005
+++ loncom/xml/londefdef.pm	Mon Feb  7 15:15:11 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.251 2005/01/19 18:20:12 albertel Exp $
+# $Id: londefdef.pm,v 1.252 2005/02/07 20:15:11 matthew Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -3796,18 +3796,26 @@
     my $width = &Apache::lonxml::get_param('width',$parstack,$safeeval,
 					   undef,1);
     if ($TeXwidth ne '') {  
+	my $old_width_param=$width_param;
 	if ($TeXwidth=~/(\d+)\s*\%/) {
 	    $width_param = $1*$ENV{'form.textwidth'}/100;
 	} else { 
 	    $width_param = $TeXwidth;
 	}
+	$height_param=$TeXwidth/$old_width_param*$height_param;
     } elsif ($TeXheight ne '') {
 	$height_param = $TeXheight;
 	$width_param  = $TeXheight/$height_param*$width_param;
     } elsif ($width ne '') {
+	my $old_width_param=$width_param;
 	$width_param = $width*$scaling;      
+        $height_param=$width_param/$old_width_param*$height_param;
+    }
+    if ($width_param > $ENV{'form.textwidth'}) {
+        my $old_width_param=$width_param;
+	$width_param =0.95*$ENV{'form.textwidth'};
+        $height_param=$width_param/$old_width_param*$height_param;
     }
-    if ($width_param > $ENV{'form.textwidth'}) {$width_param =0.95*$ENV{'form.textwidth'}}
     return ($height_param, $width_param);
 }