fix: clip-follow only when playhead is inside a scroll-to annotation's bar

::active-annotation falls back to the nearest annotation (it drives the
commentary highlight), so gating playback clip-follow on it fired for every
clip. Gate on strict bar containment of a :scroll-to annotation instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-06-30 10:37:49 -04:00
parent baa46cb734
commit b031a167a4

View file

@ -308,7 +308,6 @@
thumbs @(rf/subscribe [::subs/thumbnails]) thumbs @(rf/subscribe [::subs/thumbnails])
playhead @(rf/subscribe [::subs/playhead]) playhead @(rf/subscribe [::subs/playhead])
playing? @(rf/subscribe [::subs/playing?]) playing? @(rf/subscribe [::subs/playing?])
active @(rf/subscribe [::subs/active-annotation])
authoring? (some? @(rf/subscribe [::subs/draft-group])) authoring? (some? @(rf/subscribe [::subs/draft-group]))
linking @(rf/subscribe [::subs/linking]) linking @(rf/subscribe [::subs/linking])
len @(rf/subscribe [::subs/length]) len @(rf/subscribe [::subs/length])
@ -320,10 +319,14 @@
(r/after-render (r/after-render
(fn [] (fn []
(follow! fps zoom playhead) (follow! fps zoom playhead)
;; clip-following: while playing through an annotation that opts in ;; clip-following: only while the playhead is actually inside a bar of
;; (:meta :scroll-to), scroll each clip into view as the playhead ;; an annotation that opts in (:meta :scroll-to) — scroll each of its
;; crosses onto its track. Deduped so it only moves on track change. ;; clips into view as the playhead crosses onto a new track. (Strict
(when (ann-scroll-to? (get-in scene [:groups active])) ;; containment, NOT ::active-annotation, which falls back to the
;; nearest annotation and would fire on every clip.)
(when (some (fn [a] (and (ann-scroll-to? (get-in scene [:groups (:id a)]))
(some (fn [[lo hi]] (<= lo playhead hi)) (:bars a))))
anns)
(let [track (:track (nth segs (seg-at segs playhead) nil))] (let [track (:track (nth segs (seg-at segs playhead) nil))]
(when (not= track @played-track) (when (not= track @played-track)
(reset! played-track track) (reset! played-track track)