@@ -30,6 +30,7 @@ import '!!file-loader?name=/vpython_data/[name].[ext]!../vpython_data/wood_textu
30
30
export var comm
31
31
var ws = null
32
32
var isopen = false
33
+ var isjupyterlab_vpython = true
33
34
34
35
console . log ( 'START OF GLOWCOMM' )
35
36
@@ -819,20 +820,25 @@ function handle_cmds(dcmds) {
819
820
case 'local_light' : { glowObjs [ idx ] = local_light ( cfg ) ; break }
820
821
case 'distant_light' : { glowObjs [ idx ] = distant_light ( cfg ) ; break }
821
822
case 'canvas' : {
822
- var container = document . getElementById ( "glowscript" ) ;
823
- if ( container !== null ) {
824
- window . __context = { glowscript_container : $ ( "#glowscript" ) . removeAttr ( "id" ) }
825
- }
826
- glowObjs [ idx ] = canvas ( cfg )
827
- glowObjs [ idx ] [ 'idx' ] = idx
828
- try {
829
- glowObjs [ idx ] . wrapper [ 0 ] . addEventListener ( "contextmenu" , function ( event ) {
830
- event . preventDefault ( ) ;
831
- event . stopPropagation ( ) ;
832
- } ) ;
833
- }
834
- catch ( err ) {
835
- console . log ( "glowcomm canvas contextmenu event : " , err . message ) ;
823
+ if ( ( typeof isjupyterlab_vpython !== 'undefined' ) && ( isjupyterlab_vpython === true ) ) {
824
+ var container = document . getElementById ( "glowscript" ) ;
825
+ if ( container !== null ) {
826
+ window . __context = { glowscript_container : $ ( "#glowscript" ) . removeAttr ( "id" ) }
827
+ }
828
+ glowObjs [ idx ] = canvas ( cfg )
829
+ glowObjs [ idx ] [ 'idx' ] = idx
830
+ try {
831
+ glowObjs [ idx ] . wrapper [ 0 ] . addEventListener ( "contextmenu" , function ( event ) {
832
+ event . preventDefault ( ) ;
833
+ event . stopPropagation ( ) ;
834
+ } ) ;
835
+ }
836
+ catch ( err ) {
837
+ console . log ( "glowcomm canvas contextmenu event : " , err . message ) ;
838
+ }
839
+ } else {
840
+ glowObjs [ idx ] = canvas ( cfg )
841
+ glowObjs [ idx ] [ 'idx' ] = idx
836
842
}
837
843
break
838
844
// Display frames per second and render time:
0 commit comments