Update app.py
Browse files
app.py
CHANGED
@@ -692,11 +692,7 @@ async(c, o, p, d, n, m, s)=>{
|
|
692 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].alphaIndex = 1;
|
693 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].visibility = 0.9999;
|
694 |
|
695 |
-
window.CoT = CoT;
|
696 |
window.md = false;
|
697 |
-
window.r_old = 1.0;
|
698 |
-
window.a_old = 0;
|
699 |
-
window.b_old = Math.PI / 2;
|
700 |
window.compass = document.getElementById("compass");
|
701 |
window.x = 0;
|
702 |
window.y = 0;
|
@@ -712,17 +708,10 @@ async(c, o, p, d, n, m, s)=>{
|
|
712 |
y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
|
713 |
|
714 |
if (Math.abs(x-xold)>16 || Math.abs(y-yold)>16) {
|
715 |
-
if (Math.abs(BABYLON.Engine.LastCreatedScene.activeCamera.radius) > 16) {
|
716 |
-
BABYLON.Engine.LastCreatedScene.activeCamera.radius =
|
717 |
} else {
|
718 |
-
|
719 |
-
}
|
720 |
-
BABYLON.Engine.LastCreatedScene.activeCamera.fov = 0.8 * BABYLON.Engine.LastCreatedScene.activeCamera.radius;
|
721 |
-
|
722 |
-
if (BABYLON.Engine.LastCreatedScene.activeCamera.fov < 0.157) {
|
723 |
-
BABYLON.Engine.LastCreatedScene.activeCamera.fov = 0.157;
|
724 |
-
} else if (BABYLON.Engine.LastCreatedScene.activeCamera.fov > 1.57) {
|
725 |
-
BABYLON.Engine.LastCreatedScene.activeCamera.fov = 1.57;
|
726 |
}
|
727 |
document.getElementById('zoom').value = BABYLON.Engine.LastCreatedScene.activeCamera.fov;
|
728 |
document.getElementById('zoom').parentNode.childNodes[2].innerText = document.getElementById('zoom').value;
|
@@ -1260,7 +1249,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
|
|
1260 |
load_all = gr.Checkbox(label="Load all")
|
1261 |
|
1262 |
with gr.Group():
|
1263 |
-
camera = gr.HTML(value="""<div style='width:128px;height:128px;border:1px dotted gray;padding:0;margin:0;
|
1264 |
<a href='#' id='reset_cam' style='width:12em;float:right;clear:none;color:white' onclick='
|
1265 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
1266 |
BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {
|
@@ -1280,7 +1269,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
|
|
1280 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + Math.ceil(Math.log2(Math.PI/document.getElementById(\"zoom\").value))/2.0*Math.sqrt(2.0) + \"px)\";
|
1281 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].oncontextmenu = function(e){e.preventDefault();}
|
1282 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].ondrag = function(e){e.preventDefault();}
|
1283 |
-
'>Reset camera</a
|
1284 |
html = gr.HTML(value="""<span style='max-width:50%;float:right;clear:none;'><label for='zoom' style='width:8em'>Zoom</label><input id='zoom' type='range' style='width:128px;height:1em;' value='0.8' min='0.157' max='1.57' step='0.001' oninput='
|
1285 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
1286 |
var evt = document.createEvent(\"Event\");
|
|
|
692 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].alphaIndex = 1;
|
693 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].visibility = 0.9999;
|
694 |
|
|
|
695 |
window.md = false;
|
|
|
|
|
|
|
696 |
window.compass = document.getElementById("compass");
|
697 |
window.x = 0;
|
698 |
window.y = 0;
|
|
|
708 |
y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
|
709 |
|
710 |
if (Math.abs(x-xold)>16 || Math.abs(y-yold)>16) {
|
711 |
+
if (Math.abs(BABYLON.Engine.LastCreatedScene.activeCamera.radius) > (1.57-0.157)*16) {
|
712 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.radius = (1.57-0.157)*16;
|
713 |
} else {
|
714 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.fov = BABYLON.Engine.LastCreatedScene.activeCamera.radius/16 + 0.157;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
715 |
}
|
716 |
document.getElementById('zoom').value = BABYLON.Engine.LastCreatedScene.activeCamera.fov;
|
717 |
document.getElementById('zoom').parentNode.childNodes[2].innerText = document.getElementById('zoom').value;
|
|
|
1249 |
load_all = gr.Checkbox(label="Load all")
|
1250 |
|
1251 |
with gr.Group():
|
1252 |
+
camera = gr.HTML(value="""<div style='width:128px;height:128px;border:1px dotted gray;padding:0;margin:0;position:absolute;' id='seek'></div>
|
1253 |
<a href='#' id='reset_cam' style='width:12em;float:right;clear:none;color:white' onclick='
|
1254 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
1255 |
BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {
|
|
|
1269 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + Math.ceil(Math.log2(Math.PI/document.getElementById(\"zoom\").value))/2.0*Math.sqrt(2.0) + \"px)\";
|
1270 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].oncontextmenu = function(e){e.preventDefault();}
|
1271 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].ondrag = function(e){e.preventDefault();}
|
1272 |
+
'>Reset camera</a><br/>""")
|
1273 |
html = gr.HTML(value="""<span style='max-width:50%;float:right;clear:none;'><label for='zoom' style='width:8em'>Zoom</label><input id='zoom' type='range' style='width:128px;height:1em;' value='0.8' min='0.157' max='1.57' step='0.001' oninput='
|
1274 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
1275 |
var evt = document.createEvent(\"Event\");
|