@@ -774,20 +774,25 @@ function handle_cmds(dcmds) {
774774 case 'local_light' : { glowObjs [ idx ] = local_light ( cfg ) ; break }
775775 case 'distant_light' : { glowObjs [ idx ] = distant_light ( cfg ) ; break }
776776 case 'canvas' : {
777- var container = document . getElementById ( "glowscript" ) ;
778- if ( container !== null ) {
779- window . __context = { glowscript_container : $ ( "#glowscript" ) . removeAttr ( "id" ) }
780- }
781- glowObjs [ idx ] = canvas ( cfg )
782- glowObjs [ idx ] [ 'idx' ] = idx
783- try {
784- glowObjs [ idx ] . wrapper [ 0 ] . addEventListener ( "contextmenu" , function ( event ) {
785- event . preventDefault ( ) ;
786- event . stopPropagation ( ) ;
787- } ) ;
788- }
789- catch ( err ) {
790- console . log ( "glowcomm canvas contextmenu event : " , err . message ) ;
777+ if ( ( typeof isjupyterlab_vpython !== 'undefined' ) && ( isjupyterlab_vpython === true ) ) {
778+ var container = document . getElementById ( "glowscript" ) ;
779+ if ( container !== null ) {
780+ window . __context = { glowscript_container : $ ( "#glowscript" ) . removeAttr ( "id" ) }
781+ }
782+ glowObjs [ idx ] = canvas ( cfg )
783+ glowObjs [ idx ] [ 'idx' ] = idx
784+ try {
785+ glowObjs [ idx ] . wrapper [ 0 ] . addEventListener ( "contextmenu" , function ( event ) {
786+ event . preventDefault ( ) ;
787+ event . stopPropagation ( ) ;
788+ } ) ;
789+ }
790+ catch ( err ) {
791+ console . log ( "glowcomm canvas contextmenu event : " , err . message ) ;
792+ }
793+ } else {
794+ glowObjs [ idx ] = canvas ( cfg )
795+ glowObjs [ idx ] [ 'idx' ] = idx
791796 }
792797 break
793798 // Display frames per second and render time:
0 commit comments