@@ -90,6 +90,8 @@ function ExecutionVisualizer(domRootID, dat, params) {
9090 this . sortedBreakpointsList = null ; // sorted and synced with breakpointLines
9191 this . hoverBreakpoints = null ; // set of breakpoints because we're HOVERING over a given line
9292
93+ this . enableTransitions = false ; // EXPERIMENTAL - enable transition effects
94+
9395
9496 this . hasRendered = false ;
9597
@@ -347,16 +349,6 @@ ExecutionVisualizer.prototype.setKeyboardBindings = function() {
347349
348350 leftTablePane . attr ( 'tabindex' , '0' ) ;
349351 leftTablePane . css ( 'outline' , 'none' ) ; // don't display a tacky border when focused
350-
351- // focus on mouse entering td#left_pane (so that the user doesn't need
352- // to click to focus)
353- // This is actually annoying because the display JERKS to focus on elements ...
354- /*
355- leftTablePane.mouseenter(function() {
356- leftTablePane.focus();
357- });
358- */
359-
360352
361353 leftTablePane . keydown ( function ( k ) {
362354 if ( ! myViz . keyStuckDown ) {
@@ -1171,39 +1163,58 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
11711163 heapRows . enter ( ) . append ( 'table' )
11721164 //.each(function(objLst, i) {console.log('NEW ROW:', objLst, i);})
11731165 . attr ( 'class' , 'heapRow' )
1174- . append ( 'tr' )
1166+ . append ( 'tr' ) ;
11751167
11761168 // delete a heap row
1177- heapRows . exit ( )
1178- //.each(function(objLst, i) {console.log('DEL ROW:', objLst, i);})
1179- . remove ( ) ;
1169+ var hrExit = heapRows . exit ( ) ;
1170+
1171+ if ( myViz . enableTransitions ) {
1172+ hrExit
1173+ . style ( 'opacity' , '1' )
1174+ . transition ( )
1175+ . style ( 'opacity' , '0' )
1176+ . duration ( 500 )
1177+ . each ( 'end' , function ( ) {
1178+ hrExit . remove ( ) ;
1179+ myViz . redrawConnectors ( ) ;
1180+ } ) ;
1181+ }
1182+ else {
1183+ hrExit . remove ( ) ;
1184+ }
11801185
11811186
11821187 // update an existing heap row
1183- var heapColumns = heapRows
1184- . each ( function ( objLst , i ) { console . log ( 'UPDATE ROW:' , objLst , i ) ; } )
1188+ var toplevelHeapObjects = heapRows
1189+ // .each(function(objLst, i) { console.log('UPDATE ROW:', objLst, i); })
11851190 . selectAll ( 'td' )
11861191 . data ( function ( d , i ) { return d . slice ( 1 , d . length ) ; } , /* map over each row, skipping row ID tag */
11871192 function ( objID ) { return objID ; } /* each object ID is unique for constancy */ ) ;
11881193
11891194 // insert a new toplevelHeapObject
1190- heapColumns . enter ( ) . append ( 'td' )
1195+ var tlhEnter = toplevelHeapObjects . enter ( ) . append ( 'td' )
11911196 . attr ( 'class' , 'toplevelHeapObject' )
1192- . attr ( 'id' , function ( d , i ) { return 'toplevel_heap_object_' + d ; } )
1193- . style ( 'opacity' , '0' )
1194- . style ( 'border-color' , 'red' )
1195- // remember that the enter selection is added to the update
1196- // selection so that we can process it later ...
1197- . transition ( )
1198- . style ( 'opacity' , '1' ) /* fade in */
1199- . duration ( 500 )
1200- . transition ( )
1201- . style ( 'border-color' , 'white' )
1202- . delay ( 500 )
1203- . duration ( 300 ) ;
1197+ . attr ( 'id' , function ( d , i ) { return 'toplevel_heap_object_' + d ; } ) ;
1198+
1199+ if ( myViz . enableTransitions ) {
1200+ tlhEnter
1201+ . style ( 'opacity' , '0' )
1202+ . style ( 'border-color' , 'red' )
1203+ . transition ( )
1204+ . style ( 'opacity' , '1' ) /* fade in */
1205+ . duration ( 700 )
1206+ . each ( 'end' , function ( ) {
1207+ tlhEnter . transition ( )
1208+ . style ( 'border-color' , 'white' ) /* kill border */
1209+ . duration ( 300 )
1210+ } ) ;
1211+ }
1212+
1213+ // remember that the enter selection is added to the update
1214+ // selection so that we can process it later ...
12041215
12051216 // update a toplevelHeapObject
1206- heapColumns
1217+ toplevelHeapObjects
12071218 . order ( ) // VERY IMPORTANT to put in the order corresponding to data elements
12081219 . each ( function ( objID , i ) {
12091220 //console.log('NEW/UPDATE ELT', objID);
@@ -1215,9 +1226,20 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
12151226 } ) ;
12161227
12171228 // delete a toplevelHeapObject
1218- heapColumns . exit ( )
1219- . remove ( ) ;
1220-
1229+ var tlhExit = toplevelHeapObjects . exit ( ) ;
1230+
1231+ if ( myViz . enableTransitions ) {
1232+ tlhExit . transition ( )
1233+ . style ( 'opacity' , '0' ) /* fade out */
1234+ . duration ( 500 )
1235+ . each ( 'end' , function ( ) {
1236+ tlhExit . remove ( ) ;
1237+ myViz . redrawConnectors ( ) ;
1238+ } ) ;
1239+ }
1240+ else {
1241+ tlhExit . remove ( ) ;
1242+ }
12211243
12221244
12231245 function renderNestedObject ( obj , d3DomElement ) {
0 commit comments