From f6d128842aced5125c2f89b3a5ea34e68bf701ce Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 29 Apr 2022 21:56:15 +0200 Subject: [PATCH] filter out inactive events --- repl/src/useHighlighting.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/repl/src/useHighlighting.js b/repl/src/useHighlighting.js index 964e2ab4..115960fe 100644 --- a/repl/src/useHighlighting.js +++ b/repl/src/useHighlighting.js @@ -10,7 +10,10 @@ function useHighlighting({ view, pattern, started }) { function updateHighlights() { const audioTime = Tone.getTransport().seconds; - const events = pattern.queryArc(audioTime, audioTime + 1 / 60); + const span = { begin: audioTime, end: audioTime + 1 / 60 }; + // TODO: remove isActive workaround when query is fixed + const isActive = (event) => event.whole.end >= span.begin && event.whole.begin <= span.end; + const events = pattern.queryArc(span.begin, span.end).filter(isActive); view.dispatch({ effects: setHighlights.of(events) }); frame = requestAnimationFrame(updateHighlights); }