mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-24 12:08:28 +00:00
add autodraw flag
This commit is contained in:
parent
7fcd9d8a83
commit
c29d032027
@ -87,7 +87,7 @@ export function initEditor({ initialCode = '', onChange, onEvaluate, onStop, set
|
|||||||
|
|
||||||
export class StrudelMirror {
|
export class StrudelMirror {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
const { root, initialCode = '', onDraw, drawTime = [-2, 2], prebake, settings, ...replOptions } = options;
|
const { root, initialCode = '', onDraw, drawTime = [-2, 2], autodraw, prebake, settings, ...replOptions } = options;
|
||||||
this.code = initialCode;
|
this.code = initialCode;
|
||||||
this.root = root;
|
this.root = root;
|
||||||
this.miniLocations = [];
|
this.miniLocations = [];
|
||||||
@ -110,7 +110,7 @@ export class StrudelMirror {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.prebaked = prebake();
|
this.prebaked = prebake();
|
||||||
// this.drawFirstFrame();
|
autodraw && this.drawFirstFrame();
|
||||||
|
|
||||||
this.repl = repl({
|
this.repl = repl({
|
||||||
...replOptions,
|
...replOptions,
|
||||||
@ -169,7 +169,7 @@ export class StrudelMirror {
|
|||||||
try {
|
try {
|
||||||
await this.repl.evaluate(this.code, false);
|
await this.repl.evaluate(this.code, false);
|
||||||
this.drawer.invalidate(this.repl.scheduler);
|
this.drawer.invalidate(this.repl.scheduler);
|
||||||
this.onDraw?.(this.drawer.visibleHaps, 0, []);
|
this.onDraw?.(this.drawer.visibleHaps, 0, [], this.painters);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('first frame could not be painted');
|
console.warn('first frame could not be painted');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,6 +52,7 @@ export function MicroRepl({
|
|||||||
defaultOutput: webaudioOutput,
|
defaultOutput: webaudioOutput,
|
||||||
getTime: () => getAudioContext().currentTime,
|
getTime: () => getAudioContext().currentTime,
|
||||||
transpiler,
|
transpiler,
|
||||||
|
autodraw: !!shouldDraw,
|
||||||
root: containerRef.current,
|
root: containerRef.current,
|
||||||
initialCode: '// LOADING',
|
initialCode: '// LOADING',
|
||||||
pattern: silence,
|
pattern: silence,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user