Spaces:
Runtime error
Runtime error
da03
commited on
Commit
·
b8ac450
1
Parent(s):
9b99c78
- static/index.html +10 -5
static/index.html
CHANGED
@@ -24,6 +24,9 @@
|
|
24 |
const MAX_RECONNECT_DELAY = 30000; // Maximum delay between reconnection attempts (30 seconds)
|
25 |
|
26 |
let isProcessing = false;
|
|
|
|
|
|
|
27 |
|
28 |
function connect() {
|
29 |
socket = new WebSocket(`wss://${window.location.host}/ws`);
|
@@ -125,11 +128,13 @@
|
|
125 |
let x = event.clientX - rect.left;
|
126 |
let y = event.clientY - rect.top;
|
127 |
|
128 |
-
//
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
|
|
133 |
|
134 |
sendInputState(x, y);
|
135 |
});
|
|
|
24 |
const MAX_RECONNECT_DELAY = 30000; // Maximum delay between reconnection attempts (30 seconds)
|
25 |
|
26 |
let isProcessing = false;
|
27 |
+
|
28 |
+
// Add flag to control trace visibility, default to false (hidden)
|
29 |
+
let showTrace = false;
|
30 |
|
31 |
function connect() {
|
32 |
socket = new WebSocket(`wss://${window.location.host}/ws`);
|
|
|
128 |
let x = event.clientX - rect.left;
|
129 |
let y = event.clientY - rect.top;
|
130 |
|
131 |
+
// Only draw the trace if showTrace is true
|
132 |
+
if (showTrace && lastSentPosition) {
|
133 |
+
ctx.beginPath();
|
134 |
+
ctx.moveTo(lastSentPosition.x, lastSentPosition.y);
|
135 |
+
ctx.lineTo(x, y);
|
136 |
+
ctx.stroke();
|
137 |
+
}
|
138 |
|
139 |
sendInputState(x, y);
|
140 |
});
|