fix option handling
This commit is contained in:
parent
ea0e0b4396
commit
e4f538b674
1 changed files with 3 additions and 3 deletions
|
|
@ -284,14 +284,14 @@ export function pianoroll({
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOptions(drawTime, options) {
|
function getOptions(drawTime, options = {}) {
|
||||||
let [lookbehind, lookahead] = drawTime;
|
let [lookbehind, lookahead] = drawTime;
|
||||||
lookbehind = Math.abs(lookbehind);
|
lookbehind = Math.abs(lookbehind);
|
||||||
const cycles = lookahead + lookbehind;
|
const cycles = lookahead + lookbehind;
|
||||||
const playhead = lookbehind / cycles;
|
const playhead = lookbehind / cycles;
|
||||||
return { ...options, cycles, playhead };
|
return { fold: 1, ...options, cycles, playhead };
|
||||||
}
|
}
|
||||||
|
|
||||||
Pattern.prototype.punchcard = function (options = { fold: 1 }) {
|
Pattern.prototype.punchcard = function (options) {
|
||||||
return this.onPaint((ctx, time, haps, drawTime) => pianoroll({ ctx, time, haps, ...getOptions(drawTime, options) }));
|
return this.onPaint((ctx, time, haps, drawTime) => pianoroll({ ctx, time, haps, ...getOptions(drawTime, options) }));
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue