Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add parallel line markers to parallel lines #FIXIT

Reviewers: emily

Reviewed By: emily

Differential Revision: http://phabricator.khanacademy.org/D423
  • Loading branch information...
commit cf70efbd6f5a985beaad5d35081bcb9a618e13c2 1 parent 0a0d34f
@beneater beneater authored
View
1  exercises/alternate_exterior_angles.html
@@ -24,6 +24,7 @@
});
graph.pl = new ParallelLines( 0, 0, 10, 0, 3 );
graph.pl.draw();
+ graph.pl.drawMarkers(ANCHOR);
graph.pl.drawTransverse( ANCHOR );
graph.pl.drawAngle( KNOWN_INDEX, true );
graph.pl.drawAngle( UNKNOWN_INDEX, false, "#FFA500" );
View
1  exercises/alternate_exterior_angles_2.html
@@ -36,6 +36,7 @@
});
graph.pl = new ParallelLines(0, 0, 10, 0, 3);
graph.pl.draw();
+ graph.pl.drawMarkers(ANGLE);
graph.pl.drawTransverse(ANGLE);
graph.pl.drawAngle(KNOWN_INDEX, eq1);
graph.pl.drawAngle(UNKNOWN_INDEX, eq2, "#FFA500");
View
1  exercises/alternate_interior_angles.html
@@ -24,6 +24,7 @@
});
graph.pl = new ParallelLines( 0, 0, 10, 0, 3 );
graph.pl.draw();
+ graph.pl.drawMarkers(ANCHOR);
graph.pl.drawTransverse( ANCHOR );
graph.pl.drawAngle( KNOWN_INDEX, true );
graph.pl.drawAngle( UNKNOWN_INDEX, false, "#FFA500" );
View
1  exercises/alternate_interior_angles_2.html
@@ -36,6 +36,7 @@
});
graph.pl = new ParallelLines(0, 0, 10, 0, 3);
graph.pl.draw();
+ graph.pl.drawMarkers(ANGLE);
graph.pl.drawTransverse(ANGLE);
graph.pl.drawAngle(KNOWN_INDEX, eq1);
graph.pl.drawAngle(UNKNOWN_INDEX, eq2, "#FFA500");
View
1  exercises/corresponding_angles.html
@@ -25,6 +25,7 @@
});
graph.pl = new ParallelLines( 0, 0, 10, 0, 3 );
graph.pl.draw();
+ graph.pl.drawMarkers(ANCHOR);
graph.pl.drawTransverse( ANCHOR );
graph.pl.drawAngle( KNOWN_INDEX, true );
graph.pl.drawAngle( UNKNOWN_INDEX, false, "#FFA500" );
View
1  exercises/corresponding_angles_2.html
@@ -37,6 +37,7 @@
});
graph.pl = new ParallelLines(0, 0, 10, 0, 3);
graph.pl.draw();
+ graph.pl.drawMarkers(ANGLE);
graph.pl.drawTransverse(ANGLE);
graph.pl.drawAngle(KNOWN_INDEX, eq1);
graph.pl.drawAngle(UNKNOWN_INDEX, eq2, "#FFA500");
View
1  exercises/same_side_exterior_angles.html
@@ -24,6 +24,7 @@
});
graph.pl = new ParallelLines( 0, 0, 10, 0, 3 );
graph.pl.draw();
+ graph.pl.drawMarkers(ANCHOR);
graph.pl.drawTransverse( ANCHOR );
graph.pl.drawAngle( KNOWN_INDEX, true );
graph.pl.drawAngle( UNKNOWN_INDEX, false, "#FFA500" );
View
1  exercises/same_side_exterior_angles_2.html
@@ -36,6 +36,7 @@
graph.pl = new ParallelLines( 0, 0, 10, 0, 3 );
graph.pl.draw();
+ graph.pl.drawMarkers(ANCHOR);
graph.pl.drawTransverse( ANCHOR );
graph.pl.drawAngle( KNOWN_INDEX, eq1 );
graph.pl.drawAngle( UNKNOWN_INDEX, eq2, "#FFA500" );
View
1  exercises/same_side_interior_angles.html
@@ -24,6 +24,7 @@
});
graph.pl = new ParallelLines( 0, 0, 10, 0, 3 );
graph.pl.draw();
+ graph.pl.drawMarkers(ANCHOR);
graph.pl.drawTransverse( ANCHOR );
graph.pl.drawAngle( KNOWN_INDEX, true );
graph.pl.drawAngle( UNKNOWN_INDEX, false, "#FFA500" );
View
1  exercises/same_side_interior_angles_2.html
@@ -35,6 +35,7 @@
});
graph.pl = new ParallelLines( 0, 0, 10, 0, 3 );
graph.pl.draw();
+ graph.pl.drawMarkers(ANCHOR);
graph.pl.drawTransverse( ANCHOR );
graph.pl.drawAngle( KNOWN_INDEX, eq1 );
graph.pl.drawAngle( UNKNOWN_INDEX, eq2, "#FFA500" );
View
28 utils/graphie-helpers.js
@@ -293,6 +293,32 @@ function ParallelLines(x1, y1, x2, y2, distance) {
graph.line([x1, y1 + distance], [x2, y2 + distance]);
};
+ this.drawMarkers = function(position) {
+ var graph = KhanUtil.currentGraph;
+ var pmarkX = (x2 - x1) / 2 + x1;
+ if (position === "right" || (position >= 40 && position <= 140)) {
+ pmarkX = x2 - 55 / graph.scaleVector([1, 1])[0];
+ } else if (position === "left") {
+ pmarkX = x1 + 50 / graph.scaleVector([1, 1])[0];
+ }
+ var pmarkX1 = pmarkX;
+ var pmarkX2 = pmarkX + 5 / graph.scaleVector([1, 1])[0];
+ var pmarkW = 5 / graph.scaleVector([1, 1])[0];
+ var pmarkH = 5 / graph.scaleVector([1, 1])[1];
+ graph.path([[pmarkX1 - pmarkW, y1 + pmarkH],
+ [pmarkX1, y1],
+ [pmarkX1 - pmarkW, y1 - pmarkH]]);
+ graph.path([[pmarkX2 - pmarkW, y1 + pmarkH],
+ [pmarkX2, y1],
+ [pmarkX2 - pmarkW, y1 - pmarkH]]);
+ graph.path([[pmarkX1 - pmarkW, y1 + pmarkH + distance],
+ [pmarkX1, y1 + distance],
+ [pmarkX1 - pmarkW, y1 - pmarkH + distance]]);
+ graph.path([[pmarkX2 - pmarkW, y1 + pmarkH + distance],
+ [pmarkX2, y1 + distance],
+ [pmarkX2 - pmarkW, y1 - pmarkH + distance]]);
+ };
+
this.drawTransverse = function(angleDeg) {
anchorAngle = angleDeg;
var graph = KhanUtil.currentGraph;
@@ -601,4 +627,4 @@ function labelDirection(angle) {
} else if (angle > 270 && angle < 360) {
return "below right";
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.