Skip to content

Commit 42e2579

Browse files
authored
Update glowcommlab.js
Reinstate some canvas code.
1 parent adbc4ee commit 42e2579

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

labextension/vpython/src/glowcommlab.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,21 @@ function handle_cmds(dcmds) {
819819
case 'local_light': {glowObjs[idx] = local_light(cfg); break}
820820
case 'distant_light': {glowObjs[idx] = distant_light(cfg); break}
821821
case 'canvas': {
822+
var container = document.getElementById("glowscript");
823+
if (container !== null) {
824+
window.__context = { glowscript_container: $("#glowscript").removeAttr("id")}
825+
}
822826
glowObjs[idx] = canvas(cfg)
823827
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+
}
824837
break
825838
// Display frames per second and render time:
826839
//$("<div id='fps'/>").appendTo(glowObjs[idx].title)

0 commit comments

Comments
 (0)