Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -360,16 +360,20 @@ with gr.Blocks(css=css) as demo:
|
|
360 |
}
|
361 |
document.getElementById(\"pl\").setAttribute(\"points\", pts);
|
362 |
this.onpointermove = function(event) {
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
|
|
|
|
368 |
}
|
369 |
this.onpointerup = function(event) {
|
370 |
-
document.getElementsByTagName(\"
|
|
|
371 |
}
|
372 |
}
|
|
|
373 |
}catch(e){alert(e);}
|
374 |
'>
|
375 |
<defs>
|
|
|
360 |
}
|
361 |
document.getElementById(\"pl\").setAttribute(\"points\", pts);
|
362 |
this.onpointermove = function(event) {
|
363 |
+
if (this.style.borderBottom == \"1px dotted white\") {
|
364 |
+
var x = event.clientX - event.target.getBoundingClientRect().x;
|
365 |
+
var y = event.clientY - event.target.getBoundingClientRect().y;
|
366 |
+
var pl_a = document.getElementById(\"pl\").getAttribute(\"points\").split(\" \");
|
367 |
+
pl_a[x] = x+\",\"+y;
|
368 |
+
document.getElementById(\"pl\").setAttribute(\"points\", pl_a.join(\" \"));
|
369 |
+
}
|
370 |
}
|
371 |
this.onpointerup = function(event) {
|
372 |
+
document.getElementsByTagName(\"textarea\")[1].value = document.getElementById(\"pl\").getAttribute(\"points\").replace(/\d+,/g, \"\");
|
373 |
+
this.style.borderBottom = \"1px dotted black\";
|
374 |
}
|
375 |
}
|
376 |
+
this.style.borderBottom = \"1px dotted white\";
|
377 |
}catch(e){alert(e);}
|
378 |
'>
|
379 |
<defs>
|