Skip to content

Commit ca150f4

Browse files
author
Philip Guo
committed
some cleanups
1 parent c98dcf6 commit ca150f4

2 files changed

Lines changed: 26 additions & 11 deletions

File tree

‎v3/css/pytutor.css‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ div.ExecutionVisualizer #leftCodeGutterSVG {
103103
be 0 or it defaults to something arbitrary and gross */
104104
}
105105

106+
div.ExecutionVisualizer #prevLegendArrowSVG,
107+
div.ExecutionVisualizer #curLegendArrowSVG {
108+
width: 18px;
109+
height: 10px;
110+
}
111+
106112
div.ExecutionVisualizer .arrow {
107113
font-size: 16pt;
108114
}
@@ -124,8 +130,11 @@ div.ExecutionVisualizer table#pyCodeOutput .cod {
124130

125131
div.ExecutionVisualizer div#legendDiv {
126132
margin: 0px;
133+
margin-top: 10px;
134+
margin-bottom: 5px;
127135
padding: 0px;
128136
text-align: left;
137+
color: #888;
129138
}
130139

131140
div.ExecutionVisualizer div#editCodeLinkDiv {

‎v3/js/pytutor.js‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5555
*/
5656

5757

58+
var svgArrowPolygon = '0,3 12,3 12,0 18,5 12,10 12,7 0,7';
59+
5860
var curVisualizerID = 1; // global to uniquely identify each ExecutionVisualizer instance
5961

6062
// domRootID is the string ID of the root element where to render this instance
@@ -211,15 +213,19 @@ ExecutionVisualizer.prototype.render = function() {
211213
</table>');
212214

213215

214-
this.domRoot
215-
.find('#legendDiv')
216-
.append(arrowHTML + ' line that has just executed')
217-
.find('.arrow:last')
218-
.css('color', lightArrowColor)
219-
.end()
220-
.append('<p style="margin-top:-6px">' + arrowHTML + ' next line to be executed</p>')
221-
.find('.arrow:last')
222-
.css('color', darkArrowColor);
216+
this.domRoot.find('#legendDiv')
217+
.append('<svg id="prevLegendArrowSVG"/> line that has just executed')
218+
.append('<p style="margin-top: 3px"><svg id="curLegendArrowSVG"/> next line to be executed</p>');
219+
220+
myViz.domRootD3.select('svg#prevLegendArrowSVG')
221+
.append('polygon')
222+
.attr('points', svgArrowPolygon)
223+
.attr('fill', lightArrowColor);
224+
225+
myViz.domRootD3.select('svg#curLegendArrowSVG')
226+
.append('polygon')
227+
.attr('points', svgArrowPolygon)
228+
.attr('fill', darkArrowColor);
223229

224230

225231
if (this.params.editCodeBaseURL) {
@@ -675,13 +681,13 @@ ExecutionVisualizer.prototype.renderPyCodeOutput = function() {
675681
myViz.domRootD3.select('svg#leftCodeGutterSVG')
676682
.append('polygon')
677683
.attr('id', 'prevLineArrow')
678-
.attr('points', '0,3 12,3 12,0 18,5 12,10 12,7 0,7')
684+
.attr('points', svgArrowPolygon)
679685
.attr('fill', 'white');
680686

681687
myViz.domRootD3.select('svg#leftCodeGutterSVG')
682688
.append('polygon')
683689
.attr('id', 'curLineArrow')
684-
.attr('points', '0,3 12,3 12,0 18,5 12,10 12,7 0,7')
690+
.attr('points', svgArrowPolygon)
685691
.attr('fill', 'white');
686692

687693

0 commit comments

Comments
 (0)