@vosjs/studio-core 0.30.1 → 0.30.2

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/index.d.ts CHANGED
@@ -2404,6 +2404,12 @@ interface PlanOptions {
2404
2404
  dragLevel?: number;
2405
2405
  /** emit spans with focusMode 'auto' (cursor-follow camera). */
2406
2406
  followByDefault?: boolean;
2407
+ /**
2408
+ * the footage's length in seconds: no span runs past it. The cursor
2409
+ * track ends at the last event, before the footage does, so the track
2410
+ * alone cannot say where the footage ends.
2411
+ */
2412
+ duration?: number;
2407
2413
  /** typing sessions plan spans. */
2408
2414
  typingZoom?: boolean;
2409
2415
  /** max silence between `key` pings before the typing session ends. */
package/dist/index.js CHANGED
@@ -1749,8 +1749,10 @@ function planAutoZoom(track, options) {
1749
1749
  typingZoom = style.typingZoom,
1750
1750
  typingGap = style.typingGap,
1751
1751
  typingHold = style.typingHold,
1752
- typingMinLevel = style.typingMinLevel
1752
+ typingMinLevel = style.typingMinLevel,
1753
+ duration
1753
1754
  } = options;
1755
+ const within = (spans2) => duration === void 0 ? spans2 : spans2.map((z) => ({ ...z, out: Math.min(z.out, round(duration)) })).filter((z) => z.out - z.in >= 0.3);
1754
1756
  const grouped = groupTrack(track, {
1755
1757
  width,
1756
1758
  height,
@@ -1870,12 +1872,14 @@ function planAutoZoom(track, options) {
1870
1872
  // the FIELD is the anchor, and a follow would be a no-op at best.
1871
1873
  source: "auto"
1872
1874
  }));
1873
- const spans = [...zSpans, ...kSpans, ...dragSpans].sort((a, b) => a.in - b.in);
1875
+ const spans = within([...zSpans, ...kSpans, ...dragSpans]).sort(
1876
+ (a, b) => a.in - b.in
1877
+ );
1874
1878
  const dwells = dwellSpans(track, width, height, maxLevel, [
1875
1879
  ...spans,
1876
1880
  ...dragReserved
1877
1881
  ]);
1878
- return [...spans, ...dwells].sort((a, b) => a.in - b.in);
1882
+ return within([...spans, ...dwells]).sort((a, b) => a.in - b.in);
1879
1883
  }
1880
1884
  function typingSessions(track, width, height, typingGap) {
1881
1885
  const pings = track.filter((e) => e.type === "key").map((e) => ({ t: e.t / 1e3, rect: e.rect, x: e.x, y: e.y }));