[LON-CAPA-cvs] cvs: loncom /homework functionplotresponse.pm
www
www at source.lon-capa.org
Fri Nov 25 20:35:26 EST 2011
www Sat Nov 26 01:35:26 2011 EDT
Modified files:
/loncom/homework functionplotresponse.pm
Log:
Be able to adjust width and height, so you can use 1:1 aspect ratio
Index: loncom/homework/functionplotresponse.pm
diff -u loncom/homework/functionplotresponse.pm:1.87 loncom/homework/functionplotresponse.pm:1.88
--- loncom/homework/functionplotresponse.pm:1.87 Thu Nov 24 15:43:08 2011
+++ loncom/homework/functionplotresponse.pm Sat Nov 26 01:35:26 2011
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# Functionplot responses
#
-# $Id: functionplotresponse.pm,v 1.87 2011/11/24 15:43:08 www Exp $
+# $Id: functionplotresponse.pm,v 1.88 2011/11/26 01:35:26 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -49,10 +49,14 @@
#
sub geogebra_startcode {
- my ($id)=@_;
+ my ($id,$width,$height)=@_;
+ $width=int(1.*$width);
+ $height=int(1.*$height);
+ unless ($width) { $width=700; }
+ unless ($height) { $height=400; }
return (<<ENDSTARTCODE);
<applet name="ggbApplet_$id" code="geogebra.GeoGebraApplet" archive="geogebra.jar"
- codebase="/adm/geogebra/" width="722" height="447" MAYSCRIPT>
+ codebase="/adm/geogebra/" width="$width" height="$height" MAYSCRIPT>
<param name="java_arguments" value="-Xmx512m -Djnlp.packEnabled=true"/>
ENDSTARTCODE
}
@@ -1248,7 +1252,11 @@
.&Apache::edit::end_row()
.&Apache::edit::start_spanning_row()
."\n";
- $result.=&Apache::edit::text_arg('Label x-axis:','xlabel',
+ $result.=&Apache::edit::text_arg('Width (pixels):','width',
+ $token,'6').' '.
+ &Apache::edit::text_arg('Height (pixels):','height',
+ $token,'6').'<br />'.
+ &Apache::edit::text_arg('Label x-axis:','xlabel',
$token,'6').' '.
&Apache::edit::text_arg('Minimum x-value:','xmin',
$token,'4').' '.
@@ -1271,7 +1279,7 @@
&Apache::edit::end_row().&Apache::edit::start_spanning_row();
} elsif ($target eq 'modified') {
my $constructtag=&Apache::edit::get_new_args($token,$parstack,
- $safeeval,'xlabel','xmin','xmax','ylabel','ymin','ymax',
+ $safeeval,'width','height','xlabel','xmin','xmax','ylabel','ymin','ymax',
'xaxisvisible','yaxisvisible','gridvisible','answerdisplay');
if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
@@ -1986,7 +1994,9 @@
# generate the input fields
$result.=$Apache::functionplotresponse::inputfields;
# actually start the <applet>-tag
- $result.=&geogebra_startcode($internalid);
+ $result.=&geogebra_startcode($internalid,
+ &Apache::lonxml::get_param('width',$parstack,$safeeval,-2),
+ &Apache::lonxml::get_param('height',$parstack,$safeeval,-2));
# load the spline bytecode
$result.=&geogebra_spline_program();
# set default parameters
More information about the LON-CAPA-cvs
mailing list