refactor: remove old draw logic

+ pianoroll now uses .onPaint
This commit is contained in:
Felix Roos 2023-05-05 09:52:07 +02:00
parent 4b921c47f5
commit 95719654f3
7 changed files with 10 additions and 206 deletions

View file

@ -50,10 +50,9 @@ const modulesLoading = evalScope(
const presets = prebake();
let drawContext, clearCanvas;
let drawContext;
if (typeof window !== 'undefined') {
drawContext = getDrawContext();
clearCanvas = () => drawContext.clearRect(0, 0, drawContext.canvas.height, drawContext.canvas.width);
}
const getTime = () => getAudioContext().currentTime;
@ -208,7 +207,7 @@ export function Repl({ embedded = false }) {
const handleShuffle = async () => {
const { code, name } = getRandomTune();
logger(`[repl] ✨ loading random tune "${name}"`);
clearCanvas();
cleanupDraw();
resetLoadedSounds();
scheduler.setCps(1);
await prebake(); // declare default samples