approaching proper draw logic in microrepl

This commit is contained in:
Felix Roos 2023-12-16 16:14:40 +01:00
parent fc034830d0
commit 7fcd9d8a83
3 changed files with 58 additions and 26 deletions

View file

@ -256,10 +256,13 @@ export function getDrawOptions(drawTime, options = {}) {
return { fold: 1, ...options, cycles, playhead };
}
export const getPunchcardPainter =
(options = {}) =>
(ctx, time, haps, drawTime, paintOptions = {}) =>
pianoroll({ ctx, time, haps, ...getDrawOptions(drawTime, { ...paintOptions, ...options }) });
Pattern.prototype.punchcard = function (options) {
return this.onPaint((ctx, time, haps, drawTime, paintOptions = {}) =>
pianoroll({ ctx, time, haps, ...getDrawOptions(drawTime, { ...paintOptions, ...options }) }),
);
return this.onPaint(getPunchcardPainter(options));
};
/**