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
A picture stretches along one axis
Jareer35ac2c23ce3e
diff --git a/TODO.MD b/TODO.MDindex 540628b9..975405f6 100644--- a/TODO.MD+++ b/TODO.MD@@ -27,6 +27,6 @@ DO NOT DELETE ANY OF THE TODOs, JUST MARK THEM DONE.- [x] ux qol: For Library>Media>{Videos,Images}: grabbing (mouse button down) any visual media should immediately show its "floating preview" and not wait for the first-drag, it makes the app look snappier and faster. _(The chip appears on the press and the drag takes over from it.)_- [x] ux: remove the "Concat" label from the right-click context menu that shows on timelines. _(That row was the clip's name; gone.)_- [x] fix: a lot of inputs have a bug where when they are focused and you click somewhere else to de-focus, it does not work. fix that. _(Any press on a lane, the stage, a clip, the ruler or the bin's floor takes focus back.)_-- [ ] feature: right now visual-media (images, videos) can only be scaled (resized on both dimensions propotionally). We need to add a feature to allow single-axis scale/stretch as well using the 2d bounding box in preview.+- [x] feature: right now visual-media (images, videos) can only be scaled (resized on both dimensions propotionally). We need to add a feature to allow single-axis scale/stretch as well using the 2d bounding box in preview. _(Edge grips on the stage pull one axis; Width and Height under Video › Transform do the same by number. Saved as stretchX / stretchY; exports and both compositors follow it.)_- [x] feature: add a "resize/scale" snapping too along with translate snapping. _(Scaling from a corner pulls the picture's edges to the frame's lines and other pictures' edges, with the same guides a move draws.)_-- [ ] we need to add a "Remove BG" toggle feature in Inspector for Images and Videos, enabling this removes the media's background like how CapCut does (CapCut has different options like Auto Removal, Custom Removal, Chroma key, etc.). Custom removal gives the user Smart Brush, Brush, Smart Eraser, Eraser to outline the target.\ No newline at end of file+- [ ] we need to add a "Remove BG" toggle feature in Inspector for Images and Videos, enabling this removes the media's background like how CapCut does (CapCut has different options like Auto Removal, Custom Removal, Chroma key, etc.). Custom removal gives the user Smart Brush, Brush, Smart Eraser, Eraser to outline the target. _(Video › Basic › Remove background: off, green screen or blue screen, with similarity and softness. Automatic and brush removal are next, on a person mask.)_\ No newline at end of filediff --git a/engine/crates/concat-core/src/animate.rs b/engine/crates/concat-core/src/animate.rsindex ad3bf6e2..360ba0f6 100644--- a/engine/crates/concat-core/src/animate.rs+++ b/engine/crates/concat-core/src/animate.rs@@ -142,6 +142,8 @@ impl Animation {offset_x: base.offset_x + self.offset_x.value_at(x, 0.0),offset_y: base.offset_y + self.offset_y.value_at(x, 0.0),rotation: base.rotation + self.rotation.value_at(x, 0.0),+ stretch_x: base.stretch_x,+ stretch_y: base.stretch_y,}}@@ -198,6 +200,8 @@ mod tests {offset_x: 0.1,offset_y: -0.2,rotation: 10.0,+ stretch_x: 1.0,+ stretch_y: 1.0,};let mid = animation.transform_at(base, 0.5);assert!((mid.scale - 1.5).abs() < 1e-12);diff --git a/engine/crates/concat-core/src/timeline.rs b/engine/crates/concat-core/src/timeline.rsindex 667cf042..6d39987f 100644--- a/engine/crates/concat-core/src/timeline.rs+++ b/engine/crates/concat-core/src/timeline.rs@@ -172,6 +172,11 @@ pub struct Transform {pub offset_y: f64,/// Clockwise rotation about the picture's centre, in degrees.pub rotation: f64,+ /// A multiplier on the fitted width beyond `scale`, for a picture+ /// pulled wider or narrower than its aspect. 1 keeps the aspect.+ pub stretch_x: f64,+ /// The same for the height.+ pub stretch_y: f64,}impl Transform {@@ -181,6 +186,8 @@ impl Transform {offset_x: 0.0,offset_y: 0.0,rotation: 0.0,+ stretch_x: 1.0,+ stretch_y: 1.0,};/// True when applying this transform would change nothing.diff --git a/engine/crates/concat-export/src/flatten.rs b/engine/crates/concat-export/src/flatten.rsindex cc251019..6fc1d783 100644--- a/engine/crates/concat-export/src/flatten.rs+++ b/engine/crates/concat-export/src/flatten.rs@@ -71,6 +71,8 @@ pub fn flatten_timeline(project: &Project, timeline_id: Option<&str>) -> Vec<Expoffset_x: 0.0,offset_y: 0.0,rotation: 0.0,+ stretch_x: 1.0,+ stretch_y: 1.0,opacity: clip.opacity,video_filter_chain: video_effect_chain(&clip.video_effects),transition: None,@@ -127,6 +129,8 @@ pub fn flatten_timeline(project: &Project, timeline_id: Option<&str>) -> Vec<Expoffset_x: clip.offset_x,offset_y: clip.offset_y,rotation: clip.rotation,+ stretch_x: clip.stretch_x,+ stretch_y: clip.stretch_y,opacity: clip.opacity,video_filter_chain: video_effect_chain(&clip.video_effects),// Passed through unconditionally: `resolve_transitions` isdiff --git a/engine/crates/concat-export/src/lib.rs b/engine/crates/concat-export/src/lib.rsindex 55f60f89..687637ac 100644--- a/engine/crates/concat-export/src/lib.rs+++ b/engine/crates/concat-export/src/lib.rs@@ -148,6 +148,13 @@ pub struct ExportClip {/// Clockwise rotation in degrees.#[serde(default)]pub rotation: f64,+ /// Multipliers on the fitted width and height beyond `scale`, for a+ /// picture pulled along one axis; 1 keeps the aspect.+ #[serde(default = "unity")]+ pub stretch_x: f64,+ /// The height's half of `stretch_x`'s pair.+ #[serde(default = "unity")]+ pub stretch_y: f64,/// Blend strength over the layers beneath, 1 being solid. Defaulted for/// requests from a UI that predates it.#[serde(default = "unity")]@@ -593,6 +600,8 @@ fn place_layer<'a>(rotation: transform.rotation.to_radians() as f32,translate_x: (transform.offset_x * f64::from(width)) as f32,translate_y: (transform.offset_y * f64::from(height)) as f32,+ stretch_x: transform.stretch_x as f32,+ stretch_y: transform.stretch_y as f32,}};Layer::new(frame)@@ -1006,6 +1015,8 @@ fn build_timeline(offset_x: clip.offset_x,offset_y: clip.offset_y,rotation: clip.rotation,+ stretch_x: clip.stretch_x,+ stretch_y: clip.stretch_y,};engine_clip.opacity = clip.opacity.clamp(0.0, 1.0) as f32;// Quantised like every other time: the ramp must land on the same@@ -1551,6 +1562,8 @@ mod tests {offset_x: 0.0,offset_y: 0.0,rotation: 0.0,+ stretch_x: 1.0,+ stretch_y: 1.0,opacity: 1.0,video_filter_chain: String::new(),transition: None,diff --git a/engine/crates/concat-host/src/titles.rs b/engine/crates/concat-host/src/titles.rsindex b8d281db..5cf1f73b 100644--- a/engine/crates/concat-host/src/titles.rs+++ b/engine/crates/concat-host/src/titles.rs@@ -123,6 +123,8 @@ impl Titles {offset_x: clip.offset_x,offset_y: clip.offset_y,rotation: clip.rotation,+ stretch_x: clip.stretch_x,+ stretch_y: clip.stretch_y,// The style's own opacity multiplies the clip's: a// half-transparent title fades to half, not to solid.opacity: (clip.opacity * text.opacity).clamp(0.0, 1.0),diff --git a/engine/crates/concat-project/src/commands.rs b/engine/crates/concat-project/src/commands.rsindex 186612e9..c112b2cd 100644--- a/engine/crates/concat-project/src/commands.rs+++ b/engine/crates/concat-project/src/commands.rs@@ -30,6 +30,10 @@ const MIN_SPEED: f64 = 0.0625;const MAX_SPEED: f64 = 16.0;const MIN_SCALE: f64 = 0.05;const MAX_SCALE: f64 = 8.0;+/// How far a picture may be pulled along one axis: a tenth to ten times+/// its fitted extent, which covers every squash and every banner.+pub(crate) const MIN_STRETCH: f64 = 0.1;+pub(crate) const MAX_STRETCH: f64 = 10.0;const MAX_OFFSET: f64 = 3.0;/// How far apart two clips may sit and still count as touching, in seconds.const JOIN_EPSILON: f64 = 1e-6;@@ -373,6 +377,12 @@ pub enum Command {/// New rotation in degrees, wrapped into (-180, 180] so a full drag/// never accumulates turns.rotation: Option<f64>,+ /// New width multiplier beyond the scale, clamped into 0.1..=10.+ #[serde(default)]+ stretch_x: Option<f64>,+ /// New height multiplier, on the same terms.+ #[serde(default)]+ stretch_y: Option<f64>,},/// Pulls a video clip's sound out into its own audio clip on a free/// lane (minting one if none is free), muting the video and moving its@@ -589,6 +599,8 @@ fn default_clip(id: String, track_id: String, media: &MediaItem, start: f64) ->offset_x: 0.0,offset_y: 0.0,rotation: 0.0,+ stretch_x: 1.0,+ stretch_y: 1.0,opacity: 1.0,speed: 1.0,preserve_pitch: true,@@ -930,6 +942,8 @@ pub fn apply(offset_x: 0.0,offset_y: offset_y.unwrap_or(0.0).clamp(-MAX_OFFSET, MAX_OFFSET),rotation: 0.0,+ stretch_x: 1.0,+ stretch_y: 1.0,opacity: 1.0,speed: 1.0,preserve_pitch: true,@@ -994,6 +1008,8 @@ pub fn apply(offset_x: 0.0,offset_y: 0.0,rotation: 0.0,+ stretch_x: 1.0,+ stretch_y: 1.0,opacity: 1.0,speed: 1.0,preserve_pitch: true,@@ -1318,6 +1334,8 @@ pub fn apply(offset_x,offset_y,rotation,+ stretch_x,+ stretch_y,} => {let timeline = project.active_mut();let Some(clip) = timeline.clip_mut(&clip_id) else {@@ -1339,6 +1357,12 @@ pub fn apply(let next = if wrapped == -180.0 { 180.0 } else { wrapped };applied |= assign(&mut clip.rotation, next);}+ if let Some(stretch) = stretch_x {+ applied |= assign(&mut clip.stretch_x, stretch.clamp(MIN_STRETCH, MAX_STRETCH));+ }+ if let Some(stretch) = stretch_y {+ applied |= assign(&mut clip.stretch_y, stretch.clamp(MIN_STRETCH, MAX_STRETCH));+ }Ok(Outcome {created_id: None,applied,diff --git a/engine/crates/concat-project/src/doc.rs b/engine/crates/concat-project/src/doc.rsindex fe2bdaaf..7f8287bb 100644--- a/engine/crates/concat-project/src/doc.rs+++ b/engine/crates/concat-project/src/doc.rs@@ -20,6 +20,7 @@use serde_json::{Map, Value, json};+use crate::commands::{MAX_STRETCH, MIN_STRETCH};use crate::model::{AppliedFilter, Clip, ClipAnimation, ClipKind, Crop, CustomFont, MediaItem, MediaKind, Project,SpeedPoint, TextAlign, TextStyle, Timeline, Track, Transition,@@ -213,6 +214,8 @@ fn read_clips(raw: Option<&Value>, tracks: &[Track], media: &[MediaItem]) -> Vecoffset_x: number(entry.get("offsetX"), 0.0),offset_y: number(entry.get("offsetY"), 0.0),rotation: number(entry.get("rotation"), 0.0),+ stretch_x: number(entry.get("stretchX"), 1.0).clamp(MIN_STRETCH, MAX_STRETCH),+ stretch_y: number(entry.get("stretchY"), 1.0).clamp(MIN_STRETCH, MAX_STRETCH),// Clamped: a hand-edited 2 would export differently from how// the preview clamps it on screen.opacity: number(entry.get("opacity"), 1.0).clamp(0.0, 1.0),diff --git a/engine/crates/concat-project/src/lib.rs b/engine/crates/concat-project/src/lib.rsindex 57b5dcbf..07bad2a9 100644--- a/engine/crates/concat-project/src/lib.rs+++ b/engine/crates/concat-project/src/lib.rs@@ -851,6 +851,8 @@ mod tests {offset_x: Some(f64::from(step) / 1000.0 + 0.001),offset_y: None,rotation: None,+ stretch_x: None,+ stretch_y: None,}).expect("applies");}@@ -1185,6 +1187,8 @@ mod tests {offset_x: None,offset_y: None,rotation: Some(sent),+ stretch_x: None,+ stretch_y: None,}).expect("sets");assert_eq!(@@ -1392,6 +1396,8 @@ mod tests {offset_x: None,offset_y: Some(-0.25),rotation: Some(90.0),+ stretch_x: None,+ stretch_y: None,},Command::DetachAudio {clip_id: "c1".to_owned(),diff --git a/engine/crates/concat-project/src/model.rs b/engine/crates/concat-project/src/model.rsindex 969f8e3d..59e7ae3a 100644--- a/engine/crates/concat-project/src/model.rs+++ b/engine/crates/concat-project/src/model.rs@@ -97,6 +97,14 @@ pub struct MediaItem {pub placeholder: bool,}+fn unity() -> f64 {+ 1.0+}++fn is_unity(value: &f64) -> bool {+ *value == 1.0+}+fn is_false(value: &bool) -> bool {!value}@@ -340,6 +348,13 @@ pub struct Clip {pub offset_y: f64,/// Clockwise rotation in degrees, about the picture's centre.pub rotation: f64,+ /// A multiplier on the fitted width beyond `scale`, for a picture+ /// pulled wider or narrower than its aspect; 1 keeps the aspect.+ #[serde(default = "unity", skip_serializing_if = "is_unity")]+ pub stretch_x: f64,+ /// The same for the height.+ #[serde(default = "unity", skip_serializing_if = "is_unity")]+ pub stretch_y: f64,/// Blend strength over whatever is beneath, in 0..1.pub opacity: f64,/// Playback rate. 1 is normal. With a curve set this is the curve'sdiff --git a/engine/crates/concat-render/src/compositor.rs b/engine/crates/concat-render/src/compositor.rsindex a7c2406b..d6cedb90 100644--- a/engine/crates/concat-render/src/compositor.rs+++ b/engine/crates/concat-render/src/compositor.rs@@ -28,6 +28,10 @@ pub struct Placement {pub translate_x: f32,/// Vertical offset of the layer's centre from its base position, pixels.pub translate_y: f32,+ /// A multiplier on the width beyond `scale`; 1 keeps the aspect.+ pub stretch_x: f32,+ /// The same for the height.+ pub stretch_y: f32,}impl Placement {@@ -37,6 +41,8 @@ impl Placement {rotation: 0.0,translate_x: 0.0,translate_y: 0.0,+ stretch_x: 1.0,+ stretch_y: 1.0,};/// True when applying this placement would change nothing.@@ -205,7 +211,9 @@ fn mix(blend: Blend, over: f32, under: f32, alpha: f32) -> f32 {fn blend_transformed(output: &mut Frame, layer: &Layer<'_>, opacity: f32) {let source = layer.frame;let placement = layer.placement;- let scale = placement.scale.max(1e-6);+ // One factor per axis: the scale, and the stretch that axis carries.+ let scale_x = (placement.scale * placement.stretch_x).max(1e-6);+ let scale_y = (placement.scale * placement.stretch_y).max(1e-6);let (sin, cos) = placement.rotation.sin_cos();let src_w = source.width() as f32;@@ -215,8 +223,8 @@ fn blend_transformed(output: &mut Frame, layer: &Layer<'_>, opacity: f32) {let centre_y = layer.y as f32 + src_h / 2.0 + placement.translate_y;// Bounding box of the transformed rectangle, clamped to the output.- let half_w = src_w * scale / 2.0;- let half_h = src_h * scale / 2.0;+ let half_w = src_w * scale_x / 2.0;+ let half_h = src_h * scale_y / 2.0;let reach_x = (half_w * cos.abs()) + (half_h * sin.abs());let reach_y = (half_w * sin.abs()) + (half_h * cos.abs());@@ -239,8 +247,8 @@ fn blend_transformed(output: &mut Frame, layer: &Layer<'_>, opacity: f32) {// untranslate, unrotate, unscale, then re-origin at the corner.let dx = (x as f32 + 0.5) - centre_x;let dy = (y as f32 + 0.5) - centre_y;- let sx = (dx * cos + dy * sin) / scale + src_w / 2.0 - 0.5;- let sy = (-dx * sin + dy * cos) / scale + src_h / 2.0 - 0.5;+ let sx = (dx * cos + dy * sin) / scale_x + src_w / 2.0 - 0.5;+ let sy = (-dx * sin + dy * cos) / scale_y + src_h / 2.0 - 0.5;if sx < -0.5 || sy < -0.5 || sx > src_w - 0.5 || sy > src_h - 0.5 {continue;diff --git a/engine/crates/concat-render/src/gpu.rs b/engine/crates/concat-render/src/gpu.rsindex f5959016..32afa47c 100644--- a/engine/crates/concat-render/src/gpu.rs+++ b/engine/crates/concat-render/src/gpu.rs@@ -811,13 +811,15 @@ impl WgpuCompositor {let centre_x = layer.x as f32 + width / 2.0 + placement.translate_x;let centre_y = layer.y as f32 + height / 2.0 + placement.translate_y;let (sin, cos) = placement.rotation.sin_cos();- let scale = placement.scale.max(1e-6);+ let scale_x = (placement.scale * placement.stretch_x).max(1e-6);+ let scale_y = (placement.scale * placement.stretch_y).max(1e-6);let corner = |sx: f32, sy: f32, u: f32, v: f32| {- // Source-space offset from centre, scaled, then rotated clockwise- // in y-down coordinates - the forward form of the CPU inverse map.- let dx = sx * width / 2.0 * scale;- let dy = sy * height / 2.0 * scale;+ // Source-space offset from centre, scaled per axis, then rotated+ // clockwise in y-down coordinates - the forward form of the CPU+ // inverse map.+ let dx = sx * width / 2.0 * scale_x;+ let dy = sy * height / 2.0 * scale_y;let px = centre_x + dx * cos - dy * sin;let py = centre_y + dx * sin + dy * cos;Vertex {diff --git a/engine/crates/concat/src/studio.rs b/engine/crates/concat/src/studio.rsindex d9c9541f..b01ec738 100644--- a/engine/crates/concat/src/studio.rs+++ b/engine/crates/concat/src/studio.rs@@ -362,6 +362,21 @@ pub enum Gesture {/// an edge's position at any later scale is one multiplication.half: (f64, f64),},+ /// An edge grip pulls one axis: the picture's stretch across or down,+ /// about its centre, measured along the box's own axis so a turned+ /// picture stretches along itself and not along the frame.+ StageStretch {+ clip: String,+ /// The left and right edges pull the width; the others the height.+ across: bool,+ stretch: f64,+ centre: (f64, f64),+ /// The pointer's distance from the centre along the axis at the+ /// press, in frame pixels.+ from: f64,+ /// The picture's turn, to project the pointer onto its axes.+ rotation: f64,+ },/// The rotation grip dragged: the picture turns by the angle the pointer/// has swept about the centre since the press.StageRotate {@@ -2242,7 +2257,8 @@ impl Studio {Gesture::None| Gesture::StageMove { .. }| Gesture::StageScale { .. }- | Gesture::StageRotate { .. } => {}+ | Gesture::StageRotate { .. }+ | Gesture::StageStretch { .. } => {}}self.gesture = gesture;}@@ -2302,7 +2318,8 @@ impl Studio {// Not a lane gesture: hand it back untouched, echo and all.other @ (Gesture::StageMove { .. }| Gesture::StageScale { .. }- | Gesture::StageRotate { .. }) => {+ | Gesture::StageRotate { .. }+ | Gesture::StageStretch { .. }) => {self.gesture = other;}}@@ -2324,6 +2341,8 @@ impl Studio {let text = clip.text.get_or_insert_with(TextStyle::default);match field {ClipField::Scale => clip.scale = value.clamp(0.05, 8.0),+ ClipField::StretchX => clip.stretch_x = value.clamp(0.1, 10.0),+ ClipField::StretchY => clip.stretch_y = value.clamp(0.1, 10.0),ClipField::OffsetX => clip.offset_x = value.clamp(-1.0, 1.0),ClipField::OffsetY => clip.offset_y = value.clamp(-1.0, 1.0),ClipField::Rotation => clip.rotation = value.clamp(-180.0, 180.0),@@ -2506,6 +2525,8 @@ impl Studio {|| after.offset_x != before.offset_x|| after.offset_y != before.offset_y|| after.rotation != before.rotation+ || after.stretch_x != before.stretch_x+ || after.stretch_y != before.stretch_y{commands.push(Command::SetClipTransform {clip_id: id.clone(),@@ -2513,6 +2534,8 @@ impl Studio {offset_x: Some(after.offset_x),offset_y: Some(after.offset_y),rotation: Some(after.rotation),+ stretch_x: Some(after.stretch_x),+ stretch_y: Some(after.stretch_y),});}if after.speed_curve != before.speed_curve {@@ -2702,6 +2725,8 @@ impl Studio {None => (clip.scale, clip.scale),}};+ // Then pulled along each axis, as the compositor pulls it.+ let (w, h) = (w * clip.stretch_x, h * clip.stretch_y);// The placement at the playhead: the clip's own, moved by its// animation, so the box follows a slide or a spin.let base = concat_core::timeline::Transform {@@ -2709,6 +2734,8 @@ impl Studio {offset_x: clip.offset_x,offset_y: clip.offset_y,rotation: clip.rotation,+ stretch_x: clip.stretch_x,+ stretch_y: clip.stretch_y,};let placed = match concat_project::animation::animation_of(clip) {Some(animation) if clip.duration > 0.0 => {@@ -2877,6 +2904,28 @@ impl Studio {centre,from: dy.atan2(dx),}+ } else if grip >= 5 {+ // 5 top, 6 right, 7 bottom, 8 left: the pointer's offset from+ // the centre, turned back into the box's own frame.+ let across = grip == 6 || grip == 8;+ let (sin, cos) = clip.rotation.to_radians().sin_cos();+ let along = if across {+ dx * cos + dy * sin+ } else {+ -dx * sin + dy * cos+ };+ Gesture::StageStretch {+ clip: id.to_owned(),+ across,+ stretch: if across {+ clip.stretch_x+ } else {+ clip.stretch_y+ },+ centre,+ from: along.abs().max(1.0),+ rotation: clip.rotation,+ }} else {Gesture::StageScale {clip: id.to_owned(),@@ -3035,6 +3084,34 @@ impl Studio {clip.scale = next.clamp(0.05, 8.0);}}+ Gesture::StageStretch {+ clip,+ across,+ stretch,+ centre,+ from,+ rotation,+ } => {+ let dx = x * f64::from(width) - centre.0;+ let dy = y * f64::from(height) - centre.1;+ let (sin, cos) = rotation.to_radians().sin_cos();+ let along = if *across {+ dx * cos + dy * sin+ } else {+ -dx * sin + dy * cos+ };+ let mut next = stretch * along.abs() / from;+ if snap {+ next = (next * 20.0).round() / 20.0;+ }+ if let Some(clip) = self.echo_clip_mut(clip) {+ if *across {+ clip.stretch_x = next.clamp(0.1, 10.0);+ } else {+ clip.stretch_y = next.clamp(0.1, 10.0);+ }+ }+ }Gesture::StageRotate {clip,rotation,@@ -3073,7 +3150,9 @@ impl Studio {Gesture::StageMove { origins, .. } => {origins.into_iter().map(|origin| origin.clip).collect()}- Gesture::StageScale { clip, .. } | Gesture::StageRotate { clip, .. } => vec![clip],+ Gesture::StageScale { clip, .. }+ | Gesture::StageRotate { clip, .. }+ | Gesture::StageStretch { clip, .. } => vec![clip],other => {// Not ours to end; a lane gesture is still live.self.gesture = other;@@ -3097,6 +3176,8 @@ impl Studio {|| after.offset_x != before.offset_x|| after.offset_y != before.offset_y|| after.rotation != before.rotation+ || after.stretch_x != before.stretch_x+ || after.stretch_y != before.stretch_y{commands.push(Command::SetClipTransform {clip_id: id,@@ -3104,6 +3185,8 @@ impl Studio {offset_x: Some(after.offset_x),offset_y: Some(after.offset_y),rotation: Some(after.rotation),+ stretch_x: Some(after.stretch_x),+ stretch_y: Some(after.stretch_y),});}}@@ -3862,7 +3945,11 @@ impl Studio {self.speech.message = "Download a voice model in Settings › Speech first".to_owned();return;};- let Some(voice) = self.speakers.get(self.speech.voice).map(|speaker| speaker.id) else {+ let Some(voice) = self+ .speakers+ .get(self.speech.voice)+ .map(|speaker| speaker.id)+ else {self.speech.message = "No voice to read with".to_owned();return;};@@ -4280,6 +4367,8 @@ impl Studio {offset_x: clip.offset_x as f32,offset_y: clip.offset_y as f32,rotation: clip.rotation as f32,+ stretch_x: clip.stretch_x as f32,+ stretch_y: clip.stretch_y as f32,opacity: clip.opacity as f32,volume: clip.volume as f32,speed: clip.speed as f32,diff --git a/engine/crates/concat/ui/editor.slint b/engine/crates/concat/ui/editor.slintindex f7ed649d..3f9388c1 100644--- a/engine/crates/concat/ui/editor.slint+++ b/engine/crates/concat/ui/editor.slint@@ -170,7 +170,8 @@ export global Editor {/// selection — the way `clip-pressed` does for the lanes.callback stage-pressed(x: float, y: float, additive: bool);/// A press on one of a selected box's grips: 0..3 are its corners,- /// clockwise from top-left, and 4 is the rotation handle above it.+ /// clockwise from top-left, 4 is the rotation handle above it, and+ /// 5..8 are the edges' midpoints, top, right, bottom, left.callback stage-grip-pressed(id: string, grip: int, x: float, y: float);/// The pointer moved with a stage gesture live. `snap` is shift: an axis/// for a move, steps for a scale, fifteen degrees for a turn.diff --git a/engine/crates/concat/ui/inspector/clip-inspector.slint b/engine/crates/concat/ui/inspector/clip-inspector.slintindex 768e0bc3..497fc736 100644--- a/engine/crates/concat/ui/inspector/clip-inspector.slint+++ b/engine/crates/concat/ui/inspector/clip-inspector.slint@@ -359,6 +359,8 @@ export component VideoPanel inherits VerticalLayout {property <float> offset-x;property <float> offset-y;property <float> rotation;+ property <float> stretch-x;+ property <float> stretch-y;property <float> alpha;property <float> crop-left;property <float> crop-top;@@ -370,6 +372,8 @@ export component VideoPanel inherits VerticalLayout {root.offset-x = root.selected.offset-x;root.offset-y = root.selected.offset-y;root.rotation = root.selected.rotation;+ root.stretch-x = root.selected.stretch-x;+ root.stretch-y = root.selected.stretch-y;root.alpha = root.selected.opacity;root.crop-left = root.selected.crop-left;root.crop-top = root.selected.crop-top;@@ -402,7 +406,9 @@ export component VideoPanel inherits VerticalLayout {if root.transform-help: Note {text: "Scale and position are fractions of the output frame, so a"+ " clip keeps its framing if the project is re-sized. The"- + " same numbers move with the box on the monitor.";+ + " same numbers move with the box on the monitor. Width and"+ + " height pull one axis beyond the scale; the edge grips on"+ + " the monitor do the same.";}Param {@@ -445,6 +451,26 @@ export component VideoPanel inherits VerticalLayout {fmt: ParamFormat.degrees;changed(v) => { root.set(ClipField.rotation, v); root.commit(); }}+ Param {+ label: "Width";+ value <=> root.stretch-x;+ minimum: 0.1;+ maximum: 4;+ step: 0.01;+ default-value: 1;+ fmt: ParamFormat.fraction;+ changed(v) => { root.set(ClipField.stretch-x, v); root.commit(); }+ }+ Param {+ label: "Height";+ value <=> root.stretch-y;+ minimum: 0.1;+ maximum: 4;+ step: 0.01;+ default-value: 1;+ fmt: ParamFormat.fraction;+ changed(v) => { root.set(ClipField.stretch-y, v); root.commit(); }+ }}}diff --git a/engine/crates/concat/ui/timeline/model.slint b/engine/crates/concat/ui/timeline/model.slintindex 62291ef9..11ed4038 100644--- a/engine/crates/concat/ui/timeline/model.slint+++ b/engine/crates/concat/ui/timeline/model.slint@@ -150,7 +150,7 @@ export enum TextAlignment { left, center, right }/// and alignment as its ordinal, which keeps this to two callbacks instead of/// one per control.export enum ClipField {- scale, offset-x, offset-y, rotation, opacity,+ scale, offset-x, offset-y, rotation, stretch-x, stretch-y, opacity,volume, speed, preserve-pitch, speed-curve, reverse, fade-in, fade-out,anim-in, anim-out, anim-combo, anim-in-duration, anim-out-duration,flip-h, flip-v, blend, crop-left, crop-top, crop-right, crop-bottom,@@ -183,6 +183,9 @@ export struct SelectedClipData {offset-x: float,offset-y: float,rotation: float,+ /// the width and height pulled beyond the scale; 1 keeps the aspect+ stretch-x: float,+ stretch-y: float,opacity: float,// sound — everything but a stilldiff --git a/engine/crates/concat/ui/workspace/preview-pane.slint b/engine/crates/concat/ui/workspace/preview-pane.slintindex 34e7c140..1b928f4a 100644--- a/engine/crates/concat/ui/workspace/preview-pane.slint+++ b/engine/crates/concat/ui/workspace/preview-pane.slint@@ -406,6 +406,45 @@ component StageItem inherits Rectangle {released => { root.released(); }}+ // The edges' midpoints, top, right, bottom, left as Rust numbers them:+ // a pull on one stretches that axis alone.+ Grip {+ at-x: root.px(0px, -root.bh / 2);+ at-y: root.py(0px, -root.bh / 2);+ stage-w: root.width; stage-h: root.height;+ cursor: MouseCursor.ns-resize;+ pressed(x, y) => { root.grip-pressed(5, x, y); }+ dragged(x, y, snap) => { root.dragged(x, y, snap); }+ released => { root.released(); }+ }+ Grip {+ at-x: root.px(root.bw / 2, 0px);+ at-y: root.py(root.bw / 2, 0px);+ stage-w: root.width; stage-h: root.height;+ cursor: MouseCursor.ew-resize;+ pressed(x, y) => { root.grip-pressed(6, x, y); }+ dragged(x, y, snap) => { root.dragged(x, y, snap); }+ released => { root.released(); }+ }+ Grip {+ at-x: root.px(0px, root.bh / 2);+ at-y: root.py(0px, root.bh / 2);+ stage-w: root.width; stage-h: root.height;+ cursor: MouseCursor.ns-resize;+ pressed(x, y) => { root.grip-pressed(7, x, y); }+ dragged(x, y, snap) => { root.dragged(x, y, snap); }+ released => { root.released(); }+ }+ Grip {+ at-x: root.px(-root.bw / 2, 0px);+ at-y: root.py(-root.bw / 2, 0px);+ stage-w: root.width; stage-h: root.height;+ cursor: MouseCursor.ew-resize;+ pressed(x, y) => { root.grip-pressed(8, x, y); }+ dragged(x, y, snap) => { root.dragged(x, y, snap); }+ released => { root.released(); }+ }+// The rotation handle, above the top edge.Grip {turn: true;