From b0673ffc8b659c7d0b0b04dea80d8d2314afcc86 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 31 Oct 2026 18:52:48 -0400 Subject: [PATCH 01/49] packaging(flatpak): add OCI image build and GHCR publishing helper (#1784) --- packaging/linux/flatpak-bundle.sh | 8 ++++ packaging/linux/flatpak-oci.sh | 64 +++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100755 packaging/linux/flatpak-oci.sh diff --git a/packaging/linux/flatpak-bundle.sh b/packaging/linux/flatpak-bundle.sh index b3353b386..808de718f 100755 --- a/packaging/linux/flatpak-bundle.sh +++ b/packaging/linux/flatpak-bundle.sh @@ -21,10 +21,12 @@ APP_ID=ai.storyteller.figcraft FLATHUB=https://dl.flathub.org/repo/flathub.flatpakrepo TEST=1 +OCI=0 TARBALL="" while [[ $# -gt 0 ]]; do case "$1" in --no-test) TEST=0; shift ;; + --oci) OCI=1; shift ;; -h | --help) sed -n '2,14p' "$0"; exit 0 ;; -*) echo "unknown argument: $1" >&2; exit 2 ;; *) TARBALL="$1"; shift ;; @@ -62,6 +64,12 @@ OUT="$DIST/$BASENAME.flatpak" # --runtime-repo lets `flatpak install` fetch the freedesktop runtime from Flathub if missing. flatpak build-bundle --runtime-repo="$FLATHUB" "$WORK/repo" "$OUT" "$APP_ID" stable echo "wrote $OUT" +if [[ "$OCI" = 1 ]]; then + OUT_OCI="$DIST/$BASENAME-oci" + rm -rf "$OUT_OCI" + flatpak build-bundle --oci "$WORK/repo" "$OUT_OCI" "$APP_ID" stable + echo "wrote OCI layout to $OUT_OCI" +fi if [[ "$TEST" = 1 ]]; then flatpak install --user -y --noninteractive --reinstall "$OUT" diff --git a/packaging/linux/flatpak-oci.sh b/packaging/linux/flatpak-oci.sh new file mode 100755 index 000000000..33ec81cd9 --- /dev/null +++ b/packaging/linux/flatpak-oci.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +# Build figcraft as an OCI container layout and push it to GitHub Container Registry (GHCR) +# for consumption by Flatpak OCI clients (flatpak-oci-specs). +# +# Usage: +# packaging/linux/flatpak-oci.sh [--push] [TARBALL] +# +# Environment variables: +# REGISTRY Target registry image (default: ghcr.io/storytold/figcraft) +# TAG Target image tag (default: $VERSION-$ARCH, also tags stable-$ARCH) +# GITHUB_TOKEN Token for GHCR authentication when --push is used +set -euo pipefail +# shellcheck source=../env.sh +. "$(dirname "${BASH_SOURCE[0]}")/../env.sh" +HERE="$ROOT/packaging/linux" + +PUSH=0 +TARBALL="" +while [[ $# -gt 0 ]]; do + case "$1" in + --push) PUSH=1; shift ;; + -h | --help) sed -n '2,12p' "$0"; exit 0 ;; + -*) echo "unknown argument: $1" >&2; exit 2 ;; + *) TARBALL="$1"; shift ;; + esac +done + +ARCH="$(uname -m)" +case "$ARCH" in + x86_64) ;; + aarch64 | arm64) ARCH=aarch64 ;; + *) echo "unsupported architecture $ARCH" >&2; exit 2 ;; +esac + +BASENAME="figcraft-$VERSION-linux-$ARCH" +OUT_OCI="$DIST/$BASENAME-oci" + +echo "==> Building Flatpak OCI layout for $BASENAME" +"$HERE/flatpak-bundle.sh" --oci --no-test "${TARBALL:-}" + +[[ -d "$OUT_OCI" ]] || { echo "error: $OUT_OCI layout not generated" >&2; exit 1; } + +REGISTRY="${REGISTRY:-ghcr.io/storytold/figcraft}" +TAG="${TAG:-$VERSION-$ARCH}" + +echo "==> OCI layout ready at $OUT_OCI (Target: $REGISTRY:$TAG)" + +if [[ "$PUSH" = 1 ]]; then + command -v skopeo >/dev/null || { echo "error: skopeo is required to push OCI images (apt install skopeo)" >&2; exit 1; } + + AUTH_ARGS=() + if [[ -n "${GITHUB_TOKEN:-}" ]]; then + AUTH_ARGS=(--dest-creds "${GITHUB_ACTOR:-storytold}:$GITHUB_TOKEN") + fi + + echo "==> Pushing to $REGISTRY:$TAG" + skopeo copy --format oci "${AUTH_ARGS[@]}" "oci:$OUT_OCI" "docker://$REGISTRY:$TAG" + + # Also update architecture-specific stable tag + echo "==> Pushing to $REGISTRY:stable-$ARCH" + skopeo copy --format oci "${AUTH_ARGS[@]}" "oci:$OUT_OCI" "docker://$REGISTRY:stable-$ARCH" + + echo "==> Push complete" +fi From 53259cf50eba496998ae156ddc3270197ac056c5 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 31 Oct 2026 23:43:14 -0400 Subject: [PATCH 02/49] ci: grant packages write permission to release workflow --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f93219fae..68a705399 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,7 @@ on: permissions: contents: write + packages: write concurrency: group: release-${{ github.ref }} From 7b5f8c369988ad6b46946b91a95a87aa347f0e93 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 1 Nov 2026 12:30:08 -0500 Subject: [PATCH 03/49] docs: sync Craft App Suite list with ArtCraft Launcher --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 63c8fb3d1..012ca857a 100644 --- a/README.md +++ b/README.md @@ -314,14 +314,22 @@ stand on its own. | | App | What it's for | Code | Learn more | |:-:|---|---|---|---| -| | **FigCraft** | **Interface design, components and prototypes · you are here** | [GitHub](https://github.com/storytold/figcraft) | [Website](https://getartcraft.com/apps/figcraft) | -| | **PhotoCraft** | Image editing | [GitHub](https://github.com/storytold/photocraft) | [Website](https://getartcraft.com/apps/photocraft) | +| | **PhotoCraft** | Image editing: layers, masks, type and real PSD files | [GitHub](https://github.com/storytold/photocraft) | [Website](https://getartcraft.com/apps/photocraft) | | | **VectorCraft** | Vector illustration | [GitHub](https://github.com/storytold/vectorcraft) | [Website](https://getartcraft.com/apps/vectorcraft) | | | **FilmCraft** | Video editing, color and sound | [GitHub](https://github.com/storytold/filmcraft) | [Website](https://getartcraft.com/apps/filmcraft) | | | **LightCraft** | Photo library and raw development | [GitHub](https://github.com/storytold/lightcraft) | [Website](https://getartcraft.com/apps/lightcraft) | | | **PdfCraft** | Reading, organizing and protecting PDFs | [GitHub](https://github.com/storytold/pdfcraft) | [Website](https://getartcraft.com/apps/pdfcraft) | | | **EffectCraft** | Motion graphics and visual effects | [GitHub](https://github.com/storytold/effectcraft) | [Website](https://getartcraft.com/apps/effectcraft) | | | **DesignCraft** | Page layout and publishing | [GitHub](https://github.com/storytold/designcraft) | [Website](https://getartcraft.com/apps/designcraft) | +| | **FigCraft** | Interface design and prototyping | [GitHub](https://github.com/storytold/figcraft) | [Website](https://getartcraft.com/apps/figcraft) | +| | **WordCraft** | Word processing and documents | [GitHub](https://github.com/storytold/wordcraft) | [Website](https://getartcraft.com/apps/wordcraft) | +| | **SoundCraft** | Audio recording and editing | [GitHub](https://github.com/storytold/soundcraft) | [Website](https://getartcraft.com/apps/soundcraft) | +| | **DeckCraft** | Presentations and slide decks | [GitHub](https://github.com/storytold/deckcraft) | [Website](https://getartcraft.com/apps/deckcraft) | +| | **CADCraft** | Computer-aided design | [GitHub](https://github.com/storytold/cadcraft) | [Website](https://getartcraft.com/apps/cadcraft) | +| | **GridCraft** | Spreadsheets and data | [GitHub](https://github.com/storytold/gridcraft) | [Website](https://getartcraft.com/apps/gridcraft) | +| | **TextureCraft** | 3D texture painting | [GitHub](https://github.com/storytold/texturecraft) | [Website](https://getartcraft.com/apps/texturecraft) | +| | **Craft Anything** | See how any software works, then build your own | [GitHub](https://github.com/storytold/craft-anything) | [Website](https://getartcraft.com/apps/craft-anything) | +| | **SolidCraft** | Parametric 3D CAD by Tangency Labs (community app) | [GitHub](https://github.com/tangency-labs/solidcraft) | | And [**ArtCraft**](https://getartcraft.com/) itself, our AI image and video studio for artists who want real control. From 5fc2840d9089e0b21056b57c4dff9f795e38a4e3 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 1 Nov 2026 13:58:36 -0500 Subject: [PATCH 04/49] Release 0.14.0 Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 44 ++++++++++++++++++++++---------------------- Cargo.toml | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 797f6498d..888365316 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1763,7 +1763,7 @@ checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" [[package]] name = "figcraft" -version = "0.13.1" +version = "0.14.0" dependencies = [ "arboard", "craft-menu", @@ -1795,7 +1795,7 @@ dependencies = [ [[package]] name = "figcraft-cli" -version = "0.13.1" +version = "0.14.0" dependencies = [ "clap", "clap_complete", @@ -1813,7 +1813,7 @@ dependencies = [ [[package]] name = "figcraft-collab" -version = "0.13.1" +version = "0.14.0" dependencies = [ "base64 0.22.1", "chrono", @@ -1831,7 +1831,7 @@ dependencies = [ [[package]] name = "figcraft-collab-net" -version = "0.13.1" +version = "0.14.0" dependencies = [ "base64 0.22.1", "figcraft-collab", @@ -1854,7 +1854,7 @@ dependencies = [ [[package]] name = "figcraft-color" -version = "0.13.1" +version = "0.14.0" dependencies = [ "kurbo", "serde", @@ -1863,7 +1863,7 @@ dependencies = [ [[package]] name = "figcraft-doc" -version = "0.13.1" +version = "0.14.0" dependencies = [ "figcraft-color", "figcraft-geom", @@ -1876,7 +1876,7 @@ dependencies = [ [[package]] name = "figcraft-engine" -version = "0.13.1" +version = "0.14.0" dependencies = [ "base64 0.22.1", "craft-docpath", @@ -1910,7 +1910,7 @@ dependencies = [ [[package]] name = "figcraft-format" -version = "0.13.1" +version = "0.14.0" dependencies = [ "figcraft-doc", "figcraft-layout", @@ -1927,7 +1927,7 @@ dependencies = [ [[package]] name = "figcraft-geom" -version = "0.13.1" +version = "0.14.0" dependencies = [ "kurbo", "serde", @@ -1935,7 +1935,7 @@ dependencies = [ [[package]] name = "figcraft-layout" -version = "0.13.1" +version = "0.14.0" dependencies = [ "figcraft-doc", "figcraft-geom", @@ -1943,7 +1943,7 @@ dependencies = [ [[package]] name = "figcraft-mcp" -version = "0.13.1" +version = "0.14.0" dependencies = [ "base64 0.22.1", "figcraft-collab-net", @@ -1959,7 +1959,7 @@ dependencies = [ [[package]] name = "figcraft-pathops" -version = "0.13.1" +version = "0.14.0" dependencies = [ "figcraft-doc", "figcraft-geom", @@ -1968,7 +1968,7 @@ dependencies = [ [[package]] name = "figcraft-pdf" -version = "0.13.1" +version = "0.14.0" dependencies = [ "figcraft-color", "figcraft-doc", @@ -1985,7 +1985,7 @@ dependencies = [ [[package]] name = "figcraft-plugin" -version = "0.13.1" +version = "0.14.0" dependencies = [ "figcraft-color", "serde", @@ -1998,7 +1998,7 @@ dependencies = [ [[package]] name = "figcraft-render" -version = "0.13.1" +version = "0.14.0" dependencies = [ "crc32fast", "figcraft-color", @@ -2017,7 +2017,7 @@ dependencies = [ [[package]] name = "figcraft-server" -version = "0.13.1" +version = "0.14.0" dependencies = [ "chrono", "crc32fast", @@ -2042,7 +2042,7 @@ dependencies = [ [[package]] name = "figcraft-svg" -version = "0.13.1" +version = "0.14.0" dependencies = [ "base64 0.22.1", "figcraft-color", @@ -2058,7 +2058,7 @@ dependencies = [ [[package]] name = "figcraft-text" -version = "0.13.1" +version = "0.14.0" dependencies = [ "core-text", "craft-font-catalog", @@ -2076,7 +2076,7 @@ dependencies = [ [[package]] name = "figcraft-ui-egui" -version = "0.13.1" +version = "0.14.0" dependencies = [ "base64 0.22.1", "chrono", @@ -2104,7 +2104,7 @@ dependencies = [ [[package]] name = "figcraft-vectordrawable" -version = "0.13.1" +version = "0.14.0" dependencies = [ "figcraft-color", "figcraft-doc", @@ -2118,7 +2118,7 @@ dependencies = [ [[package]] name = "figcraft-web" -version = "0.13.1" +version = "0.14.0" dependencies = [ "base64 0.22.1", "eframe", @@ -6739,7 +6739,7 @@ checksum = "9440ea3e5aeabb0ac63af70daf835274065238cdd0cec83418f417eae38bacee" [[package]] name = "xtask" -version = "0.13.1" +version = "0.14.0" dependencies = [ "figcraft-engine", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index a560971a8..c7a86dd21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ exclude = ["plugins"] # default-members = ["crates/*", "apps/figcraft", "apps/figcraft-cli", "xtask"] [workspace.package] -version = "0.13.1" +version = "0.14.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.95" From 83c28cf3aeb2df61c8c0c3941a3e7fbe6dbe5e1a Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 1 Nov 2026 14:12:18 -0500 Subject: [PATCH 05/49] M6: SVG import: a stretched image stays stretched (#1811) Co-authored-by: Claude Fable 5.1 --- crates/svg/src/import.rs | 12 +++++++++++- crates/svg/src/import/structure_tests.rs | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/crates/svg/src/import.rs b/crates/svg/src/import.rs index 71c6c3b05..e3d9d8523 100644 --- a/crates/svg/src/import.rs +++ b/crates/svg/src/import.rs @@ -608,7 +608,17 @@ fn image(cx: &mut Ctx, img: &usvg::Image, id: &str, parent: NodeId, base: Affine let hash = add_image(cx.doc, bytes, iw, ih); let mut n = Node::new(cx.doc.alloc_id(), NodeKind::Rectangle, layer_name(id, "Image"), w, h); n.transform = transform; - n.fills = vec![Paint::image(hash, ImageScaleMode::Fill)]; + let mut fill = Paint::image(hash, ImageScaleMode::Fill); + // usvg sizes the box to the picture (`meet` and `slice` are in the transform), so a box of + // another shape is `preserveAspectRatio="none"`: the picture stretched edge to edge. A Fill + // would keep its shape and crop it; a crop of the whole picture stretches it. + if (w * ih - h * iw).abs() > 1e-6 * (w * ih).max(h * iw) + && let figcraft_color::PaintKind::Image(ip) = &mut fill.kind + { + ip.scale_mode = ImageScaleMode::Crop; + ip.crop = Some(Affine::IDENTITY.as_coeffs()); + } + n.fills = vec![fill]; cx.add(n, parent); } diff --git a/crates/svg/src/import/structure_tests.rs b/crates/svg/src/import/structure_tests.rs index adeedb005..f16abb66a 100644 --- a/crates/svg/src/import/structure_tests.rs +++ b/crates/svg/src/import/structure_tests.rs @@ -129,6 +129,28 @@ fn strokes_scale_with_their_layer() { assert_eq!((l.width, l.stroke.weight, l.stroke.dashes.clone()), (30.0, 6.0, vec![12.0, 6.0])); } +/// `preserveAspectRatio="none"` stretches a picture into its box edge to edge. usvg sizes the +/// box to the picture for `meet` and `slice` (the fit is in the transform), so a box of another +/// shape is a stretch: a Fill, which keeps the picture's shape and crops it, would show the +/// middle of the picture instead. +#[test] +fn an_image_stretched_into_its_box_stays_stretched() { + use figcraft_color::{ImageScaleMode, PaintKind}; + let (d, f) = + import(&format!(r##""##)); + let n = node(&d, f, "pic"); + assert_eq!((n.width, n.height), (40.0, 40.0)); + let Some(PaintKind::Image(ip)) = n.fills.first().map(|p| &p.kind) else { panic!("{:?}", n.fills) }; + // The 4 × 2 picture's pixels map onto the whole 40 × 40 box: 10 across, 20 down. + let m = figcraft_render::paint::image_transform(ip, 4.0, 2.0, n.width, n.height); + assert_eq!((m.sx, m.ky, m.kx, m.sy, m.tx, m.ty), (10.0, 0.0, 0.0, 20.0, 0.0, 0.0), "{ip:?}"); + // With the aspect kept (the default) the box is the picture's own shape and a Fill is exact. + let (d, f) = import(&format!(r##""##)); + let n = node(&d, f, "pic"); + assert_eq!((n.width, n.height), (40.0, 20.0)); + assert!(matches!(n.fills.first().map(|p| &p.kind), Some(PaintKind::Image(i)) if i.scale_mode == ImageScaleMode::Fill), "{:?}", n.fills); +} + #[test] fn linked_files_are_never_read() { let dir = std::env::temp_dir().join("figcraft-svg-linked"); From 6b2e464361e84e3df28d33da5681ac08e9991763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=BC=ED=98=84?= Date: Mon, 2 Nov 2026 04:12:23 +0900 Subject: [PATCH 06/49] M8: a scaled node's spread shadow keeps its room in SVG (#1803) The SVG export blurs a spread drop shadow in a filter whose region is the silhouette's page bounds grown by the spread's mitre and the blur. The spread grows the outline in the node's own units, though, and the transform then scales it: on a star scaled three times, a spread of 10 mitred out to some 97 units while the region only made room for 48, so SVG viewers cut the shadow's points off. The spread now grows the region as far across and down as the transform takes a local step of that length, as the paint bounds already do. Co-authored-by: Claude Opus 5.5 --- crates/svg/src/effects_tests.rs | 42 +++++++++++++++++++++++++++++++++ crates/svg/src/lib.rs | 10 +++++--- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/crates/svg/src/effects_tests.rs b/crates/svg/src/effects_tests.rs index 5177e992b..f81d8e04c 100644 --- a/crates/svg/src/effects_tests.rs +++ b/crates/svg/src/effects_tests.rs @@ -83,3 +83,45 @@ fn hostile_shadow_values_still_export() { assert!(export_svg(&d, &[n], &SvgOptions::default()).is_some()); } } + +/// The filter a spread shadow is blurred in makes room for the spread as the node's transform +/// draws it: on a star scaled three times, the spread's mitres reach three times as far, and on a +/// skewed one further across than down. +#[test] +fn a_scaled_spread_shadow_keeps_its_filter_room() { + use figcraft_doc::SPREAD_MITER_LIMIT; + use figcraft_geom::{Affine, kurbo}; + let star = NodeKind::Star { count: 5, inner_ratio: 0.4 }; + let s = + Shadow { color: Color::from_hex("000000").unwrap(), offset: (6.0, -9.0), radius: 4.0, spread: 10.0, show_behind: true, ..Default::default() }; + for (why, xf) in [ + ("scaled 3", Affine::scale(3.0)), + ("scaled (3, 1)", Affine::scale_non_uniform(3.0, 1.0)), + ("skewed", Affine::new([1.0, 0.0, 2.0, 1.0, 0.0, 0.0])), + ("turned and stretched", Affine::rotate(0.5) * Affine::scale_non_uniform(3.0, 1.0)), + ("as drawn", Affine::IDENTITY), + ] { + let (mut d, n) = with_effects(star.clone(), vec![EffectKind::DropShadow(s.clone())]); + let t = d.get(n).unwrap().transform; + d.get_mut(n).unwrap().transform = t * xf; + let svg = export(&d, n); + let tag = &svg[svg.find(" f64 { + let at = tag.find(&format!(" {name}=\"")).unwrap() + name.len() + 3; + tag[at..at + tag[at..].find('"').unwrap()].parse().unwrap() + }; + let region = kurbo::Rect::new(attr("x"), attr("y"), attr("x") + attr("width"), attr("y") + attr("height")); + // What the shadow paints, as the renderer draws it: the outline stroked twice the spread + // wide with mitred joins, through the node's transform, moved by the offset (in the + // export's frame, which starts at the node's export bounds) and blurred. + let bounds = figcraft_render::export_bounds(&d, n).unwrap(); + let at = Affine::translate((s.offset.0 - bounds.x0, s.offset.1 - bounds.y0)) * d.world_transform(n); + let shape = figcraft_render::node_outline(&d, d.get(n).unwrap()).unwrap(); + let stroke = kurbo::Stroke::new(s.spread * 2.0).with_join(kurbo::Join::Miter).with_miter_limit(SPREAD_MITER_LIMIT); + let mut grown = kurbo::stroke(shape.0.iter(), &stroke, &Default::default(), 0.01); + grown.apply_affine(at); + let blur = s.radius * 1.5; + let painted = figcraft_geom::Shape::bounding_box(&grown).inflate(blur, blur); + assert!(region.union(painted) == region, "{why}: the filter {region:?} cuts the shadow at {painted:?}"); + } +} diff --git a/crates/svg/src/lib.rs b/crates/svg/src/lib.rs index de98795d3..58d80ac91 100644 --- a/crates/svg/src/lib.rs +++ b/crates/svg/src/lib.rs @@ -1052,10 +1052,14 @@ impl W<'_> { else { continue; }; - let reach = s.spread.abs() * SPREAD_MITER_LIMIT + s.radius.abs() * 1.5 + 2.0; + // The spread grows the outline in its own units (mitres up to the limit), drawn through + // `xf`: as far across and down as a local step that long goes. The blur is in page units. + let spread = if s.spread.is_finite() { s.spread.abs() * SPREAD_MITER_LIMIT } else { 0.0 }; + let [a, b_, c, d, _, _] = xf.as_coeffs(); + let blur = s.radius.abs() * 1.5 + 2.0; + let region = b.inflate(spread * a.hypot(c) + blur, spread * b_.hypot(d) + blur); let cover = if s.show_behind { None } else { self.cover_input(n, xf) }; - let filter = - self.blur_filter(s.radius, b.inflate(reach, reach), cover.as_deref()).map(|f| format!(" filter=\"url(#{f})\"")).unwrap_or_default(); + let filter = self.blur_filter(s.radius, region, cover.as_deref()).map(|f| format!(" filter=\"url(#{f})\"")).unwrap_or_default(); let op = f64::from(s.color.a * n.opacity.clamp(0.0, 1.0)); let blend = if matches!(s.blend, figcraft_color::BlendMode::Normal | figcraft_color::BlendMode::PassThrough) { String::new() From 264bcb1c03219fe8785af50487d7b5a367a338c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=BC=ED=98=84?= Date: Mon, 2 Nov 2026 04:12:27 +0900 Subject: [PATCH 07/49] M8: an arc's spread shadow and mitred stroke get room for their corners (#1802) * M8: an arc's spread shadow gets room for its mitred corners Rectangles, frames and ellipses grow by exactly their spread, so their layers only make room for the spread itself; other shapes make room for the mitre at sharp corners (up to four times the spread). An ellipse with arc data (a pie slice, or a ring cut short) counted as an ellipse, but its ends meet its sides in sharp corners: a spread of 25 on a slice of 0.3 rad cut its shadow off at the layer's edge (up to 255 levels). Only an ellipse that goes all the way round now grows by exactly its spread. `figcraft_geom::full_sweep` is what `ellipse` already used to tell a whole ellipse or ring from an arc, so the two agree. Co-Authored-By: Claude Opus 5.5 * M8: an arc's mitred stroke gets room for its corners too Review: `outline_reach` counted every ellipse as an outline whose stroke mitres end on the grown box, the same mistake as the spread. A thin slice with a 20-unit mitred stroke and a spread of 10 still had its shadow cut off (255 levels). It now asks `grows_by_exactly_its_spread`, which picks the same shapes and leaves arcs out. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- crates/doc/src/node.rs | 17 +++++++---- crates/geom/src/lib.rs | 8 ++++- crates/render/src/spread_tests.rs | 50 +++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 7 deletions(-) diff --git a/crates/doc/src/node.rs b/crates/doc/src/node.rs index 6ec7e8245..3ac81afdb 100644 --- a/crates/doc/src/node.rs +++ b/crates/doc/src/node.rs @@ -942,9 +942,9 @@ impl Node { matches!(&self.kind, NodeKind::Vector { network } if network.vertices.iter().any(|v| v.cap.is_some_and(StrokeCap::is_arrow))); let caps = if self.stroke.cap_start.is_arrow() || self.stroke.cap_end.is_arrow() || point_arrows { w.max(self.stroke.weight) * 3.0 } else { w }; - // Right-angled or smooth outlines (boxes, ellipses) end their mitres on the grown box. - let boxy = matches!(self.kind, NodeKind::Rectangle | NodeKind::Ellipse { .. } | NodeKind::Section { .. }) || self.kind.is_frame_like(); - let miter = if boxy { 1.0 } else { self.stroke.miter_limit.clamp(1.0, 4.0) }; + // Right-angled or smooth outlines (boxes, whole ellipses) end their mitres on the grown + // box; an arc's corners don't. + let miter = if self.grows_by_exactly_its_spread() { 1.0 } else { self.stroke.miter_limit.clamp(1.0, 4.0) }; base.max(if matches!(self.kind, NodeKind::Line | NodeKind::Vector { .. }) { caps } else { 0.0 }) * miter } else { 0.0 @@ -960,14 +960,19 @@ impl Node { !(matches!(self.kind, NodeKind::Group) || (matches!(self.kind, NodeKind::Text(_)) && self.has_visible_stroke())) } - /// Whether a spread grows this node's outline by exactly the spread (no sharp corners). + /// Whether a spread grows this node's outline by exactly the spread (no sharp corners). An arc + /// (an ellipse that doesn't go all the way round) has corners where its ends meet its sides. fn grows_by_exactly_its_spread(&self) -> bool { - matches!(self.kind, NodeKind::Rectangle | NodeKind::Ellipse { .. } | NodeKind::Section { .. }) || self.kind.is_frame_like() + match self.kind { + NodeKind::Rectangle | NodeKind::Section { .. } => true, + NodeKind::Ellipse { sweep, .. } => figcraft_geom::full_sweep(sweep), + _ => self.kind.is_frame_like(), + } } /// How much further than its spread a drop shadow can reach at the outline's sharp corners: /// spread moves the edges out in parallel and they meet in a mitre (see - /// [`SPREAD_MITER_LIMIT`]). Rectangles, frames and ellipses grow by exactly the spread. + /// [`SPREAD_MITER_LIMIT`]). Rectangles, frames and whole ellipses grow by exactly the spread. fn spread_miter_reach(&self) -> f64 { if self.grows_by_exactly_its_spread() { return 0.0; diff --git a/crates/geom/src/lib.rs b/crates/geom/src/lib.rs index 012fca429..696a02e92 100644 --- a/crates/geom/src/lib.rs +++ b/crates/geom/src/lib.rs @@ -319,6 +319,12 @@ fn line_or_move(path: &mut BezPath, p: Point) { } } +/// Whether an ellipse of this `sweep` (radians) goes all the way round: a whole ellipse or ring, +/// without the sharp corners where an arc's ends meet its sides. +pub fn full_sweep(sweep: f64) -> bool { + finite(sweep).abs() >= TAU - 1e-9 +} + /// An ellipse in the `width`×`height` box; with arc data, a pie/arc/ring: `start` and `sweep` in /// radians (clockwise from 3 o'clock, y-down) and `inner` radius ratio 0..1. pub fn ellipse(width: f64, height: f64, start: f64, sweep: f64, inner: f64) -> BezPath { @@ -327,7 +333,7 @@ pub fn ellipse(width: f64, height: f64, start: f64, sweep: f64, inner: f64) -> B let sweep = finite(sweep).clamp(-TAU, TAU); let start = finite(start); let inner = finite(inner).clamp(0.0, 1.0); - let full = sweep.abs() >= TAU - 1e-9; + let full = full_sweep(sweep); let mut path = BezPath::new(); if full && inner <= 0.0 { return kurbo::Ellipse::new(c, (rx, ry), 0.0).to_path(0.01); diff --git a/crates/render/src/spread_tests.rs b/crates/render/src/spread_tests.rs index 00fbb6333..6b30766fc 100644 --- a/crates/render/src/spread_tests.rs +++ b/crates/render/src/spread_tests.rs @@ -142,3 +142,53 @@ fn spread_bands_are_cached_and_hostile_values_are_safe() { let _ = render(&d, n); } } + +/// An arc (a pie slice, or a ring cut short) has sharp corners where its ends meet its sides, and +/// a spread mitres them out past the spread: its layer makes room for that, as a star's does. A +/// clear shadow spread four times as far gives the same layer room to the full mitre: the shadow +/// it casts is the same. (Both layers end at the view here, so they line up pixel for pixel; +/// layers starting at different pixels can differ by a few levels at their edges.) +#[test] +fn arc_spread_mitres_are_not_cut_off() { + for kind in [ + NodeKind::Ellipse { start: 1.0, sweep: 0.3, inner: 0.0 }, + NodeKind::Ellipse { start: 0.0, sweep: 3.0, inner: 0.0 }, + NodeKind::Ellipse { start: 1.0, sweep: 2.0, inner: 0.8 }, + ] { + for spread in [25.0, 40.0] { + let (d, n) = shape(kind.clone(), vec![EffectKind::DropShadow(shadow(spread))]); + let clear = Shadow { color: Color::new(0.0, 0.0, 0.0, 0.0), ..shadow(spread * 4.0) }; + let (roomy, m) = shape(kind.clone(), vec![EffectKind::DropShadow(shadow(spread)), EffectKind::DropShadow(clear)]); + let (a, b) = (render(&d, n), render(&roomy, m)); + let worst = a.data().chunks(4).zip(b.data().chunks(4)).map(|(p, q)| p[3].abs_diff(q[3])).max().unwrap_or(0); + assert!(worst <= 2, "{kind:?}, a spread of {spread}: {worst} levels cut off"); + } + } +} + +/// A mitred stroke on an arc reaches out past its width at the arc's corners too, and a spread +/// grows from there: a thin slice with both keeps its whole shadow. +#[test] +fn arc_stroke_mitres_are_not_cut_off() { + use figcraft_doc::{StrokeAlign, StrokeJoin}; + let kind = NodeKind::Ellipse { start: std::f64::consts::FRAC_PI_2 - 0.015, sweep: 0.03, inner: 0.0 }; + for align in [StrokeAlign::Center, StrokeAlign::Outside] { + let make = |effects: Vec| { + let mut d = Document::new("arc"); + let p = d.first_page().unwrap(); + let n = d.create(p, kind.clone(), "S", 0.0, 190.0, 400.0, 20.0).unwrap(); + let node = d.get_mut(n).unwrap(); + node.fills = vec![Paint::solid(Color::WHITE)]; + node.strokes = vec![Paint::solid(Color::WHITE)]; + (node.stroke.weight, node.stroke.align, node.stroke.join, node.stroke.miter_limit) = (20.0, align, StrokeJoin::Miter, 4.0); + node.effects = effects.into_iter().map(|kind| Effect { kind, visible: true }).collect(); + (d, n) + }; + let (d, n) = make(vec![EffectKind::DropShadow(shadow(10.0))]); + let clear = Shadow { color: Color::new(0.0, 0.0, 0.0, 0.0), ..shadow(80.0) }; + let (roomy, m) = make(vec![EffectKind::DropShadow(shadow(10.0)), EffectKind::DropShadow(clear)]); + let (a, b) = (render(&d, n), render(&roomy, m)); + let worst = a.data().chunks(4).zip(b.data().chunks(4)).map(|(p, q)| p[3].abs_diff(q[3])).max().unwrap_or(0); + assert!(worst <= 2, "{align:?}: {worst} levels cut off"); + } +} From bd920fc7dec63ee8d433884a175f2f581cc9eb87 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 1 Nov 2026 14:12:31 -0500 Subject: [PATCH 08/49] M8: .fig import: a routed connector takes its line style from the generated record (#1807) (#1813) * M8: .fig import: a routed connector takes its line style from the generated record (#1807) Co-Authored-By: Claude Fable 5.1 * M8: .fig import: a routed connector keeps its own empty paints and dash pattern CodeRabbit review on #1813: an explicit empty strokePaints (no stroke) or dashPattern (solid) on the connector no longer takes the generated record's. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- .../format/src/fig/connector_label_tests.rs | 58 +++++++++++++++++++ crates/format/src/fig/map/connector.rs | 26 +++++++++ docs/file-format-parity.md | 5 +- 3 files changed, 87 insertions(+), 2 deletions(-) diff --git a/crates/format/src/fig/connector_label_tests.rs b/crates/format/src/fig/connector_label_tests.rs index de0c4f2fb..ca76c0b29 100644 --- a/crates/format/src/fig/connector_label_tests.rs +++ b/crates/format/src/fig/connector_label_tests.rs @@ -218,6 +218,64 @@ fn connector_mut<'a, 's>(message: &'a mut Kv<'s>, local_id: u64) -> Option<&'a m }) } +fn set_connector_field(message: &mut Kv<'_>, key: &'static str, value: Kv<'static>) { + let connector = connector_mut(message, 123).expect("synthetic connector"); + let Kv::Object(fields) = connector else { panic!("connector object") }; + if let Some((_, current)) = fields.iter_mut().find(|(name, _)| *name == key) { + *current = value; + } else { + fields.push((key, value)); + } +} + +/// A connector without a saved snapshot (a curved or elbowed one is routed here) still draws its +/// line as the generated record says: the paint, weight, cap and dashes live there, not on the +/// connector (#1807). +#[test] +fn a_routed_connector_takes_its_line_style_from_the_generated_record() { + let mut message = synthetic_connector(1.0, false, 0.0); + set_connector_field(&mut message, "connectorLineStyle", Kv::Enum("CURVED")); + set_connector_field(&mut message, "connectorStart", obj(vec![("position", point(10.0, 10.0))])); + set_connector_field(&mut message, "connectorEnd", obj(vec![("position", point(110.0, 60.0))])); + set_override_field(&mut message, "nodeGenerationData", 0, "strokeWeight", scalar(4.0)); + set_override_field(&mut message, "nodeGenerationData", 0, "strokeCap", Kv::Enum("ROUND")); + set_override_field(&mut message, "nodeGenerationData", 0, "dashPattern", Kv::Array(vec![scalar(16.0), scalar(10.0)])); + let (rest, warnings, _) = map::to_rest(&message, "synthetic", crate::rest::MAX_NODES); + let connector = &rest["document"]["children"][0]["children"][0]; + assert_eq!(connector["type"], "VECTOR"); + assert!(connector.get("vectorNetwork").is_some(), "routed here: {connector}"); + assert_eq!(connector["strokes"].as_array().map(Vec::len), Some(1), "{connector}"); + assert!((connector["strokes"][0]["color"]["b"].as_f64().unwrap() - 0.8).abs() < 1e-6); + assert_eq!(connector["strokeWeight"], 4.0); + assert_eq!(connector["strokeDashes"], serde_json::json!([16.0, 10.0])); + assert_eq!(connector["strokeCapEnd"], "ARROW"); + assert!(warnings.iter().any(|warning| warning.contains("follow FigCraft's own routing")), "{warnings:?}"); + + let (native, _) = crate::rest::import_fig(&rest, &|_| None).unwrap(); + let node = find_node(&native, "synthetic connector"); + assert_eq!((node.strokes.len(), node.stroke.weight, node.stroke.dashes.clone()), (1, 4.0, vec![16.0, 10.0])); +} + +/// A routed connector that writes its own empty paints and dash pattern is meant to have no stroke +/// and a solid line: the generated record's paint and dashes don't replace them. +#[test] +fn a_routed_connector_keeps_its_own_empty_paints_and_dashes() { + let mut message = synthetic_connector(1.0, false, 0.0); + set_connector_field(&mut message, "connectorLineStyle", Kv::Enum("CURVED")); + set_connector_field(&mut message, "connectorStart", obj(vec![("position", point(10.0, 10.0))])); + set_connector_field(&mut message, "connectorEnd", obj(vec![("position", point(110.0, 60.0))])); + set_connector_field(&mut message, "strokePaints", Kv::Array(Vec::new())); + set_connector_field(&mut message, "dashPattern", Kv::Array(Vec::new())); + set_override_field(&mut message, "nodeGenerationData", 0, "strokeWeight", scalar(4.0)); + set_override_field(&mut message, "nodeGenerationData", 0, "dashPattern", Kv::Array(vec![scalar(16.0), scalar(10.0)])); + let (rest, _, _) = map::to_rest(&message, "synthetic", crate::rest::MAX_NODES); + let connector = &rest["document"]["children"][0]["children"][0]; + assert!(connector.get("vectorNetwork").is_some(), "routed here: {connector}"); + assert!(connector["strokes"].as_array().is_none_or(Vec::is_empty), "{connector}"); + assert!(connector.get("strokeDashes").is_none(), "{connector}"); + assert_eq!(connector["strokeWeight"], 4.0); +} + fn set_override_field(message: &mut Kv<'_>, field: &str, local_id: u64, key: &'static str, value: Kv<'static>) { let connector = connector_mut(message, 123).expect("synthetic connector"); let section = field_mut(connector, field).expect("connector override section"); diff --git a/crates/format/src/fig/map/connector.rs b/crates/format/src/fig/map/connector.rs index 7da7458b9..de2ff501c 100644 --- a/crates/format/src/fig/map/connector.rs +++ b/crates/format/src/fig/map/connector.rs @@ -1,4 +1,5 @@ use super::layer::{cap_name, own_text, svg_path, valid_size}; +use super::paint::{paint, stroke}; use super::{Affine, Kv, Mapper, NO_STYLE, Obj, Point, Value, View, generated_record, guid, json, matrix, network, num, rows}; use figcraft_doc::geom::kurbo::{BezPath, PathEl, Rect, Shape}; use figcraft_doc::{RouteEnd, Routing, Side, route_points}; @@ -29,6 +30,7 @@ impl<'a> Mapper<'a> { return Vec::new(); } let mid = self.connector(o, v, space); + self.connector_line_style(o, v); if shape.label { return self.connector_label(o, v, rest_id, mid); } @@ -122,6 +124,30 @@ impl<'a> Mapper<'a> { middle(&path).map(|m| m - b.origin().to_vec2()) } + /// The line's paint, weight, cap and dashes, which a connector keeps in its generated line + /// record rather than on itself: without a saved snapshot the routed line took none of them and + /// drew nothing (#1807). The connector's own values, when it has any, win. + fn connector_line_style(&mut self, o: &mut Obj, v: &View<'a>) { + let Some(line_style) = generated_record(v, "nodeGenerationData", 0) else { return }; + let style = View::of(line_style); + // A connector that writes its own (even empty) paints or dash pattern keeps them: an empty + // list is no stroke, or a solid line, not a missing value. + if v.get("strokePaints").is_none() && o.get("strokes").and_then(Value::as_array).is_none_or(Vec::is_empty) { + let strokes: Vec = style.list("strokePaints").iter().filter_map(|p| paint(p, &mut |w| self.warn(w))).collect(); + if !strokes.is_empty() { + o.insert("strokes".into(), Value::Array(strokes)); + } + } + let mut line = Obj::new(); + stroke(&mut line, &style); + if v.get("dashPattern").is_some() { + line.remove("strokeDashes"); + } + for (key, value) in line { + o.entry(key).or_insert(value); + } + } + /// A connector with a label but no saved snapshot of it, as the frame a saved one imports as: /// `o` keeps the connector's place and size and gives its line to a vector child, and the /// label is a text child centred on `mid` (the line's middle; the frame's centre when the line diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 50805f39e..56cc701a2 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-31 · **Change:** minor (a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; pasted layers whose image the clipboard lacks are named and show a placeholder that reads as missing (#1646); paint-style colours on layers pasted from another design app keep their style instead of turning black (#1638); imported and pasted text finds an installed family under the other names its fonts give it, and with other case and spacing (#1292); `.fig` export writes colour calculations as the colour they show in each mode and leaves out, with a warning, one that resolves to nothing (#1280); `.fig` import budgets four decoded values per compressed byte instead of one, still within 20M–128M, so dense files within that budget open instead of being refused as having too many values (#574); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); every file a command reads whole by path is a regular file within a cap that fits it: documents 16 GiB, placed images 256 MiB, CLI scripts 1 GiB; folders, devices and pipes are refused before anything is read (#1114); files nested 256 levels deep import on the browser's 1 MB stack (#1101); SVG and PDF exports count pattern sources and the renders they embed from the layer's depth, so one cap bounds a whole export (#1082); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); a FigJam `.jam` file opens as a board (#1342); FigJam `.jam` files open like `.fig` files: File ▸ Open, drag and drop, `file.import` and the command line (#1342); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); SVG import draws each pattern tile once per scale, within the layer budget (#1080); a file's JPEG thumbnail can't crash the home screen (#1491's progressive JPEG check, now shared); `.fig` import: library text styles linked by asset key, and override rows restating a nested level (#1234); `.fig` import keeps the file's saved line breaks while the text and its box are unedited (#1236); Download a missing free font from the Missing fonts window (`font.download`, #754); offline Penpot 2.x import/export (#1143); `.sketch` import checked against Sketch's renders: master backgrounds, symbol clipping, tints before Sketch 64, mask opacity, bitmap fills, image overrides on shapes, stretching stacks, blur radii, colour adjustments, OKLab gradients, text growth, shape group borders (#1389); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); image member names are checked on read, and REST image placeholders get archive-safe keys (#1086); Android Vector Drawable (XML) export; `.fig` export: files the incumbent imports, with component set properties, and grid track sizes at its field ids; Save and auto-save don't replace changes another app made to the open file (#1330); `.sketch` import, best effort, Sketch 48 and newer; the PNG row names ignore overlapping layers and where include bounding box is offered; the Fonts table's missing-font row describes the Missing fonts window; `.figcraft` carries the file kind (boards); `.fig` import: resized instances and variable modes by asset key; atomic saves; auto-save; SVG export clip of nested frames; SVG/PDF export depth refusal (#208); `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; `.fig` export: written files checked by opening them in other software; experimental `.fig` export; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; embedded image colour profiles; `.fig` import, best effort; animated GIF fills and TIFF images; last major: created, formats from the installed Figma's Info.plist and help center, ours from source; REST import keeps slot layers and instances' slot content (#792); REST import reads grid track sizes (#465); `.fig` import fidelity from the community batches, budgets for large files, the import report, a `.fig` copy from Save as, paste from another design app; instance layers' size and resizing and Hug on import (#731, #732)) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-01 · **Change:** minor (a FigJam connector without a saved snapshot took no stroke and was invisible; its line's paint, weight, cap and dashes now come from the file's generated line record (#1807); a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; pasted layers whose image the clipboard lacks are named and show a placeholder that reads as missing (#1646); paint-style colours on layers pasted from another design app keep their style instead of turning black (#1638); imported and pasted text finds an installed family under the other names its fonts give it, and with other case and spacing (#1292); `.fig` export writes colour calculations as the colour they show in each mode and leaves out, with a warning, one that resolves to nothing (#1280); `.fig` import budgets four decoded values per compressed byte instead of one, still within 20M–128M, so dense files within that budget open instead of being refused as having too many values (#574); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); every file a command reads whole by path is a regular file within a cap that fits it: documents 16 GiB, placed images 256 MiB, CLI scripts 1 GiB; folders, devices and pipes are refused before anything is read (#1114); files nested 256 levels deep import on the browser's 1 MB stack (#1101); SVG and PDF exports count pattern sources and the renders they embed from the layer's depth, so one cap bounds a whole export (#1082); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); a FigJam `.jam` file opens as a board (#1342); FigJam `.jam` files open like `.fig` files: File ▸ Open, drag and drop, `file.import` and the command line (#1342); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); SVG import draws each pattern tile once per scale, within the layer budget (#1080); a file's JPEG thumbnail can't crash the home screen (#1491's progressive JPEG check, now shared); `.fig` import: library text styles linked by asset key, and override rows restating a nested level (#1234); `.fig` import keeps the file's saved line breaks while the text and its box are unedited (#1236); Download a missing free font from the Missing fonts window (`font.download`, #754); offline Penpot 2.x import/export (#1143); `.sketch` import checked against Sketch's renders: master backgrounds, symbol clipping, tints before Sketch 64, mask opacity, bitmap fills, image overrides on shapes, stretching stacks, blur radii, colour adjustments, OKLab gradients, text growth, shape group borders (#1389); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); image member names are checked on read, and REST image placeholders get archive-safe keys (#1086); Android Vector Drawable (XML) export; `.fig` export: files the incumbent imports, with component set properties, and grid track sizes at its field ids; Save and auto-save don't replace changes another app made to the open file (#1330); `.sketch` import, best effort, Sketch 48 and newer; the PNG row names ignore overlapping layers and where include bounding box is offered; the Fonts table's missing-font row describes the Missing fonts window; `.figcraft` carries the file kind (boards); `.fig` import: resized instances and variable modes by asset key; atomic saves; auto-save; SVG export clip of nested frames; SVG/PDF export depth refusal (#208); `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; `.fig` export: written files checked by opening them in other software; experimental `.fig` export; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; embedded image colour profiles; `.fig` import, best effort; animated GIF fills and TIFF images; last major: created, formats from the installed Figma's Info.plist and help center, ours from source; REST import keeps slot layers and instances' slot content (#792); REST import reads grid track sizes (#465); `.fig` import fidelity from the community batches, budgets for large files, the import report, a `.fig` copy from Save as, paste from another design app; instance layers' size and resizing and Hug on import (#731, #732)) · **Target:** Figma Design (desktop app 126.10.7) Every format Figma reads or writes, with FigCraft's support. Sources: `Info.plist` of `/Applications/Figma.app` (document types only; nothing inside the bundle's code was read), Figma's @@ -17,7 +17,7 @@ and prototype interactions are still unchecked there. | Format | Figma | FigCraft read | FigCraft write | Fidelity / testing | Hours | |---|---|---|---|---|---| -| `.fig` (Figma Design, `com.figma.document`, `application/x-figma`) | native (cloud; "Save local copy") | **yes, best effort** (`file.open`, `file.import`, drop, CLI, MCP) | **experimental** ([below](#export-to-fig-experimental)) | `.fig` files open (best effort): the zip, its deflate/zstd chunks and the kiwi schema are decoded generically and mapped by field name onto the REST importer, so pages, the layer tree, geometry, paints (styles resolved), strokes, effects, text with styled runs, vectors as editable vector networks with region-specific fill paints (points, curved segments, filled areas with their winding, per-point corner radius and handle mirroring, end caps; outlines when the network is missing or damaged), auto layout (grid included; a flow that records no primary-axis sizing hugs on that axis, an instance that records no auto layout has its main's), constraints, ellipse arcs, boolean operations, components, sets (with their descriptions), instances (expanded from their main with overrides, derived layout and property values; the size and resizing their layers override stay overrides), styles, variables with modes and bindings, prototyping (set-variable, set-variable-mode and conditional actions included) and image fills from the archive come across; sticky notes and shapes with text keep their generated backgrounds, styled text, text paints, saved child bounds and sticky author lines as editable frame children, including saved vector networks without geometry paths, outer fill/stroke outlines when generated geometry is damaged, and outer body text when its generated child is unusable even if an author survives (#1341, #1397); connectors, tables, code blocks, slides and similar layers come in as the closest frames, text layers and vectors, with a warning; anything else is a warning. Since 2026-10-17 (community batches #727, #728): an instance's own identity and the cached library components a file carries, overrides applied by key and order, local text values and instance overrides over a shared text style, grid track sizes (fixed, content-sized, fill), slot content, labels of connectors saved with their drawn path (a static snapshot; the ends aren't live), skip ink, paragraph options and hanging lists, list start numbers, vertical trim, per-point stroke joins, editable text on a path, image adjustments and images carried in the message; since 2026-10-29, style links that name a library style by asset key and version (the file's own copy of it), with override rows above the linking one still winning, and override rows restating a nested level's overrides applied at that level, below the instance's own (#1234), and the line breaks the file saved with a text, followed until an edit or a resize could move one, or where a line would come out more than 3% wider than its box in the fonts at hand (#1236). Budgets come from the file's own size (four decoded values per compressed byte, 20M–128M, lower ceilings on 32-bit targets; the layer cap follows the file's size too), so a 15.4 MB synthetic file with 300,000 layers opens whole; ZIP image reads have a separate total budget of 4 GiB (1 GiB on 32-bit targets) of decompressed ZIP-member bytes containing encoded images, with the 256 MiB per-image cap kept: a member that cannot fit is skipped before its output buffer is allocated, and the import report names the budget and counts skipped images (#1076). Failed reads and invalid image contents still consume the bytes read; a reference used by several layers is read once. This is not a limit on decoded pixels or total import memory; images carried inside the message are unchanged. The file's bytes stay out of the command journal; an import report lists what was left out or changed once the file opens. Elbowed and curved connectors without a saved path are routed as FigCraft's board connectors are (right angles, or one curve, from the sides of the layers they join). A connector's label without a saved snapshot is kept as text centred on its line, without its background. Not read: table cells beyond their own layers, live style and variable links for vector region fills, variables bound to fields the editor can't bind, video fills. Tested on fixtures generated in code (`crates/format/src/fig/tests.rs`, `tail_tests.rs` and the per-feature `*_tests.rs` beside them, fuzzed), `crates/engine/src/shapebuilder_region_paints_tests.rs`, and by reading back what the export writes; the FigJam report sample from #1341 checked locally only; no representative real-world corpus yet | read tail 5–10, write: checks against real files 5–15 | +| `.fig` (Figma Design, `com.figma.document`, `application/x-figma`) | native (cloud; "Save local copy") | **yes, best effort** (`file.open`, `file.import`, drop, CLI, MCP) | **experimental** ([below](#export-to-fig-experimental)) | `.fig` files open (best effort): the zip, its deflate/zstd chunks and the kiwi schema are decoded generically and mapped by field name onto the REST importer, so pages, the layer tree, geometry, paints (styles resolved), strokes, effects, text with styled runs, vectors as editable vector networks with region-specific fill paints (points, curved segments, filled areas with their winding, per-point corner radius and handle mirroring, end caps; outlines when the network is missing or damaged), auto layout (grid included; a flow that records no primary-axis sizing hugs on that axis, an instance that records no auto layout has its main's), constraints, ellipse arcs, boolean operations, components, sets (with their descriptions), instances (expanded from their main with overrides, derived layout and property values; the size and resizing their layers override stay overrides), styles, variables with modes and bindings, prototyping (set-variable, set-variable-mode and conditional actions included) and image fills from the archive come across; sticky notes and shapes with text keep their generated backgrounds, styled text, text paints, saved child bounds and sticky author lines as editable frame children, including saved vector networks without geometry paths, outer fill/stroke outlines when generated geometry is damaged, and outer body text when its generated child is unusable even if an author survives (#1341, #1397); connectors, tables, code blocks, slides and similar layers come in as the closest frames, text layers and vectors, with a warning; anything else is a warning. Since 2026-10-17 (community batches #727, #728): an instance's own identity and the cached library components a file carries, overrides applied by key and order, local text values and instance overrides over a shared text style, grid track sizes (fixed, content-sized, fill), slot content, labels of connectors saved with their drawn path (a static snapshot; the ends aren't live), skip ink, paragraph options and hanging lists, list start numbers, vertical trim, per-point stroke joins, editable text on a path, image adjustments and images carried in the message; since 2026-10-29, style links that name a library style by asset key and version (the file's own copy of it), with override rows above the linking one still winning, and override rows restating a nested level's overrides applied at that level, below the instance's own (#1234), and the line breaks the file saved with a text, followed until an edit or a resize could move one, or where a line would come out more than 3% wider than its box in the fonts at hand (#1236). Budgets come from the file's own size (four decoded values per compressed byte, 20M–128M, lower ceilings on 32-bit targets; the layer cap follows the file's size too), so a 15.4 MB synthetic file with 300,000 layers opens whole; ZIP image reads have a separate total budget of 4 GiB (1 GiB on 32-bit targets) of decompressed ZIP-member bytes containing encoded images, with the 256 MiB per-image cap kept: a member that cannot fit is skipped before its output buffer is allocated, and the import report names the budget and counts skipped images (#1076). Failed reads and invalid image contents still consume the bytes read; a reference used by several layers is read once. This is not a limit on decoded pixels or total import memory; images carried inside the message are unchanged. The file's bytes stay out of the command journal; an import report lists what was left out or changed once the file opens. Elbowed and curved connectors without a saved path are routed as FigCraft's board connectors are (right angles, or one curve, from the sides of the layers they join), and a connector routed here takes its line's paint, weight, cap and dashes from the file's generated line record, as one with a saved snapshot does (#1807). A connector's label without a saved snapshot is kept as text centred on its line, without its background. Not read: table cells beyond their own layers, live style and variable links for vector region fills, variables bound to fields the editor can't bind, video fills. Tested on fixtures generated in code (`crates/format/src/fig/tests.rs`, `tail_tests.rs` and the per-feature `*_tests.rs` beside them, fuzzed), `crates/engine/src/shapebuilder_region_paints_tests.rs`, and by reading back what the export writes; the FigJam report sample from #1341 checked locally only; no representative real-world corpus yet | read tail 5–10, write: checks against real files 5–15 | | `.penpot` (Penpot 2.x ZIP export) | — | **yes, offline** (open, import, drop, CLI, MCP) | **yes, offline** (export, CLI convert) | Editable layers, supported flex/grid layout, components, tokens and prototypes using the existing model. Unsupported layouts retain saved positions and bounded metadata; toggle-overlay and embedded font binaries are reported. Font references remain editable; no downloads. Synthetic regression coverage; live Penpot and cross-platform QA remain open. See [Penpot reference](penpot.md). | further live Penpot and cross-platform QA | | `.sketch` (Sketch 48 and newer) | import (file browser ▸ Import or drop, desktop app too; converted to a Figma file, symbols as components; per the help center) | **yes, best effort** (`file.open`, `file.import`, drop, CLI, MCP; Open With from Finder, Explorer and Linux file managers once installed; recent files show its `previews/preview.png`) | no (out of scope) | zip + JSON read from the public format description; Sketch 43–47 (text as binary property lists) and older (SQLite) files are refused with a message to resave them in a newer Sketch. Pages, artboards as frames with their background, groups; Sketch 2025 and newer: frames (clipping or not) with their style, graphics, stacks as auto layout (direction, gap, alignment, padding, wrap, hug/fill sizing, stretching filling every item across, items ignoring the stack), corners in the style (rounded, smooth with its smoothing; angled, inside square and inside arc as paths), pins and sizing, per-side borders, lists of blurs (progressive background blurs, glass), inner shadows in the shadow list, tints (a graphic's, group's or instance's fill colouring its layers, and colour overrides; from Sketch 64, before which a group's fill draws nothing), text colour and visibility overrides, text sized by its sizing; rectangles with corner radii, ovals, stars and polygons while their points are the generated ones, paths as editable vector networks, shape groups as their shape, as one compound path (children without an operation, by the group's winding rule) or as boolean operations (mixed operations nested from the left); operands' own borders ignored as Sketch does; open paths filled as if closed, edited ovals and rectangles as paths, bitmaps (their image under their style's fills; colour adjustments as image filters with Sketch's tone curve, contrast and then brightness added), slices, hotspots; transforms (rotation, flips after it), resizing constraints; fills (solid, gradients with Sketch's geometry, gradients mixed in OKLab or OKLCH as sRGB stops along the same colours, image patterns), borders (the first enabled border's width and position), shadows, inner shadows, layer, motion and background blurs (Sketch's radius is the standard deviation), opacity and blend modes; clipping masks (an outline mask that shows its own style draws a copy under itself, as Sketch does, and its opacity fades it and what it clips together; alpha masks only mask; broken mask chains wrapped), progressive opacity (Fade) as an alpha mask of its gradient; text with styled runs (UTF-16 ranges), paragraph and vertical alignment, lines placed by Sketch's line spacing behaviour, box sizing, fonts found by their PostScript names among the installed ones (else the family read from the name), variable font axes, Sketch's natural line (ascent and descent rounded, no line gap, a fifth more for classic Mac fonts) for text without a fixed line height; symbols as components (library copies on a page of their own) and instances carrying their masters' layers with overrides (text, nested swaps and hiding, images, also on shapes' image fills, layer and text styles, nested paths), clipping only where the master clips (`clippingBehavior` 1), laid out for their size the way Sketch does it (proportional sharing per pins from format 110, scaling before) and still live; master backgrounds in instances only when the master includes them in both instances and exports, as on Sketch's canvas and renders; Apple's system fonts found under the names designs use, with the platform's tracking kept as letter spacing; shared layer styles as paint (fills, border colours) and effect styles, shared text styles as text styles; Color Variables (also library ones) as colour variables with bindings; prototype links, flow starts, export options, layout and square grids (hidden, as Sketch shows them only in its layout view). Instances of a stack laid out at their size and texts an override changed measured again on open, an auto-width one growing from its aligned edge. Warnings: noise fills, OKLab and OKLCH gradients, motion and zoom blurs (drawn as plain blurs), fonts embedded with their data (not used), Smart Layout (kept as laid out), locked overrides, scaled instances. Tested on fixtures built in code (`crates/format/src/sketch/*_tests.rs`, fuzzed) and locally (`FIGCRAFT_SKETCH_SAMPLES`) on one real Sketch 50 file and the public Apache-2.0 IBM Carbon Design Kit saved by Sketch 68 and 83 (70,000 layers open in ~3 s, debug build; its edition saved by Sketch 47 is refused, as it should be); compared artboard by artboard with Sketch 2026's own renders (`FIGCRAFT_SKETCHTOOL`, black-box): the Sketch 50 file's 73 artboards differ in at most 2.3% of their pixels (0.8% on average) (text metrics, fonts FigCraft doesn't find, antialiasing), Carbon 11's 69 1.1% on average and at most 4.4% (text in IBM Plex, which the file embeds and FigCraft doesn't use yet), a Sketch 64 file's 65 artboards 2.1% on average, a Sketch 2026 showcase file's 16 frames 0.9% on average (at most 1.9%); the rules for master backgrounds, symbol clipping, mask opacity, bitmap fills, image overrides, stretching stacks, blur radii, colour adjustments, gradient interpolation and text growth checked against Sketch's renders of files built for each case (black-box, synthetic) | 5–10 (Smart Layout as auto layout, motion and zoom blurs, several borders of different widths; fonts embedded in the file once `.figcraft` documents can carry fonts: until then they would only last the session). Known limitations: a plain group (not a frame) that fills a stack keeps its layers' size where Sketch stretches them; a font Sketch can't find draws in the installed family's own weight (Sketch falls back to a regular face); text in the system SF Pro comes out a few percent narrower than Sketch's; macOS's reserved system fonts (PingFang) aren't found; brightness past about +0.4 is approximated (image filters can't add); OKLab gradients become sRGB stops (FigCraft gradients mix in sRGB) | | `.jam` (whiteboards) | native to FigJam | **yes, best effort** (`file.open`, `file.import`, File ▸ Open, drop, CLI, MCP) | no | the same archive as a `.fig` (its canvas header reads `fig-jam.`) through the same reader (#1342): it opens as a board (the file kind; a `.fig` stays a design file), with generated sticky and shape backgrounds and text kept (#1341) as ordinary layers rather than native board objects (see [boards-parity](boards-parity.md)); tables, stamps, code blocks and the like come in as frames with their text and connectors as vectors, with an import note; a layer type the reader doesn't know is left out with a note naming it; writing `.jam` is not supported | — | @@ -187,6 +187,7 @@ source paint coordinates. | Date | Change | Summary | |---|---|---| +| 2026-11-01 | patch | `.fig` and `.jam` import: a connector without a saved snapshot (elbowed and curved ones are routed here) took no stroke, so it was invisible (#1807); its line's paint, weight, cap and dashes now come from the file's generated line record, as a saved snapshot's do, and the connector's own values, when it has any, win. Test: `fig::connector_label_tests::a_routed_connector_takes_its_line_style_from_the_generated_record`. Numbers unchanged | | 2026-10-31 | patch | M4: Dash and Custom strokes have a Dash cap (None, Round, Square) in the advanced stroke settings and `node.set {dashCap}`, on both ends of every dash on the canvas and in PNG, PDF and SVG. Unset, dashes keep taking the end point caps, so older files look the same; the saved file writes it only when set. Numbers unchanged | | 2026-10-30 | minor | `.fig` import: a connector's label without a saved snapshot was skipped; now the connector imports as a frame holding its line and the label, as a connector with a saved snapshot does, the label centred on the line's middle by length (in a 200-wide box, laid out again with the fonts at hand), in the connector's fill paints or black. Its background isn't known without the snapshot and is left out. Not checked on real files. Test: `fig::tests::tail::a_labelled_connector_without_a_snapshot_keeps_its_label` | | 2026-10-30 | minor | Pasted content row: an image the clipboard doesn't carry keeps its name and shows a placeholder that reads as missing; the paste names those layers in its message and opens the import report with its notes (#1646). Numbers unchanged | From 9a1b33bbfdafd5938fb49cd1b7d22923b88c8357 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:49:26 +0100 Subject: [PATCH 09/49] Reject signed major in plugin manifest api version string (#1853) Found while testing crates/plugin/src/manifest.rs:70 (api_from_number_or_string, the Api::Text arm) Co-authored-by: Claude Haiku 5.5 --- crates/plugin/src/manifest.rs | 1 + crates/plugin/src/tests.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/crates/plugin/src/manifest.rs b/crates/plugin/src/manifest.rs index 6bca9aef2..269174e0f 100644 --- a/crates/plugin/src/manifest.rs +++ b/crates/plugin/src/manifest.rs @@ -77,6 +77,7 @@ fn api_from_number_or_string<'de, D: serde::Deserializer<'de>>(d: D) -> Result Date: Mon, 2 Nov 2026 05:49:30 +0100 Subject: [PATCH 10/49] fix(cli): M2.1: scope dead-code expectation (#1816) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cédric Legrand --- apps/figcraft-cli/examples/man-and-completions.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/figcraft-cli/examples/man-and-completions.rs b/apps/figcraft-cli/examples/man-and-completions.rs index c67827477..2b119d6a8 100644 --- a/apps/figcraft-cli/examples/man-and-completions.rs +++ b/apps/figcraft-cli/examples/man-and-completions.rs @@ -6,7 +6,7 @@ #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] #[path = "../src/args.rs"] -#[expect(dead_code, reason = "Generation uses clap's command metadata, not the parsed fields or runtime parser.")] +#[cfg_attr(not(test), expect(dead_code, reason = "Generation uses clap's command metadata, not the parsed fields or runtime parser."))] mod args; use std::path::Path; From fa8faf216d1ae9693332c49fecbc078e01b31293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=BC=ED=98=84?= Date: Mon, 2 Nov 2026 13:49:34 +0900 Subject: [PATCH 11/49] M8: a whole ellipse starting anywhere stays whole through a .fig file (#1851) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A .fig file (and the REST JSON) holds an ellipse's start and end angles as 32-bit floats, and FigCraft writes them that way too. For a whole turn that starts anywhere but zero, end - start comes out a hair short of 2π as often as not (start 0.3: 6.283185184), which reads as an arc: the ellipse came back as a pie slice whose centred stroke draws a line from the centre to the edge. On import, a sweep within the angles' precision of a turn is now a turn. Co-authored-by: Claude Opus 5.5 --- crates/format/src/fig/export_tests.rs | 19 +++++++++++++++++++ crates/format/src/rest.rs | 7 ++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/crates/format/src/fig/export_tests.rs b/crates/format/src/fig/export_tests.rs index 5b4bcb991..b1b31262a 100644 --- a/crates/format/src/fig/export_tests.rs +++ b/crates/format/src/fig/export_tests.rs @@ -1592,3 +1592,22 @@ fn a_name_used_with_two_types_in_a_set_writes_both_definitions() { } } } + +/// A whole ellipse that starts anywhere round comes back whole: the file holds its start and end +/// angles as 32-bit floats, and their difference falls a hair short of a turn as often as not. +#[test] +fn a_whole_ellipse_starting_anywhere_comes_back_whole() { + let tau = std::f64::consts::TAU; + for start in [0.3, 2.0, -std::f64::consts::FRAC_PI_2, std::f64::consts::PI, 100.25] { + for sweep in [tau, -tau] { + let mut doc = Document::new("whole"); + let page = doc.first_page().unwrap(); + doc.create(page, NodeKind::Ellipse { start, sweep, inner: 0.0 }, "Ellipse", 0.0, 0.0, 100.0, 100.0).unwrap(); + let (bytes, _) = export(&doc, None).unwrap(); + let (back, _) = import(&bytes, "x").unwrap(); + let kinds: Vec = + back.ids().filter_map(|id| back.node(id)).map(|n| n.kind.clone()).filter(|k| matches!(k, NodeKind::Ellipse { .. })).collect(); + assert!(matches!(kinds.as_slice(), [NodeKind::Ellipse { sweep: s, .. }] if *s == sweep), "start {start}, sweep {sweep}: {kinds:?}"); + } + } +} diff --git a/crates/format/src/rest.rs b/crates/format/src/rest.rs index 26ab3586a..4604b73a6 100644 --- a/crates/format/src/rest.rs +++ b/crates/format/src/rest.rs @@ -629,7 +629,12 @@ impl<'a> Ctx<'a> { let start = arc("startingAngle").unwrap_or(0.0).clamp(-1e3, 1e3); let end = arc("endingAngle").map_or(start + std::f64::consts::TAU, |e| e.clamp(-1e3, 1e3)); let tau = std::f64::consts::TAU; - NodeKind::Ellipse { start, sweep: (end - start).clamp(-tau, tau), inner: arc("innerRadius").unwrap_or(0.0).clamp(0.0, 1.0) } + // The angles are 32-bit floats: a whole turn from anywhere but zero comes out a + // hair short of 2π as often as not. Within their precision of a turn, it is one. + let precision = (start.abs() + end.abs() + tau) * f64::from(f32::EPSILON); + let sweep = end - start; + let sweep = if sweep.abs() >= tau - precision { tau.copysign(sweep) } else { sweep }; + NodeKind::Ellipse { start, sweep: sweep.clamp(-tau, tau), inner: arc("innerRadius").unwrap_or(0.0).clamp(0.0, 1.0) } } // Point counts aren't part of the documented JSON: the outline is exact when present. "REGULAR_POLYGON" | "STAR" if point_count().is_none() && has_geometry => NodeKind::Vector { network: VectorNetwork::default() }, From 702b0d78944e79fc3721261be3c495a08ef6730d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=BC=ED=98=84?= Date: Mon, 2 Nov 2026 13:49:38 +0900 Subject: [PATCH 12/49] M8: a whole ellipse drawn backwards keeps its simple stroke in SVG (#1848) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * M8: a whole ellipse drawn backwards keeps its simple stroke in SVG An ellipse with a sweep of -2π goes all the way round, as the renderer and the .fig export already read it. The SVG export's simple stroke checked `sweep >= 2π` only, so such an ellipse's inside or outside stroke was written as a filled even-odd ring instead of a stroke. All three places now ask `figcraft_geom::full_sweep`, as the geometry and the bounds do. Co-Authored-By: Claude Opus 5.5 * M8: a backwards whole ellipse's stroke ring in the renderer and .fig export, tested Review follow-up (#1848): the renderer's stroke ring and the .fig export's stroke geometry read a sweep of -2π as whole too, now through `full_sweep`. A test for each checks a backwards ellipse strokes the same ring as a forward one, and fails if either goes back to checking positive sweeps only. Co-Authored-By: Claude Opus 5.5 * M8: the .fig backwards-ellipse test compares the stroke ring itself Review follow-up (#1848): the test checked only that one stroke path was written. It now compares the path's commands and winding rule for the forward and backwards ellipse, and that the ring is even-odd. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- crates/format/src/fig/export/shape.rs | 2 +- crates/format/src/fig/interop_tests.rs | 31 ++++++++++++++++++++++++++ crates/render/src/draw.rs | 2 +- crates/render/src/join_tests.rs | 20 +++++++++++++++++ crates/svg/src/lib.rs | 2 +- crates/svg/src/tests.rs | 21 +++++++++++++++++ 6 files changed, 75 insertions(+), 3 deletions(-) diff --git a/crates/format/src/fig/export/shape.rs b/crates/format/src/fig/export/shape.rs index 03c82cfb1..e4e2cae6b 100644 --- a/crates/format/src/fig/export/shape.rs +++ b/crates/format/src/fig/export/shape.rs @@ -282,7 +282,7 @@ impl<'d> Exporter<'d> { if !(plain && weight.is_finite() && weight > 0.0 && w.is_finite() && h.is_finite()) { return; } - let whole = matches!(n.kind, NodeKind::Ellipse { sweep, inner, .. } if inner == 0.0 && sweep.abs() >= std::f64::consts::TAU - 1e-9); + let whole = matches!(n.kind, NodeKind::Ellipse { sweep, inner, .. } if inner == 0.0 && figcraft_doc::geom::full_sweep(sweep)); if boxy || whole { let (out, inset) = match sp.align { StrokeAlign::Inside => (0.0, weight), diff --git a/crates/format/src/fig/interop_tests.rs b/crates/format/src/fig/interop_tests.rs index b51760c55..fa95d792b 100644 --- a/crates/format/src/fig/interop_tests.rs +++ b/crates/format/src/fig/interop_tests.rs @@ -449,3 +449,34 @@ fn local_samples_agree_with_the_written_schema() { } } } + +/// An ellipse drawn the other way round (a sweep of −2π) is whole: its inside stroke is written +/// as the same ring a forward one's is, path and winding rule alike. +#[test] +fn a_whole_ellipse_drawn_backwards_carries_its_stroke_ring() { + let ring = |sweep: f64| { + let mut doc = sample(); + let ids: Vec = doc.ids().collect(); + for id in ids { + if let Some(n) = doc.node_mut(id) + && let NodeKind::Ellipse { sweep: s, .. } = &mut n.kind + { + *s = sweep; + } + } + let out = std::cell::RefCell::new(None); + with_changes(&doc, |of, msg| { + let blobs = msg.get("blobs").unwrap().list(); + let geometry = of("ELLIPSE").get("strokeGeometry").map(|g| { + let p = g.list().first().unwrap().clone(); + let bytes = blobs.get(num(&p, "commandsBlob") as usize).and_then(|b| b.get("bytes")).and_then(Kv::bytes).unwrap(); + (name(&p, "windingRule").to_string(), bytes.to_vec()) + }); + *out.borrow_mut() = geometry; + }); + out.into_inner() + }; + let forwards = ring(std::f64::consts::TAU).expect("a forward ellipse writes its stroke ring"); + assert_eq!(forwards.0, "ODD"); + assert_eq!(ring(-std::f64::consts::TAU), Some(forwards)); +} diff --git a/crates/render/src/draw.rs b/crates/render/src/draw.rs index f48899aea..f0af6b6d0 100644 --- a/crates/render/src/draw.rs +++ b/crates/render/src/draw.rs @@ -217,7 +217,7 @@ pub fn stroke_area(n: &Node, path: &BezPath, closed: bool) -> Arc { p.apply_affine(Affine::translate((x0, y0))); Some(p) } - NodeKind::Ellipse { sweep, inner, .. } if sweep.abs() >= std::f64::consts::TAU - 1e-9 && inner == 0.0 => { + NodeKind::Ellipse { sweep, inner, .. } if figcraft_geom::full_sweep(sweep) && inner == 0.0 => { Some(figcraft_geom::kurbo::Ellipse::from_rect(Rect::new(x0, y0, x0 + ww, y0 + hh)).to_path(0.05)) } _ => None, diff --git a/crates/render/src/join_tests.rs b/crates/render/src/join_tests.rs index 9fbb4f870..42c931997 100644 --- a/crates/render/src/join_tests.rs +++ b/crates/render/src/join_tests.rs @@ -44,3 +44,23 @@ fn outside_bevel_join_cuts_outer_corner() { fn outside_miter_join_keeps_square_corner() { assert_ne!(covered(StrokeJoin::Miter), 0); } + +/// An ellipse drawn the other way round (a sweep of −2π) is whole: its inside stroke is the same +/// ring of two outlines as a forward one's. +#[test] +fn a_whole_ellipse_drawn_backwards_strokes_as_a_ring() { + let ring = |sweep: f64| { + let mut d = Document::new("ring"); + let p = d.first_page().unwrap(); + let id = d.create(p, NodeKind::Ellipse { start: 0.0, sweep, inner: 0.0 }, "E", 0.0, 0.0, 60.0, 40.0).unwrap(); + let n = d.get_mut(id).unwrap(); + n.strokes = vec![Paint::solid(Color::BLACK)]; + (n.stroke.weight, n.stroke.align) = (6.0, StrokeAlign::Inside); + let outline: BezPath = figcraft_geom::kurbo::Ellipse::from_rect(figcraft_geom::kurbo::Rect::new(0.0, 0.0, 60.0, 40.0)).to_path(0.1); + (*crate::draw::stroke_area(d.get(id).unwrap(), &outline, true)).clone() + }; + let forwards = ring(std::f64::consts::TAU); + let moves = forwards.elements().iter().filter(|e| matches!(e, figcraft_geom::kurbo::PathEl::MoveTo(_))).count(); + assert_eq!(moves, 2, "two outlines: {forwards:?}"); + assert_eq!(ring(-std::f64::consts::TAU), forwards); +} diff --git a/crates/svg/src/lib.rs b/crates/svg/src/lib.rs index 58d80ac91..3158d1c0d 100644 --- a/crates/svg/src/lib.rs +++ b/crates/svg/src/lib.rs @@ -802,7 +802,7 @@ impl W<'_> { return None; } match n.kind { - NodeKind::Ellipse { sweep, inner, .. } if inner == 0.0 && sweep >= std::f64::consts::TAU - 1e-9 => { + NodeKind::Ellipse { sweep, inner, .. } if inner == 0.0 && figcraft_geom::full_sweep(sweep) => { figcraft_geom::kurbo::Shape::to_path(&figcraft_geom::kurbo::Ellipse::from_rect(r), 0.1) } NodeKind::Rectangle | NodeKind::Frame | NodeKind::Component { .. } | NodeKind::Instance { .. } if n.corners.smoothing == 0.0 => { diff --git a/crates/svg/src/tests.rs b/crates/svg/src/tests.rs index c3fb75f8e..ade0e3f30 100644 --- a/crates/svg/src/tests.rs +++ b/crates/svg/src/tests.rs @@ -429,3 +429,24 @@ fn an_exported_dashed_line_opens_as_the_same_line() { d.subtree(frame).iter().filter_map(|i| d.node(*i)).filter(|n| !n.stroke.dashes.is_empty()).map(|n| n.stroke.dashes.clone()).collect(); assert!(matches!(dashes.as_slice(), [d] if d.len() == 2 && d.iter().all(|v| (v - 10.7).abs() < 1e-4)), "{dashes:?}"); } + +/// An ellipse drawn the other way round (a sweep of −2π) is as whole as one drawn forwards: its +/// stroke inside or outside exports as a stroke, the same as the forward one's. +#[test] +fn a_whole_ellipse_drawn_backwards_keeps_its_simple_stroke() { + let export = |sweep: f64, align: figcraft_doc::StrokeAlign| { + let mut d = Document::new("backwards"); + let p = d.first_page().unwrap(); + let n = d.create(p, NodeKind::Ellipse { start: 0.0, sweep, inner: 0.0 }, "Ellipse", 0.0, 0.0, 100.0, 60.0).unwrap(); + let node = d.get_mut(n).unwrap(); + node.fills.clear(); + node.strokes = vec![Paint::solid(Color::from_hex("000000").unwrap())]; + (node.stroke.weight, node.stroke.align) = (8.0, align); + export_svg(&d, &[n], &SvgOptions { simplify_stroke: true, ..SvgOptions::default() }).unwrap() + }; + for align in [figcraft_doc::StrokeAlign::Inside, figcraft_doc::StrokeAlign::Outside] { + let (forwards, backwards) = (export(std::f64::consts::TAU, align), export(-std::f64::consts::TAU, align)); + assert!(forwards.contains("stroke-width=\"8\""), "{align:?}: {forwards}"); + assert_eq!(backwards, forwards, "{align:?}"); + } +} From fdd27a0b88ca597aac72260e18f077fc5c5dfe87 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 1 Nov 2026 23:49:43 -0500 Subject: [PATCH 13/49] Shortcuts: the Layers panel opens with Ctrl+1 as well as Alt+1 on Windows and Linux (#1844) * Shortcuts: the Layers panel opens with Ctrl+1 as well as Alt+1 on Windows and Linux Co-Authored-By: Claude Fable 5.1 * Parity note: in the browser Ctrl+1 is the browser's tab key Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 --- crates/engine/src/keymap.rs | 3 ++- crates/engine/src/keymap_tests.rs | 12 ++++++++++++ crates/engine/src/shortcut_parity_tests.rs | 2 +- docs/ui-parity.md | 5 +++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/keymap.rs b/crates/engine/src/keymap.rs index baa3885c5..65259755a 100644 --- a/crates/engine/src/keymap.rs +++ b/crates/engine/src/keymap.rs @@ -212,7 +212,8 @@ pub static KEYS: &[Binding] = &[ k(View, "view.comments", &["Shift+C"]), k(View, "view.multiplayerCursors", &["Alt+Cmd+\\"]), k(View, "view.snapPixel", &["Shift+Cmd+'"]), - k(View, "view.layers", &["Alt+1"]).label("Layers panel"), + // Windows: one help-center article writes Ctrl+1, another Alt+1; both open it there. + k(View, "view.layers", &["Alt+1"]).win(&["Alt+1", "Ctrl+1"]).label("Layers panel"), k(View, "view.assets", &["Alt+2"]).label("Assets panel"), k(View, "libraries.open", &["Alt+3"]), k(View, "view.design", &["Alt+8"]).label("Design panel"), diff --git a/crates/engine/src/keymap_tests.rs b/crates/engine/src/keymap_tests.rs index bdf57c9da..c7db0b16e 100644 --- a/crates/engine/src/keymap_tests.rs +++ b/crates/engine/src/keymap_tests.rs @@ -305,3 +305,15 @@ fn ctrl_tab_cycles_documents() { assert_eq!(lookup(Platform::Other, Context::Canvas, "Tab", mods(false, false, true, true)).map(|b| b.id), Some("doc.nextTab")); assert_eq!(lookup(Platform::Mac, Context::Canvas, "Tab", mods(true, false, false, true)).map(|b| b.id), Some("doc.previousTab")); } + +/// The Layers panel's Windows key is Ctrl+1 in one help-center article ("Mac: Option 1 Windows: +/// Ctrl 1", Select layers and objects) and Alt+1 in another (Explore the navigation bar and left +/// sidebar): both open it there. macOS keeps Option+1 alone; Cmd+1 is not documented. +#[test] +fn the_layers_panel_answers_both_of_its_documented_windows_keys() { + let (alt, ctrl, cmd) = (mods(false, true, false, false), mods(false, false, false, true), mods(false, false, true, false)); + assert_eq!(id_for(Platform::Other, Context::Canvas, "1", alt), Some("view.layers")); + assert_eq!(id_for(Platform::Other, Context::Canvas, "1", ctrl), Some("view.layers")); + assert_eq!(id_for(Platform::Mac, Context::Canvas, "1", alt), Some("view.layers")); + assert_eq!(id_for(Platform::Mac, Context::Canvas, "1", cmd), None); +} diff --git a/crates/engine/src/shortcut_parity_tests.rs b/crates/engine/src/shortcut_parity_tests.rs index 65e269982..6cf7c361d 100644 --- a/crates/engine/src/shortcut_parity_tests.rs +++ b/crates/engine/src/shortcut_parity_tests.rs @@ -146,7 +146,7 @@ static ROWS: &[Row] = &[ doc(View, "Pixel preview", &["Ctrl+P"], &["Ctrl+Alt+P"], Bound("view.pixelPreview"), ""), doc(View, "Others' cursors in a live session", &["Alt+Cmd+\\"], &["Ctrl+Alt+\\"], Bound("view.multiplayerCursors"), "new command"), doc(View, "Hide the side panels (minimize the interface)", &["Shift+Cmd+\\"], &[], Bound("view.leftSidebar"), ""), - doc(View, "Layers panel", &["Alt+1"], &[], Bound("view.layers"), "one article writes Ctrl+1 for Windows, another Alt+1; Alt+1 bound"), + doc(View, "Layers panel", &["Alt+1"], &["Alt+1", "Ctrl+1"], Bound("view.layers"), "one article writes Ctrl+1 for Windows, another Alt+1; both bound there"), doc(View, "Assets panel", &["Alt+2"], &[], Bound("view.assets"), ""), doc(View, "Libraries", &["Alt+3"], &[], Bound("libraries.open"), ""), doc(View, "Dev Mode on or off", &["Shift+D"], &[], Bound("view.devMode"), ""), diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 0286fd37d..a77f79348 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-10-30 · **Change:** minor (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-01 · **Change:** minor (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: @@ -150,7 +150,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look - **Where the documentation disagrees with itself** (noted per row): pixel grid (Shift+' or Cmd+'), letter spacing (Alt or Cmd with < >; Cmd would be the font size keys, Alt bound), Windows remove fill (Alt+/ or Alt+,; Alt+, is letter spacing), the Layers panel on Windows (Alt+1 - or Ctrl+1), send to back / bring to front (one table shows only the bracket). + or Ctrl+1; both bound there, though in the browser Ctrl+1 is the browser's own tab key and only Alt+1 reaches the app), send to back / bring to front (one table shows only the bracket). - **Platform keys:** macOS rows use Cmd and Option, Windows/Linux rows Ctrl and Alt (tested: no macOS glyph on Windows/Linux keycaps, no "Ctrl"/"Alt" words on macOS); no default binding uses a chord the system keeps (Cmd+H/M/Q/Tab/Space, Ctrl+Space and the screenshot keys on macOS; @@ -176,6 +176,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-01 | patch | Shortcuts: the Layers panel opens with Ctrl+1 as well as Alt+1 on Windows and Linux ("Mac: Option 1 Windows: Ctrl 1" in Select layers and objects; "Windows: Alt 1" in Explore the navigation bar and left sidebar). macOS keeps Option+1. Found by a documentation audit of the shortcuts (every chord driven over the control channel). Tests: `keymap_tests::the_layers_panel_answers_both_of_its_documented_windows_keys`, the parity row. Counts unchanged | | 2026-10-31 | minor | M1, #1682: as the help center describes the colour picker, choosing Image no longer opens a file dialog at once: the tab shows a checkered placeholder and Upload from computer until there is a file. An image paint shows its asset preview with the same button. A file dropped on the open picker replaces the image and keeps the fill mode, crop, position and adjustments; on the placeholder it becomes the paint's image, filling the layer. While a file is dragged the picker says it takes it instead of the window saying Drop to import. New command `image.replace {ids?, target?, index?, data | path}`, through the same size cap and decoder as `image.place`; one undo step. Dropped files in the browser arrive as `data`. A native window or a browser doesn't say where a dragged file is, so a drop with no known position goes to the open picker, and one known to be over the canvas imports as before. Left: the Fill and Stroke swatches in the Design panel don't take a drop, since their place can't be told during a drag; pasting into the picker isn't documented and isn't added. Tests: `colorpicker_image_tests`, `image_crop_tests::replacing_an_image_keeps_its_fill_mode_crop_and_adjustments`. Numbers unchanged | | 2026-10-30 | minor | Gap 4: the keyboard's Menu key opens the context menu, as Shift+F10 does (at the focused layer row or below the canvas selection, with the keyboard in the menu). egui already reported the key; FigCraft's keymap had no name or binding for it. `view.contextMenu` now takes `Menu` too, and the Context menus row is done (`layers_keyboard_tests`). Stale rows corrected: smart-selection spacing has had reorder rings since the "M1: smart-selection drag reordering" landing (the row is still partial: irregular grids and several marked layers aren't covered), and gap 4 and the parity summary quoted shortcut counts from before the last bindings (now 128 bound, none missing, 57 undocumented pinned, as `shortcut_parity_tests` counts). | | 2026-10-30 | minor | M4, gap 4: the eyedropper with Cmd/Ctrl+Shift held makes a colour style or variable of the colour it picks, as the reference app's eyedropper does, instead of filling the selection. It asks the UI for a Create from color window (`dialog.createFromColor`; the control channel never opens it). The window shows the colour and offers Style or Variable, a name (the next free "Color n") and, for a variable, a collection: the file's first, or a new one made with it in the same undo step. Create runs `style.create` or `variable.create`. Tests: `eyedropper_create_tests`, `sampled_color_tests`. | From 3b8ded69c00a01a10190d7eb73903bec78bcc043 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 1 Nov 2026 23:49:48 -0500 Subject: [PATCH 14/49] M4: a link on text is underlined by default, and Underline takes it off (#1841) * M4: a link on text is underlined by default, and Underline takes it off Co-Authored-By: Claude Fable 5.1 * text.link: only a new link takes the default underline; Underline reads the texts inside a target Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 --- crates/engine/src/cmd/text.rs | 26 +++++++++++++---- crates/engine/src/text_behaviour_tests.rs | 34 +++++++++++++++++++++++ docs/target-app-parity.md | 3 +- 3 files changed, 57 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/cmd/text.rs b/crates/engine/src/cmd/text.rs index ec219db36..4fbb0fe1d 100644 --- a/crates/engine/src/cmd/text.rs +++ b/crates/engine/src/cmd/text.rs @@ -101,7 +101,9 @@ fn all_have(s: &Session, p: &Value, pred: impl Fn(&TextStyle) -> bool) -> bool { } return false; } - targets(s, p).iter().all(|i| matches!(doc.node(*i).map(|n| &n.kind), Some(NodeKind::Text(t)) if t.spans().iter().all(|(_, _, st)| pred(st)))) + // The texts `style` restyles: the targets and the texts inside them. + let texts: Vec<&TextData> = targets(s, p).iter().flat_map(|i| doc.subtree(*i)).filter_map(|d| doc.node(d).and_then(|n| n.kind.text())).collect(); + !texts.is_empty() && texts.iter().all(|t| t.spans().iter().all(|(_, _, st)| pred(st))) } fn toggle_bold(s: &mut Session, p: &Value) -> Result { @@ -217,10 +219,24 @@ pub fn specs() -> Vec { let on = all_have(s, p, |st| st.decoration == TextDecoration::Strikethrough); style(s, p, |st| st.decoration = if on { TextDecoration::None } else { TextDecoration::Strikethrough }) }), - spec!("text.link", "Create link", "{url, ids?}", true, |s, p| { - let url = req_string("text.link", p, "url")?; - style(s, p, |st| st.link = Some(url.clone())) - }), + spec!( + "text.link", + "Create link", + "{url, ids?} linked text is underlined unless it has a decoration of its own (Underline takes it off again)", + true, + |s, p| { + let url = req_string("text.link", p, "url")?; + style(s, p, |st| { + // "Links are styled with an underline by default" (Add links to text); Underline + // (Cmd/Ctrl+U) removes it, as documented there, and changing the URL of a link + // leaves its decoration as it is. + if st.link.is_none() && st.decoration == TextDecoration::None { + st.decoration = TextDecoration::Underline; + } + st.link = Some(url.clone()); + }) + } + ), spec!("text.bulletList", "Bulleted list", "{ids?} while editing: the selected paragraphs", true, |s, p| set_list( s, p, diff --git a/crates/engine/src/text_behaviour_tests.rs b/crates/engine/src/text_behaviour_tests.rs index b263211ee..ad476c364 100644 --- a/crates/engine/src/text_behaviour_tests.rs +++ b/crates/engine/src/text_behaviour_tests.rs @@ -550,3 +550,37 @@ fn css_font_family_escapes_backslash_and_newline() { let css = crate::codegen::css_decls(s.doc().unwrap(), s.doc().unwrap().node(t).unwrap(), &mut Default::default(), (true, true)); assert!(css.contains(r#"font-family: "Foo\"\3C /style>";"#), "{css}"); } + +/// "Links are styled with an underline by default. Use the keyboard shortcut to remove the +/// underline: Mac: Command U, Windows: Control U" (Add links to text). +#[test] +fn a_link_is_underlined_by_default_and_underline_takes_it_off() { + use figcraft_doc::TextDecoration; + let mut s = Session::new(); + let t = text(&mut s, "docs", json!({})); + let style = |s: &Session| s.doc().unwrap().node(t).unwrap().kind.text().unwrap().style.clone(); + s.execute("text.link", &json!({"ids": [t], "url": "https://example.com"})).unwrap(); + assert_eq!((style(&s).link.as_deref(), style(&s).decoration), (Some("https://example.com"), TextDecoration::Underline)); + s.execute("text.underline", &json!({"ids": [t]})).unwrap(); + assert_eq!( + (style(&s).link.as_deref(), style(&s).decoration), + (Some("https://example.com"), TextDecoration::None), + "the link stays, the underline goes" + ); + // Changing the URL of a link whose underline was taken off keeps it off. + s.execute("text.link", &json!({"ids": [t], "url": "https://example.org"})).unwrap(); + assert_eq!((style(&s).link.as_deref(), style(&s).decoration), (Some("https://example.org"), TextDecoration::None)); + // A decoration of the text's own is kept. + let u = text(&mut s, "struck", json!({"textDecoration": "strikethrough"})); + s.execute("text.link", &json!({"ids": [u], "url": "https://example.com"})).unwrap(); + assert_eq!(s.doc().unwrap().node(u).unwrap().kind.text().unwrap().style.decoration, TextDecoration::Strikethrough); + // On a frame, the link reaches the text inside, and Underline reads that text: it takes the + // underline off rather than putting it on again. + let f = id(s.execute("frame.create", &json!({"x": 0, "y": 100, "width": 200, "height": 100})).unwrap()); + let inner = id(s.execute("text.create", &json!({"text": "inside", "x": 0, "y": 100, "parent": f})).unwrap()); + let inner_style = |s: &Session| s.doc().unwrap().node(inner).unwrap().kind.text().unwrap().style.clone(); + s.execute("text.link", &json!({"ids": [f], "url": "https://example.com"})).unwrap(); + assert_eq!((inner_style(&s).link.as_deref(), inner_style(&s).decoration), (Some("https://example.com"), TextDecoration::Underline)); + s.execute("text.underline", &json!({"ids": [f]})).unwrap(); + assert_eq!(inner_style(&s).decoration, TextDecoration::None, "Underline on the frame reads the text inside it"); +} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 489c0e7da..06cf024f0 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # FigCraft parity with Figma -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-31 · **Change:** minor (a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; gap 6: widgets draw lines and SVG pictures (plugin API 6); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); Thai, Lao, Khmer and Burmese lines break between words (#1219); MCP and control calls name their document (#998); shadows of images with transparent pixels follow their alpha (#1289); Arabic draft catalog; truncated text fills its last line before the ellipsis and keeps truncating when resized; auto-height text with max lines (#1375, #1376, #1377), numbers unchanged; plugin widgets take text input and a property menu (plugin API 4); boards: templates and tables; boards: a shared timer and voting sessions; boards: the dot grid, connector ends dragged to re-attach, curved connectors; `.sketch` import, best effort: import/export breadth 86% → 87%, file formats 60% → 61%, headline numbers unchanged; Canvas & navigation's remaining work no longer lists outline mode's Include hidden layers and Include object bounds; boards: area 22 (weight 0, outside the weighted sum); CJK line breaking: JIS X 4051's line-start and line-end sets completed with the halfwidth small kana, the halfwidth and spacing (semi-)voiced sound marks, iteration marks 〱–〵 and the halfwidth parentheses; Turkish reviewed, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; vector edit mode regions: hover hatch, selection and drag; plugin log byte/count limits (#191); core editor leftovers: component playground, auto gap handles, variables inside styles, inner shadows and background blur on groups, command-made text readable on dark pages, a one-step frame/group convert, delays on mouse triggers and manual overlay offsets, wrapped-line alignment; starter templates, a Templates tab and Getting started tips on the home screen: essentials ~57% → ~59%; everyday editing partials: number fields, outline options, Hide when publishing, cursors, panel widths, dark pages, numbers unchanged but menu breadth 211/211; text box sizes measured against documents re-saved by other software: whole-pixel line heights, advances on a 1024-per-em grid, letter spacing between glyphs only, numbers unchanged; .fig export checked by opening written files in other software, numbers unchanged; a public figcraft-server: open hosting, owner tokens, per-address limits, idle expiry, moderation, install.sh; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; headline percentages recomputed from the area table: feature breadth ~84%, core ~94%, mainstream ~50%; text lists, hanging punctuation and decoration styles; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; styles and variables behaviour suite and fixes; prototyping behaviour suite and fixes; components behaviour suite and fixes; embedded image colour profiles; layers panel keyboard: F2 rename, Shift+F10 context menu, keyboard box selection, 10k-layer QA; per-side stroke weight variables; text behaviour suite: CJK line breaking, metrics, vertical trim; selection and transform behaviour suite and fixes; `.fig` import, best effort; auto layout behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings; feature breadth ~80%; ready ~49%; last major: full re-measure against Figma desktop 126.10.7; rows for the community batches: Selection colors, smart-selection spacing and a Present tab (#753), `.fig` import fidelity, paste from another design app, a `.fig` copy from Save as; control requests while the window is minimised (#720); catalog counts re-measured; automation roots (#715); number variables in the text content picker (#629); frames and sections convert into each other (#719)) · **Target:** Figma Design (desktop app 126.10.7, macOS) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-01 · **Change:** minor (a link on text is underlined by default, as the help center says, and Underline takes the underline off while the link stays; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; gap 6: widgets draw lines and SVG pictures (plugin API 6); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); Thai, Lao, Khmer and Burmese lines break between words (#1219); MCP and control calls name their document (#998); shadows of images with transparent pixels follow their alpha (#1289); Arabic draft catalog; truncated text fills its last line before the ellipsis and keeps truncating when resized; auto-height text with max lines (#1375, #1376, #1377), numbers unchanged; plugin widgets take text input and a property menu (plugin API 4); boards: templates and tables; boards: a shared timer and voting sessions; boards: the dot grid, connector ends dragged to re-attach, curved connectors; `.sketch` import, best effort: import/export breadth 86% → 87%, file formats 60% → 61%, headline numbers unchanged; Canvas & navigation's remaining work no longer lists outline mode's Include hidden layers and Include object bounds; boards: area 22 (weight 0, outside the weighted sum); CJK line breaking: JIS X 4051's line-start and line-end sets completed with the halfwidth small kana, the halfwidth and spacing (semi-)voiced sound marks, iteration marks 〱–〵 and the halfwidth parentheses; Turkish reviewed, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; vector edit mode regions: hover hatch, selection and drag; plugin log byte/count limits (#191); core editor leftovers: component playground, auto gap handles, variables inside styles, inner shadows and background blur on groups, command-made text readable on dark pages, a one-step frame/group convert, delays on mouse triggers and manual overlay offsets, wrapped-line alignment; starter templates, a Templates tab and Getting started tips on the home screen: essentials ~57% → ~59%; everyday editing partials: number fields, outline options, Hide when publishing, cursors, panel widths, dark pages, numbers unchanged but menu breadth 211/211; text box sizes measured against documents re-saved by other software: whole-pixel line heights, advances on a 1024-per-em grid, letter spacing between glyphs only, numbers unchanged; .fig export checked by opening written files in other software, numbers unchanged; a public figcraft-server: open hosting, owner tokens, per-address limits, idle expiry, moderation, install.sh; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; headline percentages recomputed from the area table: feature breadth ~84%, core ~94%, mainstream ~50%; text lists, hanging punctuation and decoration styles; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; styles and variables behaviour suite and fixes; prototyping behaviour suite and fixes; components behaviour suite and fixes; embedded image colour profiles; layers panel keyboard: F2 rename, Shift+F10 context menu, keyboard box selection, 10k-layer QA; per-side stroke weight variables; text behaviour suite: CJK line breaking, metrics, vertical trim; selection and transform behaviour suite and fixes; `.fig` import, best effort; auto layout behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings; feature breadth ~80%; ready ~49%; last major: full re-measure against Figma desktop 126.10.7; rows for the community batches: Selection colors, smart-selection spacing and a Present tab (#753), `.fig` import fidelity, paste from another design app, a `.fig` copy from Save as; control requests while the window is minimised (#720); catalog counts re-measured; automation roots (#715); number variables in the text content picker (#629); frames and sections convert into each other (#719)) · **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 @@ -648,6 +648,7 @@ Carried over from the ROADMAP's "Shipped so far" (2026-10-10). The test count th | Date | Change | Summary | |---|---|---| +| 2026-11-01 | patch | M4: a link made with `text.link` (Cmd/Ctrl+K, Shift+Cmd/Ctrl+U) underlines the linked text unless it has a decoration of its own ("Links are styled with an underline by default. Use the keyboard shortcut to remove the underline", Add links to text); Underline (Cmd/Ctrl+U) takes the underline off and the link stays. Found by a documentation audit of the text rules. Test: `text_behaviour_tests::a_link_is_underlined_by_default_and_underline_takes_it_off`. Numbers unchanged | | 2026-10-31 | patch | M4: Dash and Custom strokes have a Dash cap (None, Round, Square) in the advanced stroke settings and `node.set {dashCap}`, on both ends of every dash on the canvas and in PNG, PDF and SVG. Unset, dashes keep taking the end point caps, so older files look the same; the saved file writes it only when set. Numbers unchanged | | 2026-10-31 | minor | M11, gap 6: widgets draw lines and SVG pictures, as a Figma widget's `Line` and `SVG` do (plugin API 6; older plugins unchanged). A line is 100 long, black and 1 thick unless told otherwise, and turns around its top-left corner. An SVG comes in as locked layers, scaled to fit a size, within the widget's 256 layers. The Counter example uses both. Numbers unchanged. Tests: `widget_shapes_tests`, `widget_tests`. | | 2026-10-30 | minor | M11, gap 6: a widget can open its plugin's panel, as a Figma widget's click handler shows a plugin window (plugin API 5). A widget callback's `ui_show` (click, field edit or menu item) opens the plugin's one panel and keeps the module loaded; each panel callback gets the widget's id and current state as well as the panel's event and values, and its `widget_render` redraws the widget in the same undo step. A widget removed meanwhile isn't redrawn (the callback rolls back, the panel stays); an API 3 or 4 plugin's `ui_show` from a widget still opens nothing; a presented prototype opens no panel. The Counter example (API 5) gets Set count… in its menu: a panel whose Set button redraws it with the count entered. Tests: `widget_panel_tests` (engine), the Counter's unit test. Numbers unchanged | From 2abd8c5f52ae76e1269833fa4351662e45f78cfa Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 1 Nov 2026 23:49:53 -0500 Subject: [PATCH 15/49] M2: Remove all auto layout takes it off a frame and every frame nested in it (#1833) Co-authored-by: Claude Fable 5.1 --- crates/engine/src/al_nesting_tests.rs | 27 +++++++++++++++++++++++++++ crates/engine/src/cmd/structure.rs | 26 ++++++++++++++++++++++++++ crates/ui-egui/locales/en.toml | 1 + crates/ui-egui/src/menus.rs | 1 + docs/auto-layout-parity.md | 4 +++- 5 files changed, 58 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/al_nesting_tests.rs b/crates/engine/src/al_nesting_tests.rs index 6ebcc295b..f5d607ecf 100644 --- a/crates/engine/src/al_nesting_tests.rs +++ b/crates/engine/src/al_nesting_tests.rs @@ -318,3 +318,30 @@ fn fill_text_in_a_hugging_card_sets_the_height_in_one_step() { // Whatever the fonts, the card hugs the wrapped text exactly. assert!((cb.height() - (tb.height() + 20.0)).abs() < 1e-6, "card {cb:?} text {tb:?}"); } + +/// "To remove auto layout from a frame and all of its nested objects at once, right-click on the +/// frame and go to More layout options > Remove all auto layout." (Toggle on auto layout in designs) +#[test] +fn remove_all_auto_layout_strips_the_frame_and_every_frame_nested_in_it() { + let mut s = Session::new(); + let outer = frame(&mut s, None, 0.0, 0.0, 300.0, 100.0); + let inner = frame(&mut s, Some(outer), 0.0, 0.0, 100.0, 50.0); + let deep = frame(&mut s, Some(inner), 0.0, 0.0, 40.0, 20.0); + rect(&mut s, Some(deep), 0.0, 0.0, 10.0, 10.0); + for (f, dir) in [(outer, "horizontal"), (inner, "vertical"), (deep, "horizontal")] { + s.execute("node.set", &json!({"id": f, "props": {"layout": dir}})).unwrap(); + } + let laid_out = |s: &Session| [outer, inner, deep].map(|n| s.doc().unwrap().node(n).unwrap().layout.is_some()); + // Remove auto layout takes it off the frame alone. + s.execute("layout.remove", &json!({"ids": [outer]})).unwrap(); + assert_eq!(laid_out(&s), [false, true, true]); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(laid_out(&s), [true, true, true]); + let steps = s.ds().unwrap().history.undo.len(); + let r = s.execute("layout.removeAll", &json!({"ids": [outer]})).unwrap(); + assert_eq!(laid_out(&s), [false, false, false], "every nested frame too"); + assert_eq!(r["removed"].as_array().map(Vec::len), Some(3)); + assert_eq!(s.ds().unwrap().history.undo.len(), steps + 1, "one undo step"); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(laid_out(&s), [true, true, true]); +} diff --git a/crates/engine/src/cmd/structure.rs b/crates/engine/src/cmd/structure.rs index 52b4a415d..693465d81 100644 --- a/crates/engine/src/cmd/structure.rs +++ b/crates/engine/src/cmd/structure.rs @@ -83,6 +83,32 @@ pub fn specs() -> Vec { } ok() }), + spec!( + "layout.removeAll", + "Remove all auto layout", + "{ids?} takes the auto layout off the frames and every frame nested in them at once (More layout options ▸ Remove all auto layout); instances and the layers inside them keep theirs", + true, + |s, p| { + let ids = req_targets("layout.removeAll", s, p)?; + let doc = s.doc_mut()?; + let mut removed = Vec::new(); + for root in ids { + for i in doc.subtree(root) { + let strip = doc.node(i).is_some_and(|n| n.layout.is_some() && !matches!(n.kind, figcraft_doc::NodeKind::Instance { .. })) + && !crate::assets::components::inside_instance(doc, i); + if !strip { + continue; + } + let n = doc.get_mut(i)?; + n.layout = None; + super::props::drop_layout_bindings(n); + figcraft_layout::coherent_sizing(doc, i); + removed.push(i); + } + } + Ok(json!({"removed": removed})) + } + ), spec!("layout.suggest", "Suggest auto layout", "{ids?, direction? (horizontal|vertical|grid)}", true, layout_add), spec!("object.moveToPage", "Move to page", "{ids?, page}", true, move_to_page), spec!("object.setThumbnail", "Set as thumbnail", "{id?}", true, |s, p| { diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index ba567dd81..9150cc32b 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -1187,6 +1187,7 @@ name = "English" "Remove" = "Remove" "Remove all" = "Remove all" "Remove annotation" = "Remove annotation" +"Remove all auto layout" = "Remove all auto layout" "Remove auto layout" = "Remove auto layout" "Remove column" = "Remove column" "Remove dev resource" = "Remove dev resource" diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 76f220f4f..299d2a20f 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -502,6 +502,7 @@ pub fn popups(app: &mut FigApp, ctx: &egui::Context) { (tr("Use as mask"), "object.mask"), ("-", ""), (tr("Add auto layout"), "layout.add"), + (tr("Remove all auto layout"), "layout.removeAll"), (tr("Create component"), "component.create"), (tr("Detach instance"), "component.detach"), ("-", ""), diff --git a/docs/auto-layout-parity.md b/docs/auto-layout-parity.md index b38829368..feb476a1a 100644 --- a/docs/auto-layout-parity.md +++ b/docs/auto-layout-parity.md @@ -1,6 +1,6 @@ # Auto layout and constraints parity -> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-30 · **Change:** minor (grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); Layout sidebar: Add auto layout (+) is available for groups and converts a single group to a frame in place, with mask order, flow-only inference and Fill sizing preserved; adding auto layout to an empty frame keeps its size (#369); `node.set` applies auto layout keys only to frames, with warnings (#603); core editor leftovers: auto gap handles, wrapped-line alignment; behaviour suite written from the public documentation, every rule's status; fixes and the missing settings it found) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-11-01 · **Change:** minor (Remove all auto layout, as the help center's More layout options has it: `layout.removeAll` takes the auto layout off a frame and every frame nested in it in one undo step; grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); Layout sidebar: Add auto layout (+) is available for groups and converts a single group to a frame in place, with mask order, flow-only inference and Fill sizing preserved; adding auto layout to an empty frame keeps its size (#369); `node.set` applies auto layout keys only to frames, with warnings (#603); core editor leftovers: auto gap handles, wrapped-line alignment; behaviour suite written from the public documentation, every rule's status; fixes and the missing settings it found) · **Target:** Figma Design (desktop app 126.10.7) Auto layout is the most used layout feature in Figma and the one where small differences (a hugging frame one pixel off, text wrapping at another width) break real files. **Breadth ~98%, @@ -42,6 +42,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Hug only on auto layout frames (and text); Fill only in an auto layout flow, never on a top-level frame | pass | `al_behaviour_tests::hug_and_fill_only_where_they_apply` | | Min/max width and height bound Hug, Fill and Fixed sizes, on frames and children | pass | `sizing_rules`; a fill child at its max leaves the rest to the other fill children (silent on redistribution: CSS flexbox) | | A hugging text wider than its max width wraps at the max | pass | `sizing_rules` | +| Remove all auto layout: a frame and all of its nested objects lose their auto layout at once (More layout options) | **added** | `layout.removeAll {ids?}`, one undo step, in the canvas context menu beside Add auto layout; instances and the layers inside them keep theirs; `al_nesting_tests::remove_all_auto_layout_strips_the_frame_and_every_frame_nested_in_it` | | Text filling a width wraps and its hugging frame grows with it | pass | `sizing_rules` | | A hugging frame follows a child that grows, through nested levels, in one edit and one undo step | pass | `al_behaviour_tests::a_hugging_frame_follows_its_children_through_nested_levels` | | Padding per side (uniform, vertical/horizontal, individual) | pass | `padding_and_stroke_rules` | @@ -95,6 +96,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Date | Change | Summary | |---|---|---| +| 2026-11-01 | minor | M2: Remove all auto layout ("To remove auto layout from a frame and all of its nested objects at once, right-click on the frame and go to More layout options > Remove all auto layout", Toggle on auto layout in designs): `layout.removeAll {ids?}` strips the frames and every frame nested in them in one undo step, leaving instances and their layers alone; in the canvas context menu beside Add auto layout and in the Actions palette. Found by a documentation audit of this page. Test: `al_nesting_tests::remove_all_auto_layout_strips_the_frame_and_every_frame_nested_in_it`. Numbers unchanged | | 2026-10-30 | minor | M8, #1083: grid placement finds free cells on a bitmap, a word at a time, with the same placements; crafted grids of wide children no longer stall a layout pass. Numbers unchanged. | | 2026-10-29 | minor | M2 review fixes: conversion preserves mask runs and Fill sizing per axis; layout inference uses visible, non-absolute flow children; the sidebar hides Add for mixed selections containing existing auto layout. Regression coverage includes rendered mask pixels, visible-child positions, parent layout stability and the sidebar accessibility tree. Numbers unchanged | | 2026-10-29 | minor | M2: the Layout sidebar exposes Add auto layout (+) for groups. `layout.add` converts one selected group into a frame in place rather than wrapping it: same id, name and direct children; the layout arranges those children, and one undo restores the group. Sidebar, menu, shortcut and API calls all use the corrected command. This follows the contributor’s observed Figma behavior and the workflow familiar to users of similar design tools. Tests cover direct-child reflow, stable hierarchy, undo/redo and wrapping a multi-group selection. Numbers unchanged | From 65bd00f739601e257150275347cc816b0d68f098 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 1 Nov 2026 23:49:58 -0500 Subject: [PATCH 16/49] M3: Delete on a layer inside an instance hides it instead of being refused (#1834) * M3: Delete on a layer inside an instance hides it instead of being refused Co-Authored-By: Claude Fable 5.1 * The components structure test: Delete inside an instance hides Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 --- crates/engine/src/assets/components/tests.rs | 6 ++++- crates/engine/src/cmd/edit.rs | 11 ++++++++- .../engine/src/components_behaviour_tests.rs | 24 ++++++++++++++++++- docs/components-parity.md | 5 ++-- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/assets/components/tests.rs b/crates/engine/src/assets/components/tests.rs index 82aabc63f..ffaac176f 100644 --- a/crates/engine/src/assets/components/tests.rs +++ b/crates/engine/src/assets/components/tests.rs @@ -144,7 +144,6 @@ fn instances_refuse_structure_edits() { let before = s.doc().unwrap().clone(); let undo = s.ds().unwrap().history.undo.len(); let refused = [ - ("edit.delete", json!({"ids": [ibg]})), ("shape.rectangle", json!({"x": 0, "y": 0, "width": 5, "height": 5, "parent": i})), ("node.reorder", json!({"id": idot, "index": 0})), ("object.group", json!({"ids": [ibg, idot]})), @@ -158,6 +157,11 @@ fn instances_refuse_structure_edits() { assert_eq!(*s.doc().unwrap(), before, "{cmd} rolled back"); } assert_eq!(s.ds().unwrap().history.undo.len(), undo); + // Delete on a layer inside hides it instead (an override), as the reference tool does. + ex(&mut s, "edit.delete", json!({"ids": [ibg]})); + assert!(s.doc().unwrap().node(ibg).is_some_and(|n| !n.visible), "hidden, not removed"); + assert_eq!(s.doc().unwrap().node(i).unwrap().children, before.node(i).unwrap().children, "the structure is intact"); + healthy(&s); // Deleting the whole instance is fine. ex(&mut s, "edit.delete", json!({"ids": [i]})); healthy(&s); diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 3f72e429e..700fa7414 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -544,6 +544,15 @@ fn delete(s: &mut Session, p: &Value) -> Result { let ids = req_targets("edit.delete", s, p)?; let doc = s.doc_mut()?; let ids = roots(doc, &ids); + // A layer inside an instance can't be removed: Delete hides it instead, an override ("Figma + // will only toggle the layer's visibility instead of removing it", Guide to auto layout). + let (hidden, ids): (Vec<_>, Vec<_>) = ids.into_iter().partition(|i| crate::assets::components::inside_instance(doc, *i)); + for i in &hidden { + doc.get_mut(*i)?.visible = false; + } + if ids.is_empty() { + return Ok(json!({"deleted": [], "hidden": hidden})); + } let mut parents = Vec::new(); for i in &ids { if doc.node(*i).is_some_and(Node::is_page) { @@ -556,7 +565,7 @@ fn delete(s: &mut Session, p: &Value) -> Result { } // Select the parent frame like Figma? Figma clears the selection. s.set_selection(vec![]); - Ok(json!({"deleted": ids})) + Ok(json!({"deleted": ids, "hidden": hidden})) } /// Layers duplicated last (Duplicate or Alt-drag) and their copies, in the same order. While the diff --git a/crates/engine/src/components_behaviour_tests.rs b/crates/engine/src/components_behaviour_tests.rs index a95e1268c..6d5a7ebcb 100644 --- a/crates/engine/src/components_behaviour_tests.rs +++ b/crates/engine/src/components_behaviour_tests.rs @@ -512,7 +512,6 @@ fn what_instances_cannot_override_is_refused() { ), ("remove auto layout", "layout.remove", json!({"ids": ["$"]}), Layer::Row, "structure of the instance"), ("reorder layers", "node.reorder", json!({"id": "$", "index": 3}), Layer::Bg, "\"the order, or z-index, of any layers within the instance\""), - ("delete a layer", "edit.delete", json!({"ids": ["$"]}), Layer::Bg, "layers can only be hidden"), ( "add a layer", "shape.rectangle", @@ -969,3 +968,26 @@ fn a_new_component_set_is_named_after_its_first_variant() { assert_eq!(node(&s, c).name, "State=Default"); healthy(&s); } + +/// "You can't delete a layer or object from an instance. If you try, Figma will only toggle the +/// layer's visibility instead of removing it." (Guide to auto layout; the flows article says the +/// same). Delete hides the layer, an override; the main component is untouched. +#[test] +fn deleting_a_layer_inside_an_instance_hides_it_instead() { + let mut s = Session::new(); + let k = kit(&mut s); + let target = k.copy(&s, Layer::Bg); + let steps = undo_len(&s); + let r = s.execute("edit.delete", &json!({"ids": [target]})).unwrap(); + assert_eq!((r["hidden"].clone(), r["deleted"].clone()), (json!([target]), json!([]))); + let doc = s.doc().unwrap(); + assert!(doc.node(target).is_some_and(|n| !n.visible), "hidden, not removed"); + assert!(doc.node(k.bg).is_some_and(|n| n.visible), "the main is untouched"); + assert_eq!(doc.node(k.inst).unwrap().children.len(), doc.node(k.card).unwrap().children.len(), "the structure is intact"); + assert_eq!(undo_len(&s), steps + 1, "one undo step"); + s.execute("edit.undo", &json!({})).unwrap(); + assert!(s.doc().unwrap().node(target).is_some_and(|n| n.visible)); + // The instance itself still goes away. + s.execute("edit.delete", &json!({"ids": [k.inst]})).unwrap(); + assert!(s.doc().unwrap().node(k.inst).is_none()); +} diff --git a/docs/components-parity.md b/docs/components-parity.md index 051730215..0e3248248 100644 --- a/docs/components-parity.md +++ b/docs/components-parity.md @@ -1,6 +1,6 @@ # Components, variants, styles and variables parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-31 · **Change:** minor (library analytics list how many layers and files use each style and variable; SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a collection of this file can be extended (Extend collection on its row, `variable.extendCollection`), its extension following its edits at once, and extended collections extend again in the file; a typed or stored variable, collection or mode id names only the object with that id (#1613); colour variables can be calculated from other colours per mode — `{alpha}` replaces a colour's alpha, `{mix}` blends two — and follow them (#1280); stored variable and collection references keep their identity when another object is named like their id (follow-up to #1542); a component set's property rows fit the 240 px right panel: variant values wrap two to a line there and every + and − stays in view; opening a file contacts no team library server it names until you check it (#1097); an explicit variables file path (`variable.import`, the `variables` of `file.open` and `file.import`) is refused past 256 MiB or when it isn't a regular file, as the sibling `variables.json` already was (part of #1114); component properties keep the order they were made in when one is renamed, and Make slot asks for the slot's name first (#1536, #1537); components can't contain their own instances, directly or through others (#1084); the instance-swap menus have a search field (#1338); an instance-swap property's default menu scrolls (#1338); variables on a text style's fields from the style editor; instance-swap properties in the component playground; duplicating or Alt-dragging a main component makes an instance of it (#892); a bound colour variable's alpha applies once (#802); variables import reads `variables` outside `meta` and warns when it imports none (#790); variant properties reorder by drag; library files saved right after a read are read again; Hide when publishing note corrected; size and resizing overrides of layers inside instances (#731); variables export in the browser as a download; core editor leftovers: component playground, variables inside styles; layers and assets panels behaviour suite and fixes; extended collections tail; styles and variables behaviour suite and fixes; components behaviour suite and fixes; team libraries on the server, library usage and swapping a library; extended collections, variables import/export, gradient stops and variant properties bound to variables) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-01 · **Change:** minor (Delete on a layer inside an instance hides it as an override instead of being refused, as the help center says: "Figma will only toggle the layer's visibility instead of removing it"; library analytics list how many layers and files use each style and variable; SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a collection of this file can be extended (Extend collection on its row, `variable.extendCollection`), its extension following its edits at once, and extended collections extend again in the file; a typed or stored variable, collection or mode id names only the object with that id (#1613); colour variables can be calculated from other colours per mode — `{alpha}` replaces a colour's alpha, `{mix}` blends two — and follow them (#1280); stored variable and collection references keep their identity when another object is named like their id (follow-up to #1542); a component set's property rows fit the 240 px right panel: variant values wrap two to a line there and every + and − stays in view; opening a file contacts no team library server it names until you check it (#1097); an explicit variables file path (`variable.import`, the `variables` of `file.open` and `file.import`) is refused past 256 MiB or when it isn't a regular file, as the sibling `variables.json` already was (part of #1114); component properties keep the order they were made in when one is renamed, and Make slot asks for the slot's name first (#1536, #1537); components can't contain their own instances, directly or through others (#1084); the instance-swap menus have a search field (#1338); an instance-swap property's default menu scrolls (#1338); variables on a text style's fields from the style editor; instance-swap properties in the component playground; duplicating or Alt-dragging a main component makes an instance of it (#892); a bound colour variable's alpha applies once (#802); variables import reads `variables` outside `meta` and warns when it imports none (#790); variant properties reorder by drag; library files saved right after a read are read again; Hide when publishing note corrected; size and resizing overrides of layers inside instances (#731); variables export in the browser as a download; core editor leftovers: component playground, variables inside styles; layers and assets panels behaviour suite and fixes; extended collections tail; styles and variables behaviour suite and fixes; components behaviour suite and fixes; team libraries on the server, library usage and swapping a library; extended collections, variables import/export, gradient stops and variant properties bound to variables) · **Target:** Figma Design (desktop app 126.10.7) Design systems are why teams adopt Figma. **Components: breadth ~96%, ready ~72%. Styles and variables: breadth ~95%, ready ~76% (estimated).** QA'd with a synthetic design system of ~300 @@ -15,7 +15,7 @@ accounts). | Create component, instances, detach, reset, go to main, restore main, push changes | done | push from a nested layer goes to the outer main | | Per-layer overrides with reset; kept across main edits, nested swaps, copy/paste | done | main edits match a full rebuild exactly at 2,000 instances | | What an instance overrides: fills, strokes, effects, visibility, layer names, text content and every text property (resizing included), auto layout padding, gap and alignment, layout grids, export settings, prototype interactions, nested swaps and property values; the size and resizing (hug, fill, fixed, min and max) of layers inside it | done | each kept when the main changes that property, reset per group; opacity and corner radius too (documentation silent); size and resizing are kept through relayout, undo, save, `.fig` and REST import and detach, and stay with the instance on push | -| What it doesn't: position, rotation, constraints and absolute or grid placement of layers inside it, its auto layout direction and other settings, its structure | done | refused with a message, the fields greyed out; the instance itself resizes and its layers follow the main's constraints | +| What it doesn't: position, rotation, constraints and absolute or grid placement of layers inside it, its auto layout direction and other settings, its structure | done | refused with a message, the fields greyed out (Delete on a layer inside an instance hides it instead of removing it, as the help center says it does); the instance itself resizes and its layers follow the main's constraints | | Component sets / variants, add variant, switch | done | Combine as variants is in the Object menu, and the canvas and layers context menu and the Design panel offer it when two or more main components are selected; Add variant on a main component not in a set yet makes it a set of itself and the new variant, one undo step (#903); components that are variants already aren't combined again (it used to put a set inside a set) | | A main's copy within its file is an instance of it: Duplicate, Alt-drag, Copy then Paste | done | a variant duplicated in its set stays a new variant and a whole set copies as a new set; only the copied roots become instances (a main inside a copied frame is copied as a main); Cut then Paste and pastes into other files keep the component (#892) | | A component can't contain its own instance, directly or through other components | done | refused with the loop named (creating, placing, swapping, switching variants, moving, pasting, an instance-swap value); each variant counts as its own component, so a variant may hold a sibling variant's instance unless that one leads back to it; a dropped instance lands on the page; a file holding a loop opens with one instance detached and a note, any other file unchanged; a loop merged in a live session stops expanding where an instance would show itself again (#1084) | @@ -78,6 +78,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Date | Change | Summary | |---|---|---| +| 2026-11-01 | patch | M3: Delete on a layer inside an instance hides it (an override) instead of being refused ("You can't delete a layer or object from an instance. If you try, Figma will only toggle the layer's visibility instead of removing it", Guide to auto layout); `edit.delete` reports those ids under `hidden`, the structure and the main component stay as they were, one undo step; deleting the instance itself still removes it. Found by a documentation audit of the auto layout page. Test: `components_behaviour_tests::deleting_a_layer_inside_an_instance_hides_it_instead` (the refusal row for it is gone from `what_instances_cannot_override_is_refused`). Numbers unchanged | | 2026-10-31 | minor | M3, gap 10: library analytics cover styles and variables. A file reports how many of its layers use each of a library's styles and variables, and Show usage (`library.usage`) lists them beside the components, by a Type choice, with their layers and files. Layers inside instances count for their component. Insertions, detachments and modes aren't counted for them yet. Numbers unchanged. Tests: `library_assets_tests`. | | 2026-10-31 | minor | M6: as the help center describes code syntax, Dev Mode's SwiftUI and Compose code now writes a bound variable's iOS or Android code syntax in place of its value, as CSS already wrote the Web one: fills, strokes and their weight, sizes, corner radius, gaps, padding, opacity, the font family and size and the characters. A variable with no code syntax for the platform keeps the value, since a name made up here wouldn't exist in the code it lands in. ArkUI and Flutter have no code syntax platform and are unchanged. Test: `variables_behaviour_tests::swiftui_and_compose_name_variables_by_their_code_syntax`. Numbers unchanged. Grade unchanged | | 2026-10-31 | minor | M3, gap 10: library analytics over time. A file counts the instances of library components it inserts (placed, created, pasted or duplicated, Alt-dragged copies too; not those nested in another instance) and reports them like its detaches (`ReportInserted`). The server counts what a file's insertion and detach totals grow past their highest in the current week, a Monday at 00:00 UTC, so an undo and a redo count once, and keeps a year of weeks in `actions.json` (`Actions`). `library.usage {days?}` adds `insertions`, `detachments` and `weeks`, and per component `insertions` and `detachments`; Show usage has a 30 days, 90 days or 1 year choice, the period's totals, and each component's counts on a line of their own. The new variants are appended, so older messages keep their bytes; an older server refuses them and Show usage says it doesn't count insertions. A file's first report after this counts its total in that week. Tests: `library_actions_tests`, `inserting_library_instances_counts_them`. Grade unchanged | From 5050631bcf0679ac01f53c073a0b6310d2084ce9 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 1 Nov 2026 23:50:03 -0500 Subject: [PATCH 17/49] M5: Hide UI in the presenter: the bars go away and Cmd/Ctrl+\ brings them back (#1820) (#1826) Co-authored-by: Claude Fable 5.1 --- crates/engine/src/cmd/proto.rs | 6 ++-- crates/ui-egui/locales/en.toml | 2 ++ crates/ui-egui/src/app/commands.rs | 4 +++ crates/ui-egui/src/app/control.rs | 2 +- crates/ui-egui/src/present.rs | 5 ++- crates/ui-egui/src/present/chrome.rs | 16 ++++++++- crates/ui-egui/src/present/navigate.rs | 1 + crates/ui-egui/src/present/player.rs | 12 +++++-- crates/ui-egui/src/proto_editor_tests.rs | 45 +++++++++++++++++++++++- docs/control-protocol.md | 4 +-- docs/mcp.md | 2 +- docs/prototyping-parity.md | 4 ++- 12 files changed, 90 insertions(+), 13 deletions(-) diff --git a/crates/engine/src/cmd/proto.rs b/crates/engine/src/cmd/proto.rs index df80764a3..dc30e933b 100644 --- a/crates/engine/src/cmd/proto.rs +++ b/crates/engine/src/cmd/proto.rs @@ -137,7 +137,7 @@ pub fn specs() -> Vec { spec!( "proto.presentOptions", "Presentation options", - "{scale? fit|fitWidth|fill|actual, deviceFrame? bool, hotspotHints? bool, inspect? bool} how the presenter sizes the prototype (Fit scales down to fit, Fit width fills the width, Fill covers the window, Actual shows it at 100%), whether it draws the device, whether a click where nothing reacts flashes the hotspots (on by default) and whether the Inspect panel shows the properties of the layer under the pointer; kept for later presentations", + "{scale? fit|fitWidth|fill|actual, deviceFrame? bool, hotspotHints? bool, inspect? bool, hideUi? bool} how the presenter sizes the prototype (Fit scales down to fit, Fit width fills the width, Fill covers the window, Actual shows it at 100%), whether it draws the device, whether a click where nothing reacts flashes the hotspots (on by default), whether the Inspect panel shows the properties of the layer under the pointer, and whether the bars are hidden (Hide UI: the prototype alone; Cmd/Ctrl+\\ shows them again); kept for later presentations", false, |s, p| { let cmd = "proto.presentOptions"; @@ -146,13 +146,13 @@ pub fn specs() -> Vec { let scale = v.as_str().filter(|x| PRESENT_SCALES.contains(x)).ok_or_else(|| bad(cmd, "scale: fit|fitWidth|fill|actual"))?; data.insert("scale".into(), json!(scale)); } - for key in ["deviceFrame", "hotspotHints", "inspect"] { + for key in ["deviceFrame", "hotspotHints", "inspect", "hideUi"] { if let Some(v) = p.get(key).filter(|v| !v.is_null()) { data.insert(key.into(), json!(v.as_bool().ok_or_else(|| bad(cmd, format!("{key}: true|false")))?)); } } if data.is_empty() { - return Err(bad(cmd, "nothing to set: scale, deviceFrame, hotspotHints or inspect")); + return Err(bad(cmd, "nothing to set: scale, deviceFrame, hotspotHints, inspect or hideUi")); } s.request_ui("present.options", Value::Object(data)); ok() diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index 9150cc32b..38f2d4970 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -656,6 +656,7 @@ name = "English" "Help page" = "Help page" "Here: {names}" = "Here: {names}" "Hidden" = "Hidden" +"Hide UI" = "Hide UI" "Hide contents" = "Hide contents" "Hide from publishing" = "Hide from publishing" "Hide section contents" = "Hide section contents" @@ -1385,6 +1386,7 @@ name = "English" "Show device frame" = "Show device frame" "Show dimensions on objects" = "Show dimensions on objects" "Show hotspot hints" = "Show hotspot hints" +"The bars are hidden. {shortcut} shows them again" = "The bars are hidden. {shortcut} shows them again" "Show in Explorer" = "Show in Explorer" "Show in Finder" = "Show in Finder" "Show in folder" = "Show in folder" diff --git a/crates/ui-egui/src/app/commands.rs b/crates/ui-egui/src/app/commands.rs index 69b60c5ed..0e34f437a 100644 --- a/crates/ui-egui/src/app/commands.rs +++ b/crates/ui-egui/src/app/commands.rs @@ -210,10 +210,14 @@ impl FigApp { if let Some(i) = r.data.get("inspect").and_then(|i| i.as_bool()) { v.inspect = i; } + if let Some(h) = r.data.get("hideUi").and_then(|h| h.as_bool()) { + v.hide_ui = h; + } if let Some(p) = self.ui.present.as_mut() { p.view.device_frame = v.device_frame; p.view.hotspot_hints = v.hotspot_hints; p.view.inspect = v.inspect; + p.view.hide_ui = v.hide_ui; p.set_scale(v.scale); } } diff --git a/crates/ui-egui/src/app/control.rs b/crates/ui-egui/src/app/control.rs index 10baf76e8..72435673c 100644 --- a/crates/ui-egui/src/app/control.rs +++ b/crates/ui-egui/src/app/control.rs @@ -53,7 +53,7 @@ impl FigApp { "reduceMotion": self.reduce_motion(), "presenting": self.ui.present.is_some(), "presenter": tabs::shown_or_paused(self).map(present::Presenter::inspect), - "presentOptions": {"scale": self.ui.present_view.scale.id(), "deviceFrame": self.ui.present_view.device_frame, "comments": self.ui.present_view.comments, "hotspotHints": self.ui.present_view.hotspot_hints, "inspect": self.ui.present_view.inspect}, + "presentOptions": {"scale": self.ui.present_view.scale.id(), "deviceFrame": self.ui.present_view.device_frame, "comments": self.ui.present_view.comments, "hotspotHints": self.ui.present_view.hotspot_hints, "inspect": self.ui.present_view.inspect, "hideUi": self.ui.present_view.hide_ui}, "preview": self.ui.preview.as_ref().map(|p| p.player.inspect()), "mainMenu": self.ui.main_menu, "palette": self.ui.palette.is_some(), diff --git a/crates/ui-egui/src/present.rs b/crates/ui-egui/src/present.rs index 11c4466df..8f23069f2 100644 --- a/crates/ui-egui/src/present.rs +++ b/crates/ui-egui/src/present.rs @@ -216,11 +216,14 @@ pub struct PresentView { pub hotspot_hints: bool, /// A panel beside the prototype shows the Inspect properties of the layer under the pointer. pub inspect: bool, + /// Hide UI: the bar above the prototype and the navigation bar under it are gone, so the + /// prototype shows alone (Cmd/Ctrl+\, the editor's Show/Hide UI key, brings them back). + pub hide_ui: bool, } impl Default for PresentView { fn default() -> Self { - Self { scale: PresentScale::Fit, device_frame: true, comments: false, hotspot_hints: true, inspect: false } + Self { scale: PresentScale::Fit, device_frame: true, comments: false, hotspot_hints: true, inspect: false, hide_ui: false } } } diff --git a/crates/ui-egui/src/present/chrome.rs b/crates/ui-egui/src/present/chrome.rs index 4b477ec9f..4fc57ff0f 100644 --- a/crates/ui-egui/src/present/chrome.rs +++ b/crates/ui-egui/src/present/chrome.rs @@ -21,6 +21,8 @@ pub(super) enum BarAction { Comments, /// Show or hide the Inspect panel. Inspect, + /// Hide UI: hide or show the bars (the Options menu, Cmd/Ctrl+\). + HideUi, } pub struct PresentTab { @@ -53,6 +55,10 @@ pub fn show(app: &mut FigApp, ui: &mut Ui) { if !typing && ctx.input_mut(|i| i.consume_key(egui::Modifiers::SHIFT, egui::Key::C)) { action = Some(BarAction::Comments); } + // Cmd/Ctrl+\ hides and shows the bars, as it hides and shows the editor's UI. + if !typing && ctx.input_mut(|i| i.consume_key(egui::Modifiers::COMMAND, egui::Key::Backslash)) { + action = Some(BarAction::HideUi); + } if pres.view.inspect { let t = Tokens::get(&ctx); egui::Panel::right("present_inspect") @@ -64,7 +70,7 @@ pub fn show(app: &mut FigApp, ui: &mut Ui) { egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| { action = player(&mut pres, ui, ui.max_rect(), now, Chrome { keys: !typing, ..FULL }).or(action); }); - let picked_device = navigation_bar(&mut pres, &ctx, now); + let picked_device = if pres.view.hide_ui { None } else { navigation_bar(&mut pres, &ctx, now) }; // Keys the prototype left alone: C shows the comments, F fills the screen. if !typing { if ctx.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::C)) { @@ -78,6 +84,14 @@ pub fn show(app: &mut FigApp, ui: &mut Ui) { match action { Some(BarAction::Comments) => pres.view.comments = !pres.view.comments, Some(BarAction::Inspect) => pres.view.inspect = !pres.view.inspect, + Some(BarAction::HideUi) => { + pres.view.hide_ui = !pres.view.hide_ui; + // As the reference tool does, say how the bars come back. + if pres.view.hide_ui { + let shortcut = crate::toolbar::pretty_shortcut("Cmd+\\"); + app.toast(crate::i18n::trf("The bars are hidden. {shortcut} shows them again", &[("shortcut", &shortcut)])); + } + } _ => {} } if live diff --git a/crates/ui-egui/src/present/navigate.rs b/crates/ui-egui/src/present/navigate.rs index 34e76ea80..b5ae19cec 100644 --- a/crates/ui-egui/src/present/navigate.rs +++ b/crates/ui-egui/src/present/navigate.rs @@ -130,6 +130,7 @@ impl Presenter { "waiting": self.waiting.len(), "inspect": self.view.inspect, "inspected": self.inspected, + "hideUi": self.view.hide_ui, "deviceColor": doc.and_then(|d| page_settings(d, self.current).device_color()).map(|c| c.name), "responsive": self.fit.map(|f| [f.0, f.1]), "frameSize": doc.and_then(|d| d.node(self.current)).map(|n| [n.width, n.height]), diff --git a/crates/ui-egui/src/present/player.rs b/crates/ui-egui/src/present/player.rs index 006d95214..8bcbea09d 100644 --- a/crates/ui-egui/src/present/player.rs +++ b/crates/ui-egui/src/present/player.rs @@ -16,12 +16,14 @@ use super::{ pub(super) fn player(p: &mut Presenter, ui: &mut Ui, rect: Rect, now: f64, chrome: Chrome) -> Option { let ctx = ui.ctx().clone(); p.clock = now; - let bar = Rect::from_min_size(rect.min, vec2(rect.width(), chrome.bar_h)); + // Hide UI (the full-window presenter only): no bar, the prototype takes the whole window. + let hidden = p.view.hide_ui && !chrome.pane; + let bar = Rect::from_min_size(rect.min, vec2(rect.width(), if hidden { 0.0 } else { chrome.bar_h })); let area = Rect::from_min_max(pos2(rect.min.x, bar.max.y), rect.max); let bg = crate::theme::doc_c32(ui.ctx(), p.doc.as_ref().map(|d| page_settings(d, p.current)).unwrap_or_default().background); let r = chrome.round; ui.painter().rect_filled(area, CornerRadius { nw: 0, ne: 0, sw: r, se: r }, bg); - let action = top_bar(p, ui, bar, now, chrome); + let action = if hidden { None } else { top_bar(p, ui, bar, now, chrome) }; if action == Some(BarAction::Restart) { p.restart(p.start, now); } @@ -280,6 +282,12 @@ fn options_menu(p: &mut Presenter, ui: &mut Ui, device: Option, responsi p.view.hotspot_hints = !p.view.hotspot_hints; ui.close(); } + // Hide UI, as the reference tool's Options menu has it (#1820): the bars go away, the key + // (the editor's Show/Hide UI key) brings them back. + if menu_check(ui, p.view.hide_ui, tr("Hide UI"), &crate::toolbar::pretty_shortcut("Cmd+\\")) { + action = Some(BarAction::HideUi); + ui.close(); + } if menu_check(ui, false, tr("Restart"), "R") { p.restart(p.start, now); ui.close(); diff --git a/crates/ui-egui/src/proto_editor_tests.rs b/crates/ui-egui/src/proto_editor_tests.rs index 63c152e14..b16894425 100644 --- a/crates/ui-egui/src/proto_editor_tests.rs +++ b/crates/ui-egui/src/proto_editor_tests.rs @@ -1,10 +1,11 @@ //! The interaction editor's conditionals and the presenter's hotspot hints, driven headless //! through egui (the harness is `present_tests`'). -use egui::{Pos2, Rect, pos2}; +use egui::{Event, Key, Modifiers, Pos2, Rect, pos2}; use figcraft_doc::proto::{Action, Expr, ExprOp}; use figcraft_doc::{NodeId, VariableValue}; use figcraft_engine::Session; +use figcraft_engine::keymap::Platform; use serde_json::{Value, json}; use crate::present_tests::{Ui, id}; @@ -42,6 +43,48 @@ fn click(u: &mut Ui, p: Pos2) { u.button(p, false); } +fn press(u: &mut Ui, key: Key, modifiers: Modifiers) { + let ev = |pressed| Event::Key { key, physical_key: None, pressed, repeat: false, modifiers }; + u.frame(vec![ev(true), ev(false)]); +} + +/// Cmd on macOS, Ctrl elsewhere, as egui reports it. +fn cmd() -> Modifiers { + if crate::shortcuts::platform() == Platform::Mac { Modifiers::MAC_CMD | Modifiers::COMMAND } else { Modifiers::CTRL | Modifiers::COMMAND } +} + +/// Hide UI (the Options menu, or Cmd/Ctrl+\ as in the editor) hides the bar above the prototype and +/// the navigation bar under it, so the prototype alone shows and takes the bar's room; the key shows +/// them again; the option carries over like the others, and the prototype still reacts meanwhile. +#[test] +fn hide_ui_hides_the_bars_and_the_key_shows_them_again() { + let (s, a, b, _) = setup(); + let mut u = Ui::new(s); + u.run("proto.present", json!({"start": a})); + u.frame(vec![]); + assert_eq!(presenter(&u)["hideUi"], json!(false), "shown by default"); + let top = |u: &Ui| rect_of(&presenter(u)["hotspots"][0]["rect"]).min.y; + let with_bars = top(&u); + u.run("proto.presentOptions", json!({"hideUi": true})); + u.frame(vec![]); + assert_eq!(presenter(&u)["hideUi"], json!(true)); + assert_eq!(u.app.inspect()["presentOptions"]["hideUi"], json!(true), "kept for the next presentation"); + let without = top(&u); + assert!(without < with_bars, "the prototype moves up into the bar's room: {with_bars} then {without}"); + press(&mut u, Key::Backslash, cmd()); + u.frame(vec![]); + assert_eq!(presenter(&u)["hideUi"], json!(false), "the key shows the bars again"); + assert_eq!(top(&u), with_bars); + press(&mut u, Key::Backslash, cmd()); + u.frame(vec![]); + assert_eq!(presenter(&u)["hideUi"], json!(true), "and hides them once more"); + assert!(u.app.ui.present_view.hide_ui, "kept for the next presentation"); + // The prototype keeps reacting with the bars hidden. + let at = rect_of(&presenter(&u)["hotspots"][0]["rect"]).center(); + click(&mut u, at); + assert_eq!(presenter(&u)["current"], json!(b)); +} + #[test] fn a_click_where_nothing_reacts_flashes_the_hotspots() { let (s, a, b, btn) = setup(); diff --git a/docs/control-protocol.md b/docs/control-protocol.md index b2a455e0f..82ba08bd1 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -250,9 +250,9 @@ far the view is panned (`pan`, `panRange`), whether a scroll is still coasting ( active screen's `hotspots` (`[{id, rect: [x0, y0, x1, y1]}]` in window points, bottom-most first), whether a click where nothing reacts flashes them (`hotspotHints`) and they are flashing now (`hotspotFlash`), and whether the Inspect panel shows (`inspect`) with the layer it shows -(`inspected`), and the link an Open link notice waits to open (`linkNotice`, else `null`) (`null` +(`inspected`), whether its bars are hidden (`hideUi`), and the link an Open link notice waits to open (`linkNotice`, else `null`) (`null` when nothing plays). `presentOptions` holds the options the next presentation -starts with (`scale`, `deviceFrame`, `comments`, `hotspotHints`, `inspect`). +starts with (`scale`, `deviceFrame`, `comments`, `hotspotHints`, `inspect`, `hideUi`). `textPreview` is true while a live text preview shows on the canvas (a hovered text style or named instance, a dragged axis slider; see `text.preview` in [mcp.md](mcp.md)). `focus` is keyboard navigation's state: the `region` with the keyboard (`toolbar`, `layers`, diff --git a/docs/mcp.md b/docs/mcp.md index 0e9f4f497..b5e49e749 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -859,7 +859,7 @@ in the file) the presented frame is instead resized to the device's screen, or w the presenter's window at 100%, and its constraints and auto layout respond as when it is resized in the editor (an axis it hugs keeps hugging its content); the file's frames don't change. `proto.present {start?}` plays the prototype full-window and `proto.preview {start?}` in a resizable pane over the canvas that follows edits live; `proto.closePreview` closes -it. `proto.presentOptions {scale?, deviceFrame?, hotspotHints?, inspect?}` sets how the +it. `proto.presentOptions {scale?, deviceFrame?, hotspotHints?, inspect?, hideUi?}` sets how the full-window presenter sizes the prototype (`fit` scales it down to fit, `fitWidth` fills the width, `fill` covers the window, `actual` shows it at 100%; what overflows pans), whether it draws the device, whether a click where nothing reacts briefly flashes the screen's hotspots (the layers with diff --git a/docs/prototyping-parity.md b/docs/prototyping-parity.md index 345d08753..826b6780d 100644 --- a/docs/prototyping-parity.md +++ b/docs/prototyping-parity.md @@ -1,6 +1,6 @@ # Prototyping parity -> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-31 · **Change:** minor (the Controller menu names each button as PlayStation and Switch controllers do; "Open in new tab" on Open link: off, the web build's own tab goes to the link; a manual overlay's position can be dragged on the canvas (#405); Open link notices now cover mail links, and skipping them covers only links the viewer fired (#1096); overlay positions relative to the layer that opens them; the Triggers row no longer lists delays on mouse triggers as missing; top-level frames bigger than the device's screen scroll in the player; Change to, set variable and set variable mode lay out what they change in the player, as the canvas does; presentation tabs, one per page of a file; a Present tab with device and scale controls (#537); core editor leftovers: delays on mouse triggers and manual overlay offsets; controller buttons on key/gamepad triggers, widgets that react in prototypes, `proto.evaluate` and the mode lookup rules pinned) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-11-01 · **Change:** minor (Hide UI in the presenter's Options menu, and Cmd/Ctrl+\ as in the editor: the bar above the prototype and the navigation bar under it go away, a toast names the key that brings them back, `proto.presentOptions {hideUi}` (#1820); the Controller menu names each button as PlayStation and Switch controllers do; "Open in new tab" on Open link: off, the web build's own tab goes to the link; a manual overlay's position can be dragged on the canvas (#405); Open link notices now cover mail links, and skipping them covers only links the viewer fired (#1096); overlay positions relative to the layer that opens them; the Triggers row no longer lists delays on mouse triggers as missing; top-level frames bigger than the device's screen scroll in the player; Change to, set variable and set variable mode lay out what they change in the player, as the canvas does; presentation tabs, one per page of a file; a Present tab with device and scale controls (#537); core editor leftovers: delays on mouse triggers and manual overlay offsets; controller buttons on key/gamepad triggers, widgets that react in prototypes, `proto.evaluate` and the mode lookup rules pinned) · **Target:** Figma Design (desktop app 126.10.7) **Breadth ~92%, ready ~74% (estimated).** Every Figma trigger except media, every action except media control, every transition and easing exist; key/gamepad triggers take controller buttons, @@ -44,6 +44,7 @@ tool; opt-in), **silent** (the documentation doesn't say; the case pins the curr | Nested layers with the same trigger: the top-most layer's interaction wins; a layer without that trigger lets it through to the one under it | pass | `nested_hotspots_and_click_through`, `hotspots_priority_and_click_through` | | A layer without interactions over a hotspot | silent | it doesn't block it: clicks reach the hotspot under it | | Hidden layers aren't hotspots; clipping frames cut their hotspots | pass | same | +| Hide UI (Options menu): "Hide the toolbar and footer on your current view" and "Remind you how to restore the toolbar and footer" | **added** | the Options menu's Hide UI and Cmd/Ctrl+\ (the editor's Show/Hide UI key, as the reference tool's) hide the bar above the prototype and the navigation bar under it, and a toast names the key that shows them again; `hide_ui_hides_the_bars_and_the_key_shows_them_again` (#1820) | | Navigate to: replaces the screen; from an overlay it closes the overlays; preserve scroll position keeps the offset (as far as the destination scrolls) | pass | `overlays_stack_swap_close_and_go_with_navigation`, `navigating_resets_scroll_unless_it_preserves_it` | | Back: closes the top overlay first, else returns to the previous screen playing its animation backwards; restart empties the history | pass | `back_plays_the_way_in_backwards_and_restart_starts_over`, `back_and_reverting_play_the_animation_the_other_way` | | Scroll to: every frame around the layer scrolls to bring it in, animated with the interaction's animation | pass | `scroll_to_moves_every_scrolling_frame_around_the_layer` | @@ -92,6 +93,7 @@ tool; opt-in), **silent** (the documentation doesn't say; the case pins the curr | Drag-driven animations that follow the pointer, in their direction | done | | | Presenter: device frames and colours, rotation, custom sizes, fit/fill/100%, responsive frames | done | device bodies drawn in code. Presenting opens a tab for the page, named "file - page", which keeps its screen and history while you go back to the design, with a thumbnail of the current frame, previous / next, device presets and scale choices; the frame is laid out again for the device's screen on the prototype's copy (constraints and auto layout; the file is untouched); on phones and tablets overflowing content drags while the device stays put: a top-level frame bigger than the screen always scrolls (as in Figma, with no overflow setting), content past the frame's own edges as its overflow setting allows ("No scrolling" clips it); closing the window asks about unsaved changes above the presentation (#537). Devices not compared with Figma's | | Hotspot hints, inspect panel in the presenter, comments in the presenter | done | | +| Hide UI in the presenter (Options menu, Cmd/Ctrl+\) | done | the bar above the prototype and the navigation bar under it go away and the prototype takes their room; a toast names the key that brings them back; `proto.presentOptions {hideUi}`, kept for later presentations (#1820) | | Preview pane following edits live | done | | | Edit interactions on several layers at once | done | | | Open link: a notice before a link opens, with a checkbox to skip it on this device | done | every openable link — `http`, `https` and `mailto` — and whatever fired it, a click, a delay, a key (a further link that fires while the notice shows is dropped); skipping it opens at once only a link the viewer's own click, press, drag or key fired, one per frame and never while a notice shows — a delay, the pointer passing over a layer or a timed mouse trigger still shows the notice, without the checkbox; a press under way when the notice appears ends there, so its release doesn't reach the prototype behind it; Open link opens it, Cancel or Escape drops it; the desktop app saves the checkbox with its preferences, and the web build keeps it until the page reloads; `proto.linkNotice {show}` turns it on or off (`present_links_tests`) | From f58e022ed7cd48d9a2bb883cbcf3c9e27888a7b2 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 1 Nov 2026 23:56:06 -0500 Subject: [PATCH 18/49] Shortcuts: Cmd/Ctrl+Alt+arrows rotate a degree at a time, 15 with Shift (#1845) * Shortcuts: Cmd/Ctrl+Alt+arrows rotate a degree at a time, 15 with Shift Co-Authored-By: Claude Fable 5.1 * The rotate gesture's label in the English catalog Co-Authored-By: Claude Fable 5.1 * Rotate keys: about the selection's rotation origin, not while editing points, Dev Mode refusal on the control path too Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- crates/engine/src/keymap.rs | 1 + crates/engine/src/shortcut_parity_tests.rs | 4 +- crates/ui-egui/locales/en.toml | 3 ++ crates/ui-egui/src/control.rs | 15 ++++++- crates/ui-egui/src/shortcut_keys_tests.rs | 49 ++++++++++++++++++++++ crates/ui-egui/src/shortcuts.rs | 15 +++++++ docs/ui-parity.md | 7 ++-- 7 files changed, 89 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/keymap.rs b/crates/engine/src/keymap.rs index 65259755a..d21864762 100644 --- a/crates/engine/src/keymap.rs +++ b/crates/engine/src/keymap.rs @@ -346,6 +346,7 @@ pub static KEYS: &[Binding] = &[ pub static GESTURES: &[(Group, &str, &str, &str)] = &[ (Tools, "Pan the canvas", "Space drag", "Space+drag"), (Tools, "Pan with nothing selected (Shift: farther)", "← ↑ → ↓", "← ↑ → ↓"), + (Transform, "Rotate a degree (Shift: 15)", "⌥⌘ ← ↑ → ↓", "Ctrl+Alt+← ↑ → ↓"), (Tools, "Place a shape or frame (its tool chosen)", "↵", "Enter"), (Zoom, "Zoom tool: click to zoom in, drag an area", "Hold Z", "Hold Z"), (Zoom, "Zoom tool: zoom out", "Hold ⌥Z", "Hold Alt+Z"), diff --git a/crates/engine/src/shortcut_parity_tests.rs b/crates/engine/src/shortcut_parity_tests.rs index 6cf7c361d..c650f121e 100644 --- a/crates/engine/src/shortcut_parity_tests.rs +++ b/crates/engine/src/shortcut_parity_tests.rs @@ -255,6 +255,8 @@ static ROWS: &[Row] = &[ doc(Transform, "Use as mask (again: release)", &["Ctrl+Cmd+M"], &["Ctrl+Alt+M"], Bound("object.mask"), ""), doc(Transform, "Resize a frame to fit its contents", &["Alt+Shift+Cmd+R"], &["Ctrl+Alt+Shift+R"], Bound("object.resizeToFit"), ""), doc(Transform, "Nudge (Shift: big nudge)", &["ArrowRight"], &[], Gesture("Nudge (Shift: big nudge)"), ""), + doc(Transform, "Rotate a degree (Shift: 15 degrees)", &["Alt+Cmd+ArrowDown"], &[], Gesture("Rotate a degree (Shift: 15)"), + "Accessibility at Figma; down and right turn clockwise, up and left back (silent on the direction)"), doc(Transform, "Suspend snapping while dragging", &["Ctrl"], &[], Gesture("Suspend snapping while dragging"), "Control on macOS (Cmd keeps working); Ctrl elsewhere"), doc(Transform, "Show the rotation origin to move it", &["Alt+R"], &[], Bound("transform.rotationOrigin"), @@ -407,7 +409,7 @@ fn counts_match_the_docs() { let reserved = documented.iter().filter(|r| !r.reserved.is_empty()).count(); let pinned = ROWS.len() - documented.len(); // docs/ui-parity.md quotes these. - assert_eq!((documented.len(), bound, moved, missing, reserved, pinned), (129, 128, 1, 0, 2, 57)); + assert_eq!((documented.len(), bound, moved, missing, reserved, pinned), (130, 129, 1, 0, 2, 57)); } #[test] diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index 38f2d4970..c44635a2a 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -994,6 +994,9 @@ name = "English" "Nov" = "Nov" "Now" = "Now" "Nudge (Shift: big nudge)" = "Nudge (Shift: big nudge)" +"Rotate a degree (Shift: 15)" = "Rotate a degree (Shift: 15)" +"⌥⌘ ← ↑ → ↓" = "⌥⌘ ← ↑ → ↓" +"Ctrl+Alt+← ↑ → ↓" = "Ctrl+Alt+← ↑ → ↓" "Nudge amount" = "Nudge amount" "Number" = "Number" "Number ↑" = "Number ↑" diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index fd5a2a4e9..58c454bc3 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -996,11 +996,24 @@ fn ui_key(app: &mut FigApp, ctx: &Context, p: &Value) -> Result { "ArrowUp" => (0, -1), _ => (0, 1), }; - let (cmd, params) = if m.cmd || m.ctrl { + let (cmd, params) = if (m.cmd || m.ctrl) && m.alt { + // Rotate a degree, 15 with Shift: down and right clockwise, up and left back, about + // the selection's rotation origin; nothing while points are being edited. + if app.session.ds().is_ok_and(|d| d.vector_edit.is_some()) { + return Ok(json!({})); + } + let step = if m.shift { 15.0 } else { 1.0 }; + let origin = app.session.ds().ok().and_then(|d| d.origin_point()); + ("transform.rotate", json!({"degrees": if dx + dy < 0 { -step } else { step }, "cx": origin.map(|o| o.x), "cy": origin.map(|o| o.y)})) + } else if m.cmd || m.ctrl { ("transform.nudgeSize", json!({"dw": dx, "dh": dy, "big": m.shift})) } else { ("transform.nudge", json!({"dx": dx, "dy": dy, "big": m.shift})) }; + // Dev Mode only inspects, as the window's key path says. + if crate::menus::dev_mode_refuses(app, cmd) { + return Err("Dev Mode only inspects: switch to Design to edit".into()); + } app.session.execute(cmd, ¶ms).map_err(|e| e.to_string()) } _ => { diff --git a/crates/ui-egui/src/shortcut_keys_tests.rs b/crates/ui-egui/src/shortcut_keys_tests.rs index 42413a4fb..6907cac5a 100644 --- a/crates/ui-egui/src/shortcut_keys_tests.rs +++ b/crates/ui-egui/src/shortcut_keys_tests.rs @@ -228,3 +228,52 @@ fn cmd_plus_and_minus_zoom_the_canvas_not_the_interface() { assert!(view(&u).2 < 1.0, "Cmd/Ctrl+- zooms the canvas out: {}", view(&u).2); assert_eq!(u.ctx.zoom_factor(), 1.0); } + +/// "Press ⌘Command ⌥Option ↑/ ↓ on Mac or Control Alt ↑/↓ on Windows to rotate an object one +/// degree at a time" and with Shift "15 degrees at a time" (Accessibility at Figma). The keys +/// turned the selection's size before; Cmd/Ctrl+arrows without Alt still resize. +#[test] +fn cmd_alt_arrows_rotate_a_degree_and_fifteen_with_shift() { + let mut s = Session::new(); + let r = id(s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 40, "height": 40})).unwrap()); + let mut u = Ui::new(s); + u.app.run("select.set", json!({"ids": [r]})); + let rot = |u: &Ui| figcraft_geom::rotation_degrees(u.app.session.doc().unwrap().node(r).unwrap().transform); + let size = |u: &Ui| { + let n = u.app.session.doc().unwrap().node(r).unwrap().clone(); + (n.width, n.height) + }; + press(&mut u, Key::ArrowDown, cmd() | Modifiers::ALT); + assert!((rot(&u) - 1.0).abs() < 1e-6, "one degree: {}", rot(&u)); + press(&mut u, Key::ArrowDown, cmd() | Modifiers::ALT | Modifiers::SHIFT); + assert!((rot(&u) - 16.0).abs() < 1e-6, "fifteen more: {}", rot(&u)); + press(&mut u, Key::ArrowUp, cmd() | Modifiers::ALT); + assert!((rot(&u) - 15.0).abs() < 1e-6, "one back: {}", rot(&u)); + assert_eq!(size(&u), (40.0, 40.0), "no resize"); + press(&mut u, Key::ArrowDown, cmd()); + assert_eq!(size(&u), (40.0, 41.0), "Cmd/Ctrl+arrows alone still resize"); + // Two layers turned together: the turns go about the rotated selection box's centre, so a + // degree down and a degree up leave both where they were. + let c = id(u.app.session.execute("shape.rectangle", &json!({"x": 200, "y": 0, "width": 40, "height": 40})).unwrap()); + let d = id(u.app.session.execute("shape.rectangle", &json!({"x": 300, "y": 60, "width": 30, "height": 20})).unwrap()); + u.app.run("select.set", json!({"ids": [c, d]})); + u.app.run("transform.rotate", json!({"degrees": 30})); + let bounds = |u: &Ui| [c, d].map(|n| u.app.session.doc().unwrap().world_bounds(n).unwrap()); + let before = bounds(&u); + press(&mut u, Key::ArrowDown, cmd() | Modifiers::ALT); + press(&mut u, Key::ArrowUp, cmd() | Modifiers::ALT); + let after = bounds(&u); + for (x, y) in before.iter().zip(&after) { + assert!( + (x.x0 - y.x0).abs() < 1e-6 && (x.y0 - y.y0).abs() < 1e-6 && (x.x1 - y.x1).abs() < 1e-6 && (x.y1 - y.y1).abs() < 1e-6, + "{x:?} then {y:?}" + ); + } + // While points are being edited the chord does nothing to the layer. + u.app.run("select.set", json!({"ids": [r]})); + let rot_before = rot(&u); + u.app.run("vector.edit.begin", json!({"id": r})); + press(&mut u, Key::ArrowDown, cmd() | Modifiers::ALT); + assert!((rot(&u) - rot_before).abs() < 1e-6, "no turn while editing points"); + u.app.run("vector.edit.end", json!({})); +} diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index a6006976d..f44adb68e 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -484,6 +484,21 @@ fn key_event(app: &mut FigApp, key: Key, physical: Option, m: Modifiers, re app.run("view.pan", json!({"dx": dx, "dy": dy, "big": m.shift})); } else if crate::menus::dev_mode_refuses(app, "transform.nudge") { // Dev Mode: said so, nothing moves. + } else if m.command && m.alt { + // Cmd/Ctrl+Alt+arrows rotate a degree at a time, 15 with Shift (Accessibility at + // Figma); down and right turn clockwise, up and left back (the documentation doesn't + // say which way). Not while points are being edited: the layer must not turn under + // the editor, and no key rotates points. About the selection's rotation origin (the + // moved one, else the centre of the rotated selection box), so repeated turns stay put. + if app.session.ds().is_ok_and(|d| d.vector_edit.is_some()) { + return true; + } + let step = if m.shift { 15.0 } else { 1.0 }; + let origin = app.session.ds().ok().and_then(|d| d.origin_point()); + app.run( + "transform.rotate", + json!({"degrees": if dx + dy < 0.0 { -step } else { step }, "cx": origin.map(|o| o.x), "cy": origin.map(|o| o.y)}), + ); } else if m.command { // Cmd/Ctrl+arrows resize: right/down grow, left/up shrink. app.run("transform.nudgeSize", json!({"dw": dx, "dh": dy, "big": m.shift})); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index a77f79348..de15b2bd2 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-01 · **Change:** minor (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-01 · **Change:** minor (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: @@ -128,8 +128,8 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | | Count | Notes | |---|---|---| -| Documented shortcuts (rows) | 129 | each with macOS and Windows/Linux keys | -| Bound as documented | 128 (110 before this suite) | 108 keymap bindings, 14 held keys, gestures and presentation keys, 6 vector edit tool keys | +| Documented shortcuts (rows) | 130 | each with macOS and Windows/Linux keys | +| Bound as documented | 129 (110 before this suite) | 108 keymap bindings, 15 held keys, gestures and presentation keys, 6 vector edit tool keys | | Bound on other keys (documented conflict) | 1 | Run last plugin: the documentation also gives Ctrl+Alt+P to pixel preview on Windows; the plugin takes Ctrl+Alt+Shift+P there | | Missing | 0 | moving the rotation origin (Alt+R, `transform.rotationOrigin`) and placing an object with Enter after choosing its tool (`tool.place`) were the last two | | Documented keys a platform keeps | 2 | Ctrl+Space (Windows/Linux keyboard box selection) switches some CJK input methods; F6 goes to a browser's address bar in the web build | @@ -176,6 +176,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-01 | patch | Shortcuts: Cmd/Ctrl+Alt+↑/↓ (and ←/→) rotate the selection one degree at a time, 15 with Shift ("Press ⌘Command ⌥Option ↑/ ↓ on Mac or Control Alt ↑/↓ on Windows to rotate an object one degree at a time", Accessibility at Figma); they resized by the nudge before, which Cmd/Ctrl+arrows without Alt still do. Down and right turn clockwise, up and left back (the documentation is silent on the direction). In the shortcuts panel's Transform tab, over the control channel's `ui.key` too. Found by a documentation audit of the shortcuts. Test: `shortcut_keys_tests::cmd_alt_arrows_rotate_a_degree_and_fifteen_with_shift`. Documented rows 129 → 130, bound 128 → 129 | | 2026-11-01 | patch | Shortcuts: the Layers panel opens with Ctrl+1 as well as Alt+1 on Windows and Linux ("Mac: Option 1 Windows: Ctrl 1" in Select layers and objects; "Windows: Alt 1" in Explore the navigation bar and left sidebar). macOS keeps Option+1. Found by a documentation audit of the shortcuts (every chord driven over the control channel). Tests: `keymap_tests::the_layers_panel_answers_both_of_its_documented_windows_keys`, the parity row. Counts unchanged | | 2026-10-31 | minor | M1, #1682: as the help center describes the colour picker, choosing Image no longer opens a file dialog at once: the tab shows a checkered placeholder and Upload from computer until there is a file. An image paint shows its asset preview with the same button. A file dropped on the open picker replaces the image and keeps the fill mode, crop, position and adjustments; on the placeholder it becomes the paint's image, filling the layer. While a file is dragged the picker says it takes it instead of the window saying Drop to import. New command `image.replace {ids?, target?, index?, data | path}`, through the same size cap and decoder as `image.place`; one undo step. Dropped files in the browser arrive as `data`. A native window or a browser doesn't say where a dragged file is, so a drop with no known position goes to the open picker, and one known to be over the canvas imports as before. Left: the Fill and Stroke swatches in the Design panel don't take a drop, since their place can't be told during a drag; pasting into the picker isn't documented and isn't added. Tests: `colorpicker_image_tests`, `image_crop_tests::replacing_an_image_keeps_its_fill_mode_crop_and_adjustments`. Numbers unchanged | | 2026-10-30 | minor | Gap 4: the keyboard's Menu key opens the context menu, as Shift+F10 does (at the focused layer row or below the canvas selection, with the keyboard in the menu). egui already reported the key; FigCraft's keymap had no name or binding for it. `view.contextMenu` now takes `Menu` too, and the Context menus row is done (`layers_keyboard_tests`). Stale rows corrected: smart-selection spacing has had reorder rings since the "M1: smart-selection drag reordering" landing (the row is still partial: irregular grids and several marked layers aren't covered), and gap 4 and the parity summary quoted shortcut counts from before the last bindings (now 128 bound, none missing, 57 undocumented pinned, as `shortcut_parity_tests` counts). | From a953a04e33a51e5112f7f35511cea21399f271ad Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 1 Nov 2026 23:59:08 -0500 Subject: [PATCH 19/49] Shortcuts: Cmd/Ctrl+Shift+Alt+= / - / 0 make the interface larger, smaller and default-sized (#1846) * Shortcuts: Cmd/Ctrl+Shift+Alt+= / - / 0 make the interface larger, smaller and default-sized Co-Authored-By: Claude Fable 5.1 * Interface size keys: live while editing text too, and the new size draws on the next frame Co-Authored-By: Claude Fable 5.1 * A preference set during a frame repaints this window too, so the interface size applies on the next frame Co-Authored-By: Claude Fable 5.1 * Control channel: a preference changed by a hidden window's command repaints every window Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- crates/engine/src/cmd/view.rs | 31 ++++++++++++++++ crates/engine/src/keymap.rs | 5 +++ crates/engine/src/keymap_tests.rs | 41 ++++++++++++++++++++++ crates/engine/src/lib.rs | 2 +- crates/engine/src/prefs.rs | 4 +++ crates/engine/src/shortcut_parity_tests.rs | 5 ++- crates/ui-egui/src/app.rs | 8 +++++ crates/ui-egui/src/control.rs | 8 +++++ crates/ui-egui/src/ui_scale.rs | 5 +-- crates/ui-egui/src/windows.rs | 2 ++ docs/ui-parity.md | 7 ++-- 11 files changed, 111 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/cmd/view.rs b/crates/engine/src/cmd/view.rs index c7fea9f92..1fc2ef22a 100644 --- a/crates/engine/src/cmd/view.rs +++ b/crates/engine/src/cmd/view.rs @@ -194,6 +194,22 @@ fn region(s: &mut Session, step: i64) -> Result { ok() } +/// Step the interface size through the Preferences sizes: `dir` 1 up, -1 down, 0 back to the +/// system's size (1). At an end it stays. Kept at once, as a size picked in Preferences is. +fn ui_scale_step(s: &mut Session, dir: i32) -> Result { + let now = s.prefs.ui_scale; + let next = match dir { + 0 => 1.0, + 1 => crate::UI_SCALE_SIZES.iter().copied().find(|v| *v > now + 1e-9).unwrap_or(now), + _ => crate::UI_SCALE_SIZES.iter().rev().copied().find(|v| *v < now - 1e-9).unwrap_or(now), + }; + if (next - now).abs() > 1e-9 { + s.prefs.ui_scale = next; + s.prefs_unsaved = true; + } + Ok(json!({"scale": s.prefs.ui_scale})) +} + fn pref(s: &mut Session, p: &Value, f: fn(&mut crate::Prefs) -> &mut bool) -> Result { let slot = f(&mut s.prefs); *slot = boolean(p, "on").unwrap_or(!*slot); @@ -395,6 +411,21 @@ pub fn specs() -> Vec { Ok(json!({"scale": s.prefs.ui_scale})) } ), + spec!( + "pref.uiScaleUp", + "Larger interface", + "{} the next of the Preferences sizes above the current one (the interface size keys of Accessibility at Figma); at the largest it stays → {scale}", + false, + |s, _| ui_scale_step(s, 1) + ), + spec!( + "pref.uiScaleDown", + "Smaller interface", + "{} the next of the Preferences sizes below the current one; at the smallest it stays → {scale}", + false, + |s, _| ui_scale_step(s, -1) + ), + spec!("pref.uiScaleReset", "Default interface size", "{} back to the system's own size (1) → {scale}", false, |s, _| ui_scale_step(s, 0)), spec!("pref.autoSave", "Save files automatically", "{on?}", false, |s, p| pref(s, p, |x| &mut x.auto_save)), spec!("pref.startOnHome", "Start on the Home screen", "{on?}", false, |s, p| pref(s, p, |x| &mut x.start_on_home)), spec!("pref.nudge", "Nudge amount", "{small?, big?}", false, |s, p| { diff --git a/crates/engine/src/keymap.rs b/crates/engine/src/keymap.rs index d21864762..a0f0bc4b6 100644 --- a/crates/engine/src/keymap.rs +++ b/crates/engine/src/keymap.rs @@ -214,6 +214,11 @@ pub static KEYS: &[Binding] = &[ k(View, "view.snapPixel", &["Shift+Cmd+'"]), // Windows: one help-center article writes Ctrl+1, another Alt+1; both open it there. k(View, "view.layers", &["Alt+1"]).win(&["Alt+1", "Ctrl+1"]).label("Layers panel"), + // The interface size (Accessibility at Figma): Cmd/Ctrl+Shift+Alt with =, - and 0, while + // editing text too. + k(View, "pref.uiScaleUp", &["Alt+Shift+Cmd+="]).both(), + k(View, "pref.uiScaleDown", &["Alt+Shift+Cmd+-"]).both(), + k(View, "pref.uiScaleReset", &["Alt+Shift+Cmd+0"]).both(), k(View, "view.assets", &["Alt+2"]).label("Assets panel"), k(View, "libraries.open", &["Alt+3"]), k(View, "view.design", &["Alt+8"]).label("Design panel"), diff --git a/crates/engine/src/keymap_tests.rs b/crates/engine/src/keymap_tests.rs index c7db0b16e..67c5bf258 100644 --- a/crates/engine/src/keymap_tests.rs +++ b/crates/engine/src/keymap_tests.rs @@ -306,6 +306,47 @@ fn ctrl_tab_cycles_documents() { assert_eq!(lookup(Platform::Mac, Context::Canvas, "Tab", mods(true, false, false, true)).map(|b| b.id), Some("doc.previousTab")); } +/// "Adjust the scale of the Figma UI [...] Windows: Reset to Default: Control ⇧Shift Alt 0; Make +/// Larger: Control ⇧Shift Alt =; Make Smaller: Control ⇧Shift Alt -" (Accessibility at Figma; ⌘ on +/// a Mac). The steps go through the sizes Preferences offers, stop at the ends, and are kept at once. +#[test] +fn the_interface_size_keys_step_through_the_preferences_sizes() { + let m = mods(true, true, true, false); + for p in PLATFORMS { + for c in [Context::Canvas, Context::Text] { + assert_eq!(id_for(p, c, "=", m), Some("pref.uiScaleUp"), "{p:?} {c:?}"); + assert_eq!(id_for(p, c, "-", m), Some("pref.uiScaleDown"), "{p:?} {c:?}"); + assert_eq!(id_for(p, c, "0", m), Some("pref.uiScaleReset"), "{p:?} {c:?}"); + } + } + let mut s = Session::new(); + let scale = |s: &Session| s.prefs.ui_scale; + ex(&mut s, "pref.uiScale", json!({"scale": 1})); + s.prefs_unsaved = false; + ex(&mut s, "pref.uiScaleUp", json!({})); + assert_eq!(scale(&s), 1.1); + assert!(s.prefs_unsaved, "kept at once"); + ex(&mut s, "pref.uiScaleUp", json!({})); + assert_eq!(scale(&s), 1.25); + ex(&mut s, "pref.uiScaleDown", json!({})); + assert_eq!(scale(&s), 1.1); + assert_eq!(ex(&mut s, "pref.uiScaleReset", json!({}))["scale"], json!(1.0)); + assert_eq!(scale(&s), 1.0); + // Between two sizes a step lands on the next one; at an end it stays. + ex(&mut s, "pref.uiScale", json!({"scale": 1.3})); + ex(&mut s, "pref.uiScaleUp", json!({})); + assert_eq!(scale(&s), 1.5); + ex(&mut s, "pref.uiScale", json!({"scale": 1.3})); + ex(&mut s, "pref.uiScaleDown", json!({})); + assert_eq!(scale(&s), 1.25); + ex(&mut s, "pref.uiScale", json!({"scale": 2})); + ex(&mut s, "pref.uiScaleUp", json!({})); + assert_eq!(scale(&s), 2.0); + ex(&mut s, "pref.uiScale", json!({"scale": 0.75})); + ex(&mut s, "pref.uiScaleDown", json!({})); + assert_eq!(scale(&s), 0.75); +} + /// The Layers panel's Windows key is Ctrl+1 in one help-center article ("Mac: Option 1 Windows: /// Ctrl 1", Select layers and objects) and Alt+1 in another (Explore the navigation bar and left /// sidebar): both open it there. macOS keeps Option+1 alone; Cmd+1 is not documented. diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 1c0b7e39a..0da532b25 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -110,7 +110,7 @@ mod view_state; pub use derived::{changed_nodes, normalize}; pub use doc_state::{DocState, History, HistoryEntry, Interaction, PREVIEW_READ_ONLY, Preedit, TextEdit, VersionPreview}; pub use error::{EngineError, Result, bad}; -pub use prefs::{Clipboard, MAX_RECENT_ACTIONS, Prefs, UI_SCALE_MAX, UI_SCALE_MIN, UiRequest, clamp_ui_scale}; +pub use prefs::{Clipboard, MAX_RECENT_ACTIONS, Prefs, UI_SCALE_MAX, UI_SCALE_MIN, UI_SCALE_SIZES, UiRequest, clamp_ui_scale}; pub use session::Forward; pub use view_state::ViewState; diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs index 709482218..5c455aa35 100644 --- a/crates/engine/src/prefs.rs +++ b/crates/engine/src/prefs.rs @@ -7,6 +7,10 @@ pub const UI_SCALE_MIN: f64 = 0.75; pub const UI_SCALE_MAX: f64 = 3.0; /// `scale` kept between [`UI_SCALE_MIN`] and [`UI_SCALE_MAX`]; not a finite number: `None`. +/// The interface sizes Preferences offers, relative to the system's scale (the keys step through +/// them; `pref.uiScale` takes any size up to [`UI_SCALE_MAX`]). +pub const UI_SCALE_SIZES: [f64; 8] = [0.75, 0.9, 1.0, 1.1, 1.25, 1.5, 1.75, 2.0]; + pub fn clamp_ui_scale(scale: f64) -> Option { scale.is_finite().then(|| scale.clamp(UI_SCALE_MIN, UI_SCALE_MAX)) } diff --git a/crates/engine/src/shortcut_parity_tests.rs b/crates/engine/src/shortcut_parity_tests.rs index c650f121e..0b9b573af 100644 --- a/crates/engine/src/shortcut_parity_tests.rs +++ b/crates/engine/src/shortcut_parity_tests.rs @@ -147,6 +147,9 @@ static ROWS: &[Row] = &[ doc(View, "Others' cursors in a live session", &["Alt+Cmd+\\"], &["Ctrl+Alt+\\"], Bound("view.multiplayerCursors"), "new command"), doc(View, "Hide the side panels (minimize the interface)", &["Shift+Cmd+\\"], &[], Bound("view.leftSidebar"), ""), doc(View, "Layers panel", &["Alt+1"], &["Alt+1", "Ctrl+1"], Bound("view.layers"), "one article writes Ctrl+1 for Windows, another Alt+1; both bound there"), + doc(View, "Interface scale: make larger", &["Alt+Shift+Cmd+="], &[], Bound("pref.uiScaleUp"), "Accessibility at Figma, Adjust the scale of the Figma UI"), + doc(View, "Interface scale: make smaller", &["Alt+Shift+Cmd+-"], &[], Bound("pref.uiScaleDown"), "Accessibility at Figma"), + doc(View, "Interface scale: reset to default", &["Alt+Shift+Cmd+0"], &[], Bound("pref.uiScaleReset"), "Accessibility at Figma"), doc(View, "Assets panel", &["Alt+2"], &[], Bound("view.assets"), ""), doc(View, "Libraries", &["Alt+3"], &[], Bound("libraries.open"), ""), doc(View, "Dev Mode on or off", &["Shift+D"], &[], Bound("view.devMode"), ""), @@ -409,7 +412,7 @@ fn counts_match_the_docs() { let reserved = documented.iter().filter(|r| !r.reserved.is_empty()).count(); let pinned = ROWS.len() - documented.len(); // docs/ui-parity.md quotes these. - assert_eq!((documented.len(), bound, moved, missing, reserved, pinned), (130, 129, 1, 0, 2, 57)); + assert_eq!((documented.len(), bound, moved, missing, reserved, pinned), (133, 132, 1, 0, 2, 57)); } #[test] diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index d130daaea..c625f342a 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -117,6 +117,11 @@ impl FigApp { if ctx.viewport_id() == egui::ViewportId::ROOT { ctx.set_zoom_factor(plan.zoom); } + // A size that just changed (a key, Preferences, a command) draws at the new size from + // the next frame: ask for it rather than wait for the next input. + if plan != self.ui.ui_scale { + ctx.request_repaint(); + } self.ui.ui_scale = plan; } let dark = match self.session.prefs.theme.as_str() { @@ -177,6 +182,9 @@ impl FigApp { self.frame(ui); windows::settle(self, &ctx, files); if self.session.prefs != prefs { + // This window too: a preference set during the frame (the interface size, the theme) + // is applied as the next frame begins, so ask for it now rather than wait for input. + ctx.request_repaint(); windows::repaint_others(self, &ctx); } windows::show(self, &ctx); diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index 58c454bc3..322d9032c 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -545,6 +545,7 @@ pub fn background(app: &mut FigApp, ctx: &Context) { } // Outside a frame, so outside the frame's guard: within the window's swap, a panic still // ends in recovery copies and leaves every window its own state. + let prefs = app.session.prefs.clone(); let res = crate::windows::as_window(app, target, |app| { let mut res = Err("internal error".to_string()); // Every control-channel gesture is fenced from the user's system clipboard. @@ -554,6 +555,13 @@ pub fn background(app: &mut FigApp, ctx: &Context) { app.control_synthetic = before; res }); + // A preference the command changed (the interface size, the theme) applies as each + // window's next frame begins; no frame's end-of-frame check ran here, so ask every window. + if app.session.prefs != prefs { + for id in std::iter::once(0).chain(app.windows.list.iter().map(|w| w.id)) { + ctx.request_repaint_of(crate::windows::viewport(id)); + } + } let _ = r.reply.send(ControlReply { id: r.id, result: res.unwrap_or_else(|| Err(format!("no window {target}"))) }); } request_paint(app, ctx); diff --git a/crates/ui-egui/src/ui_scale.rs b/crates/ui-egui/src/ui_scale.rs index 6b275a078..3a407dcf8 100644 --- a/crates/ui-egui/src/ui_scale.rs +++ b/crates/ui-egui/src/ui_scale.rs @@ -47,8 +47,9 @@ pub fn percent(scale: f32) -> u32 { (scale * 100.0).round().clamp(0.0, 100_000.0) as u32 } -/// The sizes Preferences offers, relative to the system's scale (`pref.uiScale` takes up to 3). -pub const SIZES: [f64; 8] = [0.75, 0.9, 1.0, 1.1, 1.25, 1.5, 1.75, 2.0]; +/// The sizes Preferences offers, relative to the system's scale (`pref.uiScale` takes up to 3); +/// the interface size keys step through the same list. +pub const SIZES: [f64; 8] = figcraft_engine::UI_SCALE_SIZES; #[cfg(test)] mod tests { diff --git a/crates/ui-egui/src/windows.rs b/crates/ui-egui/src/windows.rs index b9e7e997d..f9f6067d7 100644 --- a/crates/ui-egui/src/windows.rs +++ b/crates/ui-egui/src/windows.rs @@ -718,6 +718,8 @@ fn draw(app: &mut FigApp, id: u64, ui: &mut egui::Ui) { adopt(app, &e); settle(app, &ctx, files_before); if app.session.prefs != prefs { + // This window too (see the root's frame): the next frame applies the preference. + ctx.request_repaint(); repaint_others(app, &ctx); } let (outer, inner) = ctx.input(|i| (i.viewport().outer_rect, i.viewport().inner_rect)); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index de15b2bd2..3963e4624 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-01 · **Change:** minor (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-01 · **Change:** minor (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: @@ -128,8 +128,8 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | | Count | Notes | |---|---|---| -| Documented shortcuts (rows) | 130 | each with macOS and Windows/Linux keys | -| Bound as documented | 129 (110 before this suite) | 108 keymap bindings, 15 held keys, gestures and presentation keys, 6 vector edit tool keys | +| Documented shortcuts (rows) | 133 | each with macOS and Windows/Linux keys | +| Bound as documented | 132 (110 before this suite) | 111 keymap bindings, 15 held keys, gestures and presentation keys, 6 vector edit tool keys | | Bound on other keys (documented conflict) | 1 | Run last plugin: the documentation also gives Ctrl+Alt+P to pixel preview on Windows; the plugin takes Ctrl+Alt+Shift+P there | | Missing | 0 | moving the rotation origin (Alt+R, `transform.rotationOrigin`) and placing an object with Enter after choosing its tool (`tool.place`) were the last two | | Documented keys a platform keeps | 2 | Ctrl+Space (Windows/Linux keyboard box selection) switches some CJK input methods; F6 goes to a browser's address bar in the web build | @@ -176,6 +176,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-01 | patch | Shortcuts: Cmd/Ctrl+Shift+Alt+= and - make the interface larger and smaller through the sizes Preferences offers, and Cmd/Ctrl+Shift+Alt+0 puts it back to the system's size ("Adjust the scale of the Figma UI [...] Reset to Default: Control ⇧Shift Alt 0; Make Larger: Control ⇧Shift Alt =; Make Smaller: Control ⇧Shift Alt -", Accessibility at Figma); the size is kept at once, as one picked in Preferences is. `pref.uiScaleUp`, `pref.uiScaleDown`, `pref.uiScaleReset`; the sizes list now lives in the engine (`UI_SCALE_SIZES`) and Preferences reads it from there. Found by a documentation audit of the shortcuts. Test: `keymap_tests::the_interface_size_keys_step_through_the_preferences_sizes`. Documented rows 130 → 133, bound 129 → 132 | | 2026-11-01 | patch | Shortcuts: Cmd/Ctrl+Alt+↑/↓ (and ←/→) rotate the selection one degree at a time, 15 with Shift ("Press ⌘Command ⌥Option ↑/ ↓ on Mac or Control Alt ↑/↓ on Windows to rotate an object one degree at a time", Accessibility at Figma); they resized by the nudge before, which Cmd/Ctrl+arrows without Alt still do. Down and right turn clockwise, up and left back (the documentation is silent on the direction). In the shortcuts panel's Transform tab, over the control channel's `ui.key` too. Found by a documentation audit of the shortcuts. Test: `shortcut_keys_tests::cmd_alt_arrows_rotate_a_degree_and_fifteen_with_shift`. Documented rows 129 → 130, bound 128 → 129 | | 2026-11-01 | patch | Shortcuts: the Layers panel opens with Ctrl+1 as well as Alt+1 on Windows and Linux ("Mac: Option 1 Windows: Ctrl 1" in Select layers and objects; "Windows: Alt 1" in Explore the navigation bar and left sidebar). macOS keeps Option+1. Found by a documentation audit of the shortcuts (every chord driven over the control channel). Tests: `keymap_tests::the_layers_panel_answers_both_of_its_documented_windows_keys`, the parity row. Counts unchanged | | 2026-10-31 | minor | M1, #1682: as the help center describes the colour picker, choosing Image no longer opens a file dialog at once: the tab shows a checkered placeholder and Upload from computer until there is a file. An image paint shows its asset preview with the same button. A file dropped on the open picker replaces the image and keeps the fill mode, crop, position and adjustments; on the placeholder it becomes the paint's image, filling the layer. While a file is dragged the picker says it takes it instead of the window saying Drop to import. New command `image.replace {ids?, target?, index?, data | path}`, through the same size cap and decoder as `image.place`; one undo step. Dropped files in the browser arrive as `data`. A native window or a browser doesn't say where a dragged file is, so a drop with no known position goes to the open picker, and one known to be over the canvas imports as before. Left: the Fill and Stroke swatches in the Design panel don't take a drop, since their place can't be told during a drag; pasting into the picker isn't documented and isn't added. Tests: `colorpicker_image_tests`, `image_crop_tests::replacing_an_image_keeps_its_fill_mode_crop_and_adjustments`. Numbers unchanged | From 9c3ec8c1d1c0f7457c990700c4f8c77677420aef Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 2 Nov 2026 00:00:19 -0500 Subject: [PATCH 20/49] M4: typing 1) and a space starts a numbered list, as 1. does (#1842) * M4: typing 1) and a space starts a numbered list, as 1. does Co-Authored-By: Claude Fable 5.1 * Parity: the Text area row names the list creation characters Co-Authored-By: Claude Fable 5.1 * Parity: the list creation characters without spaces inside the code spans Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- crates/engine/src/canvas/textedit.rs | 5 +++-- crates/engine/src/text_tail_tests.rs | 27 +++++++++++++++++++++++++++ docs/target-app-parity.md | 5 +++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/canvas/textedit.rs b/crates/engine/src/canvas/textedit.rs index 91e411e54..d7a70e5c7 100644 --- a/crates/engine/src/canvas/textedit.rs +++ b/crates/engine/src/canvas/textedit.rs @@ -277,14 +277,15 @@ fn insert_model(s: &mut Session, text: &str, ime_commit: bool) -> Result = t.characters.chars().collect(); let start = line_start(&chars, a); let typed: String = chars.get(start..a).unwrap_or(&[]).iter().collect(); let list = match typed.as_str() { "-" | "*" => ListStyle::Bulleted, - "1." => ListStyle::Numbered, + "1." | "1)" => ListStyle::Numbered, _ => ListStyle::None, }; if list != ListStyle::None { diff --git a/crates/engine/src/text_tail_tests.rs b/crates/engine/src/text_tail_tests.rs index 81d05ed23..a94852093 100644 --- a/crates/engine/src/text_tail_tests.rs +++ b/crates/engine/src/text_tail_tests.rs @@ -318,3 +318,30 @@ fn rest_import_lists_and_decorations() { (DecorationStyle::Wavy, DecorationLength::Pixels(2.0), DecorationLength::Auto, true, Some(Color::new(0.0, 0.0, 1.0, 1.0))) ); } + +/// "From within the text layer, there are a couple of ways to start a numbered list: Enter one of +/// the creation characters below followed by a Space: 1. 1)" (Create bulleted and numbered lists); +/// "-" and "*" start a bulleted one the same way. +#[test] +fn typing_a_creation_character_and_a_space_starts_a_list() { + for (start, want) in [("1.", N), ("1)", N), ("-", B), ("*", B)] { + let mut s = Session::new(); + let t = text(&mut s, "x"); + s.execute("node.set", &json!({"id": t, "props": {"characters": ""}})).unwrap(); + begin(&mut s, t, Some(0), false).unwrap(); + for c in start.chars() { + insert(&mut s, &c.to_string()).unwrap(); + } + insert(&mut s, " ").unwrap(); + assert_eq!((data(&s, t).characters.as_str(), lists(&s, t)), ("", vec![(want, 0)]), "{start}"); + } + // "2)" is not a creation character: it stays text. + let mut s = Session::new(); + let t = text(&mut s, "x"); + s.execute("node.set", &json!({"id": t, "props": {"characters": ""}})).unwrap(); + begin(&mut s, t, Some(0), false).unwrap(); + for c in ["2", ")", " "] { + insert(&mut s, c).unwrap(); + } + assert_eq!((data(&s, t).characters.as_str(), lists(&s, t)), ("2) ", vec![(P, 0)])); +} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 06cf024f0..69ea86cca 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # FigCraft parity with Figma -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-01 · **Change:** minor (a link on text is underlined by default, as the help center says, and Underline takes the underline off while the link stays; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; gap 6: widgets draw lines and SVG pictures (plugin API 6); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); Thai, Lao, Khmer and Burmese lines break between words (#1219); MCP and control calls name their document (#998); shadows of images with transparent pixels follow their alpha (#1289); Arabic draft catalog; truncated text fills its last line before the ellipsis and keeps truncating when resized; auto-height text with max lines (#1375, #1376, #1377), numbers unchanged; plugin widgets take text input and a property menu (plugin API 4); boards: templates and tables; boards: a shared timer and voting sessions; boards: the dot grid, connector ends dragged to re-attach, curved connectors; `.sketch` import, best effort: import/export breadth 86% → 87%, file formats 60% → 61%, headline numbers unchanged; Canvas & navigation's remaining work no longer lists outline mode's Include hidden layers and Include object bounds; boards: area 22 (weight 0, outside the weighted sum); CJK line breaking: JIS X 4051's line-start and line-end sets completed with the halfwidth small kana, the halfwidth and spacing (semi-)voiced sound marks, iteration marks 〱–〵 and the halfwidth parentheses; Turkish reviewed, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; vector edit mode regions: hover hatch, selection and drag; plugin log byte/count limits (#191); core editor leftovers: component playground, auto gap handles, variables inside styles, inner shadows and background blur on groups, command-made text readable on dark pages, a one-step frame/group convert, delays on mouse triggers and manual overlay offsets, wrapped-line alignment; starter templates, a Templates tab and Getting started tips on the home screen: essentials ~57% → ~59%; everyday editing partials: number fields, outline options, Hide when publishing, cursors, panel widths, dark pages, numbers unchanged but menu breadth 211/211; text box sizes measured against documents re-saved by other software: whole-pixel line heights, advances on a 1024-per-em grid, letter spacing between glyphs only, numbers unchanged; .fig export checked by opening written files in other software, numbers unchanged; a public figcraft-server: open hosting, owner tokens, per-address limits, idle expiry, moderation, install.sh; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; headline percentages recomputed from the area table: feature breadth ~84%, core ~94%, mainstream ~50%; text lists, hanging punctuation and decoration styles; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; styles and variables behaviour suite and fixes; prototyping behaviour suite and fixes; components behaviour suite and fixes; embedded image colour profiles; layers panel keyboard: F2 rename, Shift+F10 context menu, keyboard box selection, 10k-layer QA; per-side stroke weight variables; text behaviour suite: CJK line breaking, metrics, vertical trim; selection and transform behaviour suite and fixes; `.fig` import, best effort; auto layout behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings; feature breadth ~80%; ready ~49%; last major: full re-measure against Figma desktop 126.10.7; rows for the community batches: Selection colors, smart-selection spacing and a Present tab (#753), `.fig` import fidelity, paste from another design app, a `.fig` copy from Save as; control requests while the window is minimised (#720); catalog counts re-measured; automation roots (#715); number variables in the text content picker (#629); frames and sections convert into each other (#719)) · **Target:** Figma Design (desktop app 126.10.7, macOS) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-01 · **Change:** minor (typing `1)` and a space at the start of a paragraph starts a numbered list, as `1.` does, both being the help center's creation characters; a link on text is underlined by default, as the help center says, and Underline takes the underline off while the link stays; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; gap 6: widgets draw lines and SVG pictures (plugin API 6); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); Thai, Lao, Khmer and Burmese lines break between words (#1219); MCP and control calls name their document (#998); shadows of images with transparent pixels follow their alpha (#1289); Arabic draft catalog; truncated text fills its last line before the ellipsis and keeps truncating when resized; auto-height text with max lines (#1375, #1376, #1377), numbers unchanged; plugin widgets take text input and a property menu (plugin API 4); boards: templates and tables; boards: a shared timer and voting sessions; boards: the dot grid, connector ends dragged to re-attach, curved connectors; `.sketch` import, best effort: import/export breadth 86% → 87%, file formats 60% → 61%, headline numbers unchanged; Canvas & navigation's remaining work no longer lists outline mode's Include hidden layers and Include object bounds; boards: area 22 (weight 0, outside the weighted sum); CJK line breaking: JIS X 4051's line-start and line-end sets completed with the halfwidth small kana, the halfwidth and spacing (semi-)voiced sound marks, iteration marks 〱–〵 and the halfwidth parentheses; Turkish reviewed, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; vector edit mode regions: hover hatch, selection and drag; plugin log byte/count limits (#191); core editor leftovers: component playground, auto gap handles, variables inside styles, inner shadows and background blur on groups, command-made text readable on dark pages, a one-step frame/group convert, delays on mouse triggers and manual overlay offsets, wrapped-line alignment; starter templates, a Templates tab and Getting started tips on the home screen: essentials ~57% → ~59%; everyday editing partials: number fields, outline options, Hide when publishing, cursors, panel widths, dark pages, numbers unchanged but menu breadth 211/211; text box sizes measured against documents re-saved by other software: whole-pixel line heights, advances on a 1024-per-em grid, letter spacing between glyphs only, numbers unchanged; .fig export checked by opening written files in other software, numbers unchanged; a public figcraft-server: open hosting, owner tokens, per-address limits, idle expiry, moderation, install.sh; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; headline percentages recomputed from the area table: feature breadth ~84%, core ~94%, mainstream ~50%; text lists, hanging punctuation and decoration styles; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; styles and variables behaviour suite and fixes; prototyping behaviour suite and fixes; components behaviour suite and fixes; embedded image colour profiles; layers panel keyboard: F2 rename, Shift+F10 context menu, keyboard box selection, 10k-layer QA; per-side stroke weight variables; text behaviour suite: CJK line breaking, metrics, vertical trim; selection and transform behaviour suite and fixes; `.fig` import, best effort; auto layout behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings; feature breadth ~80%; ready ~49%; last major: full re-measure against Figma desktop 126.10.7; rows for the community batches: Selection colors, smart-selection spacing and a Present tab (#753), `.fig` import fidelity, paste from another design app, a `.fig` copy from Save as; control requests while the window is minimised (#720); catalog counts re-measured; automation roots (#715); number variables in the text content picker (#629); frames and sections convert into each other (#719)) · **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 @@ -105,7 +105,7 @@ Breadth: does it exist. Ready: depth, correctness and fidelity for real projects | 7 | Effects | 4 | 100% | 75% | Glass and progressive blur tuned side by side (behaviour suite from the documentation, inner shadows and background blur on groups, shadows hidden behind translucent layers on the canvas and in every export landed) | 2–5 | | 8 | Frames, groups, sections, masks | 5 | 97% | 80% | Visual QA with real files (a one-step frame/group convert, and a behaviour suite from the documentation landed: masked-out areas don't take clicks, mask group bounds and exports follow the mask, sections kept out of frames and groups, frames and sections drawn around layers take them, section resizing leaves contents in place, X/Y measured in the frame) | 1–3 | | 9 | Auto layout & constraints | 9 | 98% | 74% | Behaviour against real Figma files (behaviour suite from the documentation, `fr` tracks like CSS, vertical wrap, auto gaps evenly/around, cell alignment and wrapped-line alignment landed) ([auto-layout-parity](auto-layout-parity.md)) | 3–6 | -| 10 | Text | 8 | 90% | 70% | Spell check, text metrics on real files and in other fonts (text box sizes measured against documents re-saved by other software: all 230 self-sizing boxes in 7 documents come out to the pixel, one font family; behaviour suite with CJK line breaking, Thai, Lao, Khmer and Burmese breaks between words, vertical trim and carets by grapheme cluster landed; lists per paragraph with nesting and list spacing, hanging punctuation and lists, decoration style, thickness, offset, skip ink and colour landed) | 3–7 | +| 10 | Text | 8 | 90% | 70% | Spell check, text metrics on real files and in other fonts (text box sizes measured against documents re-saved by other software: all 230 self-sizing boxes in 7 documents come out to the pixel, one font family; behaviour suite with CJK line breaking, Thai, Lao, Khmer and Burmese breaks between words, vertical trim and carets by grapheme cluster landed; lists per paragraph with nesting and list spacing (typing `-`, `*`, `1.` or `1)` and a space starts one), hanging punctuation and lists, decoration style, thickness, offset, skip ink and colour landed) | 3–7 | | 11 | Components & variants | 9 | 96% | 72% | Real (not synthetic) libraries, `.fig` libraries (a component playground for variant, boolean, text and instance-swap properties, a behaviour suite from the documentation, overrides of padding, gap, grids, exports and interactions, refused geometry overrides, variant-switch and Assets-swap override rules, top-left default variant landed) ([components-parity](components-parity.md)) | 4–9 | | 12 | Styles & variables | 5 | 95% | 76% | Real-library QA (variables inside styles, behaviour suite from the documentation, style folders and order, mode order, code syntax, extended collections with their tail (new library variables as updates, chains through libraries) and variables import/export landed) ([components-parity](components-parity.md)) | 2–4 | | 13 | Prototyping | 6 | 92% | 74% | Video triggers and media actions, controllers on macOS, Linux and FreeBSD, real prototype QA (behaviour suite from the documentation, delays on mouse triggers, manual overlay offsets, key combinations, controller buttons on key/gamepad triggers (Windows and the browser), widgets reacting in prototypes, interactive components playing their variants, drag-driven animations, physical springs landed) ([prototyping-parity](prototyping-parity.md)) | 2–5 | @@ -648,6 +648,7 @@ Carried over from the ROADMAP's "Shipped so far" (2026-10-10). The test count th | Date | Change | Summary | |---|---|---| +| 2026-11-01 | patch | M4: typing `1)` followed by a space at the start of a plain paragraph starts a numbered list, as `1.` already did ("Enter one of the creation characters below followed by a Space: 1. 1)", Create bulleted and numbered lists). Found by a documentation audit of the text rules. Test: `text_tail_tests::typing_a_creation_character_and_a_space_starts_a_list`. Numbers unchanged | | 2026-11-01 | patch | M4: a link made with `text.link` (Cmd/Ctrl+K, Shift+Cmd/Ctrl+U) underlines the linked text unless it has a decoration of its own ("Links are styled with an underline by default. Use the keyboard shortcut to remove the underline", Add links to text); Underline (Cmd/Ctrl+U) takes the underline off and the link stays. Found by a documentation audit of the text rules. Test: `text_behaviour_tests::a_link_is_underlined_by_default_and_underline_takes_it_off`. Numbers unchanged | | 2026-10-31 | patch | M4: Dash and Custom strokes have a Dash cap (None, Round, Square) in the advanced stroke settings and `node.set {dashCap}`, on both ends of every dash on the canvas and in PNG, PDF and SVG. Unset, dashes keep taking the end point caps, so older files look the same; the saved file writes it only when set. Numbers unchanged | | 2026-10-31 | minor | M11, gap 6: widgets draw lines and SVG pictures, as a Figma widget's `Line` and `SVG` do (plugin API 6; older plugins unchanged). A line is 100 long, black and 1 thick unless told otherwise, and turns around its top-left corner. An SVG comes in as locked layers, scaled to fit a size, within the widget's 256 layers. The Counter example uses both. Numbers unchanged. Tests: `widget_shapes_tests`, `widget_tests`. | From 8174dd5b7438bf900ab2af194f381c249f6ca5f9 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 2 Nov 2026 00:01:29 -0500 Subject: [PATCH 21/49] M4: bulleted lists keep the same bullet at every level of indentation (#1843) * M4: bulleted lists keep the same bullet at every level of indentation Co-Authored-By: Claude Fable 5.1 * list_markers: the comment says bullets are the same at every level Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- crates/text/src/layout.rs | 9 ++++++--- crates/text/src/tail_tests.rs | 4 ++-- docs/target-app-parity.md | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/text/src/layout.rs b/crates/text/src/layout.rs index 3ae4997ab..7f5872fdf 100644 --- a/crates/text/src/layout.rs +++ b/crates/text/src/layout.rs @@ -1165,9 +1165,12 @@ pub fn layout(text: &TextData, box_width: Option, box_height: Option) /// The markers of a text's paragraphs ("" for plain ones). Numbers count the items of one list at /// one level, restarting after a plain paragraph, a shallower item or the other kind of list, -/// from the first item's start number; levels go 1. a. i. and • ◦ ▪, then round again. +/// from the first item's start number; levels go 1. a. i., then round again; bullets are • at +/// every level. pub(crate) fn list_markers(lists: &[ParaList]) -> Vec { - const BULLETS: [&str; 3] = ["\u{2022}", "\u{25E6}", "\u{25AA}"]; + // "Figma bullets will keep the same styling at all levels of indentation." (Create bulleted + // and numbered lists) + const BULLET: &str = "\u{2022}"; let mut count = [(ListStyle::None, 0usize); figcraft_doc::MAX_LIST_INDENT as usize + 1]; lists .iter() @@ -1187,7 +1190,7 @@ pub(crate) fn list_markers(lists: &[ParaList]) -> Vec { (ListStyle::Numbered, 1) => format!("{}.", alpha(c.1)), (ListStyle::Numbered, 2) => format!("{}.", roman(c.1)), (ListStyle::Numbered, _) => format!("{}.", c.1), - _ => BULLETS.get(d % 3).copied().unwrap_or("\u{2022}").to_string(), + _ => BULLET.to_string(), } }) .collect() diff --git a/crates/text/src/tail_tests.rs b/crates/text/src/tail_tests.rs index 712ff6aa8..805f744d8 100644 --- a/crates/text/src/tail_tests.rs +++ b/crates/text/src/tail_tests.rs @@ -90,8 +90,8 @@ fn list_numbering_by_level() { ), ( vec![pl(B, 0), pl(B, 1), pl(B, 2), pl(B, 3)], - vec!["\u{2022}", "\u{25E6}", "\u{25AA}", "\u{2022}"], - "silent: bullets change shape per level, round again", + vec!["\u{2022}", "\u{2022}", "\u{2022}", "\u{2022}"], + "bullets keep the same styling at all levels of indentation", ), (vec![pl(N, 0), pl(N, 0), pl(P, 0), pl(N, 0)], vec!["1.", "2.", "", "1."], "silent: a plain paragraph ends a list, the next starts at 1"), (vec![pl(N, 0), pl(B, 0), pl(N, 0)], vec!["1.", "\u{2022}", "1."], "silent: the other kind of list at the same level starts the count again"), diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 69ea86cca..75a426231 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # FigCraft parity with Figma -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-01 · **Change:** minor (typing `1)` and a space at the start of a paragraph starts a numbered list, as `1.` does, both being the help center's creation characters; a link on text is underlined by default, as the help center says, and Underline takes the underline off while the link stays; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; gap 6: widgets draw lines and SVG pictures (plugin API 6); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); Thai, Lao, Khmer and Burmese lines break between words (#1219); MCP and control calls name their document (#998); shadows of images with transparent pixels follow their alpha (#1289); Arabic draft catalog; truncated text fills its last line before the ellipsis and keeps truncating when resized; auto-height text with max lines (#1375, #1376, #1377), numbers unchanged; plugin widgets take text input and a property menu (plugin API 4); boards: templates and tables; boards: a shared timer and voting sessions; boards: the dot grid, connector ends dragged to re-attach, curved connectors; `.sketch` import, best effort: import/export breadth 86% → 87%, file formats 60% → 61%, headline numbers unchanged; Canvas & navigation's remaining work no longer lists outline mode's Include hidden layers and Include object bounds; boards: area 22 (weight 0, outside the weighted sum); CJK line breaking: JIS X 4051's line-start and line-end sets completed with the halfwidth small kana, the halfwidth and spacing (semi-)voiced sound marks, iteration marks 〱–〵 and the halfwidth parentheses; Turkish reviewed, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; vector edit mode regions: hover hatch, selection and drag; plugin log byte/count limits (#191); core editor leftovers: component playground, auto gap handles, variables inside styles, inner shadows and background blur on groups, command-made text readable on dark pages, a one-step frame/group convert, delays on mouse triggers and manual overlay offsets, wrapped-line alignment; starter templates, a Templates tab and Getting started tips on the home screen: essentials ~57% → ~59%; everyday editing partials: number fields, outline options, Hide when publishing, cursors, panel widths, dark pages, numbers unchanged but menu breadth 211/211; text box sizes measured against documents re-saved by other software: whole-pixel line heights, advances on a 1024-per-em grid, letter spacing between glyphs only, numbers unchanged; .fig export checked by opening written files in other software, numbers unchanged; a public figcraft-server: open hosting, owner tokens, per-address limits, idle expiry, moderation, install.sh; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; headline percentages recomputed from the area table: feature breadth ~84%, core ~94%, mainstream ~50%; text lists, hanging punctuation and decoration styles; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; styles and variables behaviour suite and fixes; prototyping behaviour suite and fixes; components behaviour suite and fixes; embedded image colour profiles; layers panel keyboard: F2 rename, Shift+F10 context menu, keyboard box selection, 10k-layer QA; per-side stroke weight variables; text behaviour suite: CJK line breaking, metrics, vertical trim; selection and transform behaviour suite and fixes; `.fig` import, best effort; auto layout behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings; feature breadth ~80%; ready ~49%; last major: full re-measure against Figma desktop 126.10.7; rows for the community batches: Selection colors, smart-selection spacing and a Present tab (#753), `.fig` import fidelity, paste from another design app, a `.fig` copy from Save as; control requests while the window is minimised (#720); catalog counts re-measured; automation roots (#715); number variables in the text content picker (#629); frames and sections convert into each other (#719)) · **Target:** Figma Design (desktop app 126.10.7, macOS) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-01 · **Change:** minor (bulleted lists use the same bullet at every level of indentation, as the help center says, instead of a white bullet and a square at the deeper levels; typing `1)` and a space at the start of a paragraph starts a numbered list, as `1.` does, both being the help center's creation characters; a link on text is underlined by default, as the help center says, and Underline takes the underline off while the link stays; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; gap 6: widgets draw lines and SVG pictures (plugin API 6); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); Thai, Lao, Khmer and Burmese lines break between words (#1219); MCP and control calls name their document (#998); shadows of images with transparent pixels follow their alpha (#1289); Arabic draft catalog; truncated text fills its last line before the ellipsis and keeps truncating when resized; auto-height text with max lines (#1375, #1376, #1377), numbers unchanged; plugin widgets take text input and a property menu (plugin API 4); boards: templates and tables; boards: a shared timer and voting sessions; boards: the dot grid, connector ends dragged to re-attach, curved connectors; `.sketch` import, best effort: import/export breadth 86% → 87%, file formats 60% → 61%, headline numbers unchanged; Canvas & navigation's remaining work no longer lists outline mode's Include hidden layers and Include object bounds; boards: area 22 (weight 0, outside the weighted sum); CJK line breaking: JIS X 4051's line-start and line-end sets completed with the halfwidth small kana, the halfwidth and spacing (semi-)voiced sound marks, iteration marks 〱–〵 and the halfwidth parentheses; Turkish reviewed, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; vector edit mode regions: hover hatch, selection and drag; plugin log byte/count limits (#191); core editor leftovers: component playground, auto gap handles, variables inside styles, inner shadows and background blur on groups, command-made text readable on dark pages, a one-step frame/group convert, delays on mouse triggers and manual overlay offsets, wrapped-line alignment; starter templates, a Templates tab and Getting started tips on the home screen: essentials ~57% → ~59%; everyday editing partials: number fields, outline options, Hide when publishing, cursors, panel widths, dark pages, numbers unchanged but menu breadth 211/211; text box sizes measured against documents re-saved by other software: whole-pixel line heights, advances on a 1024-per-em grid, letter spacing between glyphs only, numbers unchanged; .fig export checked by opening written files in other software, numbers unchanged; a public figcraft-server: open hosting, owner tokens, per-address limits, idle expiry, moderation, install.sh; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; headline percentages recomputed from the area table: feature breadth ~84%, core ~94%, mainstream ~50%; text lists, hanging punctuation and decoration styles; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; styles and variables behaviour suite and fixes; prototyping behaviour suite and fixes; components behaviour suite and fixes; embedded image colour profiles; layers panel keyboard: F2 rename, Shift+F10 context menu, keyboard box selection, 10k-layer QA; per-side stroke weight variables; text behaviour suite: CJK line breaking, metrics, vertical trim; selection and transform behaviour suite and fixes; `.fig` import, best effort; auto layout behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings; feature breadth ~80%; ready ~49%; last major: full re-measure against Figma desktop 126.10.7; rows for the community batches: Selection colors, smart-selection spacing and a Present tab (#753), `.fig` import fidelity, paste from another design app, a `.fig` copy from Save as; control requests while the window is minimised (#720); catalog counts re-measured; automation roots (#715); number variables in the text content picker (#629); frames and sections convert into each other (#719)) · **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 @@ -648,6 +648,7 @@ Carried over from the ROADMAP's "Shipped so far" (2026-10-10). The test count th | Date | Change | Summary | |---|---|---| +| 2026-11-01 | patch | M4: bulleted lists draw the same bullet at every level of indentation ("Figma bullets will keep the same styling at all levels of indentation", Create bulleted and numbered lists); the deeper levels drew a white bullet and a small square, pinned as silent before. Numbered levels (1., a., i.) are unchanged. Found by a documentation audit of the text rules. Test: `tail_tests::list_numbering_by_level` (the bullets row). Numbers unchanged | | 2026-11-01 | patch | M4: typing `1)` followed by a space at the start of a plain paragraph starts a numbered list, as `1.` already did ("Enter one of the creation characters below followed by a Space: 1. 1)", Create bulleted and numbered lists). Found by a documentation audit of the text rules. Test: `text_tail_tests::typing_a_creation_character_and_a_space_starts_a_list`. Numbers unchanged | | 2026-11-01 | patch | M4: a link made with `text.link` (Cmd/Ctrl+K, Shift+Cmd/Ctrl+U) underlines the linked text unless it has a decoration of its own ("Links are styled with an underline by default. Use the keyboard shortcut to remove the underline", Add links to text); Underline (Cmd/Ctrl+U) takes the underline off and the link stays. Found by a documentation audit of the text rules. Test: `text_behaviour_tests::a_link_is_underlined_by_default_and_underline_takes_it_off`. Numbers unchanged | | 2026-10-31 | patch | M4: Dash and Custom strokes have a Dash cap (None, Round, Square) in the advanced stroke settings and `node.set {dashCap}`, on both ends of every dash on the canvas and in PNG, PDF and SVG. Unset, dashes keep taking the end point caps, so older files look the same; the saved file writes it only when set. Numbers unchanged | From f9b56936219857cfbbe82d0c6b6c19eb7a7850f9 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 2 Nov 2026 00:02:56 -0500 Subject: [PATCH 22/49] M2: a text keeps a max height or a number of max lines, not both (#1832) Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- crates/engine/src/cmd/props.rs | 19 +++++++++++++- crates/engine/src/cmd/text.rs | 22 +++++++++++++++-- crates/engine/src/text_behaviour_tests.rs | 30 +++++++++++++++++++++++ docs/auto-layout-parity.md | 4 ++- 4 files changed, 71 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/props.rs b/crates/engine/src/cmd/props.rs index fe7fdcd74..fbf80fc1b 100644 --- a/crates/engine/src/cmd/props.rs +++ b/crates/engine/src/cmd/props.rs @@ -759,6 +759,14 @@ fn apply_sizing(cmd: &str, doc: &mut Document, id: NodeId, k: &str, v: &Value) - other => Some(f64_of(other).ok_or_else(|| bad(cmd, format!("`{k}` must be a number or null")))?.clamp(0.0, 1e7)), }; set_limit(&mut doc.get_mut(id)?.child_layout, k, val); + // A text has a max height or a number of max lines, not both: a max height sets the + // lines back to Auto (Guide to auto layout). + if k == "maxHeight" + && val.is_some() + && let Some(t) = doc.get_mut(id)?.kind.text_mut() + { + t.max_lines = 0; + } } "columnTracks" | "gridColumnTracks" | "rowTracks" | "gridRowTracks" => { let a = v.as_array().ok_or_else(|| bad(cmd, format!("`{k}` must be an array of tracks")))?; @@ -900,7 +908,16 @@ fn apply_text(cmd: &str, doc: &mut Document, id: NodeId, props: &Map text_mut(cmd, doc.get_mut(id)?)?.leading_trim = enum_of(v).ok_or_else(|| bad(cmd, "leadingTrim: none|capHeight"))?, - "maxLines" => text_mut(cmd, doc.get_mut(id)?)?.max_lines = f64_of(v).unwrap_or(0.0).clamp(0.0, 10_000.0) as u32, + "maxLines" => { + let lines = f64_of(v).unwrap_or(0.0).clamp(0.0, 10_000.0) as u32; + let n = doc.get_mut(id)?; + text_mut(cmd, n)?.max_lines = lines; + // A text has a max height or a number of max lines, not both: a number of lines takes + // the max height away (Guide to auto layout). + if lines > 0 { + n.child_layout.max_h = None; + } + } "features" | "textFeatures" | "fontFeatures" | "openTypeFeatures" => { let f = features_of(cmd, v)?; let t = text_mut(cmd, doc.get_mut(id)?)?; diff --git a/crates/engine/src/cmd/text.rs b/crates/engine/src/cmd/text.rs index 4fbb0fe1d..b507afd6b 100644 --- a/crates/engine/src/cmd/text.rs +++ b/crates/engine/src/cmd/text.rs @@ -323,12 +323,30 @@ pub fn specs() -> Vec { true, |s, p| { let v = finite(req_num("text.maxLines", p, "lines")?).clamp(0.0, 10_000.0) as u32; - para(s, p, |t| { + let r = para(s, p, |t| { t.max_lines = v; if v > 0 && t.auto_resize != TextAutoResize::Height { t.auto_resize = TextAutoResize::Truncate; } - }) + })?; + // A text has a max height or a number of max lines, not both (Guide to auto layout). + if v > 0 { + let ids = match textedit::selected_range(s) { + Some((id, _, _)) => vec![id], + None => targets(s, p), + }; + let doc = s.doc_mut()?; + for i in ids { + for d in doc.subtree(i) { + if let Some(n) = doc.node_mut(d) + && n.kind.text().is_some() + { + n.child_layout.max_h = None; + } + } + } + } + Ok(r) } ), spec!( diff --git a/crates/engine/src/text_behaviour_tests.rs b/crates/engine/src/text_behaviour_tests.rs index ad476c364..9ae7dd62c 100644 --- a/crates/engine/src/text_behaviour_tests.rs +++ b/crates/engine/src/text_behaviour_tests.rs @@ -551,6 +551,36 @@ fn css_font_family_escapes_backslash_and_newline() { assert!(css.contains(r#"font-family: "Foo\"\3C /style>";"#), "{css}"); } +/// "Text layers cannot have both a max height and a set number of max lines. Adding a max height +/// will set max lines to Auto. Setting max lines to a number will remove the layer's max height +/// setting." (Guide to auto layout) +#[test] +fn a_text_has_a_max_height_or_max_lines_not_both() { + let mut s = Session::new(); + let f = id(s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 300, "height": 100})).unwrap()); + s.execute("node.set", &json!({"id": f, "props": {"layout": "vertical"}})).unwrap(); + let t = id(s.execute("text.create", &json!({"text": "Hello there world", "x": 0, "y": 0, "parent": f, "width": 60})).unwrap()); + let state = |s: &Session| { + let n = s.doc().unwrap().node(t).unwrap().clone(); + (n.kind.text().unwrap().max_lines, n.child_layout.max_h) + }; + s.execute("node.set", &json!({"id": t, "props": {"maxLines": 2}})).unwrap(); + assert_eq!(state(&s), (2, None)); + s.execute("node.set", &json!({"id": t, "props": {"maxHeight": 40}})).unwrap(); + assert_eq!(state(&s), (0, Some(40.0)), "a max height sets max lines to Auto"); + s.execute("node.set", &json!({"id": t, "props": {"maxLines": 3}})).unwrap(); + assert_eq!(state(&s), (3, None), "max lines take the max height away"); + s.execute("node.set", &json!({"id": t, "props": {"maxHeight": 50}})).unwrap(); + s.execute("text.maxLines", &json!({"ids": [t], "lines": 1})).unwrap(); + assert_eq!(state(&s), (1, None), "the Max lines command too"); + // Auto (0) leaves a max height alone, and a frame's max height has no lines to clear. + s.execute("node.set", &json!({"id": t, "props": {"maxHeight": 50}})).unwrap(); + s.execute("node.set", &json!({"id": t, "props": {"maxLines": 0}})).unwrap(); + assert_eq!(state(&s), (0, Some(50.0))); + s.execute("node.set", &json!({"id": f, "props": {"maxHeight": 80}})).unwrap(); + assert_eq!(s.doc().unwrap().node(f).unwrap().child_layout.max_h, Some(80.0)); +} + /// "Links are styled with an underline by default. Use the keyboard shortcut to remove the /// underline: Mac: Command U, Windows: Control U" (Add links to text). #[test] diff --git a/docs/auto-layout-parity.md b/docs/auto-layout-parity.md index feb476a1a..f481fc7ab 100644 --- a/docs/auto-layout-parity.md +++ b/docs/auto-layout-parity.md @@ -1,6 +1,6 @@ # Auto layout and constraints parity -> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-11-01 · **Change:** minor (Remove all auto layout, as the help center's More layout options has it: `layout.removeAll` takes the auto layout off a frame and every frame nested in it in one undo step; grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); Layout sidebar: Add auto layout (+) is available for groups and converts a single group to a frame in place, with mask order, flow-only inference and Fill sizing preserved; adding auto layout to an empty frame keeps its size (#369); `node.set` applies auto layout keys only to frames, with warnings (#603); core editor leftovers: auto gap handles, wrapped-line alignment; behaviour suite written from the public documentation, every rule's status; fixes and the missing settings it found) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-11-01 · **Change:** minor (a text keeps a max height or a number of max lines, not both, as the Guide to auto layout says: a max height sets max lines to Auto and max lines remove the max height; Remove all auto layout, as the help center's More layout options has it: `layout.removeAll` takes the auto layout off a frame and every frame nested in it in one undo step; grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); Layout sidebar: Add auto layout (+) is available for groups and converts a single group to a frame in place, with mask order, flow-only inference and Fill sizing preserved; adding auto layout to an empty frame keeps its size (#369); `node.set` applies auto layout keys only to frames, with warnings (#603); core editor leftovers: auto gap handles, wrapped-line alignment; behaviour suite written from the public documentation, every rule's status; fixes and the missing settings it found) · **Target:** Figma Design (desktop app 126.10.7) Auto layout is the most used layout feature in Figma and the one where small differences (a hugging frame one pixel off, text wrapping at another width) break real files. **Breadth ~98%, @@ -42,6 +42,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Hug only on auto layout frames (and text); Fill only in an auto layout flow, never on a top-level frame | pass | `al_behaviour_tests::hug_and_fill_only_where_they_apply` | | Min/max width and height bound Hug, Fill and Fixed sizes, on frames and children | pass | `sizing_rules`; a fill child at its max leaves the rest to the other fill children (silent on redistribution: CSS flexbox) | | A hugging text wider than its max width wraps at the max | pass | `sizing_rules` | +| A text has a max height or a number of max lines, not both: a max height sets max lines to Auto, a number of max lines removes the max height | **fixed** | both coexisted; `node.set {maxHeight}` and `{maxLines}` and `text.maxLines` keep one of the two (a frame's max height is untouched); `text_behaviour_tests::a_text_has_a_max_height_or_max_lines_not_both` | | Remove all auto layout: a frame and all of its nested objects lose their auto layout at once (More layout options) | **added** | `layout.removeAll {ids?}`, one undo step, in the canvas context menu beside Add auto layout; instances and the layers inside them keep theirs; `al_nesting_tests::remove_all_auto_layout_strips_the_frame_and_every_frame_nested_in_it` | | Text filling a width wraps and its hugging frame grows with it | pass | `sizing_rules` | | A hugging frame follows a child that grows, through nested levels, in one edit and one undo step | pass | `al_behaviour_tests::a_hugging_frame_follows_its_children_through_nested_levels` | @@ -96,6 +97,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Date | Change | Summary | |---|---|---| +| 2026-11-01 | patch | M2: a text layer keeps a max height or a number of max lines, not both ("Text layers cannot have both a max height and a set number of max lines", Guide to auto layout): `node.set {maxHeight}` on a text sets its max lines to Auto, and `node.set {maxLines}` or `text.maxLines` with a number removes its max height. Found by a documentation audit of this page. Test: `text_behaviour_tests::a_text_has_a_max_height_or_max_lines_not_both`. Numbers unchanged | | 2026-11-01 | minor | M2: Remove all auto layout ("To remove auto layout from a frame and all of its nested objects at once, right-click on the frame and go to More layout options > Remove all auto layout", Toggle on auto layout in designs): `layout.removeAll {ids?}` strips the frames and every frame nested in them in one undo step, leaving instances and their layers alone; in the canvas context menu beside Add auto layout and in the Actions palette. Found by a documentation audit of this page. Test: `al_nesting_tests::remove_all_auto_layout_strips_the_frame_and_every_frame_nested_in_it`. Numbers unchanged | | 2026-10-30 | minor | M8, #1083: grid placement finds free cells on a bitmap, a word at a time, with the same placements; crafted grids of wide children no longer stall a layout pass. Numbers unchanged. | | 2026-10-29 | minor | M2 review fixes: conversion preserves mask runs and Fill sizing per axis; layout inference uses visible, non-absolute flow children; the sidebar hides Add for mixed selections containing existing auto layout. Regression coverage includes rendered mask pixels, visible-child positions, parent layout stability and the sidebar accessibility tree. Numbers unchanged | From 779a5c982e2888d6487cfb3db5a984ad232cf5b6 Mon Sep 17 00:00:00 2001 From: Patrik Lermon Date: Mon, 2 Nov 2026 11:29:02 +0100 Subject: [PATCH 23/49] i18n(sv): translate 21 new strings (#1870) Brings the Swedish catalog up to date with upstream main (f9b56936). Co-authored-by: Claude Opus 5.5 --- crates/ui-egui/locales/sv.toml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/crates/ui-egui/locales/sv.toml b/crates/ui-egui/locales/sv.toml index 748518fff..1c9cf0ee2 100644 --- a/crates/ui-egui/locales/sv.toml +++ b/crates/ui-egui/locales/sv.toml @@ -13,7 +13,10 @@ name = "Svenska" "({n} warnings: some entries were skipped)" = { one = "({n} varning: vissa poster hoppades över)", other = "({n} varningar: vissa poster hoppades över)" } "+ Create variable" = "+ Skapa variabel" ".fig (experimental)" = ".fig (experimentell)" +"1 year" = "1 år" "1…9, 0" = "1…9, 0" +"30 days" = "30 dagar" +"90 days" = "90 dagar" "@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{bin_added} / −{bin_deleted} binary assets, {first} – {last}" = "@{login}: {prs} PR:er, {commits} commits, +{added} / −{deleted} rader (Δ {delta}), +{bin_added} / −{bin_deleted} binära resurser, {first} – {last}" "A collection of this file with these modes and variables: override their values per mode and add variables of its own" = "En samling i den här filen med dessa lägen och variabler: ange overrides för deras värden per läge och lägg till egna variabler" "A .figcraft file with this name already exists. Choose its full name to confirm replacement." = "Det finns redan en .figcraft-fil med det här namnet. Välj dess fullständiga namn för att bekräfta att den ersätts." @@ -477,6 +480,7 @@ name = "Svenska" "Drop to import" = "Släpp för att importera" "Drop to open" = "Släpp för att öppna" "Drop shadow" = "Slagskugga" +"Drop to use this image" = "Släpp för att använda bilden" "Dual-licensed MIT OR Apache-2.0. Made by the ArtCraft team and community." = "Dubbellicensierad under MIT OR Apache-2.0. Skapad av ArtCraft-teamet och gemenskapen." "Duo" = "Duo" "Duplicate" = "Duplicera" @@ -652,6 +656,7 @@ name = "Svenska" "Help page" = "Hjälpsida" "Here: {names}" = "Här: {names}" "Hidden" = "Dold" +"Hide UI" = "Dölj gränssnitt" "Hide contents" = "Dölj innehåll" "Hide from publishing" = "Dölj vid publicering" "Hide section contents" = "Dölj avsnittets innehåll" @@ -832,6 +837,9 @@ name = "Svenska" "Make slot" = "Gör till plats" "New collection" = "Ny samling" "Nobody shares a file there now." = "Ingen delar någon fil där just nu." +"Past 30 days" = "Senaste 30 dagarna" +"Past 90 days" = "Senaste 90 dagarna" +"Past year" = "Senaste året" "Pasted design layers" = "Inklistrade designlager" "Pasted design layers; the clipboard didn't carry the images of: {layers}" = "Designlager inklistrade; urklippet innehöll inte bilderna för: {layers}" "Remove these results from the file" = "Ta bort de här resultaten från filen" @@ -977,6 +985,7 @@ name = "Svenska" "Not read yet" = "Inte läst än" "Not shared" = "Inte delad" "Note {n}" = "Anteckning {n}" +"Nothing counted yet" = "Inget har räknats ännu" "Nothing changed since this version." = "Ingenting har ändrats sedan den här versionen." "Nothing changed since this was marked ready for dev." = "Inget har ändrats sedan detta markerades som klart för utveckling." "Nothing here yet. Set a frame's status to list it." = "Inget här än. Ange en frames status för att lista den." @@ -985,6 +994,9 @@ name = "Svenska" "Nov" = "nov" "Now" = "Nu" "Nudge (Shift: big nudge)" = "Flytta stegvis (Shift: stort steg)" +"Rotate a degree (Shift: 15)" = "Rotera en grad (Shift: 15)" +"⌥⌘ ← ↑ → ↓" = "⌥⌘ ← ↑ → ↓" +"Ctrl+Alt+← ↑ → ↓" = "Ctrl+Alt+← ↑ → ↓" "Nudge amount" = "Steglängd" "Number" = "Nummer" "Number ↑" = "Nummer ↑" @@ -1179,6 +1191,7 @@ name = "Svenska" "Remove" = "Ta bort" "Remove all" = "Ta bort alla" "Remove annotation" = "Ta bort anteckning" +"Remove all auto layout" = "Ta bort all auto layout" "Remove auto layout" = "Ta bort auto layout" "Remove column" = "Ta bort kolumn" "Remove dev resource" = "Ta bort utvecklarresurs" @@ -1309,8 +1322,11 @@ name = "Svenska" "Search files and templates" = "Sök efter filer och mallar" "Search results" = "Sökresultat" "Search fonts" = "Sök typsnitt" +"This server doesn't count insertions" = "Den här servern räknar inte infogningar" +"This server doesn't count styles and variables" = "Den här servern räknar inte stilar och variabler" "Someone who left" = "Någon som har lämnat" "Take the results off the board; they stay in the file" = "Ta bort resultaten från tavlan; de finns kvar i filen" +"Upload from computer" = "Ladda upp från datorn" "Use fonts installed on this computer…" = "Använd typsnitt som är installerade på den här datorn…" "Search layers" = "Sök lager" "Search pages" = "Sök sidor" @@ -1373,6 +1389,7 @@ name = "Svenska" "Show device frame" = "Visa enhetsram" "Show dimensions on objects" = "Visa dimensioner på objekt" "Show hotspot hints" = "Visa tips om aktiva punkter" +"The bars are hidden. {shortcut} shows them again" = "Fälten är dolda. {shortcut} visar dem igen" "Show in Explorer" = "Visa i Utforskaren" "Show in Finder" = "Visa i Finder" "Show in folder" = "Visa i mapp" @@ -1864,6 +1881,7 @@ name = "Svenska" "video triggers are not supported and were skipped" = "videoutlösare stöds inte och hoppades över" "yesterday" = "i går" "{count} in it now · Changed {date}" = "{count} i den nu · Ändrad {date}" +"{insertions} · {detachments}" = "{insertions} · {detachments}" "{instances} in {files}" = "{instances} i {files}" "{language}: draft translation, waiting for a native speaker's review." = "{language}: utkast till översättning, väntar på granskning av en modersmålstalare." "{length} bleed" = "{length} utfall" @@ -1902,6 +1920,7 @@ name = "Svenska" "{n} detached" = { one = "{n} bortkopplad", other = "{n} bortkopplade" } "{n} files" = { one = "{n} fil", other = "{n} filer" } "{n} hours ago" = { one = "för {n} timme sedan", other = "för {n} timmar sedan" } +"{n} inserted" = { one = "{n} infogad", other = "{n} infogade" } "{n} instances" = { one = "{n} instans", other = "{n} instanser" } "{n} layers" = { one = "{n} lager", other = "{n} lager" } "{n} layers as one file" = { one = "{n} lager som en fil", other = "{n} lager som en fil" } @@ -1932,6 +1951,7 @@ name = "Svenska" "{n}w" = "{n} v" "{page}, nothing selected" = "{page}, inget markerat" "{percent}%" = "{percent} %" +"{period}: {counts}" = "{period}: {counts}" "{profile} (current)" = "{profile} (aktuell)" "{property} is its value; {property ? \"a\" : \"b\"} picks a string. Other {…} stays as written." = "{property} är dess värde; {property ? \"a\" : \"b\"} väljer en sträng. Andra {…} lämnas som de är skrivna." "{server} can't say what became of your files (it is older than this app)." = "{server} kan inte säga vad som hände med dina filer (den är äldre än den här appen)." @@ -1939,6 +1959,7 @@ name = "Svenska" "{server} · {shared} · Opened {date}" = "{server} · {shared} · Öppnad {date}" "{tool} hold {key}" = "{tool} håll ned {key}" "{used} · {detached}" = "{used} · {detached}" +"{used} · {inserted}" = "{used} · {inserted}" "{value} isn't a colour" = "{value} är inte en färg" "{when} · edited" = "{when} · ändrad" "← ↑ → ↓" = "← ↑ → ↓" From ebe60a4924a09bcc1ee3e5b5ec3a12d400cee9c6 Mon Sep 17 00:00:00 2001 From: Jonas <124611557+MrChocolate12@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:29:12 +0100 Subject: [PATCH 24/49] Complete German translation (192 missing entries) (#1863) I completed all missing translations and checked them in de.toml. Co-authored-by: Brandon Thomas --- crates/ui-egui/locales/de.toml | 192 +++++++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) diff --git a/crates/ui-egui/locales/de.toml b/crates/ui-egui/locales/de.toml index e6d13bbea..b088b2d32 100644 --- a/crates/ui-egui/locales/de.toml +++ b/crates/ui-egui/locales/de.toml @@ -1781,6 +1781,198 @@ status = "draft — needs native review" "⌘ click" = "⌘ Klick" "⌘ scroll" = "⌘ Scrollen" "⌥ drag" = "⌥ Ziehen" +"1 year" = "1 Jahr" +"30 days" = "30 Tage" +"90 days" = "90 Tage" +"A responsive product page: hero, features, figures, a quote and a footer" = "Eine responsive Produktseite: Hero-Bereich, Funktionen, Kennzahlen, ein Zitat und eine Fußzeile" +"A title, an agenda, a big figure, a chart and a closing slide" = "Ein Titel, eine Agenda, eine große Kennzahl, ein Diagramm und eine Abschlussfolie" +"A to Z" = "A bis Z" +"All the fonts this file uses are installed" = "Alle Schriften dieser Datei sind installiert" +"Allow and download" = "Erlauben und herunterladen" +"Allow downloading fonts?" = "Herunterladen von Schriften erlauben?" +"Alphabetical" = "Alphabetisch" +"An analytics screen on a grid: figures, charts drawn from vectors and a table" = "Ein Analytics-Bildschirm auf einem Raster: Kennzahlen, aus Vektoren gezeichnete Diagramme und eine Tabelle" +"Android Vector Drawable" = "Android Vector Drawable" +"Apps" = "Apps" +"Apr" = "Apr." +"Aug" = "Aug." +"Best effort" = "Bestmöglich" +"Board grid" = "Boardraster" +"Bottom padding" = "Innenabstand unten" +"Bound to {name}. Click to detach the variable." = "An {name} gebunden. Klicken Sie, um die Variable zu lösen." +"Check for Updates" = "Nach Updates suchen" +"Check for updates…" = "Nach Updates suchen…" +"Checking the fonts installed on this computer…" = "Auf diesem Computer installierte Schriften werden geprüft…" +"Colour and text styles, Light and Dark variables, buttons, inputs and cards" = "Farb- und Textstile, Variablen für Hell und Dunkel, Buttons, Eingabefelder und Karten" +"Compatibility" = "Kompatibilität" +"Convert to frame" = "In Rahmen umwandeln" +"Convert to section" = "In Abschnitt umwandeln" +"Dart constants for Flutter…" = "Dart-Konstanten für Flutter…" +"Calculated from other variables; it follows them" = "Aus anderen Variablen berechnet; folgt ihnen" +"Copied comments for AI" = "Kommentare für KI kopiert" +"Copy effect" = "Effekt kopieren" +"Copy fill" = "Füllung kopieren" +"Copy for AI" = "Für KI kopieren" +"Copy stroke" = "Kontur kopieren" +"Couldn't download {name}" = "{name} konnte nicht heruntergeladen werden" +"Created" = "Erstellt" +"Crop image" = "Bild zuschneiden" +"Dashboard" = "Dashboard" +"Date created" = "Erstellungsdatum" +"Dec" = "Dez." +"Design system starter" = "Designsystem-Starter" +"Detach calculation" = "Berechnung lösen" +"Don't show this again" = "Nicht mehr anzeigen" +"Download" = "Herunterladen" +"Downloading… {percent}%" = "Wird heruntergeladen… {percent} %" +"Draw a frame" = "Rahmen zeichnen" +"Drop to use this image" = "Loslassen, um dieses Bild zu verwenden" +"Edited {when}" = "Bearbeitet {when}" +"Exact only" = "Nur exakt" +"Export frames and layers as PNG, JPG, SVG or PDF" = "Rahmen und Ebenen als PNG, JPG, SVG oder PDF exportieren" +"Exported {name}; {n} kinds of content were changed or left out" = { one = "{name} exportiert; {n} Inhaltsart wurde geändert oder ausgelassen", other = "{name} exportiert; {n} Inhaltsarten wurden geändert oder ausgelassen" } +"Exported {n} files; some content was changed or left out" = { one = "{n} Datei exportiert; einige Inhalte wurden geändert oder ausgelassen", other = "{n} Dateien exportiert; einige Inhalte wurden geändert oder ausgelassen" } +"Feb" = "Feb." +"FigCraft stopped because of an internal error." = "FigCraft wurde wegen eines internen Fehlers beendet." +"File not found" = "Datei nicht gefunden" +"Format" = "Format" +"Four screens of a trail app with components and a prototype flow" = "Vier Bildschirme einer Wander-App mit Komponenten und einem Prototyp-Ablauf" +"Free fonts come from Google Fonts and Noto, through jsDelivr and GitHub. Each file is checked against the font index before it is installed into the font folder the Craft apps share. Nothing is downloaded until you allow it." = "Kostenlose Schriften stammen von Google Fonts und Noto und werden über jsDelivr und GitHub geladen. Jede Datei wird anhand des Schriftenindex geprüft, bevor sie in den Schriftenordner installiert wird, den die Craft-Apps gemeinsam nutzen. Nichts wird heruntergeladen, bevor Sie es erlauben." +"Getting started" = "Erste Schritte" +"Graph paper" = "Rasterpapier" +"Greyscale components and two example screens to sketch a flow with" = "Komponenten in Graustufen und zwei Beispielbildschirme, um einen Ablauf zu skizzieren" +"Hide UI" = "Oberfläche ausblenden" +"Hide these tips (Getting started in the Help menu shows them again)" = "Diese Tipps ausblenden („Erste Schritte“ im Hilfemenü zeigt sie wieder an)" +"Hide when publishing" = "Beim Veröffentlichen ausblenden" +"Icon components on a 24 px grid with keylines and a size preview" = "Icon-Komponenten auf einem 24-px-Raster mit Keylines und einer Größenvorschau" +"Icon set starter" = "Icon-Set-Starter" +"Ignore unsupported" = "Nicht unterstützte ignorieren" +"Individual padding" = "Einzelne Innenabstände" +"Interface size" = "Größe der Oberfläche" +"Jan" = "Jan." +"Joining live session…" = "Live-Sitzung wird beigetreten…" +"Jul" = "Jul." +"Jun" = "Jun." +"Kits" = "Kits" +"Landing page" = "Landingpage" +"Last modified" = "Zuletzt geändert" +"Leaving the prototype" = "Prototyp wird verlassen" +"Left padding" = "Innenabstand links" +"Link frames on the Prototype tab, then present the flow" = "Verknüpfen Sie Rahmen im Tab „Prototyp“ und präsentieren Sie dann den Ablauf" +"Make a component" = "Komponente erstellen" +"Past 30 days" = "Letzte 30 Tage" +"Past 90 days" = "Letzte 90 Tage" +"Past year" = "Letztes Jahr" +"Mar" = "Mär." +"May" = "Mai" +"Missing fonts" = "Fehlende Schriften" +"Mobile app" = "Mobile App" +"Newest first" = "Neueste zuerst" +"No comments to copy" = "Keine Kommentare zum Kopieren" +"No files or templates match your search" = "Keine Dateien oder Vorlagen passen zu Ihrer Suche" +"No other pages" = "Keine weiteren Seiten" +"No templates match your search" = "Keine Vorlagen passen zu Ihrer Suche" +"Not now" = "Nicht jetzt" +"Nothing counted yet" = "Noch nichts gezählt" +"Nov" = "Nov." +"Rotate a degree (Shift: 15)" = "Um ein Grad drehen (Umschalt: 15)" +"⌥⌘ ← ↑ → ↓" = "⌥⌘ ← ↑ → ↓" +"Ctrl+Alt+← ↑ → ↓" = "Strg+Alt+← ↑ → ↓" +"Oct" = "Okt." +"Oldest first" = "Älteste zuerst" +"One announcement in five common sizes: square, portrait, story, link and banner" = "Eine Ankündigung in fünf gängigen Größen: Quadrat, Hochformat, Story, Link und Banner" +"Order" = "Reihenfolge" +"Other" = "Sonstige" +"Paste effect" = "Effekt einfügen" +"Paste fill" = "Füllung einfügen" +"Paste stroke" = "Kontur einfügen" +"Pick the Frame tool, then drag on the canvas or choose a device size" = "Wählen Sie das Rahmen-Werkzeug und ziehen Sie auf der Arbeitsfläche oder wählen Sie eine Gerätegröße" +"Plugin" = "Plugin" +"Plugins & widgets" = "Plugins & Widgets" +"Presentation slides" = "Präsentationsfolien" +"Playground" = "Testumgebung" +"Relative to your system's display scaling (100% is the system's own size). Document zoom is separate." = "Relativ zur Anzeigeskalierung Ihres Systems (100 % ist die Größe des Systems). Der Dokumentzoom ist davon unabhängig." +"Reload the page to get back the unsaved files the browser had room for." = "Laden Sie die Seite neu, um die ungespeicherten Dateien zurückzuerhalten, für die der Browser Platz hatte." +"Reload the page to get your unsaved files back." = "Laden Sie die Seite neu, um Ihre ungespeicherten Dateien zurückzuerhalten." +"Reload the page to start again." = "Laden Sie die Seite neu, um von vorn zu beginnen." +"Remove all auto layout" = "Gesamtes Auto-Layout entfernen" +"Remove from recents" = "Aus „Zuletzt verwendet“ entfernen" +"Reorder selection" = "Auswahl neu anordnen" +"Reset grid" = "Raster zurücksetzen" +"Right padding" = "Innenabstand rechts" +"Search templates" = "Vorlagen suchen" +"See all templates" = "Alle Vorlagen ansehen" +"Select layers and they space themselves as their content changes" = "Wählen Sie Ebenen aus, und ihre Abstände passen sich an, wenn sich der Inhalt ändert" +"Search files and templates" = "Dateien und Vorlagen suchen" +"Search results" = "Suchergebnisse" +"This server doesn't count insertions" = "Dieser Server zählt keine Einfügungen" +"This server doesn't count styles and variables" = "Dieser Server zählt keine Stile und Variablen" +"Upload from computer" = "Vom Computer hochladen" +"Search pages" = "Seiten suchen" +"Sep" = "Sep." +"Server key" = "Serverschlüssel" +"Set corner smoothing to 60%" = "Eckenglättung auf 60 % setzen" +"Share with a code" = "Mit einem Code teilen" +"Show all templates" = "Alle Vorlagen anzeigen" +"The bars are hidden. {shortcut} shows them again" = "Die Leisten sind ausgeblendet. {shortcut} blendet sie wieder ein" +"Show in Explorer" = "Im Explorer anzeigen" +"Show in Finder" = "Im Finder anzeigen" +"Show in folder" = "Im Ordner anzeigen" +"Social and slides" = "Social Media und Folien" +"Social post sizes" = "Größen für Social-Media-Beiträge" +"Sort by" = "Sortieren nach" +"Sort by {column}" = "Nach {column} sortieren" +"Start from a template" = "Mit einer Vorlage beginnen" +"Start sharing with the Share button, then pass on the code it gives" = "Starten Sie das Teilen mit der Schaltfläche „Teilen“ und geben Sie dann den angezeigten Code weiter" +"Strong line every" = "Starke Linie alle" +"Text on a path" = "Text auf Pfad" +"The window is too small for {size}%, so the interface is drawn at {drawn}%. Make the window larger to use {size}%." = "Das Fenster ist zu klein für {size} %, daher wird die Oberfläche mit {drawn} % dargestellt. Vergrößern Sie das Fenster, um {size} % zu verwenden." +"This file is too large to join here (up to {mb} MB)" = "Diese Datei ist zu groß, um hier beizutreten (bis zu {mb} MB)" +"This file uses fonts that aren't installed on this computer. Their text is drawn in a fallback font until you install them." = "Diese Datei verwendet Schriften, die auf diesem Computer nicht installiert sind. Ihr Text wird in einer Ersatzschrift dargestellt, bis Sie sie installieren." +"This link opens a website outside the prototype:" = "Dieser Link öffnet eine Website außerhalb des Prototyps:" +"This link opens your mail app to write a message:" = "Dieser Link öffnet Ihre Mail-App, um eine Nachricht zu schreiben:" +"This server doesn't count detached instances" = "Dieser Server zählt keine gelösten Instanzen" +"Top padding" = "Innenabstand oben" +"Try another search, or browse templates." = "Versuchen Sie eine andere Suche oder stöbern Sie in den Vorlagen." +"Try another word, or look at every kind." = "Versuchen Sie ein anderes Wort oder sehen Sie sich alle Arten an." +"Turn a layer into a component, reuse it, and change every copy at once" = "Wandeln Sie eine Ebene in eine Komponente um, verwenden Sie sie wieder und ändern Sie alle Kopien auf einmal" +"Update check is not supported in the web browser." = "Die Update-Suche wird im Webbrowser nicht unterstützt." +"Use your browser's zoom to change the interface size." = "Ändern Sie die Größe der Oberfläche mit dem Zoom Ihres Browsers." +"Uses variables: each layer shows them in its own mode" = "Verwendet Variablen: Jede Ebene zeigt sie in ihrem eigenen Modus" +"Websites" = "Websites" +"What you try here changes this preview and the code below, not the file" = "Was Sie hier ausprobieren, ändert diese Vorschau und den Code darunter, nicht die Datei" +"Widget" = "Widget" +"Wireframe kit" = "Wireframe-Kit" +"Your unsaved files were too large for the browser to keep." = "Ihre ungespeicherten Dateien waren zu groß, als dass der Browser sie behalten konnte." +"Z to A" = "Z bis A" +"connector labels without a saved snapshot are centred on the line, without their background" = "Verbinder-Beschriftungen ohne gespeicherten Schnappschuss werden mittig auf der Linie und ohne Hintergrund dargestellt" +"elbowed and curved connectors without a saved path follow FigCraft's own routing" = "Abgewinkelte und gebogene Verbinder ohne gespeicherten Pfad folgen dem eigenen Routing von FigCraft" +"instance swap properties whose default component was past the layer limit were skipped" = "Instanztausch-Eigenschaften, deren Standardkomponente über dem Ebenenlimit lag, wurden übersprungen" +"instances whose component was past the layer limit were imported as frames" = "Instanzen, deren Komponente über dem Ebenenlimit lag, wurden als Rahmen importiert" +"invalid vector region fill paint list; layer fill used" = "Ungültige Füllungsliste der Vektorregion; Füllung der Ebene verwendet" +"invalid vector region paints were skipped" = "Ungültige Füllungen der Vektorregion wurden übersprungen" +"just now" = "gerade eben" +"linked vector region fill styles keep resolved appearance; live style links were left out" = "Verknüpfte Füllstile von Vektorregionen behalten ihr aufgelöstes Aussehen; Live-Stilverknüpfungen wurden ausgelassen" +"note or shape generated child has invalid bounds; child skipped" = "Vom Notiz- oder Formgenerator erzeugtes Kindobjekt hat ungültige Grenzen; Kindobjekt übersprungen" +"note or shape generated child is missing its style or bounds; child skipped" = "Dem vom Notiz- oder Formgenerator erzeugten Kindobjekt fehlen Stil oder Grenzen; Kindobjekt übersprungen" +"note or shape generated children exceed the layer or nesting limit; remaining children skipped" = "Vom Notiz- oder Formgenerator erzeugte Kindobjekte überschreiten das Ebenen- oder Verschachtelungslimit; übrige Kindobjekte übersprungen" +"note or shape generated layout is missing or unsupported; using its outer frame" = "Das vom Notiz- oder Formgenerator erzeugte Layout fehlt oder wird nicht unterstützt; äußerer Rahmen verwendet" +"only in a text style or variable" = "nur in einem Textstil oder einer Variable" +"shape generated outline is missing or damaged; using its rectangle" = "Die vom Formgenerator erzeugte Kontur fehlt oder ist beschädigt; Rechteck verwendet" +"slot layers without a matching slot property were imported as frames" = "Slot-Ebenen ohne passende Slot-Eigenschaft wurden als Rahmen importiert" +"variable-bound vector region paints keep resolved appearance; live bindings were left out" = "An Variablen gebundene Füllungen von Vektorregionen behalten ihr aufgelöstes Aussehen; Live-Bindungen wurden ausgelassen" +"vector region paint data exceeded import limits and was skipped" = "Füllungsdaten der Vektorregion überschritten die Importgrenzen und wurden übersprungen" +"vector region references a missing fill style; layer fill used" = "Vektorregion verweist auf einen fehlenden Füllstil; Füllung der Ebene verwendet" +"yesterday" = "gestern" +"{insertions} · {detachments}" = "{insertions} · {detachments}" +"{month} {day}, {year}" = "{day}. {month} {year}" +"{n} detached" = { one = "{n} gelöst", other = "{n} gelöst" } +"{n} inserted" = { one = "{n} eingefügt", other = "{n} eingefügt" } +"{n} text layers" = { one = "{n} Textebene", other = "{n} Textebenen" } +"{percent}%" = "{percent} %" +"{period}: {counts}" = "{period}: {counts}" +"{used} · {detached}" = "{used} · {detached}" +"{used} · {inserted}" = "{used} · {inserted}" [commands] "align.bottom" = "Unten ausrichten" From 5d387bb3b482f749c279af960eec1e9069f63927 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 2 Nov 2026 05:29:23 -0500 Subject: [PATCH 25/49] M2: fill container children share the free space by their content area, border-box fashion (#1824) (#1861) * M2: fill container children share the free space by their content area, border-box fashion (#1824) Co-Authored-By: Claude Fable 5.1 * Layout: rustfmt's line for the frozen-share closure Co-Authored-By: Claude Fable 5.1 * M2: one doc comment on distribute (review) Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- crates/layout/src/lib.rs | 43 +++++++++++++++++++++++-------- crates/layout/src/nested_tests.rs | 42 ++++++++++++++++++++++++++++++ docs/auto-layout-parity.md | 4 ++- 3 files changed, 77 insertions(+), 12 deletions(-) diff --git a/crates/layout/src/lib.rs b/crates/layout/src/lib.rs index f13339c6f..56f4bf625 100644 --- a/crates/layout/src/lib.rs +++ b/crates/layout/src/lib.rs @@ -327,6 +327,10 @@ struct Item { max_main: Option, min_cross: Option, max_cross: Option, + /// The item's own insets along the main axis (an auto layout frame's padding and included + /// inside stroke): fill children share the free space by their content area, border-box + /// fashion, so these come on top of each one's share. + inset_main: f64, /// Baseline alignment: distance from the item's top to its first baseline. baseline: Option, /// Baseline alignment: offset from the line's top (computed per line). @@ -414,6 +418,10 @@ fn flow_items(doc: &Document, kids: &[NodeId], horizontal: bool, hug_main: bool, let (sm, sc) = if horizontal { (cl.sizing_h, cl.sizing_v) } else { (cl.sizing_v, cl.sizing_h) }; let (min_main, max_main, min_cross, max_cross) = if horizontal { (cl.min_w, cl.max_w, cl.min_h, cl.max_h) } else { (cl.min_h, cl.max_h, cl.min_w, cl.max_w) }; + let inset_main = node.layout.as_ref().map_or(0.0, |al| { + let (pt, pr, pb, pl) = insets(node, al); + if horizontal { pl + pr } else { pt + pb } + }); items.push(Item { id: *child, main: if horizontal { w } else { h }, @@ -425,6 +433,7 @@ fn flow_items(doc: &Document, kids: &[NodeId], horizontal: bool, hug_main: bool, max_main, min_cross, max_cross, + inset_main, baseline: None, base_off: 0.0, }); @@ -596,19 +605,31 @@ pub fn layout_frame(doc: &mut Document, frame: NodeId, m: &dyn Measure) { } } -/// Share `free` main-axis space among the fill items `open` like CSS flexbox: each takes an equal -/// share within its min/max; when clamping adds more than it removes, the items held at their min -/// keep it (otherwise those held at their max do) and the rest share what is left again. +/// Share `free` among the fill items `open` by their content areas: each one's own insets (an +/// auto layout frame's padding and included inside stroke) come off the top and go back on its +/// share, so a child with more padding or a thicker inside stroke takes a little more and the +/// content areas come out the same, as in the CSS border-box model ("Figma distributes space +/// amongst fill container children by the children's content area instead of by their size"). +/// Min and max sizes still clamp each item's outer size; the clamped ones are frozen and the rest +/// share what is left, as before. fn distribute(items: &mut [Item], mut open: Vec, free: f64) { let mut free = free.max(0.0); while !open.is_empty() { - let share = free / open.len() as f64; - let sized: Vec<(usize, f64)> = - open.iter().filter_map(|i| items.get(*i).map(|it| (*i, clamp_size(share, it.min_main, it.max_main)))).collect(); - let violation: f64 = sized.iter().map(|(_, v)| v - share).sum(); - let frozen = |v: f64| violation.abs() < 1e-9 || (violation > 0.0 && v > share + 1e-9) || (violation < 0.0 && v < share - 1e-9); - for (i, v) in &sized { - if frozen(*v) + let insets: f64 = open.iter().filter_map(|i| items.get(*i)).map(|it| it.inset_main).sum(); + let content_share = ((free - insets) / open.len() as f64).max(0.0); + let sized: Vec<(usize, f64, f64)> = open + .iter() + .filter_map(|i| { + items.get(*i).map(|it| { + let want = content_share + it.inset_main; + (*i, want, clamp_size(want, it.min_main, it.max_main)) + }) + }) + .collect(); + let violation: f64 = sized.iter().map(|(_, want, v)| v - want).sum(); + let frozen = |want: f64, v: f64| violation.abs() < 1e-9 || (violation > 0.0 && v > want + 1e-9) || (violation < 0.0 && v < want - 1e-9); + for (i, want, v) in &sized { + if frozen(*want, *v) && let Some(it) = items.get_mut(*i) { it.main = *v; @@ -616,7 +637,7 @@ fn distribute(items: &mut [Item], mut open: Vec, free: f64) { } } free = free.max(0.0); - open = sized.into_iter().filter(|(_, v)| !frozen(*v)).map(|(i, _)| i).collect(); + open = sized.into_iter().filter(|(_, want, v)| !frozen(*want, *v)).map(|(i, _, _)| i).collect(); } } diff --git a/crates/layout/src/nested_tests.rs b/crates/layout/src/nested_tests.rs index 4b77b3b94..2a51e282e 100644 --- a/crates/layout/src/nested_tests.rs +++ b/crates/layout/src/nested_tests.rs @@ -287,6 +287,48 @@ fn padding_and_included_strokes() { assert_eq!(pos(&d, c), (15.0, 15.0, 70.0, 20.0)); } +/// "Figma distributes space amongst fill container children by the children's content area +/// instead of by their size, matching the CSS border-box model. A layer with a thicker stroke will +/// take up slightly more of the available width or height, so that its inner content area matches +/// its sibling's." (Use auto layout with CSS Flexbox in mind) +#[test] +fn fill_children_share_by_content_area() { + let mut d = Document::new("t"); + let p = page(&d); + let f = al(&mut d, p, LayoutMode::Horizontal, (200.0, 50.0), (Sizing::Fixed, Sizing::Fixed)); + layout_mut(&mut d, f).gap = 0.0; + let a = al(&mut d, f, LayoutMode::Horizontal, (10.0, 50.0), (Sizing::Fill, Sizing::Fixed)); + let b = al(&mut d, f, LayoutMode::Horizontal, (10.0, 50.0), (Sizing::Fill, Sizing::Fixed)); + layout_mut(&mut d, b).padding = [0.0, 20.0, 0.0, 20.0]; + layout_frame(&mut d, f, &NoMeasure); + // 200 less b's 40 of padding leaves 160 of content, 80 each: a is 80 wide, b 120. + assert_eq!((size(&d, a).0, size(&d, b).0), (80.0, 120.0)); + assert_eq!(pos(&d, b).0, 80.0); + // A 10 px inside stroke counted in b's layout instead: 90 and 110. + layout_mut(&mut d, b).padding = [0.0; 4]; + { + let n = d.get_mut(b).unwrap(); + n.strokes = vec![figcraft_doc::color::Paint::solid(figcraft_doc::color::Color::BLACK)]; + n.stroke.weight = 10.0; + n.stroke.align = StrokeAlign::Inside; + } + layout_mut(&mut d, b).strokes_included = true; + layout_frame(&mut d, f, &NoMeasure); + assert_eq!((size(&d, a).0, size(&d, b).0), (90.0, 110.0)); + // A stroke not counted in the layout is no inset: an even split, as before. + layout_mut(&mut d, b).strokes_included = false; + layout_frame(&mut d, f, &NoMeasure); + assert_eq!((size(&d, a).0, size(&d, b).0), (100.0, 100.0)); + // Equal insets: still even. A max on a freezes it there and b takes the rest, insets kept. + layout_mut(&mut d, a).padding = [0.0, 20.0, 0.0, 20.0]; + layout_mut(&mut d, b).padding = [0.0, 20.0, 0.0, 20.0]; + layout_frame(&mut d, f, &NoMeasure); + assert_eq!((size(&d, a).0, size(&d, b).0), (100.0, 100.0)); + d.get_mut(a).unwrap().child_layout.max_w = Some(60.0); + layout_frame(&mut d, f, &NoMeasure); + assert_eq!((size(&d, a).0, size(&d, b).0), (60.0, 140.0)); +} + #[test] fn grid_hug_tracks_and_wrapping_text_rows() { use figcraft_doc::GridTrack; diff --git a/docs/auto-layout-parity.md b/docs/auto-layout-parity.md index f481fc7ab..61462a2c1 100644 --- a/docs/auto-layout-parity.md +++ b/docs/auto-layout-parity.md @@ -1,6 +1,6 @@ # Auto layout and constraints parity -> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-11-01 · **Change:** minor (a text keeps a max height or a number of max lines, not both, as the Guide to auto layout says: a max height sets max lines to Auto and max lines remove the max height; Remove all auto layout, as the help center's More layout options has it: `layout.removeAll` takes the auto layout off a frame and every frame nested in it in one undo step; grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); Layout sidebar: Add auto layout (+) is available for groups and converts a single group to a frame in place, with mask order, flow-only inference and Fill sizing preserved; adding auto layout to an empty frame keeps its size (#369); `node.set` applies auto layout keys only to frames, with warnings (#603); core editor leftovers: auto gap handles, wrapped-line alignment; behaviour suite written from the public documentation, every rule's status; fixes and the missing settings it found) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-11-02 · **Change:** patch (fill children share the free space by their content area, border-box fashion, as the Flexbox article says (#1824); a text keeps a max height or a number of max lines, not both, as the Guide to auto layout says: a max height sets max lines to Auto and max lines remove the max height; Remove all auto layout, as the help center's More layout options has it: `layout.removeAll` takes the auto layout off a frame and every frame nested in it in one undo step; grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); Layout sidebar: Add auto layout (+) is available for groups and converts a single group to a frame in place, with mask order, flow-only inference and Fill sizing preserved; adding auto layout to an empty frame keeps its size (#369); `node.set` applies auto layout keys only to frames, with warnings (#603); core editor leftovers: auto gap handles, wrapped-line alignment; behaviour suite written from the public documentation, every rule's status; fixes and the missing settings it found) · **Target:** Figma Design (desktop app 126.10.7) Auto layout is the most used layout feature in Figma and the one where small differences (a hugging frame one pixel off, text wrapping at another width) break real files. **Breadth ~98%, @@ -38,6 +38,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Hug: the frame sizes to its children plus padding (the 40 px text + 10 px padding = 60 px example) | pass | `sizing_rules` | | Fixed: the frame keeps its size whatever its children need | pass | `sizing_rules` | | Fill: children share the space left after padding, gaps and fixed siblings; across the flow they stretch | pass | `sizing_rules` | +| Fill children share by their content area (border-box): a child with more padding or a thicker included inside stroke takes a little more, so the content areas come out the same | **fixed** | "Figma distributes space amongst fill container children by the children's content area instead of by their size, matching the CSS border-box model. A layer with a thicker stroke will take up slightly more of the available width or height, so that its inner content area matches its sibling's" (Use auto layout with CSS Flexbox in mind); the split went by outer size before. Min and max still clamp the outer size; a child's own insets are its padding and its included inside stroke (`nested_tests::fill_children_share_by_content_area`; #1824) | | Fill on a child turns its hugging parent Fixed on that axis | pass | `al_behaviour_tests::fill_on_a_child_turns_the_hugging_parent_fixed` | | Hug only on auto layout frames (and text); Fill only in an auto layout flow, never on a top-level frame | pass | `al_behaviour_tests::hug_and_fill_only_where_they_apply` | | Min/max width and height bound Hug, Fill and Fixed sizes, on frames and children | pass | `sizing_rules`; a fill child at its max leaves the rest to the other fill children (silent on redistribution: CSS flexbox) | @@ -97,6 +98,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Date | Change | Summary | |---|---|---| +| 2026-11-02 | patch | M2, #1824: fill container children share the free space by their content area: each one's own insets (padding and an included inside stroke, from the same `insets` the frame uses) come off the free space before the equal split and go back on its share, so a child with more padding or a thicker inside stroke takes a little more and the content areas match ("Figma distributes space amongst fill container children by the children's content area instead of by their size, matching the CSS border-box model", Use auto layout with CSS Flexbox in mind). Min and max still clamp the outer sizes and the frozen-share loop is as it was; children without insets split as before. Test: `nested_tests::fill_children_share_by_content_area` | | 2026-11-01 | patch | M2: a text layer keeps a max height or a number of max lines, not both ("Text layers cannot have both a max height and a set number of max lines", Guide to auto layout): `node.set {maxHeight}` on a text sets its max lines to Auto, and `node.set {maxLines}` or `text.maxLines` with a number removes its max height. Found by a documentation audit of this page. Test: `text_behaviour_tests::a_text_has_a_max_height_or_max_lines_not_both`. Numbers unchanged | | 2026-11-01 | minor | M2: Remove all auto layout ("To remove auto layout from a frame and all of its nested objects at once, right-click on the frame and go to More layout options > Remove all auto layout", Toggle on auto layout in designs): `layout.removeAll {ids?}` strips the frames and every frame nested in them in one undo step, leaving instances and their layers alone; in the canvas context menu beside Add auto layout and in the Actions palette. Found by a documentation audit of this page. Test: `al_nesting_tests::remove_all_auto_layout_strips_the_frame_and_every_frame_nested_in_it`. Numbers unchanged | | 2026-10-30 | minor | M8, #1083: grid placement finds free cells on a bitmap, a word at a time, with the same placements; crafted grids of wide children no longer stall a layout pass. Numbers unchanged. | From 33589610334929e5d8a7059e8f2332952e76283a Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 2 Nov 2026 05:29:33 -0500 Subject: [PATCH 26/49] M4: Backspace or Delete at a list item's start keeps its indentation level (#1862) * M4: Backspace or Delete at a list item's start keeps its indentation level Co-Authored-By: Claude Fable 5.1 * Lists: the level is kept by Backspace and Delete alone, and the tests read the text's own glyph Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- crates/doc/src/text.rs | 18 +++++++++-- crates/engine/src/canvas/textedit.rs | 45 +++++++++++++++++++--------- crates/engine/src/text_tail_tests.rs | 22 ++++++++++++++ crates/text/src/behaviour_tests.rs | 32 +++++++++++++++++++- crates/text/src/layout.rs | 12 ++++---- docs/ui-parity.md | 5 ++-- 6 files changed, 110 insertions(+), 24 deletions(-) diff --git a/crates/doc/src/text.rs b/crates/doc/src/text.rs index 0ba0aeeca..8a7253e9e 100644 --- a/crates/doc/src/text.rs +++ b/crates/doc/src/text.rs @@ -251,7 +251,10 @@ pub const MAX_LIST_INDENT: u8 = 8; #[serde(default)] pub struct ParaList { pub list: ListStyle, - /// Nesting level (0 = outermost; plain paragraphs are always 0). + /// Nesting level (0 = outermost). A plain paragraph is 0, except one that left its list by + /// Backspace or Delete at its start ([`TextData::unlist_keeping_levels`]): it keeps the level + /// it had and starts where that level's item text does ("delete the counter, but keep the + /// same level of indentation"). pub indent: u8, /// A numbered list that starts counting at this paragraph counts from `start_offset + 1` /// (items that go on counting ignore it; other paragraphs are always 0). @@ -798,11 +801,22 @@ impl TextData { /// paragraphs stay at level 0, only numbered ones keep a start, levels stop at /// [`MAX_LIST_INDENT`]); one style for all with no nesting or start folds back into `list`. pub fn set_para_lists(&mut self, start: usize, end: usize, f: impl Fn(&mut ParaList)) { + self.set_para_lists_with(start, end, false, f); + } + + /// Take the list items among the paragraphs chars `start..end` touch out of their list at the + /// level they had, as Backspace or Delete at an item's start does: "delete the counter, but + /// keep the same level of indentation" (Create bulleted and numbered lists). + pub fn unlist_keeping_levels(&mut self, start: usize, end: usize) { + self.set_para_lists_with(start, end, true, |pl| pl.list = ListStyle::None); + } + + fn set_para_lists_with(&mut self, start: usize, end: usize, keep_levels: bool, f: impl Fn(&mut ParaList)) { let (a, b) = self.para_span(start, end); self.fill_paragraphs(); for pl in self.paragraphs.get_mut(a..=b).unwrap_or(&mut []) { f(pl); - if pl.list == ListStyle::None { + if pl.list == ListStyle::None && !keep_levels { pl.indent = 0; } if pl.list != ListStyle::Numbered { diff --git a/crates/engine/src/canvas/textedit.rs b/crates/engine/src/canvas/textedit.rs index d7a70e5c7..368a48c90 100644 --- a/crates/engine/src/canvas/textedit.rs +++ b/crates/engine/src/canvas/textedit.rs @@ -303,9 +303,21 @@ fn insert_model(s: &mut Session, text: &str, ime_commit: bool) -> Result Result { let Some(te) = s.ds()?.text_edit.clone() else { return Ok(false) }; let t = text_of(s, te.id)?; @@ -315,19 +327,24 @@ fn list_key(s: &mut Session, key: &str, shift: bool) -> Result { let item = t.para_list(t.para_of(a)).list != ListStyle::None; let (pa, pb) = t.para_span(a, b); let any_item = (pa..=pb).any(|p| t.para_list(p).list != ListStyle::None); - let deeper = match key { - "Tab" if any_item => !shift, - "Backspace" if item && at_start => false, - "Enter" if item && at_start && chars.get(a).is_none_or(|c| *c == '\n') => false, + let mv = match key { + "Tab" if any_item && !shift => ListMove::Deeper, + "Tab" if any_item => ListMove::Out, + "Backspace" | "Delete" if item && at_start => ListMove::Unlist, + "Enter" if item && at_start && chars.get(a).is_none_or(|c| *c == '\n') => ListMove::Out, _ => return Ok(false), }; edit(s, |t, _| { - t.set_para_lists(a, b, |pl| match pl.list { - ListStyle::None => {} - _ if deeper => pl.indent = pl.indent.saturating_add(1), - _ if pl.indent > 0 => pl.indent -= 1, - _ => pl.list = ListStyle::None, - }) + if mv == ListMove::Unlist { + t.unlist_keeping_levels(a, b); + } else { + t.set_para_lists(a, b, |pl| match (pl.list, mv) { + (ListStyle::None, _) | (_, ListMove::Unlist) => {} + (_, ListMove::Deeper) => pl.indent = pl.indent.saturating_add(1), + (_, ListMove::Out) if pl.indent > 0 => pl.indent -= 1, + (_, ListMove::Out) => pl.list = ListStyle::None, + }); + } })?; Ok(true) } @@ -411,7 +428,7 @@ pub fn key(s: &mut Session, key: &str, shift: bool, word: bool, line: bool) -> R let t = text_of(s, te.id)?; let chars: Vec = t.characters.chars().collect(); let n = chars.len(); - if matches!(key, "Tab" | "Backspace" | "Enter") && !word && !line && list_key(s, key, shift)? { + if matches!(key, "Tab" | "Backspace" | "Delete" | "Enter") && !word && !line && list_key(s, key, shift)? { return Ok(()); } match key { diff --git a/crates/engine/src/text_tail_tests.rs b/crates/engine/src/text_tail_tests.rs index a94852093..8e399ba3a 100644 --- a/crates/engine/src/text_tail_tests.rs +++ b/crates/engine/src/text_tail_tests.rs @@ -129,6 +129,28 @@ fn list_keys_at_list_items() { "silent: Backspace at an item's start removes its bullet", ), ("a\nbc", vec![(B, 0), (B, 0)], 4, "Backspace", false, "a\nb", vec![(B, 0), (B, 0)], "Backspace inside an item deletes text"), + ( + "a\nb", + vec![(B, 0), (B, 1)], + 2, + "Backspace", + false, + "a\nb", + vec![(B, 0), (P, 1)], + "Backspace at a nested item's start removes its bullet and keeps its level", + ), + ("a\nb", vec![(N, 0), (N, 2)], 2, "Delete", false, "a\nb", vec![(N, 0), (P, 2)], "Delete at an item's start does the same"), + ("a\nbc", vec![(B, 0), (B, 1)], 3, "Delete", false, "a\nb", vec![(B, 0), (B, 1)], "Delete inside an item deletes text"), + ( + "a\nb", + vec![(B, 0), (P, 1)], + 2, + "Tab", + false, + "a\n\tb", + vec![(B, 0), (P, 1)], + "a plain paragraph at a level isn't an item: Tab types a tab", + ), ("a\nb", vec![(P, 0), (P, 0)], 3, "Tab", false, "a\nb\t", vec![(P, 0), (P, 0)], "outside a list Tab types a tab"), ("a", vec![(B, 8)], 1, "Tab", false, "a", vec![(B, 8)], "silent: nesting stops at 8 levels"), ]; diff --git a/crates/text/src/behaviour_tests.rs b/crates/text/src/behaviour_tests.rs index fe63e3866..439a81fcf 100644 --- a/crates/text/src/behaviour_tests.rs +++ b/crates/text/src/behaviour_tests.rs @@ -9,7 +9,7 @@ use super::*; use crate::breaks::{break_between, grapheme_starts}; -use figcraft_doc::{LeadingTrim, LetterSpacing, LineHeight, TextAlignH, TextAutoResize, TextData, TextDecoration}; +use figcraft_doc::{LeadingTrim, LetterSpacing, LineHeight, ListStyle, ParaList, TextAlignH, TextAutoResize, TextData, TextDecoration}; /// The default face once system fonts are indexed (a Latin face where the system has one, so CJK /// and emoji come from fallback faces), or None (skip) on a machine without fonts. @@ -100,6 +100,36 @@ fn letter_spacing_percent_and_pixels() { } } +/// "Use Backspace or Delete at the beginning of a list item to delete the counter, but keep the +/// same level of indentation" (Create bulleted and numbered lists): a plain paragraph at a list +/// level starts where that level's item text starts, even once no list is left; a plain +/// paragraph at level 0 starts at the box as always. +#[test] +fn a_plain_paragraph_at_a_list_level_starts_where_the_items_text_does() { + if face().is_none() { + return; + } + let level = |list: ListStyle, indent: u8| ParaList { list, indent, start_offset: 0 }; + let mut t = text("a\nb\nc", TextAutoResize::WidthAndHeight); + t.paragraphs = vec![level(ListStyle::Bulleted, 1), level(ListStyle::None, 1), level(ListStyle::None, 0)]; + let l = layout(&t, None, None); + // Where a line's text starts: its first character's glyph (the indent is in the glyphs); a + // list marker shares that character and sits in the gutter to its left, so the text is the + // rightmost of them. + let text_x = |l: &TextLayout, li: usize| { + l.glyphs.iter().filter(|g| g.char_start == l.lines[li].char_start).map(|g| g.x).fold(f64::NAN, |a, b| if a.is_nan() { b } else { a.max(b) }) + }; + let (x0, x1, x2) = (text_x(&l, 0), text_x(&l, 1), text_x(&l, 2)); + assert!((x1 - x0).abs() < EPS, "the plain paragraph keeps the item's text start: {x1} vs {x0}"); + assert!(x0 > 20.0, "a nested item's text starts two gutters in: {x0}"); + assert!(x2.abs() < EPS, "a level-0 plain paragraph starts at the box: {x2}"); + // No list left at all: the level still indents, by the same gutters. + let mut alone = text("b", TextAutoResize::WidthAndHeight); + alone.paragraphs = vec![level(ListStyle::None, 1)]; + let a = layout(&alone, None, None); + assert!((text_x(&a, 0) - x1).abs() < EPS, "{} vs {x1}", text_x(&a, 0)); +} + #[test] fn paragraph_spacing_and_indent() { if face().is_none() { diff --git a/crates/text/src/layout.rs b/crates/text/src/layout.rs index 7f5872fdf..51dd6d06b 100644 --- a/crates/text/src/layout.rs +++ b/crates/text/src/layout.rs @@ -951,10 +951,12 @@ pub fn layout(text: &TextData, box_width: Option, box_height: Option) // The start indent of a line of paragraph `p` (`first`: its first line, starting at char `ci`). let line_indent_of = |p: usize, first: bool, ci: usize| { let pl = list_of(p); + let level = step * (f64::from(pl.indent) + 1.0) - hang_list; match pl.list { - ListStyle::None if first => indent_at(ci), - ListStyle::None => 0.0, - _ => step * (f64::from(pl.indent) + 1.0) - hang_list, + // A plain paragraph that kept its level on leaving a list starts where that level's + // item text does; paragraph indent goes on its first line as on any plain paragraph. + ListStyle::None => (if pl.indent > 0 { level } else { 0.0 }) + if first { indent_at(ci) } else { 0.0 }, + _ => level, } }; // Hanging punctuation: at the start edge of left-aligned and justified lines, at the end edge @@ -1237,9 +1239,9 @@ fn roman(mut n: usize) -> String { } /// The width of one list level's gutter: room for the widest number plus half an em, at least one -/// and a half ems (0 without lists). +/// and a half ems (0 without lists, or plain paragraphs that kept a list level). fn list_step(lists: &[ParaList], markers: &[String], style: Option<&TextStyle>, face: Option<&Arc>) -> f64 { - if lists.iter().all(|l| l.list == ListStyle::None) { + if lists.iter().all(|l| l.list == ListStyle::None && l.indent == 0) { return 0.0; } let size = style.map(|s| sanitize_size(s.font_size)).unwrap_or(12.0); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 3963e4624..b4f3d9023 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-01 · **Change:** minor (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-02 · **Change:** patch (Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; 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: @@ -89,7 +89,7 @@ interaction feel not yet compared. | Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | 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); 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`). Not yet: areas of other layers edited at once | | 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) | -| Text: point, auto height, fixed; caret, words, lines, IME | done | 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; no spell check | +| 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`); 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; no spell check | | Eyedropper (I) | done | picks the colour seen under the pointer (opaque) into the selection's fill and the recent colours, one undo step (`fx_behaviour_tests`); with Cmd/Ctrl+Shift held it makes a colour style or variable of it instead, as the reference app's eyedropper does: a Create from color window asks which, its name (the next free "Color n") and a variable's collection (the file's first, or a new one made with it in the same undo step), and leaves the selection's fills alone (`eyedropper_create_tests`, `sampled_color_tests`) | | Comment (C), Shift+C to show/hide | done | local only | | Text on a path (Figma Draw) | done | the Text on a path tool in the Text flyout (`tool.textOnPath`) shows the I-beam over a shape's or vector's path, and a click there puts new text on the path, starting at the click, with the path's effects and its fill when one shows; the path layer is removed, and the path comes back if nothing is typed. Also from the Design panel or `text.onPath`; the path is edited by resizing only | @@ -176,6 +176,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-02 | patch | M4: Backspace or Delete at the start of a list item takes its marker and keeps its level ("Use Backspace or Delete at the beginning of a list item to delete the counter, but keep the same level of indentation", Create bulleted and numbered lists): a plain paragraph may now carry a list level, and the text layout starts it where that level's item text starts (the gutters stay even when no list is left). Backspace used to drop the level too, and Delete at an item's start deleted the next character. Tab on such a paragraph types a tab, as outside a list. Tests: `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests::a_plain_paragraph_at_a_list_level_starts_where_the_items_text_does` | | 2026-11-01 | patch | Shortcuts: Cmd/Ctrl+Shift+Alt+= and - make the interface larger and smaller through the sizes Preferences offers, and Cmd/Ctrl+Shift+Alt+0 puts it back to the system's size ("Adjust the scale of the Figma UI [...] Reset to Default: Control ⇧Shift Alt 0; Make Larger: Control ⇧Shift Alt =; Make Smaller: Control ⇧Shift Alt -", Accessibility at Figma); the size is kept at once, as one picked in Preferences is. `pref.uiScaleUp`, `pref.uiScaleDown`, `pref.uiScaleReset`; the sizes list now lives in the engine (`UI_SCALE_SIZES`) and Preferences reads it from there. Found by a documentation audit of the shortcuts. Test: `keymap_tests::the_interface_size_keys_step_through_the_preferences_sizes`. Documented rows 130 → 133, bound 129 → 132 | | 2026-11-01 | patch | Shortcuts: Cmd/Ctrl+Alt+↑/↓ (and ←/→) rotate the selection one degree at a time, 15 with Shift ("Press ⌘Command ⌥Option ↑/ ↓ on Mac or Control Alt ↑/↓ on Windows to rotate an object one degree at a time", Accessibility at Figma); they resized by the nudge before, which Cmd/Ctrl+arrows without Alt still do. Down and right turn clockwise, up and left back (the documentation is silent on the direction). In the shortcuts panel's Transform tab, over the control channel's `ui.key` too. Found by a documentation audit of the shortcuts. Test: `shortcut_keys_tests::cmd_alt_arrows_rotate_a_degree_and_fifteen_with_shift`. Documented rows 129 → 130, bound 128 → 129 | | 2026-11-01 | patch | Shortcuts: the Layers panel opens with Ctrl+1 as well as Alt+1 on Windows and Linux ("Mac: Option 1 Windows: Ctrl 1" in Select layers and objects; "Windows: Alt 1" in Explore the navigation bar and left sidebar). macOS keeps Option+1. Found by a documentation audit of the shortcuts (every chord driven over the control channel). Tests: `keymap_tests::the_layers_panel_answers_both_of_its_documented_windows_keys`, the parity row. Counts unchanged | From e9eb7ce7f43b298b44233b55eb0dccdf303addb2 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 2 Nov 2026 05:29:59 -0500 Subject: [PATCH 27/49] M4: max lines on auto-width text keep it auto width, hugging that many lines (#1864) * M4: max lines on auto-width text keep it auto width, hugging that many lines Co-Authored-By: Claude Fable 5.1 * M4: an auto-width text with max lines hugs the ellipsis on its last line, and the editing test expects auto width Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- crates/doc/src/text.rs | 8 +++--- crates/engine/src/canvas/textedit/tests.rs | 2 +- crates/engine/src/cmd/text.rs | 4 +-- crates/engine/src/text_behaviour_tests.rs | 30 +++++++++++++++++++++- crates/text/src/layout.rs | 2 ++ docs/ui-parity.md | 5 ++-- 6 files changed, 42 insertions(+), 9 deletions(-) diff --git a/crates/doc/src/text.rs b/crates/doc/src/text.rs index 8a7253e9e..0c41d3c9a 100644 --- a/crates/doc/src/text.rs +++ b/crates/doc/src/text.rs @@ -609,12 +609,14 @@ impl TextData { } /// Whether text that runs out of room ends in an ellipsis: a truncating box, or auto height - /// with a line limit (the box hugs up to `max_lines` lines). + /// or auto width with a line limit (the box hugs up to `max_lines` lines: "Max lines is + /// available only if truncate text is enabled, and: Text resizing is set to auto height or + /// auto width"). pub fn truncates(&self) -> bool { match self.auto_resize { TextAutoResize::Truncate => true, - TextAutoResize::Height => self.max_lines > 0, - TextAutoResize::WidthAndHeight | TextAutoResize::None => false, + TextAutoResize::Height | TextAutoResize::WidthAndHeight => self.max_lines > 0, + TextAutoResize::None => false, } } diff --git a/crates/engine/src/canvas/textedit/tests.rs b/crates/engine/src/canvas/textedit/tests.rs index fecca5808..81756901d 100644 --- a/crates/engine/src/canvas/textedit/tests.rs +++ b/crates/engine/src/canvas/textedit/tests.rs @@ -242,7 +242,7 @@ fn paragraph_and_feature_commands_on_nodes() { s.execute("text.listStyle", &json!({"ids": ids, "style": "bulleted"})).unwrap(); let t = data(&s, id); assert_eq!((t.paragraph_indent, t.paragraph_spacing, t.max_lines), (16.0, 8.0, 2)); - assert_eq!(t.auto_resize, TextAutoResize::Truncate); + assert_eq!(t.auto_resize, TextAutoResize::WidthAndHeight, "max lines keep an auto-width text auto width"); assert_eq!(t.style.decoration, TextDecoration::Strikethrough); assert_eq!(t.style.case, TextCase::SmallCaps); assert_eq!(t.list, ListStyle::Bulleted); diff --git a/crates/engine/src/cmd/text.rs b/crates/engine/src/cmd/text.rs index b507afd6b..446b01d29 100644 --- a/crates/engine/src/cmd/text.rs +++ b/crates/engine/src/cmd/text.rs @@ -319,13 +319,13 @@ pub fn specs() -> Vec { spec!( "text.maxLines", "Max lines", - "{lines (0 = no limit; truncates: auto-height text hugs up to that many lines, other text becomes a truncating box), ids?}", + "{lines (0 = no limit; truncates: auto-height and auto-width text hug up to that many lines, fixed-size text becomes a truncating box), ids?}", true, |s, p| { let v = finite(req_num("text.maxLines", p, "lines")?).clamp(0.0, 10_000.0) as u32; let r = para(s, p, |t| { t.max_lines = v; - if v > 0 && t.auto_resize != TextAutoResize::Height { + if v > 0 && !matches!(t.auto_resize, TextAutoResize::Height | TextAutoResize::WidthAndHeight) { t.auto_resize = TextAutoResize::Truncate; } })?; diff --git a/crates/engine/src/text_behaviour_tests.rs b/crates/engine/src/text_behaviour_tests.rs index 9ae7dd62c..ab62136c4 100644 --- a/crates/engine/src/text_behaviour_tests.rs +++ b/crates/engine/src/text_behaviour_tests.rs @@ -365,12 +365,40 @@ fn max_lines_on_auto_height_text_hugs_that_many_lines() { s.execute("node.set", &json!({"id": t, "props": {"maxLines": 1}})).unwrap(); s.execute("node.set", &json!({"id": t, "props": {"height": 30}})).unwrap(); assert_eq!((resize_mode(&s, t), size(&s, t).1), (TextAutoResize::Truncate, 30.0)); - // Other text still becomes a truncating box with max lines. + // Fixed-size text still becomes a truncating box with max lines. let fixed = text(&mut s, "Lorem", json!({"textAutoResize": "none", "width": 100, "height": 100})); s.execute("text.maxLines", &json!({"ids": [fixed], "lines": 2})).unwrap(); assert_eq!(resize_mode(&s, fixed), TextAutoResize::Truncate); } +#[test] +fn max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines() { + // "Max lines is available only if truncate text is enabled, and: Text resizing is set to + // auto height or auto width" (Explore text properties): an auto-width text with max lines + // stays auto width, growing with its longest line and hugging up to that many lines. + use figcraft_doc::TextAutoResize; + // The synthetic font: every character 8 px wide at 16 px, so the widths are the same + // everywhere and never depend on what the system has installed. + let font = test_mono_font(); + let mut s = Session::new(); + let t = text(&mut s, "one\ntwo\nthree", json!({"fontFamily": font, "fontSize": 16, "lineHeight": 24})); + assert_eq!(resize_mode(&s, t), TextAutoResize::WidthAndHeight); + assert_eq!(size(&s, t), (40.0, 72.0), "three lines tall, as wide as 'three'"); + s.execute("text.maxLines", &json!({"ids": [t], "lines": 2})).unwrap(); + assert_eq!(resize_mode(&s, t), TextAutoResize::WidthAndHeight, "max lines keep auto width"); + assert_eq!(size(&s, t), (32.0, 48.0), "two lines tall, as wide as the widest line it shows with its ellipsis (two…), not the hidden third"); + assert_eq!(crate::inspect::node_json(s.doc().unwrap(), t, 0)["maxLines"], json!(2)); + // Still auto width: a longer line widens the box. + s.execute("text.edit.begin", &json!({"id": t, "caret": 3})).unwrap(); + s.execute("text.edit.insert", &json!({"text": " and a longer line"})).unwrap(); + crate::textedit::end(&mut s).unwrap(); + assert_eq!(size(&s, t), (168.0, 48.0), "the box grew with its longest line (21 characters)"); + assert_eq!(resize_mode(&s, t), TextAutoResize::WidthAndHeight); + // No limit: all of its lines again. + s.execute("node.set", &json!({"id": t, "props": {"maxLines": 0}})).unwrap(); + assert_eq!(size(&s, t).1, 72.0); +} + /// A synthetic monospaced TrueType font (outline-less glyphs, every printable ASCII character 500 of /// 1000 units wide), loaded into the font database so text measures the same on every machine. fn test_mono_font() -> &'static str { diff --git a/crates/text/src/layout.rs b/crates/text/src/layout.rs index 51dd6d06b..5d3d3c27f 100644 --- a/crates/text/src/layout.rs +++ b/crates/text/src/layout.rs @@ -798,6 +798,8 @@ fn truncate_layout(out: &mut TextLayout, finish: &LayoutFinish<'_>) { } } add_ellipsis(out, wrap); + // The ellipsis can make the last line the widest: an auto-width box hugs it too. + out.width = out.width.max(out.lines.last().map_or(0.0, |l| l.width)); // Carets and selections reach every char the line shows, borrowed ones included. if let Some(l) = out.lines.last() { let shown = diff --git a/docs/ui-parity.md b/docs/ui-parity.md index b4f3d9023..aa1c4510e 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-02 · **Change:** patch (Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; 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-02 · **Change:** patch (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; 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: @@ -89,7 +89,7 @@ interaction feel not yet compared. | Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | 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); 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`). Not yet: areas of other layers edited at once | | 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) | -| 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`); 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; no spell check | +| 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`); 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; no spell check | | Eyedropper (I) | done | picks the colour seen under the pointer (opaque) into the selection's fill and the recent colours, one undo step (`fx_behaviour_tests`); with Cmd/Ctrl+Shift held it makes a colour style or variable of it instead, as the reference app's eyedropper does: a Create from color window asks which, its name (the next free "Color n") and a variable's collection (the file's first, or a new one made with it in the same undo step), and leaves the selection's fills alone (`eyedropper_create_tests`, `sampled_color_tests`) | | Comment (C), Shift+C to show/hide | done | local only | | Text on a path (Figma Draw) | done | the Text on a path tool in the Text flyout (`tool.textOnPath`) shows the I-beam over a shape's or vector's path, and a click there puts new text on the path, starting at the click, with the path's effects and its fill when one shows; the path layer is removed, and the path comes back if nothing is typed. Also from the Design panel or `text.onPath`; the path is edited by resizing only | @@ -177,6 +177,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| | 2026-11-02 | patch | M4: Backspace or Delete at the start of a list item takes its marker and keeps its level ("Use Backspace or Delete at the beginning of a list item to delete the counter, but keep the same level of indentation", Create bulleted and numbered lists): a plain paragraph may now carry a list level, and the text layout starts it where that level's item text starts (the gutters stay even when no list is left). Backspace used to drop the level too, and Delete at an item's start deleted the next character. Tab on such a paragraph types a tab, as outside a list. Tests: `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests::a_plain_paragraph_at_a_list_level_starts_where_the_items_text_does` | +| 2026-11-02 | patch | M4: max lines on an auto-width text keep it auto width: the box hugs up to that many lines and still grows with its longest line ("Max lines is available only if truncate text is enabled, and: Text resizing is set to auto height or auto width", Explore text properties). `text.maxLines` turned such a text into a fixed truncating box with a stale height, so later typing no longer widened it; fixed-size text still becomes a truncating box, auto-height text hugs as before. Test: `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines` | | 2026-11-01 | patch | Shortcuts: Cmd/Ctrl+Shift+Alt+= and - make the interface larger and smaller through the sizes Preferences offers, and Cmd/Ctrl+Shift+Alt+0 puts it back to the system's size ("Adjust the scale of the Figma UI [...] Reset to Default: Control ⇧Shift Alt 0; Make Larger: Control ⇧Shift Alt =; Make Smaller: Control ⇧Shift Alt -", Accessibility at Figma); the size is kept at once, as one picked in Preferences is. `pref.uiScaleUp`, `pref.uiScaleDown`, `pref.uiScaleReset`; the sizes list now lives in the engine (`UI_SCALE_SIZES`) and Preferences reads it from there. Found by a documentation audit of the shortcuts. Test: `keymap_tests::the_interface_size_keys_step_through_the_preferences_sizes`. Documented rows 130 → 133, bound 129 → 132 | | 2026-11-01 | patch | Shortcuts: Cmd/Ctrl+Alt+↑/↓ (and ←/→) rotate the selection one degree at a time, 15 with Shift ("Press ⌘Command ⌥Option ↑/ ↓ on Mac or Control Alt ↑/↓ on Windows to rotate an object one degree at a time", Accessibility at Figma); they resized by the nudge before, which Cmd/Ctrl+arrows without Alt still do. Down and right turn clockwise, up and left back (the documentation is silent on the direction). In the shortcuts panel's Transform tab, over the control channel's `ui.key` too. Found by a documentation audit of the shortcuts. Test: `shortcut_keys_tests::cmd_alt_arrows_rotate_a_degree_and_fifteen_with_shift`. Documented rows 129 → 130, bound 128 → 129 | | 2026-11-01 | patch | Shortcuts: the Layers panel opens with Ctrl+1 as well as Alt+1 on Windows and Linux ("Mac: Option 1 Windows: Ctrl 1" in Select layers and objects; "Windows: Alt 1" in Explore the navigation bar and left sidebar). macOS keeps Option+1. Found by a documentation audit of the shortcuts (every chord driven over the control channel). Tests: `keymap_tests::the_layers_panel_answers_both_of_its_documented_windows_keys`, the parity row. Counts unchanged | From c44cfc94af9c1efa47f3359932245480cfdfaed8 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 2 Nov 2026 05:30:50 -0500 Subject: [PATCH 28/49] M4: superscript and subscript are synthesised where the font has no glyphs for them (#1828) (#1868) * M4: superscript and subscript are synthesised where the font has no glyphs for them (#1828) Co-Authored-By: Claude Fable 5.1 * Text: a zero OS/2 script offset counts as unset, and the native-glyph check sees the case-mapped characters Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- crates/engine/src/text_behaviour_tests.rs | 40 ++++++++++ crates/text/src/fontdb.rs | 18 +++++ crates/text/src/layout.rs | 92 +++++++++++++++-------- crates/text/src/tests.rs | 43 +++++++++++ docs/ui-parity.md | 4 +- 5 files changed, 163 insertions(+), 34 deletions(-) diff --git a/crates/engine/src/text_behaviour_tests.rs b/crates/engine/src/text_behaviour_tests.rs index ab62136c4..bed6b3d6b 100644 --- a/crates/engine/src/text_behaviour_tests.rs +++ b/crates/engine/src/text_behaviour_tests.rs @@ -399,6 +399,46 @@ fn max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines() { assert_eq!(size(&s, t).1, 72.0); } +#[test] +fn superscript_and_subscript_are_synthesised_without_glyphs_for_them() { + // "If it isn't provided, Figma draws a synthesized version by using the font's standard + // version of the character, shrinking it, and positioning it accordingly" (Explore text + // properties). The synthetic font has no sups or subs feature and no OS/2 metrics, so the + // usual 0.65 em at 0.35 em up (superscript) or 0.14 em down (subscript) apply. + let font = test_mono_font(); + let mut s = Session::new(); + let t = text(&mut s, "x2", json!({"fontFamily": font, "fontSize": 40})); + let glyphs = |s: &Session| -> Vec<(f64, f64, f64)> { + let (l, _) = figcraft_text::layout_node(s.doc().unwrap().node(t).unwrap()).unwrap(); + l.glyphs.iter().map(|g| (g.size, g.y, g.advance)).collect() + }; + let plain = glyphs(&s); + assert_eq!(plain.len(), 2); + assert_eq!((plain[0].0, plain[0].2), (40.0, 20.0)); + assert_eq!(size(&s, t).0, 40.0); + s.execute("text.setFeatures", &json!({"ids": [t], "features": {"sups": true}})).unwrap(); + let sup = glyphs(&s); + for (g, p) in sup.iter().zip(&plain) { + assert!((g.0 - 26.0).abs() < 1e-6 && (g.2 - 13.0).abs() < 1e-6, "shrunk to 0.65 em, the advance with it: {g:?}"); + assert!((p.1 - g.1 - 14.0).abs() < 1e-6, "raised 0.35 em: {g:?} against {p:?}"); + } + assert!((size(&s, t).0 - 26.0).abs() < 1e-6, "the auto-width box hugs the smaller glyphs: {:?}", size(&s, t)); + s.execute("text.setFeatures", &json!({"ids": [t], "features": {"sups": null, "subs": true}})).unwrap(); + let sub = glyphs(&s); + for (g, p) in sub.iter().zip(&plain) { + assert!((g.0 - 26.0).abs() < 1e-6 && (g.1 - p.1 - 5.6).abs() < 1e-6, "shrunk, and lowered 0.14 em: {g:?} against {p:?}"); + } + // Capitalised, the same: the synthesis follows the characters shaping saw. + s.execute("node.set", &json!({"id": t, "props": {"textCase": "upper"}})).unwrap(); + s.execute("text.setFeatures", &json!({"ids": [t], "features": {"subs": null, "sups": true}})).unwrap(); + for (g, p) in glyphs(&s).iter().zip(&plain) { + assert!((g.0 - 26.0).abs() < 1e-6 && (p.1 - g.1 - 14.0).abs() < 1e-6, "upper case, superscript: {g:?} against {p:?}"); + } + s.execute("node.set", &json!({"id": t, "props": {"textCase": "original"}})).unwrap(); + s.execute("text.setFeatures", &json!({"ids": [t], "features": {"sups": null, "subs": false}})).unwrap(); + assert_eq!(glyphs(&s), plain, "off again"); +} + /// A synthetic monospaced TrueType font (outline-less glyphs, every printable ASCII character 500 of /// 1000 units wide), loaded into the font database so text measures the same on every machine. fn test_mono_font() -> &'static str { diff --git a/crates/text/src/fontdb.rs b/crates/text/src/fontdb.rs index 2c6aac948..d0004fcd9 100644 --- a/crates/text/src/fontdb.rs +++ b/crates/text/src/fontdb.rs @@ -102,6 +102,11 @@ pub struct Face { pub underline_pos: f64, pub underline_thickness: f64, pub strike_pos: f64, + /// Synthesised superscript and subscript (the OS/2 table's values, or the usual ones without + /// it): the glyph size as a fraction of the em, and the baseline shift up in font units + /// (negative for a subscript, which sits below). + pub superscript: (f64, f64), + pub subscript: (f64, f64), pub shaper: harfrust::ShaperData, /// OpenType GSUB feature tags the face provides (e.g. `smcp`). gsub_features: Vec<[u8; 4]>, @@ -179,6 +184,17 @@ impl Face { let colr = has_table(b"COLR"); let under = m.underline.map(|d| (f64::from(d.offset), f64::from(d.thickness))).unwrap_or((-upem * 0.1, upem * 0.06)); let strike = m.strikeout.map(|d| f64::from(d.offset)).unwrap_or(ascent * 0.3); + // Superscript and subscript sizes and offsets: the OS/2 table's, else the usual 0.65 em, + // 0.35 em up and 0.14 em down (what common fonts carry); a zero counts as unset, as some + // fonts leave these fields. + let os2 = f.os2().ok(); + let script = |size: Option, offset: Option, up: bool, usual_offset: f64| -> (f64, f64) { + let size = size.map(f64::from).filter(|v| *v > 0.0).map_or(0.65, |v| v / upem); + let offset = offset.map(f64::from).filter(|v| *v != 0.0).unwrap_or(usual_offset * upem); + (size, if up { offset } else { -offset }) + }; + let superscript = script(os2.as_ref().map(|t| t.y_superscript_y_size()), os2.as_ref().map(|t| t.y_superscript_y_offset()), true, 0.35); + let subscript = script(os2.as_ref().map(|t| t.y_subscript_y_size()), os2.as_ref().map(|t| t.y_subscript_y_offset()), false, 0.14); let weight = { let w = attrs.weight.value(); if w.is_finite() && w > 0.0 { w.round() as u16 } else { figcraft_doc::style_weight(&style) } @@ -200,6 +216,8 @@ impl Face { underline_pos: under.0, underline_thickness: under.1.max(upem * 0.02), strike_pos: strike, + superscript, + subscript, shaper, gsub_features, track, diff --git a/crates/text/src/layout.rs b/crates/text/src/layout.rs index 5d3d3c27f..7305dac15 100644 --- a/crates/text/src/layout.rs +++ b/crates/text/src/layout.rs @@ -1418,39 +1418,65 @@ fn shape_segment(chars: &[char], seg: &Segment, face: &Arc, features: &[Fe // Variable fonts: the axis values the style asks for (named instance, implied weight, custom). let values = face.axis_values(style); let coords = face.coords(&values); - let mut raw: Vec<(u32, u32, i32, i32, i32)> = Vec::new(); - if let Some(hb) = face.hb() { - let instance = (!coords.is_empty()).then(|| { - let vars = face - .axes - .iter() - .zip(&values) - .filter_map(|(a, v)| <[u8; 4]>::try_from(a.tag.as_bytes()).ok().map(|t| Variation { tag: Tag::new(&t), value: *v as f32 })); - ShaperInstance::from_variations(&hb, vars) - }); - let shaper = face.shaper.shaper(&hb).instance(instance.as_ref()).build(); - let mut buf = UnicodeBuffer::new(); - for (u, src, _) in &mapped { - buf.add(*u, *src as u32); - } - let rtl = seg.level % 2 == 1; - buf.set_direction(if rtl { Direction::RightToLeft } else { Direction::LeftToRight }); - buf.guess_segment_properties(); - let gb = shaper.shape(buf, ShapeOptions::new().features(&feats)); - for (info, pos) in gb.glyph_infos().iter().zip(gb.glyph_positions()) { - raw.push((info.glyph_id, info.cluster, pos.x_advance, pos.x_offset, pos.y_offset)); - } - // Right-to-left glyphs come out in visual order; items are kept in logical order (lines - // put runs back in visual order). - if rtl { - raw.reverse(); - } - } else { - for (u, src, _) in &mapped { - let gid = face.glyph_for(*u); - raw.push((gid, *src as u32, face.advance_at(gid, &coords) as i32, 0, 0)); + let shape = |feats: &[Feature]| -> Vec<(u32, u32, i32, i32, i32)> { + let mut raw = Vec::new(); + if let Some(hb) = face.hb() { + let instance = (!coords.is_empty()).then(|| { + let vars = face + .axes + .iter() + .zip(&values) + .filter_map(|(a, v)| <[u8; 4]>::try_from(a.tag.as_bytes()).ok().map(|t| Variation { tag: Tag::new(&t), value: *v as f32 })); + ShaperInstance::from_variations(&hb, vars) + }); + let shaper = face.shaper.shaper(&hb).instance(instance.as_ref()).build(); + let mut buf = UnicodeBuffer::new(); + for (u, src, _) in &mapped { + buf.add(*u, *src as u32); + } + let rtl = seg.level % 2 == 1; + buf.set_direction(if rtl { Direction::RightToLeft } else { Direction::LeftToRight }); + buf.guess_segment_properties(); + let gb = shaper.shape(buf, ShapeOptions::new().features(feats)); + for (info, pos) in gb.glyph_infos().iter().zip(gb.glyph_positions()) { + raw.push((info.glyph_id, info.cluster, pos.x_advance, pos.x_offset, pos.y_offset)); + } + // Right-to-left glyphs come out in visual order; items are kept in logical order + // (lines put runs back in visual order). + if rtl { + raw.reverse(); + } + } else { + for (u, src, _) in &mapped { + let gid = face.glyph_for(*u); + raw.push((gid, *src as u32, face.advance_at(gid, &coords) as i32, 0, 0)); + } } + raw + }; + let mut raw = shape(&feats); + // Superscript or subscript (`sups` / `subs` on the node): the face's own glyphs where it has + // the feature and every letter or digit here got one; otherwise synthesised from the standard + // glyphs, shrunk and shifted ("Figma draws a synthesized version by using the font's standard + // version of the character, shrinking it, and positioning it accordingly"; a run mixing + // available and unavailable glyphs is synthesised whole, "for consistency"). + let script = [(b"sups", true), (b"subs", false)].into_iter().find(|(tag, _)| feats.iter().any(|f| f.tag == Tag::new(tag) && f.value != 0)); + // The glyph a cluster's character has on its own, after the case mapping shaping saw. + let plain_gid = |cl: usize| mapped.iter().find(|(_, src, _)| *src == cl).map(|(u, _, _)| face.glyph_for(*u)); + let unchanged = |raw: &[(u32, u32, i32, i32, i32)]| { + raw.iter().any(|&(gid, cl, ..)| { + let cl = cl as usize; + chars.get(cl).is_some_and(|c| c.is_alphanumeric()) && plain_gid(cl) == Some(gid) + }) + }; + let synth = script.filter(|(tag, _)| !face.has_feature(tag) || unchanged(&raw)); + if let Some((tag, _)) = synth + && face.has_feature(tag) + { + let plain: Vec = feats.iter().filter(|f| f.tag != Tag::new(tag)).cloned().collect(); + raw = shape(&plain); } + let (script_scale, script_shift) = synth.map_or((1.0, 0.0), |(_, up)| if up { face.superscript } else { face.subscript }); let n = raw.len(); for gi in 0..n { let Some(&(gid, cl, xa, xo, yo)) = raw.get(gi) else { continue }; @@ -1459,7 +1485,7 @@ fn shape_segment(chars: &[char], seg: &Segment, face: &Arc, features: &[Fe let cend = raw.iter().skip(gi + 1).map(|r| r.1 as usize).find(|c| *c > cl).unwrap_or(end).max(cl + 1); let last_in_cluster = raw.get(gi + 1).is_none_or(|r| r.1 as usize != cl); let ch = chars.get(cl).copied().unwrap_or(' '); - let scale = if small_at(cl) { SMALL_CAP_SCALE } else { 1.0 }; + let scale = if small_at(cl) { SMALL_CAP_SCALE } else { 1.0 } * script_scale; let spacing = if last_in_cluster { seg.spacing * (cend - cl) as f64 } else { 0.0 }; // The glyph's own advance and what shaping added to it (kerning) each land on the grid. let own = face.advance_at(gid, &coords); @@ -1472,7 +1498,7 @@ fn shape_segment(chars: &[char], seg: &Segment, face: &Arc, features: &[Fe adv, spacing, dx: f64::from(xo) * k * scale, - dy: f64::from(yo) * k * scale, + dy: f64::from(yo) * k * scale + script_shift * k, char_start: cl, char_end: cend, style: seg.st_idx, diff --git a/crates/text/src/tests.rs b/crates/text/src/tests.rs index e643ccaee..6d341419c 100644 --- a/crates/text/src/tests.rs +++ b/crates/text/src/tests.rs @@ -157,6 +157,49 @@ fn small_caps_native_or_synthesised() { assert_eq!(sc.glyphs.iter().find(|g| g.char_start == 0).unwrap().gid, face.glyph_for('A')); } +#[test] +fn superscript_native_or_synthesised_and_never_mixed() { + // "Figma tries to use any superscript/subscript glyphs provided by the font. If it isn't + // provided, Figma draws a synthesized version by using the font's standard version of the + // character, shrinking it, and positioning it accordingly." and a layer mixing both "will all + // update to the synthesized form for consistency" (Explore text properties). + let Some(face) = inter() else { return }; + let mut t = TextData::new("x2"); + t.style.font_size = 20.0; + let plain = layout(&t, None, None); + t.features.insert("sups".into(), true); + let sup = layout(&t, None, None); + let at = |l: &TextLayout, i: usize| l.glyphs.iter().find(|g| g.char_start == i).cloned().unwrap(); + let native = |i: usize| at(&sup, i).gid != at(&plain, i).gid && (at(&sup, i).size - 20.0).abs() < 1e-9; + let synthesised = |i: usize| at(&sup, i).gid == at(&plain, i).gid && at(&sup, i).size < 20.0 && at(&sup, i).y < at(&plain, i).y; + assert!((native(0) && native(1)) || (synthesised(0) && synthesised(1)), "both glyphs the same way: {:?} {:?}", at(&sup, 0), at(&sup, 1)); + if !face.has_feature(b"sups") { + assert!(synthesised(0) && synthesised(1), "no sups in the face: synthesised"); + } + t.features.insert("sups".into(), false); + t.features.insert("subs".into(), true); + let sub = layout(&t, None, None); + let g = at(&sub, 1); + let p = at(&plain, 1); + assert!((g.gid != p.gid && (g.size - 20.0).abs() < 1e-9) || (g.size < 20.0 && g.y > p.y), "subscript: native, or shrunk and lowered: {g:?}"); + // Capitalised, the same holds: the check against the face's own glyphs sees the characters + // shaping saw (an X, not an x), so a face with a superscript 2 and no superscript X + // synthesises both rather than mixing them. + t.features.clear(); + t.style.case = figcraft_doc::TextCase::Upper; + let plain_up = layout(&t, None, None); + t.features.insert("sups".into(), true); + let up = layout(&t, None, None); + let native_up = |i: usize| at(&up, i).gid != at(&plain_up, i).gid && (at(&up, i).size - 20.0).abs() < 1e-9; + let synth_up = |i: usize| at(&up, i).gid == at(&plain_up, i).gid && at(&up, i).size < 20.0 && at(&up, i).y < at(&plain_up, i).y; + assert!( + (native_up(0) && native_up(1)) || (synth_up(0) && synth_up(1)), + "upper case: both glyphs the same way: {:?} {:?}", + at(&up, 0), + at(&up, 1) + ); +} + #[test] fn title_case_across_runs() { let Some(face) = inter() else { return }; diff --git a/docs/ui-parity.md b/docs/ui-parity.md index aa1c4510e..d936c9408 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-02 · **Change:** patch (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; 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-02 · **Change:** patch (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); 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: @@ -90,6 +90,7 @@ interaction feel not yet compared. | 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) | | 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`); 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; no spell check | +| Text: superscript and subscript | done | `sups` / `subs` use the font's own glyphs where it has the feature and every letter or digit of the run gets one; otherwise the standard glyphs are drawn shrunk and raised or lowered by the font's OS/2 superscript and subscript metrics (0.65 em at 0.35 em up or 0.14 em down without them), and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says ("Figma draws a synthesized version by using the font's standard version of the character, shrinking it, and positioning it accordingly"; mixed glyphs "all update to the synthesized form for consistency"), #1828; tests `text::tests::superscript_native_or_synthesised_and_never_mixed`, `text_behaviour_tests::superscript_and_subscript_are_synthesised_without_glyphs_for_them` | | Eyedropper (I) | done | picks the colour seen under the pointer (opaque) into the selection's fill and the recent colours, one undo step (`fx_behaviour_tests`); with Cmd/Ctrl+Shift held it makes a colour style or variable of it instead, as the reference app's eyedropper does: a Create from color window asks which, its name (the next free "Color n") and a variable's collection (the file's first, or a new one made with it in the same undo step), and leaves the selection's fills alone (`eyedropper_create_tests`, `sampled_color_tests`) | | Comment (C), Shift+C to show/hide | done | local only | | Text on a path (Figma Draw) | done | the Text on a path tool in the Text flyout (`tool.textOnPath`) shows the I-beam over a shape's or vector's path, and a click there puts new text on the path, starting at the click, with the path's effects and its fill when one shows; the path layer is removed, and the path comes back if nothing is typed. Also from the Design panel or `text.onPath`; the path is edited by resizing only | @@ -178,6 +179,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look |---|---|---| | 2026-11-02 | patch | M4: Backspace or Delete at the start of a list item takes its marker and keeps its level ("Use Backspace or Delete at the beginning of a list item to delete the counter, but keep the same level of indentation", Create bulleted and numbered lists): a plain paragraph may now carry a list level, and the text layout starts it where that level's item text starts (the gutters stay even when no list is left). Backspace used to drop the level too, and Delete at an item's start deleted the next character. Tab on such a paragraph types a tab, as outside a list. Tests: `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests::a_plain_paragraph_at_a_list_level_starts_where_the_items_text_does` | | 2026-11-02 | patch | M4: max lines on an auto-width text keep it auto width: the box hugs up to that many lines and still grows with its longest line ("Max lines is available only if truncate text is enabled, and: Text resizing is set to auto height or auto width", Explore text properties). `text.maxLines` turned such a text into a fixed truncating box with a stale height, so later typing no longer widened it; fixed-size text still becomes a truncating box, auto-height text hugs as before. Test: `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines` | +| 2026-11-02 | patch | M4, #1828: superscript and subscript synthesised where the font has no `sups` / `subs` glyphs (the standard glyph shrunk and shifted by the OS/2 metrics, the usual 0.65 em and 0.35 / 0.14 em offsets without them), and a run mixing available and unavailable glyphs synthesised whole, as Explore text properties says. Tests: `text::tests::superscript_native_or_synthesised_and_never_mixed`, `text_behaviour_tests::superscript_and_subscript_are_synthesised_without_glyphs_for_them`. | | 2026-11-01 | patch | Shortcuts: Cmd/Ctrl+Shift+Alt+= and - make the interface larger and smaller through the sizes Preferences offers, and Cmd/Ctrl+Shift+Alt+0 puts it back to the system's size ("Adjust the scale of the Figma UI [...] Reset to Default: Control ⇧Shift Alt 0; Make Larger: Control ⇧Shift Alt =; Make Smaller: Control ⇧Shift Alt -", Accessibility at Figma); the size is kept at once, as one picked in Preferences is. `pref.uiScaleUp`, `pref.uiScaleDown`, `pref.uiScaleReset`; the sizes list now lives in the engine (`UI_SCALE_SIZES`) and Preferences reads it from there. Found by a documentation audit of the shortcuts. Test: `keymap_tests::the_interface_size_keys_step_through_the_preferences_sizes`. Documented rows 130 → 133, bound 129 → 132 | | 2026-11-01 | patch | Shortcuts: Cmd/Ctrl+Alt+↑/↓ (and ←/→) rotate the selection one degree at a time, 15 with Shift ("Press ⌘Command ⌥Option ↑/ ↓ on Mac or Control Alt ↑/↓ on Windows to rotate an object one degree at a time", Accessibility at Figma); they resized by the nudge before, which Cmd/Ctrl+arrows without Alt still do. Down and right turn clockwise, up and left back (the documentation is silent on the direction). In the shortcuts panel's Transform tab, over the control channel's `ui.key` too. Found by a documentation audit of the shortcuts. Test: `shortcut_keys_tests::cmd_alt_arrows_rotate_a_degree_and_fifteen_with_shift`. Documented rows 129 → 130, bound 128 → 129 | | 2026-11-01 | patch | Shortcuts: the Layers panel opens with Ctrl+1 as well as Alt+1 on Windows and Linux ("Mac: Option 1 Windows: Ctrl 1" in Select layers and objects; "Windows: Alt 1" in Explore the navigation bar and left sidebar). macOS keeps Option+1. Found by a documentation audit of the shortcuts (every chord driven over the control channel). Tests: `keymap_tests::the_layers_panel_answers_both_of_its_documented_windows_keys`, the parity row. Counts unchanged | From 9f09b7163cfda16241b6693b01510b8cafd83a0a Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 2 Nov 2026 05:31:00 -0500 Subject: [PATCH 29/49] M2: a double-click on an auto layout edge sets Hug contents, with Alt Fill container (#1838) (#1867) * M2: a double-click on an auto layout edge sets Hug contents, with Alt Fill container (#1838) Co-Authored-By: Claude Fable 5.1 * Auto layout edges: a text child fills with Alt too, and still enters on a plain double-click Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- crates/engine/src/canvas/tools/click.rs | 31 +++++++++++ crates/engine/src/double_click_tests.rs | 74 +++++++++++++++++++++++++ crates/engine/src/keymap.rs | 2 + crates/ui-egui/locales/en.toml | 5 ++ docs/auto-layout-parity.md | 4 +- 5 files changed, 115 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/canvas/tools/click.rs b/crates/engine/src/canvas/tools/click.rs index 0e07b331d..a48b215bc 100644 --- a/crates/engine/src/canvas/tools/click.rs +++ b/crates/engine/src/canvas/tools/click.rs @@ -22,6 +22,29 @@ impl Session { } } + /// A double-click on an edge handle of the one selected layer auto layout sizes: Hug contents + /// on that axis for an auto layout frame, Fill container with Alt for a child of one (a + /// vertical edge sizes the width, a horizontal one the height). Whether it applied: on any + /// other layer, or off the edges, the double-click goes on as before. + fn edge_double_click(&mut self, doc: &Document, sel: &[NodeId], ev: &PointerEvent) -> Result { + let [id] = sel[..] else { return Ok(false) }; + let Some(super::Handle::Edge(edge)) = super::handles::handle_at(doc, sel, ev.p(), ev.zoom) else { return Ok(false) }; + let Some(n) = doc.node(id) else { return Ok(false) }; + let applies = if ev.alt { + !n.child_layout.absolute && n.parent.and_then(|p| doc.node(p)).is_some_and(|p| p.layout.is_some()) + } else { + n.layout.is_some() + }; + if !applies { + return Ok(false); + } + // Edges run top, right, bottom, left: the odd ones are vertical and size the width. + let mut props = serde_json::Map::new(); + props.insert(if edge % 2 == 1 { "sizingH" } else { "sizingV" }.to_string(), json!(if ev.alt { "fill" } else { "hug" })); + self.execute("node.set", &json!({"id": id, "props": props}))?; + Ok(true) + } + pub(super) fn double_click(&mut self, ev: &PointerEvent) -> Result<()> { let ds = self.ds()?; let (doc, sel, page) = (ds.doc.clone(), ds.selection.clone(), ds.page); @@ -61,6 +84,14 @@ impl Session { self.tool.overlay.marquee = None; self.cancel_interaction()?; } + // An edge of an auto layout object's bounding box: Hug contents on that axis, with Alt + // Fill container ("Tip: Double-click the vertical or horizontal edge of an auto layout + // object's bounding box to set it to Hug contents." and "Hold ⌥ Option or Alt and + // double-click the vertical or horizontal edge of an auto layout object's bounding box to + // set it to Fill container.", Guide to auto layout). + if edits && matches!(self.tool.tool, ToolId::Move | ToolId::Scale) && !(ev.shift || ev.cmd) && self.edge_double_click(&doc, &sel, ev)? { + return Ok(()); + } let hit_here = self.hit(&doc, page, ev.p(), ev.tol() * 2.0); // A double-click anywhere on the one selected shape edits its points, like Enter: also // inside a hollow (unfilled) closed shape, where the hit test finds nothing under the diff --git a/crates/engine/src/double_click_tests.rs b/crates/engine/src/double_click_tests.rs index 83ea82fdd..15fbf905c 100644 --- a/crates/engine/src/double_click_tests.rs +++ b/crates/engine/src/double_click_tests.rs @@ -128,3 +128,77 @@ fn a_press_drags_only_past_the_threshold_in_screen_pixels() { assert_eq!(origin(&s, r).2 != 200.0, resizes, "resize by {by}"); } } + +/// A double-click with Alt held throughout, as the canvas sends it. +fn alt_double_click(s: &mut Session, x: f64, y: f64, zoom: f64) { + for kind in [PointerKind::Down, PointerKind::Up, PointerKind::Down, PointerKind::DoubleClick] { + let mut ev = PointerEvent::at(kind, x, y, zoom); + ev.alt = true; + s.pointer(&ev).unwrap(); + } +} + +/// "Tip: Double-click the vertical or horizontal edge of an auto layout object's bounding box to +/// set it to Hug contents." and "Hold ⌥ Option or Alt and double-click the vertical or horizontal +/// edge of an auto layout object's bounding box to set it to Fill container." (Guide to auto +/// layout): a vertical edge sizes the width, a horizontal one the height; a layer auto layout +/// doesn't size keeps the double-click's old meaning. +#[test] +fn a_double_click_on_an_auto_layout_edge_hugs_and_with_alt_fills() { + use figcraft_doc::Sizing; + let mut s = Session::new(); + let f = id_of(&ex(&mut s, "frame.create", json!({"x": 0, "y": 0, "width": 400, "height": 100}))["id"]).unwrap(); + ex(&mut s, "node.set", json!({"id": f, "props": {"layout": "horizontal", "padding": 0, "gap": 0}})); + let c = + id_of(&ex(&mut s, "shape.rectangle", json!({"x": 0, "y": 0, "width": 100, "height": 40, "parent": f, "props": {"fill": "#FF0000"}}))["id"]) + .unwrap(); + let sizing = |s: &Session, id: NodeId| { + let cl = &s.doc().unwrap().node(id).unwrap().child_layout; + (cl.sizing_h, cl.sizing_v) + }; + let size = |s: &Session, id: NodeId| { + let n = s.doc().unwrap().node(id).unwrap(); + (n.width, n.height) + }; + ex(&mut s, "select.set", json!({"ids": [f]})); + assert_eq!((sizing(&s, f), size(&s, f)), ((Sizing::Fixed, Sizing::Fixed), (400.0, 100.0))); + // The frame's right edge: Hug contents horizontally, and the frame shrinks onto its child. + double_click(&mut s, 400.0, 50.0, 0.0, 1.0); + assert_eq!(sizing(&s, f), (Sizing::Hug, Sizing::Fixed)); + assert_eq!(size(&s, f), (100.0, 100.0)); + assert_eq!(s.selection(), [f], "still selected, not entered"); + s.undo().unwrap(); + assert_eq!((sizing(&s, f), size(&s, f)), ((Sizing::Fixed, Sizing::Fixed), (400.0, 100.0)), "one undo step"); + // Its bottom edge: Hug contents vertically. + double_click(&mut s, 200.0, 100.0, 0.0, 1.0); + assert_eq!(sizing(&s, f), (Sizing::Fixed, Sizing::Hug)); + assert_eq!(size(&s, f), (400.0, 40.0)); + // Alt on the child's right edge: Fill container horizontally, and the child takes the width. + ex(&mut s, "select.set", json!({"ids": [c]})); + alt_double_click(&mut s, 100.0, 20.0, 1.0); + assert_eq!(sizing(&s, c), (Sizing::Fill, Sizing::Fixed)); + assert_eq!(size(&s, c), (400.0, 40.0)); + // Without Alt the child, no auto layout frame itself, keeps the old meaning (a frame's + // double-click: nothing to enter here), and a plain rectangle's edge still edits its points. + double_click(&mut s, 400.0, 20.0, 0.0, 1.0); + assert_eq!(sizing(&s, c), (Sizing::Fill, Sizing::Fixed)); + // A text child of the frame: Alt+double-click on its edge sets Fill like any child's, and a + // plain double-click on its edge still enters the text. + let x = id_of(&ex(&mut s, "text.create", json!({"text": "Hi", "x": 0, "y": 0, "parent": f, "props": {"fontSize": 16}}))["id"]).unwrap(); + ex(&mut s, "node.set", json!({"id": x, "props": {"textAutoResize": "none", "width": 60, "height": 20}})); + ex(&mut s, "select.set", json!({"ids": [x]})); + let b = s.doc().unwrap().world_bounds(x).unwrap(); + alt_double_click(&mut s, b.x1, (b.y0 + b.y1) / 2.0, 1.0); + assert_eq!(sizing(&s, x), (Sizing::Fill, Sizing::Fixed), "a text child fills too"); + let b = s.doc().unwrap().world_bounds(x).unwrap(); + // On the edge handle, a pixel in (the hit test's reach): the text, not the frame edge it shares. + double_click(&mut s, b.x1 - 1.0, (b.y0 + b.y1) / 2.0, 0.0, 1.0); + assert!(s.ds().unwrap().text_edit.as_ref().is_some_and(|te| te.id == x), "a text's edge still enters it without Alt"); + assert_eq!(sizing(&s, x), (Sizing::Fill, Sizing::Fixed)); + crate::textedit::end(&mut s).unwrap(); + let r = id_of(&ex(&mut s, "shape.rectangle", json!({"x": 0, "y": 300, "width": 100, "height": 100}))["id"]).unwrap(); + ex(&mut s, "select.set", json!({"ids": [r]})); + double_click(&mut s, 99.0, 350.0, 0.0, 1.0); + assert_eq!(sizing(&s, r), (Sizing::Fixed, Sizing::Fixed)); + assert!(s.ds().unwrap().vector_edit.is_some(), "a shape's double-click still edits its points"); +} diff --git a/crates/engine/src/keymap.rs b/crates/engine/src/keymap.rs index a0f0bc4b6..fb7713e66 100644 --- a/crates/engine/src/keymap.rs +++ b/crates/engine/src/keymap.rs @@ -364,6 +364,8 @@ pub static GESTURES: &[(Group, &str, &str, &str)] = &[ (Transform, "Opacity 10%…90%, 0: 100%", "1…9, 0", "1…9, 0"), (Transform, "Exact opacity (4 then 5: 45%)", "Two digits", "Two digits"), (Transform, "Suspend snapping while dragging", "Hold ⌃ or ⌘", "Hold Ctrl"), + (Arrange, "Set hug contents", "Double-click an edge of an auto layout frame", "Double-click an edge of an auto layout frame"), + (Arrange, "Set fill container", "⌥ double-click an edge of an auto layout child", "Alt+double-click an edge of an auto layout child"), (Prototype, "Presenting: next frame", "→, Space or N", "→, Space or N"), (Prototype, "Presenting: previous frame", "←", "←"), (Prototype, "Presenting: restart", "R", "R"), diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index c44635a2a..034e3381a 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -407,6 +407,11 @@ name = "English" "Decoration style" = "Decoration style" "Decoration" = "Decoration" "Deep select" = "Deep select" +"Set hug contents" = "Set hug contents" +"Set fill container" = "Set fill container" +"Double-click an edge of an auto layout frame" = "Double-click an edge of an auto layout frame" +"⌥ double-click an edge of an auto layout child" = "⌥ double-click an edge of an auto layout child" +"Alt+double-click an edge of an auto layout child" = "Alt+double-click an edge of an auto layout child" "Default" = "Default" "Default content" = "Default content" "Default value (the top-left variant)" = "Default value (the top-left variant)" diff --git a/docs/auto-layout-parity.md b/docs/auto-layout-parity.md index 61462a2c1..3ddd0072a 100644 --- a/docs/auto-layout-parity.md +++ b/docs/auto-layout-parity.md @@ -1,6 +1,6 @@ # Auto layout and constraints parity -> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-11-02 · **Change:** patch (fill children share the free space by their content area, border-box fashion, as the Flexbox article says (#1824); a text keeps a max height or a number of max lines, not both, as the Guide to auto layout says: a max height sets max lines to Auto and max lines remove the max height; Remove all auto layout, as the help center's More layout options has it: `layout.removeAll` takes the auto layout off a frame and every frame nested in it in one undo step; grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); Layout sidebar: Add auto layout (+) is available for groups and converts a single group to a frame in place, with mask order, flow-only inference and Fill sizing preserved; adding auto layout to an empty frame keeps its size (#369); `node.set` applies auto layout keys only to frames, with warnings (#603); core editor leftovers: auto gap handles, wrapped-line alignment; behaviour suite written from the public documentation, every rule's status; fixes and the missing settings it found) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-11-02 · **Change:** patch (fill children share the free space by their content area, border-box fashion, as the Flexbox article says (#1824); double-click an edge of an auto layout frame's box for Hug contents, Alt+double-click an edge of a child's box for Fill container, as the Guide to auto layout says (#1838); a text keeps a max height or a number of max lines, not both, as the Guide to auto layout says: a max height sets max lines to Auto and max lines remove the max height; Remove all auto layout, as the help center's More layout options has it: `layout.removeAll` takes the auto layout off a frame and every frame nested in it in one undo step; grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); Layout sidebar: Add auto layout (+) is available for groups and converts a single group to a frame in place, with mask order, flow-only inference and Fill sizing preserved; adding auto layout to an empty frame keeps its size (#369); `node.set` applies auto layout keys only to frames, with warnings (#603); core editor leftovers: auto gap handles, wrapped-line alignment; behaviour suite written from the public documentation, every rule's status; fixes and the missing settings it found) · **Target:** Figma Design (desktop app 126.10.7) Auto layout is the most used layout feature in Figma and the one where small differences (a hugging frame one pixel off, text wrapping at another width) break real files. **Breadth ~98%, @@ -41,6 +41,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Fill children share by their content area (border-box): a child with more padding or a thicker included inside stroke takes a little more, so the content areas come out the same | **fixed** | "Figma distributes space amongst fill container children by the children's content area instead of by their size, matching the CSS border-box model. A layer with a thicker stroke will take up slightly more of the available width or height, so that its inner content area matches its sibling's" (Use auto layout with CSS Flexbox in mind); the split went by outer size before. Min and max still clamp the outer size; a child's own insets are its padding and its included inside stroke (`nested_tests::fill_children_share_by_content_area`; #1824) | | Fill on a child turns its hugging parent Fixed on that axis | pass | `al_behaviour_tests::fill_on_a_child_turns_the_hugging_parent_fixed` | | Hug only on auto layout frames (and text); Fill only in an auto layout flow, never on a top-level frame | pass | `al_behaviour_tests::hug_and_fill_only_where_they_apply` | +| Double-click an edge of an auto layout frame's box: Hug contents on that axis; Alt+double-click an edge of a child's box: Fill container | **fixed** | "Tip: Double-click the vertical or horizontal edge of an auto layout object's bounding box to set it to Hug contents."; "Hold ⌥ Option or Alt and double-click the vertical or horizontal edge of an auto layout object's bounding box to set it to Fill container." A vertical edge sizes the width, a horizontal one the height; any other layer keeps the double-click's old meaning (#1838). `double_click_tests::a_double_click_on_an_auto_layout_edge_hugs_and_with_alt_fills` | | Min/max width and height bound Hug, Fill and Fixed sizes, on frames and children | pass | `sizing_rules`; a fill child at its max leaves the rest to the other fill children (silent on redistribution: CSS flexbox) | | A hugging text wider than its max width wraps at the max | pass | `sizing_rules` | | A text has a max height or a number of max lines, not both: a max height sets max lines to Auto, a number of max lines removes the max height | **fixed** | both coexisted; `node.set {maxHeight}` and `{maxLines}` and `text.maxLines` keep one of the two (a frame's max height is untouched); `text_behaviour_tests::a_text_has_a_max_height_or_max_lines_not_both` | @@ -99,6 +100,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Date | Change | Summary | |---|---|---| | 2026-11-02 | patch | M2, #1824: fill container children share the free space by their content area: each one's own insets (padding and an included inside stroke, from the same `insets` the frame uses) come off the free space before the equal split and go back on its share, so a child with more padding or a thicker inside stroke takes a little more and the content areas match ("Figma distributes space amongst fill container children by the children's content area instead of by their size, matching the CSS border-box model", Use auto layout with CSS Flexbox in mind). Min and max still clamp the outer sizes and the frozen-share loop is as it was; children without insets split as before. Test: `nested_tests::fill_children_share_by_content_area` | +| 2026-11-02 | patch | M2, #1838: a double-click on an edge of an auto layout frame's bounding box sets Hug contents on that axis, Alt+double-click on an edge of a child's Fill container ("Double-click the vertical or horizontal edge of an auto layout object's bounding box to set it to Hug contents", "Hold ⌥ Option or Alt and double-click ... to set it to Fill container", Guide to auto layout); a vertical edge sizes the width, a horizontal one the height; the Keyboard shortcuts panel lists both gestures. Test: `double_click_tests::a_double_click_on_an_auto_layout_edge_hugs_and_with_alt_fills`. Numbers unchanged. | | 2026-11-01 | patch | M2: a text layer keeps a max height or a number of max lines, not both ("Text layers cannot have both a max height and a set number of max lines", Guide to auto layout): `node.set {maxHeight}` on a text sets its max lines to Auto, and `node.set {maxLines}` or `text.maxLines` with a number removes its max height. Found by a documentation audit of this page. Test: `text_behaviour_tests::a_text_has_a_max_height_or_max_lines_not_both`. Numbers unchanged | | 2026-11-01 | minor | M2: Remove all auto layout ("To remove auto layout from a frame and all of its nested objects at once, right-click on the frame and go to More layout options > Remove all auto layout", Toggle on auto layout in designs): `layout.removeAll {ids?}` strips the frames and every frame nested in them in one undo step, leaving instances and their layers alone; in the canvas context menu beside Add auto layout and in the Actions palette. Found by a documentation audit of this page. Test: `al_nesting_tests::remove_all_auto_layout_strips_the_frame_and_every_frame_nested_in_it`. Numbers unchanged | | 2026-10-30 | minor | M8, #1083: grid placement finds free cells on a bitmap, a word at a time, with the same placements; crafted grids of wide children no longer stall a layout pass. Numbers unchanged. | From f9d507f7b0bccf4a8818be9520c670207d77cc5e Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 2 Nov 2026 05:31:11 -0500 Subject: [PATCH 30/49] M2: a child resized to the full available space of its auto layout frame becomes Fill container (#1859) * M2: a child resized to the full available space of its auto layout frame becomes Fill container Co-Authored-By: Claude Fable 5.1 * Auto layout: a child becomes Fill for the full space only across the flow or alone along it Co-Authored-By: Claude Fable 5.1 * Auto layout: the full available space is what layout leaves (padding and an included inside stroke), judged after a new path's size Co-Authored-By: Claude Fable 5.1 * M2: a rotated child resized to the frame's room stays Fixed (review) CodeRabbit on #1859: a rotated layer's local size isn't the room layout gives it, so Fill would squash its geometry. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- crates/engine/src/al_behaviour_tests.rs | 60 ++++++++++++++++++++++++ crates/engine/src/cmd/arrange.rs | 13 +++--- crates/engine/src/cmd/props.rs | 61 +++++++++++++++++++++---- crates/layout/src/lib.rs | 5 +- docs/auto-layout-parity.md | 4 +- 5 files changed, 126 insertions(+), 17 deletions(-) diff --git a/crates/engine/src/al_behaviour_tests.rs b/crates/engine/src/al_behaviour_tests.rs index d36b35b8f..514a39fdc 100644 --- a/crates/engine/src/al_behaviour_tests.rs +++ b/crates/engine/src/al_behaviour_tests.rs @@ -72,6 +72,52 @@ fn fill_on_a_child_turns_the_hugging_parent_fixed() { assert_eq!(sizing(&s, f), (Sizing::Hug, Sizing::Hug)); } +#[test] +fn a_child_resized_to_the_full_available_space_becomes_fill() { + // Documented: "Child objects of an auto layout frame will also be set to Fill container if + // they are manually resized to the full available space of the parent frame." + let mut s = Session::new(); + let f = al_frame(&mut s, json!({"padding": 10, "gap": 10})); // 200 × 100, fixed + let a = rect(&mut s, f, 50.0, 20.0, "#FF0000"); + // Along the flow, alone in the frame: its width less the padding (200 - 20). + s.execute("transform.resize", &json!({"ids": [a], "width": 180})).unwrap(); + assert_eq!(sizing(&s, a), (Sizing::Fill, Sizing::Fixed)); + assert_eq!(size(&s, a), (180.0, 20.0)); + s.undo().unwrap(); + assert_eq!(sizing(&s, a), (Sizing::Fixed, Sizing::Fixed), "undone as part of the edit"); + // Across the flow, beside a sibling too: the frame's height less its padding. + let b = rect(&mut s, f, 50.0, 20.0, "#0000FF"); + set(&mut s, b, json!({"height": 80})); + assert_eq!(sizing(&s, b), (Sizing::Fixed, Sizing::Fill)); + assert_eq!(size(&s, b), (50.0, 80.0)); + // Short of it: fixed, as before. + set(&mut s, b, json!({"height": 70})); + assert_eq!(sizing(&s, b), (Sizing::Fixed, Sizing::Fixed)); + // Along the flow beside a sibling, what is left is not "the full available space": a width + // that happens to match it (180 - 10 - 50) stays fixed. + s.execute("transform.resize", &json!({"ids": [b], "width": 120})).unwrap(); + assert_eq!(sizing(&s, b), (Sizing::Fixed, Sizing::Fixed)); + // A hugging frame has no full space to offer: the child stays fixed. + let g = al_frame(&mut s, json!({"sizingH": "hug", "sizingV": "hug", "padding": 10})); + let c = rect(&mut s, g, 50.0, 20.0, "#00FF00"); + set(&mut s, c, json!({"width": 180})); + assert_eq!(sizing(&s, c), (Sizing::Fixed, Sizing::Fixed)); + // An inside stroke the layout includes takes room like the padding: the full space is what + // layout leaves the child (200 - 2 × 10 - 2 × 4), not the frame less its padding alone. + let h = al_frame(&mut s, json!({"padding": 10, "strokesIncluded": true, "stroke": "#000000", "strokeWeight": 4, "strokeAlign": "inside"})); + let d = rect(&mut s, h, 50.0, 20.0, "#FF0000"); + set(&mut s, d, json!({"width": 180})); + assert_eq!(sizing(&s, d), (Sizing::Fixed, Sizing::Fixed), "wider than the room the stroke leaves"); + assert_eq!(size(&s, d), (180.0, 20.0), "and kept as typed"); + set(&mut s, d, json!({"width": 172})); + assert_eq!(sizing(&s, d), (Sizing::Fill, Sizing::Fixed)); + assert_eq!(size(&s, d), (172.0, 20.0)); + // Excluded from the layout, the stroke takes no room: the frame less its padding again. + set(&mut s, h, json!({"strokesIncluded": false})); + set(&mut s, d, json!({"width": 172})); + assert_eq!(sizing(&s, d), (Sizing::Fixed, Sizing::Fixed)); +} + #[test] fn hug_and_fill_only_where_they_apply() { // Documented: Hug applies to auto layout frames (and text); Fill to children of auto layout, @@ -232,6 +278,20 @@ fn a_size_given_with_a_new_path_fixes_that_axis() { set(&mut s, v, json!({"path": "M0 0 L20 5", "width": 30})); assert_eq!(sizing(&s, v).0, Sizing::Fixed); assert!((size(&s, v).0 - 30.0).abs() < 1e-6, "{:?}", size(&s, v)); + // The axis is judged by the size the path is given, not the one before it: the frame's full + // height (100) given with a path fills; a smaller height given with the next path is fixed, + // though the layer filled the frame until then. + set(&mut s, v, json!({"path": "M0 0 L20 5", "height": 100})); + assert_eq!(sizing(&s, v).1, Sizing::Fill); + assert!((size(&s, v).1 - 100.0).abs() < 1e-6, "{:?}", size(&s, v)); + set(&mut s, v, json!({"height": 40, "path": "M0 0 L20 5"})); + assert_eq!(sizing(&s, v).1, Sizing::Fixed); + assert!((size(&s, v).1 - 40.0).abs() < 1e-6, "{:?}", size(&s, v)); + // Rotated, the layer's local size isn't the room layout gives it: a height matching the + // frame's stays fixed rather than have Fill squash the path. + set(&mut s, v, json!({"rotation": 90})); + set(&mut s, v, json!({"path": "M0 0 L20 5", "height": 100})); + assert_eq!(sizing(&s, v).1, Sizing::Fixed); } /// What one call's auto layout keys give, whichever way they are spelled: the mode (a string, or diff --git a/crates/engine/src/cmd/arrange.rs b/crates/engine/src/cmd/arrange.rs index 19572c959..b90cf1d1f 100644 --- a/crates/engine/src/cmd/arrange.rs +++ b/crates/engine/src/cmd/arrange.rs @@ -569,12 +569,6 @@ pub(crate) fn resize_cmd(s: &mut Session, p: &Value) -> Result { let n = doc.get_mut(i)?; let after = n.transform * Point::new(w * ax, h * ay); n.transform = Affine::translate(before - after) * n.transform; - if num(p, "width").is_some() { - n.child_layout.sizing_h = Sizing::Fixed; - } - if num(p, "height").is_some() { - n.child_layout.sizing_v = Sizing::Fixed; - } if let NodeKind::Text(t) = &mut n.kind { if num(p, "height").is_some() { t.fix_size(num(p, "width").is_some(), true); @@ -582,6 +576,13 @@ pub(crate) fn resize_cmd(s: &mut Session, p: &Value) -> Result { t.auto_resize = TextAutoResize::Height; } } + // A side given is fixed, or fills its auto layout parent when it is the full space there. + if num(p, "width").is_some() { + super::props::fix_axis(doc, i, true)?; + } + if num(p, "height").is_some() { + super::props::fix_axis(doc, i, false)?; + } super::props::restore_worlds(doc, &kept)?; } super::styles::detach_edited(doc, &before); diff --git a/crates/engine/src/cmd/props.rs b/crates/engine/src/cmd/props.rs index fbf80fc1b..01f83bc85 100644 --- a/crates/engine/src/cmd/props.rs +++ b/crates/engine/src/cmd/props.rs @@ -437,17 +437,55 @@ fn layout_keys_beside_none(cmd: &str, props: &Map) -> Result<()> } /// An explicit width (`is_w`) or height makes hugging or filling on that axis fixed, like typing -/// into W or H. -fn fix_axis(doc: &mut Document, id: NodeId, is_w: bool) -> Result<()> { +/// into W or H; sized to the full space its auto layout parent has for it on that axis, the layer +/// fills instead: "Child objects of an auto layout frame will also be set to Fill container if +/// they are manually resized to the full available space of the parent frame" (Guide to auto +/// layout). +pub(crate) fn fix_axis(doc: &mut Document, id: NodeId, is_w: bool) -> Result<()> { + let sizing = if fills_available_space(doc, id, is_w) { Sizing::Fill } else { Sizing::Fixed }; let n = doc.get_mut(id)?; if is_w { - n.child_layout.sizing_h = Sizing::Fixed; + n.child_layout.sizing_h = sizing; } else { - n.child_layout.sizing_v = Sizing::Fixed; + n.child_layout.sizing_v = sizing; } Ok(()) } +/// Whether `id`'s width (`is_w`) or height is the full space its auto layout parent has for it on +/// that axis: the frame's size less its padding and an inside stroke included in the layout (the +/// insets layout itself takes). Across the flow that is every child's room; +/// along the flow only a lone child has it (beside siblings what is left depends on the gaps, the +/// alignment and overflow, so a size that happens to match it is not "the full available +/// space"). Never in a hugging or wrapping frame or a grid, or for a layer that ignores the layout. +fn fills_available_space(doc: &Document, id: NodeId, is_w: bool) -> bool { + let Some(n) = doc.node(id) else { return false }; + let Some(parent) = n.parent.and_then(|p| doc.node(p)) else { return false }; + let Some(l) = &parent.layout else { return false }; + if n.child_layout.absolute || l.wrap || l.mode == LayoutMode::Grid { + return false; + } + // A rotated layer's local size isn't the size layout gives it room for (its rotated bounds + // are): it stays Fixed rather than have Fill squash its geometry. + let [_, b, c, ..] = n.transform.as_coeffs(); + if b.abs() > 1e-9 || c.abs() > 1e-9 { + return false; + } + let hugs = if is_w { parent.child_layout.sizing_h } else { parent.child_layout.sizing_v } == Sizing::Hug; + if hugs { + return false; + } + if (l.mode == LayoutMode::Horizontal) == is_w + && parent.children.iter().filter(|c| **c != id).filter_map(|c| doc.node(*c)).any(|c| c.visible && !c.child_layout.absolute) + { + return false; + } + let (pt, pr, pb, pl) = figcraft_layout::insets(parent, l); + let available = if is_w { parent.width - pl - pr } else { parent.height - pt - pb }; + let size = if is_w { n.width } else { n.height }; + available > 0.0 && (size - available).abs() < 0.01 +} + /// The `geometry` properties of `apply`; `false` when `k` is not one of them. fn apply_geometry( cmd: &str, @@ -459,10 +497,17 @@ fn apply_geometry( path_offset: &mut (f64, f64), ) -> Result { match k { - "path" => *path_offset = set_path(cmd, doc, id, v, props)?, - // A new path takes the size asked for as its scale (`set_path`); the size still fixes - // its auto layout axis. - "width" | "height" | "w" | "h" if props.contains_key("path") => fix_axis(doc, id, k.starts_with('w'))?, + "path" => { + *path_offset = set_path(cmd, doc, id, v, props)?; + // A size given beside the path is its scale (`set_path`), and still fixes or fills + // its auto layout axis, judged once the path has given the layer that size. + for (long, short, is_w) in [("width", "w", true), ("height", "h", false)] { + if props.contains_key(long) || props.contains_key(short) { + fix_axis(doc, id, is_w)?; + } + } + } + "width" | "height" | "w" | "h" if props.contains_key("path") => {} "x" | "y" => { let val = f64_of(v).ok_or_else(|| bad(cmd, format!("`{k}` must be a number")))?; let val = val + if k == "x" { path_offset.0 } else { path_offset.1 }; diff --git a/crates/layout/src/lib.rs b/crates/layout/src/lib.rs index 56f4bf625..19de84afb 100644 --- a/crates/layout/src/lib.rs +++ b/crates/layout/src/lib.rs @@ -216,8 +216,9 @@ fn coherent_own_sizing(doc: &mut Document, id: NodeId) -> bool { /// Padding `(top, right, bottom, left)` of an auto layout frame, sanitised, plus the frame's own /// inside stroke (per side) when strokes are included in the layout; center and outside strokes -/// never take up space. -fn insets(f: &figcraft_doc::Node, al: &AutoLayout) -> (f64, f64, f64, f64) { +/// never take up space. The frame's size less these is its children's room, the "full available +/// space" a child resized to it fills. +pub fn insets(f: &figcraft_doc::Node, al: &AutoLayout) -> (f64, f64, f64, f64) { let included = al.strokes_included && f.has_visible_stroke() && f.stroke.align == StrokeAlign::Inside; let stroke = if included { f.stroke.sides.unwrap_or([f.stroke.weight; 4]) } else { [0.0; 4] }; let [pt, pr, pb, pl] = al.padding.map(|p| finite_or_zero(p).max(0.0)); diff --git a/docs/auto-layout-parity.md b/docs/auto-layout-parity.md index 3ddd0072a..3b5466b2c 100644 --- a/docs/auto-layout-parity.md +++ b/docs/auto-layout-parity.md @@ -1,6 +1,6 @@ # Auto layout and constraints parity -> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-11-02 · **Change:** patch (fill children share the free space by their content area, border-box fashion, as the Flexbox article says (#1824); double-click an edge of an auto layout frame's box for Hug contents, Alt+double-click an edge of a child's box for Fill container, as the Guide to auto layout says (#1838); a text keeps a max height or a number of max lines, not both, as the Guide to auto layout says: a max height sets max lines to Auto and max lines remove the max height; Remove all auto layout, as the help center's More layout options has it: `layout.removeAll` takes the auto layout off a frame and every frame nested in it in one undo step; grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); Layout sidebar: Add auto layout (+) is available for groups and converts a single group to a frame in place, with mask order, flow-only inference and Fill sizing preserved; adding auto layout to an empty frame keeps its size (#369); `node.set` applies auto layout keys only to frames, with warnings (#603); core editor leftovers: auto gap handles, wrapped-line alignment; behaviour suite written from the public documentation, every rule's status; fixes and the missing settings it found) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-11-02 · **Change:** patch (fill children share the free space by their content area, border-box fashion, as the Flexbox article says (#1824); double-click an edge of an auto layout frame's box for Hug contents, Alt+double-click an edge of a child's box for Fill container, as the Guide to auto layout says (#1838); a child resized to the full available space of its auto layout frame becomes Fill container on that axis, as the Guide to auto layout says; a text keeps a max height or a number of max lines, not both, as the Guide to auto layout says: a max height sets max lines to Auto and max lines remove the max height; Remove all auto layout, as the help center's More layout options has it: `layout.removeAll` takes the auto layout off a frame and every frame nested in it in one undo step; grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); Layout sidebar: Add auto layout (+) is available for groups and converts a single group to a frame in place, with mask order, flow-only inference and Fill sizing preserved; adding auto layout to an empty frame keeps its size (#369); `node.set` applies auto layout keys only to frames, with warnings (#603); core editor leftovers: auto gap handles, wrapped-line alignment; behaviour suite written from the public documentation, every rule's status; fixes and the missing settings it found) · **Target:** Figma Design (desktop app 126.10.7) Auto layout is the most used layout feature in Figma and the one where small differences (a hugging frame one pixel off, text wrapping at another width) break real files. **Breadth ~98%, @@ -40,6 +40,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Fill: children share the space left after padding, gaps and fixed siblings; across the flow they stretch | pass | `sizing_rules` | | Fill children share by their content area (border-box): a child with more padding or a thicker included inside stroke takes a little more, so the content areas come out the same | **fixed** | "Figma distributes space amongst fill container children by the children's content area instead of by their size, matching the CSS border-box model. A layer with a thicker stroke will take up slightly more of the available width or height, so that its inner content area matches its sibling's" (Use auto layout with CSS Flexbox in mind); the split went by outer size before. Min and max still clamp the outer size; a child's own insets are its padding and its included inside stroke (`nested_tests::fill_children_share_by_content_area`; #1824) | | Fill on a child turns its hugging parent Fixed on that axis | pass | `al_behaviour_tests::fill_on_a_child_turns_the_hugging_parent_fixed` | +| A child resized to the full available space becomes Fill container on that axis | **fixed** | "Child objects of an auto layout frame will also be set to Fill container if they are manually resized to the full available space of the parent frame": a width or height given by a resize, the W/H fields or a canvas handle that equals the frame's size less its padding sets Fill there: across the flow for any child, along the flow for a lone child (beside siblings what is left depends on the gaps, the alignment and overflow, so it is left alone); not in a hugging or wrapping frame or a grid. It stayed Fixed before (`al_behaviour_tests::a_child_resized_to_the_full_available_space_becomes_fill`) | | Hug only on auto layout frames (and text); Fill only in an auto layout flow, never on a top-level frame | pass | `al_behaviour_tests::hug_and_fill_only_where_they_apply` | | Double-click an edge of an auto layout frame's box: Hug contents on that axis; Alt+double-click an edge of a child's box: Fill container | **fixed** | "Tip: Double-click the vertical or horizontal edge of an auto layout object's bounding box to set it to Hug contents."; "Hold ⌥ Option or Alt and double-click the vertical or horizontal edge of an auto layout object's bounding box to set it to Fill container." A vertical edge sizes the width, a horizontal one the height; any other layer keeps the double-click's old meaning (#1838). `double_click_tests::a_double_click_on_an_auto_layout_edge_hugs_and_with_alt_fills` | | Min/max width and height bound Hug, Fill and Fixed sizes, on frames and children | pass | `sizing_rules`; a fill child at its max leaves the rest to the other fill children (silent on redistribution: CSS flexbox) | @@ -101,6 +102,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver |---|---|---| | 2026-11-02 | patch | M2, #1824: fill container children share the free space by their content area: each one's own insets (padding and an included inside stroke, from the same `insets` the frame uses) come off the free space before the equal split and go back on its share, so a child with more padding or a thicker inside stroke takes a little more and the content areas match ("Figma distributes space amongst fill container children by the children's content area instead of by their size, matching the CSS border-box model", Use auto layout with CSS Flexbox in mind). Min and max still clamp the outer sizes and the frozen-share loop is as it was; children without insets split as before. Test: `nested_tests::fill_children_share_by_content_area` | | 2026-11-02 | patch | M2, #1838: a double-click on an edge of an auto layout frame's bounding box sets Hug contents on that axis, Alt+double-click on an edge of a child's Fill container ("Double-click the vertical or horizontal edge of an auto layout object's bounding box to set it to Hug contents", "Hold ⌥ Option or Alt and double-click ... to set it to Fill container", Guide to auto layout); a vertical edge sizes the width, a horizontal one the height; the Keyboard shortcuts panel lists both gestures. Test: `double_click_tests::a_double_click_on_an_auto_layout_edge_hugs_and_with_alt_fills`. Numbers unchanged. | +| 2026-11-02 | patch | M2: a child of an auto layout frame resized to the full space available to it on an axis (the frame's size less its padding: across the flow for any child, along the flow for a lone child) becomes Fill container on that axis, whether by `transform.resize`, the W/H fields or a canvas handle ("Child objects of an auto layout frame will also be set to Fill container if they are manually resized to the full available space of the parent frame", Guide to auto layout). Any other size keeps the axis Fixed as before; beside siblings along the flow, in a hugging or wrapping frame, in a grid and for a layer that ignores the layout nothing changes. Test: `al_behaviour_tests::a_child_resized_to_the_full_available_space_becomes_fill` | | 2026-11-01 | patch | M2: a text layer keeps a max height or a number of max lines, not both ("Text layers cannot have both a max height and a set number of max lines", Guide to auto layout): `node.set {maxHeight}` on a text sets its max lines to Auto, and `node.set {maxLines}` or `text.maxLines` with a number removes its max height. Found by a documentation audit of this page. Test: `text_behaviour_tests::a_text_has_a_max_height_or_max_lines_not_both`. Numbers unchanged | | 2026-11-01 | minor | M2: Remove all auto layout ("To remove auto layout from a frame and all of its nested objects at once, right-click on the frame and go to More layout options > Remove all auto layout", Toggle on auto layout in designs): `layout.removeAll {ids?}` strips the frames and every frame nested in them in one undo step, leaving instances and their layers alone; in the canvas context menu beside Add auto layout and in the Actions palette. Found by a documentation audit of this page. Test: `al_nesting_tests::remove_all_auto_layout_strips_the_frame_and_every_frame_nested_in_it`. Numbers unchanged | | 2026-10-30 | minor | M8, #1083: grid placement finds free cells on a bitmap, a word at a time, with the same placements; crafted grids of wide children no longer stall a layout pass. Numbers unchanged. | From 1f0acd2bbd31148898ee514dbdc63598c183d2a4 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 2 Nov 2026 05:31:21 -0500 Subject: [PATCH 31/49] M4: Alt+Enter while editing text opens the link at the caret (text.openLink) (#1860) Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- crates/engine/src/cmd/text.rs | 26 ++++++++++ crates/engine/src/keymap.rs | 1 + crates/engine/src/lib.rs | 2 + crates/engine/src/shortcut_parity_tests.rs | 3 +- crates/engine/src/text_link_tests.rs | 42 +++++++++++++++ crates/ui-egui/src/app/commands.rs | 7 +++ crates/ui-egui/src/lib.rs | 2 + crates/ui-egui/src/text_link_tests.rs | 60 ++++++++++++++++++++++ docs/ui-parity.md | 9 ++-- 9 files changed, 147 insertions(+), 5 deletions(-) create mode 100644 crates/engine/src/text_link_tests.rs create mode 100644 crates/ui-egui/src/text_link_tests.rs diff --git a/crates/engine/src/cmd/text.rs b/crates/engine/src/cmd/text.rs index 446b01d29..f72f215ee 100644 --- a/crates/engine/src/cmd/text.rs +++ b/crates/engine/src/cmd/text.rs @@ -521,6 +521,32 @@ pub fn specs() -> Vec { textedit::end(s)?; ok() }), + spec!( + "text.openLink", + "Open link", + "{} while editing: the link at the caret (the selection's start) goes to the UI to open, as Alt+Enter does (\"press Option Return / Alt Enter to activate a focused link\"); only a web or mail link opens → {url} ({url: null}: no link there)", + false, + |s, _| { + let Some(te) = s.ds()?.text_edit.clone() else { return Err(bad("text.openLink", "no text is being edited")) }; + let doc = s.doc()?; + let t = doc.node(te.id).and_then(|n| n.kind.text()).ok_or_else(|| bad("text.openLink", format!("{} is not text", te.id)))?; + let n = t.char_count(); + let at = te.caret.min(te.anchor); + // The caret sits between two chars: the link of the one after it, else before it. + let link = (at < n) + .then(|| t.style_at(at).link.clone()) + .flatten() + .or_else(|| (at > 0 && at <= n).then(|| t.style_at(at - 1).link.clone()).flatten()); + match link { + Some(url) if crate::doc_urls::openable(&url) => { + s.request_ui("open.url", json!({"url": url})); + Ok(json!({"url": url})) + } + Some(url) => Err(bad("text.openLink", format!("`{url}` is not a web or mail link"))), + None => Ok(json!({"url": Value::Null})), + } + } + ), spec!( "text.fonts", "List fonts", diff --git a/crates/engine/src/keymap.rs b/crates/engine/src/keymap.rs index fb7713e66..4f55fa4ad 100644 --- a/crates/engine/src/keymap.rs +++ b/crates/engine/src/keymap.rs @@ -247,6 +247,7 @@ pub static KEYS: &[Binding] = &[ // Text (on selected text layers, and on the selected characters while editing) k(Text, "text.bold", &["Cmd+B"]).both(), k(Text, "text.italic", &["Cmd+I"]).both(), + k(Text, "text.openLink", &["Alt+Enter"]).both(), k(Text, "text.underline", &["Cmd+U"]).both(), k(Text, "text.strikethrough", &["Shift+Cmd+X"]).both(), k(Text, "text.link", &["Shift+Cmd+U", "Cmd+K"]).text(), diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 0da532b25..e919444e2 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -565,6 +565,8 @@ mod text_behaviour_tests; #[cfg(test)] mod text_fill_tests; #[cfg(test)] +mod text_link_tests; +#[cfg(test)] mod text_metrics_local_tests; #[cfg(test)] mod text_motion_tests; diff --git a/crates/engine/src/shortcut_parity_tests.rs b/crates/engine/src/shortcut_parity_tests.rs index 0b9b573af..31ce9d18e 100644 --- a/crates/engine/src/shortcut_parity_tests.rs +++ b/crates/engine/src/shortcut_parity_tests.rs @@ -181,6 +181,7 @@ static ROWS: &[Row] = &[ pin(Zoom, "view.nextFrame", &["N", "End"], &[]), // Text doc(Text, "Bold", &["Cmd+B"], &[], Bound("text.bold"), ""), + doc(Text, "Activate a focused link", &["Alt+Enter"], &[], Bound("text.openLink"), "while editing: the link at the caret; web and mail links only"), doc(Text, "Italic", &["Cmd+I"], &[], Bound("text.italic"), ""), doc(Text, "Underline", &["Cmd+U"], &[], Bound("text.underline"), ""), doc(Text, "Strikethrough", &["Shift+Cmd+X"], &[], Bound("text.strikethrough"), ""), @@ -412,7 +413,7 @@ fn counts_match_the_docs() { let reserved = documented.iter().filter(|r| !r.reserved.is_empty()).count(); let pinned = ROWS.len() - documented.len(); // docs/ui-parity.md quotes these. - assert_eq!((documented.len(), bound, moved, missing, reserved, pinned), (133, 132, 1, 0, 2, 57)); + assert_eq!((documented.len(), bound, moved, missing, reserved, pinned), (134, 133, 1, 0, 2, 57)); } #[test] diff --git a/crates/engine/src/text_link_tests.rs b/crates/engine/src/text_link_tests.rs new file mode 100644 index 000000000..df0748996 --- /dev/null +++ b/crates/engine/src/text_link_tests.rs @@ -0,0 +1,42 @@ +//! Alt+Enter while editing text activates the link at the caret ("When editing text, press +//! ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma): `text.openLink` +//! hands a web or mail link at the caret to the UI, refuses other schemes, and does nothing where +//! there is no link. + +use serde_json::json; + +use crate::Session; +use crate::params::id_of; + +#[test] +fn the_link_at_the_caret_goes_to_the_ui_and_only_a_web_or_mail_link() { + let mut s = Session::new(); + let t = id_of(&s.execute("text.create", &json!({"text": "See the docs now", "x": 0, "y": 0})).unwrap()["id"]).unwrap(); + s.execute("text.style", &json!({"id": t, "start": 4, "end": 12, "hyperlink": "https://example.com/docs"})).unwrap(); + assert!(s.execute("text.openLink", &json!({})).is_err(), "nothing to activate while no text is edited"); + s.execute("text.edit.begin", &json!({"id": t, "caret": 6})).unwrap(); + let r = s.execute("text.openLink", &json!({})).unwrap(); + assert_eq!(r["url"], "https://example.com/docs"); + let req = s.ui_requests.iter().find(|r| r.kind == "open.url").expect("a UI request to open it"); + assert_eq!(req.data["url"], "https://example.com/docs"); + assert!(s.ds().unwrap().text_edit.is_some(), "still editing"); + // Right after the link's last char the caret still counts as on it; before its start it doesn't. + s.execute("text.edit.caret", &json!({"index": 12})).unwrap(); + assert_eq!(s.execute("text.openLink", &json!({})).unwrap()["url"], "https://example.com/docs"); + s.execute("text.edit.caret", &json!({"index": 2})).unwrap(); + assert!(s.execute("text.openLink", &json!({})).unwrap()["url"].is_null(), "no link there"); + // A selection: its start decides. + s.execute("text.edit.caret", &json!({"index": 14})).unwrap(); + s.execute("text.edit.caret", &json!({"index": 8, "extend": true})).unwrap(); + assert_eq!(s.execute("text.openLink", &json!({})).unwrap()["url"], "https://example.com/docs"); + // Mail links open; anything that isn't a web or mail link is refused and nothing is requested. + s.execute("text.style", &json!({"id": t, "start": 4, "end": 12, "hyperlink": "mailto:hello@example.com"})).unwrap(); + s.execute("text.edit.caret", &json!({"index": 6})).unwrap(); + assert_eq!(s.execute("text.openLink", &json!({})).unwrap()["url"], "mailto:hello@example.com"); + let before = s.ui_requests.len(); + for bad in ["javascript:alert(1)", "file:///etc/passwd", "example.com/docs"] { + s.execute("text.style", &json!({"id": t, "start": 4, "end": 12, "hyperlink": bad})).unwrap(); + assert!(s.execute("text.openLink", &json!({})).is_err(), "{bad} is refused"); + } + assert_eq!(s.ui_requests.len(), before, "nothing requested for a refused link"); +} diff --git a/crates/ui-egui/src/app/commands.rs b/crates/ui-egui/src/app/commands.rs index 0e34f437a..93762e579 100644 --- a/crates/ui-egui/src/app/commands.rs +++ b/crates/ui-egui/src/app/commands.rs @@ -228,6 +228,13 @@ impl FigApp { } "preview.close" => self.ui.preview = None, "open.help" => self.services.open_url("https://getartcraft.com/apps/figcraft"), + // A link in text activated while editing (`text.openLink`): the engine checked it + // is a web or mail link. + "open.url" => { + if let Some(url) = r.data["url"].as_str() { + self.services.open_url(url); + } + } "layers.collapseAll" => layers::collapse_all(self), "contextMenu" => self.ui.key_menu = true, "selectArea" => self.start_key_box(), diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 7ecb64d22..e9969c106 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -243,6 +243,8 @@ mod table_paste_tests; #[cfg(test)] mod text_enter_tests; #[cfg(test)] +mod text_link_tests; +#[cfg(test)] mod titlebar_tests; #[cfg(test)] mod ui_params_tests; diff --git a/crates/ui-egui/src/text_link_tests.rs b/crates/ui-egui/src/text_link_tests.rs new file mode 100644 index 000000000..5f902e7a9 --- /dev/null +++ b/crates/ui-egui/src/text_link_tests.rs @@ -0,0 +1,60 @@ +//! Alt+Enter while editing text opens the link at the caret through the platform ("When editing +//! text, press ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma), +//! driven through egui headless with a recording opener; editing goes on. + +use std::sync::{Arc, Mutex}; + +use egui::{Event, Key, Modifiers}; +use figcraft_doc::NodeId; +use figcraft_engine::Session; +use serde_json::json; + +use crate::Services; +use crate::layers_drag_tests::Ui; + +/// Records every URL the app asks the platform to open. +#[derive(Default, Clone)] +struct Opened(Arc>>); + +impl Services for Opened { + fn open_url(&mut self, url: &str) { + if let Ok(mut v) = self.0.lock() { + v.push(url.to_string()); + } + } +} + +fn alt_enter(u: &mut Ui) { + let modifiers = Modifiers::ALT; + u.frame_with( + vec![ + Event::Key { key: Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers }, + Event::Key { key: Key::Enter, physical_key: None, pressed: false, repeat: false, modifiers }, + ], + modifiers, + ); + u.frame(vec![]); +} + +#[test] +fn alt_enter_opens_the_link_at_the_caret_while_editing() { + let mut s = Session::new(); + let t = NodeId(s.execute("text.create", &json!({"text": "See the docs now", "x": 20, "y": 20})).unwrap()["id"].as_u64().unwrap()); + s.execute("text.style", &json!({"id": t, "start": 4, "end": 12, "hyperlink": "https://example.com/docs"})).unwrap(); + s.execute("text.edit.begin", &json!({"id": t, "caret": 2})).unwrap(); + let opened = Opened::default(); + let mut u = Ui::new(s); + u.app.services = Box::new(opened.clone()); + u.frame(vec![]); + alt_enter(&mut u); + assert!(opened.0.lock().unwrap().is_empty(), "no link at the caret: nothing opens"); + assert!(u.app.session.ds().unwrap().text_edit.is_some(), "still editing"); + u.app.session.execute("text.edit.caret", &json!({"index": 6})).unwrap(); + alt_enter(&mut u); + assert_eq!(*opened.0.lock().unwrap(), vec!["https://example.com/docs".to_string()]); + assert!(u.app.session.ds().unwrap().text_edit.is_some(), "still editing"); + // Not a web or mail link: nothing opens. + u.app.session.execute("text.style", &json!({"id": t, "start": 4, "end": 12, "hyperlink": "file:///etc/passwd"})).unwrap(); + alt_enter(&mut u); + assert_eq!(opened.0.lock().unwrap().len(), 1); +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index d936c9408..7a416f2d6 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-02 · **Change:** patch (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); 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-02 · **Change:** patch (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; 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: @@ -89,7 +89,7 @@ interaction feel not yet compared. | Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | 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); 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`). Not yet: areas of other layers edited at once | | 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) | -| 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`); 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; no spell check | +| 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; no spell check | | Text: superscript and subscript | done | `sups` / `subs` use the font's own glyphs where it has the feature and every letter or digit of the run gets one; otherwise the standard glyphs are drawn shrunk and raised or lowered by the font's OS/2 superscript and subscript metrics (0.65 em at 0.35 em up or 0.14 em down without them), and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says ("Figma draws a synthesized version by using the font's standard version of the character, shrinking it, and positioning it accordingly"; mixed glyphs "all update to the synthesized form for consistency"), #1828; tests `text::tests::superscript_native_or_synthesised_and_never_mixed`, `text_behaviour_tests::superscript_and_subscript_are_synthesised_without_glyphs_for_them` | | Eyedropper (I) | done | picks the colour seen under the pointer (opaque) into the selection's fill and the recent colours, one undo step (`fx_behaviour_tests`); with Cmd/Ctrl+Shift held it makes a colour style or variable of it instead, as the reference app's eyedropper does: a Create from color window asks which, its name (the next free "Color n") and a variable's collection (the file's first, or a new one made with it in the same undo step), and leaves the selection's fills alone (`eyedropper_create_tests`, `sampled_color_tests`) | | Comment (C), Shift+C to show/hide | done | local only | @@ -129,8 +129,8 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | | Count | Notes | |---|---|---| -| Documented shortcuts (rows) | 133 | each with macOS and Windows/Linux keys | -| Bound as documented | 132 (110 before this suite) | 111 keymap bindings, 15 held keys, gestures and presentation keys, 6 vector edit tool keys | +| Documented shortcuts (rows) | 134 | each with macOS and Windows/Linux keys | +| Bound as documented | 133 (110 before this suite) | 112 keymap bindings, 15 held keys, gestures and presentation keys, 6 vector edit tool keys | | Bound on other keys (documented conflict) | 1 | Run last plugin: the documentation also gives Ctrl+Alt+P to pixel preview on Windows; the plugin takes Ctrl+Alt+Shift+P there | | Missing | 0 | moving the rotation origin (Alt+R, `transform.rotationOrigin`) and placing an object with Enter after choosing its tool (`tool.place`) were the last two | | Documented keys a platform keeps | 2 | Ctrl+Space (Windows/Linux keyboard box selection) switches some CJK input methods; F6 goes to a browser's address bar in the web build | @@ -180,6 +180,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | 2026-11-02 | patch | M4: Backspace or Delete at the start of a list item takes its marker and keeps its level ("Use Backspace or Delete at the beginning of a list item to delete the counter, but keep the same level of indentation", Create bulleted and numbered lists): a plain paragraph may now carry a list level, and the text layout starts it where that level's item text starts (the gutters stay even when no list is left). Backspace used to drop the level too, and Delete at an item's start deleted the next character. Tab on such a paragraph types a tab, as outside a list. Tests: `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests::a_plain_paragraph_at_a_list_level_starts_where_the_items_text_does` | | 2026-11-02 | patch | M4: max lines on an auto-width text keep it auto width: the box hugs up to that many lines and still grows with its longest line ("Max lines is available only if truncate text is enabled, and: Text resizing is set to auto height or auto width", Explore text properties). `text.maxLines` turned such a text into a fixed truncating box with a stale height, so later typing no longer widened it; fixed-size text still becomes a truncating box, auto-height text hugs as before. Test: `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines` | | 2026-11-02 | patch | M4, #1828: superscript and subscript synthesised where the font has no `sups` / `subs` glyphs (the standard glyph shrunk and shifted by the OS/2 metrics, the usual 0.65 em and 0.35 / 0.14 em offsets without them), and a run mixing available and unavailable glyphs synthesised whole, as Explore text properties says. Tests: `text::tests::superscript_native_or_synthesised_and_never_mixed`, `text_behaviour_tests::superscript_and_subscript_are_synthesised_without_glyphs_for_them`. | +| 2026-11-02 | patch | Shortcuts: Alt+Enter while editing text opens the link at the caret ("When editing text, press ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma) through the new `text.openLink` command, which hands a web or mail link to the platform's opener and refuses any other scheme as the prototype player does; editing goes on. The key went to the editor as a plain Enter before. A documented row: 134 documented, 133 bound. Tests: engine `text_link_tests`, `text_link_tests` (UI) | | 2026-11-01 | patch | Shortcuts: Cmd/Ctrl+Shift+Alt+= and - make the interface larger and smaller through the sizes Preferences offers, and Cmd/Ctrl+Shift+Alt+0 puts it back to the system's size ("Adjust the scale of the Figma UI [...] Reset to Default: Control ⇧Shift Alt 0; Make Larger: Control ⇧Shift Alt =; Make Smaller: Control ⇧Shift Alt -", Accessibility at Figma); the size is kept at once, as one picked in Preferences is. `pref.uiScaleUp`, `pref.uiScaleDown`, `pref.uiScaleReset`; the sizes list now lives in the engine (`UI_SCALE_SIZES`) and Preferences reads it from there. Found by a documentation audit of the shortcuts. Test: `keymap_tests::the_interface_size_keys_step_through_the_preferences_sizes`. Documented rows 130 → 133, bound 129 → 132 | | 2026-11-01 | patch | Shortcuts: Cmd/Ctrl+Alt+↑/↓ (and ←/→) rotate the selection one degree at a time, 15 with Shift ("Press ⌘Command ⌥Option ↑/ ↓ on Mac or Control Alt ↑/↓ on Windows to rotate an object one degree at a time", Accessibility at Figma); they resized by the nudge before, which Cmd/Ctrl+arrows without Alt still do. Down and right turn clockwise, up and left back (the documentation is silent on the direction). In the shortcuts panel's Transform tab, over the control channel's `ui.key` too. Found by a documentation audit of the shortcuts. Test: `shortcut_keys_tests::cmd_alt_arrows_rotate_a_degree_and_fifteen_with_shift`. Documented rows 129 → 130, bound 128 → 129 | | 2026-11-01 | patch | Shortcuts: the Layers panel opens with Ctrl+1 as well as Alt+1 on Windows and Linux ("Mac: Option 1 Windows: Ctrl 1" in Select layers and objects; "Windows: Alt 1" in Explore the navigation bar and left sidebar). macOS keeps Option+1. Found by a documentation audit of the shortcuts (every chord driven over the control channel). Tests: `keymap_tests::the_layers_panel_answers_both_of_its_documented_windows_keys`, the parity row. Counts unchanged | From e65ce42000ea2bd3c31d14f6c7e47d14bc6ab164 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 2 Nov 2026 05:31:32 -0500 Subject: [PATCH 32/49] M7: Minimize collapses the navigation bar and both sidebars, the right one back while something is selected (#1835) (#1865) * M7: Minimize collapses the navigation bar and both sidebars, the right one back while something is selected (#1835) Co-Authored-By: Claude Fable 5.1 * M7: a narrow window ignores Minimize, and a rename started while minimized waits without repaints Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 Co-authored-by: Brandon Thomas --- crates/engine/src/cmd/view.rs | 7 ++ crates/engine/src/keymap.rs | 2 +- crates/engine/src/shortcut_parity_tests.rs | 2 +- crates/engine/src/view_state.rs | 4 + crates/ui-egui/locales/ar.toml | 1 - crates/ui-egui/locales/bn.toml | 1 - crates/ui-egui/locales/bs.toml | 1 - crates/ui-egui/locales/cs.toml | 1 - crates/ui-egui/locales/de.toml | 1 - crates/ui-egui/locales/en.toml | 2 +- crates/ui-egui/locales/es.toml | 1 - crates/ui-egui/locales/fi.toml | 1 - crates/ui-egui/locales/fr.toml | 1 - crates/ui-egui/locales/id.toml | 1 - crates/ui-egui/locales/it.toml | 1 - crates/ui-egui/locales/ja.toml | 1 - crates/ui-egui/locales/ka.toml | 1 - crates/ui-egui/locales/ko.toml | 1 - crates/ui-egui/locales/nl.toml | 1 - crates/ui-egui/locales/pl.toml | 1 - crates/ui-egui/locales/pt-BR.toml | 1 - crates/ui-egui/locales/ru.toml | 1 - crates/ui-egui/locales/sv.toml | 1 - crates/ui-egui/locales/th.toml | 1 - crates/ui-egui/locales/tr.toml | 1 - crates/ui-egui/locales/vi.toml | 1 - crates/ui-egui/locales/zh-Hans.toml | 1 - crates/ui-egui/src/app.rs | 22 ++++-- crates/ui-egui/src/app/control.rs | 1 + crates/ui-egui/src/app/frame.rs | 16 ++++ crates/ui-egui/src/idle_tests.rs | 17 +++++ crates/ui-egui/src/panel_width_tests.rs | 85 +++++++++++++++++++++- crates/ui-egui/src/panels/layers.rs | 6 +- crates/ui-egui/src/shortcuts_tests.rs | 6 +- docs/ui-parity.md | 5 +- 35 files changed, 161 insertions(+), 36 deletions(-) diff --git a/crates/engine/src/cmd/view.rs b/crates/engine/src/cmd/view.rs index 1fc2ef22a..60a5c26f1 100644 --- a/crates/engine/src/cmd/view.rs +++ b/crates/engine/src/cmd/view.rs @@ -321,6 +321,13 @@ pub fn specs() -> Vec { spec!("view.snapObjects", "Snap to objects", "{on?}", false, |s, p| toggle(s, p, "view.snapObjects")), spec!("view.snapPixel", "Snap to pixel grid", "{on?}", false, |s, p| toggle(s, p, "view.snapPixel")), spec!("view.toggleUi", "Show/Hide UI", "{on?}", false, |s, p| flag(s, p, |v| &mut v.ui_hidden)), + spec!( + "view.minimize", + "Minimize the interface", + "{on?} collapses the navigation bar and both sidebars and keeps the toolbar (Shift+Cmd/Ctrl+\\, the Minimize button by the file name); the right sidebar shows while something is selected", + false, + |s, p| flag(s, p, |v| &mut v.ui_minimized) + ), spec!("view.fullscreen", "Full screen", "{on?} the window fills the screen (the desktop app; a no-op headless)", false, |s, p| { s.request_ui("window.fullscreen", json!({"on": boolean(p, "on")})); ok() diff --git a/crates/engine/src/keymap.rs b/crates/engine/src/keymap.rs index 4f55fa4ad..cec22d62f 100644 --- a/crates/engine/src/keymap.rs +++ b/crates/engine/src/keymap.rs @@ -225,7 +225,7 @@ pub static KEYS: &[Binding] = &[ k(View, "view.prototype", &["Alt+9"]).label("Prototype panel"), k(View, "view.designPrototype", &["Shift+E"]), k(View, "view.devMode", &["Shift+D"]).label("Dev Mode on/off"), - k(View, "view.leftSidebar", &["Shift+Cmd+\\"]), + k(View, "view.minimize", &["Shift+Cmd+\\"]), k(View, "view.nextRegion", &["F6"]).win(&["F6", "Ctrl+F6"]).label("Focus the next region (toolbar, layers, canvas, properties)").both(), k(View, "view.previousRegion", &["Shift+F6"]).label("Focus the previous region").both(), k(View, "view.contextMenu", &["Shift+F10", "Menu"]).label("Context menu of the selection (the focused layer row or the canvas)"), diff --git a/crates/engine/src/shortcut_parity_tests.rs b/crates/engine/src/shortcut_parity_tests.rs index 31ce9d18e..46eb14447 100644 --- a/crates/engine/src/shortcut_parity_tests.rs +++ b/crates/engine/src/shortcut_parity_tests.rs @@ -145,7 +145,7 @@ static ROWS: &[Row] = &[ doc(View, "Outline mode", &["Shift+Cmd+O"], &[], Bound("view.outlines"), ""), doc(View, "Pixel preview", &["Ctrl+P"], &["Ctrl+Alt+P"], Bound("view.pixelPreview"), ""), doc(View, "Others' cursors in a live session", &["Alt+Cmd+\\"], &["Ctrl+Alt+\\"], Bound("view.multiplayerCursors"), "new command"), - doc(View, "Hide the side panels (minimize the interface)", &["Shift+Cmd+\\"], &[], Bound("view.leftSidebar"), ""), + doc(View, "Minimize the interface: the navigation bar and both sidebars", &["Shift+Cmd+\\"], &[], Bound("view.minimize"), "the toolbar stays; the right sidebar shows while something is selected"), doc(View, "Layers panel", &["Alt+1"], &["Alt+1", "Ctrl+1"], Bound("view.layers"), "one article writes Ctrl+1 for Windows, another Alt+1; both bound there"), doc(View, "Interface scale: make larger", &["Alt+Shift+Cmd+="], &[], Bound("pref.uiScaleUp"), "Accessibility at Figma, Adjust the scale of the Figma UI"), doc(View, "Interface scale: make smaller", &["Alt+Shift+Cmd+-"], &[], Bound("pref.uiScaleDown"), "Accessibility at Figma"), diff --git a/crates/engine/src/view_state.rs b/crates/engine/src/view_state.rs index 54102d6b7..fd70b4b11 100644 --- a/crates/engine/src/view_state.rs +++ b/crates/engine/src/view_state.rs @@ -38,6 +38,9 @@ pub struct ViewState { pub snap_objects: bool, pub snap_pixel: bool, pub ui_hidden: bool, + /// Minimized interface (Shift+Cmd/Ctrl+\): the navigation bar and both sidebars are collapsed + /// and the toolbar stays; the right sidebar shows while something is selected. + pub ui_minimized: bool, } impl Default for ViewState { @@ -67,6 +70,7 @@ impl Default for ViewState { snap_objects: true, snap_pixel: true, ui_hidden: false, + ui_minimized: false, } } } diff --git a/crates/ui-egui/locales/ar.toml b/crates/ui-egui/locales/ar.toml index 86a21e234..a3dcf0844 100644 --- a/crates/ui-egui/locales/ar.toml +++ b/crates/ui-egui/locales/ar.toml @@ -288,7 +288,6 @@ status = "draft — needs native review" "Code" = "الكود" "Code syntax" = "صياغة الكود" "Collapse" = "طي" -"Collapse panel" = "طي اللوحة" "Collection" = "مجموعة" "Collections" = "المجموعات" "Color" = "اللون" diff --git a/crates/ui-egui/locales/bn.toml b/crates/ui-egui/locales/bn.toml index 9f2e6421a..32d66721f 100644 --- a/crates/ui-egui/locales/bn.toml +++ b/crates/ui-egui/locales/bn.toml @@ -275,7 +275,6 @@ status = "draft — needs native review" "Code" = "কোড" "Code syntax" = "কোড সিনট্যাক্স" "Collapse" = "সংকুচিত করুন" -"Collapse panel" = "প্যানেল সংকুচিত করুন" "Collection" = "সংগ্রহ" "Collections" = "সংগ্রহসমূহ" "Color" = "রঙ" diff --git a/crates/ui-egui/locales/bs.toml b/crates/ui-egui/locales/bs.toml index 67e0a14cd..72f0268bd 100644 --- a/crates/ui-egui/locales/bs.toml +++ b/crates/ui-egui/locales/bs.toml @@ -288,7 +288,6 @@ status = "draft — needs native review" "Code" = "Kod" "Code syntax" = "Sintaksa koda" "Collapse" = "Skupi" -"Collapse panel" = "Skupi panel" "Collection" = "Kolekcija" "Collections" = "Kolekcije" "Color" = "Boja" diff --git a/crates/ui-egui/locales/cs.toml b/crates/ui-egui/locales/cs.toml index e77610771..16de8065a 100644 --- a/crates/ui-egui/locales/cs.toml +++ b/crates/ui-egui/locales/cs.toml @@ -265,7 +265,6 @@ status = "draft — needs native review" "Code" = "Kód" "Code syntax" = "Syntaxe kódu" "Collapse" = "Sbalit" -"Collapse panel" = "Sbalit panel" "Collection" = "Kolekce" "Collections" = "Kolekce" "Color" = "Barva" diff --git a/crates/ui-egui/locales/de.toml b/crates/ui-egui/locales/de.toml index b088b2d32..344e70912 100644 --- a/crates/ui-egui/locales/de.toml +++ b/crates/ui-egui/locales/de.toml @@ -263,7 +263,6 @@ status = "draft — needs native review" "Code" = "Code" "Code syntax" = "Code-Syntax" "Collapse" = "Einklappen" -"Collapse panel" = "Bereich einklappen" "Collection" = "Sammlung" "Collections" = "Sammlungen" "Color" = "Farbe" diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index 034e3381a..a23c281ba 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -293,7 +293,6 @@ name = "English" "Code" = "Code" "Code syntax" = "Code syntax" "Collapse" = "Collapse" -"Collapse panel" = "Collapse panel" "Collection" = "Collection" "Collections" = "Collections" "Color" = "Color" @@ -536,6 +535,7 @@ name = "English" "Exclusion" = "Exclusion" "Exit focus view (Esc)" = "Exit focus view (Esc)" "Expand" = "Expand" +"Expand the interface" = "Expand the interface" "Export" = "Export" "Export all" = "Export all" "Export frames and layers as PNG, JPG, SVG or PDF" = "Export frames and layers as PNG, JPG, SVG or PDF" diff --git a/crates/ui-egui/locales/es.toml b/crates/ui-egui/locales/es.toml index 3b1f7296e..b9e004dd0 100644 --- a/crates/ui-egui/locales/es.toml +++ b/crates/ui-egui/locales/es.toml @@ -293,7 +293,6 @@ status = "draft — needs native review" "Code" = "Código" "Code syntax" = "Sintaxis de código" "Collapse" = "Contraer" -"Collapse panel" = "Contraer panel" "Collection" = "Colección" "Collections" = "Colecciones" "Color" = "Color" diff --git a/crates/ui-egui/locales/fi.toml b/crates/ui-egui/locales/fi.toml index f181ba8a5..0c74f9de7 100644 --- a/crates/ui-egui/locales/fi.toml +++ b/crates/ui-egui/locales/fi.toml @@ -281,7 +281,6 @@ status = "draft — needs native review" "Code or invite link" = "Koodi tai kutsulinkki" "Code syntax" = "Koodin syntaksi" "Collapse" = "Tiivistä muunnokset" -"Collapse panel" = "Supista paneeli" "Collection" = "Kokoelma" "Collections" = "Kokoelmat" "Color" = "Väri" diff --git a/crates/ui-egui/locales/fr.toml b/crates/ui-egui/locales/fr.toml index 42a35007b..b30abe731 100644 --- a/crates/ui-egui/locales/fr.toml +++ b/crates/ui-egui/locales/fr.toml @@ -269,7 +269,6 @@ status = "draft — needs native review" "Code" = "Code" "Code syntax" = "Syntaxe du code" "Collapse" = "Réduire" -"Collapse panel" = "Réduire le panneau" "Collection" = "Collection" "Collections" = "Collections" "Color" = "Couleur" diff --git a/crates/ui-egui/locales/id.toml b/crates/ui-egui/locales/id.toml index a3457d820..da08f159d 100644 --- a/crates/ui-egui/locales/id.toml +++ b/crates/ui-egui/locales/id.toml @@ -281,7 +281,6 @@ status = "draft — needs native review" "Code" = "Kode" "Code syntax" = "Sintaks kode" "Collapse" = "Ciutkan" -"Collapse panel" = "Ciutkan panel" "Collection" = "Koleksi" "Collections" = "Koleksi" "Color" = "Warna" diff --git a/crates/ui-egui/locales/it.toml b/crates/ui-egui/locales/it.toml index ce54d15db..3d2877e7e 100644 --- a/crates/ui-egui/locales/it.toml +++ b/crates/ui-egui/locales/it.toml @@ -259,7 +259,6 @@ status = "draft — needs native review" "Code" = "Codice" "Code syntax" = "Sintassi del codice" "Collapse" = "Comprimi" -"Collapse panel" = "Comprimi pannello" "Collection" = "Collezione" "Collections" = "Collezioni" "Color" = "Colore" diff --git a/crates/ui-egui/locales/ja.toml b/crates/ui-egui/locales/ja.toml index 8e2334f4b..8cf2da2d5 100644 --- a/crates/ui-egui/locales/ja.toml +++ b/crates/ui-egui/locales/ja.toml @@ -270,7 +270,6 @@ status = "draft — needs native review" "Code" = "コード" "Code syntax" = "コード構文" "Collapse" = "折りたたむ" -"Collapse panel" = "パネルを折りたたむ" "Collection" = "コレクション" "Collections" = "コレクション" "Color" = "カラー" diff --git a/crates/ui-egui/locales/ka.toml b/crates/ui-egui/locales/ka.toml index 90dffe678..f634a2e7e 100644 --- a/crates/ui-egui/locales/ka.toml +++ b/crates/ui-egui/locales/ka.toml @@ -279,7 +279,6 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Code" = "კოდი" "Code syntax" = "კოდის სინტაქსი" "Collapse" = "ჩაკეცვა" -"Collapse panel" = "პანელის ჩაკეცვა" "Collection" = "კოლექცია" "Collections" = "კოლექციები" "Color" = "ფერი" diff --git a/crates/ui-egui/locales/ko.toml b/crates/ui-egui/locales/ko.toml index 691c1cbc7..d52310997 100644 --- a/crates/ui-egui/locales/ko.toml +++ b/crates/ui-egui/locales/ko.toml @@ -260,7 +260,6 @@ status = "draft — needs native review" "Code" = "코드" "Code syntax" = "코드 구문" "Collapse" = "접기" -"Collapse panel" = "패널 접기" "Collection" = "컬렉션" "Collections" = "컬렉션" "Color" = "색상" diff --git a/crates/ui-egui/locales/nl.toml b/crates/ui-egui/locales/nl.toml index 027b0b3a2..070ca4bb4 100644 --- a/crates/ui-egui/locales/nl.toml +++ b/crates/ui-egui/locales/nl.toml @@ -271,7 +271,6 @@ status = "draft — needs native review" "Code or invite link" = "Code of uitnodigingslink" "Code syntax" = "Code-syntaxis" "Collapse" = "Inklappen" -"Collapse panel" = "Paneel samenvouwen" "Collection" = "Verzameling" "Collections" = "Verzamelingen" "Color" = "Kleur" diff --git a/crates/ui-egui/locales/pl.toml b/crates/ui-egui/locales/pl.toml index 28406332a..05d9b60f8 100644 --- a/crates/ui-egui/locales/pl.toml +++ b/crates/ui-egui/locales/pl.toml @@ -275,7 +275,6 @@ name = "Polski" "Code" = "Kod" "Code syntax" = "Składnia kodu" "Collapse" = "Zwiń" -"Collapse panel" = "Zwiń panel" "Collection" = "Kolekcja" "Collections" = "Kolekcje" "Color" = "Kolor" diff --git a/crates/ui-egui/locales/pt-BR.toml b/crates/ui-egui/locales/pt-BR.toml index 7924ed0f8..1b00ce28c 100644 --- a/crates/ui-egui/locales/pt-BR.toml +++ b/crates/ui-egui/locales/pt-BR.toml @@ -258,7 +258,6 @@ status = "draft — needs native review" "Code" = "Código" "Code syntax" = "Sintaxe de código" "Collapse" = "Recolher" -"Collapse panel" = "Recolher painel" "Collection" = "Coleção" "Collections" = "Coleções" "Color" = "Cor" diff --git a/crates/ui-egui/locales/ru.toml b/crates/ui-egui/locales/ru.toml index 90e6c607b..a9a155818 100644 --- a/crates/ui-egui/locales/ru.toml +++ b/crates/ui-egui/locales/ru.toml @@ -272,7 +272,6 @@ name = "Русский" "Code" = "Код" "Code syntax" = "Синтаксис кода" "Collapse" = "Свернуть" -"Collapse panel" = "Свернуть панель" "Collection" = "Коллекция" "Collections" = "Коллекции" "Color" = "Цвет" diff --git a/crates/ui-egui/locales/sv.toml b/crates/ui-egui/locales/sv.toml index 1c9cf0ee2..9384ba152 100644 --- a/crates/ui-egui/locales/sv.toml +++ b/crates/ui-egui/locales/sv.toml @@ -293,7 +293,6 @@ name = "Svenska" "Code" = "Kod" "Code syntax" = "Kodsyntax" "Collapse" = "Komprimera" -"Collapse panel" = "Komprimera panel" "Collection" = "Samling" "Collections" = "Samlingar" "Color" = "Färg" diff --git a/crates/ui-egui/locales/th.toml b/crates/ui-egui/locales/th.toml index d3268bdf9..45de7b858 100644 --- a/crates/ui-egui/locales/th.toml +++ b/crates/ui-egui/locales/th.toml @@ -273,7 +273,6 @@ status = "draft — needs native review" "Code" = "โค้ด" "Code syntax" = "ไวยากรณ์โค้ด" "Collapse" = "ยุบ" -"Collapse panel" = "ยุบแผง" "Collection" = "คอลเลกชัน" "Collections" = "คอลเลกชัน" "Color" = "สี" diff --git a/crates/ui-egui/locales/tr.toml b/crates/ui-egui/locales/tr.toml index 6c80e6864..db05d1c93 100644 --- a/crates/ui-egui/locales/tr.toml +++ b/crates/ui-egui/locales/tr.toml @@ -269,7 +269,6 @@ name = "Türkçe" "Code" = "Kod" "Code syntax" = "Kod söz dizimi" "Collapse" = "Daralt" -"Collapse panel" = "Paneli daralt" "Collection" = "Koleksiyon" "Collections" = "Koleksiyonlar" "Color" = "Renk" diff --git a/crates/ui-egui/locales/vi.toml b/crates/ui-egui/locales/vi.toml index 8149ed30b..8b58fc67e 100644 --- a/crates/ui-egui/locales/vi.toml +++ b/crates/ui-egui/locales/vi.toml @@ -256,7 +256,6 @@ status = "draft — needs native review" "Code or invite link" = "Mã hoặc liên kết mời" "Code syntax" = "Cú pháp mã" "Collapse" = "Thu gọn" -"Collapse panel" = "Thu gọn bảng" "Collection" = "Bộ sưu tập" "Collections" = "Bộ sưu tập" "Color" = "Màu" diff --git a/crates/ui-egui/locales/zh-Hans.toml b/crates/ui-egui/locales/zh-Hans.toml index 2fed25ce2..a6ecb8ab3 100644 --- a/crates/ui-egui/locales/zh-Hans.toml +++ b/crates/ui-egui/locales/zh-Hans.toml @@ -261,7 +261,6 @@ status = "draft — needs native review" "Code" = "代码" "Code syntax" = "代码语法" "Collapse" = "折叠" -"Collapse panel" = "折叠面板" "Collection" = "集合" "Collections" = "集合" "Color" = "颜色" diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index c625f342a..e13acce68 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -274,12 +274,21 @@ impl FigApp { return; } let hidden = self.session.ds().map(|d| d.view.ui_hidden).unwrap_or(false); + // Minimized (Shift+Cmd/Ctrl+\, the Minimize button by the file name): "collapses the + // navigation bar, left sidebar, and right sidebar"; "If you select an object while the + // panels are minimized, the left sidebar remains minimized while the right sidebar expands + // [...] Once all objects are deselected, the right panel minimizes again" (Explore the + // navigation bar and left sidebar). The toolbar stays; Hide UI takes everything. let narrow = !hidden && ui.available_width() < NARROW_WIDTH; + // A narrow window has no sidebars beside the canvas to take: its panels open from their + // buttons as before, and the interface is minimized again once the window is wide. + let minimized = !hidden && !narrow && self.session.ds().is_ok_and(|d| d.view.ui_minimized); + let right_minimized = minimized && self.session.selection().is_empty(); let mobile = self.ui.mobile_panel.filter(|_| narrow); self.ui.narrow = narrow; // A narrow window shows the right panel when its button asks for it, a board's too. - let right_open = (self.right_panel_shown(hidden) && !narrow) || mobile == Some(MobilePanel::Right); - if !hidden && (!narrow || mobile == Some(MobilePanel::Left)) { + let right_open = (self.right_panel_shown(hidden) && !narrow && !right_minimized) || mobile == Some(MobilePanel::Right); + if !hidden && !minimized && (!narrow || mobile == Some(MobilePanel::Left)) { egui::Panel::left("left_rail") .exact_size(layers::RAIL_WIDTH) .resizable(false) @@ -290,7 +299,7 @@ impl FigApp { }); } // The panels are as wide as asked, less in a window too small for them and the canvas. - let left_open = !hidden && if narrow { mobile == Some(MobilePanel::Left) } else { !self.ui.left_collapsed }; + let left_open = !hidden && !minimized && if narrow { mobile == Some(MobilePanel::Left) } else { !self.ui.left_collapsed }; let (left_w, right_w) = if narrow { let w = (ui.available_width() - MOBILE_STRIP).max(0.0); (if left_open { w } else { 0.0 }, w) @@ -353,6 +362,8 @@ impl FigApp { if narrow { let x = if mobile == Some(MobilePanel::Left) { ctx.content_rect().max.x - MOBILE_STRIP + 4.0 } else { ctx.content_rect().min.x + 4.0 }; self.mobile_buttons(&ctx, egui::pos2(x, rows.min + 8.0)); + } else if minimized { + self.expand_button(&ctx, egui::pos2(ctx.content_rect().min.x + 8.0, rows.min + 8.0)); } // The panels' edges, over the canvas and the panels (drawn after them: they take the press). for (name, x, shown, grows) in edges { @@ -385,8 +396,9 @@ impl FigApp { updates_ui::show(self, &ctx); self.toast_ui(&ctx); // A rename started after the layers panel drew (Cmd/Ctrl+R, a double-click) opens its field - // next frame. - if self.ui.rename.is_some_and(|r| r.start) && !hidden && !self.ui.left_collapsed && self.ui.left_tab == LeftTab::File { + // next frame; while the panel isn't drawn (the interface hidden or minimized, the panel + // closed in a narrow window) the rename waits for it without asking for frames. + if self.ui.rename.is_some_and(|r| r.start) && left_open && self.ui.left_tab == LeftTab::File { ctx.request_repaint(); } a11y::end(self, &ctx); diff --git a/crates/ui-egui/src/app/control.rs b/crates/ui-egui/src/app/control.rs index 72435673c..f63ab334a 100644 --- a/crates/ui-egui/src/app/control.rs +++ b/crates/ui-egui/src/app/control.rs @@ -102,6 +102,7 @@ impl FigApp { "importReport": self.ui.import_report.as_ref().map(import_report::Report::inspect), }); state["homeSearch"] = json!(self.ui.home_view.file_query); + state["panels"]["minimized"] = json!(self.session.ds().is_ok_and(|d| d.view.ui_minimized)); // Set apart from the literal above, which is at the macro recursion limit. state["uiScale"] = json!({"choice": self.session.prefs.ui_scale, "zoom": self.ui.ui_scale.zoom, "drawn": self.ui.ui_scale.drawn, "limited": self.ui.ui_scale.limited}); state["pendingOpens"] = json!(self.ui.pending_opens.len()); diff --git a/crates/ui-egui/src/app/frame.rs b/crates/ui-egui/src/app/frame.rs index 128cd0294..49040b7d9 100644 --- a/crates/ui-egui/src/app/frame.rs +++ b/crates/ui-egui/src/app/frame.rs @@ -247,6 +247,22 @@ impl FigApp { }); } + /// The way back from a minimized interface by mouse: a small Panels button at the top left of + /// the canvas, where the navigation bar was (the shortcut works too). + pub(super) fn expand_button(&mut self, ctx: &egui::Context, at: egui::Pos2) { + use a11y::Tip as _; + let t = theme::Tokens::get(ctx); + egui::Area::new(egui::Id::unique("expand_interface")).order(egui::Order::Foreground).fixed_pos(at).show(ctx, |ui| { + let (r, resp) = ui.allocate_exact_size(egui::vec2(32.0, 32.0), egui::Sense::click()); + let resp = resp.tip(i18n::tr("Expand the interface")); + ui.painter().rect(r, 8.0, t.panel, egui::Stroke::new(1.0, t.border), egui::StrokeKind::Inside); + icons::paint(ui.painter(), r.shrink(8.0), icons::Icon::Panels, t.icon); + if resp.clicked() { + self.run("view.minimize", serde_json::json!({})); + } + }); + } + /// Draw the toast: start its lifetime on the frame **after** the first drawn frame, request /// that frame and the frame that hides it, expire and remove it at the deadline, and place it /// at the bottom centre. diff --git a/crates/ui-egui/src/idle_tests.rs b/crates/ui-egui/src/idle_tests.rs index e2054bc84..ae34ded78 100644 --- a/crates/ui-egui/src/idle_tests.rs +++ b/crates/ui-egui/src/idle_tests.rs @@ -513,3 +513,20 @@ fn a_discarded_sizing_pass_sets_up_and_counts_one_frame_only() { assert_eq!(passes, 2, "egui reran the frame"); assert_eq!(app.frame_stats.frames, frames + 1, "one frame was drawn, not one per pass"); } + +#[test] +fn a_rename_started_while_minimized_waits_for_the_layers_panel_quietly() { + let (mut h, _) = document(); + let r = h.run("shape.rectangle", json!({"x": 500, "y": 500, "width": 40, "height": 40})); + h.run("view.minimize", json!({"on": true})); + h.settle(); + // What Cmd/Ctrl+R leaves: the field opens when the layers panel next draws, which a minimized + // interface doesn't do; no frame is asked for meanwhile. + h.app.ui.rename = Some(crate::panels::layers::Rename { id: id(&r), start: true }); + h.assert_idle("a rename started while the interface is minimized"); + h.run("view.minimize", json!({"on": false})); + for _ in 0..3 { + h.frame(vec![]); + } + assert!(h.app.ui.rename.is_some_and(|r| !r.start), "the field opened once the interface expanded"); +} diff --git a/crates/ui-egui/src/panel_width_tests.rs b/crates/ui-egui/src/panel_width_tests.rs index 6f3eacf7e..357b13669 100644 --- a/crates/ui-egui/src/panel_width_tests.rs +++ b/crates/ui-egui/src/panel_width_tests.rs @@ -160,7 +160,7 @@ fn the_command_sets_and_resets_the_widths() { u.app.run("view.panelWidths", json!({"left": 320, "right": 400})); u.frame(vec![]); assert_eq!(widths(&u), (320.0, 400.0)); - assert_eq!(u.app.inspect()["panels"], json!({"left": 320.0, "right": 400.0, "leftCollapsed": false})); + assert_eq!(u.app.inspect()["panels"], json!({"left": 320.0, "right": 400.0, "leftCollapsed": false, "minimized": false})); u.app.run("view.panelWidths", json!({"left": 5000})); assert_eq!(widths(&u), (*LEFT_PANEL.end(), 400.0), "within its limits; the other panel as it was"); for junk in [json!({"left": "wide"}), json!({"left": null, "right": null}), json!({})] { @@ -210,6 +210,58 @@ fn minimize_ui_hides_the_panels_and_keeps_their_widths() { assert_eq!(edges(&u), (56.0, shown.1)); } +/// The middle of the accessible control with `role` and `label`, if one shows. +fn control(u: &mut Ui, role: egui::accesskit::Role, label: &str) -> Option { + u.ctx.enable_accesskit(); + u.frame(vec![]); + let out = u.frame_output(vec![]); + let nodes = out.platform_output.accesskit_update.expect("an AccessKit update").nodes; + let n = nodes.iter().map(|(_, n)| n).find(|n| n.role() == role && n.label() == Some(label))?; + let b = n.bounds()?; + Some(pos2(((b.x0 + b.x1) / 2.0) as f32, ((b.y0 + b.y1) / 2.0) as f32)) +} + +/// "You can click Minimize next to the file name to collapse the navigation bar, left sidebar, +/// and right sidebar" (Explore the navigation bar and left sidebar; Shift+Cmd/Ctrl+\ too): the +/// rail and both sidebars go, the toolbar and the widths stay. "If you select an object while +/// the panels are minimized, the left sidebar remains minimized while the right sidebar expands +/// [...] Once all objects are deselected, the right panel minimizes again." The Expand button at +/// the top left puts everything back (#1835). +#[test] +fn minimize_collapses_the_rail_and_both_sidebars_and_the_right_one_follows_the_selection() { + use egui::accesskit::Role; + let (mut u, _) = ui(); + u.app.run("view.panelWidths", json!({"left": 320, "right": 400})); + u.app.run("select.set", json!({"ids": []})); + u.frame(vec![]); + let shown = edges(&u); + let minimize = control(&mut u, Role::Button, "Minimize").expect("the Minimize button by the file name"); + u.button(minimize, true); + u.button(minimize, false); + u.frame(vec![]); + assert_eq!(edges(&u), (0.0, 1440.0), "no rail and no sidebars: the canvas has the window"); + assert!(control(&mut u, Role::Toolbar, "Tools").is_some(), "the toolbar stays"); + assert_eq!(widths(&u), (320.0, 400.0), "the widths are kept"); + // A selection brings the right sidebar, the left stays away; deselecting takes it again. + u.app.run("select.all", json!({})); + u.frame(vec![]); + assert!(edges(&u).0 == 0.0 && edges(&u).1 < 1440.0, "the right sidebar shows for the selection: {:?}", edges(&u)); + u.app.run("select.set", json!({"ids": []})); + u.frame(vec![]); + assert_eq!(edges(&u), (0.0, 1440.0), "and goes once nothing is selected"); + // Expand puts the interface back as it was. + let expand = control(&mut u, Role::Button, "Expand the interface").expect("the Expand button at the top left"); + u.button(expand, true); + u.button(expand, false); + u.frame(vec![]); + assert_eq!((edges(&u), widths(&u)), (shown, (320.0, 400.0)), "back as it was"); + assert!(control(&mut u, Role::Button, "Expand the interface").is_none()); + // Hide UI hides the toolbar as well, as before. + u.app.run("view.toggleUi", json!({})); + assert!(control(&mut u, Role::Toolbar, "Tools").is_none(), "Hide UI takes the toolbar too"); + u.app.run("view.toggleUi", json!({})); +} + #[test] fn the_smallest_window_keeps_its_canvas_whatever_the_widths() { for asked in [(240.0, 240.0), (480.0, 480.0), (480.0, 240.0), (200.0, 480.0)] { @@ -231,6 +283,37 @@ fn the_smallest_window_keeps_its_canvas_whatever_the_widths() { } } +/// Minimize takes nothing from a phone-sized window, which has no sidebars beside the canvas: its +/// panels open from their buttons as before, and the interface is minimized again once the window +/// is wide. +#[test] +fn a_narrow_window_keeps_its_panel_buttons_while_minimized() { + use crate::MobilePanel; + let ctx = egui::Context::default(); + let mut app = FigApp::new(Session::new(), Box::new(NoServices)); + let mut k = 0.0; + let mut canvas_width = |app: &mut FigApp, size: egui::Vec2| { + for _ in 0..4 { + k += 1.0 / 60.0; + let input = RawInput { screen_rect: Some(Rect::from_min_size(Pos2::ZERO, size)), time: Some(k), ..Default::default() }; + ctx.run_ui(input, |ui| app.ui(ui)).textures_delta.clear(); + } + app.canvas.rect.width() + }; + let phone = vec2(390.0, 844.0); + app.run("view.minimize", json!({"on": true})); + assert!(canvas_width(&mut app, phone) >= 380.0, "closed panels leave the whole width"); + app.ui.mobile_panel = Some(MobilePanel::Left); + let w = canvas_width(&mut app, phone); + assert!((1.0..=60.0).contains(&w), "the Layers button opens the left panel while minimized: {w}"); + app.ui.mobile_panel = None; + let wide = canvas_width(&mut app, vec2(1440.0, 900.0)); + assert!(wide >= 1439.0, "wide again, the interface is minimized: the canvas has the window ({wide})"); + app.run("view.minimize", json!({"on": false})); + let wide = canvas_width(&mut app, vec2(1440.0, 900.0)); + assert!(wide > 600.0 && wide < 1100.0, "expanded, both panels are beside the canvas again ({wide})"); +} + /// A phone-sized window: the canvas has the whole width, and each side panel opens alone over it, /// leaving the strip with the panel buttons. A wide window ignores the choice. #[test] diff --git a/crates/ui-egui/src/panels/layers.rs b/crates/ui-egui/src/panels/layers.rs index feeed46e6..164ec7e4a 100644 --- a/crates/ui-egui/src/panels/layers.rs +++ b/crates/ui-egui/src/panels/layers.rs @@ -159,13 +159,15 @@ pub fn left_panel(app: &mut FigApp, ui: &mut Ui) { ui.painter().text(pos2(head.min.x + 16.0, head.min.y + 46.0), Align2::LEFT_CENTER, tr("Drafts"), regular(11.0), t.text_secondary); } let hr = Rect::from_center_size(pos2(head.max.x - 24.0, head.min.y + 24.0), vec2(24.0, 24.0)); - let hresp = ui.interact(hr, ui.scope_id().with("hideui"), Sense::click()).tip(tr("Collapse panel")); + // Minimize, by the file name: "click Minimize next to the file name to collapse the + // navigation bar, left sidebar, and right sidebar" (Explore the navigation bar and left sidebar). + let hresp = ui.interact(hr, ui.scope_id().with("hideui"), Sense::click()).tip(tr("Minimize")); if hresp.hovered() { ui.painter().rect_filled(hr, CornerRadius::same(5), t.hover); } icons::paint(ui.painter(), hr.shrink(5.0), Icon::Panels, t.icon); if hresp.clicked() { - app.ui.close_left_panel(); + app.run("view.minimize", json!({})); } ui.painter().line_segment([head.left_bottom(), head.right_bottom()], Stroke::new(1.0, t.border)); match app.ui.left_tab { diff --git a/crates/ui-egui/src/shortcuts_tests.rs b/crates/ui-egui/src/shortcuts_tests.rs index 5c1e06fab..4b223b211 100644 --- a/crates/ui-egui/src/shortcuts_tests.rs +++ b/crates/ui-egui/src/shortcuts_tests.rs @@ -124,8 +124,12 @@ fn panel_keys_and_cmd_k() { press(&mut u, Key::D, Modifiers::SHIFT); assert_eq!(u.app.ui.right_tab, RightTab::Design); let collapsed = u.app.ui.left_collapsed; + let minimized = |u: &Ui| u.app.session.ds().unwrap().view.ui_minimized; press(&mut u, Key::Backslash, Modifiers::SHIFT | Modifiers::COMMAND); - assert_eq!(u.app.ui.left_collapsed, !collapsed, "Shift+Cmd+\\ toggles the left sidebar"); + assert!(minimized(&u), "Shift+Cmd+\\ minimizes the interface"); + assert_eq!(u.app.ui.left_collapsed, collapsed, "without collapsing the left sidebar for good"); + press(&mut u, Key::Backslash, Modifiers::SHIFT | Modifiers::COMMAND); + assert!(!minimized(&u), "and back"); press(&mut u, Key::K, Modifiers::COMMAND); assert!(u.app.ui.palette.is_some(), "Cmd+K opens Actions on the canvas"); } diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 7a416f2d6..1d3c01373 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-02 · **Change:** patch (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; 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-02 · **Change:** patch (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: @@ -17,7 +17,7 @@ interaction feel not yet compared. |---|---|---| | UI3 layout: tab strip as title bar, icon rail, file header, pages + layers, floating bottom toolbar with flyouts, Design / Prototype / Inspect panels | done | frameless window on Windows/Linux with drawn buttons; on a Wayland compositor that offers no server-side decorations (GNOME) the window gets winit's Adwaita controls instead (#592; checked by its author on GNOME, KDE not run) | | Light and dark themes | done | colours from `theme::Tokens`; a file or a page made while the dark theme shows gets a `#1E1E1E` page (`#F5F5F5` in the light theme), its own from then on: changing the theme repaints no page and opened files keep theirs; the file the app opens with takes the theme once it is known; the CLI, MCP and exports have no theme and keep `#F5F5F5`; text drawn with the Text tool is white on a dark page and black on a light one (so is text a command makes in the app without naming a fill; headless sessions keep black) (`theme_pages_tests`, `dark_page_text_tests`) | -| Minimize UI (Cmd+\\) | done | | +| Minimize UI (Shift+Cmd/Ctrl+\\, the Minimize button by the file name) and Show/Hide UI (Cmd/Ctrl+\\) | done | Minimize collapses the navigation bar and both sidebars and keeps the toolbar and the panel widths; "If you select an object while the panels are minimized, the left sidebar remains minimized while the right sidebar expands [...] Once all objects are deselected, the right panel minimizes again" (Explore the navigation bar and left sidebar); a small Expand button at the top left of the canvas puts them back (FigCraft's own, the article names no control for it). Hide UI takes the toolbar too (`panel_width_tests`, `shortcuts_tests`; #1835) | | Resizable panels | done | each panel's edge drags its width (left 200–480, right 240–480, 240 by default; a double-click on the edge or View ▸ Panels ▸ Reset panel widths puts the default back); the widths are each window's own, the main window's are kept in the preferences when a drag ends and come back at the next start, a new window opens with those of the window it comes from; Minimize UI hides the panels and brings them back as they were; the view keeps its centre and zoom while a panel is resized; in a window too small for them the panels give way so the canvas keeps 160 px (the left one first), down to the smallest window (800×500) (`panel_width_tests`). Not compared with Figma's widths; no snap points | | Design panel's sections on one grid | done | every section lays its rows out on the same grid: the panel is 240 pt, its content 16 pt in from the left and 8 pt from the right, two 88 pt columns at that width with 8 pt gutters and a 24 pt column for the buttons at a row's end (the columns are flex, so they share the panel when it is dragged wider); rows 24 pt in a 32 pt track, 10 pt captions over them; section titles 11 pt semibold and a row's values 11 pt, their buttons 24 pt and 4 pt apart. The panel's edge is drawn inside it: a frame stroke counts as margin and took 1 pt off each side, putting every right margin 1–2 pt out (checked in the app on Windows over the control channel) | | Actions palette (Cmd+K, Cmd+/) | done | tabs: All (every command, grouped by menu, or Other; a command that needs parameters only through its menu item, and none twice under one label, #1574), Assets (components and styles) and Plugins & widgets; results ranked prefix first, then shortest, at most 60 rows; Up/Down move a highlight and Enter runs it; Recents list what was run from the palette (matching translated labels); one open/toggle path from every entry point (`palette_tests`). Ranking and the Assets results not compared with Figma's | @@ -181,6 +181,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | 2026-11-02 | patch | M4: max lines on an auto-width text keep it auto width: the box hugs up to that many lines and still grows with its longest line ("Max lines is available only if truncate text is enabled, and: Text resizing is set to auto height or auto width", Explore text properties). `text.maxLines` turned such a text into a fixed truncating box with a stale height, so later typing no longer widened it; fixed-size text still becomes a truncating box, auto-height text hugs as before. Test: `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines` | | 2026-11-02 | patch | M4, #1828: superscript and subscript synthesised where the font has no `sups` / `subs` glyphs (the standard glyph shrunk and shifted by the OS/2 metrics, the usual 0.65 em and 0.35 / 0.14 em offsets without them), and a run mixing available and unavailable glyphs synthesised whole, as Explore text properties says. Tests: `text::tests::superscript_native_or_synthesised_and_never_mixed`, `text_behaviour_tests::superscript_and_subscript_are_synthesised_without_glyphs_for_them`. | | 2026-11-02 | patch | Shortcuts: Alt+Enter while editing text opens the link at the caret ("When editing text, press ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma) through the new `text.openLink` command, which hands a web or mail link to the platform's opener and refuses any other scheme as the prototype player does; editing goes on. The key went to the editor as a plain Enter before. A documented row: 134 documented, 133 bound. Tests: engine `text_link_tests`, `text_link_tests` (UI) | +| 2026-11-02 | patch | M7, #1835: Minimize (`view.minimize`, Shift+Cmd/Ctrl+\\, the Minimize button by the file name) collapses the navigation bar, the left sidebar and the right sidebar and keeps the toolbar and the panel widths ("click Minimize next to the file name to collapse the navigation bar, left sidebar, and right sidebar"; "This collapses the navigation bar, left sidebar, and right sidebar for an expanded view", Explore the navigation bar and left sidebar); the right sidebar shows while something is selected and goes once nothing is; an Expand button at the top left of the canvas puts everything back. The shortcut and the button collapsed the left sidebar alone before (`view.leftSidebar` stays as a command without a key). Tests: `panel_width_tests`, `shortcuts_tests`. Numbers unchanged (the row is bound to the new command) | | 2026-11-01 | patch | Shortcuts: Cmd/Ctrl+Shift+Alt+= and - make the interface larger and smaller through the sizes Preferences offers, and Cmd/Ctrl+Shift+Alt+0 puts it back to the system's size ("Adjust the scale of the Figma UI [...] Reset to Default: Control ⇧Shift Alt 0; Make Larger: Control ⇧Shift Alt =; Make Smaller: Control ⇧Shift Alt -", Accessibility at Figma); the size is kept at once, as one picked in Preferences is. `pref.uiScaleUp`, `pref.uiScaleDown`, `pref.uiScaleReset`; the sizes list now lives in the engine (`UI_SCALE_SIZES`) and Preferences reads it from there. Found by a documentation audit of the shortcuts. Test: `keymap_tests::the_interface_size_keys_step_through_the_preferences_sizes`. Documented rows 130 → 133, bound 129 → 132 | | 2026-11-01 | patch | Shortcuts: Cmd/Ctrl+Alt+↑/↓ (and ←/→) rotate the selection one degree at a time, 15 with Shift ("Press ⌘Command ⌥Option ↑/ ↓ on Mac or Control Alt ↑/↓ on Windows to rotate an object one degree at a time", Accessibility at Figma); they resized by the nudge before, which Cmd/Ctrl+arrows without Alt still do. Down and right turn clockwise, up and left back (the documentation is silent on the direction). In the shortcuts panel's Transform tab, over the control channel's `ui.key` too. Found by a documentation audit of the shortcuts. Test: `shortcut_keys_tests::cmd_alt_arrows_rotate_a_degree_and_fifteen_with_shift`. Documented rows 129 → 130, bound 128 → 129 | | 2026-11-01 | patch | Shortcuts: the Layers panel opens with Ctrl+1 as well as Alt+1 on Windows and Linux ("Mac: Option 1 Windows: Ctrl 1" in Select layers and objects; "Windows: Alt 1" in Explore the navigation bar and left sidebar). macOS keeps Option+1. Found by a documentation audit of the shortcuts (every chord driven over the control channel). Tests: `keymap_tests::the_layers_panel_answers_both_of_its_documented_windows_keys`, the parity row. Counts unchanged | From 02c38a6d959f0afd82e44d9d67d396266e6ab4a3 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Mon, 2 Nov 2026 19:26:05 -0500 Subject: [PATCH 33/49] Release 0.15.0 Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 44 ++++++++++++++++++++++---------------------- Cargo.toml | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 888365316..b9fb98654 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1763,7 +1763,7 @@ checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" [[package]] name = "figcraft" -version = "0.14.0" +version = "0.15.0" dependencies = [ "arboard", "craft-menu", @@ -1795,7 +1795,7 @@ dependencies = [ [[package]] name = "figcraft-cli" -version = "0.14.0" +version = "0.15.0" dependencies = [ "clap", "clap_complete", @@ -1813,7 +1813,7 @@ dependencies = [ [[package]] name = "figcraft-collab" -version = "0.14.0" +version = "0.15.0" dependencies = [ "base64 0.22.1", "chrono", @@ -1831,7 +1831,7 @@ dependencies = [ [[package]] name = "figcraft-collab-net" -version = "0.14.0" +version = "0.15.0" dependencies = [ "base64 0.22.1", "figcraft-collab", @@ -1854,7 +1854,7 @@ dependencies = [ [[package]] name = "figcraft-color" -version = "0.14.0" +version = "0.15.0" dependencies = [ "kurbo", "serde", @@ -1863,7 +1863,7 @@ dependencies = [ [[package]] name = "figcraft-doc" -version = "0.14.0" +version = "0.15.0" dependencies = [ "figcraft-color", "figcraft-geom", @@ -1876,7 +1876,7 @@ dependencies = [ [[package]] name = "figcraft-engine" -version = "0.14.0" +version = "0.15.0" dependencies = [ "base64 0.22.1", "craft-docpath", @@ -1910,7 +1910,7 @@ dependencies = [ [[package]] name = "figcraft-format" -version = "0.14.0" +version = "0.15.0" dependencies = [ "figcraft-doc", "figcraft-layout", @@ -1927,7 +1927,7 @@ dependencies = [ [[package]] name = "figcraft-geom" -version = "0.14.0" +version = "0.15.0" dependencies = [ "kurbo", "serde", @@ -1935,7 +1935,7 @@ dependencies = [ [[package]] name = "figcraft-layout" -version = "0.14.0" +version = "0.15.0" dependencies = [ "figcraft-doc", "figcraft-geom", @@ -1943,7 +1943,7 @@ dependencies = [ [[package]] name = "figcraft-mcp" -version = "0.14.0" +version = "0.15.0" dependencies = [ "base64 0.22.1", "figcraft-collab-net", @@ -1959,7 +1959,7 @@ dependencies = [ [[package]] name = "figcraft-pathops" -version = "0.14.0" +version = "0.15.0" dependencies = [ "figcraft-doc", "figcraft-geom", @@ -1968,7 +1968,7 @@ dependencies = [ [[package]] name = "figcraft-pdf" -version = "0.14.0" +version = "0.15.0" dependencies = [ "figcraft-color", "figcraft-doc", @@ -1985,7 +1985,7 @@ dependencies = [ [[package]] name = "figcraft-plugin" -version = "0.14.0" +version = "0.15.0" dependencies = [ "figcraft-color", "serde", @@ -1998,7 +1998,7 @@ dependencies = [ [[package]] name = "figcraft-render" -version = "0.14.0" +version = "0.15.0" dependencies = [ "crc32fast", "figcraft-color", @@ -2017,7 +2017,7 @@ dependencies = [ [[package]] name = "figcraft-server" -version = "0.14.0" +version = "0.15.0" dependencies = [ "chrono", "crc32fast", @@ -2042,7 +2042,7 @@ dependencies = [ [[package]] name = "figcraft-svg" -version = "0.14.0" +version = "0.15.0" dependencies = [ "base64 0.22.1", "figcraft-color", @@ -2058,7 +2058,7 @@ dependencies = [ [[package]] name = "figcraft-text" -version = "0.14.0" +version = "0.15.0" dependencies = [ "core-text", "craft-font-catalog", @@ -2076,7 +2076,7 @@ dependencies = [ [[package]] name = "figcraft-ui-egui" -version = "0.14.0" +version = "0.15.0" dependencies = [ "base64 0.22.1", "chrono", @@ -2104,7 +2104,7 @@ dependencies = [ [[package]] name = "figcraft-vectordrawable" -version = "0.14.0" +version = "0.15.0" dependencies = [ "figcraft-color", "figcraft-doc", @@ -2118,7 +2118,7 @@ dependencies = [ [[package]] name = "figcraft-web" -version = "0.14.0" +version = "0.15.0" dependencies = [ "base64 0.22.1", "eframe", @@ -6739,7 +6739,7 @@ checksum = "9440ea3e5aeabb0ac63af70daf835274065238cdd0cec83418f417eae38bacee" [[package]] name = "xtask" -version = "0.14.0" +version = "0.15.0" dependencies = [ "figcraft-engine", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index c7a86dd21..c9b915a69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ exclude = ["plugins"] # default-members = ["crates/*", "apps/figcraft", "apps/figcraft-cli", "xtask"] [workspace.package] -version = "0.14.0" +version = "0.15.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.95" From 3ebf0641cb3b07440460ceb26f20c272fabe8eaf Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 2 Nov 2026 23:45:53 -0500 Subject: [PATCH 34/49] fix(collab): place keyed-list puts through an index within a batch (#1893) * fix(collab): place keyed-list puts through an index within a batch Each Put of a comment, style, variable or collection scanned the whole list for its key (cloning String keys on the way) before appending, so a batch of N new entries cost N squared comparisons on the hub every session shares. Removing an image also rebuilt the document's image-use set before checking the image existed. Replica::apply now keeps a per-batch key index for each keyed list; it is rebuilt when the list's length or the entry at a key no longer matches, and dropped on whole-list sets, reorders and real removals. Removing an absent entry or image returns without scanning. * fix(collab): keep the keyed-list index current through removals Build the index without dead code outside tests, drop the wall-clock assertion from the large-batch test, and shift the index down after a single-entry removal instead of discarding it, so a run of removals in one batch does not index the list again each time. Staleness checks for puts and removals share one helper. Tests cover removals, duplicate keys from a whole-list set, and absent keys. --- crates/collab/src/docprops.rs | 152 +++++++++++++++++++++----- crates/collab/src/keyed_list_tests.rs | 132 ++++++++++++++++++++++ crates/collab/src/lib.rs | 2 + crates/collab/src/replica.rs | 7 +- 4 files changed, 261 insertions(+), 32 deletions(-) create mode 100644 crates/collab/src/keyed_list_tests.rs diff --git a/crates/collab/src/docprops.rs b/crates/collab/src/docprops.rs index e203d2c3b..b590064df 100644 --- a/crates/collab/src/docprops.rs +++ b/crates/collab/src/docprops.rs @@ -54,18 +54,71 @@ struct List { entry: fn(T::Key) -> Entry, get: fn(&Document) -> &Vec, get_mut: fn(&mut Document) -> &mut Vec, + /// The list's slot in an [`Index`]. + index: fn(&mut Index) -> &mut Option>, } -const STYLES: List