mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-17 23:58:24 +00:00
Merge pull request #2341 from ljkx/fix/point-radius-full-edge-2334
M4: a rounded vector point reaches along the whole of a segment whose other end is sharp (#2334)
This commit is contained in:
7 files changed
+216
-13
No files matched your search
@@ -1355,6 +1355,8 @@ mod proto_overlay_anchor_tests;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
#[cfg(test)]
|
||||
mod vector_radius_tests;
|
||||
#[cfg(test)]
|
||||
mod vector_regions_tests;
|
||||
#[cfg(test)]
|
||||
mod width_sides_tests;
|
||||
|
||||
+49
-11
@@ -145,6 +145,25 @@ struct Corner {
|
||||
cut2: f64,
|
||||
}
|
||||
|
||||
/// Where point `v` turns between its two segments, for rounding it: `r` its radius, `s1`/`s2` the
|
||||
/// segments (`a1`/`a2` whether `v` is their `a` end), `c1`/`c2` them as curves running away from
|
||||
/// `v`, `u1`/`u2` the directions they leave in, `angle` between those, and `l1`/`l2` their lengths.
|
||||
struct Turn {
|
||||
v: usize,
|
||||
r: f64,
|
||||
s1: usize,
|
||||
a1: bool,
|
||||
s2: usize,
|
||||
a2: bool,
|
||||
c1: CubicBez,
|
||||
c2: CubicBez,
|
||||
u1: Vec2,
|
||||
u2: Vec2,
|
||||
angle: f64,
|
||||
l1: f64,
|
||||
l2: f64,
|
||||
}
|
||||
|
||||
/// One curve of a rounded point: its handles at its start (`ta`) and its end (`tb`), relative to
|
||||
/// those ends, and the point it ends at.
|
||||
struct CornerCurve {
|
||||
@@ -391,10 +410,11 @@ impl VectorNetwork {
|
||||
}
|
||||
|
||||
/// The network with its rounded points drawn in: each sharp point with a corner radius becomes
|
||||
/// an arc between its two segments (the radius shrinks so the arc fits in half of each
|
||||
/// segment, like a polygon's corners). A curved segment is cut where the arc meets it and keeps
|
||||
/// the rest of its curve, the arc leaving along its direction there. `None` when no point is
|
||||
/// rounded.
|
||||
/// an arc between its two segments. The radius shrinks so the arc fits: a segment whose other
|
||||
/// end is rounded too is shared, half for each end, as a polygon's sides are, and one whose
|
||||
/// other end stays sharp can be used whole (as in Figma, #2334). A curved segment is cut where
|
||||
/// the arc meets it and keeps the rest of its curve, the arc leaving along its direction there.
|
||||
/// `None` when no point is rounded.
|
||||
pub fn rounded(&self) -> Option<VectorNetwork> {
|
||||
self.rounded_smoothed(0.0)
|
||||
}
|
||||
@@ -424,7 +444,9 @@ impl VectorNetwork {
|
||||
*x = true;
|
||||
}
|
||||
}
|
||||
let corners: Vec<Corner> = (0..self.vertices.len()).filter_map(|v| self.corner(v, incident.get(v)?, smoothing, &on_loop)).collect();
|
||||
let turns: Vec<Option<Turn>> = (0..self.vertices.len()).map(|v| self.turn(v, incident.get(v)?)).collect();
|
||||
let rounds: Vec<bool> = turns.iter().map(Option::is_some).collect();
|
||||
let corners: Vec<Corner> = turns.iter().flatten().filter_map(|t| self.corner(t, smoothing, &on_loop, &rounds)).collect();
|
||||
let mut out = self.clone();
|
||||
for v in &mut out.vertices {
|
||||
v.radius = 0.0;
|
||||
@@ -558,10 +580,9 @@ impl VectorNetwork {
|
||||
joining.next().is_none().then_some(first)
|
||||
}
|
||||
|
||||
/// How point `v` (its `incident` segments) is rounded, if it is: not where the two segments
|
||||
/// run on smoothly or fold back. With `smoothing`, a point between two straight segments that
|
||||
/// are both `on_loop` gets a smoothed corner.
|
||||
fn corner(&self, v: usize, incident: &[(usize, bool)], smoothing: f64, on_loop: &[bool]) -> Option<Corner> {
|
||||
/// How point `v` (its `incident` segments) turns, if it is rounded: it has a radius and two
|
||||
/// segments that neither run on smoothly nor fold back there.
|
||||
fn turn(&self, v: usize, incident: &[(usize, bool)]) -> Option<Turn> {
|
||||
let r = self.vertices.get(v)?.radius;
|
||||
let [(s1, a1), (s2, a2)] = *incident else { return None };
|
||||
if !(r > 0.0 && r.is_finite()) || s1 == s2 {
|
||||
@@ -577,6 +598,23 @@ impl VectorNetwork {
|
||||
if !(l1 > 1e-9 && l2 > 1e-9) {
|
||||
return None;
|
||||
}
|
||||
Some(Turn { v, r, s1, a1, s2, a2, c1, c2, u1, u2, angle, l1, l2 })
|
||||
}
|
||||
|
||||
/// How far along segment `s` (`l` long) from its `a` end (`at_a`) or its `b` end the corner
|
||||
/// there may reach: all of it when the other end stays sharp, half when that end is rounded
|
||||
/// too (`rounds`, by point) and takes the other half.
|
||||
fn room(&self, s: usize, at_a: bool, l: f64, rounds: &[bool]) -> f64 {
|
||||
let far = self.segments.get(s).map(|x| if at_a { x.b } else { x.a });
|
||||
if far.and_then(|f| rounds.get(f)).copied().unwrap_or(false) { l / 2.0 } else { l }
|
||||
}
|
||||
|
||||
/// The corner of a rounded point (`p`, see [`Self::turn`]); it reaches along each segment as
|
||||
/// far as [`Self::room`] allows (`rounds`: which points are rounded). With `smoothing`, a point
|
||||
/// between two straight segments that are both `on_loop` gets a smoothed corner.
|
||||
fn corner(&self, p: &Turn, smoothing: f64, on_loop: &[bool], rounds: &[bool]) -> Option<Corner> {
|
||||
let &Turn { v, r, s1, a1, s2, a2, c1, c2, u1, u2, angle, l1, l2 } = p;
|
||||
let reach = self.room(s1, a1, l1, rounds).min(self.room(s2, a2, l2, rounds));
|
||||
let own = |at_a: bool, t: f64| if at_a { t } else { 1.0 - t };
|
||||
let closed = |s: usize| on_loop.get(s).copied().unwrap_or(false);
|
||||
if smoothing > 0.0
|
||||
@@ -584,7 +622,7 @@ impl VectorNetwork {
|
||||
&& is_line(&c2)
|
||||
&& closed(s1)
|
||||
&& closed(s2)
|
||||
&& let Some(curves) = figcraft_geom::smoothed_corner(c1.p0, u1, u2, l1.min(l2) / 2.0, r, smoothing)
|
||||
&& let Some(curves) = figcraft_geom::smoothed_corner(c1.p0, u1, u2, reach, r, smoothing)
|
||||
&& let (Some(first), Some(last)) = (curves.first(), curves.last())
|
||||
{
|
||||
let (a, b) = (first.p0, last.p3);
|
||||
@@ -595,7 +633,7 @@ impl VectorNetwork {
|
||||
let (cut1, cut2) = ((a - c1.p0).hypot() / l1, (b - c2.p0).hypot() / l2);
|
||||
return Some(Corner { v, s1, s1_at_a: a1, s2, s2_at_a: a2, a, chain, cut1: own(a1, cut1), cut2: own(a2, cut2) });
|
||||
}
|
||||
let t = (r / (angle / 2.0).tan()).min(l1.min(l2) / 2.0);
|
||||
let t = (r / (angle / 2.0).tan()).min(reach);
|
||||
let ((a, d1, k1), (b, d2, k2)) = (trim(&c1, t, l1), trim(&c2, t, l2));
|
||||
// A cubic arc: handles of 4/3·tan(φ/4)·ρ along each end's direction, φ the turn between
|
||||
// them and ρ the radius of the circle through both ends (the corner radius between lines).
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
//! How far a rounded point's arc may reach along its segments (#2334): the whole segment when the
|
||||
//! segment's other end stays sharp, half of it when that end is rounded too. Figma draws a single
|
||||
//! rounded point of a 100 × 100 square with radius 100 as an arc from one neighbour to the other.
|
||||
|
||||
use figcraft_geom::kurbo::{CubicBez, ParamCurve, PathSeg};
|
||||
use figcraft_geom::{BezPath, Point};
|
||||
|
||||
use crate::vector::VectorNetwork;
|
||||
|
||||
/// A 100 × 100 square's points: top left, top right, bottom right, bottom left.
|
||||
const SQUARE: [Point; 4] = [Point::new(0.0, 0.0), Point::new(100.0, 0.0), Point::new(100.0, 100.0), Point::new(0.0, 100.0)];
|
||||
|
||||
/// A network through `pts` (closed or open) whose points have radii `radii`.
|
||||
fn network(pts: &[Point], closed: bool, radii: &[f64]) -> VectorNetwork {
|
||||
let mut n = VectorNetwork::from_points(pts, closed);
|
||||
for (v, r) in n.vertices.iter_mut().zip(radii) {
|
||||
v.radius = *r;
|
||||
}
|
||||
n
|
||||
}
|
||||
|
||||
/// The cubic curves of `path` (the rounded points' arcs; every other segment is straight).
|
||||
fn curves(path: &BezPath) -> Vec<CubicBez> {
|
||||
path.segments()
|
||||
.filter_map(|s| match s {
|
||||
PathSeg::Cubic(c) => Some(c),
|
||||
_ => None,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Whether `a` and `b` are the same point to within rounding.
|
||||
fn near(a: Point, b: Point) -> bool {
|
||||
(a - b).hypot() < 1e-9
|
||||
}
|
||||
|
||||
/// Checks that `path` draws, for each `(corner, prev, next, t)` of `want`, a circular arc
|
||||
/// between the points `t` from `corner` toward `prev` and toward `next` (a right angle, so the
|
||||
/// circle's radius is `t`), and no other curve.
|
||||
fn assert_arcs(path: &BezPath, want: &[(Point, Point, Point, f64)], why: &str) {
|
||||
let got = curves(path);
|
||||
assert_eq!(got.len(), want.len(), "{why}: {got:?}");
|
||||
for &(corner, prev, next, t) in want {
|
||||
let toward = |p: Point| corner + (p - corner) / (p - corner).hypot() * t;
|
||||
let (a, b) = (toward(prev), toward(next));
|
||||
let center = a + (b - corner);
|
||||
let mid = center + (corner - center) / (corner - center).hypot() * t;
|
||||
// Two arcs can share both ends (opposite corners of a square), so the middle picks one.
|
||||
let ends = |c: &&CubicBez| (near(c.p0, a) && near(c.p3, b)) || (near(c.p0, b) && near(c.p3, a));
|
||||
let passing: Vec<Point> = got.iter().filter(ends).map(|c| c.eval(0.5)).collect();
|
||||
assert!(
|
||||
passing.iter().any(|&m| near(m, mid)),
|
||||
"{why}: no arc at {corner:?} from {a:?} to {b:?} through {mid:?}; arcs between them pass {passing:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_rounded_points_arc_reaches_as_far_as_its_segments_other_ends_allow() {
|
||||
let [tl, tr, br, bl] = SQUARE;
|
||||
// (radii of [top left, top right, bottom right, bottom left], each arc as (point, its
|
||||
// neighbours, how far it reaches along both), derivation)
|
||||
#[allow(clippy::type_complexity)]
|
||||
let rows: Vec<([f64; 4], Vec<(Point, Point, Point, f64)>, &str)> = vec![
|
||||
([0.0, 0.0, 100.0, 0.0], vec![(br, tr, bl, 100.0)], "the issue's square: the arc runs from one sharp neighbour to the other"),
|
||||
([0.0, 0.0, 500.0, 0.0], vec![(br, tr, bl, 100.0)], "a larger radius stops at the sharp neighbours"),
|
||||
([0.0, 0.0, 75.0, 0.0], vec![(br, tr, bl, 75.0)], "a radius past half the segments is drawn whole"),
|
||||
([0.0, 0.0, 40.0, 0.0], vec![(br, tr, bl, 40.0)], "a radius that fits half the segments is unchanged"),
|
||||
(
|
||||
[0.0, 10.0, 100.0, 0.0],
|
||||
vec![(tr, tl, br, 10.0), (br, tr, bl, 50.0)],
|
||||
"the segment to the rounded top right is shared, half each, and the shorter room wins",
|
||||
),
|
||||
(
|
||||
[100.0, 0.0, 100.0, 0.0],
|
||||
vec![(tl, bl, tr, 100.0), (br, tr, bl, 100.0)],
|
||||
"opposite points share no segment: each reaches its sharp neighbours (a lens)",
|
||||
),
|
||||
(
|
||||
[100.0; 4],
|
||||
vec![(tl, bl, tr, 50.0), (tr, tl, br, 50.0), (br, tr, bl, 50.0), (bl, br, tl, 50.0)],
|
||||
"every point rounded: a circle, as before",
|
||||
),
|
||||
];
|
||||
for (radii, want, why) in rows {
|
||||
let net = network(&SQUARE, true, &radii);
|
||||
assert_arcs(&net.fill_path(), &want, why);
|
||||
assert_arcs(&net.stroke_path(), &want, why);
|
||||
// The stored radii stay as they were set.
|
||||
assert_eq!(net.vertices.iter().map(|p| p.radius).collect::<Vec<_>>(), radii.to_vec(), "{why}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_open_paths_ends_leave_its_rounded_point_the_whole_segments() {
|
||||
let pts = [Point::new(0.0, 0.0), Point::new(0.0, 100.0), Point::new(100.0, 100.0)];
|
||||
// (radii, derivation): the ends don't turn, so a radius on them rounds nothing and takes no
|
||||
// room from the middle point.
|
||||
let rows: Vec<([f64; 3], &str)> =
|
||||
vec![([0.0, 100.0, 0.0], "sharp ends"), ([100.0, 100.0, 100.0], "ends with a radius of their own stay sharp and leave the room to it")];
|
||||
for (radii, why) in rows {
|
||||
let net = network(&pts, false, &radii);
|
||||
assert_arcs(&net.stroke_path(), &[(pts[1], pts[0], pts[2], 100.0)], why);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_smoothed_corner_takes_the_room_of_a_sharp_neighbour_before_losing_smoothing() {
|
||||
// Radius 40 with smoothing 0.6 eases in from 1.6 × 40 = 64 along each side. Half of a 100
|
||||
// side (50) would cut smoothing down; the whole side next to sharp points leaves all of it.
|
||||
let net = network(&SQUARE, true, &[0.0, 0.0, 40.0, 0.0]);
|
||||
let path = net.rounded_smoothed(0.6).unwrap().fill_path();
|
||||
let ends: Vec<Point> = curves(&path).iter().flat_map(|c| [c.p0, c.p3]).collect();
|
||||
for p in [Point::new(100.0, 36.0), Point::new(36.0, 100.0)] {
|
||||
assert!(ends.iter().any(|e| (*e - p).hypot() < 1e-6), "the smoothed corner starts at {p:?}: {ends:?}");
|
||||
}
|
||||
assert!(ends.iter().all(|e| e.x >= 36.0 - 1e-6 && e.y >= 36.0 - 1e-6), "and reaches no further: {ends:?}");
|
||||
}
|
||||
@@ -302,6 +302,8 @@ mod vector_keys_tests;
|
||||
#[cfg(test)]
|
||||
mod vector_panel_tests;
|
||||
#[cfg(test)]
|
||||
mod vector_point_radius_tests;
|
||||
#[cfg(test)]
|
||||
mod vector_point_xy_tests;
|
||||
#[cfg(test)]
|
||||
mod vector_tail_ui_tests;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
//! The vector edit panel's Corner radius for a point (#2334): a typed radius larger than half the
|
||||
//! point's segments is kept and shown as typed, and the point is drawn rounded across the whole of
|
||||
//! the segments whose other ends stay sharp, as Figma draws it.
|
||||
|
||||
use egui::Key;
|
||||
use figcraft_geom::Point;
|
||||
use figcraft_geom::kurbo::{ParamCurve, PathSeg};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::field_tests::{field, type_into};
|
||||
use crate::vector_point_xy_tests::setup;
|
||||
|
||||
#[test]
|
||||
fn a_typed_radius_is_kept_shown_and_drawn_across_the_sharp_neighbours_segments() {
|
||||
// The 100 × 60 rectangle in vector edit mode; point 2 is its bottom right corner.
|
||||
let (mut u, id) = setup();
|
||||
u.app.session.execute("vector.edit.select", &json!({"vertices": [2]})).unwrap();
|
||||
type_into(&mut u, "Corner radius", "100", Key::Enter);
|
||||
assert_eq!(field(&mut u, "Corner radius").1, "100", "the field shows the radius as typed");
|
||||
let doc = u.app.session.doc().unwrap();
|
||||
let net = figcraft_engine::vectoredit::network(doc, id).unwrap();
|
||||
assert_eq!(net.vertices.iter().map(|v| v.radius).collect::<Vec<_>>(), vec![0.0, 0.0, 100.0, 0.0], "only point 2 stores it, unclamped");
|
||||
assert_eq!(net.vertices[2].point(), Point::new(100.0, 60.0));
|
||||
// Both neighbours are sharp, so the arc reaches the whole 60 of the shorter side: from the top
|
||||
// right corner to 60 along the bottom, on a circle of radius 60 centred at (40, 0).
|
||||
let arcs: Vec<_> = net
|
||||
.fill_path()
|
||||
.segments()
|
||||
.filter_map(|s| match s {
|
||||
PathSeg::Cubic(c) => Some(c),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
assert_eq!(arcs.len(), 1, "{arcs:?}");
|
||||
let ends = [arcs[0].p0, arcs[0].p3];
|
||||
let close = |a: Point, b: Point| (a - b).hypot() < 1e-9;
|
||||
assert!(ends.iter().any(|e| close(*e, Point::new(100.0, 0.0))) && ends.iter().any(|e| close(*e, Point::new(40.0, 60.0))), "{ends:?}");
|
||||
let h = 60.0 / 2f64.sqrt();
|
||||
assert!(close(arcs[0].eval(0.5), Point::new(40.0 + h, h)), "{:?}", arcs[0].eval(0.5));
|
||||
}
|
||||
@@ -9,7 +9,9 @@ use serde_json::json;
|
||||
use crate::field_tests::{field, scrub, type_into, undo_steps};
|
||||
use crate::layers_drag_tests::Ui;
|
||||
|
||||
fn setup() -> (Ui, NodeId) {
|
||||
/// A 100 × 60 rectangle at the origin, selected and in vector edit mode (points clockwise from
|
||||
/// the top left), and its id.
|
||||
pub(crate) fn setup() -> (Ui, NodeId) {
|
||||
let mut s = Session::new();
|
||||
let r = s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 100, "height": 60})).unwrap();
|
||||
let id = NodeId(r["id"].as_u64().unwrap());
|
||||
|
||||
+2
-1
@@ -94,7 +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 | 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; 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 |
|
||||
| Text: point, auto height, fixed; caret, words, lines, IME | done | Backspace or Delete at the start of a list item takes its marker and keeps its level, the paragraph starting where the item's text did ("delete the counter, but keep the same level of indentation", Create bulleted and numbered lists; `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests`); max lines on auto-width text keep it auto width, hugging up to that many lines and growing with its longest line ("Text resizing is set to auto height or auto width", Explore text properties; `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines`); Alt+Enter while editing opens the link at the caret, web and mail links only (`text.openLink`; "press ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma; `text_link_tests`); the font picker previews a family on the canvas while hovered (no undo step; Escape restores, #653) and Up/Down step through it (#352); a selection highlight after a line break starts at that line's start and an empty last line shows its mark (#665); carets step over whole emoji and accented letters; colour emoji draw from their colour tables (#300); IME composition replayed in tests as macOS sends it, not yet checked on a Mac (#747); CJK words by script run (no dictionary); vertical trim in Type settings; the caret takes the text's solid fill colour, measured in Figma's web app, 2026-11-09; gradient and image fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour, which is white in the dark theme and vanished on the default light page (#2190) (#2156; `caret_tests`); no spell check |
|
||||
@@ -213,6 +213,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged
|
||||
| 2026-11-13 | patch | M8, #2307: with Crop chosen in an image fill's colour picker, a press and drag on the image moved the whole layer: the press closed the picker, which committed the crop as a plain move. The picker now treats a crop drag as its own control (as it does the open gradient's handles, #1852), so the drag moves the picture inside the layer. A drag whose gesture something else committed under the held button no longer shows the engine's internal "no gesture in progress" as a message (`EngineError::NoGesture`, dropped by the canvas). Tests: `crop_image_tests::crop_from_the_colour_picker_then_a_drag_on_the_image_moves_the_crop_not_the_layer`, `a_drag_whose_gesture_was_committed_under_the_button_shows_no_message`. |
|
||||
| 2026-11-12 | minor | M8: Align is unavailable for the one selected layer of an auto layout frame that takes part in its flow, as in Figma (measured in Figma's web app on 2026-11-12: the Design panel's Align buttons are greyed out, Alt+A and Alt+S do nothing and the frame's alignment doesn't change). `align_target` returns none for it, so `can_align` is false and the `align.*` commands leave the layout alone; the disabled tip reads "A layer in an auto layout frame is placed by its frame" (`align_blocked_by_auto_layout`). An absolutely positioned child still aligns to its frame and multi-layer selections are unchanged (neither measured). Single and multi-layer Align and Distribute otherwise matched Figma; Tidy up differs (Figma keeps the order and sizes and evens one gap per axis) and is not yet changed. Tests: `align_is_unavailable_for_a_child_in_an_auto_layout_flow`, `an_absolute_child_of_an_auto_layout_frame_still_aligns_to_it`, `the_align_buttons_are_off_for_a_layer_in_an_auto_layout_flow` |
|
||||
| 2026-11-12 | patch | M5, #1560: the context menu's Select layer lists locked layers with a padlock in the leading column (the Layers panel's padlock icon; a row both selected and locked shows the check) and picking one selects it, as Lock and unlock layers' note says and as measured in Figma's web app, 2026-11-10; the submenu shows only with more than one layer under the pointer (measured on a single locked layer only: the least certain rule). Left clicks, hover and marquee still never reach a locked layer. `select.layersAt` lists locked layers too and its rows gain `locked`. Tests: `layers_at_a_point_list_locked_layers_with_a_flag_and_select_set_takes_them`, `select_layer_marks_locked_layers_with_a_padlock_and_picks_them`, `select_layer_needs_more_than_one_layer_under_the_pointer`. Counts unchanged |
|
||||
| 2026-11-13 | patch | M4, #2334: a vector point's corner radius was cut to half of its shorter segment, so radius 100 on one corner of a 100 × 100 square drew a radius-50 arc. Figma (the issue's screenshot) draws it from one neighbour to the other. Now each arc may reach along the whole of a segment whose other end stays sharp, and along half of one whose other end is rounded too (as before; Figma's plugin docs clamp each end of such an edge to half its length); the shorter room of the two segments wins, and a smoothed corner uses the same room before losing smoothing. The stored radius and the Point section's field were already as typed. Not measured: how Figma splits a segment between two rounded ends with different radii. Tests: `vector_radius_tests` (doc), `vector_point_radius_tests` (UI) |
|
||||
| 2026-11-09 | patch | Zoom to selection: the selection is fitted with a 40 pt margin into the canvas above the floating bottom toolbar (`ViewState::bottom_inset`, set by the UI each frame, never saved; `view.set` takes `bottomInset`) and centred in that area, as measured in Figma's web app on 2026-11-09. Zoom to fit is unchanged (margin not measured yet). Numbers unchanged. |
|
||||
| 2026-11-13 | patch | M1: Shift+Cmd/Ctrl+V (Paste over selection) puts the pasted layers just above the selected layer, in its parent and in the copied order, at its position; they went to the top of the parent's layers, so in an auto layout frame they ended the flow instead of following the selected layer. |
|
||||
| 2026-11-12 | patch | Drag modifiers compared in Figma's web app (2026-11-08): Shift locks a move to the dominant axis with no 45° snap, Alt copies, Shift keeps a resize's ratio (an edge scales about the opposite edge's middle), Alt keeps the centre, Shift+Alt does both, and a modifier changed mid-drag is read fresh on each move; FigCraft matches in all six, Ctrl/Cmd while dragging could not be measured; no code change | this page |
|
||||
|
||||
Reference in new issue
Block a user