Commit 216dac47 authored by Romain Casati's avatar Romain Casati
Browse files

Fix PythonTutor redraw when added to non visible parent.

parent c7330c17
......@@ -1563,9 +1563,7 @@ ExecutionVisualizer.prototype.updateOutputFull = function(smoothTransition) {
// there's no point in re-rendering if this pane isn't even visible in the first place!
if (!myViz.domRoot.is(':visible')) {
// [Basthon]
// There is a point in Basthon-Console! commenting the return.
// return;
return;
}
// reset
......@@ -1617,9 +1615,7 @@ ExecutionVisualizer.prototype.updateOutputFull = function(smoothTransition) {
myViz.codeRowHeight = secondRowOffsetY - firstRowOffsetY;
}
// [Basthon]
// Commented to support display in hidden context
// assert(myViz.codeRowHeight > 0);
assert(myViz.codeRowHeight > 0);
var gutterOffsetY = gutterSVG.offset().top;
var teenyAdjustment = gutterOffsetY - firstRowOffsetY;
......@@ -1633,11 +1629,9 @@ ExecutionVisualizer.prototype.updateOutputFull = function(smoothTransition) {
}
if (myViz.params.arrowLines) {
assert(myViz.arrowOffsetY !== undefined);
assert(myViz.codeRowHeight !== undefined);
// [Basthon]
// Commented to support display in hidden context.
// assert(0 <= myViz.arrowOffsetY && myViz.arrowOffsetY <= myViz.codeRowHeight);
assert(myViz.arrowOffsetY !== undefined);
assert(myViz.codeRowHeight !== undefined);
assert(0 <= myViz.arrowOffsetY && myViz.arrowOffsetY <= myViz.codeRowHeight);
}
// call the callback if necessary (BEFORE rendering)
......
......@@ -27,6 +27,15 @@
{{embeddedMode: false,
heightChangeCallback: redraw}}
);
// message of type 'redraw' from parent triggers a full redraw
// (usefull when iframe is added to a non visible parent)
window.addEventListener('message', function (event) {{
const data = event.data;
if( data.type === 'redraw' )
window.v.updateOutput();
}});
$(window).resize(redraw);
redraw();
}});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment