Skip to content

Commit e289c1a

Browse files
committed
minor
1 parent 1a3cf6d commit e289c1a

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

‎v5-unity/js/pytutor.ts‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44

55
/* TODO:
66
7-
- get rid of 'owner' field as much as possible since that signals a
8-
leaky abstraction
9-
10-
- make components as stateless and naive as possible (in React style)
7+
- BUG: resizing doesn't work in embedded mode but works in regular mode
118
129
- test breakpoint and stdin raw_input functionality after refactorings
1310
@@ -337,7 +334,7 @@ export class ExecutionVisualizer {
337334

338335
this.codDisplay = new CodeDisplay(this, base, baseD3,
339336
this.curInputCode, this.params.lang, this.params.editCodeBaseURL);
340-
this.navControls = new NavigationController(this, base, baseD3);
337+
this.navControls = new NavigationController(this, base, baseD3, this.curTrace.length);
341338

342339
if (this.params.embeddedMode) {
343340
// don't override if they've already been set!
@@ -3182,6 +3179,8 @@ class CodeDisplay {
31823179

31833180
var lines = this.codToDisplay.split('\n');
31843181

3182+
// TODO: maybe parse breakpoints in comments in ExecutionVisualizer
3183+
// instead of here in CodeDisplay?
31853184
for (var i = 0; i < lines.length; i++) {
31863185
var cod = lines[i];
31873186

@@ -3215,7 +3214,6 @@ class CodeDisplay {
32153214
this.codeOutputLines.push(n);
32163215
}
32173216

3218-
32193217
this.domRoot.find('#pyCodeOutputDiv').empty();
32203218

32213219
// maps this.codeOutputLines to both table columns
@@ -3467,11 +3465,13 @@ class NavigationController {
34673465
owner: ExecutionVisualizer;
34683466
domRoot: any;
34693467
domRootD3: any;
3468+
nSteps: number;
34703469

3471-
constructor(owner, domRoot, domRootD3) {
3470+
constructor(owner, domRoot, domRootD3, nSteps) {
34723471
this.owner = owner;
34733472
this.domRoot = domRoot;
34743473
this.domRootD3 = domRootD3;
3474+
this.nSteps = nSteps;
34753475

34763476
var navHTML = '<div id="navControlsDiv">\
34773477
<div id="executionSlider"/>\
@@ -3493,9 +3493,8 @@ class NavigationController {
34933493

34943494
this.domRoot.append(navHTML);
34953495

3496-
// TODO: refactor to get rid of 'owner'
34973496
this.domRoot.find("#jmpFirstInstr").click(() => {this.owner.renderStep(0);});
3498-
this.domRoot.find("#jmpLastInstr").click(() => {this.owner.renderStep(this.owner.curTrace.length - 1);});
3497+
this.domRoot.find("#jmpLastInstr").click(() => {this.owner.renderStep(this.nSteps - 1);});
34993498
this.domRoot.find("#jmpStepBack").click(() => {this.owner.stepBack();});
35003499
this.domRoot.find("#jmpStepFwd").click(() => {this.owner.stepForward();});
35013500

@@ -3583,7 +3582,7 @@ class NavigationController {
35833582
.attr('height', 12);
35843583

35853584
var xrange = d3.scale.linear()
3586-
.domain([0, this.owner.curTrace.length - 1])
3585+
.domain([0, this.nSteps - 1])
35873586
.range([0, w]);
35883587

35893588
sliderOverlay.selectAll('rect')

0 commit comments

Comments
 (0)