mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-27 05:28:41 +00:00
pianoroll: hideNegative flag
This commit is contained in:
parent
ac39a609d7
commit
68814dd97c
@ -14,6 +14,7 @@ Pattern.prototype.pianoroll = function ({
|
|||||||
overscan = 1,
|
overscan = 1,
|
||||||
flipTime = 0,
|
flipTime = 0,
|
||||||
flipValues = 0,
|
flipValues = 0,
|
||||||
|
hideNegative = false,
|
||||||
inactive = '#C9E597',
|
inactive = '#C9E597',
|
||||||
active = '#FFCA28',
|
active = '#FFCA28',
|
||||||
// background = '#2A3236',
|
// background = '#2A3236',
|
||||||
@ -58,9 +59,10 @@ Pattern.prototype.pianoroll = function ({
|
|||||||
ctx.fillStyle = background;
|
ctx.fillStyle = background;
|
||||||
ctx.clearRect(0, 0, w, h);
|
ctx.clearRect(0, 0, w, h);
|
||||||
ctx.fillRect(0, 0, w, h);
|
ctx.fillRect(0, 0, w, h);
|
||||||
const inFrame = (event) => event.whole.begin >= 0 && event.whole.begin <= t + to && event.whole.end >= t + from;
|
const inFrame = (event) =>
|
||||||
|
(!hideNegative || event.whole.begin >= 0) && event.whole.begin <= t + to && event.whole.end >= t + from;
|
||||||
events.filter(inFrame).forEach((event) => {
|
events.filter(inFrame).forEach((event) => {
|
||||||
const isActive = event.whole.begin <= t && event.whole.end >= t;
|
const isActive = event.whole.begin <= t && event.whole.end > t;
|
||||||
ctx.fillStyle = event.context?.color || inactive;
|
ctx.fillStyle = event.context?.color || inactive;
|
||||||
ctx.strokeStyle = event.context?.color || active;
|
ctx.strokeStyle = event.context?.color || active;
|
||||||
ctx.globalAlpha = event.context.velocity ?? 1;
|
ctx.globalAlpha = event.context.velocity ?? 1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user