Skip to content

Commit 7f96c8d

Browse files
author
Philip Guo
committed
get embeddedMode to play nicely with codeDivWidth and codeDivHeight
1 parent c9be9e4 commit 7f96c8d

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

v3/js/pytutor.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ var curVisualizerID = 1; // global to uniquely identify each ExecutionVisualizer
7272
// codeDivHeight - maximum height of #pyCodeOutputDiv (in integer pixels)
7373
// codeDivWidth - maximum width of #pyCodeOutputDiv (in integer pixels)
7474
// editCodeBaseURL - the base URL to visit when the user clicks 'Edit code' (if null, then 'Edit code' link hidden)
75-
// embeddedMode - make the widget narrower horizontally and disable breakpoints
75+
// embeddedMode - shortcut for hideOutput=true, codeDivWidth=350, codeDivHeight=400
7676
// updateOutputCallback - function to call (with 'this' as parameter)
7777
// whenever this.updateOutput() is called
7878
// (BEFORE rendering the output display)
@@ -261,8 +261,14 @@ ExecutionVisualizer.prototype.render = function() {
261261
if (this.params.embeddedMode) {
262262
this.params.hideOutput = true; // put this before hideOutput handler
263263

264-
this.params.codeDivWidth = 350;
265-
this.params.codeDivHeight = 400;
264+
// don't override if they've already been set!
265+
if (this.params.codeDivWidth === undefined) {
266+
this.params.codeDivWidth = 350;
267+
}
268+
269+
if (this.params.codeDivHeight === undefined) {
270+
this.params.codeDivHeight = 400;
271+
}
266272
}
267273

268274

0 commit comments

Comments
 (0)