@real-music-packages/web-core 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scene/index.d.ts +16 -2
- package/dist/scene/index.js +2 -1
- package/dist/scene/index.js.map +1 -1
- package/package.json +1 -1
package/dist/scene/index.d.ts
CHANGED
|
@@ -717,8 +717,22 @@ declare function measureCount(rn: RenderedNotation): number;
|
|
|
717
717
|
declare function followBoxAt(rn: RenderedNotation, posMeasures: number): Box | null;
|
|
718
718
|
/**
|
|
719
719
|
* The continuous follow-window START measure for an audio-clock progress 0..1.
|
|
720
|
-
*
|
|
721
|
-
*
|
|
720
|
+
*
|
|
721
|
+
* INVARIANT: the bar the playhead is in (`curBar`) is ALWAYS fully inside the
|
|
722
|
+
* FOLLOW_BARS-wide window. We anchor `curBar` as the BOTTOM (last) visible bar —
|
|
723
|
+
* with the preceding FOLLOW_BARS-1 bars above it for context — so the window
|
|
724
|
+
* holds steady while the playhead works through the visible bars and only scrolls
|
|
725
|
+
* once the playhead reaches the bottom bar. Concretely the resting window start is
|
|
726
|
+
* `curBar - (FOLLOW_BARS - 1)`; over the tail of each bar we ease that forward by
|
|
727
|
+
* one bar so the NEXT bar slides into the bottom slot just as the playhead crosses
|
|
728
|
+
* into it. Because the eased start stays within `[curBar-(FOLLOW_BARS-1),
|
|
729
|
+
* curBar-(FOLLOW_BARS-2)]`, `curBar` never leaves `[start, start+FOLLOW_BARS)` —
|
|
730
|
+
* the current measure (and its playhead) can never ride off the top.
|
|
731
|
+
*
|
|
732
|
+
* The scroll is cubic-eased (smooth, no hard jump) over the last portion of each
|
|
733
|
+
* bar; result is clamped to [0, nBars-FOLLOW_BARS]. (Replaces RSR's original
|
|
734
|
+
* +page.svelte:738-744 logic, which advanced the window to the NEXT bar over the
|
|
735
|
+
* last third of EVERY bar and so pushed the still-current bar off the top.)
|
|
722
736
|
*/
|
|
723
737
|
declare function followWindowStart(nBars: number, camProgress01: number): number;
|
|
724
738
|
/** The dest rect a notation frame is drawn into, on screen. */
|
package/dist/scene/index.js
CHANGED
|
@@ -382,8 +382,9 @@ function followWindowStart(nBars, camProgress01) {
|
|
|
382
382
|
const curBar = Math.floor(posBars);
|
|
383
383
|
const frac = posBars - curBar;
|
|
384
384
|
const scrollFrac = cubicEaseInOut(Math.min(1, Math.max(0, (frac - 0.66) / 0.34)));
|
|
385
|
+
const restStart = curBar - (FOLLOW_BARS - 1);
|
|
385
386
|
const maxStart = Math.max(0, nBars - FOLLOW_BARS);
|
|
386
|
-
return Math.max(0, Math.min(maxStart,
|
|
387
|
+
return Math.max(0, Math.min(maxStart, restStart + scrollFrac));
|
|
387
388
|
}
|
|
388
389
|
function notationLayout(rn, W, H, boxTop, boxH, opts = {}) {
|
|
389
390
|
const { zoom01 = 1, focusBox = null } = opts;
|