[LON-CAPA-cvs] cvs: loncom /homework functionplotresponse.pm
www
www at source.lon-capa.org
Fri Nov 18 13:02:04 EST 2011
www Fri Nov 18 18:02:04 2011 EDT
Modified files:
/loncom/homework functionplotresponse.pm
Log:
Angle display
Index: loncom/homework/functionplotresponse.pm
diff -u loncom/homework/functionplotresponse.pm:1.71 loncom/homework/functionplotresponse.pm:1.72
--- loncom/homework/functionplotresponse.pm:1.71 Fri Nov 18 17:44:07 2011
+++ loncom/homework/functionplotresponse.pm Fri Nov 18 18:02:04 2011
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# Functionplot responses
#
-# $Id: functionplotresponse.pm,v 1.71 2011/11/18 17:44:07 www Exp $
+# $Id: functionplotresponse.pm,v 1.72 2011/11/18 18:02:04 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -402,7 +402,7 @@
#
sub plotvector_script {
- my ($id,$label,$xs,$ys,$xe,$ye)=@_;
+ my ($id,$label,$xs,$ys,$xe,$ye,$xmin,$xmax)=@_;
unless ($label) {
$Apache::functionplotresponse::counter++;
$label='V'.$Apache::functionplotresponse::counter;
@@ -410,6 +410,7 @@
my $startlabel=$label.'Start';
my $endlabel=$label.'End';
my $pointlabel=$label.'Point';
+ my $pointx=2.*($xmax-$xmin)+$xmax;
my $anglelabel=$label.'Angle';
return(<<ENDVECTOR);
document.ggbApplet_$id.evalCommand("$startlabel=($xs,$ys)");
@@ -420,11 +421,10 @@
document.ggbApplet_$id.evalCommand("$label=Vector[$startlabel,$endlabel]");
document.ggbApplet_$id.setLabelVisible("$label",true);
document.ggbApplet_$id.setLineThickness("$label",8);
-// Displays the Angle
-//document.ggbApplet1.evalCommand("Gravitypoint=(110,y(Gravitystart))"); //The x-value for this should be 2*(xmax-xmin)+xmax;
-//document.ggbApplet1.evalCommand("GravityAngle=Angle[Gravitypoint,Gravitystart,Gravityend]");
-//document.ggbApplet1.setLabelVisible("GravityAngle",true);
-//document.ggbApplet1.setLabelStyle("GravityAngle",VALUE=2);
+document.ggbApplet_$id.evalCommand("$pointlabel=($pointx,y($startlabel))");
+document.ggbApplet_$id.evalCommand("$anglelabel=Angle[$pointlabel,$startlabel,$endlabel]");
+document.ggbApplet_$id.setLabelVisible("$anglelabel",true);
+document.ggbApplet_$id.setLabelStyle("$anglelabel",VALUE=2);
// Keeps track of points we care about (This should use the same listener function we use in graph problems)
//document.ggbApplet1.registerObjectUpdateListener('Gravitystart','updatePointCoordinates');
//document.ggbApplet1.registerObjectUpdateListener('Gravityend','updatePointCoordinates');
@@ -553,7 +553,7 @@
unless (defined($taily)) { $taily=$ymin; }
unless (defined($tipx)) { $tipx=$xmin; }
unless (defined($tipy)) { $tipy=$ymin; }
- $result.=&plotvector_script($internalid,$label,$tailx,$taily,$tipx,$tipy);
+ $result.=&plotvector_script($internalid,$label,$tailx,$taily,$tipx,$tipy,$xmin,$xmax);
} elsif ($target eq 'edit') {
$result=&Apache::edit::tag_start($target,$token,'Plot Vector').
&Apache::edit::text_arg('Label on Plot:','label',
More information about the LON-CAPA-cvs
mailing list