Revert "refactor: remove old draw logic"

This reverts commit 95719654f3.
This commit is contained in:
Felix Roos
2023-05-10 11:44:55 +02:00
parent 12228c56d9
commit 6e02bf59e9
7 changed files with 208 additions and 6 deletions
+3 -2
View File
@@ -50,9 +50,10 @@ const modulesLoading = evalScope(
const presets = prebake();
let drawContext;
let drawContext, clearCanvas;
if (typeof window !== 'undefined') {
drawContext = getDrawContext();
clearCanvas = () => drawContext.clearRect(0, 0, drawContext.canvas.height, drawContext.canvas.width);
}
const getTime = () => getAudioContext().currentTime;
@@ -207,7 +208,7 @@ export function Repl({ embedded = false }) {
const handleShuffle = async () => {
const { code, name } = getRandomTune();
logger(`[repl] ✨ loading random tune "${name}"`);
cleanupDraw();
clearCanvas();
resetLoadedSounds();
scheduler.setCps(1);
await prebake(); // declare default samples