Spaces:
Runtime error
Runtime error
Commit ·
8df9f56
1
Parent(s): 7f0a0f6
Upd JS
Browse files- static/script.js +6 -1
static/script.js
CHANGED
|
@@ -16,14 +16,19 @@ function resetUI() {
|
|
| 16 |
<div id="sampler-column"></div>
|
| 17 |
</div>
|
| 18 |
`;
|
|
|
|
|
|
|
| 19 |
const newCanvas = document.getElementById("lines-canvas");
|
| 20 |
-
ctx = canvas.getContext("2d");
|
| 21 |
canvas.width = newCanvas.width = 0;
|
| 22 |
canvas.height = newCanvas.height = 0;
|
|
|
|
|
|
|
|
|
|
| 23 |
if (loaderDiv) loaderDiv.remove();
|
| 24 |
if (generateBtn) generateBtn.remove();
|
| 25 |
}
|
| 26 |
|
|
|
|
| 27 |
testerInput.addEventListener("change", handleFileChange);
|
| 28 |
samplerInput.addEventListener("change", handleFileChange);
|
| 29 |
|
|
|
|
| 16 |
<div id="sampler-column"></div>
|
| 17 |
</div>
|
| 18 |
`;
|
| 19 |
+
|
| 20 |
+
// ✅ Update canvas & ctx properly
|
| 21 |
const newCanvas = document.getElementById("lines-canvas");
|
|
|
|
| 22 |
canvas.width = newCanvas.width = 0;
|
| 23 |
canvas.height = newCanvas.height = 0;
|
| 24 |
+
ctx.clearRect?.(0, 0, canvas.width, canvas.height);
|
| 25 |
+
|
| 26 |
+
// 🧼 Remove old button & loader if exists
|
| 27 |
if (loaderDiv) loaderDiv.remove();
|
| 28 |
if (generateBtn) generateBtn.remove();
|
| 29 |
}
|
| 30 |
|
| 31 |
+
|
| 32 |
testerInput.addEventListener("change", handleFileChange);
|
| 33 |
samplerInput.addEventListener("change", handleFileChange);
|
| 34 |
|