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): a scrollbar under the lanes says where the view is and drags it along the cut
Jareere8ad1d766f08
diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rsindex b013b606..054f4824 100644--- a/src/crates/concat/src/studio.rs+++ b/src/crates/concat/src/studio.rs@@ -6859,6 +6859,7 @@ impl Studio {sync(&models.key_marks, self.key_marks());editor.set_scroll_left(self.lanes.scroll_left);editor.set_seconds_per_pixel(self.lanes.seconds_per_pixel);+ editor.set_duration_seconds(self.duration());editor.set_frame_rate(self.frame_rate());editor.set_tool(self.lanes.tool);editor.set_snap(self.lanes.snap);diff --git a/src/crates/concat/ui/editor.slint b/src/crates/concat/ui/editor.slintindex 6cec58b4..6d6b6a46 100644--- a/src/crates/concat/ui/editor.slint+++ b/src/crates/concat/ui/editor.slint@@ -316,6 +316,8 @@ export global Editor {in-out property <float> frame-rate;in-out property <float> scroll-left;in-out property <float> seconds-per-pixel;+ /// Where the cut ends, in seconds: how far the lanes can scroll to.+ in-out property <float> duration-seconds;callback tab-selected(index: int);callback tab-renamed(index: int, name: string);diff --git a/src/crates/concat/ui/primitives/scrollbar.slint b/src/crates/concat/ui/primitives/scrollbar.slintindex c028985d..e5520088 100644--- a/src/crates/concat/ui/primitives/scrollbar.slint+++ b/src/crates/concat/ui/primitives/scrollbar.slint@@ -94,3 +94,74 @@ export component ThinScrollbar inherits Rectangle {}}}++// The same bar laid on its side: an 8px-tall gutter under something that+// scrolls across, the lanes of the timeline. One component per axis rather+// than an orientation switch, because every binding above names an axis+// and a switch would double each of them.+export component ThinHScrollbar inherits Rectangle {+ /// visible extent of the thing being scrolled+ in property <length> viewport;+ /// its full extent+ in property <length> content;+ /// how far along it is parked, 0..overflow+ in property <length> offset;+ in property <length> min-thumb: 24px;+ in property <float> max-thumb: 1.0;++ callback scrolled(offset: length);++ property <length> overflow: Math.max(0px, root.content - root.viewport);+ property <length> thumb-w: Math.max(root.min-thumb,+ Math.min(root.viewport * root.max-thumb,+ root.viewport * root.viewport / Math.max(root.content, 1px)));+ property <length> travel: Math.max(0px, root.viewport - root.thumb-w);+ property <length> thumb-x: root.overflow > 0px+ ? root.travel * Math.min(root.offset, root.overflow) / root.overflow+ : 0px;++ height: 8px;+ background: transparent;+ visible: root.overflow > 0px;++ thumb := Rectangle {+ x: root.thumb-x;+ y: 2px;+ width: root.thumb-w;+ height: 4px;+ border-radius: 2px;+ background: (grab.pressed || grab.has-hover) ? Theme.fg-dim : Theme.line-strong;++ animate background { duration: 100ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }+ }++ grab := TouchArea {+ property <length> origin;+ property <length> from;++ mouse-cursor: default;++ pointer-event(event) => {+ if (event.kind == PointerEventKind.down) {+ self.origin = self.absolute-position.x + self.mouse-x;+ if (self.mouse-x < root.thumb-x || self.mouse-x > root.thumb-x + root.thumb-w) {+ self.from = root.travel > 0px+ ? root.overflow * Math.max(0px, self.mouse-x - root.thumb-w / 2)+ / root.travel+ : 0px;+ root.scrolled(Math.max(0px, Math.min(root.overflow, self.from)));+ } else {+ self.from = root.offset;+ }+ }+ }++ moved => {+ if (root.travel > 0px) {+ root.scrolled(Math.max(0px, Math.min(root.overflow,+ self.from + (self.absolute-position.x + self.mouse-x - self.origin)+ * root.overflow / root.travel)));+ }+ }+ }+}diff --git a/src/crates/concat/ui/workspace/seat.slint b/src/crates/concat/ui/workspace/seat.slintindex e0af9c8a..ffc936f7 100644--- a/src/crates/concat/ui/workspace/seat.slint+++ b/src/crates/concat/ui/workspace/seat.slint@@ -374,6 +374,7 @@ export component Seat inherits Rectangle {frame-rate: Editor.frame-rate;scroll-left: Editor.scroll-left;seconds-per-pixel: Editor.seconds-per-pixel;+ duration-seconds: Editor.duration-seconds;tab-selected(index) => { Editor.tab-selected(index); }tab-renamed(index, name) => { Editor.tab-renamed(index, name); }diff --git a/src/crates/concat/ui/workspace/timeline-pane.slint b/src/crates/concat/ui/workspace/timeline-pane.slintindex 728c10c2..5d17bea3 100644--- a/src/crates/concat/ui/workspace/timeline-pane.slint+++ b/src/crates/concat/ui/workspace/timeline-pane.slint@@ -8,7 +8,7 @@ import { I18n } from "../i18n.slint";import { Glyph } from "../icons.slint";import { ContextMenu, MenuItemData, MenuMetrics, MenuRow } from "../primitives/context-menu.slint";import { HairlineSplitter } from "splitter.slint";-import { ThinScrollbar } from "../primitives/scrollbar.slint";+import { ThinHScrollbar, ThinScrollbar } from "../primitives/scrollbar.slint";import {ClipData, DropData, TimelineTabData, TimelineTool, TrackData, TrackSize,} from "../timeline/model.slint";@@ -88,6 +88,8 @@ export component TimelinePane inherits Rectangle {in property <float> frame-rate: 30;in property <float> scroll-left;in property <float> seconds-per-pixel: 0.05;+ /// Where the cut ends, in seconds; see the bar under the lanes.+ in property <float> duration-seconds;in-out property <length> track-scroll;callback scrubbed(seconds: float);@@ -448,6 +450,28 @@ export component TimelinePane inherits Rectangle {changed width => { root.lanes-resized(self.width / 1px); }init => { root.lanes-resized(self.width / 1px); }}++ // Across the bottom of the lanes: where the view is along the+ // cut, and a thumb to drag it there. Zoomed in, the lanes show+ // a slice of the cut and nothing said which slice or how to+ // get back to the start short of the wheel. The extent is the+ // cut's length with a screen's worth of room after it, and+ // never less than wherever the view has already been scrolled+ // to, so the thumb cannot vanish from under a drag.+ // https://github.com/jub0t/Concat/issues/237+ ThinHScrollbar {+ x: lanes.x;+ y: parent.height - self.height;+ width: lanes.width;+ viewport: lanes.width;+ content: Math.max(+ (root.duration-seconds / root.seconds-per-pixel) * 1px + lanes.width / 4,+ (root.scroll-left / root.seconds-per-pixel) * 1px + lanes.width);+ offset: (root.scroll-left / root.seconds-per-pixel) * 1px;+ scrolled(offset) => {+ root.scrolled(Math.max(0, (offset / 1px) * root.seconds-per-pixel));+ }+ }}}}