@@ -492,6 +492,8 @@ ExecutionVisualizer.prototype.initAllAnnotationBubbles = function() {
492492 }
493493 } ) ;
494494 } ) ;
495+
496+ //console.log('initAllAnnotationBubbles', myViz.allAnnotationBubbles.length);
495497}
496498
497499
@@ -508,7 +510,12 @@ ExecutionVisualizer.prototype.enterViewAnnotationsMode = function() {
508510 // and display them in 'View' mode
509511 myViz . initAllAnnotationBubbles ( ) ;
510512
511- // TODO: set text of those bubbles from curEntry.annotations
513+ $ . each ( myViz . allAnnotationBubbles , function ( i , e ) {
514+ var txt = curEntry . annotations [ e . domID ] ;
515+ if ( txt ) {
516+ e . preseedText ( txt ) ;
517+ }
518+ } ) ;
512519 }
513520 }
514521
@@ -611,6 +618,10 @@ ExecutionVisualizer.prototype.findNextBreakpoint = function() {
611618ExecutionVisualizer . prototype . stepForward = function ( ) {
612619 var myViz = this ;
613620
621+ if ( myViz . editAnnotationMode ) {
622+ return ;
623+ }
624+
614625 if ( myViz . curInstr < myViz . curTrace . length - 1 ) {
615626 // if there is a next breakpoint, then jump to it ...
616627 if ( myViz . sortedBreakpointsList . length > 0 ) {
@@ -634,6 +645,10 @@ ExecutionVisualizer.prototype.stepForward = function() {
634645ExecutionVisualizer . prototype . stepBack = function ( ) {
635646 var myViz = this ;
636647
648+ if ( myViz . editAnnotationMode ) {
649+ return ;
650+ }
651+
637652 if ( myViz . curInstr > 0 ) {
638653 // if there is a prev breakpoint, then jump to it ...
639654 if ( myViz . sortedBreakpointsList . length > 0 ) {
@@ -2619,7 +2634,7 @@ AnnotationBubble.prototype.bindViewerClickHandler = function() {
26192634}
26202635
26212636AnnotationBubble . prototype . showViewer = function ( ) {
2622- assert ( this . state == 'edit' ) ;
2637+ assert ( this . state == 'edit' || this . state == 'invisible' ) ;
26232638 assert ( this . text ) ; // must be non-empty!
26242639
26252640 // destroy then create a new tip:
@@ -2718,6 +2733,21 @@ AnnotationBubble.prototype.enterViewMode = function() {
27182733 this . makeInvisible ( ) ;
27192734 }
27202735 }
2736+ else if ( this . state == 'invisible' ) {
2737+ // this happens when, say, you first enter View Mode
2738+ if ( this . text ) {
2739+ this . showViewer ( ) ;
2740+
2741+ if ( this . type == 'codeline' ) {
2742+ this . redrawCodelineBubble ( ) ;
2743+ }
2744+ }
2745+ }
2746+ }
2747+
2748+ AnnotationBubble . prototype . preseedText = function ( txt ) {
2749+ assert ( this . state == 'invisible' ) ;
2750+ this . text = txt ;
27212751}
27222752
27232753AnnotationBubble . prototype . redrawCodelineBubble = function ( ) {
0 commit comments