The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
feat(timeline): keyframe diamonds are larger, sit on the ruler's foot, ring when on, and open the Keyframes pane (#490)
Jareer2ddaca0d726f
diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rsindex 439ed848..834c6fb8 100644--- a/src/crates/concat/src/lib.rs+++ b/src/crates/concat/src/lib.rs@@ -758,24 +758,14 @@ fn start(project: Option<std::path::PathBuf>, smoke: bool) -> Result<(), slint::state.dock.remove_leaf(&from_path);}));editor.on_dock_add(on_dock!(|state, kind: PaneKind| {- let seats = state.dock_layout().seats;- let Some(biggest) = seats- .iter()- .max_by(|a, b| (a.width * a.height).total_cmp(&(b.width * b.height)))- else {- return;- };- let across = biggest.width >= SEAT_MIN_W * 2.0;- let down = biggest.height >= SEAT_MIN_H * 2.0;- let side = if biggest.width >= biggest.height && (across || !down) {- DockSide::Right- } else {- DockSide::Bottom- };- let Some(path) = state.dock.leaf_path(biggest.index.max(0) as usize) else {- return;- };- state.dock.split_leaf(&path, kind, side);+ add_pane(&mut state, kind);+ }));+ // Not on a phone or in the compact dock: there the two seats are the+ // monitor and the timeline, and a third would squeeze both.+ editor.on_key_mark_opened(on_dock!(|state| {+ if !state.compact && !state.meters.phone && !state.dock.contains(PaneKind::Keyframes) {+ add_pane(&mut state, PaneKind::Keyframes);+ }}));editor.on_dock_remove(on_dock!(|state, seat: i32| {let Some(path) = state.dock.leaf_path(seat.max(0) as usize) else {@@ -2500,6 +2490,29 @@ fn start(project: Option<std::path::PathBuf>, smoke: bool) -> Result<(), slint::leave(0);}+/// Adds a pane of `kind` beside the largest seat: to its right when that+/// seat is wide enough to halve across, else below it.+fn add_pane(state: &mut Studio, kind: PaneKind) {+ let seats = state.dock_layout().seats;+ let Some(biggest) = seats+ .iter()+ .max_by(|a, b| (a.width * a.height).total_cmp(&(b.width * b.height)))+ else {+ return;+ };+ let across = biggest.width >= SEAT_MIN_W * 2.0;+ let down = biggest.height >= SEAT_MIN_H * 2.0;+ let side = if biggest.width >= biggest.height && (across || !down) {+ DockSide::Right+ } else {+ DockSide::Bottom+ };+ let Some(path) = state.dock.leaf_path(biggest.index.max(0) as usize) else {+ return;+ };+ state.dock.split_leaf(&path, kind, side);+}+/// How long a quit waits for an export it cancelled to stop.const EXPORT_PATIENCE: std::time::Duration = std::time::Duration::from_secs(10);diff --git a/src/crates/concat/ui/editor.slint b/src/crates/concat/ui/editor.slintindex 6d3cf319..98fa31cf 100644--- a/src/crates/concat/ui/editor.slint+++ b/src/crates/concat/ui/editor.slint@@ -425,6 +425,9 @@ export global Editor {callback finger-lifted();/// A ruler diamond was dragged: every key at `from` moves to `to`.callback key-mark-moved(from: float, to: float);+ /// A ruler diamond was clicked: the Keyframes pane comes up if it is+ /// not in the workspace (#490).+ callback key-mark-opened();callback clip-pressed(id: string, additive: bool, edge: int);/// Save Video Frame As, from the picture's right-click menu: the/// frame at the playhead, at the output's size, as a PNG.diff --git a/src/crates/concat/ui/phone/editor.slint b/src/crates/concat/ui/phone/editor.slintindex 87f00f5e..80c1d28a 100644--- a/src/crates/concat/ui/phone/editor.slint+++ b/src/crates/concat/ui/phone/editor.slint@@ -748,6 +748,7 @@ export component PhoneEditor inherits Rectangle {finger-held => { Editor.finger-held(); }finger-lifted => { Editor.finger-lifted(); }key-mark-moved(from, to) => { Editor.key-mark-moved(from, to); }+ key-mark-opened => { Editor.key-mark-opened(); }hovered(seconds) => { Editor.hovered(seconds); }hover-ended => { Editor.hover-ended(); }floor-pressed => { Editor.blur(); }diff --git a/src/crates/concat/ui/timeline/lanes.slint b/src/crates/concat/ui/timeline/lanes.slintindex 60c0ffe1..22b01d85 100644--- a/src/crates/concat/ui/timeline/lanes.slint+++ b/src/crates/concat/ui/timeline/lanes.slint@@ -1149,6 +1149,8 @@ export component Lanes inherits Rectangle {callback scrubbed(seconds: float);/// A ruler diamond dragged from one instant to another.callback key-mark-moved(from: float, to: float);+ /// A ruler diamond was clicked: the Keyframes pane, if it is not up.+ callback key-mark-opened();/// The preview axis: the pointer is over the lanes at this instant,/// and then - a beat after it last was - it is not.callback hovered(seconds: float);@@ -1847,49 +1849,71 @@ export component Lanes inherits Rectangle {}}}+ }- // The selected clip's keys, as diamonds on the ruler's floor:- // clicked to go to one, dragged to move every key at that- // instant. Only while one clip is selected (#188).- for mark in root.key-marks: TouchArea {- property <float> drag-to: mark;- property <bool> dragging;-- x: root.at(self.dragging ? self.drag-to : mark) - 7px;- y: root.ruler-height - 14px;- width: 14px;- height: 14px;- mouse-cursor: pointer;+ // The selected clip's keys, as diamonds on the ruler's floor:+ // clicked to go to one, dragged to move every key at that instant.+ // Only while one clip is selected (#188). Centred on the ruler's+ // foot, half over the lanes, so the diamond sits on the line it+ // marks a moment of; large enough to see and to hit, a finger's+ // size under a finger. Over the ruler, not inside it: the ruler+ // clips, and cut each diamond's lower half off (#490).+ for mark in root.key-marks: key := TouchArea {+ property <float> drag-to: mark;+ property <bool> dragging;+ property <length> size: root.finger ? 32px : 22px;+ property <length> core: root.finger ? 16px : 14px;+ /// Pointed at, held, or the key the playhead is on: ringed,+ /// a clear gap and then the diamond's own colour around it.+ property <bool> on: self.has-hover || self.dragging+ || Math.abs(root.playhead - mark) * root.px-per-second < 1px;++ x: root.at(self.dragging ? self.drag-to : mark) - self.size / 2;+ y: root.ruler-height - self.size / 2;+ width: self.size;+ height: self.size;+ mouse-cursor: pointer;- Path {- x: 2px;- y: 2px;- width: 10px;- height: 10px;- viewbox-width: 10;- viewbox-height: 10;- commands: "M 5 0.75 L 9.25 5 L 5 9.25 L 0.75 5 Z";- fill: Theme.accent;- stroke: Theme.ruler;- stroke-width: 1px;- }+ if key.on: Path {+ x: (key.width - self.width) / 2;+ y: (key.height - self.height) / 2;+ width: key.core + 8px;+ height: key.core + 8px;+ viewbox-width: 10;+ viewbox-height: 10;+ commands: "M 5 0.5 L 9.5 5 L 5 9.5 L 0.5 5 Z";+ stroke: Theme.accent;+ stroke-width: 1.5px;+ }+ Path {+ x: (key.width - self.width) / 2;+ y: (key.height - self.height) / 2;+ width: key.core;+ height: key.core;+ viewbox-width: 10;+ viewbox-height: 10;+ commands: "M 5 0.75 L 9.25 5 L 5 9.25 L 0.75 5 Z";+ fill: Theme.accent;+ stroke: Theme.ruler;+ stroke-width: 1px;+ }- moved => {- if (self.pressed) {- self.dragging = true;- self.drag-to = Math.max(0,- root.seconds-at(root.at(mark) + self.mouse-x - self.pressed-x));- }+ moved => {+ if (self.pressed) {+ self.dragging = true;+ self.drag-to = Math.max(0,+ root.seconds-at(root.at(mark) + self.mouse-x - self.pressed-x));}- pointer-event(event) => {- if (event.kind == PointerEventKind.up || event.kind == PointerEventKind.cancel) {- if (self.dragging && Math.abs(self.drag-to - mark) > 0.0005) {- root.key-mark-moved(mark, self.drag-to);- } else if (event.kind == PointerEventKind.up) {- root.scrubbed(mark);- }- self.dragging = false;+ }+ pointer-event(event) => {+ if (event.kind == PointerEventKind.up || event.kind == PointerEventKind.cancel) {+ if (self.dragging && Math.abs(self.drag-to - mark) > 0.0005) {+ root.key-mark-moved(mark, self.drag-to);+ } else if (event.kind == PointerEventKind.up) {+ root.scrubbed(mark);+ root.key-mark-opened();}+ self.dragging = false;}}}diff --git a/src/crates/concat/ui/workspace/seat.slint b/src/crates/concat/ui/workspace/seat.slintindex d121c3fb..104da0b9 100644--- a/src/crates/concat/ui/workspace/seat.slint+++ b/src/crates/concat/ui/workspace/seat.slint@@ -431,6 +431,7 @@ export component Seat inherits Rectangle {lanes-resized(width) => { Editor.lanes-resized(width); }floor-pressed => { Editor.blur(); }key-mark-moved(from, to) => { Editor.key-mark-moved(from, to); }+ key-mark-opened => { Editor.key-mark-opened(); }scrubbed(seconds) => {Editor.blur();Editor.scrubbed(seconds);diff --git a/src/crates/concat/ui/workspace/timeline-pane.slint b/src/crates/concat/ui/workspace/timeline-pane.slintindex ebea21e3..f5a708f3 100644--- a/src/crates/concat/ui/workspace/timeline-pane.slint+++ b/src/crates/concat/ui/workspace/timeline-pane.slint@@ -103,6 +103,7 @@ export component TimelinePane inherits Rectangle {callback scrubbed(seconds: float);callback key-mark-moved(from: float, to: float);+ callback key-mark-opened();/// A press on an empty stretch of lane; see Editor.blur.callback floor-pressed();callback clip-pressed(id: string, additive: bool, edge: int);@@ -435,6 +436,7 @@ export component TimelinePane inherits Rectangle {scrubbed(seconds) => { root.scrubbed(seconds); }key-mark-moved(from, to) => { root.key-mark-moved(from, to); }+ key-mark-opened => { root.key-mark-opened(); }hovered(seconds) => { root.hovered(seconds); }hover-ended => { root.hover-ended(); }floor-pressed => { root.floor-pressed(); }