da03 commited on
Commit
b8ac450
·
1 Parent(s): 9b99c78
Files changed (1) hide show
  1. 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
- // Client-side prediction
129
- ctx.beginPath();
130
- ctx.moveTo(lastSentPosition ? lastSentPosition.x : x, lastSentPosition ? lastSentPosition.y : y);
131
- ctx.lineTo(x, y);
132
- ctx.stroke();
 
 
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
  });