Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

style(edit-clip): draw the kept range as the clip's candy card

EtienneLescotbd1fb098fae1
diff --git a/src/components/ai-edition/EditClipModal.test.tsx b/src/components/ai-edition/EditClipModal.test.tsx
index ff907b97a..b8a42069e 100644
--- a/src/components/ai-edition/EditClipModal.test.tsx
+++ b/src/components/ai-edition/EditClipModal.test.tsx
@@ -115,20 +115,6 @@ describe("EditClipModal trim duration readout (#558)", () => {
expect(screen.getAllByText("0:20.0–1:45.0")).toHaveLength(1);
});
- it("keeps the discarded head and tail out of the pointer's way", () => {
- const { container } = renderModal();
-
- // The dimmed tail is painted after the selection, so it covers the end
- // handle's 6px overhang and, once the range is narrower than the handle,
- // the handle itself. jsdom does not hit-test, so this pins the property
- // rather than the grab; the grab is checked by driving the real window.
- const dimmed = [...container.querySelectorAll<HTMLElement>("div")].filter(
- (el) => el.style.background === "var(--overlay-dark)",
- );
- expect(dimmed).toHaveLength(2);
- for (const el of dimmed) expect(el.style.pointerEvents).toBe("none");
- });
-
it("updates the final duration as the end handle is dragged", () => {
renderModal();
diff --git a/src/components/ai-edition/Modals.tsx b/src/components/ai-edition/Modals.tsx
index b8a99fe8a..dfe2f20a7 100644
--- a/src/components/ai-edition/Modals.tsx
+++ b/src/components/ai-edition/Modals.tsx
@@ -1035,95 +1035,33 @@ export function EditClipModal({
<span>0:00.0</span>
<span>{formatSeconds(sourceDurationSec)}</span>
</div>
- <div
- ref={trackRef}
- data-testid="edit-clip-trim-track"
- style={{
- position: "relative",
- height: 32,
- flexShrink: 0,
- background: "var(--surface-2)",
- borderRadius: "var(--r-sm)",
- }}
- >
- {/* Dimmed, discarded head. Decoration only — see the tail below. */}
+ {/* The kept range is the timeline's clip card; the bare groove around it is the
+ discarded head and tail. Nothing else is painted over the grips. */}
+ <div ref={trackRef} data-testid="edit-clip-trim-track" className={styles.editClipTrack}>
<div
+ className={`${styles.editClipRange}${activeEdge ? ` ${styles.editClipRangeDragging}` : ""}`}
style={{
- position: "absolute",
- inset: 0,
- width: `${(draftStart / sourceDurationSec) * 100}%`,
- background: "var(--overlay-dark)",
- borderRadius: "var(--r-sm) 0 0 var(--r-sm)",
- pointerEvents: "none",
- }}
- />
- <div
- className={activeEdge ? styles.editClipRangeDragging : undefined}
- style={{
- position: "absolute",
- top: 0,
- bottom: 0,
left: `${(draftStart / sourceDurationSec) * 100}%`,
width: `${Math.max(0.5, (durationSec / sourceDurationSec) * 100)}%`,
- background: "var(--accent-wash)",
- border: "1px solid var(--accent)",
- borderRadius: "var(--r-sm)",
}}
>
<button
type="button"
+ className={styles.editClipGrip}
+ data-edge="start"
onPointerDown={(e) => startDrag("start", e)}
aria-label={t("editClipDialog.adjustStart")}
title={t("editClipDialog.adjustStart")}
- style={{
- position: "absolute",
- left: -6,
- top: 0,
- bottom: 0,
- width: 12,
- cursor: "ew-resize",
- background: "var(--accent)",
- border: 0,
- borderRadius: 3,
- padding: 0,
- }}
/>
<button
type="button"
+ className={styles.editClipGrip}
+ data-edge="end"
onPointerDown={(e) => startDrag("end", e)}
aria-label={t("editClipDialog.adjustEnd")}
title={t("editClipDialog.adjustEnd")}
- style={{
- position: "absolute",
- right: -6,
- top: 0,
- bottom: 0,
- width: 12,
- cursor: "ew-resize",
- background: "var(--accent)",
- border: 0,
- borderRadius: 3,
- padding: 0,
- }}
/>
</div>
- {/* Dimmed, discarded tail. It is painted after the selection, so it sits
- ABOVE the end handle that overhangs the selection's right edge by 6px:
- without pointer-events:none it swallows the grab as soon as the range is
- narrower than the handle, and a range dragged down to the 0.05s minimum
- can then only be recovered with Reset. */}
- <div
- style={{
- position: "absolute",
- top: 0,
- bottom: 0,
- right: 0,
- width: `${Math.max(0, ((sourceDurationSec - draftEnd) / sourceDurationSec) * 100)}%`,
- background: "var(--overlay-dark)",
- borderRadius: "0 var(--r-sm) var(--r-sm) 0",
- pointerEvents: "none",
- }}
- />
</div>
</div>
diff --git a/src/components/ai-edition/NewEditorShell.module.css b/src/components/ai-edition/NewEditorShell.module.css
index bbae1605c..958536ed2 100644
--- a/src/components/ai-edition/NewEditorShell.module.css
+++ b/src/components/ai-edition/NewEditorShell.module.css
@@ -2207,9 +2207,58 @@ textarea.control {
.starPromptDecline:hover { color: var(--fg); background: var(--surface-warm); }
/* ─── Edit Clip modal — draggable source-range track ────────────── */
+/* The pan/zoom bar's shape in the clip's colour: a faint groove for the whole source and,
+ on it, the timeline's clip card (.tlClip's candy recipe) for the range the trim keeps. */
+.editClipTrack {
+ position: relative;
+ height: 32px;
+ flex-shrink: 0;
+ border-radius: var(--r-sm);
+ background: color-mix(in oklab, var(--fg) 8%, transparent);
+}
+.editClipRange {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ box-sizing: border-box;
+ border-radius: var(--r-sm);
+ border: 1px solid transparent;
+ background: linear-gradient(180deg, color-mix(in oklab, var(--clip) 78%, white), var(--clip)) border-box;
+ box-shadow: 0 3px 10px color-mix(in oklab, var(--clip) var(--candy-glow), transparent);
+}
+/* The selected clip's halo ring, its gap in the card's colour. */
.editClipRangeDragging {
- box-shadow: 0 0 0 2px var(--accent-soft);
+ box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--clip);
+}
+/* A 12px grab area centred on each end, overhanging the range by 6px: a range dragged down
+ to its 0.05s minimum still leaves each grip a side of its own to grab. The notch in it sits
+ inside the card, like the pan/zoom bar's grips, in the card's dark ink. */
+.editClipGrip {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ width: 12px;
+ padding: 0;
+ border: 0;
+ background: transparent;
+ cursor: ew-resize;
+}
+.editClipGrip[data-edge="start"] { left: -6px; }
+.editClipGrip[data-edge="end"] { right: -6px; }
+.editClipGrip::before {
+ content: "";
+ position: absolute;
+ top: 50%;
+ width: 3px;
+ height: 14px;
+ margin-top: -7px;
+ border-radius: 2px;
+ background: rgb(11 18 32 / 0.55);
+ transition: transform var(--motion-fast) var(--ease);
}
+.editClipGrip[data-edge="start"]::before { left: 9px; }
+.editClipGrip[data-edge="end"]::before { right: 9px; }
+.editClipGrip:hover::before { transform: scaleY(1.25); }
.scrubBar {
flex: 1;