Spaces:
Runtime error
Runtime error
da03
commited on
Commit
·
6be71ba
1
Parent(s):
2004130
- static/index.html +14 -8
static/index.html
CHANGED
@@ -139,6 +139,17 @@
|
|
139 |
// Add flag to control trace visibility, default to false (hidden)
|
140 |
let showTrace = false;
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
function connect() {
|
143 |
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
144 |
socket = new WebSocket(`${protocol}//${window.location.host}/ws`);
|
@@ -175,7 +186,8 @@
|
|
175 |
img.src = 'data:image/png;base64,' + data.image;
|
176 |
} else if (data.type === "reset_confirmed") {
|
177 |
console.log("Simulation reset confirmed by server");
|
178 |
-
//
|
|
|
179 |
}
|
180 |
};
|
181 |
}
|
@@ -206,13 +218,7 @@
|
|
206 |
connect();
|
207 |
|
208 |
// Draw initial state on the canvas
|
209 |
-
|
210 |
-
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
211 |
-
ctx.font = "18px Arial";
|
212 |
-
ctx.fillStyle = "#666666";
|
213 |
-
ctx.textAlign = "center";
|
214 |
-
ctx.fillText("Move your mouse here to interact with NeuralOS", canvas.width/2, canvas.height/2 - 10);
|
215 |
-
ctx.fillText("The neural model will render in this area", canvas.width/2, canvas.height/2 + 20);
|
216 |
|
217 |
let lastSentPosition = null;
|
218 |
let lastSentTime = 0;
|
|
|
139 |
// Add flag to control trace visibility, default to false (hidden)
|
140 |
let showTrace = false;
|
141 |
|
142 |
+
// Function to draw the initial canvas state
|
143 |
+
function drawInitialCanvas() {
|
144 |
+
ctx.fillStyle = "#ffffff";
|
145 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
146 |
+
ctx.font = "18px Arial";
|
147 |
+
ctx.fillStyle = "#666666";
|
148 |
+
ctx.textAlign = "center";
|
149 |
+
ctx.fillText("Move your mouse here to interact with NeuralOS", canvas.width/2, canvas.height/2 - 10);
|
150 |
+
ctx.fillText("The neural model will render in this area", canvas.width/2, canvas.height/2 + 20);
|
151 |
+
}
|
152 |
+
|
153 |
function connect() {
|
154 |
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
155 |
socket = new WebSocket(`${protocol}//${window.location.host}/ws`);
|
|
|
186 |
img.src = 'data:image/png;base64,' + data.image;
|
187 |
} else if (data.type === "reset_confirmed") {
|
188 |
console.log("Simulation reset confirmed by server");
|
189 |
+
// Clear the canvas and reset to initial state
|
190 |
+
drawInitialCanvas();
|
191 |
}
|
192 |
};
|
193 |
}
|
|
|
218 |
connect();
|
219 |
|
220 |
// Draw initial state on the canvas
|
221 |
+
drawInitialCanvas();
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
|
223 |
let lastSentPosition = null;
|
224 |
let lastSentTime = 0;
|