mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-31 13:21:52 -04:00
fixes
This commit is contained in:
+15
-12
@@ -6,12 +6,7 @@ export function textbox({ haps, ctx, id, margin = 10, fontsize = 24 } = {}) {
|
||||
const h = ctx.canvas.height;
|
||||
ctx.clearRect(0, 0, w, h);
|
||||
const color = getTheme().foreground;
|
||||
const centerX = w / 2;
|
||||
const centerY = h / 2;
|
||||
|
||||
if (id) {
|
||||
haps = haps.filter((hap) => hap.hasTag(id));
|
||||
}
|
||||
ctx.strokeStyle = color;
|
||||
ctx.fillStyle = color;
|
||||
ctx.globalAlpha = 1;
|
||||
@@ -35,13 +30,21 @@ export function textbox({ haps, ctx, id, margin = 10, fontsize = 24 } = {}) {
|
||||
|
||||
Pattern.prototype.textbox = function (options = {}) {
|
||||
let { ctx = getDrawContext(), id = 1 } = options;
|
||||
return this.tag(id).onPaint((_, time, haps) =>
|
||||
textbox({
|
||||
...options,
|
||||
time,
|
||||
ctx,
|
||||
haps: haps.filter((hap) => hap.isActive(time)),
|
||||
this.draw(
|
||||
(haps, time) => {
|
||||
textbox({
|
||||
...options,
|
||||
time,
|
||||
ctx,
|
||||
haps: haps.filter((hap) => hap.isActive(time)),
|
||||
});
|
||||
},
|
||||
{
|
||||
lookbehind: 0,
|
||||
lookahead: 0,
|
||||
id,
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user