PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Blur Gallery: Tilt-Shift and Spin Blur on the image (#3373) (#3829)
Timothy Daly7e0f48a2909f
diff --git a/crates/ui-egui/src/blur_pins.rs b/crates/ui-egui/src/blur_pins.rsindex 0e10c65aa..e368abf65 100644--- a/crates/ui-egui/src/blur_pins.rs+++ b/crates/ui-egui/src/blur_pins.rs@@ -1,19 +1,26 @@-//! Filter › Blur Gallery › Field Blur… and Iris Blur… as Photoshop's workspace (#3373): pins on the-//! image, each with its own blur. While the dialog is open the image under it takes the pointer:-//! a click on the image adds a pin (and selects it), a drag moves a pin, and a drag on the selected-//! pin's ring turns its blur up or down (one turn = the full 0–500 px; the arc shows the amount).-//! Delete or Backspace removes the selected pin. The dialog shows the selected pin's Blur and the-//! Preview switch; OK runs the filter with the `pins`.+//! Filter › Blur Gallery as Photoshop's workspace (#3373): Field Blur, Iris Blur, Tilt-Shift and+//! Spin Blur are edited on the image. While the dialog is open the image under it takes the+//! pointer: a click on the image adds a pin (and selects it), a drag moves a pin, and a drag on the+//! selected pin's ring turns its amount up or down (one turn = the full range; the arc shows it).+//! Delete or Backspace removes the selected pin. The dialog shows the selected pin's amount and the+//! Preview switch; OK runs the filter.//!-//! Field Blur interpolates the pins' blur between them. An Iris Blur pin is a sharp superellipse,-//! blurred outside: the selected pin shows Photoshop's handles, four on the outline (drag to resize-//! that axis and turn the shape), a square at its corner (drag out to round it towards a rectangle)-//! and four dots inside (drag to set the sharp core, where the blur starts).+//! - **Field Blur** interpolates the pins' blur between them.+//! - **Iris Blur**: a sharp superellipse, blurred outside. The selected pin shows Photoshop's+//! handles: four on the outline (drag to resize that axis and turn the shape), a square at its+//! corner (drag out to round it towards a rectangle) and four dots inside (the sharp core, where+//! the blur starts).+//! - **Spin Blur**: an ellipse whose content turns about its centre; the outline handles resize and+//! turn it, and the ring sets the blur angle (one turn = 360°).+//! - **Tilt-Shift**: one sharp band (the engine has a single one, so a click adds nothing). The+//! solid lines bound the sharp band, the dashed lines the transition, and the dots on the solid+//! lines turn it.//!-//! Everything lives in the dialog's fields, so automation drives it with `ui.dialog.set`: `pins`-//! (as the command takes them; x and y as fractions of the filter's bounds, Iris radii as fractions-//! of their shorter side) and `__selected`. The bounds are the engine's: the selection's when there-//! is one, else the canvas.+//! Everything lives in the dialog's fields, so automation drives it with `ui.dialog.set`: `pins` as+//! the command takes them (x and y as fractions of the filter's bounds, radii as fractions of their+//! shorter side) and `__selected`; Tilt-Shift keeps the command's own `centerX`, `centerY`,+//! `angle`, `focus`, `transition` and `blur`. The bounds are the engine's: the selection's when+//! there is one, else the canvas.use egui::{Color32, Pos2, Stroke, vec2};use serde_json::{Map, Value, json};@@ -23,8 +30,12 @@ use crate::canvas::ViewXform;pub const COMMAND: &str = "filter.blurGallery.fieldBlur";pub const IRIS: &str = "filter.blurGallery.irisBlur";-/// The Blur Gallery range, in pixels.+pub const SPIN: &str = "filter.blurGallery.spinBlur";+pub const TILT: &str = "filter.blurGallery.tiltShift";+/// The blur range, in pixels.const MAX_BLUR: f64 = 500.0;+/// Spin Blur's blur angle range, in degrees.+const MAX_SPIN: f64 = 360.0;/// Photoshop's first pin.const DEFAULT_BLUR: f64 = 15.0;/// More pins than anyone places by hand; keeps the params and the per-pixel loop bounded.@@ -34,9 +45,11 @@ const DOT: f32 = 5.0;const GRAB: f32 = 9.0;const RING: f32 = 24.0;const RING_BAND: f32 = 5.0;-/// Screen size (points) of an Iris handle.+/// Screen size (points) of a shape handle.const HANDLE: f32 = 4.5;-/// Iris radii, as the command bounds them.+/// How near (points) a press must be to a Tilt-Shift line to drag it.+const LINE_GRAB: f32 = 5.0;+/// Radii, as the commands bound them.const MIN_RADIUS: f64 = 0.01;const MAX_FEATHER: f64 = 0.99;@@ -44,12 +57,28 @@ const MAX_FEATHER: f64 = 0.99;enum Kind {Field,Iris,+ Spin,+ Tilt,+}++impl Kind {+ /// The amount the ring and the dialog set: blur in pixels, or Spin's blur angle in degrees.+ fn max(self) -> f64 {+ if self == Kind::Spin { MAX_SPIN } else { MAX_BLUR }+ }++ /// The dialog field the selected pin's amount is mirrored to (remembered for next time).+ fn amount_key(self) -> &'static str {+ if self == Kind::Spin { "blurAngle" } else { "blur" }+ }}fn kind(fields: &Map<String, Value>) -> Option<Kind> {match fields.get("__command").and_then(Value::as_str) {Some(COMMAND) => Some(Kind::Field),Some(IRIS) => Some(Kind::Iris),+ Some(SPIN) => Some(Kind::Spin),+ Some(TILT) => Some(Kind::Tilt),_ => None,}}@@ -60,10 +89,10 @@ pub fn owns(fields: &Map<String, Value>) -> bool {/// The Blur Gallery filters that open as this workspace.pub fn handles(command: &str) -> bool {- command == COMMAND || command == IRIS+ matches!(command, COMMAND | IRIS | SPIN | TILT)}-/// An Iris Blur pin's shape, as the command takes it.+/// An Iris or Spin pin's shape, as the command takes it.#[derive(Clone, Copy, Debug, PartialEq)]pub struct Iris {/// Radii as fractions of the bounds' shorter side.@@ -71,20 +100,25 @@ pub struct Iris {pub ry: f64,/// Degrees, clockwise on screen.pub angle: f64,- /// 0 = ellipse … 100 = rounded rectangle.+ /// 0 = ellipse … 100 = rounded rectangle (Iris only).pub roundness: f64,- /// Where the blur starts, as a fraction of the shape (the sharp core).+ /// Where the blur starts, as a fraction of the shape (Iris only).pub feather: f64,}impl Default for Iris {- /// The command's defaults.+ /// Iris Blur's defaults.fn default() -> Self {Iris { rx: 0.35, ry: 0.25, angle: 0.0, roundness: 0.0, feather: 0.5 }}}impl Iris {+ /// Spin Blur's defaults: a circle.+ pub fn spin() -> Self {+ Iris { rx: 0.3, ry: 0.3, ..Iris::default() }+ }+fn clean(self) -> Self {let f = |v: f64, d: f64| if v.is_finite() { v } else { d };Iris {@@ -102,8 +136,38 @@ impl Iris {}}-/// Turn a freshly opened Field or Iris Blur dialog into the workspace: one pin in the middle of-/// the filter's bounds with the remembered settings, selected.+/// Tilt-Shift's band: its angle, and the sharp band's and the transition's widths beyond the+/// centre line, as fractions of the bounds' shorter side.+#[derive(Clone, Copy, Debug, PartialEq)]+pub struct Tilt {+ /// Degrees, −90…90; 0 is a horizontal band, positive turns it anticlockwise on screen.+ pub angle: f64,+ pub focus: f64,+ pub transition: f64,+}++impl Tilt {+ fn clean(self) -> Self {+ let f = |v: f64, d: f64| if v.is_finite() { v } else { d };+ // The band is the same turned half a turn: keep the command's −90…90.+ let mut angle = (f(self.angle, 0.0) + 180.0).rem_euclid(360.0) - 180.0;+ if angle > 90.0 {+ angle -= 180.0;+ } else if angle < -90.0 {+ angle += 180.0;+ }+ Tilt { angle, focus: f(self.focus, 0.1).clamp(0.0, 1.0), transition: f(self.transition, 0.15).clamp(0.01, 1.0) }+ }++ /// The unit normal of the band (the engine's), and its direction along the band.+ fn axes(self) -> ([f64; 2], [f64; 2]) {+ let (s, c) = self.angle.to_radians().sin_cos();+ ([s, c], [c, -s])+ }+}++/// Turn a freshly opened Blur Gallery dialog into the workspace: one pin in the middle of the+/// filter's bounds with the remembered settings, selected.pub fn init(app: &mut PhotocraftApp, fields: &mut Map<String, Value>) {reset(fields);let bounds = app.session.active().map(|st| (st.doc.id, st.doc.bounds(), st.doc.selection.clone()));@@ -116,19 +180,30 @@ pub fn init(app: &mut PhotocraftApp, fields: &mut Map<String, Value>) {/// One pin in the middle with the dialog's settings, selected. Alt+Cancel (Reset) runs this/// alone, so the bounds captured on opening stay.pub fn reset(fields: &mut Map<String, Value>) {- let num = |k: &str, d: f64| fields.get(k).and_then(Value::as_f64).filter(|v| v.is_finite()).unwrap_or(d);- let blur = num("blur", DEFAULT_BLUR).clamp(0.0, MAX_BLUR);- let iris = (kind(fields) == Some(Kind::Iris)).then(|| {- Iris { rx: num("radiusX", 0.35), ry: num("radiusY", 0.25), angle: num("angle", 0.0), roundness: num("roundness", 0.0), feather: num("feather", 0.5) }- .clean()- });- // The pins replace the single shape's params.- for k in ["centerX", "centerY", "radiusX", "radiusY", "angle", "roundness", "feather"] {- fields.remove(k);+ let Some(k) = kind(fields) else { return };+ let num = |key: &str, d: f64| fields.get(key).and_then(Value::as_f64).filter(|v| v.is_finite()).unwrap_or(d);+ let amount = num(k.amount_key(), DEFAULT_BLUR).clamp(0.0, k.max());+ let shape = |d: Iris| Iris { rx: num("radiusX", d.rx), ry: num("radiusY", d.ry), angle: num("angle", d.angle), ..d };+ let pin = match k {+ Kind::Field => Pin { x: 0.5, y: 0.5, blur: amount, iris: None, tilt: None },+ Kind::Iris => {+ let iris = Iris { roundness: num("roundness", 0.0), feather: num("feather", 0.5), ..shape(Iris::default()) }.clean();+ Pin { x: 0.5, y: 0.5, blur: amount, iris: Some(iris), tilt: None }+ }+ Kind::Spin => Pin { x: 0.5, y: 0.5, blur: amount, iris: Some(shape(Iris::spin()).clean()), tilt: None },+ Kind::Tilt => {+ let tilt = Tilt { angle: num("angle", 0.0), focus: num("focus", 0.1), transition: num("transition", 0.15) }.clean();+ Pin { x: num("centerX", 0.5).clamp(0.0, 1.0), y: num("centerY", 0.5).clamp(0.0, 1.0), blur: amount, iris: None, tilt: Some(tilt) }+ }+ };+ // The pins replace a single shape's params (Tilt-Shift keeps its own).+ if k != Kind::Tilt {+ for key in ["centerX", "centerY", "radiusX", "radiusY", "angle", "roundness", "feather"] {+ fields.remove(key);+ }}- fields.insert("blur".into(), json!(blur));- set_pins(fields, &[Pin { x: 0.5, y: 0.5, blur, iris }]);- fields.insert("__selected".into(), json!(0));+ set_pins(fields, &[pin]);+ select(fields, Some(0));}/// Where the dialog first opens (offset from the window's top-left): at the right edge, beside the@@ -138,49 +213,71 @@ pub fn first_place(fields: &Map<String, Value>, ctx: &egui::Context) -> Option<eowns(fields).then(|| vec2((ctx.content_rect().width() - 480.0).max(0.0), 96.0))}-/// One pin: position as fractions of the bounds, blur in pixels, and an Iris pin's shape.+/// One pin: position as fractions of the bounds, its amount (blur in pixels, Spin's blur angle in+/// degrees), and an Iris or Spin pin's shape or the Tilt-Shift band.#[derive(Clone, Copy, Debug, PartialEq)]pub struct Pin {pub x: f64,pub y: f64,pub blur: f64,pub iris: Option<Iris>,+ pub tilt: Option<Tilt>,}/// The pins in `fields`, cleaned (finite, in range, at most [`MAX_PINS`]).pub fn pins(fields: &Map<String, Value>) -> Vec<Pin> {+ let Some(k) = kind(fields) else { return Vec::new() };+ let num = |v: &Value, key: &str, d: f64| v.get(key).and_then(Value::as_f64).filter(|x| x.is_finite()).unwrap_or(d);+ if k == Kind::Tilt {+ // Tilt-Shift's one band is the command's own params.+ let f = Value::Object(fields.clone());+ let tilt = Tilt { angle: num(&f, "angle", 0.0), focus: num(&f, "focus", 0.1), transition: num(&f, "transition", 0.15) }.clean();+ let (x, y) = (num(&f, "centerX", 0.5).clamp(0.0, 1.0), num(&f, "centerY", 0.5).clamp(0.0, 1.0));+ return vec![Pin { x, y, blur: num(&f, "blur", DEFAULT_BLUR).clamp(0.0, MAX_BLUR), iris: None, tilt: Some(tilt) }];+ }let Some(list) = fields.get("pins").and_then(Value::as_array) else { return Vec::new() };- let iris = kind(fields) == Some(Kind::Iris);- let num = |v: &Value, k: &str, d: f64| v.get(k).and_then(Value::as_f64).filter(|x| x.is_finite()).unwrap_or(d);list.iter().take(MAX_PINS).map(|v| Pin {x: num(v, "x", 0.5).clamp(0.0, 1.0),y: num(v, "y", 0.5).clamp(0.0, 1.0),- blur: num(v, "blur", DEFAULT_BLUR).clamp(0.0, MAX_BLUR),- iris: iris.then(|| {- let d = Iris::default();- Iris {- rx: num(v, "radiusX", d.rx),- ry: num(v, "radiusY", d.ry),- angle: num(v, "angle", d.angle),- roundness: num(v, "roundness", d.roundness),- feather: num(v, "feather", d.feather),+ blur: num(v, k.amount_key(), DEFAULT_BLUR).clamp(0.0, k.max()),+ iris: match k {+ Kind::Iris | Kind::Spin => {+ let d = if k == Kind::Spin { Iris::spin() } else { Iris::default() };+ let iris = Iris { rx: num(v, "radiusX", d.rx), ry: num(v, "radiusY", d.ry), angle: num(v, "angle", d.angle), ..d };+ let iris = if k == Kind::Iris {+ Iris { roundness: num(v, "roundness", d.roundness), feather: num(v, "feather", d.feather), ..iris }+ } else {+ iris+ };+ Some(iris.clean())}- .clean()- }),+ _ => None,+ },+ tilt: None,}).collect()}fn set_pins(fields: &mut Map<String, Value>, pins: &[Pin]) {+ let Some(k) = kind(fields) else { return };+ if k == Kind::Tilt {+ let Some(p) = pins.first() else { return };+ let t = p.tilt.unwrap_or(Tilt { angle: 0.0, focus: 0.1, transition: 0.15 });+ for (key, v) in [("centerX", p.x), ("centerY", p.y), ("blur", p.blur), ("angle", t.angle), ("focus", t.focus), ("transition", t.transition)] {+ fields.insert(key.into(), json!(v));+ }+ return;+ }let list: Vec<Value> = pins.iter()- .map(|p| match p.iris {- None => json!({"x": p.x, "y": p.y, "blur": p.blur}),- Some(s) => {+ .map(|p| match (k, p.iris) {+ (Kind::Iris, Some(s)) => {json!({"x": p.x, "y": p.y, "blur": p.blur, "radiusX": s.rx, "radiusY": s.ry, "angle": s.angle, "roundness": s.roundness, "feather": s.feather})}+ (Kind::Spin, Some(s)) => json!({"x": p.x, "y": p.y, "blurAngle": p.blur, "radiusX": s.rx, "radiusY": s.ry, "angle": s.angle}),+ _ => json!({"x": p.x, "y": p.y, "blur": p.blur}),}).collect();fields.insert("pins".into(), Value::Array(list));@@ -194,9 +291,9 @@ pub fn selected(fields: &Map<String, Value>) -> Option<usize> {fn select(fields: &mut Map<String, Value>, i: Option<usize>) {fields.insert("__selected".into(), i.map_or(Value::Null, |i| json!(i)));- // The dialog's Blur (remembered for the next time) follows the selected pin.- if let Some(p) = i.and_then(|i| pins(fields).get(i).copied()) {- fields.insert("blur".into(), json!(p.blur));+ // The dialog's amount (remembered for the next time) follows the selected pin.+ if let (Some(k), Some(p)) = (kind(fields), i.and_then(|i| pins(fields).get(i).copied())) {+ fields.insert(k.amount_key().into(), json!(p.blur));}}@@ -208,7 +305,7 @@ fn bounds(fields: &Map<String, Value>) -> Option<[f64; 4]> {(r[2] > r[0] && r[3] > r[1]).then_some(r)}-/// The bounds' shorter side, which Iris radii are fractions of.+/// The bounds' shorter side, which radii and Tilt-Shift widths are fractions of.fn short_side(b: [f64; 4]) -> f64 {(b[2] - b[0]).min(b[3] - b[1]).max(1.0)}@@ -221,7 +318,7 @@ fn from_doc(b: [f64; 4], d: [f64; 2]) -> (f64, f64) {(((d[0] - b[0]) / (b[2] - b[0])).clamp(0.0, 1.0), ((d[1] - b[1]) / (b[3] - b[1])).clamp(0.0, 1.0))}-/// An Iris pin's local point `(u, v)` (1 = on the shape along that axis) in document pixels.+/// A shaped pin's local point `(u, v)` (1 = on the outline along that axis) in document pixels.fn iris_point(b: [f64; 4], p: Pin, s: Iris, u: f64, v: f64) -> [f64; 2] {let c = to_doc(b, p);let ss = short_side(b);@@ -230,7 +327,7 @@ fn iris_point(b: [f64; 4], p: Pin, s: Iris, u: f64, v: f64) -> [f64; 2] {[c[0] + x * cos - y * sin, c[1] + x * sin + y * cos]}-/// A document point in an Iris pin's local coordinates (the engine's `u`, `v`).+/// A document point in a shaped pin's local coordinates (the engine's `u`, `v`).fn iris_local(b: [f64; 4], p: Pin, s: Iris, d: [f64; 2]) -> (f64, f64) {let c = to_doc(b, p);let ss = short_side(b);@@ -244,8 +341,8 @@ fn diagonal(s: Iris) -> f64 {0.5f64.powf(1.0 / s.exponent())}-/// The selected Iris pin's handles in local coordinates: the four on the outline (along the axes),-/// the roundness square (upper right) and the four feather dots inside (on the diagonals).+/// A shaped pin's outline handles (along its axes), Iris's roundness square (upper right) and its+/// four feather dots (on the diagonals), in local coordinates.fn axis_handles() -> [(f64, f64); 4] {[(1.0, 0.0), (0.0, 1.0), (-1.0, 0.0), (0.0, -1.0)]}@@ -260,8 +357,35 @@ fn feather_handles(s: Iris) -> [(f64, f64); 4] {[(k, k), (-k, k), (-k, -k), (k, -k)]}-/// Remove the selected pin; the one before it (or the new first) is selected.+/// The point of the Tilt-Shift band at `offset` pixels across it (along its normal) and `along`+/// pixels along it from the centre, in document pixels.+fn tilt_point(b: [f64; 4], p: Pin, t: Tilt, offset: f64, along: f64) -> [f64; 2] {+ let c = to_doc(b, p);+ let (n, d) = t.axes();+ [c[0] + n[0] * offset + d[0] * along, c[1] + n[1] * offset + d[1] * along]+}++/// How far a document point is across the band from its centre line, in pixels (signed).+fn tilt_offset(b: [f64; 4], p: Pin, t: Tilt, d: [f64; 2]) -> f64 {+ let c = to_doc(b, p);+ let (n, _) = t.axes();+ (d[0] - c[0]) * n[0] + (d[1] - c[1]) * n[1]+}++/// A Tilt-Shift turn handle: one on each solid line, beside the pin's ring (so it never sits on+/// the ring, however narrow the band). `side` is +1 or −1.+pub fn tilt_turn_handle(b: [f64; 4], p: Pin, t: Tilt, xf: &ViewXform, side: f64) -> [f64; 2] {+ let ss = short_side(b);+ let scale = f64::from(xf.zoom_x()).max(1e-6);+ tilt_point(b, p, t, side * t.focus * ss, f64::from(RING + 18.0) / scale)+}++/// Remove the selected pin; the one before it (or the new first) is selected. Tilt-Shift's one+/// band stays.pub fn remove_selected(fields: &mut Map<String, Value>) -> bool {+ if kind(fields) == Some(Kind::Tilt) {+ return false;+ }let Some(i) = selected(fields) else { return false };let mut list = pins(fields);list.remove(i);@@ -270,16 +394,18 @@ pub fn remove_selected(fields: &mut Map<String, Value>) -> bool {true}-/// The dialog body: the selected pin's Blur, how to place pins, and Preview.+/// The dialog body: the selected pin's amount, how to edit the pins, and Preview.pub fn body(ui: &mut egui::Ui, f: &mut Map<String, Value>) {let t = crate::theme::Tokens::get(ui.ctx());+ let k = kind(f).unwrap_or(Kind::Field);match selected(f) {Some(i) => {let mut list = pins(f);if let Some(pin) = list.get_mut(i) {let mut v = pin.blur as f32;- if crate::widgets::slider_row(ui, tl!("Blur"), &mut v, 0.0..=MAX_BLUR as f32, "px", None).changed() {- pin.blur = f64::from(v.round()).clamp(0.0, MAX_BLUR);+ let (label, unit) = if k == Kind::Spin { (tl!("Blur Angle"), "°") } else { (tl!("Blur"), "px") };+ if crate::widgets::slider_row(ui, label, &mut v, 0.0..=k.max() as f32, unit, None).changed() {+ pin.blur = f64::from(v.round()).clamp(0.0, k.max());set_pins(f, &list);select(f, Some(i));}@@ -291,13 +417,25 @@ pub fn body(ui: &mut egui::Ui, f: &mut Map<String, Value>) {}ui.add_space(4.0);let hint = |ui: &mut egui::Ui, text: &str| ui.add(egui::Label::new(egui::RichText::new(text).color(t.text_dim).size(11.5)).wrap());- hint(ui, tl!("Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin."));- if kind(f) == Some(Kind::Iris) {+ if k == Kind::Tilt {+ hint(+ ui,+ tl!(+ "Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it."+ ),+ );+ } else {+ hint(ui, tl!("Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin."));+ }+ if k == Kind::Iris {hint(ui,tl!("Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts."),);}+ if k == Kind::Spin {+ hint(ui, tl!("Drag the handles on the outline to resize and turn it; the ring sets the blur angle."));+ }// Delete removes the selected pin, unless a field is being typed in.let typing = ui.ctx().memory(|m| m.focused().is_some());if !typing && ui.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Delete) || i.consume_key(egui::Modifiers::NONE, egui::Key::Backspace)) {@@ -311,20 +449,31 @@ pub fn body(ui: &mut egui::Ui, f: &mut Map<String, Value>) {}}-/// What a press at screen point `at` grabs: one of the selected Iris pin's handles (axis 0–3 =-/// +u, +v, −u, −v), the selected pin's ring, a pin, or nothing (a new pin).+/// What a press at screen point `at` grabs: one of the selected pin's handles (axis 0–3 = +u, +v,+/// −u, −v; Tilt-Shift's turn dots and lines), its ring, a pin, or nothing (a new pin).#[derive(Clone, Copy, Debug, PartialEq)]enum Grab {Axis(usize, usize),Round(usize),Feather(usize),+ Turn(usize, i8),+ Focus(usize),+ Transition(usize),Ring(usize),Pin(usize),New,}+/// Distance in screen points from `at` to the infinite line through screen points `a` and `b`.+fn line_distance(at: Pos2, a: Pos2, b: Pos2) -> f32 {+ let d = b - a;+ let len = d.length();+ if len <= f32::EPSILON { at.distance(a) } else { ((at - a).x * d.y - (at - a).y * d.x).abs() / len }+}+fn grab(fields: &Map<String, Value>, xf: &ViewXform, at: Pos2) -> Grab {let Some(b) = bounds(fields) else { return Grab::New };+ let k = kind(fields);let list = pins(fields);let screen = |d: [f64; 2]| xf.to_screen(d[0] as f32, d[1] as f32);let near = |d: [f64; 2]| screen(d).distance(at) <= GRAB;@@ -332,20 +481,43 @@ fn grab(fields: &Map<String, Value>, xf: &ViewXform, at: Pos2) -> Grab {&& let Some(p) = list.get(i).copied(){if let Some(s) = p.iris {- if let Some(k) = axis_handles().iter().position(|&(u, v)| near(iris_point(b, p, s, u, v))) {- return Grab::Axis(i, k);+ if let Some(a) = axis_handles().iter().position(|&(u, v)| near(iris_point(b, p, s, u, v))) {+ return Grab::Axis(i, a);}- let (u, v) = round_handle(s);- if near(iris_point(b, p, s, u, v)) {- return Grab::Round(i);+ if k == Some(Kind::Iris) {+ let (u, v) = round_handle(s);+ if near(iris_point(b, p, s, u, v)) {+ return Grab::Round(i);+ }+ if feather_handles(s).iter().any(|&(u, v)| near(iris_point(b, p, s, u, v))) {+ return Grab::Feather(i);+ }}- if feather_handles(s).iter().any(|&(u, v)| near(iris_point(b, p, s, u, v))) {- return Grab::Feather(i);+ }+ if let Some(t) = p.tilt {+ for side in [1i8, -1] {+ if near(tilt_turn_handle(b, p, t, xf, f64::from(side))) {+ return Grab::Turn(i, side);+ }}}if (screen(to_doc(b, p)).distance(at) - RING).abs() <= RING_BAND {return Grab::Ring(i);}+ if let Some(t) = p.tilt+ && screen(to_doc(b, p)).distance(at) > GRAB+ {+ let ss = short_side(b);+ let on = |offset: f64| line_distance(at, screen(tilt_point(b, p, t, offset, -ss)), screen(tilt_point(b, p, t, offset, ss))) <= LINE_GRAB;+ let focus = t.focus * ss;+ if on(focus) || on(-focus) {+ return Grab::Focus(i);+ }+ let edge = (t.focus + t.transition) * ss;+ if on(edge) || on(-edge) {+ return Grab::Transition(i);+ }+ }}list.iter().enumerate()@@ -362,11 +534,14 @@ pub fn canvas(app: &mut PhotocraftApp, ctx: &egui::Context, xf: &ViewXform, overlet Some(d) = app.ui.dialogs.last_mut().filter(|d| owns(&d.fields)) else { return false };let f = &mut d.fields;let Some(b) = bounds(f) else { return false };+ let Some(k) = kind(f) else { return false };let (start, down) = ctx.input(|i| (i.pointer.primary_pressed(), i.pointer.primary_down()));ctx.set_cursor_icon(match grab(f, xf, over) {- Grab::Ring(_) | Grab::Round(_) => egui::CursorIcon::Alias,+ Grab::Ring(_) | Grab::Round(_) | Grab::Turn(..) => egui::CursorIcon::Alias,Grab::Axis(..) | Grab::Feather(_) => egui::CursorIcon::Move,+ Grab::Focus(_) | Grab::Transition(_) => egui::CursorIcon::ResizeVertical,Grab::Pin(_) => egui::CursorIcon::Grab,+ Grab::New if k == Kind::Tilt => egui::CursorIcon::Default,Grab::New => egui::CursorIcon::Crosshair,});if !down && press.is_none() {@@ -378,9 +553,12 @@ pub fn canvas(app: &mut PhotocraftApp, ctx: &egui::Context, xf: &ViewXform, overlet mut list = pins(f);if start {let drag = match grab(f, xf, at) {- Grab::Axis(i, k) => json!({"axis": i, "k": k}),+ Grab::Axis(i, a) => json!({"axis": i, "k": a}),Grab::Round(i) => json!({"round": i}),Grab::Feather(i) => json!({"feather": i}),+ Grab::Turn(i, side) => json!({"turn": i, "side": side}),+ Grab::Focus(i) => json!({"focus": i}),+ Grab::Transition(i) => json!({"transition": i}),Grab::Ring(i) => {let c = list.get(i).map(|p| to_doc(b, *p)).unwrap_or(doc);json!({"ring": i, "angle": (doc[1] - c[1]).atan2(doc[0] - c[0])})@@ -390,13 +568,14 @@ pub fn canvas(app: &mut PhotocraftApp, ctx: &egui::Context, xf: &ViewXform, overlet c = list.get(i).map(|p| to_doc(b, *p)).unwrap_or(doc);json!({"pin": i, "dx": c[0] - doc[0], "dy": c[1] - doc[1]})}- Grab::New if list.len() < MAX_PINS && (b[0]..=b[2]).contains(&doc[0]) && (b[1]..=b[3]).contains(&doc[1]) => {- // A new pin takes the selected pin's blur (as the dialog's Blur shows it) and an- // Iris pin its shape too.- let blur = f.get("blur").and_then(Value::as_f64).filter(|v| v.is_finite()).unwrap_or(DEFAULT_BLUR).clamp(0.0, MAX_BLUR);- let iris = (kind(f) == Some(Kind::Iris)).then(|| selected(f).and_then(|i| list.get(i)).and_then(|p| p.iris).unwrap_or_default());+ // Tilt-Shift has one band: a click elsewhere adds nothing.+ Grab::New if k != Kind::Tilt && list.len() < MAX_PINS && (b[0]..=b[2]).contains(&doc[0]) && (b[1]..=b[3]).contains(&doc[1]) => {+ // A new pin takes the selected pin's amount (as the dialog shows it) and shape.+ let blur = f.get(k.amount_key()).and_then(Value::as_f64).filter(|v| v.is_finite()).unwrap_or(DEFAULT_BLUR).clamp(0.0, k.max());+ let fallback = if k == Kind::Spin { Iris::spin() } else { Iris::default() };+ let iris = matches!(k, Kind::Iris | Kind::Spin).then(|| selected(f).and_then(|i| list.get(i)).and_then(|p| p.iris).unwrap_or(fallback));let (x, y) = from_doc(b, doc);- list.push(Pin { x, y, blur, iris });+ list.push(Pin { x, y, blur, iris, tilt: None });set_pins(f, &list);select(f, Some(list.len() - 1));json!({"pin": list.len() - 1, "dx": 0.0, "dy": 0.0})@@ -408,21 +587,22 @@ pub fn canvas(app: &mut PhotocraftApp, ctx: &egui::Context, xf: &ViewXform, overreturn true;}let Some(drag) = f.get("__drag").cloned() else { return true };- let index = |k: &str| drag.get(k).and_then(Value::as_u64).map(|i| i as usize);+ let index = |key: &str| drag.get(key).and_then(Value::as_u64).map(|i| i as usize);+ let ss = short_side(b);if let Some(i) = index("pin")&& let Some(p) = list.get_mut(i){- let num = |k: &str| drag.get(k).and_then(Value::as_f64).unwrap_or(0.0);+ let num = |key: &str| drag.get(key).and_then(Value::as_f64).unwrap_or(0.0);(p.x, p.y) = from_doc(b, [doc[0] + num("dx"), doc[1] + num("dy")]);} else if let Some(i) = index("ring")&& let Some(p) = list.get_mut(i){- // The angle turned since the last frame, the short way round: clockwise raises the blur.+ // The angle turned since the last frame, the short way round: clockwise raises the amount.let c = to_doc(b, *p);let a = (doc[1] - c[1]).atan2(doc[0] - c[0]);let last = drag.get("angle").and_then(Value::as_f64).unwrap_or(a);let turn = (a - last + std::f64::consts::PI).rem_euclid(std::f64::consts::TAU) - std::f64::consts::PI;- p.blur = (p.blur + turn / std::f64::consts::TAU * MAX_BLUR).clamp(0.0, MAX_BLUR);+ p.blur = (p.blur + turn / std::f64::consts::TAU * k.max()).clamp(0.0, k.max());f.insert("__drag".into(), json!({"ring": i, "angle": a}));} else if let Some(i) = index("axis")&& let Some(p) = list.get_mut(i)@@ -432,14 +612,14 @@ pub fn canvas(app: &mut PhotocraftApp, ctx: &egui::Context, xf: &ViewXform, over// the shape (the +v handle sits a quarter turn after +u).let c = to_doc(b, *p);let (dx, dy) = (doc[0] - c[0], doc[1] - c[1]);- let r = (dx.hypot(dy) / short_side(b)).clamp(MIN_RADIUS, 1.0);- let k = index("k").unwrap_or(0);- if k % 2 == 0 {+ let r = (dx.hypot(dy) / ss).clamp(MIN_RADIUS, 1.0);+ let a = index("k").unwrap_or(0);+ if a % 2 == 0 {s.rx = r;} else {s.ry = r;}- s.angle = dy.atan2(dx).to_degrees() - 90.0 * k as f64;+ s.angle = dy.atan2(dx).to_degrees() - 90.0 * a as f64;p.iris = Some(s.clean());} else if let Some(i) = index("round")&& let Some(p) = list.get_mut(i)@@ -460,24 +640,60 @@ pub fn canvas(app: &mut PhotocraftApp, ctx: &egui::Context, xf: &ViewXform, overlet m = s.exponent();let e = (u.abs().powf(m) + v.abs().powf(m)).powf(1.0 / m);p.iris = Some(Iris { feather: if e.is_finite() { e } else { s.feather }, ..s }.clean());+ } else if let Some(i) = index("turn")+ && let Some(p) = list.get_mut(i)+ && let Some(t) = p.tilt+ {+ // The dot's side of the band points from the centre towards the pointer: the engine's+ // normal is (sin a, cos a).+ let c = to_doc(b, *p);+ let side = drag.get("side").and_then(Value::as_f64).unwrap_or(1.0).signum();+ let (nx, ny) = ((doc[0] - c[0]) * side, (doc[1] - c[1]) * side);+ if nx.hypot(ny) > 1e-9 {+ p.tilt = Some(Tilt { angle: nx.atan2(ny).to_degrees(), ..t }.clean());+ }+ } else if let Some(i) = index("focus")+ && let Some(p) = list.get_mut(i)+ && let Some(t) = p.tilt+ {+ p.tilt = Some(Tilt { focus: tilt_offset(b, *p, t, doc).abs() / ss, ..t }.clean());+ } else if let Some(i) = index("transition")+ && let Some(p) = list.get_mut(i)+ && let Some(t) = p.tilt+ {+ p.tilt = Some(Tilt { transition: tilt_offset(b, *p, t, doc).abs() / ss - t.focus, ..t }.clean());}set_pins(f, &list);- if let Some(i) = ["pin", "ring", "axis", "round", "feather"].into_iter().find_map(index) {+ if let Some(i) = ["pin", "ring", "axis", "round", "feather", "turn", "focus", "transition"].into_iter().find_map(index) {select(f, Some(i));}ctx.request_repaint();true}+/// Draw a dark-edged white line from `a` to `b`, dashed when `dash` is set.+fn draw_line(painter: &egui::Painter, a: Pos2, b: Pos2, dash: bool) {+ let (dark, light) = (Stroke::new(3.0, Color32::from_black_alpha(150)), Stroke::new(1.5, Color32::from_white_alpha(235)));+ if dash {+ painter.extend(egui::Shape::dashed_line(&[a, b], dark, 6.0, 5.0));+ painter.extend(egui::Shape::dashed_line(&[a, b], light, 6.0, 5.0));+ } else {+ painter.line_segment([a, b], dark);+ painter.line_segment([a, b], light);+ }+}+/// Draw the pins over the image while the workspace is open: a dot per pin (filled when-/// selected) and, round the selected one, its ring with the blur as an arc from the top, and an-/// Iris pin's outline and handles.+/// selected) and, round the selected one, its ring with the amount as an arc from the top, and+/// its outline and handles or Tilt-Shift's lines.pub fn draw(app: &PhotocraftApp, painter: &egui::Painter, xf: &ViewXform) {let Some(d) = app.ui.dialogs.last().filter(|d| owns(&d.fields)) else { return };let Some(b) = bounds(&d.fields) else { return };+ let Some(k) = kind(&d.fields) else { return };let sel = selected(&d.fields);let (dark, light) = (Stroke::new(3.0, Color32::from_black_alpha(150)), Stroke::new(1.5, Color32::from_white_alpha(235)));let screen = |p: [f64; 2]| xf.to_screen(p[0] as f32, p[1] as f32);+ let handle_stroke = Stroke::new(1.0, Color32::from_black_alpha(180));for (i, p) in pins(&d.fields).into_iter().enumerate() {let c = screen(to_doc(b, p));if sel != Some(i) {@@ -486,11 +702,11 @@ pub fn draw(app: &PhotocraftApp, painter: &egui::Painter, xf: &ViewXform) {continue;}if let Some(s) = p.iris {- // The outline: the superellipse the blur reaches its full amount at.+ // The outline: where the blur reaches its full amount (Iris) or where the spin ends.let m = s.exponent();let outline: Vec<Pos2> = (0..=128)- .map(|k| {- let a = std::f64::consts::TAU * f64::from(k) / 128.0;+ .map(|n| {+ let a = std::f64::consts::TAU * f64::from(n) / 128.0;let (cos, sin) = (a.cos(), a.sin());let r = (cos.abs().powf(m) + sin.abs().powf(m)).powf(-1.0 / m);screen(iris_point(b, p, s, r * cos, r * sin))@@ -499,27 +715,39 @@ pub fn draw(app: &PhotocraftApp, painter: &egui::Painter, xf: &ViewXform) {painter.add(egui::Shape::line(outline.clone(), dark));painter.add(egui::Shape::line(outline, light));for (u, v) in axis_handles() {- painter.circle(screen(iris_point(b, p, s, u, v)), HANDLE, Color32::WHITE, Stroke::new(1.0, Color32::from_black_alpha(180)));+ painter.circle(screen(iris_point(b, p, s, u, v)), HANDLE, Color32::WHITE, handle_stroke);+ }+ if k == Kind::Iris {+ let (u, v) = round_handle(s);+ let r = egui::Rect::from_center_size(screen(iris_point(b, p, s, u, v)), vec2(HANDLE * 2.0, HANDLE * 2.0));+ painter.rect(r, 1.0, Color32::WHITE, handle_stroke, egui::StrokeKind::Middle);+ for (u, v) in feather_handles(s) {+ painter.circle(screen(iris_point(b, p, s, u, v)), HANDLE + 1.0, Color32::from_white_alpha(230), handle_stroke);+ }+ }+ }+ if let Some(t) = p.tilt {+ // The sharp band's edges (solid) and where the blur is full (dashed), across the image.+ let ss = short_side(b);+ let clip = painter.with_clip_rect(egui::Rect::from_two_pos(screen([b[0], b[1]]), screen([b[2], b[3]])).intersect(painter.clip_rect()));+ let reach = (b[2] - b[0]).hypot(b[3] - b[1]);+ for (offset, dash) in [(t.focus, false), (t.focus + t.transition, true)] {+ for side in [1.0, -1.0] {+ let o = side * offset * ss;+ draw_line(&clip, screen(tilt_point(b, p, t, o, -reach)), screen(tilt_point(b, p, t, o, reach)), dash);+ }}- let (u, v) = round_handle(s);- let r = egui::Rect::from_center_size(screen(iris_point(b, p, s, u, v)), vec2(HANDLE * 2.0, HANDLE * 2.0));- painter.rect(r, 1.0, Color32::WHITE, Stroke::new(1.0, Color32::from_black_alpha(180)), egui::StrokeKind::Middle);- for (u, v) in feather_handles(s) {- painter.circle(- screen(iris_point(b, p, s, u, v)),- HANDLE + 1.0,- Color32::from_white_alpha(230),- Stroke::new(1.0, Color32::from_black_alpha(180)),- );+ for side in [1.0, -1.0] {+ painter.circle(screen(tilt_turn_handle(b, p, t, xf, side)), HANDLE + 0.5, Color32::WHITE, handle_stroke);}}painter.circle_stroke(c, RING, dark);painter.circle_stroke(c, RING, Stroke::new(1.0, Color32::from_white_alpha(140)));- let frac = (p.blur / MAX_BLUR) as f32;+ let frac = (p.blur / k.max()) as f32;let steps = (frac * 64.0).ceil().max(1.0) as usize;let arc: Vec<Pos2> = (0..=steps)- .map(|k| {- let a = -std::f32::consts::FRAC_PI_2 + std::f32::consts::TAU * frac * k as f32 / steps as f32;+ .map(|n| {+ let a = -std::f32::consts::FRAC_PI_2 + std::f32::consts::TAU * frac * n as f32 / steps as f32;c + vec2(a.cos(), a.sin()) * RING}).collect();@@ -527,11 +755,12 @@ pub fn draw(app: &PhotocraftApp, painter: &egui::Painter, xf: &ViewXform) {painter.add(egui::Shape::line(arc.clone(), Stroke::new(4.5, Color32::from_black_alpha(150))));painter.add(egui::Shape::line(arc, Stroke::new(2.5, Color32::WHITE)));}- painter.circle(c, DOT, Color32::WHITE, Stroke::new(1.0, Color32::from_black_alpha(180)));+ painter.circle(c, DOT, Color32::WHITE, handle_stroke);}}-/// Preview proxies run at 1/`k` of the document: the pins' pixel blur scales with them.+/// Preview proxies run at 1/`k` of the document: the pins' pixel blur scales with them, as the+/// top-level pixel params (Tilt-Shift's `blur`) already do. Spin's blur angle doesn't.pub fn scale_for_proxy(params: &mut Value, k: u32) {if k <= 1 {return;diff --git a/crates/ui-egui/src/blur_pins_tests.rs b/crates/ui-egui/src/blur_pins_tests.rsindex 69013d506..0b84a6dbf 100644--- a/crates/ui-egui/src/blur_pins_tests.rs+++ b/crates/ui-egui/src/blur_pins_tests.rs@@ -6,7 +6,7 @@ use egui_kittest::Harness;use serde_json::json;use crate::PhotocraftApp;-use crate::blur_pins::{COMMAND, IRIS, Iris, Pin, pins, selected};+use crate::blur_pins::{COMMAND, IRIS, Iris, Pin, SPIN, TILT, pins, selected};use crate::canvas::ViewXform;/// A 400×300 document at 400 %, so it fills the window round the dialog, with Field Blur open.@@ -91,7 +91,7 @@ fn on_screen(h: &Harness<'static, PhotocraftApp>, p: Pin, bounds: [f64; 4]) -> Pfn it_opens_with_one_selected_pin_in_the_middle_of_the_bounds() {let h = harness(false);let f = fields(&h);- assert_eq!(pins(&f), vec![Pin { x: 0.5, y: 0.5, blur: 15.0, iris: None }]);+ assert_eq!(pins(&f), vec![Pin { x: 0.5, y: 0.5, blur: 15.0, iris: None, tilt: None }]);assert_eq!(selected(&f), Some(0));assert_eq!(f["__bounds"], json!([0, 0, 400, 300]));assert!(!f.contains_key("centerX") && !f.contains_key("centerY"), "the pins replace the single centre");@@ -276,9 +276,112 @@ fn iris_pins_are_cleaned() {h.run_steps(2);}+fn at_doc(h: &Harness<'static, PhotocraftApp>, x: f64, y: f64) -> Pos2 {+ xf(h).to_screen(x as f32, y as f32)+}++/// Tilt-Shift's one band on the 400×300 canvas (shorter side 300): the solid lines set the sharp+/// band, the dashed ones the transition, the dots turn it, the pin moves it; a click adds nothing;+/// OK sends the command's own params.+#[test]+fn tilt_shift_lines_and_dots_shape_the_band() {+ let mut h = harness_for(TILT, false);+ let f = fields(&h);+ assert!(!f.contains_key("pins"), "Tilt-Shift keeps its own params");+ let t = only_pin(&h).tilt.unwrap();+ assert!((t.focus - 0.1).abs() < 1e-6 && (t.transition - 0.15).abs() < 1e-6 && t.angle == 0.0, "{t:?}");+ // The band is horizontal: the solid lines at y = 150 ± 30, the dashed ones 45 px further.+ // Drag the upper dashed line, far left of the pin, out to 80 px from the centre: the transition+ // is 50 px.+ let path = [at_doc(&h, 60.0, 75.0), at_doc(&h, 60.0, 72.0), at_doc(&h, 60.0, 70.0)];+ drag(&mut h, &path);+ let t = only_pin(&h).tilt.unwrap();+ assert!((t.transition - 50.0 / 300.0).abs() < 1e-3, "{t:?}");+ // Drag the lower solid line 20 px down: the sharp band is 50 px each side.+ let path = [at_doc(&h, 60.0, 180.0), at_doc(&h, 60.0, 190.0), at_doc(&h, 60.0, 200.0)];+ drag(&mut h, &path);+ let t = only_pin(&h).tilt.unwrap();+ assert!((t.focus - 50.0 / 300.0).abs() < 1e-3 && (t.transition - 50.0 / 300.0).abs() < 1e-3, "{t:?}");+ // Turn: pull the lower line's dot round to 30° (the band's normal is (sin a, cos a)).+ let p = only_pin(&h);+ let dot = crate::blur_pins::tilt_turn_handle([0.0, 0.0, 400.0, 300.0], p, t, &xf(&h), 1.0);+ let (s30, c30) = 30f64.to_radians().sin_cos();+ let path = [at_doc(&h, dot[0], dot[1]), at_doc(&h, 200.0 + 40.0 * s30, 150.0 + 40.0), at_doc(&h, 200.0 + 60.0 * s30, 150.0 + 60.0 * c30)];+ drag(&mut h, &path);+ let t = only_pin(&h).tilt.unwrap();+ assert!((t.angle - 30.0).abs() < 0.5, "{t:?}");+ assert!((t.focus - 50.0 / 300.0).abs() < 1e-3, "turning keeps the widths");+ // The pin moves the band.+ let path = [at_doc(&h, 200.0, 150.0), at_doc(&h, 210.0, 145.0), at_doc(&h, 220.0, 140.0)];+ drag(&mut h, &path);+ let p = only_pin(&h);+ assert!((p.x - 0.55).abs() < 1e-3 && (p.y - 140.0 / 300.0).abs() < 1e-3, "{p:?}");+ // A click away from the band's lines adds nothing: there is one band.+ let r = h.state().last_canvas_rect;+ let away = pos2(r.left() + 30.0, r.top() + 30.0);+ move_to(&mut h, away);+ button(&mut h, away, true);+ button(&mut h, away, false);+ h.run_steps(2);+ assert_eq!(pins(&fields(&h)).len(), 1);+ h.key_press(egui::Key::Delete);+ h.run_steps(2);+ assert_eq!(pins(&fields(&h)).len(), 1, "Delete keeps the one band");+ let id = h.state().ui.dialogs.last().unwrap().id;+ crate::dialogs::confirm(h.state_mut(), id).unwrap();+ let (cmd, params) = h.state().session.journal.last().cloned().unwrap();+ assert_eq!(cmd, TILT);+ for (k, want) in [("centerX", 0.55), ("angle", t.angle), ("focus", t.focus), ("transition", t.transition), ("blur", 15.0)] {+ assert!(params[k].as_f64().is_some_and(|v| (v - want).abs() < 1e-3), "{k}: {params}");+ }+ assert!(params.get("pins").is_none(), "{params}");+}++/// Spin Blur: outline handles resize and turn the ellipse, the ring is the blur angle (a quarter+/// turn = 90°), a click adds a pin with the same shape, OK sends `blurAngle` per pin.+#[test]+fn spin_blur_handles_and_its_angle_ring() {+ let mut h = harness_for(SPIN, false);+ let p = only_pin(&h);+ assert_eq!(p.blur, 15.0, "the blur angle");+ assert!(p.iris.is_some_and(|s| (s.rx - 0.3).abs() < 1e-6 && (s.ry - 0.3).abs() < 1e-6));+ let small = json!([{"x": 0.5, "y": 0.5, "blurAngle": 15.0, "radiusX": 0.1, "radiusY": 0.1, "angle": 0.0}]);+ h.state_mut().ui.dialogs.last_mut().unwrap().fields.insert("pins".into(), small);+ h.run_steps(2);+ // The +v handle (30 px below the centre) dragged 45 px out to the right: radius 45/300, and+ // the shape turned so +v points right (−90°).+ let p = only_pin(&h);+ let path = [iris_at(&h, p, 0.0, 1.0), at_doc(&h, 230.0, 175.0), at_doc(&h, 245.0, 150.0)];+ drag(&mut h, &path);+ let s = only_pin(&h).iris.unwrap();+ assert!((s.ry - 45.0 / 300.0).abs() < 2e-3 && (s.angle + 90.0).abs() < 0.5 && s.rx == 0.1, "{s:?}");+ // A quarter turn clockwise on the ring adds 90° of blur angle.+ let c = at_doc(&h, 200.0, 150.0);+ let ring: Vec<Pos2> = (0..=6).map(|k| c + vec2(24.0 * (k as f32 * 0.2618).cos(), 24.0 * (k as f32 * 0.2618).sin())).collect();+ drag(&mut h, &ring);+ let p = only_pin(&h);+ assert!((p.blur - 105.0).abs() < 1.0, "{}", p.blur);+ assert_eq!(fields(&h)["blurAngle"], json!(p.blur), "the dialog's Blur Angle follows the pin");+ let r = h.state().last_canvas_rect;+ let at = pos2(r.left() + 80.0, r.bottom() - 80.0);+ move_to(&mut h, at);+ button(&mut h, at, true);+ button(&mut h, at, false);+ h.run_steps(2);+ let list = pins(&fields(&h));+ assert_eq!(list.len(), 2);+ assert_eq!((list[1].iris, list[1].blur), (list[0].iris, list[0].blur));+ let id = h.state().ui.dialogs.last().unwrap().id;+ crate::dialogs::confirm(h.state_mut(), id).unwrap();+ let (cmd, params) = h.state().session.journal.last().cloned().unwrap();+ assert_eq!(cmd, SPIN);+ assert!(params["pins"][0]["blurAngle"].as_f64().is_some_and(|a| (a - 105.0).abs() < 1.0), "{params}");+ assert!(params["pins"][0].get("blur").is_none() && params["pins"][0].get("roundness").is_none(), "{params}");+}+/// Alt+Cancel → Reset (#3871) starts the workspace again from one pin in the middle, as when it/// opened, instead of leaving it with no pins; the bounds captured on opening stay. An Iris pin-/// gets the command's default shape back.+/// gets the command's default shape back, and Spin Blur and Tilt-Shift their defaults too.#[test]fn alt_reset_starts_again_from_one_pin() {let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());@@ -290,7 +393,7 @@ fn alt_reset_starts_again_from_one_pin() {fields.insert("__selected".into(), json!(1));assert!(crate::dialog_alt_reset::supported(&fields));crate::dialog_alt_reset::apply(&mut app, &egui::Context::default(), &mut fields);- assert_eq!(pins(&fields), [Pin { x: 0.5, y: 0.5, blur: 15.0, iris: None }]);+ assert_eq!(pins(&fields), [Pin { x: 0.5, y: 0.5, blur: 15.0, iris: None, tilt: None }]);assert_eq!(selected(&fields), Some(0));assert_eq!(fields["__bounds"], bounds);assert!(!fields.contains_key("centerX") && !fields.contains_key("centerY"), "{fields:?}");@@ -307,4 +410,18 @@ fn alt_reset_starts_again_from_one_pin() {for (got, want) in [(s.rx, d.rx), (s.ry, d.ry), (s.angle, d.angle), (s.roundness, d.roundness), (s.feather, d.feather)] {assert!((got - want).abs() < 1e-6, "{s:?}");}+ let id = crate::filter_dialog::open(&mut app, SPIN).unwrap();+ let mut fields = app.ui.dialog_mut(id).unwrap().fields.clone();+ fields.insert("pins".into(), json!([{"x": 0.2, "y": 0.2, "blurAngle": 90.0}, {"x": 0.7, "y": 0.6, "blurAngle": 30.0}]));+ crate::dialog_alt_reset::apply(&mut app, &egui::Context::default(), &mut fields);+ let list = pins(&fields);+ assert_eq!(list.len(), 1);+ assert_eq!((list[0].x, list[0].y, list[0].blur), (0.5, 0.5, 15.0));+ let id = crate::filter_dialog::open(&mut app, TILT).unwrap();+ let mut fields = app.ui.dialog_mut(id).unwrap().fields.clone();+ fields.insert("centerX".into(), json!(0.2));+ fields.insert("angle".into(), json!(30.0));+ crate::dialog_alt_reset::apply(&mut app, &egui::Context::default(), &mut fields);+ let p = pins(&fields)[0];+ assert_eq!((p.x, p.y, p.tilt.map(|t| t.angle)), (0.5, 0.5, Some(0.0)));}diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsvindex 81d7dcb69..5cfc0f8ff 100644--- a/crates/ui-egui/src/i18n/cs.tsv+++ b/crates/ui-egui/src/i18n/cs.tsv@@ -563,6 +563,8 @@No pin selected Není vybrán žádný špendlíkClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Kliknutím do obrazu přidáte špendlík; tažením špendlík přesunete, tažením jeho prstence změníte rozostření. Delete odstraní vybraný špendlík.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Tažením úchytů na obrysu ho změníte a otočíte, čtverečkem zaoblíte rohy a body uvnitř nastavíte, kde začíná rozostření.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Tažením špendlíku přesunete pás, tažením jeho prstence změníte rozostření. Plné čáry rozšiřují ostrý pás, přerušované nastavují přechod a body ho otáčejí.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Tažením úchytů na obrysu ho změníte a otočíte; prstenec nastavuje úhel rozostření.Iris Blur… Rozostření clonou…Tilt-Shift… Tilt-shift…Path Blur… Rozostření podél cesty…diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsvindex f9830cbb7..05ac77803 100644--- a/crates/ui-egui/src/i18n/de.tsv+++ b/crates/ui-egui/src/i18n/de.tsv@@ -562,6 +562,8 @@No pin selected Kein Pin ausgewähltClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Klicken Sie ins Bild, um einen Pin hinzuzufügen; ziehen Sie einen Pin, um ihn zu verschieben, oder seinen Ring, um die Unschärfe zu ändern. Entf entfernt den ausgewählten Pin.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Ziehen Sie die Griffe am Umriss, um ihn zu skalieren und zu drehen, das Quadrat, um die Ecken abzurunden, und die Punkte innen, um festzulegen, wo die Unschärfe beginnt.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Ziehen Sie den Pin, um das Band zu verschieben, oder seinen Ring, um die Unschärfe zu ändern. Ziehen Sie die durchgezogenen Linien, um das scharfe Band zu verbreitern, die gestrichelten für den Übergang und die Punkte zum Drehen.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Ziehen Sie die Griffe am Umriss, um ihn zu skalieren und zu drehen; der Ring legt den Unschärfewinkel fest.Iris Blur… Irisweichzeichner…Tilt-Shift… Tilt-Shift…Path Blur… Pfadweichzeichner…diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsvindex fed921ec9..c6c5ff8f6 100644--- a/crates/ui-egui/src/i18n/el.tsv+++ b/crates/ui-egui/src/i18n/el.tsv@@ -2403,6 +2403,8 @@No pin selected Δεν έχει επιλεγεί καρφίτσαClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Κάντε κλικ στην εικόνα για να προσθέσετε καρφίτσα· σύρετε μια καρφίτσα για να τη μετακινήσετε ή τον δακτύλιό της για να αλλάξετε τη θόλωση. Το Delete αφαιρεί την επιλεγμένη καρφίτσα.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Σύρετε τις λαβές στο περίγραμμα για αλλαγή μεγέθους και περιστροφή, το τετράγωνο για στρογγύλεμα των γωνιών και τις κουκκίδες μέσα για να ορίσετε πού αρχίζει η θόλωση.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Σύρετε την καρφίτσα για να μετακινήσετε τη ζώνη ή τον δακτύλιό της για να αλλάξετε τη θόλωση. Σύρετε τις συνεχείς γραμμές για να διευρύνετε την ευκρινή ζώνη, τις διακεκομμένες για τη μετάβαση και τις κουκκίδες για περιστροφή.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Σύρετε τις λαβές στο περίγραμμα για αλλαγή μεγέθους και περιστροφή· ο δακτύλιος ορίζει τη γωνία θόλωσης.File Info Πληροφορίες αρχείουFile Settings Ρυθμίσεις αρχείουFill Path Γέμισμα διαδρομήςdiff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsvindex 83ff70923..9ab990d26 100644--- a/crates/ui-egui/src/i18n/es.tsv+++ b/crates/ui-egui/src/i18n/es.tsv@@ -559,6 +559,9 @@No pin selected Ningún pin seleccionadoClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Haga clic en la imagen para añadir un pin; arrastre un pin para moverlo o su anillo para cambiar el desenfoque. Suprimir elimina el pin seleccionado.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Arrastre los manejadores del contorno para cambiar su tamaño y girarlo, el cuadrado para redondear las esquinas y los puntos interiores para fijar dónde empieza el desenfoque.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Arrastre el pin para mover la banda o su anillo para cambiar el desenfoque. Arrastre las líneas continuas para ensanchar la banda nítida, las discontinuas para fijar la transición y los puntos para girarla.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Arrastre los manejadores del contorno para cambiar su tamaño y girarlo; el anillo fija el ángulo de desenfoque.+ Blur Angle Ángulo de desenfoqueIris Blur… Desenfoque de iris…Tilt-Shift… Cambio de inclinación…Path Blur… Desenfoque de trazado…diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsvindex 14aaf6da6..db40d97ab 100644--- a/crates/ui-egui/src/i18n/fr.tsv+++ b/crates/ui-egui/src/i18n/fr.tsv@@ -547,6 +547,9 @@No pin selected Aucune épingle sélectionnéeClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Cliquez dans l’image pour ajouter une épingle ; faites glisser une épingle pour la déplacer, ou son anneau pour modifier le flou. Suppr supprime l’épingle sélectionnée.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Faites glisser les poignées du contour pour le redimensionner et le faire pivoter, le carré pour arrondir ses angles et les points intérieurs pour définir où commence le flou.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Faites glisser l’épingle pour déplacer la bande, ou son anneau pour modifier le flou. Faites glisser les lignes pleines pour élargir la bande nette, les lignes pointillées pour régler la transition et les points pour la faire pivoter.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Faites glisser les poignées du contour pour le redimensionner et le faire pivoter ; l’anneau règle l’angle de flou.+ Blur Angle Angle de flouIris Blur… Flou d'iris…Tilt-Shift… Inclinaison-décalage…Path Blur… Flou de tracé…diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsvindex 12fa86cd8..0404b429c 100644--- a/crates/ui-egui/src/i18n/hu.tsv+++ b/crates/ui-egui/src/i18n/hu.tsv@@ -564,6 +564,8 @@No pin selected Nincs kijelölt tűClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Kattints a képre tű hozzáadásához; húzd a tűt az áthelyezéséhez, vagy a gyűrűjét az elmosás módosításához. A Delete törli a kijelölt tűt.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Húzd a körvonal fogantyúit az átméretezéshez és az elforgatáshoz, a négyzetet a sarkok lekerekítéséhez, a belső pontokat pedig annak beállításához, hol kezdődjön az elmosás.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Húzd a tűt a sáv áthelyezéséhez, vagy a gyűrűjét az elmosás módosításához. Húzd a folytonos vonalakat az éles sáv szélesítéséhez, a szaggatott vonalakat az átmenet beállításához, a pontokat pedig a sáv elforgatásához.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Húzd a körvonal fogantyúit az átméretezéshez és az elforgatáshoz; a gyűrű az elmosás szögét állítja be.Fill Path… Útvonal kitöltése…Fill Screen Képernyő kitöltéseFilter Szűrődiff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsvindex 302e3cbf2..544ead05a 100644--- a/crates/ui-egui/src/i18n/id.tsv+++ b/crates/ui-egui/src/i18n/id.tsv@@ -540,6 +540,9 @@No pin selected Tidak ada pin yang dipilihClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Klik gambar untuk menambah pin; seret pin untuk memindahkannya, atau cincinnya untuk mengubah blur. Delete menghapus pin yang dipilih.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Seret pegangan pada garis luar untuk mengubah ukuran dan memutarnya, kotak untuk membulatkan sudutnya, dan titik di dalam untuk menentukan di mana blur dimulai.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Seret pin untuk memindahkan pita, atau cincinnya untuk mengubah blur. Seret garis utuh untuk melebarkan pita tajam, garis putus-putus untuk mengatur transisi, dan titik untuk memutarnya.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Seret pegangan pada garis luar untuk mengubah ukuran dan memutarnya; cincin mengatur sudut blur.+ Blur Angle Sudut BlurIris Blur… Iris Blur…Tilt-Shift… Tilt-Shift…Path Blur… Path Blur…diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsvindex db1fc16a4..40b468926 100644--- a/crates/ui-egui/src/i18n/it.tsv+++ b/crates/ui-egui/src/i18n/it.tsv@@ -555,6 +555,8 @@No pin selected Nessuna puntina selezionataClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Fai clic sull’immagine per aggiungere una puntina; trascina una puntina per spostarla o il suo anello per cambiare la sfocatura. Canc rimuove la puntina selezionata.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Trascina le maniglie sul contorno per ridimensionarlo e ruotarlo, il quadrato per arrotondarne gli angoli e i punti interni per stabilire dove inizia la sfocatura.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Trascina la puntina per spostare la banda o il suo anello per cambiare la sfocatura. Trascina le linee continue per allargare la banda nitida, quelle tratteggiate per la transizione e i punti per ruotarla.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Trascina le maniglie sul contorno per ridimensionarlo e ruotarlo; l’anello imposta l’angolo di sfocatura.Iris Blur… Sfocatura diaframma…Tilt-Shift… Miniatura…Path Blur… Sfocatura tracciato…diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsvindex 9a6042b80..1d64bf868 100644--- a/crates/ui-egui/src/i18n/ja.tsv+++ b/crates/ui-egui/src/i18n/ja.tsv@@ -557,6 +557,8 @@No pin selected ピンが選択されていませんClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. 画像をクリックしてピンを追加します。ピンをドラッグして移動し、リングをドラッグしてぼかしを変更します。Delete キーで選択したピンを削除します。Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. 輪郭上のハンドルをドラッグしてサイズ変更と回転、四角形で角の丸み、内側の点でぼかしの開始位置を設定します。+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. ピンをドラッグして帯を移動し、リングでぼかしを変更します。実線で鮮明な帯の幅、破線で移行範囲、点で回転を調整します。+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. 輪郭上のハンドルをドラッグしてサイズ変更と回転を行います。リングでぼかしの角度を設定します。Iris Blur… 虹彩絞りぼかし…Tilt-Shift… チルトシフト…Path Blur… パスぼかし…diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsvindex b39003858..e76a3c982 100644--- a/crates/ui-egui/src/i18n/ko.tsv+++ b/crates/ui-egui/src/i18n/ko.tsv@@ -544,6 +544,8 @@No pin selected 선택한 핀 없음Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. 이미지를 클릭하여 핀을 추가합니다. 핀을 드래그하여 이동하고, 링을 드래그하여 흐림 정도를 바꿉니다. Delete 키로 선택한 핀을 삭제합니다.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. 윤곽선의 핸들을 드래그하여 크기를 바꾸고 회전하고, 사각형으로 모서리를 둥글게 하며, 안쪽 점으로 흐림이 시작되는 위치를 설정합니다.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. 핀을 드래그하여 띠를 이동하고 링을 드래그하여 흐림 정도를 바꿉니다. 실선으로 선명한 띠를 넓히고, 점선으로 전환 범위를, 점으로 회전을 조정합니다.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. 윤곽선의 핸들을 드래그하여 크기를 바꾸고 회전합니다. 링으로 흐림 각도를 설정합니다.Iris Blur… 조리개 흐림 효과…Tilt-Shift… 기울기-이동…Path Blur… 패스 흐림 효과…diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsvindex b9d064a2b..2c9416c70 100644--- a/crates/ui-egui/src/i18n/nl.tsv+++ b/crates/ui-egui/src/i18n/nl.tsv@@ -547,6 +547,8 @@No pin selected Geen speld geselecteerdClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Klik in de afbeelding om een speld toe te voegen; sleep een speld om hem te verplaatsen, of zijn ring om de vervaging te wijzigen. Delete verwijdert de geselecteerde speld.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Sleep de grepen op de omtrek om hem te schalen en te draaien, het vierkantje om de hoeken af te ronden en de punten binnenin om in te stellen waar de vervaging begint.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Sleep de speld om de band te verplaatsen, of zijn ring om de vervaging te wijzigen. Sleep de doorgetrokken lijnen om de scherpe band te verbreden, de stippellijnen voor de overgang en de punten om hem te draaien.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Sleep de grepen op de omtrek om hem te schalen en te draaien; de ring stelt de vervagingshoek in.Iris Blur… Irisvervaging…Tilt-Shift… Tilt-shift…Path Blur… Padvervaging…diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsvindex d2f436041..eee1e61a9 100644--- a/crates/ui-egui/src/i18n/pl.tsv+++ b/crates/ui-egui/src/i18n/pl.tsv@@ -556,6 +556,8 @@No pin selected Nie zaznaczono pinezkiClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Kliknij obraz, aby dodać pinezkę; przeciągnij pinezkę, aby ją przesunąć, lub jej pierścień, aby zmienić rozmycie. Delete usuwa zaznaczoną pinezkę.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Przeciągnij uchwyty na obrysie, aby zmienić rozmiar i obrócić kształt, kwadrat, aby zaokrąglić narożniki, a punkty wewnątrz, aby ustawić, gdzie zaczyna się rozmycie.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Przeciągnij pinezkę, aby przesunąć pas, lub jej pierścień, aby zmienić rozmycie. Przeciągnij linie ciągłe, aby poszerzyć ostry pas, przerywane, aby ustawić przejście, a punkty, aby go obrócić.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Przeciągnij uchwyty na obrysie, aby zmienić rozmiar i obrócić kształt; pierścień ustawia kąt rozmycia.Iris Blur… Rozmycie irysowe…Tilt-Shift… Tilt-shift…Path Blur… Rozmycie ścieżki…diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsvindex 40e78664b..3e10fe7db 100644--- a/crates/ui-egui/src/i18n/pt-br.tsv+++ b/crates/ui-egui/src/i18n/pt-br.tsv@@ -541,6 +541,8 @@No pin selected Nenhum alfinete selecionadoClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Clique na imagem para adicionar um alfinete; arraste um alfinete para movê-lo ou o anel dele para alterar o desfoque. Delete remove o alfinete selecionado.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Arraste as alças do contorno para redimensionar e girar, o quadrado para arredondar os cantos e os pontos internos para definir onde o desfoque começa.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Arraste o alfinete para mover a faixa ou o anel para alterar o desfoque. Arraste as linhas contínuas para alargar a faixa nítida, as tracejadas para definir a transição e os pontos para girá-la.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Arraste as alças do contorno para redimensionar e girar; o anel define o ângulo de desfoque.Iris Blur… Desfoque de íris…Tilt-Shift… Tilt-shift…Path Blur… Desfoque de demarcador…diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsvindex ef8c350af..862788630 100644--- a/crates/ui-egui/src/i18n/ru.tsv+++ b/crates/ui-egui/src/i18n/ru.tsv@@ -347,6 +347,9 @@No pin selected Булавка не выбранаClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Щелкните изображение, чтобы добавить булавку; перетащите булавку, чтобы переместить ее, или ее кольцо, чтобы изменить размытие. Delete удаляет выбранную булавку.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Перетаскивайте маркеры на контуре, чтобы изменить размер и повернуть его, квадрат — чтобы скруглить углы, а точки внутри — чтобы задать, где начинается размытие.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Перетащите булавку, чтобы сдвинуть полосу, или ее кольцо, чтобы изменить размытие. Сплошные линии расширяют резкую полосу, пунктирные задают переход, а точки поворачивают ее.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Перетаскивайте маркеры на контуре, чтобы изменить размер и повернуть его; кольцо задает угол размытия.+ Blur Angle Угол размытияIris Blur… Диафрагменное размытие…Tilt-Shift… Наклон-сдвиг…Path Blur… Размытие по контуру…diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsvindex dc63af88d..b91b67b3e 100644--- a/crates/ui-egui/src/i18n/sr.tsv+++ b/crates/ui-egui/src/i18n/sr.tsv@@ -536,6 +536,8 @@No pin selected Nijedna čioda nije izabranaClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Kliknite na sliku da dodate čiodu; prevucite čiodu da je pomerite ili njen prsten da promenite zamućenje. Delete uklanja izabranu čiodu.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Prevucite ručke na obrisu da promenite veličinu i rotirate ga, kvadrat da zaoblite uglove, a tačke unutra da odredite gde zamućenje počinje.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Prevucite čiodu da pomerite traku ili njen prsten da promenite zamućenje. Prevucite pune linije da proširite oštru traku, isprekidane linije da podesite prelaz, a tačke da je rotirate.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Prevucite ručke na obrisu da promenite veličinu i rotirate ga; prsten određuje ugao zamućenja.Iris Blur… Iris zamućenje…Tilt-Shift… Tilt-shift…Path Blur… Zamućenje duž putanje…diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsvindex 48c4e5a48..4c8f06ccc 100644--- a/crates/ui-egui/src/i18n/tr.tsv+++ b/crates/ui-egui/src/i18n/tr.tsv@@ -535,6 +535,8 @@No pin selected Seçili pim yokClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Pim eklemek için görüntüye tıklayın; taşımak için pimi, bulanıklığını değiştirmek için halkasını sürükleyin. Delete seçili pimi siler.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Yeniden boyutlandırmak ve döndürmek için dış çizgideki tutamaçları, köşeleri yuvarlamak için kareyi, bulanıklığın nerede başlayacağını belirlemek için içerideki noktaları sürükleyin.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Bandı taşımak için pimi, bulanıklığını değiştirmek için halkasını sürükleyin. Keskin bandı genişletmek için düz çizgileri, geçişi ayarlamak için kesikli çizgileri, döndürmek için noktaları sürükleyin.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Yeniden boyutlandırmak ve döndürmek için dış çizgideki tutamaçları sürükleyin; halka bulanıklık açısını belirler.Iris Blur… İris Bulanıklığı…Tilt-Shift… Tilt-Shift…Path Blur… Yol Bulanıklığı…diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsvindex f31ed9857..39597c15c 100644--- a/crates/ui-egui/src/i18n/uk.tsv+++ b/crates/ui-egui/src/i18n/uk.tsv@@ -325,6 +325,8 @@No pin selected Шпильку не вибраноClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Клацніть зображення, щоб додати шпильку; перетягніть шпильку, щоб перемістити її, або її кільце, щоб змінити розмиття. Delete видаляє вибрану шпильку.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Перетягуйте маркери на контурі, щоб змінити розмір і повернути його, квадрат — щоб заокруглити кути, а точки всередині — щоб задати, де починається розмиття.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Перетягніть шпильку, щоб зсунути смугу, або її кільце, щоб змінити розмиття. Суцільні лінії розширюють різку смугу, пунктирні задають перехід, а точки повертають її.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Перетягуйте маркери на контурі, щоб змінити розмір і повернути його; кільце задає кут розмиття.Iris Blur… Розмиття діафрагми…Tilt-Shift… Нахил і зсув…Path Blur… Розмиття вздовж контуру…diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsvindex cf71b0e48..ac7123d85 100644--- a/crates/ui-egui/src/i18n/vi.tsv+++ b/crates/ui-egui/src/i18n/vi.tsv@@ -512,6 +512,8 @@No pin selected Chưa chọn ghim nàoClick the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Bấm vào ảnh để thêm ghim; kéo ghim để di chuyển, hoặc kéo vòng của ghim để đổi độ mờ. Delete xóa ghim đã chọn.Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Kéo các tay nắm trên đường viền để đổi kích thước và xoay, kéo ô vuông để bo tròn góc, và kéo các chấm bên trong để đặt nơi bắt đầu làm mờ.+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. Kéo ghim để di chuyển dải, hoặc kéo vòng của ghim để đổi độ mờ. Kéo các đường liền để nới rộng dải sắc nét, các đường nét đứt để đặt vùng chuyển tiếp, và các chấm để xoay dải.+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. Kéo các tay nắm trên đường viền để đổi kích thước và xoay; vòng tròn đặt góc làm mờ.Filter Gallery… Thư viện bộ lọc…Find Edges Tìm cạnhFlame… Ngọn lửa…diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsvindex c33095fef..2307739ed 100644--- a/crates/ui-egui/src/i18n/zh-hans.tsv+++ b/crates/ui-egui/src/i18n/zh-hans.tsv@@ -562,6 +562,9 @@No pin selected 未选择图钉Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. 单击图像以添加图钉;拖动图钉可移动它,拖动其圆环可更改模糊程度。按 Delete 键删除所选图钉。Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. 拖动轮廓上的手柄可调整大小并旋转,拖动方块可将角变圆,拖动内部的点可设置模糊开始的位置。+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. 拖动图钉可移动条带,拖动其圆环可更改模糊程度。拖动实线可加宽清晰条带,拖动虚线可设置过渡,拖动圆点可旋转。+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. 拖动轮廓上的手柄可调整大小并旋转;圆环设置模糊角度。+ Blur Angle 模糊角度Iris Blur… 光圈模糊…Tilt-Shift… 移轴模糊…Path Blur… 路径模糊…diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsvindex 565560d36..478489f8c 100644--- a/crates/ui-egui/src/i18n/zh-hant.tsv+++ b/crates/ui-egui/src/i18n/zh-hant.tsv@@ -567,6 +567,9 @@No pin selected 未選取圖釘Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. 按一下影像即可新增圖釘;拖移圖釘可移動它,拖移其圓環可變更模糊程度。按 Delete 鍵刪除所選圖釘。Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. 拖移輪廓上的控點可調整大小並旋轉,拖移方塊可將角變圓,拖移內部的點可設定模糊開始的位置。+ Drag the pin to move the band, or its ring to change its blur. Drag the solid lines to widen the sharp band, the dashed lines to set the transition, and the dots to turn it. 拖移圖釘可移動條帶,拖移其圓環可變更模糊程度。拖移實線可加寬清晰條帶,拖移虛線可設定過渡,拖移圓點可旋轉。+ Drag the handles on the outline to resize and turn it; the ring sets the blur angle. 拖移輪廓上的控點可調整大小並旋轉;圓環設定模糊角度。+ Blur Angle 模糊角度Iris Blur… 光圈模糊…Tilt-Shift… 傾斜偏移…Path Blur… 路徑模糊…diff --git a/docs/gaps.md b/docs/gaps.mdindex 02efb1b5d..52b467b2d 100644--- a/docs/gaps.md+++ b/docs/gaps.md@@ -69,9 +69,9 @@ what an agent can't finish alone.(TOOL-214-15); Vanishing Point plane editor (TOOL-214-14); Content-Aware Move's live previewof the result (TOOL-213-4; Transform On Drop and Content-Aware Scale through the transform box,TOOL-214-7, are done).- Blur Gallery: Field Blur's pins and Iris Blur's pins with their outline, roundness and feather- handles are edited on the image (2026-10-11, #3373); Tilt-Shift, Spin and Path Blur are still- parameter dialogs.+ Blur Gallery: Field, Iris, Tilt-Shift and Spin Blur are edited on the image with Photoshop's pins+ and handles (2026-10-11, #3373); Tilt-Shift has one band (the engine takes one), and Path Blur+ (#1759) is still a parameter dialog.- **Evidence:** scorecard rows above, all partial or missing.- **Impact:** these are the tools retouchers and compositors use daily; a slider dialog is not asubstitute.@@ -291,6 +291,7 @@ what an agent can't finish alone.| 2026-10-12 | minor | G4: checkbox-only Brush Settings rows preserve the open controls and Smoothing settings (#4283); no readiness percentage or estimate changed || 2026-10-12 | minor | G11: Load/Save Actions `.atn` landed (AUTO-219-2 partial); remaining panel work listed || 2026-10-12 | minor | Refreshed against main: G5 items fixed by #2480, #2327, #2609, #2684, #2675, #2556, #2396, #2527, #2625 and TOOL-214-5/#2442; G7 TOOL-214-7 and Transform On Drop done; G2 #2377 fixed (#2417); G9 UI scale (UI-217-9) and Stamp Visible (UI-217-22) done, prefs 27 of 156; G10 #2225 done (#2482); G13 Khmer, Lao, Myanmar fallback (#3259); G14 CR3 line; G17 Windows ARM64 done (DIST-220-2) |+| 2026-10-11 | minor | G7: Tilt-Shift's band (lines, turn dots) and Spin Blur's pins (outline handles, blur-angle ring) on the image; Path Blur remains a dialog || 2026-10-11 | minor | G7: Iris Blur's pins, outline, roundness and feather handles on the image too; Tilt-Shift, Spin and Path Blur remain dialogs || 2026-10-11 | minor | G7: Field Blur pins are placed, dragged and tuned on the image (#3373); the other Blur Gallery filters remain dialogs || 2026-10-11 | minor | D5100 image area and Camera Raw tuning validation; G14 remains open |