Skip to content

Commit 6980d4f

Browse files
committed
fix(studio): stride automation lane labels by AUTOMATION_LANE_H
Round-3 finding: getTimelineLaneTop steps by the 28px keyframe-lane height, not the 72px automation-lane height, so a second automation label sat 44px short of its curve. TRACK_H + index * AUTOMATION_LANE_H matches the three sites that already compute this offset correctly. typecheck excluded: Mac worktree has no node_modules (disk-floor hook blocks local install); verified clean on the devbox instead, see PR body.
2 parents 1a4882e + 0945de8 commit 6980d4f

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

‎packages/studio/src/player/components/TimelineTrackHeader.test.tsx‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { afterEach, describe, expect, it, vi } from "vitest";
66
import { TimelineTrackHeader } from "./TimelineTrackHeader";
77
import { defaultTimelineTheme } from "./timelineTheme";
88
import type { TimelineElement } from "../store/playerStore";
9-
import { LABEL_COL_W } from "./timelineLayout";
9+
import { LABEL_COL_W, TRACK_H } from "./timelineLayout";
10+
import { AUTOMATION_LANE_H } from "./automationLaneHeight";
1011

1112
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
1213
afterEach(() => (document.body.innerHTML = ""));
@@ -107,6 +108,26 @@ describe("TimelineTrackHeader", () => {
107108
act(() => root.unmount());
108109
});
109110

111+
it("stacks a second automation label at the curve's own stride, not the keyframe stride", () => {
112+
const clip: TimelineElement = {
113+
...ELEMENT,
114+
tag: "audio",
115+
automation: JSON.stringify({
116+
version: 1,
117+
lanes: [
118+
{ target: "volume", points: [{ t: 0, v: 1 }] },
119+
{ target: "rate", points: [{ t: 0, v: 1 }] },
120+
],
121+
}),
122+
};
123+
const { host, root } = renderHeader({ clip, audio: true });
124+
const labels = [...host.querySelectorAll<HTMLElement>("[data-automation-lane-label]")];
125+
expect(labels).toHaveLength(2);
126+
const curveTops = labels.map((_, index) => TRACK_H + index * AUTOMATION_LANE_H);
127+
expect(labels.map((el) => Number(el.dataset.timelineLaneTop))).toEqual(curveTops);
128+
act(() => root.unmount());
129+
});
130+
110131
it("names a shared audio track rather than the selected clip", () => {
111132
const automation = JSON.stringify({
112133
version: 1,

‎packages/studio/src/player/components/TimelineTrackHeader.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import { runtimeAudioId } from "../lib/timelineElementHelpers";
1414
import { TimelineFxButton } from "./TimelineFxButton";
1515
import { elementFxChain, groupAutomationLanes, isCarveLane } from "./automationLaneData";
1616
import { LaneToggleButton } from "./LayerDisclosureRow";
17-
import { getTimelineLaneTop, LABEL_COL_W, TRACK_H } from "./timelineLayout";
17+
import { LABEL_COL_W, TRACK_H } from "./timelineLayout";
18+
import { AUTOMATION_LANE_H } from "./automationLaneHeight";
1819
import type { TimelineTheme } from "./timelineTheme";
1920
import { trackDisplaySuffix } from "./timelineTrackDisplay";
2021
import { AutomationLaneHeaderRow } from "./trackHeaderLabelRows";
@@ -348,7 +349,7 @@ export function TimelineTrackHeader({
348349
alsoAutomatedBy={
349350
groupAutomatedTargets.has(row.key) ? (groupLabelForNote ?? groupOwner) : undefined
350351
}
351-
top={getTimelineLaneTop(index)}
352+
top={TRACK_H + index * AUTOMATION_LANE_H}
352353
isLastLane={index === automationRows.length - 1}
353354
gutterBackground={gutterFill(theme.gutterBackground, isGroupMember)}
354355
columnWidth={showTrackLabel ? LABEL_COL_W : contentOrigin}

0 commit comments

Comments
 (0)