File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1483,6 +1483,22 @@ function executeCodeAndCreateViz(codeToExec,
14831483 }
14841484 return [ false ] ; // pass through to let other hooks keep handling
14851485 } ) ;
1486+
1487+
1488+ // bind keyboard shortcuts if we're not in embedded mode
1489+ // (i.e., in an iframe)
1490+ if ( ! myVisualizer . embeddedMode ) {
1491+ $ ( document ) . off ( 'keydown' ) ; // clear first before rebinding, just to be paranoid
1492+ $ ( document ) . keydown ( function ( e ) {
1493+ if ( myVisualizer ) {
1494+ if ( e . keyCode === 37 ) { // left
1495+ myVisualizer . stepBack ( ) ;
1496+ } else if ( e . keyCode === 39 ) { // right
1497+ myVisualizer . stepForward ( ) ;
1498+ }
1499+ }
1500+ } ) ;
1501+ }
14861502 }
14871503 // SUPER HACK -- slip in backendOptionsObj as an extra field
14881504 if ( myVisualizer ) {
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ var curVisualizerID = 1; // global to uniquely identify each ExecutionVisualizer
8484// embeddedMode - shortcut for hideOutput=true, allowEditAnnotations=false,
8585// codeDivWidth=this.DEFAULT_EMBEDDED_CODE_DIV_WIDTH,
8686// codeDivHeight=this.DEFAULT_EMBEDDED_CODE_DIV_HEIGHT
87+ // (and don't activate keyboard shortcuts!)
8788// disableHeapNesting - if true, then render all heap objects at the top level (i.e., no nested objects)
8889// drawParentPointers - if true, then draw environment diagram parent pointers for all frames
8990// WARNING: there are hard-to-debug MEMORY LEAKS associated with activating this option
@@ -570,6 +571,7 @@ ExecutionVisualizer.prototype.render = function() {
570571 this . domRoot . find ( '#stepAnnotationEditor' ) . hide ( ) ;
571572
572573 if ( this . params . embeddedMode ) {
574+ this . embeddedMode = true ;
573575 this . params . hideOutput = true ; // put this before hideOutput handler
574576
575577 // don't override if they've already been set!
You can’t perform that action at this time.
0 commit comments