freealise commited on
Commit
e660fbb
·
verified ·
1 Parent(s): c891e54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -706,12 +706,13 @@ async(c, o, p, d, n, m, s)=>{
706
  window.parallax = 0;
707
  window.xdir = new BABYLON.Vector3(1, 0, 0);
708
  window.rdir = new BABYLON.Vector3(1, 0, 0);
 
709
 
710
  document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointermove', function(evt) {
711
  if (md === true) {
712
  rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
713
- BABYLON.Engine.LastCreatedScene.getMeshByName("videoDome").position.x = parallax * rdir.x;
714
- BABYLON.Engine.LastCreatedScene.getMeshByName("videoDome").position.z = parallax * rdir.z;
715
 
716
  x = parseInt(evt.clientX - evt.target.getBoundingClientRect().x);
717
  y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
@@ -1313,9 +1314,9 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
1313
  }
1314
  parallax = this.value;
1315
  rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
1316
- this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.getMeshByName(\"videoDome\").position;
1317
- BABYLON.Engine.LastCreatedScene.getMeshByName(\"videoDome\").position.x = parallax * rdir.x;
1318
- BABYLON.Engine.LastCreatedScene.getMeshByName(\"videoDome\").position.z = parallax * rdir.z;
1319
  //this.parentNode.childNodes[2].innerText = parallax;
1320
  '/><span>0.0</span></span><br/>
1321
  <span><label for='contrast' style='width:8em'>Contrast</label><input id='contrast' type='range' style='width:128px;height:1em;' value='1.0' min='0' max='2' step='0.001' oninput='
 
706
  window.parallax = 0;
707
  window.xdir = new BABYLON.Vector3(1, 0, 0);
708
  window.rdir = new BABYLON.Vector3(1, 0, 0);
709
+ window.videoDomeMesh = BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1];
710
 
711
  document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointermove', function(evt) {
712
  if (md === true) {
713
  rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
714
+ videoDomeMesh.position.x = parallax * rdir.x;
715
+ videoDomeMesh.position.z = parallax * rdir.z;
716
 
717
  x = parseInt(evt.clientX - evt.target.getBoundingClientRect().x);
718
  y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
 
1314
  }
1315
  parallax = this.value;
1316
  rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
1317
+ this.parentNode.childNodes[2].innerText = JSON.stringify(videoDomeMesh.position);
1318
+ videoDomeMesh.position.x = parallax * rdir.x;
1319
+ videoDomeMesh.position.z = parallax * rdir.z;
1320
  //this.parentNode.childNodes[2].innerText = parallax;
1321
  '/><span>0.0</span></span><br/>
1322
  <span><label for='contrast' style='width:8em'>Contrast</label><input id='contrast' type='range' style='width:128px;height:1em;' value='1.0' min='0' max='2' step='0.001' oninput='