fix: pane scroll picks the most-recently-entered annotation
The prior "first active in anns" pick was masked by a full-timeline annotation (bars [[0 N]]) that always won, so primary never changed and the scroll never re-fired. Pick the active bar with the greatest lo (ties → tighter bar) instead, so entering a nested/later annotation changes the pick and scrolls to it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
4b4d6183c1
commit
183e776727
1 changed files with 13 additions and 7 deletions
|
|
@ -488,13 +488,19 @@
|
||||||
(scroll-to-seg-track! segs playhead)))))
|
(scroll-to-seg-track! segs playhead)))))
|
||||||
(do (reset! played-bar nil)
|
(do (reset! played-bar nil)
|
||||||
(reset! scrolled-on-load? nil)))
|
(reset! scrolled-on-load? nil)))
|
||||||
;; scroll the commentary pane to the annotation the playhead is inside — ONE
|
;; scroll the commentary pane to the annotation the playhead is inside. ONE
|
||||||
;; deterministic pick (first active in the sorted anns), so overlapping
|
;; deterministic pick, so overlapping annotations don't race: the MOST
|
||||||
;; annotations don't race. Fires on any playhead move (playback or scrub).
|
;; RECENTLY ENTERED one — the active bar with the greatest lo (ties → the
|
||||||
(let [primary (some (fn [a]
|
;; tighter bar). A full-timeline annotation (lo 0) thus only wins when nothing
|
||||||
(when (some (fn [[lo hi]] (and (<= lo playhead) (< playhead hi))) (:bars a))
|
;; more specific contains the playhead. Fires on any playhead move.
|
||||||
(:id a)))
|
(let [primary (->> anns
|
||||||
anns)]
|
(keep (fn [a]
|
||||||
|
(some (fn [[lo hi]]
|
||||||
|
(when (and (<= lo playhead) (< playhead hi)) [lo hi (:id a)]))
|
||||||
|
(:bars a))))
|
||||||
|
(sort-by (fn [[lo hi _]] [lo (- hi)]))
|
||||||
|
last
|
||||||
|
(#(nth % 2 nil)))]
|
||||||
(when (not= primary @scrolled-ann)
|
(when (not= primary @scrolled-ann)
|
||||||
(reset! scrolled-ann primary)
|
(reset! scrolled-ann primary)
|
||||||
(when primary
|
(when primary
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue