Skip to content

Commit 4d4ecf9

Browse files
author
Philip Guo
committed
made resizer work better in both regular and embedded modes
1 parent a91f37d commit 4d4ecf9

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

‎v3/js/pytutor.js‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -441,13 +441,23 @@ ExecutionVisualizer.prototype.render = function() {
441441

442442

443443
if (this.params.codeDivWidth) {
444-
this.domRoot.find('#pyCodeOutputDiv,#codeDisplayDiv,#pyStdout')
445-
.css('max-width', this.params.codeDivWidth + 'px');
444+
this.domRoot.find('#codeDisplayDiv')
445+
.css('width', this.params.codeDivWidth + 'px');
446446

447447
this.domRoot.find('#executionSlider')
448448
.css('width', (this.params.codeDivWidth - 20) + 'px');
449449
}
450450

451+
// enable left-right draggable pane resizer (originally from David Pritchard)
452+
$('#pyCodeOutputDiv,#codeDisplayDiv,#pyStdout').css({"max-width":"inherit"});
453+
$('#executionSlider').css({"width":"95%"});
454+
455+
var syncStdoutWidth = function(event, ui){
456+
$("#vizLayoutTdFirst #pyStdout").width(ui.size.width-2*parseInt($("#pyStdout").css("padding-left")));};
457+
$('#codeDisplayDiv').resizable({handles:"e", resize: syncStdoutWidth});
458+
syncStdoutWidth(null, {size: {width: $('#codeDisplayDiv').width()}});
459+
460+
451461
if (this.params.codeDivHeight) {
452462
this.domRoot.find('#pyCodeOutputDiv')
453463
.css('max-height', this.params.codeDivHeight + 'px');
@@ -545,17 +555,6 @@ ExecutionVisualizer.prototype.render = function() {
545555
this.updateOutput();
546556

547557
this.hasRendered = true;
548-
549-
// left-right draggable pane resizer (from David Pritchard)
550-
$('#pyCodeOutputDiv').css({"max-width":"inherit"});
551-
$('#codeDisplayDiv').css({"max-width":"inherit"});
552-
$('#pyStdout').css({"max-width":"inherit"});
553-
$('#executionSlider').css({"width":"95%"});
554-
var syncStdoutWidth = function(event, ui){
555-
$("#vizLayoutTdFirst #pyStdout").width(ui.size.width-2*parseInt($("#pyStdout").css("padding-left")));};
556-
$('#codeDisplayDiv').resizable({handles:"e", resize: syncStdoutWidth});
557-
syncStdoutWidth(null, {size: {width: $('#codeDisplayDiv').width()}});
558-
559558
}
560559

561560

0 commit comments

Comments
 (0)