Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

feat: pan tool for the timeline

Domicae7060e42a38c
diff --git a/src/crates/concat/locales/de.json b/src/crates/concat/locales/de.json
index 6386ed08..9de5cb10 100644
--- a/src/crates/concat/locales/de.json
+++ b/src/crates/concat/locales/de.json
@@ -99,6 +99,7 @@
"Content": "Inhalt",
"CONTENTS": "INHALT",
"Contents": "Inhalt",
+ "Pan tool": "Pan tool",
"Timeline shortcuts": "Timeline shortcuts",
"Contrast": "Kontrast",
"Contrast Pop": "Kontrast-Pop",
diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.json
index 90a35357..e4c82954 100644
--- a/src/crates/concat/locales/en.json
+++ b/src/crates/concat/locales/en.json
@@ -444,6 +444,7 @@
"Output": "Output",
"Output · {0}": "Output · {0}",
"Pace": "Pace",
+ "Pan tool": "Pan tool",
"Paste": "Paste",
"Pause": "Pause",
"Peach": "Peach",
diff --git a/src/crates/concat/locales/es.json b/src/crates/concat/locales/es.json
index 1cbb1c0b..f85cdfbd 100644
--- a/src/crates/concat/locales/es.json
+++ b/src/crates/concat/locales/es.json
@@ -99,6 +99,7 @@
"Content": "Contenido",
"CONTENTS": "CONTENIDO",
"Contents": "Contenido",
+ "Pan tool": "Pan tool",
"Timeline shortcuts": "Timeline shortcuts",
"Contrast": "Contraste",
"Contrast Pop": "Contraste vivo",
diff --git a/src/crates/concat/locales/fr.json b/src/crates/concat/locales/fr.json
index 98235f56..174c5b1c 100644
--- a/src/crates/concat/locales/fr.json
+++ b/src/crates/concat/locales/fr.json
@@ -99,6 +99,7 @@
"Content": "Contenu",
"CONTENTS": "CONTENU",
"Contents": "Contenu",
+ "Pan tool": "Pan tool",
"Timeline shortcuts": "Timeline shortcuts",
"Contrast": "Contraste",
"Contrast Pop": "Contraste vif",
diff --git a/src/crates/concat/locales/hr.json b/src/crates/concat/locales/hr.json
index c41be62d..d4a9904f 100644
--- a/src/crates/concat/locales/hr.json
+++ b/src/crates/concat/locales/hr.json
@@ -125,6 +125,7 @@
"Content": "Sadržaj",
"CONTENTS": "SADRŽAJ",
"Contents": "Sadržaj",
+ "Pan tool": "Pan tool",
"Timeline shortcuts": "Prečaci na traci",
"Contrast": "Kontrast",
"Contrast Pop": "Kontrastni pop",
diff --git a/src/crates/concat/locales/it.json b/src/crates/concat/locales/it.json
index 1233ebc4..3314e21e 100644
--- a/src/crates/concat/locales/it.json
+++ b/src/crates/concat/locales/it.json
@@ -99,6 +99,7 @@
"Content": "Contenuto",
"CONTENTS": "CONTENUTO",
"Contents": "Contenuto",
+ "Pan tool": "Pan tool",
"Timeline shortcuts": "Timeline shortcuts",
"Contrast": "Contrasto",
"Contrast Pop": "Contrasto vivo",
diff --git a/src/crates/concat/locales/ja.json b/src/crates/concat/locales/ja.json
index 19855a7e..c3775cae 100644
--- a/src/crates/concat/locales/ja.json
+++ b/src/crates/concat/locales/ja.json
@@ -99,6 +99,7 @@
"Content": "内容",
"CONTENTS": "内容",
"Contents": "内容",
+ "Pan tool": "Pan tool",
"Timeline shortcuts": "Timeline shortcuts",
"Contrast": "コントラスト",
"Contrast Pop": "コントラストポップ",
diff --git a/src/crates/concat/locales/ko.json b/src/crates/concat/locales/ko.json
index 76512790..e5408bb8 100644
--- a/src/crates/concat/locales/ko.json
+++ b/src/crates/concat/locales/ko.json
@@ -99,6 +99,7 @@
"Content": "내용",
"CONTENTS": "내용",
"Contents": "내용",
+ "Pan tool": "Pan tool",
"Timeline shortcuts": "Timeline shortcuts",
"Contrast": "대비",
"Contrast Pop": "선명한 대비",
diff --git a/src/crates/concat/locales/pt-BR.json b/src/crates/concat/locales/pt-BR.json
index 357d65b3..2b14469c 100644
--- a/src/crates/concat/locales/pt-BR.json
+++ b/src/crates/concat/locales/pt-BR.json
@@ -99,6 +99,7 @@
"Content": "Conteúdo",
"CONTENTS": "CONTEÚDO",
"Contents": "Conteúdo",
+ "Pan tool": "Pan tool",
"Timeline shortcuts": "Timeline shortcuts",
"Contrast": "Contraste",
"Contrast Pop": "Contraste vivo",
diff --git a/src/crates/concat/locales/ru.json b/src/crates/concat/locales/ru.json
index 74b5d53f..215b55a1 100644
--- a/src/crates/concat/locales/ru.json
+++ b/src/crates/concat/locales/ru.json
@@ -99,6 +99,7 @@
"Content": "Содержание",
"CONTENTS": "СОДЕРЖИМОЕ",
"Contents": "Содержимое",
+ "Pan tool": "Pan tool",
"Timeline shortcuts": "Timeline shortcuts",
"Contrast": "Контраст",
"Contrast Pop": "Сочный контраст",
diff --git a/src/crates/concat/locales/tr.json b/src/crates/concat/locales/tr.json
index 14311ef4..27ab1a27 100644
--- a/src/crates/concat/locales/tr.json
+++ b/src/crates/concat/locales/tr.json
@@ -99,6 +99,7 @@
"Content": "İçerik",
"CONTENTS": "İÇERİK",
"Contents": "İçerik",
+ "Pan tool": "Pan tool",
"Timeline shortcuts": "Timeline shortcuts",
"Contrast": "Kontrast",
"Contrast Pop": "Canlı kontrast",
diff --git a/src/crates/concat/locales/zh-Hans.json b/src/crates/concat/locales/zh-Hans.json
index c881ec4a..39bf3c9e 100644
--- a/src/crates/concat/locales/zh-Hans.json
+++ b/src/crates/concat/locales/zh-Hans.json
@@ -99,6 +99,7 @@
"Content": "内容",
"CONTENTS": "内容",
"Contents": "内容",
+ "Pan tool": "Pan tool",
"Timeline shortcuts": "Timeline shortcuts",
"Contrast": "对比度",
"Contrast Pop": "对比增强",
diff --git a/src/crates/concat/locales/zh-TW.json b/src/crates/concat/locales/zh-TW.json
index 73118ecb..db1d4a87 100644
--- a/src/crates/concat/locales/zh-TW.json
+++ b/src/crates/concat/locales/zh-TW.json
@@ -125,6 +125,7 @@
"Content": "內容",
"CONTENTS": "內容",
"Contents": "內容",
+ "Pan tool": "Pan tool",
"Timeline shortcuts": "Timeline shortcuts",
"Contrast": "對比度",
"Contrast Pop": "強化對比",
diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rs
index c39cb5ee..02fddb64 100644
--- a/src/crates/concat/src/lib.rs
+++ b/src/crates/concat/src/lib.rs
@@ -598,6 +598,9 @@ pub fn run() -> Result<(), slint::PlatformError> {
editor.on_tool_changed(on_window!(|state, tool: TimelineTool| {
state.tool = tool;
}));
+ editor.on_pan_changed(on_window!(|state, on: bool| {
+ state.pan_mode = on;
+ }));
editor.on_snap_changed(on_window!(|state, snap: bool| {
state.snap = snap;
}));
diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rs
index ffae1655..ee693244 100644
--- a/src/crates/concat/src/studio.rs
+++ b/src/crates/concat/src/studio.rs
@@ -698,6 +698,8 @@ pub struct Studio {
pub seconds_per_pixel: f32,
pub tool: TimelineTool,
pub snap: bool,
+ /// Hand tool: wheel and drag pan time instead of scrolling the stack.
+ pub pan_mode: bool,
/// 0 Full, 1 Half, 2 Quarter of the output size, for the monitor.
pub quality: HashMap<String, usize>,
pub playing: bool,
@@ -1384,6 +1386,7 @@ impl Studio {
seconds_per_pixel: 0.05,
tool: TimelineTool::Select,
snap: true,
+ pan_mode: false,
quality: HashMap::new(),
playing: false,
transport: slint::Timer::default(),
@@ -6086,6 +6089,7 @@ impl Studio {
editor.set_frame_rate(self.frame_rate());
editor.set_tool(self.tool);
editor.set_snap(self.snap);
+ editor.set_pan_mode(self.pan_mode);
editor.set_selected_count(self.selection.len() as i32);
let (sound_selected, title_selected) = self.sound_tools();
editor.set_sound_selected(sound_selected);
diff --git a/src/crates/concat/ui/editor.slint b/src/crates/concat/ui/editor.slint
index 0c8d52c1..72bda95b 100644
--- a/src/crates/concat/ui/editor.slint
+++ b/src/crates/concat/ui/editor.slint
@@ -230,6 +230,8 @@ export global Editor {
in-out property <[ClipData]> clips;
in-out property <TimelineTool> tool;
in-out property <bool> snap;
+ /// Hand tool: wheel and drag pan time instead of scrolling the stack.
+ in-out property <bool> pan-mode: false;
in-out property <int> selected-count;
in-out property <string> merge-blocked-because;
/// What the selection offers the tray's sound and word tools: one clip
@@ -248,6 +250,7 @@ export global Editor {
callback tab-added();
callback tool-changed(tool: TimelineTool);
callback snap-changed(snap: bool);
+ callback pan-changed(on: bool);
callback split();
callback merge();
callback delete-selected();
diff --git a/src/crates/concat/ui/icons.slint b/src/crates/concat/ui/icons.slint
index 3007e920..118b341d 100644
--- a/src/crates/concat/ui/icons.slint
+++ b/src/crates/concat/ui/icons.slint
@@ -57,6 +57,7 @@ export enum Glyph {
flip-v,
keyframe,
reset,
+ hand,
/// the title strip's maximise: one square; restore is `copy`, two
maximize,
angle,
@@ -443,6 +444,13 @@ export component Icon inherits Rectangle {
+ " 2 2h3 M16 21h3a2 2 0 0 0 2-2v-3";
}
+ // lucide/hand
+ if root.glyph == Glyph.hand: Stroked {
+ size: root.size; tint: root.tint; weight: root.weight;
+ commands: "M18 11V6a2 2 0 0 0-4 0v5 M14 10V4a2 2 0 0 0-4 0v2"
+ + " M10 10.5V6a2 2 0 0 0-4 0v8 M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15";
+ }
+
// lucide/mouse-pointer-2
if root.glyph == Glyph.pointer: Stroked {
size: root.size; tint: root.tint; weight: root.weight;
diff --git a/src/crates/concat/ui/timeline/lanes.slint b/src/crates/concat/ui/timeline/lanes.slint
index b428f913..d0001073 100644
--- a/src/crates/concat/ui/timeline/lanes.slint
+++ b/src/crates/concat/ui/timeline/lanes.slint
@@ -496,6 +496,8 @@ export component Lanes inherits Rectangle {
in property <float> frame-rate: 30;
/// Seconds at the left edge of the lanes.
in property <float> scroll-left;
+ /// Hand tool: wheel and drag pan time instead of scrolling the stack.
+ in property <bool> pan-mode: false;
/// The zoom: seconds covered by one pixel.
in property <float> seconds-per-pixel: 0.05;
in property <length> track-scroll;
@@ -588,6 +590,12 @@ export component Lanes inherits Rectangle {
// up to here. A sibling would not see it.
wheel := TouchArea {
scroll-event(event) => {
+ // Hand tool: any wheel pans time, no modifier needed.
+ if (root.pan-mode) {
+ root.scrolled(Math.max(0, root.scroll-left
+ - event.delta-y / root.px-per-second));
+ return EventResult.accept;
+ }
if (event.modifiers.control || event.modifiers.meta) {
// Proportional to the gesture rather than a fixed notch per
// event. A trackpad sends a stream of small deltas, and a flat
@@ -956,5 +964,27 @@ export component Lanes inherits Rectangle {
}
}
}
+ // Hand tool: left-drag pans time. Sits at the top of the wheel's
+ // children so it takes the drag before any clip or the band does.
+ if root.pan-mode: pan := TouchArea {
+ mouse-cursor: pointer;
+ property <length> last-x: 0px;
+
+ pointer-event(event) => {
+ if (event.kind == PointerEventKind.down
+ && event.button == PointerEventButton.left) {
+ last-x = self.mouse-x;
+ }
+ if (event.kind == PointerEventKind.move && self.pressed) {
+ let delta = last-x - self.mouse-x;
+ root.scrolled(Math.max(0.0, root.scroll-left - delta / root.px-per-second));
+ last-x = self.mouse-x;
+ }
+ if (event.kind == PointerEventKind.up || event.kind == PointerEventKind.cancel) {
+ last-x = 0px;
+ }
+ }
+ }
+
}
}
diff --git a/src/crates/concat/ui/timeline/tray.slint b/src/crates/concat/ui/timeline/tray.slint
index 452a0046..58972aef 100644
--- a/src/crates/concat/ui/timeline/tray.slint
+++ b/src/crates/concat/ui/timeline/tray.slint
@@ -46,6 +46,7 @@ component Divider inherits Rectangle {
export component TimelineTray inherits Rectangle {
in property <TimelineTool> tool: TimelineTool.select;
in property <bool> snap: true;
+ in property <bool> pan-mode: false;
in property <int> selected-count;
/// Empty when the selection can be merged; otherwise why it cannot.
in property <string> merge-blocked-because;
@@ -58,6 +59,7 @@ export component TimelineTray inherits Rectangle {
callback tool-changed(tool: TimelineTool);
callback snap-changed(snap: bool);
+ callback pan-changed(on: bool);
callback split();
callback merge();
callback delete-selected();
@@ -152,6 +154,16 @@ export component TimelineTray inherits Rectangle {
Divider { }
+ IconButton {
+ glyph: Glyph.hand;
+ label: I18n.t("Pan tool");
+ icon-size: 16px;
+ checked: root.pan-mode;
+ clicked => { root.pan-changed(!root.pan-mode); }
+ }
+
+ Divider { }
+
IconButton {
glyph: Glyph.magnet;
label: I18n.t("Snap to edges");
diff --git a/src/crates/concat/ui/workspace/seat.slint b/src/crates/concat/ui/workspace/seat.slint
index 15b8719e..1afa0648 100644
--- a/src/crates/concat/ui/workspace/seat.slint
+++ b/src/crates/concat/ui/workspace/seat.slint
@@ -300,6 +300,7 @@ export component Seat inherits Rectangle {
clips: Editor.clips;
tool: Editor.tool;
snap: Editor.snap;
+ pan-mode: Editor.pan-mode;
selected-count: Editor.selected-count;
merge-blocked-because: Editor.merge-blocked-because;
sound-selected: Editor.sound-selected;
@@ -316,6 +317,7 @@ export component Seat inherits Rectangle {
tab-moved(from, to) => { Editor.tab-moved(from, to); }
tool-changed(tool) => { Editor.tool-changed(tool); }
snap-changed(snap) => { Editor.snap-changed(snap); }
+ pan-changed(on) => { Editor.pan-changed(on); }
split => { Editor.split(); }
merge => { Editor.merge(); }
delete-selected => { Editor.delete-selected(); }
diff --git a/src/crates/concat/ui/workspace/timeline-pane.slint b/src/crates/concat/ui/workspace/timeline-pane.slint
index b519081d..d18f6e75 100644
--- a/src/crates/concat/ui/workspace/timeline-pane.slint
+++ b/src/crates/concat/ui/workspace/timeline-pane.slint
@@ -36,6 +36,7 @@ export component TimelinePane inherits Rectangle {
// ── the tray ─────────────────────────────────────────────────────────
in property <TimelineTool> tool: TimelineTool.select;
in property <bool> snap: true;
+ in property <bool> pan-mode: false;
in property <int> selected-count;
in property <string> merge-blocked-because;
in property <bool> sound-selected;
@@ -43,6 +44,7 @@ export component TimelinePane inherits Rectangle {
callback tool-changed(tool: TimelineTool);
callback snap-changed(snap: bool);
+ callback pan-changed(on: bool);
callback split();
callback merge();
callback delete-selected();
@@ -175,6 +177,7 @@ export component TimelinePane inherits Rectangle {
TimelineTray {
tool: root.tool;
snap: root.snap;
+ pan-mode: root.pan-mode;
selected-count: root.selected-count;
merge-blocked-because: root.merge-blocked-because;
sound-selected: root.sound-selected;
@@ -183,6 +186,7 @@ export component TimelinePane inherits Rectangle {
tool-changed(tool) => { root.tool-changed(tool); }
snap-changed(snap) => { root.snap-changed(snap); }
+ pan-changed(on) => { root.pan-changed(on); }
split => { root.split(); }
merge => { root.merge(); }
delete-selected => { root.delete-selected(); }
@@ -252,6 +256,7 @@ export component TimelinePane inherits Rectangle {
seconds-per-pixel: root.seconds-per-pixel;
track-scroll: root.at;
ruler-height: root.ruler-height;
+ pan-mode: root.pan-mode;
scrubbed(seconds) => { root.scrubbed(seconds); }
floor-pressed => { root.floor-pressed(); }