Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -363,12 +363,14 @@ with gr.Blocks(css=css) as demo:
|
|
363 |
document.getElementById(\"pl\").setAttribute(\"points\", pts.slice(0,-1));
|
364 |
var xold = 0;
|
365 |
var yold = 0;
|
|
|
|
|
366 |
function lerp(y1, y2, mu) { return y1*(1-mu)+y2*mu; }
|
367 |
|
368 |
this.onpointermove = function(event) {
|
369 |
if (this.title != \"\") {
|
370 |
-
|
371 |
-
|
372 |
if (x < 0) { x = 0; } else if (x > 255) { x = 255; }
|
373 |
if (y < 0) { y = 0; } else if (y > 31) { y = 31; }
|
374 |
var pl_a = document.getElementById(\"pl\").getAttribute(\"points\").split(\" \");
|
|
|
363 |
document.getElementById(\"pl\").setAttribute(\"points\", pts.slice(0,-1));
|
364 |
var xold = 0;
|
365 |
var yold = 0;
|
366 |
+
var x = 0;
|
367 |
+
var y = 0;
|
368 |
function lerp(y1, y2, mu) { return y1*(1-mu)+y2*mu; }
|
369 |
|
370 |
this.onpointermove = function(event) {
|
371 |
if (this.title != \"\") {
|
372 |
+
x = parseInt(event.clientX - event.target.getBoundingClientRect().x);
|
373 |
+
y = parseInt(event.clientY - event.target.getBoundingClientRect().y);
|
374 |
if (x < 0) { x = 0; } else if (x > 255) { x = 255; }
|
375 |
if (y < 0) { y = 0; } else if (y > 31) { y = 31; }
|
376 |
var pl_a = document.getElementById(\"pl\").getAttribute(\"points\").split(\" \");
|