Merge pull request #1024 from tidalcycles/fix-draw-bugs

better theme integration for visuals + various fixes
This commit is contained in:
Felix Roos
2024-03-28 11:37:56 +01:00
committed by GitHub
14 changed files with 119 additions and 107 deletions
+1 -11
View File
@@ -39,16 +39,6 @@ export function MiniRepl({
const init = useCallback(({ code, shouldDraw }) => {
const drawContext = shouldDraw ? document.querySelector('#' + canvasId)?.getContext('2d') : null;
let onDraw;
if (shouldDraw) {
onDraw = (haps, time, frame, painters) => {
painters.length && drawContext?.clearRect(0, 0, drawContext.canvas.width * 2, drawContext.canvas.height * 2);
painters?.forEach((painter) => {
// ctx time haps drawTime paintOptions
painter(drawContext, time, haps, drawTime, { clear: false });
});
};
}
const editor = new StrudelMirror({
id,
@@ -60,7 +50,7 @@ export function MiniRepl({
initialCode: '// LOADING',
pattern: silence,
drawTime,
onDraw,
drawContext,
editPattern: (pat, id) => {
if (onTrigger) {
pat = pat.onTrigger(onTrigger, false);
+2 -9
View File
@@ -65,15 +65,8 @@ export function Repl({ embedded = false }) {
const init = useCallback(() => {
const drawTime = [-2, 2];
const drawContext = getDrawContext();
const onDraw = (haps, time, frame, painters) => {
painters.length && drawContext.clearRect(0, 0, drawContext.canvas.width * 2, drawContext.canvas.height * 2);
painters?.forEach((painter) => {
// ctx time haps drawTime paintOptions
painter(drawContext, time, haps, drawTime, { clear: false });
});
};
const editor = new StrudelMirror({
sync: true,
sync: false,
defaultOutput: webaudioOutput,
getTime: () => getAudioContext().currentTime,
setInterval,
@@ -84,7 +77,7 @@ export function Repl({ embedded = false }) {
initialCode: '// LOADING',
pattern: silence,
drawTime,
onDraw,
drawContext,
prebake: async () => Promise.all([modulesLoading, presets]),
onUpdateState: (state) => {
setReplState({ ...state });