freealise commited on
Commit
32c422b
·
verified ·
1 Parent(s): ea7e03a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py CHANGED
@@ -617,6 +617,7 @@ async(c, o, p, d, n, m)=>{
617
  document.getElementById("model3D").getElementsByTagName("canvas")[0].oncontextmenu = function(e){e.preventDefault();}
618
  document.getElementById("model3D").getElementsByTagName("canvas")[0].ondrag = function(e){e.preventDefault();}
619
 
 
620
  var coords = JSON.parse(document.getElementById("coords").getElementsByTagName("textarea")[0].value);
621
 
622
  if (o.indexOf(""+n) < 0) {
@@ -663,6 +664,7 @@ async(c, o, p, d, n, m)=>{
663
  window.r_old = 1.0;
664
  window.a_old = 0;
665
  window.b_old = Math.PI / 2;
 
666
 
667
  document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointermove', function() {
668
  if (md === true) {
@@ -969,6 +971,34 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
969
  background-color:#808080;
970
  touch-action: none;
971
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
972
  </style>
973
  """)
974
  average = gr.HTML(value="""<label for='average'>Average</label><input id='average' type='range' style='width:256px;height:1em;' value='1' min='1' max='15' step='2' onclick='
@@ -1066,6 +1096,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
1066
  <a onclick='snapshot();'>Screenshot</a><br/>
1067
  <img src='' id='img_out' onload='var ctxt = document.getElementById(\"cnv_out\").getContext(\"2d\");ctxt.drawImage(this, 0, 0);'/><br/>
1068
  <canvas id='cnv_out'></canvas>
 
1069
  """)
1070
  render = gr.Button("Render")
1071
  input_json.input(show_json, inputs=[input_json], outputs=[processed_video, processed_zip, output_frame, output_mask, output_depth, coords])
 
617
  document.getElementById("model3D").getElementsByTagName("canvas")[0].oncontextmenu = function(e){e.preventDefault();}
618
  document.getElementById("model3D").getElementsByTagName("canvas")[0].ondrag = function(e){e.preventDefault();}
619
 
620
+ document.getElementById("model3D").appendChild(document.getElementById("compass_box"));
621
  var coords = JSON.parse(document.getElementById("coords").getElementsByTagName("textarea")[0].value);
622
 
623
  if (o.indexOf(""+n) < 0) {
 
664
  window.r_old = 1.0;
665
  window.a_old = 0;
666
  window.b_old = Math.PI / 2;
667
+ window.compass = document.getElementById("compass");
668
 
669
  document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointermove', function() {
670
  if (md === true) {
 
971
  background-color:#808080;
972
  touch-action: none;
973
  }
974
+ #compass_box {
975
+ top:1.5em;
976
+ right:3px;
977
+ position: fixed;
978
+ border:1px dashed gray;
979
+ border-radius: 50%;
980
+ width:1.5em;
981
+ height:1.5em;
982
+ padding:0;
983
+ margin:0;
984
+ }
985
+ #compass {
986
+ position:absolute;
987
+ top:-1px;
988
+ left:-1px;
989
+ transform:rotate(0deg);
990
+ border:1px solid black;
991
+ border-radius: 50%;
992
+ width:100%;
993
+ height:100%;
994
+ padding:0;
995
+ margin:0;
996
+ line-height:1.45em;
997
+ letter-spacing:0;
998
+ }
999
+ #compass b {
1000
+ margin-top:-1px;
1001
+ }
1002
  </style>
1003
  """)
1004
  average = gr.HTML(value="""<label for='average'>Average</label><input id='average' type='range' style='width:256px;height:1em;' value='1' min='1' max='15' step='2' onclick='
 
1096
  <a onclick='snapshot();'>Screenshot</a><br/>
1097
  <img src='' id='img_out' onload='var ctxt = document.getElementById(\"cnv_out\").getContext(\"2d\");ctxt.drawImage(this, 0, 0);'/><br/>
1098
  <canvas id='cnv_out'></canvas>
1099
+ <div id='compass_box'><div id='compass'><b style='color:blue;'>◅</b>𝍠<b style='color:red;'>▻</b></div></div>
1100
  """)
1101
  render = gr.Button("Render")
1102
  input_json.input(show_json, inputs=[input_json], outputs=[processed_video, processed_zip, output_frame, output_mask, output_depth, coords])