File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed
vpython/vpython_libraries Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -819,8 +819,21 @@ function handle_cmds(dcmds) {
819
819
case 'local_light' : { glowObjs [ idx ] = local_light ( cfg ) ; break }
820
820
case 'distant_light' : { glowObjs [ idx ] = distant_light ( cfg ) ; break }
821
821
case 'canvas' : {
822
+ var container = document . getElementById ( "glowscript" ) ;
823
+ if ( container !== null ) {
824
+ window . __context = { glowscript_container : $ ( "#glowscript" ) . removeAttr ( "id" ) }
825
+ }
822
826
glowObjs [ idx ] = canvas ( cfg )
823
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 ) ;
836
+ }
824
837
break
825
838
// Display frames per second and render time:
826
839
//$("<div id='fps'/>").appendTo(glowObjs[idx].title)
Original file line number Diff line number Diff line change 723
723
case 'local_light' : { glowObjs [ idx ] = local_light ( cfg ) ; break }
724
724
case 'distant_light' : { glowObjs [ idx ] = distant_light ( cfg ) ; break }
725
725
case 'canvas' : {
726
+ var container = document . getElementById ( "glowscript" ) ;
727
+ if ( container !== null ) {
728
+ window . __context = { glowscript_container : $ ( "#glowscript" ) . removeAttr ( "id" ) }
729
+ }
726
730
glowObjs [ idx ] = canvas ( cfg )
727
731
glowObjs [ idx ] [ 'idx' ] = idx
732
+ try {
733
+ glowObjs [ idx ] . wrapper [ 0 ] . addEventListener ( "contextmenu" , function ( event ) {
734
+ event . preventDefault ( ) ;
735
+ event . stopPropagation ( ) ;
736
+ } ) ;
737
+ }
738
+ catch ( err ) {
739
+ console . log ( "glowcomm canvas contextmenu event : " , err . message ) ;
740
+ }
728
741
break
729
742
// Display frames per second and render time:
730
743
//$("<div id='fps'/>").appendTo(glowObjs[idx].title)
920
933
921
934
</ script >
922
935
</ div >
923
- </ body >
936
+ </ body >
Original file line number Diff line number Diff line change @@ -774,8 +774,21 @@ function handle_cmds(dcmds) {
774
774
case 'local_light' : { glowObjs [ idx ] = local_light ( cfg ) ; break }
775
775
case 'distant_light' : { glowObjs [ idx ] = distant_light ( cfg ) ; break }
776
776
case 'canvas' : {
777
+ var container = document . getElementById ( "glowscript" ) ;
778
+ if ( container !== null ) {
779
+ window . __context = { glowscript_container : $ ( "#glowscript" ) . removeAttr ( "id" ) }
780
+ }
777
781
glowObjs [ idx ] = canvas ( cfg )
778
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 ) ;
791
+ }
779
792
break
780
793
// Display frames per second and render time:
781
794
//$("<div id='fps'/>").appendTo(glowObjs[idx].title)
You can’t perform that action at this time.
0 commit comments