Skip to content

Commit f799f0d

Browse files
author
Philip Guo
committed
more nitpicking
1 parent e0575fd commit f799f0d

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎v3/js/opt-frontend.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ $(document).ready(function() {
9090
$("#pyInputPane").show();
9191
$("#pyOutputPane").hide();
9292
$("#embedLinkDiv").hide();
93+
94+
// destroy all annotation bubbles (NB: kludgy)
95+
if (myVisualizer) {
96+
myVisualizer.destroyAllAnnotationBubbles();
97+
}
9398
}
9499
else if (appMode == 'display') {
95100
$("#pyInputPane").hide();

‎v3/js/pytutor.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,16 @@ ExecutionVisualizer.prototype.updateOutput = function(smoothTransition) {
992992
return;
993993
}
994994

995+
996+
// really nitpicky!!! gets the difference in width between the code display
997+
// and the maximum width of its enclosing div
998+
myViz.codeHorizontalOverflow = myViz.domRoot.find('#pyCodeOutput').width() - myViz.domRoot.find('#pyCodeOutputDiv').width();
999+
// should always be positive
1000+
if (myViz.codeHorizontalOverflow < 0) {
1001+
myViz.codeHorizontalOverflow = 0;
1002+
}
1003+
1004+
9951005
// crucial resets for annotations (TODO: kludgy)
9961006
myViz.destroyAllAnnotationBubbles();
9971007
myViz.initStepAnnotation();
@@ -2628,6 +2638,9 @@ AnnotationBubble.prototype.showEditor = function() {
26282638
position: {
26292639
my: this.my,
26302640
at: this.at,
2641+
adjust: {
2642+
x: (myBubble.type == 'codeline' ? -6 : 0), // shift codeline tips over a bit for aesthetics
2643+
},
26312644
effect: null, // disable all cutesy animations
26322645
}
26332646
}));
@@ -2670,6 +2683,7 @@ AnnotationBubble.prototype.showViewer = function() {
26702683
assert(this.state == 'edit' || this.state == 'invisible');
26712684
assert(this.text); // must be non-empty!
26722685

2686+
var myBubble = this;
26732687
// destroy then create a new tip:
26742688
this.destroyQTip();
26752689
$(this.hashID).qtip($.extend({}, qtipShared, {
@@ -2678,6 +2692,9 @@ AnnotationBubble.prototype.showViewer = function() {
26782692
position: {
26792693
my: this.my,
26802694
at: this.at,
2695+
adjust: {
2696+
x: (myBubble.type == 'codeline' ? -6 : 0), // shift codeline tips over a bit for aesthetics
2697+
},
26812698
effect: null, // disable all cutesy animations
26822699
}
26832700
}));

0 commit comments

Comments
 (0)