diff --git a/crates/engine/src/canvas/vectoredit.rs b/crates/engine/src/canvas/vectoredit.rs index ab9fcb79f..ff8af30a4 100644 --- a/crates/engine/src/canvas/vectoredit.rs +++ b/crates/engine/src/canvas/vectoredit.rs @@ -7,6 +7,8 @@ //! the transform box around several points (in one layer or several) in [`transform`], point snapping in `point_snap.rs` and //! hovering, hatching and selecting filled regions in [`regions`]. +#[cfg(test)] +mod align_tests; pub mod ops; pub(crate) mod point_snap; mod pointer; diff --git a/crates/engine/src/canvas/vectoredit/align_tests.rs b/crates/engine/src/canvas/vectoredit/align_tests.rs new file mode 100644 index 000000000..323929563 --- /dev/null +++ b/crates/engine/src/canvas/vectoredit/align_tests.rs @@ -0,0 +1,261 @@ +//! Align and distribute the selected points in vector edit mode. + +use serde_json::json; + +use super::tests::{ex, net, pt, ve}; +use super::*; + +/// The measured path: points at (330, 480), (480, 430), (560, 560), (380, 620), in edit mode. +fn path(s: &mut Session) -> NodeId { + let r = ex(s, "vector.create", json!({"points": [[330, 480], [480, 430], [560, 560], [380, 620]], "closed": false})); + let id = crate::params::id_of(&r["id"]).unwrap(); + ex(s, "vector.edit.begin", json!({"id": id})); + id +} + +fn page(s: &Session, id: NodeId) -> Vec { + let w = s.doc().unwrap().world_transform(id); + net(s, id).vertices.iter().map(|v| w * v.point()).collect() +} + +fn page_of(s: &Session, id: NodeId, p: Point) -> Point { + s.doc().unwrap().world_transform(id) * p +} + +fn select(s: &mut Session, v: &[usize]) { + ex(s, "vector.edit.select", json!({"vertices": v})); +} + +fn near(a: Point, b: Point) -> bool { + (a - b).hypot() < 1e-6 +} + +#[test] +fn each_alignment_moves_the_points_along_one_axis_to_their_box() { + // Points 0 and 1: box x 330..480, y 430..480. + let cases = [ + ("align.left", [pt(330.0, 480.0), pt(330.0, 430.0)]), + ("align.hcenter", [pt(405.0, 480.0), pt(405.0, 430.0)]), + ("align.right", [pt(480.0, 480.0), pt(480.0, 430.0)]), + ("align.top", [pt(330.0, 430.0), pt(480.0, 430.0)]), + ("align.vcenter", [pt(330.0, 455.0), pt(480.0, 455.0)]), + ("align.bottom", [pt(330.0, 480.0), pt(480.0, 480.0)]), + ]; + for (cmd, want) in cases { + let mut s = Session::new(); + let id = path(&mut s); + let before = page(&s, id); + select(&mut s, &[0, 1]); + ex(&mut s, cmd, json!({})); + let after = page(&s, id); + assert!(near(after[0], want[0]) && near(after[1], want[1]), "{cmd}: {after:?}"); + assert!(near(after[2], before[2]) && near(after[3], before[3]), "{cmd} left the others"); + } +} + +#[test] +fn one_point_does_not_move() { + let mut s = Session::new(); + let id = path(&mut s); + let before = page(&s, id); + select(&mut s, &[1]); + for c in ["align.left", "align.bottom", "distribute.horizontal"] { + ex(&mut s, c, json!({})); + } + assert_eq!(page(&s, id), before); +} + +#[test] +fn two_points_do_not_distribute() { + let mut s = Session::new(); + let id = path(&mut s); + let before = page(&s, id); + select(&mut s, &[0, 1]); + for c in ["distribute.horizontal", "distribute.vertical"] { + ex(&mut s, c, json!({})); + } + assert_eq!(page(&s, id), before); +} + +/// A vector inside a frame at (100, 100), its left (150) well inside the frame. +fn framed(s: &mut Session) -> (NodeId, NodeId) { + let f = crate::params::id_of(&ex(s, "frame.create", json!({"x": 100, "y": 100, "width": 400, "height": 400}))["id"]).unwrap(); + let r = ex(s, "vector.create", json!({"points": [[50, 100], [150, 50], [200, 200]], "closed": false, "parent": f})); + (f, crate::params::id_of(&r["id"]).unwrap()) +} + +const ALIGNS: [&str; 6] = ["align.left", "align.hcenter", "align.right", "align.top", "align.vcenter", "align.bottom"]; + +#[test] +fn no_points_selected_moves_nothing_and_not_the_layer() { + let mut s = Session::new(); + let (frame, v) = framed(&mut s); + ex(&mut s, "vector.edit.begin", json!({"id": v})); + ex(&mut s, "vector.edit.select", json!({"vertices": []})); + assert_eq!(transform::edit_point_count(s.doc().unwrap(), &ve(&s)), 0); + let (points, bounds, local) = (page(&s, v), s.doc().unwrap().world_bounds(v), net(&s, v).vertices); + assert!(bounds.unwrap().x0 > s.doc().unwrap().world_bounds(frame).unwrap().x0 + 10.0, "starts well inside the frame"); + for c in ALIGNS.into_iter().chain(["distribute.horizontal", "distribute.vertical"]) { + ex(&mut s, c, json!({})); + assert_eq!(page(&s, v), points, "{c}"); + assert_eq!(s.doc().unwrap().world_bounds(v), bounds, "{c} moved the layer"); + assert_eq!(net(&s, v).vertices, local, "{c}"); + } +} + +#[test] +fn points_of_several_layers_align_and_one_undo_restores_all() { + let mut s = Session::new(); + let mut line = |p: serde_json::Value| crate::params::id_of(&ex(&mut s, "vector.create", json!({"points": p, "closed": false}))["id"]).unwrap(); + let (a, b) = (line(json!([[0, 100], [100, 150]])), line(json!([[300, 40], [400, 90]]))); + ex(&mut s, "vector.edit.begin", json!({"ids": [a, b]})); + ex(&mut s, "vector.edit.select", json!({"id": a, "vertices": [0]})); + ex(&mut s, "vector.edit.select", json!({"id": b, "vertices": [1], "add": true})); + let (pa, pb) = (page(&s, a), page(&s, b)); + ex(&mut s, "align.top", json!({})); + let (na, nb) = (page(&s, a), page(&s, b)); + let top = pa[0].y.min(pb[1].y); + assert!(near(na[0], pt(pa[0].x, top)) && near(nb[1], pt(pb[1].x, top)), "{na:?} {nb:?}"); + assert!(near(na[1], pa[1]) && near(nb[0], pb[0]), "unselected points stay"); + s.undo().unwrap(); + let (ua, ub) = (page(&s, a), page(&s, b)); + assert!(pa.iter().zip(&ua).chain(pb.iter().zip(&ub)).all(|(x, y)| near(*x, *y)), "{ua:?} {ub:?}"); +} + +#[test] +fn a_rotated_layer_aligns_in_the_boxs_own_frame() { + let mut s = Session::new(); + let id = path(&mut s); + ex(&mut s, "node.set", json!({"id": id, "props": {"rotation": 30}})); + select(&mut s, &[0, 1]); + let b = transform::point_box(s.doc().unwrap(), &ve(&s)).unwrap(); + let inv = b.frame.inverse(); + let before: Vec = page(&s, id).iter().map(|p| inv * *p).collect(); + assert!((before[0].x - before[1].x).abs() > 1.0, "the points differ in box x"); + ex(&mut s, "align.left", json!({})); + let after: Vec = page(&s, id).iter().map(|p| inv * *p).collect(); + for i in 0..2 { + assert!(after[i].x.abs() < 1e-6, "box x is the box's left: {after:?}"); + assert!((after[i].y - before[i].y).abs() < 1e-6, "box y unchanged: {after:?}"); + } +} + +#[test] +fn id_in_edit_mode_moves_the_layer_not_the_points() { + let mut s = Session::new(); + let (frame, v) = framed(&mut s); + ex(&mut s, "vector.edit.begin", json!({"id": v})); + select(&mut s, &[0, 1]); + let local = net(&s, v).vertices; + ex(&mut s, "align.left", json!({"id": v})); + let d = s.doc().unwrap(); + assert!((d.world_bounds(v).unwrap().x0 - d.world_bounds(frame).unwrap().x0).abs() < 1e-6, "layer at the frame's left"); + assert_eq!(net(&s, v).vertices, local, "points were not aligned to each other"); +} + +#[test] +fn ids_distribute_layers_and_leave_the_edited_layers_points() { + let mut s = Session::new(); + let mut rect = |x: f64| crate::params::id_of(&ex(&mut s, "shape.rectangle", json!({"x": x, "y": 0, "width": 50, "height": 50}))["id"]).unwrap(); + let (r1, r2, r3) = (rect(0.0), rect(60.0), rect(400.0)); + ex(&mut s, "vector.edit.begin", json!({"id": r2})); + select(&mut s, &[0, 1]); + let local = net(&s, r2).vertices; + ex(&mut s, "distribute.horizontal", json!({"ids": [r1, r2, r3]})); + let x0 = s.doc().unwrap().world_bounds(r2).unwrap().x0; + assert!((x0 - 200.0).abs() < 1e-6, "middle layer centred between the outer two: {x0}"); + assert_eq!(net(&s, r2).vertices, local); +} + +#[test] +fn distribute_spaces_the_points_evenly_between_the_outermost() { + let mut s = Session::new(); + let id = path(&mut s); + select(&mut s, &[0, 1, 2, 3]); + ex(&mut s, "distribute.horizontal", json!({})); + let p = page(&s, id); + let want_x = [330.0, 483.0 + 1.0 / 3.0, 560.0, 380.0 + 80.0 / 3.0]; + for (q, x) in p.iter().zip(want_x) { + assert!((q.x - x).abs() < 1e-6, "{p:?}"); + } + let want_y = [480.0, 430.0, 560.0, 620.0]; + assert!(p.iter().zip(want_y).all(|(q, y)| (q.y - y).abs() < 1e-6), "y unchanged: {p:?}"); + + ex(&mut s, "distribute.vertical", json!({})); + let p = page(&s, id); + // y sorted 430, 480, 560, 620 spread over 430..620. + let step = 190.0 / 3.0; + let want_y = [430.0 + step, 430.0, 430.0 + 2.0 * step, 620.0]; + assert!(p.iter().zip(want_y).all(|(q, y)| (q.y - y).abs() < 1e-6), "{p:?}"); +} + +#[test] +fn a_curved_points_handles_move_with_it() { + let mut s = Session::new(); + let r = ex(&mut s, "vector.create", json!({"path": "M 0 0 C 0 50 50 100 100 100 L 200 0", "x": 0, "y": 0})); + let id = crate::params::id_of(&r["id"]).unwrap(); + ex(&mut s, "vector.edit.begin", json!({"id": id})); + let before = net(&s, id); + let page_before = page(&s, id); + let handle = |s: &Session, n: &VectorNetwork, v: usize, t: (f64, f64)| page_of(s, id, n.vertices[v].point() + Vec2::new(t.0, t.1)); + let (h1_before, h0_before) = (handle(&s, &before, 1, before.segments[0].tb), handle(&s, &before, 0, before.segments[0].ta)); + select(&mut s, &[0, 1]); + ex(&mut s, "align.left", json!({})); + let after = net(&s, id); + let moved: Vec = (0..2).filter(|i| !near(page(&s, id)[*i], page_before[*i])).collect(); + assert!(!moved.is_empty(), "something moved"); + let p = page(&s, id); + assert!(near(p[0], pt(0.0, 0.0)) && near(p[1], pt(0.0, 100.0)), "{p:?}"); + assert!(near(p[2], page_before[2]), "vertex 2 stays"); + // Handles: vertex 1's incoming one (vertex + segment 0's `tb`) moves with it by (-100, 0). + let a0 = &after.segments[0]; + assert!(near(h1_before, pt(50.0, 100.0)) && near(handle(&s, &after, 1, a0.tb), pt(-50.0, 100.0)), "vertex 1's handle moved by (-100, 0)"); + assert!(near(h0_before, handle(&s, &after, 0, a0.ta)), "vertex 0's handle stays"); + assert_eq!(before.segments.len(), after.segments.len()); + for (a, b) in before.segments.iter().zip(&after.segments) { + assert_eq!((a.ta, a.tb), (b.ta, b.tb), "handle offsets travel with their vertex"); + } +} + +#[test] +fn one_undo_restores_the_points() { + let mut s = Session::new(); + let id = path(&mut s); + let before = page(&s, id); + select(&mut s, &[0, 1, 2, 3]); + ex(&mut s, "align.right", json!({})); + assert_ne!(page(&s, id), before); + s.undo().unwrap(); + let after = page(&s, id); + assert!(before.iter().zip(&after).all(|(a, b)| near(*a, *b)), "{after:?}"); +} + +#[test] +fn ids_in_edit_mode_still_align_layers() { + let mut s = Session::new(); + let mut square = |x: f64| crate::params::id_of(&ex(&mut s, "shape.rectangle", json!({"x": x, "y": 0, "width": 50, "height": 50}))["id"]).unwrap(); + let (a, b) = (square(0.0), square(200.0)); + ex(&mut s, "vector.edit.begin", json!({"id": a})); + select(&mut s, &[0, 1]); + let local = net(&s, a).vertices; + ex(&mut s, "align.left", json!({"ids": [a, b]})); + let x = |id| s.doc().unwrap().world_bounds(id).unwrap().x0; + assert!((x(a) - x(b)).abs() < 1e-6, "layers aligned"); + assert_eq!(net(&s, a).vertices, local, "the selected points kept their local positions"); +} + +#[test] +fn a_segment_selected_in_another_edited_layer_counts_both_its_ends() { + // `a`'s segment (two ends) and `b`'s first point: three points, so the panel offers + // Distribute and the command spaces all three. + let mut s = Session::new(); + let mut line = |p: serde_json::Value| crate::params::id_of(&ex(&mut s, "vector.create", json!({"points": p, "closed": false}))["id"]).unwrap(); + let (a, b) = (line(json!([[0, 0], [100, 50]])), line(json!([[300, 200], [400, 260]]))); + ex(&mut s, "vector.edit.begin", json!({"ids": [a, b]})); + ex(&mut s, "vector.edit.select", json!({"id": a, "segments": [0]})); + ex(&mut s, "vector.edit.select", json!({"id": b, "vertices": [0], "add": true})); + assert_eq!(transform::edit_point_count(s.doc().unwrap(), &ve(&s)), 3); + ex(&mut s, "distribute.horizontal", json!({})); + let xs: Vec = page(&s, a).iter().chain(page(&s, b).first()).map(|p| p.x).collect(); + assert!(xs.iter().zip([0.0, 150.0, 300.0]).all(|(x, w)| (x - w).abs() < 1e-6), "{xs:?}"); +} diff --git a/crates/engine/src/canvas/vectoredit/transform.rs b/crates/engine/src/canvas/vectoredit/transform.rs index 0f87a0bd5..0eaacb185 100644 --- a/crates/engine/src/canvas/vectoredit/transform.rs +++ b/crates/engine/src/canvas/vectoredit/transform.rs @@ -172,6 +172,126 @@ pub fn transform_in_edit_mode(s: &mut Session, p: &Value, f: impl FnOnce(&PointB Some(s.doc_mut().and_then(|doc| transform_points(doc, ve.id, &b.points, m)).map(|()| json!({"ok": true}))) } +/// Which edge or centre line of the selected points' box each point goes to. +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum PointAlign { + Left, + HCenter, + Right, + Top, + VCenter, + Bottom, +} + +/// Every selected point of `b` in every layer as (layer, vertex, page position). +fn page_points(doc: &Document, b: &PointBox, id: NodeId) -> Vec<(NodeId, usize, Point)> { + let layers = std::iter::once((id, &b.points)).chain(b.others.iter().map(|(o, v)| (*o, v))); + layers + .flat_map(|(l, verts)| { + let w = doc.world_transform(l); + let net = network(doc, l); + verts.iter().filter_map(move |v| net.and_then(|n| n.vertices.get(*v)).map(|vx| (l, *v, w * vx.point()))).collect::>() + }) + .collect() +} + +/// The box to align or distribute in: all edited layers' points when several are selected. +fn edit_box(doc: &Document, ve: &VectorEdit) -> Option { + let b = if ve.others_selected() { layers_box(doc, ve) } else { point_box(doc, ve) }; + b.filter(|b| b.point_count() > 0) +} + +/// How many points align and distribute act on: the selected points and selected segments' ends +/// of every edited layer. +pub fn edit_point_count(doc: &Document, ve: &VectorEdit) -> usize { + edit_box(doc, ve).map_or(0, |b| b.point_count()) +} + +/// Move each point by its own page delta, one vertex at a time (handles go with their vertex). +fn move_each(doc: &mut Document, moves: &[(NodeId, usize, Point)]) -> Result<()> { + for (l, v, d) in moves { + if d.x.is_finite() && d.y.is_finite() && (d.x != 0.0 || d.y != 0.0) { + transform_points(doc, *l, &[*v], Affine::translate((d.x, d.y)))?; + } + } + Ok(()) +} + +/// The page delta of moving by `(dx, dy)` along the box's axes. +fn along(frame: Affine, dx: f64, dy: f64) -> Point { + let [a, b, c, d, _, _] = frame.as_coeffs(); + Point::new(a * dx + c * dy, b * dx + d * dy) +} + +/// Align the selected points to their box's edge or centre line (`None` when edit mode is off or +/// the command names layers; with no points selected in edit mode nothing moves, and the edited +/// layer is not aligned to its parent). Each point moves along one axis of the box only; fewer than +/// two points stay put. +pub fn align_points_in_edit_mode(s: &mut Session, p: &Value, how: PointAlign) -> Option> { + if get(p, "ids").is_some() || get(p, "id").is_some() { + return None; + } + let ve = editing(s).ok()?; + let Some(b) = edit_box(s.doc().ok()?, &ve) else { + return Some(Ok(json!({"ok": true}))); + }; + let pts = page_points(s.doc().ok()?, &b, ve.id); + let inv = b.frame.inverse(); + let moves: Vec<(NodeId, usize, Point)> = if b.point_count() < 2 { + vec![] + } else { + pts.iter() + .map(|(l, v, pg)| { + let q = inv * *pg; + let (dx, dy) = match how { + PointAlign::Left => (-q.x, 0.0), + PointAlign::HCenter => (b.width / 2.0 - q.x, 0.0), + PointAlign::Right => (b.width - q.x, 0.0), + PointAlign::Top => (0.0, -q.y), + PointAlign::VCenter => (0.0, b.height / 2.0 - q.y), + PointAlign::Bottom => (0.0, b.height - q.y), + }; + (*l, *v, along(b.frame, dx, dy)) + }) + .collect() + }; + Some(s.doc_mut().and_then(|doc| move_each(doc, &moves)).map(|()| json!({"ok": true}))) +} + +/// Space the selected points evenly along the box's x (or y) axis between the outermost two, in +/// order along it (`None` when edit mode is off or the command names layers; with no points +/// selected in edit mode nothing moves). Fewer than three points stay put. +pub fn distribute_points_in_edit_mode(s: &mut Session, p: &Value, horizontal: bool) -> Option> { + if get(p, "ids").is_some() || get(p, "id").is_some() { + return None; + } + let ve = editing(s).ok()?; + let Some(b) = edit_box(s.doc().ok()?, &ve) else { + return Some(Ok(json!({"ok": true}))); + }; + let pts = page_points(s.doc().ok()?, &b, ve.id); + let inv = b.frame.inverse(); + let mut items: Vec<(NodeId, usize, Point)> = pts.iter().map(|(l, v, pg)| (*l, *v, inv * *pg)).collect(); + let axis = |q: &Point| if horizontal { q.x } else { q.y }; + items.sort_by(|a, c| axis(&a.2).total_cmp(&axis(&c.2))); + let n = items.len(); + let moves: Vec<(NodeId, usize, Point)> = if n < 3 { + vec![] + } else { + let (lo, hi) = (0.0, if horizontal { b.width } else { b.height }); + items + .iter() + .enumerate() + .map(|(k, (l, v, q))| { + let target = lo + (hi - lo) * k as f64 / (n - 1) as f64; + let d = target - axis(q); + (*l, *v, if horizontal { along(b.frame, d, 0.0) } else { along(b.frame, 0.0, d) }) + }) + .collect() + }; + Some(s.doc_mut().and_then(|doc| move_each(doc, &moves)).map(|()| json!({"ok": true}))) +} + /// The selected points' box, or an error naming `cmd`. fn selected_box(s: &Session, cmd: &str) -> Result<(VectorEdit, PointBox)> { let ve = editing(s)?; diff --git a/crates/engine/src/canvas/vectoredit/transform_tests.rs b/crates/engine/src/canvas/vectoredit/transform_tests.rs index eb2f96f5e..7d6206ea7 100644 --- a/crates/engine/src/canvas/vectoredit/transform_tests.rs +++ b/crates/engine/src/canvas/vectoredit/transform_tests.rs @@ -315,9 +315,23 @@ fn edit_mode_transform_commands_survive_junk() { json!({"width": -1e308, "height": "x", "center": "maybe", "angle": 1e308, "cx": "NaN", "matrix": [1, 2, 3, "a", 5, 6]}), json!({"matrix": [0, 0, 0, 0, 0, 0], "vertices": [1e12, -1], "width": 1e308, "height": 0}), ]; - for c in - ["object.flipH", "object.flipV", "object.rotate180", "object.rotateLeft", "object.rotateRight", "vector.edit.resize", "vector.edit.rotate"] - { + for c in [ + "object.flipH", + "object.flipV", + "object.rotate180", + "object.rotateLeft", + "object.rotateRight", + "vector.edit.resize", + "vector.edit.rotate", + "align.left", + "align.hcenter", + "align.right", + "align.top", + "align.vcenter", + "align.bottom", + "distribute.horizontal", + "distribute.vertical", + ] { for j in &junk { let mut s = Session::new(); let id = rect(&mut s); diff --git a/crates/engine/src/cmd/arrange.rs b/crates/engine/src/cmd/arrange.rs index d32064271..ea7a8830e 100644 --- a/crates/engine/src/cmd/arrange.rs +++ b/crates/engine/src/cmd/arrange.rs @@ -11,14 +11,62 @@ use crate::{Result, Session, bad, spec}; pub fn specs() -> Vec { vec![ - spec!("align.left", "Align left", "{ids?}", true, |s, p| align(s, p, Al::Left)), - spec!("align.hcenter", "Align horizontal centers", "{ids?}", true, |s, p| align(s, p, Al::HCenter)), - spec!("align.right", "Align right", "{ids?}", true, |s, p| align(s, p, Al::Right)), - spec!("align.top", "Align top", "{ids?}", true, |s, p| align(s, p, Al::Top)), - spec!("align.vcenter", "Align vertical centers", "{ids?}", true, |s, p| align(s, p, Al::VCenter)), - spec!("align.bottom", "Align bottom", "{ids?}", true, |s, p| align(s, p, Al::Bottom)), - spec!("distribute.horizontal", "Distribute horizontal spacing", "{ids?, spacing?}", true, |s, p| distribute(s, p, true)), - spec!("distribute.vertical", "Distribute vertical spacing", "{ids?, spacing?}", true, |s, p| distribute(s, p, false)), + spec!( + "align.left", + "Align left", + "{ids?} (in vector edit mode without ids: the selected points, and nothing moves with none selected)", + true, + |s, p| align(s, p, Al::Left) + ), + spec!( + "align.hcenter", + "Align horizontal centers", + "{ids?} (in vector edit mode without ids: the selected points, and nothing moves with none selected)", + true, + |s, p| align(s, p, Al::HCenter) + ), + spec!( + "align.right", + "Align right", + "{ids?} (in vector edit mode without ids: the selected points, and nothing moves with none selected)", + true, + |s, p| align(s, p, Al::Right) + ), + spec!( + "align.top", + "Align top", + "{ids?} (in vector edit mode without ids: the selected points, and nothing moves with none selected)", + true, + |s, p| align(s, p, Al::Top) + ), + spec!( + "align.vcenter", + "Align vertical centers", + "{ids?} (in vector edit mode without ids: the selected points, and nothing moves with none selected)", + true, + |s, p| align(s, p, Al::VCenter) + ), + spec!( + "align.bottom", + "Align bottom", + "{ids?} (in vector edit mode without ids: the selected points, and nothing moves with none selected)", + true, + |s, p| align(s, p, Al::Bottom) + ), + spec!( + "distribute.horizontal", + "Distribute horizontal spacing", + "{ids?, spacing?} (in vector edit mode without ids: the selected points, and nothing moves with none selected)", + true, + |s, p| distribute(s, p, true) + ), + spec!( + "distribute.vertical", + "Distribute vertical spacing", + "{ids?, spacing?} (in vector edit mode without ids: the selected points, and nothing moves with none selected)", + true, + |s, p| distribute(s, p, false) + ), spec!( "arrange.spacing", "Spacing", @@ -192,6 +240,18 @@ fn align_target(doc: &Document, roots: &[NodeId]) -> Option { } fn align(s: &mut Session, p: &Value, a: Al) -> Result { + use crate::vectoredit::transform::PointAlign; + let how = match a { + Al::Left => PointAlign::Left, + Al::HCenter => PointAlign::HCenter, + Al::Right => PointAlign::Right, + Al::Top => PointAlign::Top, + Al::VCenter => PointAlign::VCenter, + Al::Bottom => PointAlign::Bottom, + }; + if let Some(r) = crate::vectoredit::transform::align_points_in_edit_mode(s, p, how) { + return r; + } let ids = req_targets("align", s, p)?; let doc = s.doc_mut()?; let ids = roots(doc, &ids); @@ -212,6 +272,9 @@ fn align(s: &mut Session, p: &Value, a: Al) -> Result { } fn distribute(s: &mut Session, p: &Value, horizontal: bool) -> Result { + if let Some(r) = crate::vectoredit::transform::distribute_points_in_edit_mode(s, p, horizontal) { + return r; + } let ids = req_targets("distribute", s, p)?; let doc = s.doc_mut()?; let ids = roots(doc, &ids); diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 692b55ff0..80cc05bbc 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -300,6 +300,8 @@ mod variables_window_resize_tests; #[cfg(test)] mod variants_discovery_tests; #[cfg(test)] +mod vector_align_tests; +#[cfg(test)] mod vector_keys_tests; #[cfg(test)] mod vector_panel_tests; diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index 9446279fe..9243ab3a3 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -671,7 +671,7 @@ pub(crate) fn tidy_available(ctx: &egui::Context, doc: &Arc, sel: &[No fn position_fields(app: &mut FigApp, ui: &mut Ui, doc: &Arc, sel: &[NodeId]) { let pv = position_values(ui.ctx(), doc, sel); let col = widgets::col_width(ui.available_width()); - align_row(app, ui, sel, pv.can_align, pv.align_blocked, col); + align_row(app, ui, AlignTarget::Layers(sel), pv.can_align, pv.align_blocked, col); position_row(app, ui, doc, sel, &pv, col); rotation_row(app, ui, doc, sel, pv.rot, col); if pv.in_frame { @@ -679,9 +679,24 @@ fn position_fields(app: &mut FigApp, ui: &mut Ui, doc: &Arc, sel: &[No } } -/// Alignment, and distribution and tidy up for three or more layers. -fn align_row(app: &mut FigApp, ui: &mut Ui, sel: &[NodeId], can_align: bool, blocked: bool, col: f32) { - let ids = sel.to_vec(); +/// What the alignment row acts on. +#[derive(Clone, Copy)] +pub enum AlignTarget<'a> { + /// These layers (distribution and tidy up from three). + Layers(&'a [NodeId]), + /// The selected points in vector edit mode, this many of them (distribution from three, no + /// tidy up). + Points(usize), +} + +/// Alignment, and distribution and tidy up for three or more layers (or the selected points). +pub fn align_row(app: &mut FigApp, ui: &mut Ui, target: AlignTarget, can_align: bool, blocked: bool, col: f32) { + let (ids, count, points) = match target { + AlignTarget::Layers(sel) => (sel.to_vec(), sel.len(), false), + AlignTarget::Points(n) => (vec![], n, true), + }; + // Points take the commands with no ids: they act on the selected points. + let params = || if points { json!({}) } else { json!({"ids": ids}) }; widgets::sublabels(ui, tr("Alignment"), None); row(ui, 32.0, |ui| { let cmds = ["align.left", "align.hcenter", "align.right", "align.top", "align.vcenter", "align.bottom"]; @@ -707,24 +722,26 @@ fn align_row(app: &mut FigApp, ui: &mut Ui, sel: &[NodeId], can_align: bool, blo }; picked.response.on_disabled_hover_text(why); if let Some(i) = picked.inner { - app.run(cmds[i], json!({"ids": ids})); + app.run(cmds[i], params()); } - if sel.len() > 2 { + if count > 2 { let more = icons::button(ui, Icon::DistributeH, 24.0, false, tr("Distribute and tidy")); menu_popup(&more).show(|ui| { - let can_tidy = app.session.ds().is_ok_and(|ds| tidy_available(ui.ctx(), &ds.doc, &ids)); - for (l, c, on) in [ + let can_tidy = !points && app.session.ds().is_ok_and(|ds| tidy_available(ui.ctx(), &ds.doc, &ids)); + let tidy = (tr("Tidy up"), "arrange.tidy", can_tidy); + let entries = [ (tr("Distribute horizontal spacing"), "distribute.horizontal", true), (tr("Distribute vertical spacing"), "distribute.vertical", true), - (tr("Tidy up"), "arrange.tidy", can_tidy), - ] { + ]; + // Points have no tidy up. + for (l, c, on) in entries.into_iter().chain((!points).then_some(tidy)) { let item = ui.add_enabled_ui(on, |ui| menu_item(ui, l, crate::shortcuts::shortcut(c).unwrap_or(""))); if !on { item.response .on_disabled_hover_text(tr("Select a row, a column or a full grid of three or more layers, outside an auto layout flow")); } if item.inner { - app.run(c, json!({"ids": ids})); + app.run(c, params()); ui.close(); } } diff --git a/crates/ui-egui/src/panels/vector_panel.rs b/crates/ui-egui/src/panels/vector_panel.rs index 3b91c9ffc..bde550ee1 100644 --- a/crates/ui-egui/src/panels/vector_panel.rs +++ b/crates/ui-egui/src/panels/vector_panel.rs @@ -99,12 +99,19 @@ pub fn points(app: &mut FigApp, ui: &mut Ui, doc: &Document, ve: &VectorEdit) { let Some(net) = vectoredit::network(doc, ve.id) else { return }; let pts = vectoredit::selected_points(net, ve); widgets::section_header(ui, if pts.len() > 1 { tr("Points") } else { tr("Point") }, &[], false); + let col = widgets::col_width(ui.available_width()); + // Figma puts alignment first; one point is a no-op there too. The count is the engine's, so + // selected segments' ends in any edited layer count as the commands do: the row shows even + // when only another edited layer has points selected. + let count = vectoredit::transform::edit_point_count(doc, ve); + if count > 0 { + crate::right::align_row(app, ui, crate::right::AlignTarget::Points(count), true, false, col); + } if pts.is_empty() { let t = crate::theme::Tokens::get(ui.ctx()); widgets::note(ui, tr("Select points to edit their position, radius and mirroring"), t.text_secondary); return; } - let col = widgets::col_width(ui.available_width()); let round = |v: f64| (v * 100.0).round() / 100.0; let parent_pts = vectoredit::selected_parent_points(doc, ve); // The value the selected points share (within 1e-6), or none: Mixed. diff --git a/crates/ui-egui/src/vector_align_tests.rs b/crates/ui-egui/src/vector_align_tests.rs new file mode 100644 index 000000000..e6ce444c1 --- /dev/null +++ b/crates/ui-egui/src/vector_align_tests.rs @@ -0,0 +1,99 @@ +//! Align and distribute the selected points in vector edit mode: the Design panel's alignment row +//! and the Alt+letter keys act on the points. + +use egui::accesskit::Node; +use egui::{Event, Key, Modifiers, Pos2}; +use figcraft_doc::NodeId; +use figcraft_engine::Session; +use serde_json::json; + +use crate::layers_drag_tests::Ui; + +/// A four-point open path in edit mode, the first two points selected. +fn two_selected() -> (Ui, NodeId) { + let mut s = Session::new(); + let r = s.execute("vector.create", &json!({"points": [[330, 480], [480, 430], [560, 560], [380, 620]], "closed": false})).unwrap(); + let path = NodeId(r["id"].as_u64().unwrap()); + s.execute("vector.edit.begin", &json!({"id": path})).unwrap(); + s.execute("vector.edit.select", &json!({"vertices": [0, 1]})).unwrap(); + let mut u = Ui::new(s); + u.frame(vec![]); + (u, path) +} + +/// Page x of every point of `path`. +fn xs(u: &Ui, path: NodeId) -> Vec { + let doc = u.app.session.doc().unwrap(); + let w = doc.world_transform(path); + figcraft_engine::vectoredit::network(doc, path).unwrap().vertices.iter().map(|v| (w * v.point()).x).collect() +} + +fn tree(u: &mut Ui) -> Vec { + u.ctx.enable_accesskit(); + u.frame(vec![]); + let out = u.frame_output(vec![]); + out.platform_output.accesskit_update.expect("an AccessKit update").nodes.into_iter().map(|(_, n)| n).collect() +} + +fn button<'a>(nodes: &'a [Node], label: &str) -> Option<&'a Node> { + nodes.iter().find(|n| n.label().is_some_and(|l| l.starts_with(label))) +} + +#[test] +fn the_alignment_row_shows_for_points_and_align_left_moves_them() { + let (mut u, path) = two_selected(); + let nodes = tree(&mut u); + let left = button(&nodes, "Align left").expect("the alignment row shows in edit mode with points selected"); + assert!(!left.is_disabled(), "enabled whenever points are selected"); + assert!(button(&nodes, "Distribute and tidy").is_none(), "two points have nothing to distribute"); + let b = left.bounds().expect("bounds"); + let p = Pos2::new(((b.x0 + b.x1) / 2.0) as f32, ((b.y0 + b.y1) / 2.0) as f32); + u.button(p, true); + u.button(p, false); + u.frame(vec![]); + let x = xs(&u, path); + assert!((x[0] - 330.0).abs() < 1e-6 && (x[1] - 330.0).abs() < 1e-6, "{x:?}"); + assert!((x[2] - 560.0).abs() < 1e-6, "unselected points stay: {x:?}"); +} + +#[test] +fn the_distribute_menu_shows_from_three_points() { + let (mut u, _) = two_selected(); + u.app.session.execute("vector.edit.select", &json!({"vertices": [0, 1, 2]})).unwrap(); + let nodes = tree(&mut u); + assert!(button(&nodes, "Distribute and tidy").is_some()); +} + +/// Two layers edited at once, points selected only in the one that isn't active: the row still +/// shows, since the commands act on every edited layer's selected points. +#[test] +fn the_alignment_row_shows_when_only_another_edited_layer_has_points_selected() { + let mut s = Session::new(); + let mut make = + |pts: serde_json::Value| NodeId(s.execute("vector.create", &json!({"points": pts, "closed": false})).unwrap()["id"].as_u64().unwrap()); + let a = make(json!([[330, 480], [480, 430], [560, 560]])); + let b = make(json!([[700, 480], [800, 430], [900, 560]])); + s.execute("vector.edit.begin", &json!({"ids": [a, b]})).unwrap(); + s.execute("vector.edit.select", &json!({"id": a, "vertices": [0, 1, 2]})).unwrap(); + s.execute("vector.edit.select", &json!({"id": b, "vertices": [], "add": true})).unwrap(); + let mut u = Ui::new(s); + u.frame(vec![]); + let nodes = tree(&mut u); + assert!(button(&nodes, "Align left").is_some(), "the row shows for the other layer's points"); + assert!(button(&nodes, "Distribute and tidy").is_some(), "three points there: distribute too"); +} + +#[test] +fn alt_d_in_edit_mode_aligns_the_points_right() { + let (mut u, path) = two_selected(); + let m = Modifiers::ALT; + u.frame_with( + vec![ + Event::Key { key: Key::D, physical_key: Some(Key::D), pressed: true, repeat: false, modifiers: m }, + Event::Key { key: Key::D, physical_key: Some(Key::D), pressed: false, repeat: false, modifiers: m }, + ], + m, + ); + let x = xs(&u, path); + assert!((x[0] - 480.0).abs() < 1e-6 && (x[1] - 480.0).abs() < 1e-6, "{x:?}"); +} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 8fb0abec1..99106ec27 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # FigCraft parity with Figma -> **Last reviewed:** 2026-11-15 · **Last updated:** 2026-11-18 · **Change:** minor (gap 6: the browser build uses team libraries and plugin directories on a server; M6 `.fig` export writes text on a path (#2323), list spacing, hanging punctuation and lists, vertical trim (#2305), vector region paints (#2302), image adjustments (#2297) and a page's prototype background (#2326); M8 Tidy up keeps a row's or column's order and sizes and evens the gaps, rounds the gap, tidies overlapping rows and grids along their longer axis, and raises a negative gap, as measured in Figma (#2319); a polygon's or star's Count handle and a double-click on a layer's icon (zoom, range anchor) follow Figma; Tab while renaming moves only the rename; Align is unavailable in an auto layout frame's flow; the Scale tool pivots on the opposite handle; Paste over selection puts copies above the selected layer; Crop from the image fill's menu crops with a drag (#2307); M10 code export writes every colour and gradient fill in paint order for CSS, SwiftUI, Compose and Flutter (#2271); 24 pt icon buttons draw 16 pt glyphs (#2227, #2238); M5 marquee selection follows Figma's measured rules and Select layer lists locked layers (#1560); M7 the Design panel shows the page's variable modes with nothing selected (#2215); M12 mind maps centre in a section or frame without a place, stickies take a Small–Huge text-size menu, and M9 `.jam` shapes with text import as native board shapes (#1808); M4 a boolean group's corner radius rounds its result (#2222), Flatten bakes a point's corner radius (#2195) and loops close through a joining segment (#1951); library links survive moving or cloning the project folder (#2132); a variable group renamed to a path with `/` nests (#2353); SVG import, widget images, batches and grids take bounded work, and a host's server key is never sent over plain `ws://` to another machine (#1923); releases FigCraft v0.18.0 and v0.18.1; the 2026-10-17 menu measurement (212 / 212) and every percentage and hour stand, not re-measured) · **Target:** Figma Design (desktop app 126.10.7, macOS) +> **Last reviewed:** 2026-11-15 · **Last updated:** 2026-11-18 · **Change:** minor (points align and distribute in vector edit mode as in Figma: the six Align commands, the keys Alt+A/H/D/W/V/S, and Distribute horizontal and vertical spacing act on the selected points, each moving along one axis to their box's edge or centre line, spaced evenly between the outermost for distribute, with the alignment row first in the Design panel (#2109); gap 6: the browser build uses team libraries and plugin directories on a server; M6 `.fig` export writes text on a path (#2323), list spacing, hanging punctuation and lists, vertical trim (#2305), vector region paints (#2302), image adjustments (#2297) and a page's prototype background (#2326); M8 Tidy up keeps a row's or column's order and sizes and evens the gaps, rounds the gap, tidies overlapping rows and grids along their longer axis, and raises a negative gap, as measured in Figma (#2319); a polygon's or star's Count handle and a double-click on a layer's icon (zoom, range anchor) follow Figma; Tab while renaming moves only the rename; Align is unavailable in an auto layout frame's flow; the Scale tool pivots on the opposite handle; Paste over selection puts copies above the selected layer; Crop from the image fill's menu crops with a drag (#2307); M10 code export writes every colour and gradient fill in paint order for CSS, SwiftUI, Compose and Flutter (#2271); 24 pt icon buttons draw 16 pt glyphs (#2227, #2238); M5 marquee selection follows Figma's measured rules and Select layer lists locked layers (#1560); M7 the Design panel shows the page's variable modes with nothing selected (#2215); M12 mind maps centre in a section or frame without a place, stickies take a Small–Huge text-size menu, and M9 `.jam` shapes with text import as native board shapes (#1808); M4 a boolean group's corner radius rounds its result (#2222), Flatten bakes a point's corner radius (#2195) and loops close through a joining segment (#1951); library links survive moving or cloning the project folder (#2132); a variable group renamed to a path with `/` nests (#2353); SVG import, widget images, batches and grids take bounded work, and a host's server key is never sent over plain `ws://` to another machine (#1923); releases FigCraft v0.18.0 and v0.18.1; the 2026-10-17 menu measurement (212 / 212) and every percentage and hour stand, not re-measured) · **Target:** Figma Design (desktop app 126.10.7, macOS) The authoritative assessment of how close FigCraft is to Figma Design. [`ROADMAP.md`](../ROADMAP.md) summarizes it; [`gaps.md`](gaps.md) is the ranked work list; the measured menu checklist is @@ -255,7 +255,7 @@ Hours in this narrative are the builders' estimates; the tables above supersede smooth interpolation per subpath, dashes, caps and joins, canvas/PNG/SVG/PDF and outline stroke), a transform box around several selected points (corners and edges scale them, Shift keeps proportions, Alt from the centre; just outside a corner rotates, Shift in 15° steps; drag inside - to move; the Design panel's X/Y/W/H and flip/rotate act on the points), point snapping while + to move; the Design panel's X/Y/W/H, align, distribute and flip/rotate act on the points), point snapping while dragging points or handles and with both pens (to the points and segment midpoints of this and other vectors, the usual layer targets and the pixel grid, with guides and a marker on the point landed on; Ctrl/Cmd turns it off), arc handles on the canvas (sweep, start and ratio with a @@ -652,6 +652,7 @@ Carried over from the ROADMAP's "Shipped so far" (2026-10-10). The test count th | Date | Change | Summary | |---|---|---| | 2026-11-18 | minor | M9, gap 6: the browser build uses team libraries and plugin directories on a server, through its WebSocket requests: adding a library by its link, its styles and components, publishing to it, Show usage and the reports a file sends; browsing a directory and installing from it, for the page only. Scripts through `window.figcraft` still can't, as commands there don't wait for the server. Numbers unchanged. Tests: `exchange_tests`. | +| 2026-11-08 | minor | M8, #2109: in vector edit mode the Align commands (`align.left` to `align.bottom`, Alt+A/H/D/W/V/S) and Distribute horizontal and vertical spacing act on the selected points when no `ids` are given, as in Figma (measured in Figma on 2026-11-08): each point moves along one axis only, to its box's left, horizontal centre, right, top, vertical centre or bottom, and distribute spaces the points evenly between the outermost two in order along the axis; handles go with their vertex, a single point stays, with no point selected nothing moves (the layer is not aligned to its frame, as measured in Figma), and one undo restores them. The Design panel draws the alignment row first, with a Distribute menu from three points. Numbers unchanged. | | 2026-11-15 | minor | M6 `.fig` export writes text on a path (#2323), list spacing, hanging punctuation and lists, vertical trim (#2305), vector region paints (#2302), image adjustments (#2297) and a page's prototype background (#2326); M8 Tidy up keeps a row's or column's order and sizes and evens the gaps, rounds the gap, tidies overlapping rows and grids along their longer axis, and raises a negative gap, as measured in Figma (#2319); a polygon's or star's Count handle and a double-click on a layer's icon (zoom, range anchor) follow Figma; Tab while renaming moves only the rename; Align is unavailable in an auto layout frame's flow; the Scale tool pivots on the opposite handle; Paste over selection puts copies above the selected layer; Crop from the image fill's menu crops with a drag (#2307); M10 code export writes every colour and gradient fill in paint order for CSS, SwiftUI, Compose and Flutter (#2271); 24 pt icon buttons draw 16 pt glyphs (#2227, #2238); M5 marquee selection follows Figma's measured rules and Select layer lists locked layers (#1560); M7 the Design panel shows the page's variable modes with nothing selected (#2215); M12 mind maps centre in a section or frame without a place, stickies take a Small–Huge text-size menu, and M9 `.jam` shapes with text import as native board shapes (#1808); M4 a boolean group's corner radius rounds its result (#2222), Flatten bakes a point's corner radius (#2195) and loops close through a joining segment (#1951); library links survive moving or cloning the project folder (#2132); a variable group renamed to a path with `/` nests (#2353); SVG import, widget images, batches and grids take bounded work, and a host's server key is never sent over plain `ws://` to another machine (#1923); releases FigCraft v0.18.0 and v0.18.1; the 2026-10-17 menu measurement (212 / 212) and every percentage and hour stand, not re-measured | | 2026-11-10 | minor | M4, #2222: a boolean group's corner radius rounds every sharp corner of its result (row 4). Numbers unchanged | | 2026-11-08 | minor | M8: measured in Figma on 2026-11-08, vector edit mode's Point section: X and Y show the value the selected points share, or Mixed when they differ, and a typed value sets every selected point's own coordinate in the layer being edited, points of other edited layers left as they are (it moved the group's top-left before); a relative edit (`+10`, `*2`, `/2`) typed into a Mixed field applies to each point's own value (`vector.edit.position` takes a number or `{add}`, `{mul}`, `{div}` per axis); the W and H row and other edited layers' points are unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 3d976c68b..2ec810638 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-17 · **Change:** minor (going back to a page shows it where it was left, not fitted again; Duplicate repeats the last copy's move and its rotation (about the copy's centre, or the selection's centre for several layers), not its size, and forgets the step when the selection changes, measured in Figma's web app on 2026-11-12 (#2293); M8: a double-click on a layer's icon zooms to it instead of renaming, measured in Figma's web app on 2026-11-12; Tidy up keeps the order and sizes and evens the gaps, as measured in Figma's web app on 2026-11-12, rounds the gap half up, tidies overlapping rows and packs a grid along its longer axis, and is greyed out for fewer than three layers, a diagonal and an irregular layout (M8); after Crop is chosen in the image fill's colour picker, a drag on the image crops it instead of moving the layer, and no internal gesture message shows (#2307); Align is disabled for a layer in an auto layout frame's flow, as measured in Figma's web app on 2026-11-12, with a tip saying the frame places it; Select layer lists locked layers with a padlock and selects them, and shows only with more than one layer under the pointer (#1560); M8: Scale tool handle drags pivot on the opposite handle whatever the origin, and the origin starts at the centre (measured in Figma's web app, 2026-11-09); M8: a selected polygon or star has a Count handle on the canvas, on its first point clockwise from the top; Zoom to selection leaves a 40 pt margin and clears the bottom toolbar, measured in Figma's web app; M1: Paste over selection puts the pasted layers just above the selected layer; drag modifiers compared in Figma's web app (2026-11-08): Shift locks a move to the dominant axis, Alt copies, Shift keeps a resize's ratio, Alt keeps its centre, all read afresh on every move, and FigCraft matches (Ctrl/Cmd not measurable); a mirror mode (angle, or angle and length) on a sharp point turns it smooth, as in Figma (#2110); M8: Tab while renaming the last layer wraps to the first row, measured in Figma's web app on 2026-11-12; the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-17 · **Change:** minor (points align and distribute in vector edit mode as in Figma: the six Align commands, the keys Alt+A/H/D/W/V/S, and Distribute horizontal and vertical spacing act on the selected points, each moving along one axis to their box's edge or centre line, spaced evenly between the outermost for distribute, with the alignment row first in the Design panel (#2109); going back to a page shows it where it was left, not fitted again; Duplicate repeats the last copy's move and its rotation (about the copy's centre, or the selection's centre for several layers), not its size, and forgets the step when the selection changes, measured in Figma's web app on 2026-11-12 (#2293); M8: a double-click on a layer's icon zooms to it instead of renaming, measured in Figma's web app on 2026-11-12; Tidy up keeps the order and sizes and evens the gaps, as measured in Figma's web app on 2026-11-12, rounds the gap half up, tidies overlapping rows and packs a grid along its longer axis, and is greyed out for fewer than three layers, a diagonal and an irregular layout (M8); after Crop is chosen in the image fill's colour picker, a drag on the image crops it instead of moving the layer, and no internal gesture message shows (#2307); Align is disabled for a layer in an auto layout frame's flow, as measured in Figma's web app on 2026-11-12, with a tip saying the frame places it; Select layer lists locked layers with a padlock and selects them, and shows only with more than one layer under the pointer (#1560); M8: Scale tool handle drags pivot on the opposite handle whatever the origin, and the origin starts at the centre (measured in Figma's web app, 2026-11-09); M8: a selected polygon or star has a Count handle on the canvas, on its first point clockwise from the top; Zoom to selection leaves a 40 pt margin and clears the bottom toolbar, measured in Figma's web app; M1: Paste over selection puts the pasted layers just above the selected layer; drag modifiers compared in Figma's web app (2026-11-08): Shift locks a move to the dominant axis, Alt copies, Shift keeps a resize's ratio, Alt keeps its centre, all read afresh on every move, and FigCraft matches (Ctrl/Cmd not measurable); a mirror mode (angle, or angle and length) on a sharp point turns it smooth, as in Figma (#2110); M8: Tab while renaming the last layer wraps to the first row, measured in Figma's web app on 2026-11-12; the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -94,6 +94,7 @@ interaction feel only partly compared: the interactions measured so far, case by | Rectangle, ellipse (arc handles and Design panel arc fields), polygon, star, line, arrow; Shift/Alt | done | Alt draws lines from the centre too (`shapes_behaviour_tests`) | | Corner radius handles (inside each corner of a rectangle or frame, a polygon's or star's top point; Alt: one corner), star ratio handle; Count and Ratio fields | done | handles hide under 48 px on screen; a Count handle sits on a polygon's first vertex or a star's first outer point clockwise from the top, and the count follows the pointer's angle about the centre, `round(360 / angle)` clockwise from the top point, clamped to 3 to 60, in one undo step (measured in Figma's web app, 2026-11-12; a polygon's maximum wasn't read and is clamped at 60 like the star's, the help center's range); corner smoothing rounds rectangles and frames only | | Pen: vector networks, branch, close, bend; pencil | done | pen pressure on Windows and from browser styluses only; outside edit mode the Pen closes on its first point, connects to its other points and continues a selected open path from an end point (`vector_multi_behaviour_tests`); Escape ends the path and keeps its layer in edit mode with the pen, so the next path joins the same vector and another Escape leaves edit mode (#760, `pen_end_tests`); Enter or a double-click ends the path (at the double-click's point, added once) and edits the vector with the Move tool, a double-click with the idle pen edits the layer under it, and in edit mode the pen's Enter or double-click takes the Move tool (#1430, `pen_vector_edit_tests`); switching from Design to Prototype or Inspect ends the path and returns to Move (#308) | +| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring, align and distribute points | done | a double-click a few pixels off a thin stroke enters edit mode (#646); entering edit mode and picking a region keep the canvas still (#322); a point dropped on another point merges with it, and dropping one end of an open path on the other closes it (a 2-point line's end just moves, #401); Flatten keeps open paths open (#377), and bakes a vector's point corner radius into its path (each rounded point becomes the arc's end points joined by curves, the layer stays a vector and its box fits the real geometry, #2195); paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn; Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); the Point section's X and Y show the value the selected points share, or Mixed, and a typed value sets every selected point's own coordinate, in the layer being edited (measured in Figma on 2026-11-08); Copy and Cut with points or segments selected take just those (a lone point: the segments touching it) as a vector with the layer's look, at their own place, so a paste outside edit mode is a new layer in place; Cut removes them as Delete does, the path splitting in the same layer with edit mode staying on; Paste while editing adds the clipboard's segments, or a copied shape's or boolean's outline, to the edited network in place with the new points selected, skipping layers with no outline (text, frames, groups; named in `skipped`) and refusing when none has one, as measured in Figma (`vector_clipboard_tests`, #1875). Not yet: areas of other layers edited at once; the Point section's X and Y over points of several edited layers | | Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a mirror mode on a sharp point turns it smooth by the measured rule (#2110); a double-click a few pixels off a thin stroke enters edit mode (#646); entering edit mode and picking a region keep the canvas still (#322); a point dropped on another point merges with it, and dropping one end of an open path on the other closes it (a 2-point line's end just moves, #401); Flatten keeps open paths open (#377), and bakes a vector's point corner radius into its path (each rounded point becomes the arc's end points joined by curves, the layer stays a vector and its box fits the real geometry, #2195); paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn, an arc reaching along the whole of a segment whose other end is sharp and half of one whose other end is rounded too, so one rounded corner of a 100 × 100 square with radius 100 runs from one neighbour to the other, while the radius field keeps what was typed (#2334, `vector_radius_tests`, `vector_point_radius_tests`); Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); the Point section's X and Y show the value the selected points share, or Mixed, and a typed value sets every selected point's own coordinate, in the layer being edited (measured in Figma on 2026-11-08); Copy and Cut with points or segments selected take just those (a lone point: the segments touching it) as a vector with the layer's look, at their own place, so a paste outside edit mode is a new layer in place; Cut removes them as Delete does, the path splitting in the same layer with edit mode staying on; Paste while editing adds the clipboard's segments, or a copied shape's or boolean's outline, to the edited network in place with the new points selected, skipping layers with no outline (text, frames, groups; named in `skipped`) and refusing when none has one, as measured in Figma (`vector_clipboard_tests`, #1875). Not yet: areas of other layers edited at once; the Point section's X and Y over points of several edited layers | | Shape builder (Shift+M) on fills, strokes and open paths; variable width (Shift+W), one side with Alt | done | | | Boolean groups: clicked where the result is, double-click or Cmd/Ctrl-click into operands, live results while dragging or editing points, per-operand operations | done | a group past the path operations' caps (250 000 segments, 2 million possible crossings, 4 million segments swept over a fold) draws without its result, with a warning, and Flatten refuses it (#1104); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003); a boolean group takes a corner radius from the Design panel and from `node.set cornerRadius`: every sharp corner of its result rounds, convex and concave, layers inside keep their own radius and do not stack with it, a radius larger than the edges allow shrinks to fit while the field keeps the value typed, Flatten bakes the arcs and a mixed selection reads Mixed; measured in Figma's web app on 2026-11-10 (#2222; `crates/pathops/src/round_tests.rs`, `crates/render/src/boolean_radius_tests.rs`, `crates/engine/src/boolean_radius_tests.rs`, the boolean group test in `crates/ui-egui/src/field_tests.rs`). Pinned and not yet compared with Figma: corner smoothing on a boolean group draws the polygon profile between straight edges, a corner beside a curve stays within the curve piece next to it, and there is no radius handle on the canvas | @@ -207,6 +208,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| +| 2026-11-08 | minor | M8, #2109: in vector edit mode the Align commands (`align.left` to `align.bottom`, Alt+A/H/D/W/V/S) and Distribute horizontal and vertical spacing act on the selected points when neither `ids` nor `id` is given (either one targets layers), as in Figma (measured in Figma on 2026-11-08): each point moves along one axis only, to its box's left, horizontal centre, right, top, vertical centre or bottom, and distribute spaces the points evenly between the outermost two in order along the axis; handles go with their vertex, a single point stays, with no point selected nothing moves (the layer is not aligned to its frame, as measured in Figma), and one undo restores them. The Design panel draws the alignment row first, with a Distribute menu from three points. Numbers unchanged. | | 2026-11-08 | patch | Number fields: scrubbing a label moves half a step a point, not a step, as measured in Figma (X from 100: +6 for a 12.2 px drag, +31 for 61.2 px; rotation 6° and opacity 5% for 12.2 px); Shift (x10), Alt (x0.1) and the speed by height are kept on top of it and were not measured, and no field's scrub direction changed | | 2026-11-17 | patch | M8: each page keeps its view in a session: going back to a page (the Pages list, `page.select`, Previous/Next page) shows it where it was left instead of fitting it again; a new page is still fitted, and going to the page shown moves nothing (`page_view_tests`) | | 2026-11-13 | patch | Rows that recent merges had duplicated or garbled are merged back into one row each (no behaviour change): UI3 layout, Light and dark themes, Rotate just outside a corner, Selection colors, Keyboard box selection, Boolean groups, Text: point, auto height, fixed, Text: wrap style, Bound as documented, Pan/zoom. |