From 297426c595b7b681d537d92bc39f2e4b593e9853 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 6 Nov 2026 22:21:51 -0800 Subject: [PATCH 001/239] Export: color profile text states which formats are tagged and that CMYK PDF is DeviceCMYK The export tool and command descriptions, docs/mcp.md and the file-format table said PDF is always sRGB, that sRGB JPG is untagged and that every exported file is tagged with its profile. RGB PDF is sRGB and PDF with cmyk is DeviceCMYK; JPG embeds an ICC profile for sRGB and Display P3; WebP embeds one for Display P3 only. The JPG quality (1 to 100, default 90) now has one row in the format table. --- crates/engine/src/cmd/file.rs | 2 +- crates/mcp/src/tools.rs | 2 +- docs/file-format-parity.md | 7 +++---- docs/mcp.md | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rs index 0ed12b8d3..e52960d43 100644 --- a/crates/engine/src/cmd/file.rs +++ b/crates/engine/src/cmd/file.rs @@ -120,7 +120,7 @@ pub fn specs() -> Vec { spec!( "file.export", "Export", - "{ids? (default selection, else the page), format? (png|jpg|svg|pdf|webp|xml (an Android Vector Drawable, with `warnings` for what it changed or left out), or fig: the whole file as .fig, experimental, with `warnings` for what was left out; other apps may not open every file; or penpot: the whole file as a Penpot 2.x archive, with warnings for unsupported content), scale? (default 1) | size? (2x|512w|512h or {by: scale|width|height, value}: a scale, or a width or height in pixels), path? (else returns base64 `data`), bleed? (PDF: points, or with a unit: \"3mm\", \"0.125in\", \"9pt\"), cropMarks?, bleedMarks?, cmyk? (PDF print options), contentsOnly? (default true; false also draws the layers that show in their area), includeBoundingBox? (true: only the layers' own boxes, cutting off shadows and outside strokes), svgOutlineText? (default true), svgSimplifyStroke? (default true), svgIdAttribute? (SVG ids, XML android:name), vdCompat? (XML: bestEffort (default: approximate with a warning)|exact (leave out what can't be exact, with a warning)|ignore (no warnings)), colorProfile? (PNG, JPG and WebP: sameAsFile (default: the document's profile)|srgb|displayP3; colors convert, out-of-gamut ones clip; SVG, PDF and XML are always sRGB), quality? (JPG: 1-100, default 90)}", + "{ids? (default selection, else the page), format? (png|jpg|svg|pdf|webp|xml (an Android Vector Drawable, with `warnings` for what it changed or left out), or fig: the whole file as .fig, experimental, with `warnings` for what was left out; other apps may not open every file; or penpot: the whole file as a Penpot 2.x archive, with warnings for unsupported content), scale? (default 1) | size? (2x|512w|512h or {by: scale|width|height, value}: a scale, or a width or height in pixels), path? (else returns base64 `data`), bleed? (PDF: points, or with a unit: \"3mm\", \"0.125in\", \"9pt\"), cropMarks?, bleedMarks?, cmyk? (PDF print options), contentsOnly? (default true; false also draws the layers that show in their area), includeBoundingBox? (true: only the layers' own boxes, cutting off shadows and outside strokes), svgOutlineText? (default true), svgSimplifyStroke? (default true), svgIdAttribute? (SVG ids, XML android:name), vdCompat? (XML: bestEffort (default: approximate with a warning)|exact (leave out what can't be exact, with a warning)|ignore (no warnings)), colorProfile? (PNG, JPG and WebP: sameAsFile (default: the document's profile)|srgb|displayP3; colors convert, out-of-gamut ones clip; SVG, XML and RGB PDF output are always sRGB; PDF with cmyk is DeviceCMYK), quality? (JPG: 1-100, default 90)}", false, export ), diff --git a/crates/mcp/src/tools.rs b/crates/mcp/src/tools.rs index 9e901f5bb..5d4296f01 100644 --- a/crates/mcp/src/tools.rs +++ b/crates/mcp/src/tools.rs @@ -280,7 +280,7 @@ fn tools() -> Vec { "svgIdAttribute": boolean("SVG: layer names as unique `id` attributes (default false)"), "svgSimplifyStroke": boolean("SVG: strokes as `stroke` attributes where exact (default true); false writes outlines"), "vdCompat": {"type": "string", "enum": ["bestEffort", "exact", "ignore"], "description": "XML: what a Vector Drawable can't draw exactly is approximated with a warning (bestEffort, default), left out with a warning (exact), or written as far as it maps without warnings (ignore: overlapping layer opacity dropped, even-odd fills kept as fillType=evenOdd, diamond gradients left out)"}, - "colorProfile": {"type": "string", "enum": ["sameAsFile", "srgb", "displayP3"], "description": "PNG, JPG and WebP: the color profile of the file (default sameAsFile: the document's); colors are converted and out-of-gamut ones clip. SVG, PDF and XML are always sRGB"}, + "colorProfile": {"type": "string", "enum": ["sameAsFile", "srgb", "displayP3"], "description": "PNG, JPG and WebP: the color profile of the file (default sameAsFile: the document's); colors are converted and out-of-gamut ones clip. SVG, XML and RGB PDF output are always sRGB; PDF with cmyk is DeviceCMYK"}, "quality": {"type": "integer", "minimum": 1, "maximum": 100, "description": "JPG: the encoder's quality, 1 (smallest file) to 100; default 90"}, }), &[], diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index bce90b008..335115ad1 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -54,12 +54,11 @@ export limit, not a native document nesting limit. | Format | Figma | FigCraft | Notes | Hours | |---|---|---|---|---| | PNG | yes, scales/suffixes | yes | export settings per layer, presets (`2x`, `512w`, `512h`), preview, "Export N layers"; ignore overlapping layers (on by default; off: every layer showing in the area) and include bounding box (the layer's own box; the Export section offers it for text layers, and `file.export` and `export.update` take it for any layer); slashes in layer names export into folders. The exported area is what the layer paints: shadows towards their offset, outside and centre strokes, unclipped children, a mask group's mask, nothing for hidden layers; slices export everything under them, except that with ignore overlapping layers on a slice inside a frame or group exports only that frame or group; sides round up to whole pixels | — | -| JPG | yes | yes | white where transparent; quality 1 to 100 (`quality` on `file.export`, export settings and MCP `export`; default 90; the Export panel has no control for it yet); the file's colour profile embedded as ICC (APP2), sRGB too | — | +| JPG | yes | yes | white where transparent; quality 1 to 100 (`quality` on `file.export`, export settings and MCP `export`; default 90; the Export panel has no control for it yet); a color profile per setting as for PNG (`colorProfile`), the file tagged with an ICC profile (APP2) for sRGB and for Display P3 | — | | PNG | yes, scales/suffixes | yes | export settings per layer, presets (`2x`, `512w`, `512h`), preview, "Export N layers"; ignore overlapping layers (on by default; off: every layer showing in the area) and include bounding box (the layer's own box; the Export section offers it for text layers, and `file.export` and `export.update` take it for any layer); slashes in layer names export into folders. The exported area is what the layer paints: shadows towards their offset, outside and centre strokes, unclipped children, a mask group's mask, nothing for hidden layers; slices export everything under them, except that with ignore overlapping layers on a slice inside a frame or group exports only that frame or group; sides round up to whole pixels; a color profile per setting (Same as file, the default, sRGB or Display P3: `colorProfile`), the pixels converted and the file tagged (`sRGB` chunk, or ICC and `cICP`) | — | -| JPG | yes | yes | white where transparent; fixed quality (90); a color profile per setting as for PNG (sRGB untagged, Display P3 with its ICC profile) | — | | SVG | yes (outline text option, ids) | yes | alpha/luminance masks kept; noise, texture, progressive and background blur, glass embedded as images; outline text (off: `` with one `` per line, one style per layer), unique id attributes from layer names, explicit depth-limit refusal, nested frames clipped by their parent's clip (#327), simplified strokes (stroke attributes for centred strokes and for inside and outside strokes on boxes and ellipses) | — | | PDF | yes | yes | one page per frame, real selectable text in subset fonts, links, vectors and gradients as vectors, effects as images; bleed, crop/bleed marks, page boxes, naive CMYK; checked by rendering the PDF back against PNG exports; explicit depth-limit refusal; RGB is always sRGB (no color profile setting and no output intent) | CMYK output intent 2–4 | -| WebP | — | yes (ours) | a color profile per setting as for JPG | — | +| WebP | — | yes (ours) | a color profile per setting as for PNG; sRGB files untagged, Display P3 files with the generated ICC profile | — | | Android Vector Drawable (XML) | — | yes (ours) | an `.xml` drawable resource (`file.export {format: "xml"}`, export settings, File ▸ Export…, the CLI and MCP), pretty-printed, sized in dp with the viewport in layer units, for AndroidX (VectorDrawableCompat: gradients and even-odd need API 24 without it). Shapes, booleans and text as path data with transforms baked in; solid fills and linear, radial and sweep gradients (`aapt:attr`, exact for any handles: radial and sweep in a `` that maps the unit circle); centred strokes as stroke attributes where Android draws them the same (uniform scale, one cap, no dashes or variable width), other strokes as filled outlines; clipping frames and masks as `` with ``; `android:name` from layer names with the id attribute option. What the format can't hold goes by the compatibility mode (`vdCompat`): best effort (default) applies layer opacity to each shape, rewrites even-odd fills and clip outlines as non-zero, draws diamond gradients as radial and alpha masks as outline clips, each with a warning; exact leaves out what it can't draw exactly, with a warning; ignore writes what maps without warnings: layer opacity over overlapping shapes is dropped (drawn opaque), even-odd fills keep `fillType="evenOdd"`, even-odd clip outlines clip as non-zero, diamond gradients are left out and alpha masks clip to their outline. Effects, image and pattern fills and blend modes are always left out (warned except in ignore); an export that draws nothing writes one empty path (Android refuses a drawable without a path), with a warning. Checked by parsing the XML, against FigCraft's renderer (gradients pixel by pixel), with `aapt2 compile` and `link`, and by rendering samples (linear, skewed radial and sweep gradients, a sweep with mirrored handles, even-odd booleans, centred and inside strokes, rotated text, a clipping frame, an alpha mask, a translucent group, each compatibility mode) with Android 13's (API 33) VectorDrawable on an emulator, next to FigCraft's PNG export: they match, including where the sweep starts and which way it turns, except what the compatibility mode and its warnings say (best effort: overlapping shapes in a translucent group look denser; exact and ignore leave out or draw opaque what they list). Not checked on API 21–23 (VectorDrawableCompat) | — | | Copy as CSS / SVG / PNG / text / link | yes | yes | Copy as PNG: the whole selection at 2x | — | | Dev Mode code (CSS, iOS SwiftUI, Android Compose) | yes | yes, plus HTML, React, Vue, Leptos, ArkUI and Flutter | see [dev-mode-parity](dev-mode-parity.md) | — | @@ -193,7 +192,7 @@ source paint coordinates. | 2026-11-04 | minor | JPG export: `quality` (1 to 100, default 90) on `file.export`, `export.add` / `export.update` and MCP `export`, kept in the export setting; an sRGB file's JPGs embed the sRGB ICC profile, as Display P3 files' JPGs already embedded theirs, since an untagged JPG is only assumed to be sRGB (#2004). | | 2026-11-04 | minor | `.fig` and `.jam` import, #1910: an elbowed connector saved with its path keeps it. FigJam stores `connectorControlPoints`, one per run between the first and the last, each a point on its run (in the connector's parent's coordinates) with the run's axis; the first run leaves the start's side and the last arrives at the end's. They become the `ConnectorPath::Runs` a board connector reshaped by hand has (`figcraft_doc::route_along`), so a connector drawn around a layer in FigJam stays around it instead of being routed through it. Points that don't make such a path (off both axes, two runs in a row the same way, a first or last run sideways to its side or going back into its object, more runs than a hand could make) leave the connector to the router as before, and only connectors routed here count in the "follow FigCraft's own routing" note. A curved connector's `connectorBezierControlPoints` are still not read. Tests: `tail_tests::an_elbow_connector_saved_with_its_path_keeps_it`, `tail_tests::an_elbow_whose_saved_path_doesnt_fit_its_sides_is_routed_here`. | | 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 | minor | Export settings: each PNG, JPG and WebP setting has a color profile, Same as file (the default; the document's profile when it exports), sRGB or Display P3, in its advanced settings and as `colorProfile` on `export.add`, `export.update`, `file.export`, `file.exportLayers` and MCP `export`. The pixels convert to the chosen profile (out-of-gamut colors clip) and the file is tagged as before: sRGB PNG with an `sRGB` chunk, Display P3 with the generated ICC profile (and `cICP` in PNG); sRGB JPG and WebP stay untagged. A setting keeps its choice when its format changes; settings saved without one read as Same as file. SVG, PDF and XML show no choice and stay sRGB (PDF has no output intent yet). Numbers unchanged | +| 2026-10-31 | minor | Export settings: each PNG, JPG and WebP setting has a color profile, Same as file (the default; the document's profile when it exports), sRGB or Display P3, in its advanced settings and as `colorProfile` on `export.add`, `export.update`, `file.export`, `file.exportLayers` and MCP `export`. The pixels convert to the chosen profile (out-of-gamut colors clip) and the file is tagged as before: sRGB PNG with an `sRGB` chunk, Display P3 with the generated ICC profile (and `cICP` in PNG); sRGB JPG embeds the sRGB ICC profile (#2004) and sRGB WebP stays untagged. A setting keeps its choice when its format changes; settings saved without one read as Same as file. SVG, PDF and XML show no choice and stay sRGB (PDF has no output intent yet). 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 | diff --git a/docs/mcp.md b/docs/mcp.md index aebcbf46d..11945a76c 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -255,7 +255,7 @@ Or in a project's `.mcp.json`: profile into the file's space: an embedded ICC profile (PNG, JPG, WebP, TIFF; RGB or grey), a PNG's `sRGB` / `gAMA` / `cHRM` chunks, else sRGB (also for CMYK or damaged profiles); `image.place` reports the profile's name as `imageProfile` (`null`: none usable, taken as sRGB). PNG exports are tagged (`sRGB` chunk, or a Display P3 ICC profile plus - `cICP`), Display P3 JPG and WebP embed the ICC profile, and SVG and PDF export Display P3 files + `cICP`), JPG embeds the ICC profile for sRGB and for Display P3, WebP embeds it for Display P3 only (sRGB WebP is untagged), and SVG and PDF export Display P3 files converted to sRGB (out-of-gamut colours clip). The app's canvas shows sRGB (P3 colours outside sRGB clip on screen): `view.proofSrgb {on?}` (View ▸ Soft-proof sRGB) stripes those pixels so `screenshot {window: true}` shows where they are (after the next canvas render), and the colour picker says Outside @@ -380,7 +380,7 @@ a later step can use `{"$step": 0, "field": "ids/0"}` to target the first match. | `inspect_document {depth, allPages, fields?, outline?}` | The document as JSON (its `id`, layer tree, styles, selection, history); `fields` selects layer properties, `outline: true` gives a compact tree (below). The tools that act on a document also take `document` (see Naming the document below). | | `get_node {id, depth, fields?, outline?}` | One layer as JSON; takes the same `fields` and `outline` options; `pluginData` (`{key: value}`, values as strings) when the layer or page has layer data written with `set_properties {props: {pluginData}}`. | | `select {ids}` | Replace the selection (`[]` deselects). | -| `export {ids, format, scale \| size, path?, bleed?, cropMarks?, bleedMarks?, cmyk?, contentsOnly?, includeBoundingBox?, svgOutlineText?, svgIdAttribute?, svgSimplifyStroke?, vdCompat?, colorProfile?, quality?}` | png, jpg, svg, webp, pdf, xml (an Android Vector Drawable: `svgIdAttribute` writes `android:name`, `vdCompat` is `bestEffort` (default: approximated with a warning), `exact` (left out with a warning) or `ignore` (no warnings: overlapping layer opacity dropped, even-odd fills kept as `fillType="evenOdd"`, diamond gradients left out), and the result lists `warnings` for what was changed or left out), or `fig`: the whole file as `.fig`, experimental (see Exporting `.fig` files below); `size` is `2x`, `512w` or `512h`; `quality` is the JPG quality, 1 to 100 (default 90). The image covers what the layers paint (shadows towards their offset, strokes, unclipped children, a mask group's mask; hidden layers take no room; a slice is its area with everything under it, or only the frame or group it sits in while `contentsOnly` is on); `contentsOnly: false` also draws every other layer showing in that area, `includeBoundingBox` exports the layers' own boxes; SVG: `svgOutlineText: false` keeps ``, `svgIdAttribute` writes unique ids from layer names, `svgSimplifyStroke: false` writes every stroke as an outline; png, jpg and webp: `colorProfile` is `sameAsFile` (default: the document's profile), `srgb` or `displayP3`, the pixels converted (out-of-gamut colors clip) and the file tagged for it (SVG, PDF and XML are always sRGB). The same options go in export settings (`export.add` / `export.update`). PDF: frames one page each (sized in points), anything else together on one page; print options: `bleed` (points or a length like `"3mm"`, `"0.125in"`), crop and bleed marks, CMYK colour (see Exports below), also taken by `file.export`, `file.exportLayers`, `file.exportFramesPdf` and stored per export setting by `export.add` / `export.update`; `run_command` `file.exportFramesPdf {page?, path?}` writes every top-level frame of a page. Without `path`, images come back as MCP image content, SVG as text, XML as text followed by `{format, bytes, warnings}`. Layers' own export settings: `run_command` with `export.add` / `export.update {index, size?, suffix?, format?}` / `export.remove` and `file.exportLayers {ids?, dir?, assets?}` (every layer once per setting, named `.`, a slash in a layer name making a folder; `assets: true` exports the Inspect tab's assets instead: icons as SVG, images as PNG). | +| `export {ids, format, scale \| size, path?, bleed?, cropMarks?, bleedMarks?, cmyk?, contentsOnly?, includeBoundingBox?, svgOutlineText?, svgIdAttribute?, svgSimplifyStroke?, vdCompat?, colorProfile?, quality?}` | png, jpg, svg, webp, pdf, xml (an Android Vector Drawable: `svgIdAttribute` writes `android:name`, `vdCompat` is `bestEffort` (default: approximated with a warning), `exact` (left out with a warning) or `ignore` (no warnings: overlapping layer opacity dropped, even-odd fills kept as `fillType="evenOdd"`, diamond gradients left out), and the result lists `warnings` for what was changed or left out), or `fig`: the whole file as `.fig`, experimental (see Exporting `.fig` files below); `size` is `2x`, `512w` or `512h`; `quality` is the JPG quality, 1 to 100 (default 90). The image covers what the layers paint (shadows towards their offset, strokes, unclipped children, a mask group's mask; hidden layers take no room; a slice is its area with everything under it, or only the frame or group it sits in while `contentsOnly` is on); `contentsOnly: false` also draws every other layer showing in that area, `includeBoundingBox` exports the layers' own boxes; SVG: `svgOutlineText: false` keeps ``, `svgIdAttribute` writes unique ids from layer names, `svgSimplifyStroke: false` writes every stroke as an outline; png, jpg and webp: `colorProfile` is `sameAsFile` (default: the document's profile), `srgb` or `displayP3`, the pixels converted (out-of-gamut colors clip) and the file tagged for it (PNG: `sRGB` chunk, or ICC and `cICP` for Display P3; JPG: ICC profile; WebP: ICC profile for Display P3, none for sRGB) (SVG, XML and RGB PDF output are always sRGB; PDF with `cmyk` is DeviceCMYK). The same options go in export settings (`export.add` / `export.update`). PDF: frames one page each (sized in points), anything else together on one page; print options: `bleed` (points or a length like `"3mm"`, `"0.125in"`), crop and bleed marks, CMYK colour (see Exports below), also taken by `file.export`, `file.exportLayers`, `file.exportFramesPdf` and stored per export setting by `export.add` / `export.update`; `run_command` `file.exportFramesPdf {page?, path?}` writes every top-level frame of a page. Without `path`, images come back as MCP image content, SVG as text, XML as text followed by `{format, bytes, warnings}`. Layers' own export settings: `run_command` with `export.add` / `export.update {index, size?, suffix?, format?}` / `export.remove` and `file.exportLayers {ids?, dir?, assets?}` (every layer once per setting, named `.`, a slash in a layer name making a folder; `assets: true` exports the Inspect tab's assets instead: icons as SVG, images as PNG). | | `screenshot {ids?, scale?, maxSize?, window?}` | PNG of the page (with background) or of layers, scaled to fit `maxSize` (default 1600). `window: true` captures the app window in front when attached, a window id (see Windows below) that window. | | `open_file {path, variables?, reload?}` / `save_file {path?}` | Open `.figcraft`, `.json` (FigCraft JSON or REST API file JSON with its variables, see below), `.fig` or FigJam `.jam` (best effort, see below), `.sketch` (Sketch 48 and newer, best effort), `.svg` (see Importing SVG below) or an image; save as `.figcraft`. `open_file` returns `opened` (for a file opened anew, a `summary` of `name`, `pages`, `layers` and `images`, and `warnings` or `repairs`; a file that was already open gives its `index`, with `stale: true` when the file changed on disk since that tab read or saved it; `reload: true` reads it again into the tab, refused while the tab has unsaved changes) and the document's `document` outline. | | `undo` / `redo` | Step through history. | From bc2984a998dcef49844878871640ead076c9ed35 Mon Sep 17 00:00:00 2001 From: Patrik Lermon Date: Sat, 7 Nov 2026 07:55:28 +0100 Subject: [PATCH 002/239] i18n(sv): translate 69 new strings Brings the Swedish catalog up to date with upstream main (3635c230). Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/locales/sv.toml | 69 ++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/crates/ui-egui/locales/sv.toml b/crates/ui-egui/locales/sv.toml index a94feb2a9..c3834d2b6 100644 --- a/crates/ui-egui/locales/sv.toml +++ b/crates/ui-egui/locales/sv.toml @@ -127,6 +127,7 @@ name = "Svenska" "Another server, or one that needs its key. The usual server is set in Preferences." = "En annan server, eller en som kräver sin nyckel. Standardservern anges i Inställningar." "Any status" = "Valfri status" "Anyone on your network with this code can edit the file, while this app stays open." = "Alla i ditt nätverk som har den här koden kan redigera filen så länge appen är öppen." +"Anyone on your network with this code can look at the file, not change it, while this app stays open." = "Alla i ditt nätverk som har den här koden kan titta på filen, men inte ändra den, så länge appen är öppen." "Anyone with the edit link can change the file; the view link only lets people look. The links carry their secrets: share them like passwords. `figcraft-server links` makes more and revokes them." = "Alla med redigeringslänken kan ändra filen; visningslänken låter bara andra titta. Länkarna innehåller sina hemligheter: dela dem som lösenord. `figcraft-server links` skapar fler och återkallar dem." "Anyone with this code can edit the file." = "Alla med den här koden kan redigera filen." "Anyone with this code can look at the file, not change it." = "Alla med den här koden kan titta på filen, men inte ändra den." @@ -387,6 +388,8 @@ name = "Svenska" "Crop marks" = "Skärmärken" "Ctrl+arrows" = "Ctrl+piltangenter" "Ctrl+click" = "Ctrl+klick" +"Ctrl+click a padding field" = "Ctrl+klicka på ett padding-fält" +"⌘ click a padding field" = "⌘ klicka på ett padding-fält" "Ctrl+scroll" = "Ctrl+rullning" "Current name" = "Aktuellt namn" "Current version" = "Aktuell version" @@ -406,6 +409,40 @@ name = "Svenska" "Decoration style" = "Dekorationsstil" "Decoration" = "Dekoration" "Deep select" = "Djupmarkering" +"Scrub a field faster (2x) or slower (1/2, 1/4)" = "Dragjustera ett fält snabbare (2x) eller långsammare (1/2, 1/4)" +"Move up or down while dragging its label" = "Flytta upp eller ned medan du drar dess etikett" +"Scrubbing at 2x" = "Dragjustering med 2x hastighet" +"Scrubbing at 1x" = "Dragjustering med 1x hastighet" +"Scrubbing at 1/2" = "Dragjustering med 1/2 hastighet" +"Scrubbing at 1/4" = "Dragjustering med 1/4 hastighet" +"Delete {n} variables" = { one = "Radera {n} variabel", other = "Radera {n} variabler" } +"Move out of any group" = "Flytta ut ur alla grupper" +"Move to group {group}" = "Flytta till gruppen {group}" +"Scope: all supported properties" = "Omfång: alla egenskaper som stöds" +"Scope: hidden from pickers" = "Omfång: dold i väljare" +"Scope: only {scope}" = "Omfång: endast {scope}" +"Disconnected. Reconnecting…" = "Frånkopplad. Återansluter…" +"Disconnected. Your edits stay here and sync when the connection returns. Reconnecting…" = "Frånkopplad. Dina redigeringar finns kvar här och synkas när anslutningen är tillbaka. Återansluter…" +"Dismiss" = "Stäng" +"Not connected: {reason}. Your work is still in this tab." = "Inte ansluten: {reason}. Ditt arbete finns kvar i den här fliken." +"Retry now" = "Försök igen nu" +"Save a copy…" = "Spara en kopia…" +"Wrap style" = "Radbrytningsstil" +"Text direction" = "Textriktning" +"Auto: by the first letter with a direction" = "Auto: efter den första bokstaven som har en riktning" +"Left to right" = "Vänster till höger" +"Right to left" = "Höger till vänster" +"Balance" = "Balans" +"Pretty" = "Snygg" +"Auto: as many words as fit on each line" = "Auto: så många ord som får plats på varje rad" +"Balance: every line close to the same length" = "Balans: alla rader ungefär lika långa" +"Pretty: full lines, no one word alone on the last" = "Snygg: fulla rader, inget ensamt ord på den sista" +"Set hug contents" = "Ställ in Omslut innehåll" +"Set fill container" = "Ställ in Fyll behållaren" +"Double-click an edge of an auto layout frame" = "Dubbelklicka på en kant av en auto layout-frame" +"{name}, disconnected from its live session" = "{name}, frånkopplad från sin livesession" +"⌥ double-click an edge of an auto layout child" = "⌥ dubbelklicka på en kant av ett underordnat objekt i auto layout" +"Alt+double-click an edge of an auto layout child" = "Alt+dubbelklicka på en kant av ett underordnat objekt i auto layout" "Default" = "Standard" "Default content" = "Standardinnehåll" "Default value (the top-left variant)" = "Standardvärde (varianten längst upp till vänster)" @@ -493,6 +530,7 @@ name = "Svenska" "Edit dev resource" = "Redigera utvecklarresurs" "Edit link" = "Redigeringslänk" "Edit link copied" = "Redigeringslänken har kopierats" +"Edit padding on all sides" = "Redigera padding på alla sidor" "Edit style" = "Redigera stil" "Edit variable" = "Redigera variabel" "Edit with the builder" = "Redigera med byggaren" @@ -530,6 +568,7 @@ name = "Svenska" "Exclusion" = "Uteslutning" "Exit focus view (Esc)" = "Lämna fokusvyn (Esc)" "Expand" = "Expandera" +"Expand the interface" = "Expandera gränssnittet" "Export" = "Exportera" "Export all" = "Exportera alla" "Export frames and layers as PNG, JPG, SVG or PDF" = "Exportera frames och lager som PNG, JPG, SVG eller PDF" @@ -1072,6 +1111,7 @@ name = "Svenska" "Pages: {pages}" = "Sidor: {pages}" "Paint bucket" = "Färghink" "Pan the canvas" = "Panorera arbetsytan" +"Show and move the placement crosshair (its tool chosen, nothing selected)" = "Visa och flytta placeringshårkorset (med dess verktyg valt och inget markerat)" "Pan with nothing selected (Shift: farther)" = "Panorera när inget är markerat (Shift: längre)" "Panels" = "Paneler" "Paper" = "Papper" @@ -1296,6 +1336,7 @@ name = "Svenska" "See all templates" = "Se alla mallar" "Select layers and they space themselves as their content changes" = "Markera lager så fördelar de avståndet själva när innehållet ändras" "SHA-256: {sha}…" = "SHA-256: {sha}…" +"Same as file ({profile})" = "Samma som filen ({profile})" "Same as layer" = "Samma som lagret" "Saturation" = "Mättnad" "Save" = "Spara" @@ -1968,6 +2009,17 @@ name = "Svenska" "⌘ click" = "⌘ klicka" "⌘ scroll" = "⌘ rulla" "⌥ drag" = "⌥ dra" +"Selection box: switch to pick select" = "Markeringsruta: växla till plockmarkering" +"Pick select: next or previous layer" = "Plockmarkering: nästa eller föregående lager" +"Pick select: into a layer, out to its parent" = "Plockmarkering: in i ett lager, ut till dess överordnade" +"Pick select: select the picked layer" = "Plockmarkering: markera det valda lagret" +"⇥ or ⌥ Space again" = "⇥ eller ⌥ Blanksteg igen" +"Tab or Ctrl+Space again" = "Tab eller Ctrl+Blanksteg igen" +"↵ / ⇧↵" = "↵ / ⇧↵" +"Enter / Shift+Enter" = "Enter / Shift+Enter" +"Space" = "Blanksteg" +"Nothing to pick: the page is empty" = "Inget att välja: sidan är tom" +"Pick select: Tab and Shift+Tab move between layers, Enter goes into one, Shift+Enter out, Space selects, Escape cancels" = "Plockmarkering: Tab och Shift+Tab flyttar mellan lager, Enter går in i ett, Shift+Enter ut, Blanksteg markerar, Esc avbryter" [commands] @@ -2004,6 +2056,7 @@ name = "Svenska" "board.label" = "Kopplingsetikett" "board.nextSticky" = "Nästa lapp" "board.reattach" = "Koppla om koppling" +"board.reshape" = "Omforma koppling" "board.setColor" = "Whiteboardfärg" "board.setStyle" = "Whiteboardstil" "board.shape" = "Form med text" @@ -2046,6 +2099,7 @@ name = "Svenska" "collab.openFile" = "Öppna onlinefil" "collab.peers" = "Personer i den här filen" "collab.publish" = "Publicera på server" +"collab.reconnect" = "Återanslut livesessionen" "collab.recoverFile" = "Återställ onlinefil" "collab.registerLinks" = "Öppna inbjudningslänkar i FigCraft" "collab.removePerson" = "Ta bort från session" @@ -2193,6 +2247,7 @@ name = "Svenska" "image.deletePreset" = "Radera förinställning" "image.place" = "Placera bild" "image.presets" = "Bildförinställningar" +"image.replace" = "Ersätt bild" "image.savePreset" = "Spara förinställning" "inspect.assets" = "Resurser" "inspect.code" = "Kod" @@ -2210,6 +2265,7 @@ name = "Svenska" "layers.collapseAll" = "Fäll ihop alla" "layout.add" = "Lägg till auto layout" "layout.remove" = "Ta bort auto layout" +"layout.removeAll" = "Ta bort all auto layout" "layout.setTrack" = "Ange spår" "layout.suggest" = "Föreslå layout" "libraries.open" = "Öppna bibliotek" @@ -2304,6 +2360,9 @@ name = "Svenska" "pref.showDimensions" = "Visa dimensioner på objekt" "pref.startOnHome" = "Börja på Start" "pref.uiScale" = "Gränssnittsstorlek" +"pref.uiScaleDown" = "Mindre gränssnitt" +"pref.uiScaleReset" = "Standardstorlek för gränssnittet" +"pref.uiScaleUp" = "Större gränssnitt" "pref.userName" = "Ditt namn" "proto.action.add" = "Lägg till prototypåtgärd" "proto.action.move" = "Ändra ordning på prototypåtgärd" @@ -2351,6 +2410,7 @@ name = "Svenska" "selection.applyColorStyle" = "Använd färgformatmall på markeringen" "selection.bindColorVariable" = "Använd färgvariabel på markeringen" "selection.colors" = "Markeringsfärger" +"selection.createColorStyle" = "Skapa färgstil från markeringen" "selection.detachColor" = "Koppla bort markeringsfärg" "selection.selectColor" = "Markera lager med den här färgen" "selection.setPaint" = "Ändra markeringens färg" @@ -2397,6 +2457,10 @@ name = "Svenska" "text.caseUpper" = "Versaler" "text.create" = "Text" "text.decoration" = "Dekoration" +"text.direction" = "Textriktning" +"text.directionAuto" = "Textriktning: auto" +"text.directionLtr" = "Textriktning: vänster till höger" +"text.directionRtl" = "Textriktning: höger till vänster" "text.edit.begin" = "Redigera text" "text.edit.caret" = "Placera markören" "text.edit.end" = "Sluta redigera text" @@ -2421,6 +2485,7 @@ name = "Svenska" "text.missingFonts" = "Saknade typsnitt" "text.numberList" = "Numrerad lista" "text.onPath" = "Text på bana" +"text.openLink" = "Öppna länk" "text.paragraphIndent" = "Styckeindrag" "text.paragraphSpacing" = "Styckeavstånd" "text.pathOptions" = "Alternativ för textbana" @@ -2440,9 +2505,11 @@ name = "Svenska" "text.underline" = "Understrykning" "text.weightDown" = "Minska teckenvikten" "text.weightUp" = "Öka teckenvikten" +"text.wrapStyle" = "Radbrytningsstil" "tool.arrow" = "Pil" "tool.comment" = "Kommentar" "tool.connector" = "Koppling" +"tool.crosshair" = "Flytta placeringshårkorset" "tool.ellipse" = "Ellips" "tool.eraser" = "Suddgummi" "tool.frame" = "Frame" @@ -2486,6 +2553,7 @@ name = "Svenska" "variable.deleteCollection" = "Radera samling" "variable.duplicate" = "Duplicera variabel" "variable.export" = "Exportera variabler" +"variable.extendCollection" = "Utöka samlingen" "variable.import" = "Importera variabler" "variable.list" = "Lista variabler" "variable.moveMode" = "Flytta läge" @@ -2559,6 +2627,7 @@ name = "Svenska" "view.layoutGrids" = "Layoutrutnät" "view.leftSidebar" = "Visa/dölj vänster sidofält" "view.maskOutlines" = "Konturlinjer för masker" +"view.minimize" = "Minimera gränssnittet" "view.multiplayerCursors" = "Samarbetsmarkörer" "view.nextFrame" = "Zooma till nästa frame" "view.nextPage" = "Nästa sida" From d252d35f27f8baad062dfc93c058b1c230f00fa7 Mon Sep 17 00:00:00 2001 From: Helen Kwok <107752876+helenkwok@users.noreply.github.com> Date: Sat, 7 Nov 2026 10:28:06 +0800 Subject: [PATCH 003/239] figcraft-web: inspect and openFile go through craft-web-api, so they time out and cancel like the other functions inspect is docInspect under its earlier name, and openFile calls the crate's execute with file.open, so a call the app does not answer within 30 seconds rejects and a request the app has not started is cancelled. --- apps/figcraft-web/src/api.rs | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/apps/figcraft-web/src/api.rs b/apps/figcraft-web/src/api.rs index 167ea7687..cb82820b7 100644 --- a/apps/figcraft-web/src/api.rs +++ b/apps/figcraft-web/src/api.rs @@ -37,7 +37,7 @@ use figcraft_ui_egui::{ControlReply, ControlRequest, RequestGate}; use serde_json::{Value, json}; use wasm_bindgen::JsCast; use wasm_bindgen::prelude::*; -use wasm_bindgen_futures::{JsFuture, future_to_promise}; +use wasm_bindgen_futures::JsFuture; use crate::saved_files::SavedFiles; @@ -150,15 +150,6 @@ async fn sleep(ms: i32) { let _ = JsFuture::from(promise).await; } -/// A reply as a promise outcome: the `result`, or an `Error` carrying the `error`. -fn outcome(reply: &Value) -> Result { - if reply.get("ok").and_then(Value::as_bool) == Some(true) { - Ok(to_js(reply.get("result").unwrap_or(&Value::Null))) - } else { - Err(js_sys::Error::new(reply.get("error").and_then(Value::as_str).unwrap_or("error")).into()) - } -} - fn set_fn(obj: &js_sys::Object, name: &str, f: JsValue) -> Result<(), JsValue> { js_sys::Reflect::set(obj, &name.into(), &f).map(|_| ()) } @@ -169,20 +160,20 @@ pub fn install() -> Result<(), JsValue> { Rc::new(PageApi::new(APP, Methods::default(), request)).install()?; let window = web_sys::window().ok_or("no window")?; let obj: js_sys::Object = js_sys::Reflect::get(&window, &APP.into())?.unchecked_into(); - set_fn( - &obj, - "inspect", - Closure:: js_sys::Promise>::new(|| future_to_promise(async { outcome(&send("document.inspect", json!({})).await) })) - .into_js_value(), - )?; + // `inspect` is `docInspect` under its earlier name: the crate's function, so it times out too. + let doc_inspect = js_sys::Reflect::get(&obj, &"docInspect".into())?; + js_sys::Reflect::set(&obj, &"inspect".into(), &doc_inspect)?; + // `openFile` runs `file.open` through the crate's `execute`, so a call the app does not answer times out and is cancelled. + let execute: js_sys::Function = js_sys::Reflect::get(&obj, &"execute".into())?.unchecked_into(); + let this = obj.clone(); set_fn( &obj, "openFile", - Closure:: js_sys::Promise>::new(|name: String, bytes: js_sys::Uint8Array| { + Closure:: JsValue>::new(move |name: String, bytes: js_sys::Uint8Array| { let data = base64::engine::general_purpose::STANDARD.encode(bytes.to_vec()); - future_to_promise(async move { - outcome(&send("engine.execute", json!({"command": "file.open", "params": {"name": name, "data": data}})).await) - }) + execute + .call2(&this, &"file.open".into(), &to_js(&json!({"name": name, "data": data}))) + .unwrap_or_else(|e| js_sys::Promise::reject(&e).into()) }) .into_js_value(), )?; From 12ade9c78c62783dfe539bbbfb62c1fbae03d9ab Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 6 Nov 2026 23:31:02 -0800 Subject: [PATCH 004/239] Docs: the 2026-10-31 export entry keeps the JPG tagging it had on that date --- docs/file-format-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 335115ad1..0d51910f0 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -192,7 +192,7 @@ source paint coordinates. | 2026-11-04 | minor | JPG export: `quality` (1 to 100, default 90) on `file.export`, `export.add` / `export.update` and MCP `export`, kept in the export setting; an sRGB file's JPGs embed the sRGB ICC profile, as Display P3 files' JPGs already embedded theirs, since an untagged JPG is only assumed to be sRGB (#2004). | | 2026-11-04 | minor | `.fig` and `.jam` import, #1910: an elbowed connector saved with its path keeps it. FigJam stores `connectorControlPoints`, one per run between the first and the last, each a point on its run (in the connector's parent's coordinates) with the run's axis; the first run leaves the start's side and the last arrives at the end's. They become the `ConnectorPath::Runs` a board connector reshaped by hand has (`figcraft_doc::route_along`), so a connector drawn around a layer in FigJam stays around it instead of being routed through it. Points that don't make such a path (off both axes, two runs in a row the same way, a first or last run sideways to its side or going back into its object, more runs than a hand could make) leave the connector to the router as before, and only connectors routed here count in the "follow FigCraft's own routing" note. A curved connector's `connectorBezierControlPoints` are still not read. Tests: `tail_tests::an_elbow_connector_saved_with_its_path_keeps_it`, `tail_tests::an_elbow_whose_saved_path_doesnt_fit_its_sides_is_routed_here`. | | 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 | minor | Export settings: each PNG, JPG and WebP setting has a color profile, Same as file (the default; the document's profile when it exports), sRGB or Display P3, in its advanced settings and as `colorProfile` on `export.add`, `export.update`, `file.export`, `file.exportLayers` and MCP `export`. The pixels convert to the chosen profile (out-of-gamut colors clip) and the file is tagged as before: sRGB PNG with an `sRGB` chunk, Display P3 with the generated ICC profile (and `cICP` in PNG); sRGB JPG embeds the sRGB ICC profile (#2004) and sRGB WebP stays untagged. A setting keeps its choice when its format changes; settings saved without one read as Same as file. SVG, PDF and XML show no choice and stay sRGB (PDF has no output intent yet). Numbers unchanged | +| 2026-10-31 | minor | Export settings: each PNG, JPG and WebP setting has a color profile, Same as file (the default; the document's profile when it exports), sRGB or Display P3, in its advanced settings and as `colorProfile` on `export.add`, `export.update`, `file.export`, `file.exportLayers` and MCP `export`. The pixels convert to the chosen profile (out-of-gamut colors clip) and the file is tagged as before: sRGB PNG with an `sRGB` chunk, Display P3 with the generated ICC profile (and `cICP` in PNG); sRGB JPG and WebP stay untagged (builds before 2026-11-04; from that date sRGB JPGs embed the sRGB ICC profile, see the 2026-11-04 JPG export entry). A setting keeps its choice when its format changes; settings saved without one read as Same as file. SVG, PDF and XML show no choice and stay sRGB (PDF has no output intent yet). 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 fbd313f4e7b9157c60f30f9e010e284df82cc5a2 Mon Sep 17 00:00:00 2001 From: Davit Matchakhelidze Date: Sat, 7 Nov 2026 12:50:18 +0400 Subject: [PATCH 005/239] i18n(ka): Georgian for 126 new strings --- crates/ui-egui/locales/ka.toml | 126 +++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) diff --git a/crates/ui-egui/locales/ka.toml b/crates/ui-egui/locales/ka.toml index 2af58f385..8a4a70475 100644 --- a/crates/ui-egui/locales/ka.toml +++ b/crates/ui-egui/locales/ka.toml @@ -111,6 +111,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Along the top" = "ზედა კიდის გასწვრივ" "Alpha" = "ალფა" "Alphabetical" = "ანბანის მიხედვით" +"Alt+double-click an edge of an auto layout child" = "Alt+ორმაგი დაწკაპუნება ავტოგანლაგების შვილობილი ელემენტის კიდეზე" "Alt+drag" = "Alt+გადათრევა" "An analytics screen on a grid: figures, charts drawn from vectors and a table" = "ანალიტიკა ბადეზე: ციფრები, დიაგრამები და ცხრილი" "An earlier vote" = "ადრინდელი კენჭისყრა" @@ -124,6 +125,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Another server, or one that needs its key. The usual server is set in Preferences." = "სხვა სერვერი ან სერვერი, რომელსაც გასაღები სჭირდება. ჩვეულებრივი სერვერი პარამეტრებში ირჩევა." "Any status" = "ნებისმიერი სტატუსი" "Anyone on your network with this code can edit the file, while this app stays open." = "თქვენს ქსელში ნებისმიერს, ვისაც ეს კოდი აქვს, შეუძლია ფაილის რედაქტირება, სანამ ეს აპი ღიაა." +"Anyone on your network with this code can look at the file, not change it, while this app stays open." = "თქვენს ქსელში ნებისმიერს, ვისაც ეს კოდი აქვს, შეუძლია ფაილის ნახვა, მაგრამ არა შეცვლა, სანამ ეს აპი ღიაა." "Anyone with the edit link can change the file; the view link only lets people look. The links carry their secrets: share them like passwords. `figcraft-server links` makes more and revokes them." = "რედაქტირების ბმულის მქონე ნებისმიერს შეუძლია ფაილის შეცვლა; ნახვის ბმული მხოლოდ დათვალიერების საშუალებას იძლევა. ბმულები საიდუმლო გასაღებებს შეიცავს: გააზიარეთ ისინი პაროლების მსგავსად. `figcraft-server links` ქმნის ახალ ბმულებს და აუქმებს მათ." "Anyone with this code can edit the file." = "ნებისმიერს, ვისაც ეს კოდი აქვს, შეუძლია ფაილის რედაქტირება." "Anyone with this code can look at the file, not change it." = "ნებისმიერს, ვისაც ეს კოდი აქვს, შეუძლია ფაილის ნახვა, მაგრამ არა შეცვლა." @@ -158,6 +160,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Auto layout" = "ავტოგანლაგება" "Auto rows" = "ავტომატური სტრიქონები" "Auto width" = "ავტომატური სიგანე" +"Auto: by the first letter with a direction" = "ავტომატური: მიმართულების მქონე პირველი ასოს მიხედვით" "Back to the FigCraft server" = "FigCraft-ის სერვერზე დაბრუნება" "Back to the font's value" = "შრიფტის მნიშვნელობაზე დაბრუნება" "Back" = "უკან" @@ -330,6 +333,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Copied as PNG" = "დაკოპირდა როგორც PNG" "Copied as SVG" = "დაკოპირდა როგორც SVG" "Copied as text" = "დაკოპირდა როგორც ტექსტი" +"Copied comments for AI" = "კომენტარები დაკოპირდა AI-სთვის" "Copied {value}" = "დაკოპირდა: {value}" "Copy" = "კოპირება" "Copy as" = "კოპირება როგორც" @@ -337,6 +341,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Copy as PNG" = "კოპირება როგორც PNG" "Copy as SVG" = "კოპირება როგორც SVG" "Copy code" = "კოდის კოპირება" +"Copy for AI" = "კოპირება AI-სთვის" "Copy link" = "ბმულის კოპირება" "Copy the {label}" = "კოპირება: {label}" "Copy {value}" = "კოპირება: {value}" @@ -364,8 +369,10 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Created" = "შექმნილია" "Crop" = "ჩამოჭრა" "Crop marks" = "ჭრის ნიშნები" +"Ctrl+Alt+← ↑ → ↓" = "Ctrl+Alt+← ↑ → ↓" "Ctrl+arrows" = "Ctrl+ისრები" "Ctrl+click" = "Ctrl+დაწკაპუნება" +"Ctrl+click a padding field" = "Ctrl+დაწკაპუნება შიდა დაშორების ველზე" "Ctrl+scroll" = "Ctrl+გადახვევა" "Current name" = "მიმდინარე სახელი" "Current version" = "მიმდინარე ვერსია" @@ -385,6 +392,47 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Decoration style" = "გაფორმების სტილი" "Decoration" = "გაფორმება" "Deep select" = "ღრმა მონიშვნა" +"Delete {n} variables" = { one = "ცვლადის წაშლა: {n}", other = "ცვლადის წაშლა: {n}" } +"Disconnected. Reconnecting…" = "კავშირი გაწყდა. ხელახლა დაკავშირება…" +"Disconnected. Your edits stay here and sync when the connection returns. Reconnecting…" = "კავშირი გაწყდა. თქვენი ცვლილებები აქ რჩება და სინქრონიზდება, როცა კავშირი აღდგება. ხელახლა დაკავშირება…" +"Dismiss" = "უგულებელყოფა" +"Double-click an edge of an auto layout frame" = "ორმაგი დაწკაპუნება ავტოგანლაგების ჩარჩოს კიდეზე" +"Edit padding on all sides" = "შიდა დაშორების რედაქტირება ყველა მხარეს" +"Enter / Shift+Enter" = "Enter / Shift+Enter" +"Expand the interface" = "ინტერფეისის გაშლა" +"Hide UI" = "ინტერფეისის დამალვა" +"Left to right" = "მარცხნიდან მარჯვნივ" +"Move out of any group" = "ჯგუფიდან გამოტანა" +"Move to group {group}" = "ჯგუფში გადატანა: {group}" +"Move up or down while dragging its label" = "ზემოთ ან ქვემოთ გადაადგილება მისი იარლიყის გადათრევისას" +"Not connected: {reason}. Your work is still in this tab." = "კავშირი არ არის: {reason}. თქვენი ნამუშევარი ისევ ამ ჩანართშია." +"Nothing to pick: the page is empty" = "ასარჩევი არაფერია: გვერდი ცარიელია" +"Pick select: Tab and Shift+Tab move between layers, Enter goes into one, Shift+Enter out, Space selects, Escape cancels" = "შრის არჩევა: Tab და Shift+Tab შრეებს შორის გადაადგილდება, Enter შრეში შედის, Shift+Enter გამოდის, Space მონიშნავს, Escape გააუქმებს" +"Pick select: into a layer, out to its parent" = "შრის არჩევა: შრეში შესვლა, მშობელზე გასვლა" +"Pick select: next or previous layer" = "შრის არჩევა: შემდეგი ან წინა შრე" +"Pick select: select the picked layer" = "შრის არჩევა: არჩეული შრის მონიშვნა" +"Remove all auto layout" = "ყველა ავტოგანლაგების მოხსნა" +"Retry now" = "ახლავე ხელახლა ცდა" +"Right to left" = "მარჯვნიდან მარცხნივ" +"Rotate a degree (Shift: 15)" = "ერთი გრადუსით შემობრუნება (Shift: 15)" +"Same as file ({profile})" = "როგორც ფაილში ({profile})" +"Save a copy…" = "ასლის შენახვა…" +"Scope: all supported properties" = "არე: ყველა მხარდაჭერილი თვისება" +"Scope: hidden from pickers" = "არე: ამომრჩევებში დამალული" +"Scope: only {scope}" = "არე: მხოლოდ {scope}" +"Scrub a field faster (2x) or slower (1/2, 1/4)" = "ველის მნიშვნელობის გადათრევით ცვლა უფრო სწრაფად (2x) ან ნელა (1/2, 1/4)" +"Scrubbing at 1/2" = "გადათრევით ცვლა: 1/2" +"Scrubbing at 1/4" = "გადათრევით ცვლა: 1/4" +"Scrubbing at 1x" = "გადათრევით ცვლა: 1x" +"Scrubbing at 2x" = "გადათრევით ცვლა: 2x" +"Selection box: switch to pick select" = "მონიშვნის ჩარჩო: შრის არჩევაზე გადართვა" +"Set fill container" = "ზომა: კონტეინერის შევსება" +"Set hug contents" = "ზომა: შიგთავსზე მორგება" +"Show and move the placement crosshair (its tool chosen, nothing selected)" = "განთავსების ჯვრის ჩვენება და გადაადგილება (არჩეული ხელსაწყოთი, როცა არაფერია მონიშნული)" +"Space" = "Space" +"Tab or Ctrl+Space again" = "Tab ან ხელახლა Ctrl+Space" +"Text direction" = "ტექსტის მიმართულება" +"The bars are hidden. {shortcut} shows them again" = "ზოლები დამალულია. {shortcut} ისევ აჩვენებს მათ" "Wrap style" = "გადატანის სტილი" "Balance" = "დაბალანსებული" "Pretty" = "მოწესრიგებული" @@ -890,6 +938,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "No color styles" = "ფერის სტილები არ არის" "No colour variables fit here." = "აქ არცერთი ფერის ცვლადი არ ერგება." "No colour variables yet. Create them in Local variables." = "ფერის ცვლადები ჯერ არ არის. შექმენით ისინი ლოკალურ ცვლადებში." +"No comments to copy" = "დასაკოპირებელი კომენტარები არ არის" "No comments yet" = "კომენტარები ჯერ არ არის" "No compatibility warnings reported" = "თავსებადობის გაფრთხილებები არ დაფიქსირებულა" "No components yet. Select layers and press {keys}." = "კომპონენტები ჯერ არ არის. მონიშნეთ შრეები და დააჭირეთ {keys}." @@ -1804,6 +1853,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "{name} is forgotten on this computer; the file stays on {server}" = "{name} დავიწყებულია ამ კომპიუტერზე; ფაილი {server}-ზე რჩება" "{name} is on the server." = "{name} სერვერზეა." "{name} is spotlighting" = "ყურადღება {name}-ზეა" +"{name}, disconnected from its live session" = "{name}, ცოცხალ სესიასთან კავშირი გაწყვეტილია" "{name}\nClick to apply to the selection" = "{name}\nდაწკაპეთ მონიშნულზე გამოსაყენებლად" "{name}\nDrag onto the canvas, or click to place in the middle of the view.\nHold Alt (Option) while dropping onto an instance to swap it." = "{name}\nგადაათრიეთ ტილოზე ან დაწკაპეთ ხედის შუაში განსათავსებლად.\nინსტანსის ჩასანაცვლებლად მასზე ჩაგდებისას დააჭირეთ Alt-ს (Option)." "{name} (from {library})" = "{name} ({library}-იდან)" @@ -1876,10 +1926,14 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "←" = "←" "→, Space or N" = "→, Space ან N" "↵" = "↵" +"↵ / ⇧↵" = "↵ / ⇧↵" "⇥ / ⇧⇥" = "⇥ / ⇧⇥" +"⇥ or ⌥ Space again" = "⇥ ან ხელახლა ⌥ Space" "⌘ arrows" = "⌘ ისრები" "⌘ click" = "⌘ დაწკაპუნება" +"⌘ click a padding field" = "⌘ დაწკაპუნება შიდა დაშორების ველზე" "⌘ scroll" = "⌘ გადახვევა" +"⌥ double-click an edge of an auto layout child" = "⌥ ორმაგი დაწკაპუნება ავტოგანლაგების შვილობილი ელემენტის კიდეზე" "⌥ drag" = "⌥ გადათრევა" "Android Vector Drawable" = "Android Vector Drawable" "Best effort" = "მაქსიმალური მიახლოება" @@ -1908,6 +1962,67 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Update check is not supported in the web browser." = "ვებბრაუზერში განახლებების შემოწმება მხარდაჭერილი არ არის." "instance swap properties whose default component was past the layer limit were skipped" = "ინსტანსის ჩანაცვლების თვისებები, რომელთა ნაგულისხმევი კომპონენტი შრეების ზღვარს მიღმა იყო, გამოტოვებულია" "instances whose component was past the layer limit were imported as frames" = "ინსტანსები, რომელთა კომპონენტი შრეების ზღვარს მიღმა იყო, ჩარჩოებად იმპორტირდა" +"1 year" = "1 წელი" +"30 days" = "30 დღე" +"90 days" = "90 დღე" +"Allow and download" = "დაშვება და ჩამოტვირთვა" +"Allow downloading fonts?" = "დაიშვას შრიფტების ჩამოტვირთვა?" +"Board grid" = "დაფის ბადე" +"Changed {date}" = "შეცვლილია: {date}" +"Copy browser link" = "ბრაუზერის ბმულის კოპირება" +"Couldn't reach {server} for its team list." = "{server}-იდან გუნდის სიის მიღება ვერ მოხერხდა." +"Calculated from other variables; it follows them" = "გამოითვლება სხვა ცვლადებიდან და მათ მიჰყვება" +"Crop image" = "გამოსახულების ჩამოჭრა" +"Detach calculation" = "გამოთვლის გამოყოფა" +"Download" = "ჩამოტვირთვა" +"Downloading… {percent}%" = "ჩამოტვირთვა… {percent}%" +"Drop to use this image" = "ჩააგდეთ ამ გამოსახულების გამოსაყენებლად" +"Everyone who reaches this server can open these files while they are shared." = "ამ სერვერთან წვდომის მქონე ყველას შეუძლია ამ ფაილების გახსნა, სანამ ისინი გაზიარებულია." +"FigCraft stopped because of an internal error." = "FigCraft-ის მუშაობა შიდა შეცდომის გამო შეწყდა." +"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." = "უფასო შრიფტები Google Fonts-იდან და Noto-დან მოდის, jsDelivr-ისა და GitHub-ის გავლით. თითოეული ფაილი შრიფტების ინდექსთან მოწმდება, სანამ Craft-აპების საერთო შრიფტების საქაღალდეში დაინსტალირდება. სანამ არ დაუშვებთ, არაფერი ჩამოიტვირთება." +"Graph paper" = "მილიმეტრიანი ქაღალდი" +"Joining live session…" = "ცოცხალ სესიასთან შეერთება…" +"Link copied: it opens the file in FigCraft" = "ბმული დაკოპირდა: ის ფაილს FigCraft-ში ხსნის" +"Link copied: it opens the file in the browser" = "ბმული დაკოპირდა: ის ფაილს ბრაუზერში ხსნის" +"Nobody shares a file there now." = "იქ ახლა არავინ აზიარებს ფაილს." +"Past 30 days" = "ბოლო 30 დღე" +"Past 90 days" = "ბოლო 90 დღე" +"Past year" = "ბოლო წელი" +"Shared by your team on {server}" = "თქვენი გუნდის მიერ {server}-ზე გაზიარებული" +"Not now" = "ახლა არა" +"Nothing counted yet" = "ჯერ არაფერი დათვლილა" +"Reload the page to get back the unsaved files the browser had room for." = "განაახლეთ გვერდი, რომ დაიბრუნოთ ის შეუნახავი ფაილები, რომლებიც ბრაუზერში დაეტია." +"Reload the page to get your unsaved files back." = "განაახლეთ გვერდი, რომ შეუნახავი ფაილები დაიბრუნოთ." +"Reload the page to start again." = "თავიდან დასაწყებად განაახლეთ გვერდი." +"Reset grid" = "ბადის ჩამოყრა" +"This server doesn't count insertions" = "ეს სერვერი ჩასმებს არ ითვლის" +"This server doesn't count styles and variables" = "ეს სერვერი სტილებსა და ცვლადებს არ ითვლის" +"Upload from computer" = "კომპიუტერიდან ატვირთვა" +"Strong line every" = "მუქი ხაზის ბიჯი" +"This link opens your mail app to write a message:" = "ეს ბმული წერილის დასაწერად თქვენს საფოსტო აპს ხსნის:" +"This server doesn't count detached instances" = "ეს სერვერი გამოყოფილ ინსტანსებს არ ითვლის" +"Your unsaved files were too large for the browser to keep." = "თქვენი შეუნახავი ფაილები ბრაუზერისთვის შესანახად ზედმეტად დიდი იყო." +"connector labels without a saved snapshot are centred on the line, without their background" = "შენახული სნეპშოტის გარეშე შემაერთებლის იარლიყები ხაზზე ცენტრდება, ფონის გარეშე" +"elbowed and curved connectors without a saved path follow FigCraft's own routing" = "შენახული ტრაექტორიის გარეშე კუთხოვანი და მრუდი შემაერთებლები FigCraft-ის საკუთარ მარშრუტს მიჰყვება" +"invalid vector region fill paint list; layer fill used" = "ვექტორული არის შევსების საღებავების სია არასწორია; გამოყენებულია შრის შევსება" +"invalid vector region paints were skipped" = "ვექტორული არის არასწორი საღებავები გამოტოვებულია" +"linked vector region fill styles keep resolved appearance; live style links were left out" = "ვექტორული არის მიბმული შევსების სტილები გამოთვლილ იერსახეს ინარჩუნებს; სტილების ცოცხალი კავშირები არ გადმოვიდა" +"note or shape generated child has invalid bounds; child skipped" = "შენიშვნის ან ფიგურის გენერირებულ შვილობილ ელემენტს არასწორი საზღვრები აქვს; ელემენტი გამოტოვებულია" +"note or shape generated child is missing its style or bounds; child skipped" = "შენიშვნის ან ფიგურის გენერირებულ შვილობილ ელემენტს სტილი ან საზღვრები აკლია; ელემენტი გამოტოვებულია" +"note or shape generated children exceed the layer or nesting limit; remaining children skipped" = "შენიშვნის ან ფიგურის გენერირებული შვილობილი ელემენტები შრეების ან ჩადგმის ლიმიტს აჭარბებს; დანარჩენი ელემენტები გამოტოვებულია" +"note or shape generated layout is missing or unsupported; using its outer frame" = "შენიშვნის ან ფიგურის გენერირებული განლაგება აკლია ან მხარდაუჭერელია; გამოიყენება მისი გარე ჩარჩო" +"shape generated outline is missing or damaged; using its rectangle" = "ფიგურის გენერირებული კონტური აკლია ან დაზიანებულია; გამოიყენება მისი მართკუთხედი" +"variable-bound vector region paints keep resolved appearance; live bindings were left out" = "ცვლადებზე მიბმული ვექტორული არის საღებავები გამოთვლილ იერსახეს ინარჩუნებს; ცოცხალი მიბმები არ გადმოვიდა" +"vector region paint data exceeded import limits and was skipped" = "ვექტორული არის საღებავის მონაცემებმა იმპორტის ლიმიტებს გადააჭარბა და გამოტოვებულია" +"vector region references a missing fill style; layer fill used" = "ვექტორული არე მიუთითებს შევსების არარსებულ სტილზე; გამოყენებულია შრის შევსება" +"{count} in it now · Changed {date}" = "ახლა მასშია: {count} · შეცვლილია: {date}" +"{insertions} · {detachments}" = "{insertions} · {detachments}" +"{period}: {counts}" = "{period}: {counts}" +"{used} · {detached}" = "{used} · {detached}" +"{used} · {inserted}" = "{used} · {inserted}" +"{n} detached" = { one = "გამოყოფილი: {n}", other = "გამოყოფილი: {n}" } +"{n} inserted" = { one = "ჩასმული: {n}", other = "ჩასმული: {n}" } +"⌥⌘ ← ↑ → ↓" = "⌥⌘ ← ↑ → ↓" [commands] "align.bottom" = "ქვემოთ სწორება" @@ -2003,6 +2118,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "comment.next" = "შემდეგი კომენტარი" "comment.open" = "კომენტარის გახსნა" "comment.people" = "კომენტარებში მონაწილე ადამიანები" +"comment.prompt" = "კომენტარების კოპირება AI-სთვის" "comment.react" = "კომენტარზე რეაგირება" "comment.reply" = "კომენტარზე პასუხი" "comment.resolve" = "კომენტარის გადაწყვეტა" @@ -2081,6 +2197,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "file.exportFramesPdf" = "ჩარჩოების PDF-ად ექსპორტირება" "file.exportLayers" = "შრეების ექსპორტირება" "file.exportSvg" = "მონიშნულის SVG-ად ექსპორტირება" +"file.fontReport" = "დოკუმენტის შრიფტების ინსპექტირება" "file.import" = "იმპორტი" "file.moveTab" = "ჩანართის გადატანა" "file.new" = "ახალი დიზაინის ფაილი" @@ -2533,6 +2650,15 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "file.markSaved" = "შენახულად მარკირება" "text.fit" = "ტექსტის ჩატევა თავის საზღვრებში" "data.fill" = "ასლების მონაცემებით შევსება" +"board.grid" = "დაფის ბადე" +"font.download" = "შრიფტის ჩამოტვირთვა" +"font.downloads" = "შრიფტების ჩამოტვირთვები" +"image.crop" = "გამოსახულების ჩამოჭრა" +"library.check" = "გუნდის ბიბლიოთეკების განახლებების შემოწმება" +"board.reshape" = "შემაერთებლის ფორმის შეცვლა" +"image.replace" = "გამოსახულების ჩანაცვლება" +"variable.extendCollection" = "კოლექციის გაფართოება" +"widget.hover" = "ვიჯეტზე მაჩვენებლის მიტანა" [menu] "bool.exclude" = "გამორიცხვა" From 386c6c1d3eb923459111e9df0fb75c231a5c3722 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sat, 7 Nov 2026 13:45:31 +0100 Subject: [PATCH 006/239] Reject negative and fractional index in image.savePreset Found while testing crates/engine/src/cmd/image.rs:239 (save_preset, `index = num(p, "index").filter(..).map(|k| k as usize)`) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd/image.rs | 7 +++++-- crates/engine/src/paint_tests.rs | 10 ++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/image.rs b/crates/engine/src/cmd/image.rs index 865e4d19a..37472b2d4 100644 --- a/crates/engine/src/cmd/image.rs +++ b/crates/engine/src/cmd/image.rs @@ -5,7 +5,7 @@ use figcraft_doc::{Document, ImagePreset, Node}; use serde_json::{Value, json}; use super::{CommandSpec, ok}; -use crate::params::{f64_of, get, num, req_index, req_string, req_targets, string, targets}; +use crate::params::{f64_of, get, req_index, req_string, req_targets, string, targets}; use crate::{EngineError, Result, Session, bad, spec}; pub fn specs() -> Vec { @@ -236,7 +236,10 @@ fn save_preset(s: &mut Session, p: &Value) -> Result { Some(v) => with_values(cmd, ImageFilters::NONE, v)?, None => { let stroke = strokes(cmd, p)?; - let index = num(p, "index").filter(|k| k.is_finite() && *k >= 0.0).map(|k| k as usize); + let index = match get(p, "index") { + None | Some(Value::Null) => None, + Some(_) => Some(req_index(cmd, p, "index")?), + }; let doc = s.doc()?; targets(s, p) .iter() diff --git a/crates/engine/src/paint_tests.rs b/crates/engine/src/paint_tests.rs index 1e97b05ca..00ada8d79 100644 --- a/crates/engine/src/paint_tests.rs +++ b/crates/engine/src/paint_tests.rs @@ -135,6 +135,16 @@ fn image_adjust_refuses_what_it_cannot_do() { assert_eq!(s.execute("image.adjust", &json!({"ids": [plain, r], "index": 1, "preset": "vivid"})).unwrap()["changed"], 1); } +#[test] +fn save_preset_rejects_bad_index() { + let mut s = Session::new(); + let r = image_rect(&mut s); + assert!(s.execute("image.savePreset", &json!({"ids": [r], "name": "B", "index": 0})).is_err()); + assert!(s.execute("image.savePreset", &json!({"ids": [r], "name": "B", "index": -1})).is_err(), "negative index accepted"); + assert!(s.execute("image.savePreset", &json!({"ids": [r], "name": "B", "index": 1.5})).is_err(), "fractional index accepted"); + assert!(s.execute("image.savePreset", &json!({"ids": [r], "name": "B", "index": 1})).is_ok()); +} + #[test] fn saved_image_presets() { let mut s = Session::new(); From b33da8a7b0f3dd92d0a2a88ec22ab72f9d028a1d Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 11:52:52 -0500 Subject: [PATCH 007/239] Ellipse: an unsliced ellipse edits as four anchor points, not six (#2080) A whole ellipse and each ring contour are built as four cubics through the extremes instead of a tolerance-subdivided arc. Sliced ellipses are unchanged. Co-Authored-By: Claude Fable 5.1 --- crates/geom/src/lib.rs | 23 ++++++++++++++++----- crates/geom/src/tests.rs | 43 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/crates/geom/src/lib.rs b/crates/geom/src/lib.rs index a775a4170..f290882d8 100644 --- a/crates/geom/src/lib.rs +++ b/crates/geom/src/lib.rs @@ -472,15 +472,28 @@ pub fn ellipse(width: f64, height: f64, start: f64, sweep: f64, inner: f64) -> B let mut path = BezPath::new(); // A whole turn as an arc with these radii: kurbo's `Ellipse` recovers its radii from an // affine map, which overflows to infinity for radii near f64's limit (and infinite cubics). - let whole = |rx: f64, ry: f64| kurbo::Arc::new(c, (rx, ry), 0.0, TAU, 0.0); + // Four cubics through the right, bottom, left and top extremes (clockwise from 3 o'clock), + // the same four anchors an ellipse has when edited as a vector; an arc subdivided by + // tolerance would give five or six. + let whole = |rx: f64, ry: f64| { + const K: f64 = 0.552_284_749_830_793_4; + let (kx, ky) = (rx * K, ry * K); + let mut p = BezPath::new(); + p.move_to(c + Vec2::new(rx, 0.0)); + p.curve_to(c + Vec2::new(rx, ky), c + Vec2::new(kx, ry), c + Vec2::new(0.0, ry)); + p.curve_to(c + Vec2::new(-kx, ry), c + Vec2::new(-rx, ky), c + Vec2::new(-rx, 0.0)); + p.curve_to(c + Vec2::new(-rx, -ky), c + Vec2::new(-kx, -ry), c + Vec2::new(0.0, -ry)); + p.curve_to(c + Vec2::new(kx, -ry), c + Vec2::new(rx, -ky), c + Vec2::new(rx, 0.0)); + p + }; if full && inner <= 0.0 { - return whole(rx, ry).to_path(tol); + return whole(rx, ry); } if full { // A ring: outer clockwise, inner counter-clockwise. - path.extend(whole(rx, ry).path_elements(tol)); - let inner_path = whole(rx * inner, ry * inner).to_path(tol); - path.extend(inner_path.reverse_subpaths()); + path.extend(whole(rx, ry).elements().iter().copied()); + let inner_path = whole(rx * inner, ry * inner); + path.extend(inner_path.reverse_subpaths().elements().iter().copied()); return path; } let outer = kurbo::Arc::new(c, (rx, ry), start, sweep, 0.0); diff --git a/crates/geom/src/tests.rs b/crates/geom/src/tests.rs index 459b2b101..909a3c475 100644 --- a/crates/geom/src/tests.rs +++ b/crates/geom/src/tests.rs @@ -263,7 +263,7 @@ fn smoothed_polygon_smooths_every_corner() { #[test] fn ellipse_ring_area() { let full = area(&ellipse(100.0, 100.0, 0.0, TAU, 0.0)); - assert!((full - PI * 2500.0).abs() < 2.0); + assert!((full - PI * 2500.0).abs() < 5.0, "{full}"); let ring = ellipse(100.0, 100.0, 0.0, TAU, 0.5); // Winding area of a ring with a reversed inner contour: outer - inner. let a = ring.area().abs(); @@ -321,6 +321,47 @@ fn reverse_subpaths_preserves_open_and_closed() { assert!(matches!(r.elements().last(), Some(kurbo::PathEl::ClosePath)), "{:?}", r.elements()); } +fn cubics(path: &BezPath) -> Vec { + path.segments() + .filter_map(|s| match s { + kurbo::PathSeg::Cubic(c) => Some(c), + _ => None, + }) + .collect() +} + +#[test] +fn a_whole_ellipse_is_four_cubics_through_the_extremes() { + for (w, h) in [(100.0, 100.0), (200.0, 60.0), (3.0, 900.0)] { + let segs = cubics(&ellipse(w, h, 0.0, TAU, 0.0)); + assert_eq!(segs.len(), 4, "{w}x{h}"); + let (rx, ry) = (w / 2.0, h / 2.0); + let want = [Point::new(rx, h), Point::new(0.0, ry), Point::new(rx, 0.0), Point::new(w, ry)]; + for (i, s) in segs.iter().enumerate() { + assert!((s.p3 - want[i]).hypot() < 1e-9, "{w}x{h}: anchor {i} is {:?}", s.p3); + // Handle length is 0.5523 of the radius along the tangent. + let k = 0.552_284_749_830_793_4; + let (r_along, r_across) = if i % 2 == 0 { (ry, rx) } else { (rx, ry) }; + let _ = r_across; + assert!(((s.p1 - s.p0).hypot() - k * r_along).abs() < 1e-9, "{w}x{h}: handle {i}"); + } + } +} + +#[test] +fn a_whole_ring_is_four_cubics_per_contour() { + let segs = cubics(&ellipse(100.0, 100.0, 0.0, TAU, 0.5)); + assert_eq!(segs.len(), 8); +} + +#[test] +fn a_sliced_ellipse_still_builds_its_arc() { + let pie = ellipse(100.0, 100.0, 0.0, PI, 0.0); + assert!(!cubics(&pie).is_empty()); + assert!(matches!(pie.elements().last(), Some(kurbo::PathEl::ClosePath))); + assert!((area(&pie) - PI * 1250.0).abs() < 2.0); +} + #[test] fn a_huge_ellipse_arc_is_a_few_cubics() { let big = ellipse(1e300, 1e300, 0.3, 2.0, 0.5); From 4118be890c2e15c9183293104a8a7e20e77e25b7 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 12:42:44 -0500 Subject: [PATCH 008/239] Ellipse: the four-cubic contour is closed, and the band test allows apex antialiasing (#2080) The band test compared row 10, the ellipse top, where the cubic now ends exactly at its level extreme; 8 pixels antialias slightly differently between a short band and the whole view. The row mean limit now grows by 0.05 per such pixel; whole-row artifacts still fail. Co-Authored-By: Claude Fable 5.1 --- crates/geom/src/lib.rs | 1 + crates/render/src/band_tests.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/geom/src/lib.rs b/crates/geom/src/lib.rs index f290882d8..41669488f 100644 --- a/crates/geom/src/lib.rs +++ b/crates/geom/src/lib.rs @@ -484,6 +484,7 @@ pub fn ellipse(width: f64, height: f64, start: f64, sweep: f64, inner: f64) -> B p.curve_to(c + Vec2::new(-kx, ry), c + Vec2::new(-rx, ky), c + Vec2::new(-rx, 0.0)); p.curve_to(c + Vec2::new(-rx, -ky), c + Vec2::new(-kx, -ry), c + Vec2::new(0.0, -ry)); p.curve_to(c + Vec2::new(kx, -ry), c + Vec2::new(rx, -ky), c + Vec2::new(rx, 0.0)); + p.close_path(); p }; if full && inner <= 0.0 { diff --git a/crates/render/src/band_tests.rs b/crates/render/src/band_tests.rs index b9a7bfbcc..e01fad5d7 100644 --- a/crates/render/src/band_tests.rs +++ b/crates/render/src/band_tests.rs @@ -83,7 +83,8 @@ fn bands_match_one_piece_rendering() { assert_eq!((banded.width(), banded.height()), (one.width(), one.height())); for (y, (mean, off)) in row_diffs(&one, &banded).into_iter().enumerate() { assert!( - mean < 0.25 && off * 20 <= v.width as usize, + // Each pixel antialiased differently (the level top of an ellipse, where a cubic ends at its extreme) may add up to 0.05 to the row's mean. + mean < 0.25 + 0.05 * off as f64 && off * 20 <= v.width as usize, "scale {scale}, {bands} bands: row {y} differs ({off} pixels, {mean:.2} on average)" ); } From 0774e44fa8c4218821a300e341237cfcb071f822 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 13:41:25 -0500 Subject: [PATCH 009/239] Render band test: only small antialiasing differences are forgiven, a real band artifact still fails (#2080) Pixels whose largest channel differs by 24 or less are noise and left out of the row mean, which keeps its original 0.25 limit; the differing-pixel limit is unchanged. A unit test shows a 44-pixel row off by 60 still fails. Co-Authored-By: Claude Fable 5.1 --- crates/render/src/band_tests.rs | 68 ++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/crates/render/src/band_tests.rs b/crates/render/src/band_tests.rs index e01fad5d7..4ea9fb1f6 100644 --- a/crates/render/src/band_tests.rs +++ b/crates/render/src/band_tests.rs @@ -56,20 +56,58 @@ fn view(scale: f64) -> View { View { origin: (-10.0, -10.0), scale, width: (440.0 * scale) as u32, height: (240.0 * scale) as u32 } } -/// Per row: the mean channel difference and how many pixels differ by more than 2. A band artifact -/// differs along a whole row; edge antialiasing may differ in a few pixels per edge (a curve -/// clipped at a band's edge rasterises a hair differently, most where it runs nearly level). +/// A pixel whose largest channel differs by at most this much between two renders is edge +/// antialiasing noise (a curve clipped at a band's edge rasterises a hair differently, most where +/// it runs level, as at the top of an ellipse), not a band artifact. +const NOISE: u8 = 24; + +/// One row of two renders: the mean channel difference over the pixels that are not noise (see +/// `NOISE`), and how many pixels differ by more than 2 at all. A band artifact differs along a +/// whole row, by more than noise. +fn row_stats(x: &[u8], y: &[u8]) -> (f64, usize) { + let mut sum = 0.0; + let mut off = 0; + for (p, q) in x.chunks(4).zip(y.chunks(4)) { + let worst = p.iter().zip(q).map(|(c, d)| c.abs_diff(*d)).max().unwrap_or(0); + if worst > 2 { + off += 1; + } + if worst > NOISE { + sum += p.iter().zip(q).map(|(c, d)| f64::from(c.abs_diff(*d))).sum::(); + } + } + (sum / x.len().max(1) as f64, off) +} + fn row_diffs(a: &Pixmap, b: &Pixmap) -> Vec<(f64, usize)> { let row = a.width() as usize * 4; - a.data() - .chunks(row) - .zip(b.data().chunks(row)) - .map(|(x, y)| { - let sum: f64 = x.iter().zip(y).map(|(p, q)| f64::from(p.abs_diff(*q))).sum(); - let off = x.chunks(4).zip(y.chunks(4)).filter(|(p, q)| p.iter().zip(*q).any(|(c, d)| c.abs_diff(*d) > 2)).count(); - (sum / row as f64, off) - }) - .collect() + a.data().chunks(row).zip(b.data().chunks(row)).map(|(x, y)| row_stats(x, y)).collect() +} + +/// Whether a row passes: the original mean limit over non-noise pixels, and at most a twentieth +/// of the row differing at all. +fn row_ok(mean: f64, off: usize, width: usize) -> bool { + mean < 0.25 && off * 20 <= width +} + +#[test] +fn a_real_band_artifact_fails_but_edge_noise_passes() { + let width = 880; // scale 2 + let flat = vec![100u8; width * 4]; + // 44 pixels differing by 60 per channel: under the old mean allowance, but a real artifact. + let mut artifact = flat.clone(); + for px in artifact.chunks_mut(4).take(44) { + px.iter_mut().for_each(|c| *c += 60); + } + let (mean, off) = row_stats(&flat, &artifact); + assert!(!row_ok(mean, off, width), "{mean} {off}"); + // 8 pixels differing by 16 (the ellipse top's antialiasing): forgiven. + let mut noise = flat.clone(); + for px in noise.chunks_mut(4).take(8) { + px.iter_mut().for_each(|c| *c += 16); + } + let (mean, off) = row_stats(&flat, &noise); + assert!(row_ok(mean, off, width), "{mean} {off}"); } #[test] @@ -82,11 +120,7 @@ fn bands_match_one_piece_rendering() { let banded = render_bands(&d, p, &v, &Options::default(), bands).unwrap(); assert_eq!((banded.width(), banded.height()), (one.width(), one.height())); for (y, (mean, off)) in row_diffs(&one, &banded).into_iter().enumerate() { - assert!( - // Each pixel antialiased differently (the level top of an ellipse, where a cubic ends at its extreme) may add up to 0.05 to the row's mean. - mean < 0.25 + 0.05 * off as f64 && off * 20 <= v.width as usize, - "scale {scale}, {bands} bands: row {y} differs ({off} pixels, {mean:.2} on average)" - ); + assert!(row_ok(mean, off, v.width as usize), "scale {scale}, {bands} bands: row {y} differs ({off} pixels, {mean:.2} on average)"); } } } From 97f086e091d712548a3415bceb344284b62302b8 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 7 Nov 2026 16:36:59 -0800 Subject: [PATCH 010/239] Docs: the Display P3 export sentence names RGB PDF and says CMYK PDF ends as DeviceCMYK The colour profile paragraph in docs/mcp.md said SVG and PDF export Display P3 files converted to sRGB, without the RGB qualifier the export tool text now carries. It now says SVG and RGB PDF convert to sRGB, and PDF with `cmyk` converts to sRGB the same way and then to DeviceCMYK. The comment above the export match in file.rs says the same. --- crates/engine/src/cmd/file.rs | 3 ++- docs/mcp.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rs index e52960d43..ca83292ec 100644 --- a/crates/engine/src/cmd/file.rs +++ b/crates/engine/src/cmd/file.rs @@ -372,7 +372,8 @@ pub fn export_file(doc: &Document, ids: &[NodeId], setting: &ExportSetting, scal && !setting.include_bounding_box && !ids.iter().any(|i| doc.node(*i).is_some_and(|n| matches!(n.kind, NodeKind::Slice))); match setting.format { - // SVG and PDF colours are sRGB: a Display P3 file exports converted (out-of-gamut colours clip). + // SVG and RGB PDF colors are sRGB: a Display P3 file exports converted (out-of-gamut colours clip). + // PDF with `cmyk` converts from those sRGB colors to DeviceCMYK. ExportFormat::Svg => { let opts = figcraft_svg::SvgOptions { include_ids: setting.svg_id_attribute, diff --git a/docs/mcp.md b/docs/mcp.md index 11945a76c..5b4efa3f7 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -255,8 +255,8 @@ Or in a project's `.mcp.json`: profile into the file's space: an embedded ICC profile (PNG, JPG, WebP, TIFF; RGB or grey), a PNG's `sRGB` / `gAMA` / `cHRM` chunks, else sRGB (also for CMYK or damaged profiles); `image.place` reports the profile's name as `imageProfile` (`null`: none usable, taken as sRGB). PNG exports are tagged (`sRGB` chunk, or a Display P3 ICC profile plus - `cICP`), JPG embeds the ICC profile for sRGB and for Display P3, WebP embeds it for Display P3 only (sRGB WebP is untagged), and SVG and PDF export Display P3 files - converted to sRGB (out-of-gamut colours clip). The app's canvas shows sRGB (P3 colours outside sRGB clip on screen): + `cICP`), JPG embeds the ICC profile for sRGB and for Display P3, WebP embeds it for Display P3 only (sRGB WebP is untagged), and SVG and RGB PDF export Display P3 files + converted to sRGB (out-of-gamut colours clip). PDF with `cmyk` converts them to sRGB the same way and then to DeviceCMYK. The app's canvas shows sRGB (P3 colours outside sRGB clip on screen): `view.proofSrgb {on?}` (View ▸ Soft-proof sRGB) stripes those pixels so `screenshot {window: true}` shows where they are (after the next canvas render), and the colour picker says Outside sRGB for such a colour. From 0c1fb11c4800d98090c00b4e531cec81e12507b0 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 19:37:16 -0500 Subject: [PATCH 011/239] Render band test: the comments say what row_stats divides by and what the artifact case measures (#2080) row_stats sums the differences of the pixels above noise and divides by the whole row's channel count; the doc now says so. The artifact case changes only the colour channels, so its mean is 2.25, which the earlier allowance let through, and its comment now says it fails on the mean while its count stays within a twentieth of the row. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote at high; no brief --- crates/render/src/band_tests.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/crates/render/src/band_tests.rs b/crates/render/src/band_tests.rs index 4ea9fb1f6..9fcf29f20 100644 --- a/crates/render/src/band_tests.rs +++ b/crates/render/src/band_tests.rs @@ -61,9 +61,10 @@ fn view(scale: f64) -> View { /// it runs level, as at the top of an ellipse), not a band artifact. const NOISE: u8 = 24; -/// One row of two renders: the mean channel difference over the pixels that are not noise (see -/// `NOISE`), and how many pixels differ by more than 2 at all. A band artifact differs along a -/// whole row, by more than noise. +/// One row of two renders: the channel differences of the pixels above noise (see `NOISE`) summed +/// and divided by the whole row's channel count, so noise pixels add nothing but still count in +/// the denominator; and how many pixels differ by more than 2 at all. A band artifact differs along +/// a whole row, by more than noise. fn row_stats(x: &[u8], y: &[u8]) -> (f64, usize) { let mut sum = 0.0; let mut off = 0; @@ -84,8 +85,8 @@ fn row_diffs(a: &Pixmap, b: &Pixmap) -> Vec<(f64, usize)> { a.data().chunks(row).zip(b.data().chunks(row)).map(|(x, y)| row_stats(x, y)).collect() } -/// Whether a row passes: the original mean limit over non-noise pixels, and at most a twentieth -/// of the row differing at all. +/// Whether a row passes: the original 0.25 limit on the mean from `row_stats`, and at most a +/// twentieth of the row differing at all. fn row_ok(mean: f64, off: usize, width: usize) -> bool { mean < 0.25 && off * 20 <= width } @@ -94,10 +95,13 @@ fn row_ok(mean: f64, off: usize, width: usize) -> bool { fn a_real_band_artifact_fails_but_edge_noise_passes() { let width = 880; // scale 2 let flat = vec![100u8; width * 4]; - // 44 pixels differing by 60 per channel: under the old mean allowance, but a real artifact. + // 44 pixels whose colour channels differ by 60 (alpha unchanged): the mean is + // 44 * 3 * 60 / (880 * 4) = 2.25, which the earlier `0.25 + 0.05 * off` allowance (2.45 here) + // let through; the count, 44, is within a twentieth of the row. A real artifact, so it fails + // on the mean now. let mut artifact = flat.clone(); for px in artifact.chunks_mut(4).take(44) { - px.iter_mut().for_each(|c| *c += 60); + px.iter_mut().take(3).for_each(|c| *c += 60); } let (mean, off) = row_stats(&flat, &artifact); assert!(!row_ok(mean, off, width), "{mean} {off}"); From 6c3ac0c55b71bb355e59d6c0eb9156048f2e1024 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 19:44:51 -0500 Subject: [PATCH 012/239] Export settings: node.set takes back what node.get returns (snake_case aliases) node.get reports an export setting's two-word fields in snake_case, which node.set refused, so a setting could not be read and written back unchanged. ExportSetting now accepts those names as serde aliases; the camelCase names stay the canonical form. Follow-up the maintainer suggested on #2008. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 wrote at medium --- crates/doc/src/props.rs | 9 +++++++ crates/engine/src/export_behaviour_tests.rs | 28 +++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/crates/doc/src/props.rs b/crates/doc/src/props.rs index 99b9d9c39..664fcf88d 100644 --- a/crates/doc/src/props.rs +++ b/crates/doc/src/props.rs @@ -1449,8 +1449,10 @@ pub struct PrintSettings { /// is printed this far out, to be trimmed off. pub bleed: f64, /// Crop marks outside the bleed, at the trim's corners. + #[serde(alias = "crop_marks")] pub crop_marks: bool, /// Bleed marks outside the bleed, at the bleed's corners. + #[serde(alias = "bleed_marks")] pub bleed_marks: bool, /// CMYK colour (converted from RGB) instead of RGB. pub cmyk: bool, @@ -1519,25 +1521,32 @@ pub struct ExportSetting { pub print: PrintSettings, /// Only the layer itself (on), or every layer that shows in its area (off). #[serde(skip_serializing_if = "is_true")] + #[serde(alias = "contents_only")] pub contents_only: bool, /// The layer's own box, cutting off what it paints outside it (shadows, outside strokes). #[serde(skip_serializing_if = "is_false")] + #[serde(alias = "include_bounding_box")] pub include_bounding_box: bool, /// SVG: text as outlines (on) or as `` elements (off). #[serde(skip_serializing_if = "is_true")] + #[serde(alias = "svg_outline_text")] pub svg_outline_text: bool, /// SVG: layer names as `id` attributes. #[serde(skip_serializing_if = "is_false")] + #[serde(alias = "svg_id_attribute")] pub svg_id_attribute: bool, /// SVG: strokes as `stroke` attributes where that's exact (on), else as outlines. #[serde(skip_serializing_if = "is_true")] + #[serde(alias = "svg_simplify_stroke")] pub svg_simplify_stroke: bool, /// Android Vector Drawable: what to do with what a drawable can't hold exactly. #[serde(skip_serializing_if = "VdCompat::is_default")] + #[serde(alias = "vd_compat")] pub vd_compat: VdCompat, /// PNG, JPG and WebP: the color profile the file is written in. SVG, PDF and XML are always /// sRGB, whatever this says. #[serde(skip_serializing_if = "ExportColorProfile::is_default")] + #[serde(alias = "color_profile")] pub color_profile: ExportColorProfile, /// JPG: the encoder's quality, 1 (smallest file) to 100 (see [`ExportSetting::quality`]). #[serde(skip_serializing_if = "is_default_quality")] diff --git a/crates/engine/src/export_behaviour_tests.rs b/crates/engine/src/export_behaviour_tests.rs index 1cd836784..020734dbe 100644 --- a/crates/engine/src/export_behaviour_tests.rs +++ b/crates/engine/src/export_behaviour_tests.rs @@ -384,3 +384,31 @@ fn copy_as_png_svg_and_code() { let css = crate::codegen::code_for(doc, a, crate::codegen::CodeLang::Css); assert!(css.contains("background: #FF0000;"), "Copy as CSS is the layer's CSS from Inspect"); } + +#[test] +fn node_set_takes_back_the_export_settings_node_get_returns() { + let mut s = Session::new(); + let a = rect(&mut s, 0.0, 0.0, 40.0, 20.0, "#FF0000", None); + let given = json!({ + "format": "jpg", + "suffix": "@3x", + "contentsOnly": false, + "includeBoundingBox": true, + "svgOutlineText": false, + "svgIdAttribute": true, + "svgSimplifyStroke": false, + "vdCompat": "exact", + "colorProfile": "displayP3", + "quality": 55, + "bleed": 9, + "cropMarks": true, + "bleedMarks": true, + }); + ex(&mut s, "export.add", json!({"ids": [a], "setting": given})); + let stored = s.doc().unwrap().node(a).unwrap().exports.clone(); + assert_eq!(stored.len(), 1); + let got = ex(&mut s, "node.get", json!({"id": a}))["exports"].clone(); + set(&mut s, &[a], json!({"exports": []})); + set(&mut s, &[a], json!({"exports": got})); + assert_eq!(s.doc().unwrap().node(a).unwrap().exports, stored, "node.set stores what node.get returned, unchanged"); +} From a198046384b37e1c9e6fe98207a36b3ba6967c7d Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 19:57:05 -0500 Subject: [PATCH 013/239] Smart guides: objects snap within 4.5 screen pixels, as measured in Figma Figma snaps a dragged object's edge to another's at a gap of 4.4 screen pixels and not at 4.6, at 100% and at 200% zoom, so the threshold is about 4.5 screen pixels; FigCraft used 5. The object snap (move, resize, draw, vector points) now uses 4.5, and the equal-spacing snap in a move shares that threshold so it follows. Ruler-guide and rotation-origin snapping keep 5, unmeasured. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 measured and wrote at medium --- crates/engine/src/canvas/rotation_origin.rs | 4 ++-- crates/engine/src/canvas/snap.rs | 6 +++--- crates/engine/src/canvas/tools.rs | 2 +- crates/engine/src/canvas/tools/handles.rs | 9 ++++++-- .../engine/src/transform_behaviour_tests.rs | 21 +++++++++++++++++++ docs/ui-parity.md | 3 ++- 6 files changed, 36 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/canvas/rotation_origin.rs b/crates/engine/src/canvas/rotation_origin.rs index 8498f708a..5552bc77b 100644 --- a/crates/engine/src/canvas/rotation_origin.rs +++ b/crates/engine/src/canvas/rotation_origin.rs @@ -8,7 +8,7 @@ use figcraft_doc::{Document, NodeId}; use figcraft_geom::Point; use crate::cmd::edit::roots; -use crate::tools::{SNAP_PX, selection_box}; +use crate::tools::{UNMEASURED_SNAP_PX, selection_box}; use crate::{DocState, EngineError, Result, Session}; /// How near (screen pixels) a press must be to grab the origin handle. @@ -115,7 +115,7 @@ impl Session { let snapped = box_points(&ds.doc, &ds.selection).and_then(|b| { b.iter() .enumerate() - .filter(|(_, q)| (**q - p).hypot() * zoom.max(1e-6) <= SNAP_PX) + .filter(|(_, q)| (**q - p).hypot() * zoom.max(1e-6) <= UNMEASURED_SNAP_PX) .min_by(|x, y| (*x.1 - p).hypot().total_cmp(&(*y.1 - p).hypot())) .map(|(i, q)| (i, *q)) }); diff --git a/crates/engine/src/canvas/snap.rs b/crates/engine/src/canvas/snap.rs index cd40437d3..ff1a6b64d 100644 --- a/crates/engine/src/canvas/snap.rs +++ b/crates/engine/src/canvas/snap.rs @@ -9,7 +9,7 @@ use figcraft_geom::{Affine, Point, Rect, Vec2, transform_rect_bbox}; use serde::Serialize; use crate::guides; -use crate::tools::SNAP_PX; +use crate::tools::UNMEASURED_SNAP_PX; /// A guide line to draw: from (x0, y0) to (x1, y1) in page coordinates, with an optional label /// (a distance) at its middle; `dashed` marks a measurement's extension line. @@ -438,14 +438,14 @@ impl Targets { } /// Snap a guide on `owner` (a page or a top-level frame) to the nearest layer edge or centre along -/// its own axis, within `SNAP_PX` screen pixels at `zoom`. Returns the new offset in `owner`'s +/// its own axis, within `UNMEASURED_SNAP_PX` screen pixels at `zoom`. Returns the new offset in `owner`'s /// coordinates, or `None` when nothing is in reach. pub fn snap_guide(doc: &Document, page: NodeId, owner: NodeId, vertical: bool, offset: f64, zoom: f64) -> Option { // The guide moves along the owner's own axis (x for a vertical guide, y for a horizontal one), // which the owner's transform may scale: convert the screen-pixel reach into owner units. let [a, b, c, d, _, _] = doc.world_transform(owner).as_coeffs(); let axis = if vertical { a.hypot(b) } else { c.hypot(d) }; - let threshold = SNAP_PX / (zoom.max(1e-6) * axis.max(1e-6)); + let threshold = UNMEASURED_SNAP_PX / (zoom.max(1e-6) * axis.max(1e-6)); Targets::gather_for_guide(doc, page, owner).snap_axis(vertical, offset, threshold).map(|d| offset + d).filter(|v| v.is_finite()) } diff --git a/crates/engine/src/canvas/tools.rs b/crates/engine/src/canvas/tools.rs index a3284cd52..0c409a682 100644 --- a/crates/engine/src/canvas/tools.rs +++ b/crates/engine/src/canvas/tools.rs @@ -34,7 +34,7 @@ pub use handles::{ PENCIL_STROKE, SMALL_BOX_PX, anchor_name, anchor_of, box_sides_px, handle_at, handle_at_corners, label_at, locked_in, scale_anchor_point, selection_box, selection_frame, }; -pub(crate) use handles::{SNAP_PX, handle_cursor, readable_text_fills, resized_box}; +pub(crate) use handles::{SNAP_PX, UNMEASURED_SNAP_PX, handle_cursor, readable_text_fills, resized_box}; #[cfg(test)] pub(crate) use pen::pressure_profile; diff --git a/crates/engine/src/canvas/tools/handles.rs b/crates/engine/src/canvas/tools/handles.rs index 9fa04d9bb..f60866ec1 100644 --- a/crates/engine/src/canvas/tools/handles.rs +++ b/crates/engine/src/canvas/tools/handles.rs @@ -71,8 +71,13 @@ const HANDLE_PX: f64 = 5.0; const ROTATE_PX: f64 = 18.0; -/// Snap distance in screen pixels. -pub(crate) const SNAP_PX: f64 = 5.0; +/// Object snap distance in screen pixels: measured in Figma, where an edge snaps at a gap of 4.4 +/// screen px and not at 4.6, at 100% and at 200% zoom. +pub(crate) const SNAP_PX: f64 = 4.5; + +/// Snap distance in screen pixels for ruler guides and the rotation origin, not measured against +/// Figma. +pub(crate) const UNMEASURED_SNAP_PX: f64 = 5.0; /// Screen pixels the pointer travels after a press before a move or resize starts: a click or a /// double-click made with an unsteady hand doesn't drag what it lands on. diff --git a/crates/engine/src/transform_behaviour_tests.rs b/crates/engine/src/transform_behaviour_tests.rs index e22eb0418..56d581b32 100644 --- a/crates/engine/src/transform_behaviour_tests.rs +++ b/crates/engine/src/transform_behaviour_tests.rs @@ -625,6 +625,27 @@ fn smart_guides_snap_to_edges_centres_and_equal_spacing() { assert_eq!(bounds(&s, b).origin(), Point::new(198.0, 2.0)); } +#[test] +fn a_layer_edge_snaps_within_4_5_screen_pixels_at_any_zoom() { + // Measured in Figma (2026-11-08): a dragged edge snaps at a gap of 4.4 screen px and not at 4.6, + // at 100% and at 200% zoom. + for (zoom, gap_px, snaps) in [(1.0, 4.4, true), (1.0, 4.8, false), (2.0, 4.4, true), (2.0, 4.8, false)] { + let mut s = Session::new(); + ex(&mut s, "view.snapPixel", json!({"on": false})); + rect(&mut s, 0.0, 0.0, 100.0, 100.0, None); + let b = rect(&mut s, 300.0, 300.0, 100.0, 100.0, None); + ex(&mut s, "select.set", json!({"ids": [b]})); + let gap = gap_px / zoom; + let to = Point::new(350.0 - (200.0 - gap), 350.0); + for (kind, p) in [(PointerKind::Down, Point::new(350.0, 350.0)), (PointerKind::Move, to), (PointerKind::Up, to)] { + s.pointer(&PointerEvent::at(kind, p.x, p.y, zoom)).unwrap(); + } + let want = if snaps { 100.0 } else { 100.0 + gap }; + let got = bounds(&s, b).x0; + assert!(near(got, want), "zoom {zoom}, gap {gap_px} screen px: left edge at {got}, wanted {want}"); + } +} + #[test] fn snapping_to_layers_wins_over_the_pixel_grid() { // Both on (the defaults): a layer's centre at x = 5.5 is still a target. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index aa0ef25bd..b19d0c5a5 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -69,7 +69,7 @@ interaction feel not yet compared. | Drag threshold; double-click into groups and text | done | a press moves or resizes only once the pointer has travelled 3 px on screen, so a click or double-click made with an unsteady hand drags nothing; a double-click goes one level into a group and the next one edits the text under it, wherever on the text it lands, with all of it selected (a double-click in the text being edited selects the word) (`double_click_tests`); Enter on a selected text does the same (all of it selected, typing replaces it) and Escape leaves editing with the layer still selected (`text_enter_tests`) | | Scale tool (K): handles about an anchor, live factor, panel | done | | | Nudge 1 / Shift 10 (preference), Cmd+arrows resize | done | arrows reorder auto layout children | -| Smart guides: edges, centres, equal spacing (between two layers or continuing a row's gap, labelled), spacing labels, parent, layout grid, ruler guides | done | red, `snap.rs`; a guide dragged out of a ruler or moved snaps to layer edges and centres too (Snap to Objects; Cmd/Ctrl suspends), on its own axis only; page guides see the page's top-level layers, frame guides the frame's box, layout grids and every layer in it, along a rotated frame's own axes; thresholds not yet compared with Figma's (`guide_snap_tests`) | +| Smart guides: edges, centres, equal spacing (between two layers or continuing a row's gap, labelled), spacing labels, parent, layout grid, ruler guides | done | red, `snap.rs`; a guide dragged out of a ruler or moved snaps to layer edges and centres too (Snap to Objects; Cmd/Ctrl suspends), on its own axis only; page guides see the page's top-level layers, frame guides the frame's box, layout grids and every layer in it, along a rotated frame's own axes; the object snap threshold is 4.5 screen pixels, measured against Figma (snapped at a gap of 4.4 screen px, not at 4.6, at 100% and 200% zoom, 2026-11-08; the equal-spacing snap shares it), but the ruler-guide and rotation-origin thresholds (5 px), the red guide's look and snapping with Snap to pixel grid off are not yet compared with Figma's (`guide_snap_tests`, `transform_behaviour_tests`) | | Ctrl to suspend snapping while dragging (macOS) | done | Control on macOS (Cmd keeps working), Ctrl elsewhere; moving, resizing and drawing | | Measure (Alt hover, Cmd+Alt nested, Shift+Alt padding/gaps) | done | labels never overlap; the arrows still nudge while measuring (Shift: the big step) and the distances follow; the selection's handles and size label hide while measuring (`measure_nudge_tests`, #894) | | Pixel grid snapping, pixel preview, 2x preview | done | moves, resizes and new shapes land on whole pixels; the pixel grid shows from 400% (`view_behaviour_tests`) | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-08 | patch | Smart guides: the object snap threshold is 4.5 screen pixels, measured against Figma (a dragged edge snapped at a gap of 4.4 screen px and not at 4.6, at 100% and at 200% zoom, Snap to pixel grid on); FigCraft used 5. Equal spacing shares the move's threshold so it follows; ruler-guide and rotation-origin snapping keep 5, unmeasured (`transform_behaviour_tests`) | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 4313a60fb69d6cf7e74bd4566fd54f4b78bea073 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 20:29:58 -0500 Subject: [PATCH 014/239] Variables: Duplicate group copies a group's variables as " 2", in one undo step (#2084) The group row's context menu in the Local variables window gets Duplicate group, as in the reference: a copy named after the group plus " 2", placed after the original, holding a copy of every variable with its values in every mode, scopes and settings, undone in one step. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed from a Chrome measurement; Sonnet 5.5 wrote at medium --- crates/ui-egui/locales/en.toml | 1 + crates/ui-egui/src/dialogs/variables_panel.rs | 26 ++++++++ crates/ui-egui/src/variables_select_tests.rs | 63 +++++++++++++++++++ docs/components-parity.md | 5 +- 4 files changed, 93 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index bb8546ee6..d8c17e639 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -521,6 +521,7 @@ name = "English" "Duo" = "Duo" "Duplicate" = "Duplicate" "Duplicate by dragging" = "Duplicate by dragging" +"Duplicate group" = "Duplicate group" "Duplicate mode" = "Duplicate mode" "Duplicate page" = "Duplicate page" "Edit" = "Edit" diff --git a/crates/ui-egui/src/dialogs/variables_panel.rs b/crates/ui-egui/src/dialogs/variables_panel.rs index a2a421052..3887895bb 100644 --- a/crates/ui-egui/src/dialogs/variables_panel.rs +++ b/crates/ui-egui/src/dialogs/variables_panel.rs @@ -564,6 +564,10 @@ fn group_rows(app: &mut FigApp, ui: &mut Ui, view: &View, coll: &Collection, st: start_rename(st, target.clone()); ui.close(); } + if menu_item(ui, tr("Duplicate group"), "") { + duplicate_group(app, &members, &list, g); + ui.close(); + } if menu_item(ui, tr("Delete group"), "") { let steps: Vec = members .iter() @@ -604,6 +608,28 @@ fn rename_group(app: &mut FigApp, members: &[&Variable], g: &str, new: &str, st: } } +/// Copy group `g` (its variables `members`, every mode, scope and setting) as the group named +/// after it plus " 2" (the next free number among the collection's groups `list`), in one undo +/// step. Each copy is `variable.duplicate` then a rename; an alias keeps pointing at its target. +fn duplicate_group(app: &mut FigApp, members: &[&Variable], list: &[String], g: &str) { + let (parent, leaf) = g.rsplit_once('/').map_or(("", g), |(p, l)| (p, l)); + let leaf = unique(leaf, |n| { + let full = if parent.is_empty() { n.to_string() } else { format!("{parent}/{n}") }; + full == g || list.contains(&full) || members.iter().any(|v| v.name.starts_with(&format!("{full}/"))) + }); + let copy = if parent.is_empty() { leaf } else { format!("{parent}/{leaf}") }; + let prefix = format!("{g}/"); + let mut steps: Vec = Vec::new(); + for (k, v) in members.iter().filter(|v| v.name.starts_with(&prefix)).enumerate() { + let tag = format!("copy{k}"); + steps.push(json!({"command": "variable.duplicate", "params": {"variable": v.id}, "as": tag})); + steps.push( + json!({"command": "variable.update", "params": {"variable": {"$ref": tag}, "name": format!("{copy}/{}", &v.name[prefix.len()..])}}), + ); + } + app.run("command.batch", json!({"label": "Duplicate group", "commands": steps})); +} + fn create_collection(app: &mut FigApp, vars: &Variables, st: &mut Editor) { let name = unique("Collection", |n| vars.collections.iter().any(|c| c.name == n)); if let Some(id) = diff --git a/crates/ui-egui/src/variables_select_tests.rs b/crates/ui-egui/src/variables_select_tests.rs index b391df326..cfb93efd6 100644 --- a/crates/ui-egui/src/variables_select_tests.rs +++ b/crates/ui-egui/src/variables_select_tests.rs @@ -250,3 +250,66 @@ fn the_bulk_menu_scrolls_when_forty_groups_make_it_taller_than_the_window() { assert!(visible(&shapes), "scrolling the menu never brought {last:?} into view"); assert!(screen.contains_rect(popup_rect(&u))); } + +/// A collection with a group `space` of two number variables with distinct values in two modes. +fn grouped_window() -> Ui { + let mut s = Session::new(); + s.execute("variable.createCollection", &json!({"name": "Theme", "modes": ["Light", "Dark"]})).unwrap(); + for (n, light, dark) in [("space/sm", 4, 8), ("space/md", 16, 32)] { + s.execute("variable.create", &json!({"collection": "Theme", "name": n, "type": "number", "value": light})).unwrap(); + s.execute("variable.set", &json!({"variable": n, "mode": "Dark", "value": dark})).unwrap(); + s.execute("variable.update", &json!({"variable": n, "scopes": ["GAP"], "description": n})).unwrap(); + } + let mut u = Ui::new(s); + u.app.ui.variables = Some(Default::default()); + for _ in 0..10 { + u.frame(vec![]); + } + u +} + +/// Right-click the group row `name` and choose Duplicate group. +fn duplicate_group(u: &mut Ui, name: &str) { + let p = row(u, name); + click(u, p, PointerButton::Secondary, Modifiers::NONE); + let menu = flat(&u.frame_output(vec![]).shapes); + click(u, text_center(&menu, "Duplicate group"), PointerButton::Primary, Modifiers::NONE); + assert!(u.app.ui.last_error.is_none(), "{:?}", u.app.ui.last_error); +} + +#[test] +fn duplicate_group_copies_every_variable_in_both_modes_in_one_undo_step() { + let mut u = grouped_window(); + let before = u.app.session.undo_labels(100).len(); + duplicate_group(&mut u, "space"); + let doc = u.app.session.doc().unwrap(); + let vars = &doc.variables; + for (leaf, light, dark) in [("sm", 4, 8), ("md", 16, 32)] { + let old = vars.variables.iter().find(|v| v.name == format!("space/{leaf}")).unwrap(); + let new = vars.variables.iter().find(|v| v.name == format!("space 2/{leaf}")).unwrap_or_else(|| panic!("no space 2/{leaf}")); + assert_ne!(old.id, new.id); + assert_eq!(new.values, old.values, "{leaf}: values in both modes"); + assert_eq!(new.scopes, old.scopes); + assert_eq!(new.description, old.description); + let _ = (light, dark); + } + assert_eq!(names(&u).len(), 4); + assert_eq!(u.app.session.undo_labels(100).len(), before + 1, "one undo step"); + assert_eq!(u.app.session.undo_labels(1), ["Duplicate group"]); + // The new group is listed directly after the original. + let shapes = flat(&u.frame_output(vec![]).shapes); + assert!(has_text(&shapes, "space 2")); + assert!(text_center(&shapes, "space 2").y > text_center(&shapes, "space").y); + u.app.session.undo().unwrap(); + assert_eq!(names(&u), ["space/sm", "space/md"]); +} + +#[test] +fn a_second_duplicate_group_takes_the_next_free_name() { + let mut u = grouped_window(); + duplicate_group(&mut u, "space"); + duplicate_group(&mut u, "space"); + let n = names(&u); + assert!(n.contains(&"space 2/sm".to_string()) && n.contains(&"space 3/md".to_string()), "{n:?}"); + assert_eq!(n.len(), 6); +} diff --git a/docs/components-parity.md b/docs/components-parity.md index d6b1ee5e6..3a0aabf92 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-11-06 · **Change:** minor (the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (a group's context menu in the Local variables window has Duplicate group, a copy named after it plus " 2" holding a copy of every variable, in one undo step (#2084); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; 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 @@ -64,7 +64,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Editing a style updates its layers; detach and delete keep values; editing a styled property unlinks that style | done | an edited fill/stroke/effect/grid list or text chars unlink; applying a style replaces variables bound to what it sets; text styles on text layers only | | Organising styles: folders by `/` names, order, duplicate, rename folder, Local styles list | done | `style.move` (into a folder renames), `style.duplicate` (right below), `style.renameFolder`; the page's Local styles list by type and folder (drag to reorder, right-click) | | Variables inside styles (paint, effect, grid and text styles; each user resolves them in its own modes) | done | `style.bind`, `style_vars_tests`; the editor binds paint colours, shadow colours, blur radii, grid sizes and a text style's font, font style, size, line height and letter spacing, the rest through the command | -| Variables: colour, number, string, boolean; collections, modes, aliases, scopes, groups | done | behaviour suite: `variables_behaviour_tests.rs`; aliases same type, no loops (also on create); colour calculations per mode (`{alpha}`: a colour variable with its alpha replaced, `{mix}`: a per-channel blend of two colour variables or literals; they compose, can't loop, and bound layers, modes and undo follow them; REST, CSS, Penpot and `.fig` exports write the colour they show in each of their collection's modes, other collections in their default modes; read-only in the panel, which can swap one for an alias or detach it; `variables_colour_tests.rs`), beyond the incumbent, whose variables only alias; scopes filter pickers only; several variables can be selected in the editor (Shift and Cmd/Ctrl click) and deleted, moved to a group or rescoped at once | +| Variables: colour, number, string, boolean; collections, modes, aliases, scopes, groups | done | behaviour suite: `variables_behaviour_tests.rs`; aliases same type, no loops (also on create); colour calculations per mode (`{alpha}`: a colour variable with its alpha replaced, `{mix}`: a per-channel blend of two colour variables or literals; they compose, can't loop, and bound layers, modes and undo follow them; REST, CSS, Penpot and `.fig` exports write the colour they show in each of their collection's modes, other collections in their default modes; read-only in the panel, which can swap one for an alias or detach it; `variables_colour_tests.rs`), beyond the incumbent, whose variables only alias; scopes filter pickers only; several variables can be selected in the editor (Shift and Cmd/Ctrl click) and deleted, moved to a group or rescoped at once; a group can be duplicated from its row's menu (Duplicate group, one undo step) | | Modes: add, duplicate, rename, delete, set as default / reorder | done | layers on Auto follow a new default; explicit modes stay | | Deleting a bound variable or its collection | done | layers keep their last value and are unbound; aliases to it take its values and colour calculations reading it keep the colour they show | | Code syntax per platform (Web, iOS, Android) | done | generated CSS uses the Web name, SwiftUI the iOS one and Compose the Android one (a variable without one keeps its value there); in the variables JSON; ArkUI and Flutter have no platform of their own and write values | @@ -79,6 +79,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Date | Change | Summary | |---|---|---| +| 2026-11-07 | minor | M3, #2084: a group's context menu in the Local variables window has Duplicate group (after Rename group, before Delete group). It adds a group named after the original plus " 2" (the next free number when taken: " 3"), whose variables are copies of the originals with the same leaf names, values in every mode, description, scopes, hidden-from-publishing and code syntax, each sent as `variable.duplicate` plus a rename in one `command.batch` labelled Duplicate group, so one undo step. Measured in the incumbent with one mode; an alias to a variable of the same group keeps pointing at the original. Ungroup is not built. Tests: `variables_select_tests` (headless UI). Grade unchanged | | 2026-11-05 | minor | M3, #2002: the Local variables window selects several variables, as the Layers panel selects layers. A click selects one row, Shift+click the range from the anchor through the rows shown, Cmd/Ctrl+click toggles a row, Escape or a click on the empty space below the rows clears; selected rows use the sidebar's selected-row colour. Right-clicking a row that is part of a selection of several offers Delete, Move to group and Scope (all supported properties, hidden from pickers, or only one scope) for the selected local variables, each sent as one `command.batch`, so one undo step; no engine command changed. Renaming and value edits stay single-row. Tests: `variables_select_tests` (headless UI). Grade unchanged | | 2026-11-02 | minor | M3, #1829: text styles carry paragraph spacing and indent, the list style and the OpenType features ("Supported in text styles": "Paragraph spacing and indentation", "Lists", "OpenType features", Create and apply text styles) beside the character properties: `style.create` takes them from the layer (or the selected paragraphs' list) or from a `value` (`paragraphSpacing`, `paragraphIndent`, `listStyle`, `features`), `style.apply` sets them (on a range, the list goes to the paragraphs touched; the rest is the layer's, as in Figma), `style.update` moves them on every linked layer, editing one on a styled text unlinks it as editing its font does, the style editor lists them, and a `.fig` file keeps them with the style (its sample layer). Grade unchanged. | | 2026-11-06 | patch | M3: a glass's light angle bound to a number past ±180 turns round to the same direction (270 is -90), as the angle drawn from it does, instead of stopping at 180. Tests: `effects_tests::a_bound_light_angle_turns_round_instead_of_stopping`. Grade unchanged. | From ebe0a8c23a2cbb8e47992401acd00c4eeb431629 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 20:37:35 -0500 Subject: [PATCH 015/239] Measure test: the Alt-drag ends within the new 4.5 px snap distance alt_drag_shows_live_distances_to_the_neighbours dragged the copy to 5 px from the equal-spacing target, which the old 5 px threshold caught and 4.5 does not. The drag now ends at 129 (4 px off); the expected labels are unchanged. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/measure_tests.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/measure_tests.rs b/crates/engine/src/measure_tests.rs index 9f7937214..fb031102d 100644 --- a/crates/engine/src/measure_tests.rs +++ b/crates/engine/src/measure_tests.rs @@ -196,9 +196,9 @@ fn alt_drag_shows_live_distances_to_the_neighbours() { e }; s.pointer(&ev(PointerKind::Down, 30.0)).unwrap(); - // Alt duplicates: the copy, dragged to 110..160, snaps to equal spacing between the original + // Alt duplicates: the copy, dragged to 109..159, snaps to equal spacing between the original // and the other layer (105..155). - s.pointer(&ev(PointerKind::Move, 130.0)).unwrap(); + s.pointer(&ev(PointerKind::Move, 129.0)).unwrap(); let g = s.tool.overlay.guides.clone(); assert_eq!( labelled(&g), @@ -209,7 +209,7 @@ fn alt_drag_shows_live_distances_to_the_neighbours() { ("45".into(), [155, 50, 200, 50]) ] ); - s.pointer(&ev(PointerKind::Up, 130.0)).unwrap(); + s.pointer(&ev(PointerKind::Up, 129.0)).unwrap(); assert!(s.tool.overlay.guides.is_empty()); } From 3f39154a9fc161f637f03b5ccc80d02f3d9c9e7f Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 20:42:19 -0500 Subject: [PATCH 016/239] Export settings: the round-trip test checks every field's value and the snake_case form The test now compares the stored setting with a constructed expected value (every multi-word field, print and quality at a non-default value) after export.add and after the node.get -> node.set round trip, and feeds the snake_case keys to node.set directly, so a field dropped by a write cannot pass and the PrintSettings aliases are exercised. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/export_behaviour_tests.rs | 80 ++++++++++++++++----- 1 file changed, 61 insertions(+), 19 deletions(-) diff --git a/crates/engine/src/export_behaviour_tests.rs b/crates/engine/src/export_behaviour_tests.rs index 020734dbe..cc8be5658 100644 --- a/crates/engine/src/export_behaviour_tests.rs +++ b/crates/engine/src/export_behaviour_tests.rs @@ -387,28 +387,70 @@ fn copy_as_png_svg_and_code() { #[test] fn node_set_takes_back_the_export_settings_node_get_returns() { + use figcraft_doc::{ExportColorProfile, ExportFormat, ExportSetting, PrintSettings, VdCompat}; + + // Every multi-word field (and `quality`) away from its default. + let expected = ExportSetting { + format: ExportFormat::Jpg, + suffix: "@3x".into(), + print: PrintSettings { bleed: 9.0, crop_marks: true, bleed_marks: true, cmyk: true }, + contents_only: false, + include_bounding_box: true, + svg_outline_text: false, + svg_id_attribute: true, + svg_simplify_stroke: false, + vd_compat: VdCompat::Exact, + color_profile: ExportColorProfile::DisplayP3, + quality: 55, + ..Default::default() + }; + let default = ExportSetting::default(); + for (field, differs) in [ + ("print", expected.print != default.print), + ("contents_only", expected.contents_only != default.contents_only), + ("include_bounding_box", expected.include_bounding_box != default.include_bounding_box), + ("svg_outline_text", expected.svg_outline_text != default.svg_outline_text), + ("svg_id_attribute", expected.svg_id_attribute != default.svg_id_attribute), + ("svg_simplify_stroke", expected.svg_simplify_stroke != default.svg_simplify_stroke), + ("vd_compat", expected.vd_compat != default.vd_compat), + ("color_profile", expected.color_profile != default.color_profile), + ("quality", expected.quality != default.quality), + ] { + assert!(differs, "{field} must be non-default in the expected setting"); + } + let mut s = Session::new(); let a = rect(&mut s, 0.0, 0.0, 40.0, 20.0, "#FF0000", None); - let given = json!({ - "format": "jpg", - "suffix": "@3x", - "contentsOnly": false, - "includeBoundingBox": true, - "svgOutlineText": false, - "svgIdAttribute": true, - "svgSimplifyStroke": false, - "vdCompat": "exact", - "colorProfile": "displayP3", - "quality": 55, - "bleed": 9, - "cropMarks": true, - "bleedMarks": true, - }); - ex(&mut s, "export.add", json!({"ids": [a], "setting": given})); - let stored = s.doc().unwrap().node(a).unwrap().exports.clone(); - assert_eq!(stored.len(), 1); + let stored = |s: &Session| s.doc().unwrap().node(a).unwrap().exports.clone(); + ex( + &mut s, + "export.add", + json!({"ids": [a], "setting": { + "format": "jpg", "suffix": "@3x", "bleed": 9, "cropMarks": true, "bleedMarks": true, "cmyk": true, + "contentsOnly": false, "includeBoundingBox": true, "svgOutlineText": false, "svgIdAttribute": true, + "svgSimplifyStroke": false, "vdCompat": "exact", "colorProfile": "displayP3", "quality": 55, + }}), + ); + assert_eq!(stored(&s), vec![expected.clone()], "export.add stores every field"); + + // What node.get returns goes back through node.set unchanged. let got = ex(&mut s, "node.get", json!({"id": a}))["exports"].clone(); set(&mut s, &[a], json!({"exports": []})); + assert!(stored(&s).is_empty()); set(&mut s, &[a], json!({"exports": got})); - assert_eq!(s.doc().unwrap().node(a).unwrap().exports, stored, "node.set stores what node.get returned, unchanged"); + assert_eq!(stored(&s), vec![expected.clone()], "node.set stores what node.get returned, unchanged"); + + // The snake_case spelling is taken too. + set(&mut s, &[a], json!({"exports": []})); + set( + &mut s, + &[a], + json!({"exports": [{ + "format": "jpg", "suffix": "@3x", + "print": {"bleed": 9, "crop_marks": true, "bleed_marks": true, "cmyk": true}, + "contents_only": false, "include_bounding_box": true, "svg_outline_text": false, "svg_id_attribute": true, + "svg_simplify_stroke": false, "vd_compat": "exact", "color_profile": "displayP3", "quality": 55, + }]}), + ); + assert_eq!(stored(&s), vec![expected], "node.set takes the snake_case keys"); } From a20415e1542ef9d3df5e929b67e5be7911eba9b3 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 20:47:09 -0500 Subject: [PATCH 017/239] Variables: Edit variables edits Hide from publishing and scopes of several variables at once, with mixed states (#2082) With several variables selected, the bulk menu's Edit variables opens the reference's compact editor: Hide from publishing and the scopes, each shown mixed when the selection differs, each change applied to every selected variable in one undo step. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed from a Chrome measurement; Sonnet 5.5 wrote at medium --- crates/ui-egui/locales/en.toml | 3 + crates/ui-egui/src/dialogs/variables_panel.rs | 109 +++++++++++++++++- crates/ui-egui/src/variables_select_tests.rs | 67 +++++++++++ crates/ui-egui/src/widgets.rs | 12 +- docs/components-parity.md | 1 + 5 files changed, 186 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index bb8546ee6..8a297ed78 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -533,6 +533,9 @@ name = "English" "Edit padding on all sides" = "Edit padding on all sides" "Edit style" = "Edit style" "Edit variable" = "Edit variable" +"Edit variables" = "Edit variables" +"Scope" = "Scope" +"No scope is shared by all the selected variables" = "No scope is shared by all the selected variables" "Edit with the builder" = "Edit with the builder" "Edited {when}" = "Edited {when}" "Effect settings" = "Effect settings" diff --git a/crates/ui-egui/src/dialogs/variables_panel.rs b/crates/ui-egui/src/dialogs/variables_panel.rs index a2a421052..4e1219591 100644 --- a/crates/ui-egui/src/dialogs/variables_panel.rs +++ b/crates/ui-egui/src/dialogs/variables_panel.rs @@ -59,6 +59,10 @@ pub struct Editor { pub(crate) anchor: Option, /// The variable ids the table shows now, in row order (the range a Shift+click covers). pub(crate) order: Vec, + /// The variables the compact "Edit variables" editor is open on (empty = closed). + bulk_edit: Vec, + /// That editor's tab: 0 Details, 1 Scope. + bulk_tab: usize, } /// A click on row `id`: plain selects only it, Shift extends from the anchor to it through the @@ -113,8 +117,13 @@ fn bulk_run(app: &mut FigApp, label: &str, vars: &[&Variable], step: impl Fn(&Va /// The context menu of a row that is part of a selection of several: delete, move to a group and /// scope act on all of them. -fn bulk_menu(app: &mut FigApp, ui: &mut Ui, coll_groups: &[String], vars: &[&Variable]) { +fn bulk_menu(app: &mut FigApp, ui: &mut Ui, st: &mut Editor, coll_groups: &[String], vars: &[&Variable]) { let n = vars.len(); + if menu_item(ui, tr("Edit variables"), "") { + st.bulk_edit = vars.iter().map(|v| v.id.clone()).collect(); + st.bulk_tab = 0; + ui.close(); + } if menu_item(ui, &trn("Delete {n} variables", n, &[]), "") { bulk_run(app, "Delete variables", vars, |v| Some(("variable.delete", json!({"variable": v.id})))); ui.close(); @@ -277,6 +286,7 @@ pub fn show(app: &mut FigApp, ctx: &Context) { }); }); details(app, ctx, &doc.variables, &mut st); + bulk_details(app, ctx, &doc.variables, &mut st); app.ui.variables = open.then_some(st); } @@ -848,7 +858,7 @@ fn var_row(app: &mut FigApp, ui: &mut Ui, view: &View, coll: &Collection, v: &Va crate::right::context_popup(&resp).show(|ui| { if let Some(vars) = bulk_ids(view, st, v) { let coll_groups = groups(view.in_collection(&coll.id).map(|x| x.name.as_str())); - bulk_menu(app, ui, &coll_groups, &vars); + bulk_menu(app, ui, st, &coll_groups, &vars); return; } if menu_item(ui, tr("Edit variable"), "") { @@ -1178,9 +1188,102 @@ fn details(app: &mut FigApp, ctx: &Context, vars: &Variables, st: &mut Editor) { } } +/// Whether `f` holds for every variable (Some(true)), for none (Some(false)) or only some (None). +fn tri(vars: &[&T], f: impl Fn(&T) -> bool) -> Option { + let on = vars.iter().filter(|v| f(v)).count(); + if on == vars.len() { + Some(true) + } else if on == 0 { + Some(false) + } else { + None + } +} + +/// The compact editor of several selected variables: Details (only Hide from publishing) and Scope +/// (the scopes every selected variable's type has), each box mixed where the selection differs; a +/// click sets or clears it on all of them in one undo step. +fn bulk_details(app: &mut FigApp, ctx: &Context, vars: &Variables, st: &mut Editor) { + if st.bulk_edit.is_empty() { + return; + } + let list: Vec<&Variable> = st.bulk_edit.iter().filter_map(|id| vars.get_by_id(id)).filter(|v| v.extends.is_none()).collect(); + if list.is_empty() || st.library.is_some() { + st.bulk_edit.clear(); + return; + } + let t = Tokens::get(ctx); + let mut open = true; + egui::Window::new(tr("Edit variables")) + .id(Id::unique("variables_bulk_details")) + .open(&mut open) + .collapsible(false) + .resizable(false) + .default_width(280.0) + .frame(egui::Frame::window(&ctx.global_style()).fill(t.panel).inner_margin(egui::Margin::same(16))) + .show(ctx, |ui| { + ui.set_width(260.0); + if let Some(i) = widgets::segmented_text(ui, &[tr("Details"), tr("Scope")], st.bulk_tab) { + st.bulk_tab = i; + } + ui.add_space(8.0); + if st.bulk_tab == 0 { + let hidden = tri(&list, |v| v.hidden_from_publishing); + if widgets::checkbox_tri(ui, hidden, tr("Hide from publishing")) { + let to = hidden != Some(true); + bulk_run(app, "Edit variables", &list, |v| Some(("variable.update", json!({"variable": v.id, "hiddenFromPublishing": to})))); + } + return; + } + // The scopes every selected variable's type has. + let first = list.first().map_or(&[][..], |v| scopes_for(v.kind)); + let common: Vec<(&'static str, &'static str)> = + first.iter().filter(|(id, _)| list.iter().all(|v| scopes_for(v.kind).iter().any(|(k, _)| k == id))).copied().collect(); + if common.is_empty() { + widgets::label(ui, tr("No scope is shared by all the selected variables"), t.text_secondary); + return; + } + let all = tri(&list, |v| v.scopes.is_none()); + if widgets::checkbox_tri(ui, all, tr("All supported properties")) { + let to_all = all != Some(true); + bulk_run(app, "Edit variables", &list, |v| { + Some(("variable.update", json!({"variable": v.id, "scopes": if to_all { Value::Null } else { json!([]) }}))) + }); + } + for (sid, label) in common { + let state = tri(&list, |v| v.in_scope(sid)); + let clicked = ui + .horizontal(|ui| { + ui.add_space(16.0); + widgets::checkbox_tri(ui, state, tr(label)) + }) + .inner; + if clicked { + let to = state != Some(true); + bulk_run(app, "Edit variables", &list, |v| { + let next: Vec<&str> = + scopes_for(v.kind).iter().map(|(id, _)| *id).filter(|id| if *id == sid { to } else { v.in_scope(id) }).collect(); + Some(("variable.update", json!({"variable": v.id, "scopes": next}))) + }); + } + } + }); + if !open { + st.bulk_edit.clear(); + } +} + #[cfg(test)] mod tests { - use super::groups; + use super::{groups, tri}; + + #[test] + fn tri_is_checked_empty_or_mixed() { + let (a, b) = (true, false); + assert_eq!(tri(&[&a, &a], |v| *v), Some(true)); + assert_eq!(tri(&[&b, &b], |v| *v), Some(false)); + assert_eq!(tri(&[&a, &b], |v| *v), None); + } #[test] fn groups_include_parents_once_and_sorted() { diff --git a/crates/ui-egui/src/variables_select_tests.rs b/crates/ui-egui/src/variables_select_tests.rs index b391df326..f27aa3114 100644 --- a/crates/ui-egui/src/variables_select_tests.rs +++ b/crates/ui-egui/src/variables_select_tests.rs @@ -250,3 +250,70 @@ fn the_bulk_menu_scrolls_when_forty_groups_make_it_taller_than_the_window() { assert!(visible(&shapes), "scrolling the menu never brought {last:?} into view"); assert!(screen.contains_rect(popup_rect(&u))); } + +/// Three colour variables: bravo and charlie also have Stroke in their scopes, delta does not. +fn colour_window() -> Ui { + let mut s = Session::new(); + s.execute("variable.createCollection", &json!({"name": "Theme"})).unwrap(); + for (n, scopes) in + [("bravo", json!(["FRAME_FILL", "STROKE_COLOR"])), ("charlie", json!(["FRAME_FILL", "STROKE_COLOR"])), ("delta", json!(["FRAME_FILL"]))] + { + s.execute("variable.create", &json!({"collection": "Theme", "name": n, "type": "color", "value": "#ff0000"})).unwrap(); + s.execute("variable.update", &json!({"variable": n, "scopes": scopes})).unwrap(); + } + let mut u = Ui::new(s); + u.app.ui.variables = Some(Default::default()); + for _ in 0..10 { + u.frame(vec![]); + } + u +} + +fn open_edit_variables(u: &mut Ui) -> Vec { + let menu = select_three_and_open_menu(u); + assert!(has_text(&menu, "Edit variables"), "the bulk menu offers Edit variables"); + click(u, text_center(&menu, "Edit variables"), PointerButton::Primary, Modifiers::NONE); + flat(&u.frame_output(vec![]).shapes) +} + +fn flags(u: &Ui) -> Vec<(bool, bool)> { + let doc = u.app.session.doc().unwrap(); + ["bravo", "charlie", "delta"] + .iter() + .map(|n| { + let v = doc.variables.variables.iter().find(|v| v.name == *n).unwrap(); + (v.hidden_from_publishing, v.in_scope("STROKE_COLOR")) + }) + .collect() +} + +#[test] +fn edit_variables_sets_stroke_on_all_selected_in_one_undo_step() { + let mut u = colour_window(); + let shapes = open_edit_variables(&mut u); + assert!(has_text(&shapes, "Hide from publishing") && has_text(&shapes, "Scope")); + click(&mut u, text_center(&shapes, "Scope"), PointerButton::Primary, Modifiers::NONE); + let shapes = flat(&u.frame_output(vec![]).shapes); + assert!(has_text(&shapes, "Stroke")); + assert_eq!(flags(&u), [(false, true), (false, true), (false, false)]); + let before = u.app.session.undo_labels(100).len(); + click(&mut u, text_center(&shapes, "Stroke"), PointerButton::Primary, Modifiers::NONE); + assert!(u.app.ui.last_error.is_none(), "{:?}", u.app.ui.last_error); + assert_eq!(flags(&u), [(false, true), (false, true), (false, true)]); + assert_eq!(u.app.session.undo_labels(100).len(), before + 1, "one undo step"); + u.app.session.undo().unwrap(); + assert_eq!(flags(&u), [(false, true), (false, true), (false, false)]); +} + +#[test] +fn edit_variables_hides_all_selected_from_publishing_in_one_undo_step() { + let mut u = colour_window(); + let shapes = open_edit_variables(&mut u); + let before = u.app.session.undo_labels(100).len(); + click(&mut u, text_center(&shapes, "Hide from publishing"), PointerButton::Primary, Modifiers::NONE); + assert!(u.app.ui.last_error.is_none(), "{:?}", u.app.ui.last_error); + assert!(flags(&u).iter().all(|f| f.0), "all hidden"); + assert_eq!(u.app.session.undo_labels(100).len(), before + 1, "one undo step"); + u.app.session.undo().unwrap(); + assert!(flags(&u).iter().all(|f| !f.0)); +} diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index eae46fd81..05dbff893 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -1274,13 +1274,19 @@ pub fn paint_swatch(painter: &egui::Painter, rect: Rect, paint: &figcraft_color: /// A small checkbox with label. pub fn checkbox(ui: &mut Ui, on: bool, label: &str) -> bool { + checkbox_tri(ui, Some(on), label) +} + +/// A checkbox that can show a mixed state (`None`: a dash, for a setting that differs across a +/// selection); returns whether it was clicked. +pub fn checkbox_tri(ui: &mut Ui, state: Option, label: &str) -> bool { let t = Tokens::get(ui.ctx()); let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width().min(200.0), FIELD_H), Sense::click()); - a11y::checkbox(&resp, label, on); + a11y::checkbox(&resp, label, state == Some(true)); let b = Rect::from_min_size(pos2(rect.min.x, rect.center().y - 7.0), vec2(14.0, 14.0)); - if on { + if state != Some(false) { ui.painter().rect_filled(b, CornerRadius::same(3), t.accent); - icons::paint(ui.painter(), b.shrink(1.5), Icon::Check, t.accent_on); + icons::paint(ui.painter(), b.shrink(1.5), if state.is_some() { Icon::Check } else { Icon::Minus }, t.accent_on); } else { ui.painter().rect_stroke(b, CornerRadius::same(3), Stroke::new(1.0, t.border_strong), StrokeKind::Inside); } diff --git a/docs/components-parity.md b/docs/components-parity.md index d6b1ee5e6..9e5aadb68 100644 --- a/docs/components-parity.md +++ b/docs/components-parity.md @@ -79,6 +79,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Date | Change | Summary | |---|---|---| +| 2026-11-07 | minor | M3, #2082: Edit variables in the context menu of a selection of several local variables opens the reference's compact editor with two tabs: Details holds only Hide from publishing, Scope the scopes every selected variable's type has (All supported properties and one box per scope; a selection that shares none says so). Each box is checked when all selected variables have it, empty when none, and shows a dash when they differ; a click sets it on all (or clears it when checked on all), each change one `command.batch`, so one undo step. Names, descriptions and code syntax stay single-variable, as in the reference. The Scope: menu entries stay. A tri-state `widgets::checkbox_tri` draws the dash. Tests: `variables_select_tests` (headless UI). Grade unchanged | | 2026-11-05 | minor | M3, #2002: the Local variables window selects several variables, as the Layers panel selects layers. A click selects one row, Shift+click the range from the anchor through the rows shown, Cmd/Ctrl+click toggles a row, Escape or a click on the empty space below the rows clears; selected rows use the sidebar's selected-row colour. Right-clicking a row that is part of a selection of several offers Delete, Move to group and Scope (all supported properties, hidden from pickers, or only one scope) for the selected local variables, each sent as one `command.batch`, so one undo step; no engine command changed. Renaming and value edits stay single-row. Tests: `variables_select_tests` (headless UI). Grade unchanged | | 2026-11-02 | minor | M3, #1829: text styles carry paragraph spacing and indent, the list style and the OpenType features ("Supported in text styles": "Paragraph spacing and indentation", "Lists", "OpenType features", Create and apply text styles) beside the character properties: `style.create` takes them from the layer (or the selected paragraphs' list) or from a `value` (`paragraphSpacing`, `paragraphIndent`, `listStyle`, `features`), `style.apply` sets them (on a range, the list goes to the paragraphs touched; the rest is the layer's, as in Figma), `style.update` moves them on every linked layer, editing one on a styled text unlinks it as editing its font does, the style editor lists them, and a `.fig` file keeps them with the style (its sample layer). Grade unchanged. | | 2026-11-06 | patch | M3: a glass's light angle bound to a number past ±180 turns round to the same direction (270 is -90), as the angle drawn from it does, instead of stopping at 180. Tests: `effects_tests::a_bound_light_angle_turns_round_instead_of_stopping`. Grade unchanged. | From 35ac3a92d582fd320e7155f51b738e48253077de Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 20:56:31 -0500 Subject: [PATCH 018/239] Menus: a submenu opens as soon as its row is hovered, as measured in Figma Figma's main menu opens a submenu on the first frame its row is hovered (median 11 ms) and switches between rows in about 13 ms; FigCraft waited 0.15 s. The hover delay is now zero (the constant stays, so the pending-row bookkeeping the aim uses is untouched); the safe-triangle aim stays until the maintainer decides, since Figma has none. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 measured and wrote at medium --- crates/ui-egui/src/menu_aim_tests.rs | 22 +++++++++------------- crates/ui-egui/src/menus/tree.rs | 10 ++++++---- docs/ui-parity.md | 3 ++- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/crates/ui-egui/src/menu_aim_tests.rs b/crates/ui-egui/src/menu_aim_tests.rs index 6f7c4b8af..9310149af 100644 --- a/crates/ui-egui/src/menu_aim_tests.rs +++ b/crates/ui-egui/src/menu_aim_tests.rs @@ -1,7 +1,7 @@ //! Which submenu the main and context menus show, driven through egui headless: a closed menu //! reopens with no submenu open (also one level down), hovering another row closes the open -//! submenu at once while a submenu opens only once the pointer stays on its row a moment -//! (sweeping across rows doesn't flash each one), and on the way from a +//! submenu at once and a submenu opens on the first frame its row is hovered (as Figma's does), +//! and on the way from a //! submenu's row to its submenu the rows the pointer crosses don't take over (the safe triangle), //! unless it rests on one or turns away. @@ -214,7 +214,7 @@ fn resting_on_a_crossed_row_hands_over_to_it() { } #[test] -fn moving_straight_down_switches_after_a_short_hover() { +fn moving_straight_down_switches_at_once() { let mut u = Ui::new(); u.open_main_menu(); let file = u.top_row(0); @@ -227,24 +227,21 @@ fn moving_straight_down_switches_after_a_short_hover() { p.y = (p.y + 4.0).min(edit.y); u.hover(p); } - assert!(u.tops_shown().is_empty(), "File closes at once, Edit waits: {:?}", u.tops_shown()); - u.wait(HOVER_DELAY + 0.05); - assert_eq!(u.tops_shown(), ["Edit"]); + u.frame(vec![]); + assert_eq!(u.tops_shown(), ["Edit"], "File closes at once, Edit opens on its first frame"); } #[test] -fn the_first_submenu_opens_after_a_short_hover() { +fn the_first_submenu_opens_on_the_next_frame() { let mut u = Ui::new(); u.open_main_menu(); u.hover(u.top_row(0).center()); u.frame(vec![]); - assert!(u.tops_shown().is_empty(), "opened at once"); - u.wait(HOVER_DELAY + 0.05); - assert_eq!(u.tops_shown(), ["File"]); + assert_eq!(u.tops_shown(), ["File"], "Figma opens it on the first frame (median 11 ms)"); } #[test] -fn sweeping_across_rows_opens_only_where_the_pointer_stops() { +fn sweeping_across_rows_shows_only_the_row_under_the_pointer() { let mut u = Ui::new(); u.open_main_menu(); u.settle(u.top_row(0).center()); @@ -254,9 +251,8 @@ fn sweeping_across_rows_opens_only_where_the_pointer_stops() { u.hover(pos2(r.min.x + 20.0, r.center().y)); // (A panel drawn above the row the pointer is on goes the next frame.) u.frame(vec![]); - assert!(u.tops_shown().is_empty(), "{:?} open on row {i}", u.tops_shown()); + assert_eq!(u.tops_shown().len(), 1, "{:?} open on row {i}", u.tops_shown()); } - u.wait(HOVER_DELAY + 0.05); assert_eq!(u.tops_shown(), ["Arrange"]); } diff --git a/crates/ui-egui/src/menus/tree.rs b/crates/ui-egui/src/menus/tree.rs index f0c645509..baa60b82f 100644 --- a/crates/ui-egui/src/menus/tree.rs +++ b/crates/ui-egui/src/menus/tree.rs @@ -11,8 +11,8 @@ pub(crate) fn submenu(ui: &mut Ui, key: &str, label: &str, t: &Tokens, add: i // Which submenu is open: hover intent with a safe triangle. // // Every menu tree (the main menu, the context menu) keeps, per level, which of its submenus is -// open. Hovering another row closes the open submenu at once; resting on a submenu row for -// `HOVER_DELAY` opens it (sweeping across rows doesn't flash every submenu on the way). Except while the +// open. Hovering a row closes the open submenu at once and opens the row's own submenu on the +// same frame (as Figma's main menu does, measured; `HOVER_DELAY` is zero). Except while the // pointer is on its way from the open submenu's row to the submenu: while each move lands inside // the triangle between where it was and the submenu's near edge (it keeps getting nearer), rows // it crosses don't take over and the submenu's row stays highlighted. Resting (`AIM_REST`) or @@ -20,8 +20,10 @@ pub(crate) fn submenu(ui: &mut Ui, key: &str, label: &str, t: &Tokens, add: i // last submenu open. // Closing a menu tree forgets all of it, so it reopens with no submenu open. -/// How long the pointer stays on a submenu row before its submenu opens. -pub(crate) const HOVER_DELAY: f64 = 0.15; +/// How long the pointer stays on a submenu row before its submenu opens. None: Figma's main menu +/// opens it on the first frame (median 11 ms measured), so the delay is zero; kept as a constant so +/// the pending-row bookkeeping the aim relies on stays as it was. +pub(crate) const HOVER_DELAY: f64 = 0.0; /// How long the pointer may rest inside the safe triangle before the row under it takes over. pub(crate) const AIM_REST: f64 = 0.3; diff --git a/docs/ui-parity.md b/docs/ui-parity.md index aa0ef25bd..8127b4d56 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -25,7 +25,7 @@ interaction feel not yet compared. | 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 | | Context menus | done | canvas and layers; submenus as in the main menu below, and a right-click in a new spot starts a fresh menu (Select layer closed); Shift+F10 or the keyboard's Menu key opens them from the keyboard (at the focused layer row or below the canvas selection) and the menu takes the keyboard (`layers_keyboard_tests`) | | Home screen: Recents, Online and Templates | done (ours) | The sidebar switches between the three (`ui.set {homeSection}`). Online: your online files (see the collaboration checklist). Recents: new file, open, join with a code, open files, recent files (cards with the picture each file carries on its page colour, the file's icon, name and "Edited ... ago" or "File not found", full path on hover; or a Name, Last modified and Created table with sortable headers; sorted by name, creation or last change either way; grid or list and the sort kept in the preferences, `ui.set {homeRecentsView, homeRecentsSort, homeRecentsOrder}`; a click selects, a double-click or Enter opens, arrow keys move the selection; Open, Show in folder and Remove from recents on right-click), a Getting started card (six tips with their shortcuts from the keymap; its close button is remembered in the preferences and Help ▸ Getting started brings it back) and, while there are no recent files, four templates to start from. Templates: the eight starter templates as cards (thumbnail rendered from the document, cached per theme; name, description, kind and size), a search field and a kind filter, an empty state; Tab reaches every card and Enter opens it; cards and tabs are named for screen readers. A first run opens here. No Community files or drafts folder | -| Main menu from the logo | done | generated from `catalog.rs`; popups sized to content. Submenus open after 0.15 s on their row (a click or the keyboard opens one at once) and close at once when another row is hovered; while the pointer heads for an open submenu inside the triangle to its near edge, the rows it crosses don't take over, and resting 0.3 s on one hands over; closing the menu, however it closes, clears which submenus were open, so it reopens with none (`menu_aim_tests`, 10 tests; timings tuned by feel, not measured against Figma). Menu and palette items that need a value ask for it first: Create link, Offset path and Move to page in a dialog of the shared controls, the language, user name, server and nudge items in Preferences, Open recent on the home screen's Recents; File ▸ Rename edits the file name in place | +| Main menu from the logo | done | generated from `catalog.rs`; popups sized to content. Submenus open on the first frame their row is hovered (a click or the keyboard opens one at once; Figma's main menu measured 2026-11-07 with synthetic pointer events: median 11 ms to open, 13 ms to switch rows) and close at once when another row is hovered; while the pointer heads for an open submenu inside the triangle to its near edge, the rows it crosses don't take over, and resting 0.3 s on one hands over; closing the menu, however it closes, clears which submenus were open, so it reopens with none (`menu_aim_tests`, 10 tests; the open delay is measured; the safe triangle and its 0.3 s rest are still tuned by feel, and Figma's main menu showed no triangle at all in that measurement, so the aim is kept pending the maintainer's decision). Menu and palette items that need a value ask for it first: Create link, Offset path and Move to page in a dialog of the shared controls, the language, user name, server and nudge items in Preferences, Open recent on the home screen's Recents; File ▸ Rename edits the file name in place | | Keyboard shortcuts panel | done | closes when the home screen shows (#548); docked, tabbed by group like the documentation, searchable, per-platform keycaps; held keys, gestures and presentation keys listed beside the bindings; a label too long for its column ends with "…" and shows in full on hover | | Several windows | partial | File ▸ New window, Open in new window on a tab, a tab dragged off the strip; screen-reader tree in the main window only; positions not restored | | Multiplayer avatars, Share button | missing | waits for multiplayer | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-07 | patch | Main menu: a submenu opens on the first frame its row is hovered instead of after 0.15 s (Figma's main menu measured with synthetic pointer events and 1 ms polling: median 11 ms to open, 13 ms to switch rows, no hover delay); the safe-triangle aim is unchanged, though the same measurement saw no aim logic in Figma, left for the maintainer to decide | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 136ca4cda71018a81817672d49dd85ca87034f70 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 21:13:39 -0500 Subject: [PATCH 019/239] M4: a wrap style per paragraph and in text styles, overriding the layer's (#1827) "You can apply a wrap style at three levels: Text layer, Paragraph, Text style". The layer level was done in #1871; this adds the other two, following the per-paragraph text direction (#1830) and the list style in text styles (#1876). ParaList::wrap (None follows the layer) with para_wrap_style, set_wrap_style (the layer level, clears overrides), set_para_wrap_styles and common_wrap_style; restyle_breaks takes a style per paragraph; ParagraphStyle::wrap_style; text.wrapStyle and node.set wrapStyle with start/end; inspect lineWrapStyles; CSS text-wrap only when the paragraphs agree; the Wrap style control follows the paragraph; a read-only row in the style editor. The .fig mapping is left for a later change. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 briefed; Sonnet 5.5 wrote at medium --- crates/doc/src/text.rs | 66 ++++++++++++++++++- crates/engine/src/automation/inspect.rs | 11 +++- crates/engine/src/cmd/props.rs | 11 +++- crates/engine/src/cmd/styles.rs | 12 ++-- crates/engine/src/cmd/text.rs | 13 +++- crates/engine/src/dev/codegen/css.rs | 10 +-- crates/engine/src/styles_behaviour_tests.rs | 45 +++++++++++++ crates/engine/src/text_behaviour_tests.rs | 46 +++++++++++++ crates/format/src/rest/text.rs | 1 + crates/text/src/layout.rs | 8 +-- .../ui-egui/src/panels/typography/fields.rs | 11 +++- crates/ui-egui/src/widgets/style_picker.rs | 7 +- docs/components-parity.md | 3 +- docs/mcp.md | 14 ++-- docs/ui-parity.md | 5 +- 15 files changed, 234 insertions(+), 29 deletions(-) diff --git a/crates/doc/src/text.rs b/crates/doc/src/text.rs index b9587293e..9ba29e5a0 100644 --- a/crates/doc/src/text.rs +++ b/crates/doc/src/text.rs @@ -293,6 +293,10 @@ pub struct ParaList { /// The paragraph's base direction (Text ▸ Text direction); `Auto` follows its letters. #[serde(skip_serializing_if = "crate::node::is_default")] pub direction: TextDirection, + /// The paragraph's own wrap style ("You can apply a wrap style at three levels: Text layer, + /// Paragraph, Text style"); `None` follows the layer's [`TextData::wrap_style`]. + #[serde(skip_serializing_if = "Option::is_none")] + pub wrap: Option, } /// Character style. In runs, every field is an override; `None` means "inherit the base". @@ -337,6 +341,9 @@ pub struct ParagraphStyle { pub paragraph_indent: f64, #[serde(skip_serializing_if = "crate::node::is_default")] pub list: ListStyle, + /// The wrap style (Auto asks nothing). + #[serde(skip_serializing_if = "crate::node::is_default")] + pub wrap_style: WrapStyle, #[serde(skip_serializing_if = "crate::node::is_default")] pub features: std::collections::BTreeMap, } @@ -838,6 +845,33 @@ impl TextData { self.paragraphs.get(p).copied().unwrap_or(ParaList { list: self.list, ..ParaList::default() }) } + /// Paragraph `p`'s wrap style: its own, else the layer's. + pub fn para_wrap_style(&self, p: usize) -> WrapStyle { + self.paragraphs.get(p).and_then(|pl| pl.wrap).unwrap_or(self.wrap_style) + } + + /// The layer level: every paragraph takes wrap style `w` (their own overrides go). + pub fn set_wrap_style(&mut self, w: WrapStyle) { + self.wrap_style = w; + // Every paragraph by index: `para_span` leaves out an empty one after a final newline. + let last = self.paragraph_count() - 1; + self.set_para_lists_between(0, last, false, |pl| pl.wrap = None); + } + + /// The paragraph level: the paragraphs chars `start..end` touch take wrap style `w`; one equal + /// to the layer's is no override. + pub fn set_para_wrap_styles(&mut self, start: usize, end: usize, w: WrapStyle) { + let layer = self.wrap_style; + self.set_para_lists(start, end, |pl| pl.wrap = (w != layer).then_some(w)); + } + + /// The effective wrap style the paragraphs chars `start..end` touch share, or None when they differ. + pub fn common_wrap_style(&self, start: usize, end: usize) -> Option { + let (a, b) = self.para_span(start, end); + let first = self.para_wrap_style(a); + (a..=b).all(|p| self.para_wrap_style(p) == first).then_some(first) + } + /// Spell out every paragraph's list settings in `paragraphs` (and drop extra entries). fn fill_paragraphs(&mut self) { let n = self.paragraph_count(); @@ -911,7 +945,14 @@ impl TextData { Some(first) if self.paragraphs.iter().all(|p| p.list == first.list) => first.list, _ => self.list, }; - ParagraphStyle { paragraph_spacing: self.paragraph_spacing, paragraph_indent: self.paragraph_indent, list, features: self.features.clone() } + let wrap_style = self.common_wrap_style(0, self.char_count()).unwrap_or(self.wrap_style); + ParagraphStyle { + paragraph_spacing: self.paragraph_spacing, + paragraph_indent: self.paragraph_indent, + list, + wrap_style, + features: self.features.clone(), + } } /// Take what text style `ps` sets at the paragraph and layer level: the spacing, indent and @@ -923,6 +964,7 @@ impl TextData { // Every paragraph by index: `para_span` leaves out an empty one after a final newline. let last = self.paragraph_count() - 1; self.set_para_lists_between(0, last, false, |pl| pl.list = ps.list); + self.set_wrap_style(ps.wrap_style); } /// As [`take_paragraph_style`](Self::take_paragraph_style), with the list style going to the @@ -933,6 +975,7 @@ impl TextData { self.paragraph_indent = ps.paragraph_indent; self.features.clone_from(&ps.features); self.set_para_lists(start, end, |pl| pl.list = ps.list); + self.set_para_wrap_styles(start, end, ps.wrap_style); } /// Follow text style `id`'s paragraph-level definition wherever chars link to it. @@ -951,6 +994,7 @@ impl TextData { && self.paragraph_indent == ps.paragraph_indent && self.features == ps.features && self.common_para_list(start, end).is_some_and(|pl| pl.list == ps.list) + && self.common_wrap_style(start, end) == Some(ps.wrap_style) } /// Whether the whole text shows what text style `ps` sets at the paragraph and layer level. @@ -1104,6 +1148,26 @@ mod case_tests { t.set_para_lists(0, 0, |p| p.list = P); assert_eq!(t.para_list(0), ParaList::default()); } + + #[test] + fn wrap_style_per_paragraph_loads_from_old_files_and_folds() { + use WrapStyle::{Auto, Balance, Pretty}; + let old = r#"{"list":"numbered","indent":1}"#; + assert_eq!(serde_json::from_str::(old).unwrap().wrap, None); + let mut t = TextData::new("a\nb"); + let key = t.layout_key(); + t.set_para_wrap_styles(0, 0, Balance); + assert_eq!((t.para_wrap_style(0), t.para_wrap_style(1)), (Balance, Auto)); + assert_ne!(t.layout_key(), key); + let back: TextData = serde_json::from_str(&serde_json::to_string(&t).unwrap()).unwrap(); + assert_eq!(back, t); + t.set_para_wrap_styles(0, 0, Auto); + assert!(t.paragraphs.is_empty()); + t.set_para_wrap_styles(0, 0, Balance); + t.set_wrap_style(Pretty); + assert!(t.paragraphs.is_empty()); + assert_eq!((t.para_wrap_style(0), t.para_wrap_style(1)), (Pretty, Pretty)); + } } #[cfg(test)] diff --git a/crates/engine/src/automation/inspect.rs b/crates/engine/src/automation/inspect.rs index 324635071..133aa8fab 100644 --- a/crates/engine/src/automation/inspect.rs +++ b/crates/engine/src/automation/inspect.rs @@ -57,6 +57,7 @@ pub const NODE_KEYS: &[&str] = &[ "lineHeight", "lineIndentations", "lineTypes", + "lineWrapStyles", "listSpacing", "listStartOffsets", "listStyle", @@ -455,8 +456,14 @@ fn text_props(t: &TextData, o: &mut serde_json::Map, options: &In if t.leading_trim != figcraft_doc::LeadingTrim::None { insert_prop(o, options, "leadingTrim", || json!(t.leading_trim)); } - if t.wrap_style != figcraft_doc::WrapStyle::Auto { - insert_prop(o, options, "wrapStyle", || json!(t.wrap_style)); + // The paragraphs' effective wrap styles: one for the layer when they agree, else each one's. + let wraps: Vec = (0..t.paragraph_count()).map(|p| t.para_wrap_style(p)).collect(); + if let Some(first) = wraps.first().copied().filter(|w| *w != figcraft_doc::WrapStyle::Auto) + && wraps.iter().all(|w| *w == first) + { + insert_prop(o, options, "wrapStyle", || json!(first)); + } else if wraps.iter().any(|w| *w != figcraft_doc::WrapStyle::Auto) { + insert_prop(o, options, "lineWrapStyles", || wraps.iter().map(|w| json!(w)).collect()); } if !t.runs.is_empty() { insert_prop(o, options, "styledRuns", || serde_json::to_value(&t.runs).unwrap_or(Value::Null)); diff --git a/crates/engine/src/cmd/props.rs b/crates/engine/src/cmd/props.rs index 2e5da37bd..a43ae67cc 100644 --- a/crates/engine/src/cmd/props.rs +++ b/crates/engine/src/cmd/props.rs @@ -29,7 +29,7 @@ fontSize, lineHeight (auto|px|\"150%\"), letterSpacing (px|\"2%\"), textAlign (l (auto|px|\"10%\" of the font size; the offset runs from the baseline down to an underline's top edge), textDecorationSkipInk (underlines break around descenders), \ textDecorationColor (colour, or auto/null: the text's), textCase (original|upper|lower|title|smallCaps), paragraphSpacing, paragraphIndent, \ listStyle (none|bulleted|numbered; with start/end: the paragraphs those chars touch), indentation (list nesting level 0-8, same range rule), \ -listSpacing (px between list items, in place of paragraphSpacing), hangingPunctuation, hangingList (markers outside the box), leadingTrim (vertical trim: none|capHeight), maxLines, features ({tag: bool}, e.g. {\"liga\": false, \"tnum\": true}), \ +listSpacing (px between list items, in place of paragraphSpacing), wrapStyle (auto|balance|pretty; with start/end: the paragraphs those chars touch), hangingPunctuation, hangingList (markers outside the box), leadingTrim (vertical trim: none|capHeight), maxLines, features ({tag: bool}, e.g. {\"liga\": false, \"tnum\": true}), \ fontVariations / variationSettings ({axis: number}, e.g. {\"wght\": 550, \"wdth\": 85}; null = none), \ path (a vector's SVG path data: replaces its geometry, keeping the layer, its paints, styles and bindings; width/height in the same call scale it as \ node.create does; its own box goes at the layer's x/y, or with x/y given, at x + its left edge and y + its top as node.create places it), pointCount, innerRadius, arcStart, arcSweep, \ @@ -1008,7 +1008,14 @@ 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"))?, "wrapStyle" | "textWrap" => { - text_mut(cmd, doc.get_mut(id)?)?.wrap_style = enum_of(v).ok_or_else(|| bad(cmd, "wrapStyle: auto|balance|pretty"))? + let w: figcraft_doc::WrapStyle = enum_of(v).ok_or_else(|| bad(cmd, "wrapStyle: auto|balance|pretty"))?; + let t = text_mut(cmd, doc.get_mut(id)?)?; + if props.contains_key("start") || props.contains_key("end") { + let (start, end) = range_of(props, t.char_count()); + t.set_para_wrap_styles(start, end, w); + } else { + t.set_wrap_style(w); + } } "maxLines" => { let lines = f64_of(v).unwrap_or(0.0).clamp(0.0, 10_000.0) as u32; diff --git a/crates/engine/src/cmd/styles.rs b/crates/engine/src/cmd/styles.rs index 9ba420c43..419df8e23 100644 --- a/crates/engine/src/cmd/styles.rs +++ b/crates/engine/src/cmd/styles.rs @@ -275,6 +275,9 @@ fn paragraph_style_json(cmd: &str, v: &Value) -> Result { "paragraphSpacing" | "paragraph_spacing" => ps.paragraph_spacing = length(k, x)?, "paragraphIndent" | "paragraph_indent" => ps.paragraph_indent = length(k, x)?, "listStyle" | "list" => ps.list = super::props::enum_of(x).ok_or_else(|| bad(cmd, "listStyle: none|bulleted|numbered"))?, + "wrapStyle" | "textWrap" | "wrap_style" => { + ps.wrap_style = super::props::enum_of(x).ok_or_else(|| bad(cmd, "wrapStyle: auto|balance|pretty"))?; + } "features" | "openTypeFeatures" | "fontFeatures" | "textFeatures" => { ps.features = super::props::features_of(cmd, x)?.into_iter().filter_map(|(tag, on)| Some((tag, on?))).collect(); } @@ -289,10 +292,11 @@ fn paragraph_style_json(cmd: &str, v: &Value) -> Result { fn paragraph_style_of(n: &Node, range: Option<(usize, usize)>) -> Option { let t = n.kind.text()?; let mut ps = t.paragraph_style(); - if let Some((a, b)) = range - && let Some(pl) = t.common_para_list(a, b) - { - ps.list = pl.list; + if let Some((a, b)) = range { + if let Some(pl) = t.common_para_list(a, b) { + ps.list = pl.list; + } + ps.wrap_style = t.common_wrap_style(a, b).unwrap_or(t.wrap_style); } Some(ps) } diff --git a/crates/engine/src/cmd/text.rs b/crates/engine/src/cmd/text.rs index 5bc191d7c..c865924c5 100644 --- a/crates/engine/src/cmd/text.rs +++ b/crates/engine/src/cmd/text.rs @@ -98,6 +98,15 @@ fn set_direction(s: &mut Session, p: &Value, d: TextDirection) -> Result para_range(s, p, |t, a, b| t.set_para_lists(a, b, |pl| pl.direction = d)) } +/// The wrap style of the targeted texts: the edited paragraphs while editing (the paragraph +/// level), else the whole layer (the layer level: every paragraph, overrides included). +fn set_wrap_style(s: &mut Session, p: &Value, w: figcraft_doc::WrapStyle) -> Result { + match textedit::selected_range(s) { + Some((_, a, b)) => para(s, p, |t| t.set_para_wrap_styles(a, b, w)), + None => para(s, p, |t| t.set_wrap_style(w)), + } +} + /// Whether every targeted char has `pred` (to decide toggle direction). fn all_have(s: &Session, p: &Value, pred: impl Fn(&TextStyle) -> bool) -> bool { let Ok(doc) = s.doc() else { return false }; @@ -445,12 +454,12 @@ pub fn specs() -> Vec { spec!( "text.wrapStyle", "Wrap style", - "{style: auto|balance|pretty, ids?} where lines break when the text wraps: Auto fits as many words as fit on each line, Balance makes the lines close to the same length, Pretty keeps lines full but leaves no one word alone on the last", + "{style: auto|balance|pretty, ids?} where lines break when the text wraps (while editing: the selected paragraphs; else the whole layer): Auto fits as many words as fit on each line, Balance makes the lines close to the same length, Pretty keeps lines full but leaves no one word alone on the last", true, |s, p| { let w: figcraft_doc::WrapStyle = get(p, "style").and_then(super::props::enum_of).ok_or_else(|| bad("text.wrapStyle", "`style`: auto|balance|pretty"))?; - para(s, p, |t| t.wrap_style = w) + set_wrap_style(s, p, w) } ), spec!( diff --git a/crates/engine/src/dev/codegen/css.rs b/crates/engine/src/dev/codegen/css.rs index d521674e9..46f579123 100644 --- a/crates/engine/src/dev/codegen/css.rs +++ b/crates/engine/src/dev/codegen/css.rs @@ -302,10 +302,12 @@ fn text_decls(doc: &Document, n: &Node, tx: &figcraft_doc::TextData, t: &mut Tok TextAlignH::Right => put("text-align", "right".into()), TextAlignH::Justified => put("text-align", "justify".into()), } - match tx.wrap_style { - figcraft_doc::WrapStyle::Auto => {} - figcraft_doc::WrapStyle::Balance => put("text-wrap", "balance".into()), - figcraft_doc::WrapStyle::Pretty => put("text-wrap", "pretty".into()), + // CSS has one `text-wrap` per element: written when every paragraph has the same one. + let wrap = (0..tx.paragraph_count()).map(|p| tx.para_wrap_style(p)).collect::>(); + match wrap.first().copied().filter(|w| wrap.iter().all(|x| x == w)) { + Some(figcraft_doc::WrapStyle::Balance) => put("text-wrap", "balance".into()), + Some(figcraft_doc::WrapStyle::Pretty) => put("text-wrap", "pretty".into()), + _ => {} } // A base direction forced on every paragraph (CSS has one per element). let dir = tx.paragraphs.first().map(|p| p.direction).filter(|d| tx.paragraphs.iter().all(|p| p.direction == *d)); diff --git a/crates/engine/src/styles_behaviour_tests.rs b/crates/engine/src/styles_behaviour_tests.rs index 73fe1edef..0dd38d76f 100644 --- a/crates/engine/src/styles_behaviour_tests.rs +++ b/crates/engine/src/styles_behaviour_tests.rs @@ -418,6 +418,51 @@ fn text_styles_carry_paragraph_spacing_indent_lists_and_features() { assert!(s.execute("style.create", &json!({"type": "text", "name": "Bad", "value": {"paragraphSpacing": "wide"}})).is_err()); } +#[test] +fn text_styles_carry_the_wrap_style() { + // Explore text properties: "You can apply a wrap style at three levels: Text layer, + // Paragraph, Text style." A style made from a text takes its wrap style, applying it sets it, + // editing it on a styled text unlinks it. + use figcraft_doc::WrapStyle::{Auto, Balance, Pretty}; + let mut s = Session::new(); + let td = |s: &Session, n: NodeId| -> TextData { node(s, n).kind.text().unwrap().clone() }; + let t = text(&mut s, 0.0); + run(&mut s, "node.set", json!({"id": t, "props": {"characters": "One\nTwo", "wrapStyle": "balance"}})); + let st = sid(run(&mut s, "style.create", json!({"type": "text", "name": "Even", "from": t}))); + let listed = run(&mut s, "style.list", json!({"type": "text"})); + let even = listed.as_array().unwrap().iter().find(|x| x["id"] == json!(st)).unwrap(); + assert_eq!(even["paragraph"]["wrap_style"], json!("balance"), "{even}"); + // Applying it sets the layer's wrap style, with no paragraph overrides, and links the layer. + let t2 = text(&mut s, 300.0); + run(&mut s, "node.set", json!({"id": t2, "props": {"characters": "A\nB"}})); + run(&mut s, "style.apply", json!({"ids": [t2], "style": st})); + let d = td(&s, t2); + assert_eq!(d.wrap_style, Balance); + assert!(d.paragraphs.iter().all(|p| p.wrap.is_none()), "{:?}", d.paragraphs); + assert_eq!(node(&s, t2).styles.text.as_deref(), Some(st.as_str())); + // Redefining the style moves the layer and keeps the link. + run(&mut s, "style.update", json!({"style": st, "value": {"wrapStyle": "pretty"}})); + let d = td(&s, t2); + assert_eq!((d.para_wrap_style(0), d.para_wrap_style(1)), (Pretty, Pretty)); + assert_eq!(node(&s, t2).styles.text.as_deref(), Some(st.as_str()), "still linked after the update"); + // Editing the wrap style on the styled text unlinks it. + run(&mut s, "node.set", json!({"id": t2, "props": {"wrapStyle": "auto"}})); + assert_eq!(td(&s, t2).wrap_style, Auto); + assert_eq!(node(&s, t2).styles.text, None, "wrap style edited: unlinked"); + // On a range, the paragraphs touched take it as their own and the layer keeps its style. + let t3 = text(&mut s, 600.0); + run(&mut s, "node.set", json!({"id": t3, "props": {"characters": "A\nB"}})); + run(&mut s, "style.apply", json!({"ids": [t3], "style": st, "start": 0, "end": 1})); + let d = td(&s, t3); + assert_eq!((d.wrap_style, d.para_wrap_style(0), d.para_wrap_style(1)), (Auto, Pretty, Auto)); + // A definition given as a value takes the node.set spellings; junk is refused. + let st2 = sid(run(&mut s, "style.create", json!({"type": "text", "name": "Note", "value": {"wrapStyle": "balance"}}))); + let want = ParagraphStyle { wrap_style: Balance, ..Default::default() }; + assert!(matches!(&s.doc().unwrap().style(&st2).unwrap().kind, StyleKind::Text { paragraph, .. } if **paragraph == want)); + assert!(s.execute("style.create", &json!({"type": "text", "name": "Bad", "value": {"wrapStyle": "zigzag"}})).is_err()); + assert!(s.execute("style.create", &json!({"type": "text", "name": "Bad", "value": {"textWrap": 3}})).is_err()); +} + #[test] fn styles_are_organised_by_slash_names_order_and_duplicates() { // Documented: "/" in a name groups styles in folders; moving a style to another folder renames diff --git a/crates/engine/src/text_behaviour_tests.rs b/crates/engine/src/text_behaviour_tests.rs index f41ad28f3..779002dc1 100644 --- a/crates/engine/src/text_behaviour_tests.rs +++ b/crates/engine/src/text_behaviour_tests.rs @@ -495,6 +495,52 @@ fn balance_and_pretty_wrap_styles_break_lines_as_documented() { assert_eq!(lines(&s), [(0, 9), (9, 16), (16, 21)]); } +#[test] +fn wrap_style_per_paragraph_overrides_the_layers() { + // Explore text properties: "You can apply a wrap style at three levels: Text layer, + // Paragraph, Text style." A paragraph's own wrap style beats the layer's; setting the layer + // sets every paragraph again. + let font = test_mono_font(); + let mut s = Session::new(); + let t = text(&mut s, "aaa bbb ccc ddd eee\naaa bbb ccc ddd eee", json!({"fontFamily": font, "fontSize": 16, "lineHeight": 24})); + s.execute("node.set", &json!({"id": t, "props": {"textAutoResize": "height", "width": 136}})).unwrap(); + let lines = |s: &Session| -> Vec<(usize, usize)> { + let (l, _) = figcraft_text::layout_node(s.doc().unwrap().node(t).unwrap()).unwrap(); + l.lines.iter().map(|l| (l.char_start, l.char_end)).collect() + }; + let inspect = |s: &Session| crate::inspect::node_json(s.doc().unwrap(), t, 0); + let css = |s: &mut Session| s.execute("inspect.code", &json!({"id": t})).unwrap()["code"].as_str().unwrap().to_string(); + let paragraphs = |s: &Session| s.doc().unwrap().node(t).unwrap().kind.text().unwrap().paragraphs.clone(); + assert_eq!(lines(&s), [(0, 16), (16, 20), (20, 36), (36, 39)], "Auto: four words and one in each paragraph"); + // The second paragraph alone, by a range on node.set. + s.execute("node.set", &json!({"id": t, "props": {"wrapStyle": "balance", "start": 20, "end": 20}})).unwrap(); + assert_eq!(lines(&s), [(0, 16), (16, 20), (20, 32), (32, 39)]); + assert_eq!(inspect(&s)["lineWrapStyles"], json!(["auto", "balance"])); + assert!(inspect(&s).get("wrapStyle").is_none()); + assert!(!css(&mut s).contains("text-wrap"), "{}", css(&mut s)); + // While editing, the caret's paragraph (the Wrap style control). + s.execute("text.edit.begin", &json!({"id": t, "caret": 0})).unwrap(); + s.execute("text.wrapStyle", &json!({"style": "pretty"})).unwrap(); + s.execute("text.edit.end", &json!({})).unwrap(); + assert_eq!(lines(&s), [(0, 12), (12, 20), (20, 32), (32, 39)]); + assert_eq!(inspect(&s)["lineWrapStyles"], json!(["pretty", "balance"])); + // Undo restores the paragraph's override. + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(lines(&s), [(0, 16), (16, 20), (20, 32), (32, 39)]); + assert_eq!(inspect(&s)["lineWrapStyles"], json!(["auto", "balance"])); + // Enter inside the balanced paragraph carries the style to the new paragraph. + s.execute("text.edit.begin", &json!({"id": t, "caret": 22})).unwrap(); + s.execute("text.edit.insert", &json!({"text": "\n"})).unwrap(); + s.execute("text.edit.end", &json!({})).unwrap(); + assert_eq!(inspect(&s)["lineWrapStyles"], json!(["auto", "balance", "balance"])); + // The layer level sets every paragraph and folds the overrides away. + s.execute("node.set", &json!({"id": t, "props": {"wrapStyle": "balance"}})).unwrap(); + assert!(paragraphs(&s).iter().all(|p| p.wrap.is_none()), "{:?}", paragraphs(&s)); + assert_eq!(inspect(&s)["wrapStyle"], json!("balance")); + assert!(css(&mut s).contains("text-wrap: balance;"), "{}", css(&mut s)); + assert!(s.execute("node.set", &json!({"id": t, "props": {"wrapStyle": "zigzag", "start": 0, "end": 0}})).is_err()); +} + #[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 diff --git a/crates/format/src/rest/text.rs b/crates/format/src/rest/text.rs index 391fa4e1c..f53eb0684 100644 --- a/crates/format/src/rest/text.rs +++ b/crates/format/src/rest/text.rs @@ -278,6 +278,7 @@ fn lists(v: &Value, td: &mut TextData) { Some("RTL") => TextDirection::Rtl, _ => TextDirection::Auto, }, + wrap: None, }) .collect(); // Clamp the levels and fold one style for all back into the layer's list style. diff --git a/crates/text/src/layout.rs b/crates/text/src/layout.rs index 1a5719a9e..a003deb42 100644 --- a/crates/text/src/layout.rs +++ b/crates/text/src/layout.rs @@ -869,7 +869,7 @@ fn line_width(items: &[Item], (start, end, _, _): LineRange) -> f64 { /// to give a word to the lines after it ("keeps each line full, but adjusts the last four lines to /// avoid an orphan"). `rebreak` lays the text out again with a width per paragraph and line. fn restyle_breaks( - style: WrapStyle, + style_of: &dyn Fn(usize) -> WrapStyle, w: f64, lines: Vec, items: &[Item], @@ -905,7 +905,7 @@ fn restyle_breaks( } // Words wider than the box break where they must; the re-breaking adds no such break. let base = emergency_breaks(items, word_breaks, ¶); - match style { + match style_of(p) { WrapStyle::Auto => {} WrapStyle::Balance => { // The narrowest width that still gives `n` lines, to half a pixel. @@ -992,8 +992,8 @@ fn wrapped_lines( let lines = from_saved.or_else(|| breaks(&|_, _| wrap, None)).unwrap_or_default(); // Balance and Pretty re-break the paragraphs at narrower widths (never saved breaks). match wrap { - Some(w) if !followed && text.wrap_style != WrapStyle::Auto => { - restyle_breaks(text.wrap_style, w, lines, items, word_breaks, line_indent_of, hung_of, &|wrap_of| { + Some(w) if !followed && (0..text.paragraph_count()).any(|p| text.para_wrap_style(p) != WrapStyle::Auto) => { + restyle_breaks(&|p| text.para_wrap_style(p), w, lines, items, word_breaks, line_indent_of, hung_of, &|wrap_of| { breaks(wrap_of, None).unwrap_or_default() }) } diff --git a/crates/ui-egui/src/panels/typography/fields.rs b/crates/ui-egui/src/panels/typography/fields.rs index c290e9893..3c867e6f9 100644 --- a/crates/ui-egui/src/panels/typography/fields.rs +++ b/crates/ui-egui/src/panels/typography/fields.rs @@ -388,7 +388,14 @@ fn type_settings( } // Where lines break when the text wraps (Explore text properties). caption(ui, tr("Wrap style")); - let wrap = common(doc, ids, |n| n.kind.text().map(|t| t.wrap_style as usize)).flatten(); + // Per paragraph, as the text direction: while editing, the selected paragraphs. + let wrap = common(doc, ids, |n| { + n.kind.text().and_then(|t| { + let (a, b) = range.filter(|r| r.0 == n.id).map_or((0, t.char_count()), |(_, a, b)| (a, b)); + t.common_wrap_style(a, b).map(|w| w as usize) + }) + }) + .flatten(); let items = [ (tr("Auto"), tr_noop("Auto: as many words as fit on each line")), (tr("Balance"), tr_noop("Balance: every line close to the same length")), @@ -396,7 +403,7 @@ fn type_settings( ]; if let Some(i) = text_seg(ui, "wrap", &items, wrap, w) { let style = ["auto", "balance", "pretty"].get(i).copied().unwrap_or("auto"); - app.set_props(ids, json!({"wrapStyle": style})); + app.run("text.wrapStyle", json!({"ids": ids, "style": style})); } // The paragraphs' base direction, once a right-to-left script is in the text or a direction // is forced ("controls are available to override text direction per paragraph", Add diff --git a/crates/ui-egui/src/widgets/style_picker.rs b/crates/ui-egui/src/widgets/style_picker.rs index 7c9254151..1c8650661 100644 --- a/crates/ui-egui/src/widgets/style_picker.rs +++ b/crates/ui-egui/src/widgets/style_picker.rs @@ -11,7 +11,7 @@ use egui::{Align2, Color32, CornerRadius, Id, Rect, Response, Sense, Stroke, Ui, pos2, vec2}; use figcraft_color::{Paint, PaintKind}; use figcraft_doc::{ - Document, GridKind, ListStyle, Node, NodeId, ParagraphStyle, PublishedLibrary, Style, StyleKind, TextStyle, VariableType, trim_num, + Document, GridKind, ListStyle, Node, NodeId, ParagraphStyle, PublishedLibrary, Style, StyleKind, TextStyle, VariableType, WrapStyle, trim_num, }; use figcraft_engine::library; use serde_json::{Value, json}; @@ -999,6 +999,11 @@ fn paragraph_rows(ui: &mut Ui, ps: &ParagraphStyle) { ListStyle::Bulleted => rows.push(tr("Bulleted list").into()), ListStyle::Numbered => rows.push(tr("Numbered list").into()), } + match ps.wrap_style { + WrapStyle::Auto => {} + WrapStyle::Balance => rows.push(format!("{}: {}", tr("Wrap style"), tr("Balance"))), + WrapStyle::Pretty => rows.push(format!("{}: {}", tr("Wrap style"), tr("Pretty"))), + } if !ps.features.is_empty() { rows.push(ps.features.iter().map(|(tag, on)| format!("{}{tag}", if *on { '+' } else { '-' })).collect::>().join(" ")); } diff --git a/docs/components-parity.md b/docs/components-parity.md index d6b1ee5e6..e3cf65a07 100644 --- a/docs/components-parity.md +++ b/docs/components-parity.md @@ -60,7 +60,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Feature | Status | Notes | |---|---|---| -| Paint, text, effect, grid styles; style picker; text styles on character ranges | done | behaviour suite: `styles_behaviour_tests.rs`; a text style carries paragraph spacing and indent, the list style and the OpenType features beside the character properties (`paragraph` next to `style` in `style.list`): applied with it, moved by `style.update`, unlinking when edited, kept by `.fig` files (#1829) | +| Paint, text, effect, grid styles; style picker; text styles on character ranges | done | behaviour suite: `styles_behaviour_tests.rs`; a text style carries paragraph spacing and indent, the list style, the wrap style and the OpenType features beside the character properties (`paragraph` next to `style` in `style.list`): applied with it, moved by `style.update`, unlinking when edited, kept by `.fig` files (#1829) | | Editing a style updates its layers; detach and delete keep values; editing a styled property unlinks that style | done | an edited fill/stroke/effect/grid list or text chars unlink; applying a style replaces variables bound to what it sets; text styles on text layers only | | Organising styles: folders by `/` names, order, duplicate, rename folder, Local styles list | done | `style.move` (into a folder renames), `style.duplicate` (right below), `style.renameFolder`; the page's Local styles list by type and folder (drag to reorder, right-click) | | Variables inside styles (paint, effect, grid and text styles; each user resolves them in its own modes) | done | `style.bind`, `style_vars_tests`; the editor binds paint colours, shadow colours, blur radii, grid sizes and a text style's font, font style, size, line height and letter spacing, the rest through the command | @@ -81,6 +81,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. |---|---|---| | 2026-11-05 | minor | M3, #2002: the Local variables window selects several variables, as the Layers panel selects layers. A click selects one row, Shift+click the range from the anchor through the rows shown, Cmd/Ctrl+click toggles a row, Escape or a click on the empty space below the rows clears; selected rows use the sidebar's selected-row colour. Right-clicking a row that is part of a selection of several offers Delete, Move to group and Scope (all supported properties, hidden from pickers, or only one scope) for the selected local variables, each sent as one `command.batch`, so one undo step; no engine command changed. Renaming and value edits stay single-row. Tests: `variables_select_tests` (headless UI). Grade unchanged | | 2026-11-02 | minor | M3, #1829: text styles carry paragraph spacing and indent, the list style and the OpenType features ("Supported in text styles": "Paragraph spacing and indentation", "Lists", "OpenType features", Create and apply text styles) beside the character properties: `style.create` takes them from the layer (or the selected paragraphs' list) or from a `value` (`paragraphSpacing`, `paragraphIndent`, `listStyle`, `features`), `style.apply` sets them (on a range, the list goes to the paragraphs touched; the rest is the layer's, as in Figma), `style.update` moves them on every linked layer, editing one on a styled text unlinks it as editing its font does, the style editor lists them, and a `.fig` file keeps them with the style (its sample layer). Grade unchanged. | +| 2026-11-07 | minor | M4, #1827: text styles carry the wrap style (`wrapStyle` in a style's `paragraph`): applied with the style (on a range, to the paragraphs touched), moved by `style.update`, unlinking when edited; shown read-only in the style editor | | 2026-11-06 | patch | M3: a glass's light angle bound to a number past ±180 turns round to the same direction (270 is -90), as the angle drawn from it does, instead of stopping at 180. Tests: `effects_tests::a_bound_light_angle_turns_round_instead_of_stopping`. Grade unchanged. | | 2026-11-06 | patch | M3: a layer's effect binding (`variable.bind`, `effects//`) takes only a field its effect has, as an effect style's does: `effects/0/refraction` on a drop shadow, or a binding on an effect the layer doesn't have, is refused instead of being kept and doing nothing (a binding an older file has there still does nothing, and unbinds). Tests: `binding_lists_tests::a_layer_binds_only_fields_its_effects_have`. Grade unchanged. | | 2026-11-06 | minor | M3: Go to main component (context menu, Design panel, Ctrl+Alt+Cmd+K) on an instance of a library component opens the library file, as the help center describes for mains kept in another file ("Edit main components"); it used to refuse. The file opens in a tab, or an open tab comes to the front, on the main's page with the main selected and zoomed to: a nested instance goes to its own main, a variant to that variant. A main deleted from the library file since it was published leaves the file open with a note; a library file that moved, a team library on a server and a path off this computer are refused with a message. Test: `library::tests::going_to_a_library_main_opens_the_library_file`. Numbers unchanged | diff --git a/docs/mcp.md b/docs/mcp.md index aebcbf46d..f19566f3e 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -298,6 +298,11 @@ Or in a project's `.mcp.json`: `textDecorationOffset` (`auto`, px, or `"10%"` of the font size; the offset runs from the baseline down to an underline's top edge), `textDecorationSkipInk` (underlines break around descenders) and `textDecorationColor` (a colour, or `auto` for the text's) are character props too. +- **Wrap style** (`auto`, `balance`, `pretty`) works at three levels: `wrapStyle` on `node.set` + sets the layer (every paragraph); with `start`/`end` it sets the paragraphs those chars touch, + and a paragraph's own style beats the layer's. `text.wrapStyle` sets the selected paragraphs while + text is edited. `get_node` reports one `wrapStyle`, or `lineWrapStyles` per paragraph when they + differ. - **Lists** are per paragraph: `listStyle` (`none`, `bulleted`, `numbered`) and `indentation` (the nesting level, 0–8) apply to the paragraphs chars `start`..`end` touch (all of them without a range); `get_node` reports one `listStyle` for the layer, or `lineTypes` and `lineIndentations` @@ -313,10 +318,11 @@ Or in a project's `.mcp.json`: `style.detach {which: "text", start?, end?}` unlinks them (values stay). A layer's `styles.text` is the style all its chars share (none when they differ); `get_node` lists the linked chars as `textStyleRanges` (`[start, end, style id]`). - A text style also carries paragraph spacing and indent, the list style and the OpenType features - (`paragraph` beside `style` in `style.list`): applying it sets them (on a range, the list goes to - the paragraphs touched; the rest is the layer's), `style.update` moves them too, and a `.fig` - file keeps them with the style. + A text style also carries paragraph spacing and indent, the list style, the wrap style and the + OpenType features (`paragraph` beside `style` in `style.list`; a `value` takes `wrapStyle`): + applying it sets them (on a range, the list and wrap style go to the paragraphs touched; the rest + is the layer's), `style.update` moves them too, and a `.fig` file keeps them with the style + (not the wrap style yet). Changing what a text style sets (font, size, line height, letter spacing, decoration, case, axis values; at the paragraph level the spacing, indent, list and features) on linked chars unlinks them; `style.update` moves every linked char. `style.create {type: "text", name}` takes the diff --git a/docs/ui-parity.md b/docs/ui-parity.md index aa0ef25bd..dd0701596 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; wrap style per paragraph and in text styles (#1827); 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: @@ -96,7 +96,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); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | | 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: wrap style (Auto, Balance, Pretty) | done | per text layer (`wrapStyle` on `node.set`, `text.wrapStyle`, the Type settings control under Vertical trim, inspect, CSS `text-wrap: balance` or `pretty`): Auto breaks greedily; Balance narrows each paragraph as far as it goes without another line, so its lines come out close to the same length (what browsers do for `text-wrap: balance`); Pretty keeps lines full and, when the last line is one word, narrows one of the last four lines just enough to give a word to the lines after it (Explore text properties: "Auto: Figma fits as many words as possible on each line before wrapping to the next", "Balance: Figma distributes text as evenly as possible across every line, so each line is close to the same length", "Pretty: Figma keeps each line full, but adjusts the last four lines to avoid an orphan"). Saved line breaks from a file still win. Not yet included: per-paragraph settings, text-style support and the `.fig` import/export mapping (#1827). Test: `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented` | +| Text: wrap style (Auto, Balance, Pretty) | done | per text layer (`wrapStyle` on `node.set`, `text.wrapStyle`, the Type settings control under Vertical trim, inspect, CSS `text-wrap: balance` or `pretty`): Auto breaks greedily; Balance narrows each paragraph as far as it goes without another line, so its lines come out close to the same length (what browsers do for `text-wrap: balance`); Pretty keeps lines full and, when the last line is one word, narrows one of the last four lines just enough to give a word to the lines after it (Explore text properties: "Auto: Figma fits as many words as possible on each line before wrapping to the next", "Balance: Figma distributes text as evenly as possible across every line, so each line is close to the same length", "Pretty: Figma keeps each line full, but adjusts the last four lines to avoid an orphan"). Saved line breaks from a file still win. At three levels, as "You can apply a wrap style at three levels: Text layer, Paragraph, Text style" says: the paragraph level is the caret's or the selection's paragraphs while editing (`text.wrapStyle`; the control follows them), or `start`/`end` on `node.set wrapStyle` (a paragraph's own style beats the layer's; setting the layer sets every paragraph again; Enter carries it to the new paragraph; inspect reports `lineWrapStyles` when paragraphs differ and CSS `text-wrap` only when they agree); the text-style level is a style's `wrapStyle` (shown read-only in the style editor, applied with the style, moved by `style.update`, unlinking when edited). The `.fig` import/export mapping stays open (#1827). Test: `text_behaviour_tests::wrap_style_per_paragraph_overrides_the_layers`, `styles_behaviour_tests::text_styles_carry_the_wrap_style`, `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented` | | Text: direction override (Text ▸ Text direction) | done | per paragraph (`ParaList::direction`: auto, ltr, rtl): Text ▸ Text direction ▸ Auto / Left to right / Right to left and `text.direction {direction, ids?}` set the edited paragraphs while editing, else every paragraph of the selected texts; `node.set textDirection` the layer's (or the chars `start`/`end` name); the Type settings control appears once a right-to-left script is in the text or a direction is forced; inspect reports `textDirection` when the paragraphs agree and `lineDirections` otherwise; Dev Mode's CSS writes `direction: ltr` or `rtl` when every paragraph is forced the same way (with `text-align: left` beside `rtl`, as Left is absolute on the canvas); `.fig` import and export carry each line's `sourceDirectionality`, read up to the paragraph count. Layout gives the paragraph its base level, so a forced right-to-left paragraph of Latin letters starts at the right, mirrors its list gutter and indent and orders its runs right to left, and a forced left-to-right paragraph of Hebrew the other way ("By default, Figma automatically handles text direction based on language detection. However, controls are available to override text direction per paragraph", "Go to Text > Text direction. Select Left to right or Right to left", Add right-to-left text). Not included: a direction in text styles (the article names none). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests` | | 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`) | @@ -206,6 +206,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | 2026-11-04 | patch | M1, #1852: a press on one of the open gradient's handles or stops on the canvas is the colour picker's own, not a press outside it (Figma keeps the picker and the handles up while a handle or stop is dragged; the stops are made to be dragged: "You can click and drag a stop to change its placement on the gradient", Use gradients as a fill or stroke). The canvas took the press and began the drag, then the picker, drawn later in the same frame, saw a press outside its card and closed, committing the drag's interaction at once; the handles vanished with it and the drag went on without an undo step of its own. Now the picker stays while a gradient handle or stop drags, and the drag is one undo step; a press elsewhere on the canvas still closes it. A handle drag whose button goes up off the canvas (over a panel or the picker) ends there too, instead of waiting, uncommitted, to move the handle to the next press on the canvas. Tests: `colorpicker_selection_tests::dragging_a_gradient_handle_on_the_canvas_keeps_the_picker_open`, `colorpicker_selection_tests::a_gradient_drag_released_off_the_canvas_ends_there`. | | 2026-11-02 | patch | M8, #1875: a click with the Bend tool on a sharp point between two segments gives it handles along the line between its neighbours, a third of the way to each ("Click on a point or path where you want to add a curve", Edit vector layers); a click on a curved point still makes it sharp, a drag still sets the handles by hand, an endpoint is left alone. Between a handle's end and a point both within reach of the pointer, the nearer one on the page is hit (the handle on a tie), so a short path's point (its handles a few pixels long) can be clicked again. Before, only a drag curved a point, and a short one left two tiny handles in its direction. Tests: `vectoredit::tests::short_handles_leave_their_point_clickable`, `vectoredit::tests::a_bend_click_curves_a_sharp_point_between_its_neighbours`, `bend_tool_smooths_and_sharpens_points`. Numbers unchanged. | | 2026-11-02 | minor | M4, #1827: wrap style on a text layer (`WrapStyle`: Auto, Balance, Pretty): Balance re-breaks each paragraph at the narrowest width that keeps its line count (bisection over the greedy breaker, as browsers balance), Pretty narrows one of the last four lines just enough so the last line isn't one word; `text.wrapStyle`, `node.set wrapStyle` (`textWrap` too), inspect `wrapStyle`, Dev Mode CSS `text-wrap` (Tailwind `text-balance` / `text-pretty`), the Type settings control under Vertical trim. Per-paragraph settings, text-style support and the `.fig` import/export mapping stay open. Test: `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented`. | +| 2026-11-07 | minor | M4, #1827: wrap style per paragraph and in text styles, overriding the layer's: `ParaList::wrap` (None follows the layer; Enter carries it, an override equal to the layer's is none), `text.wrapStyle` while editing and `node.set wrapStyle` with `start`/`end` set the paragraphs, without them the layer sets every paragraph; `restyle_breaks` takes a style per paragraph; inspect `lineWrapStyles`, CSS `text-wrap` when the paragraphs agree; `ParagraphStyle::wrap_style` (text styles apply, update and unlink on it); the Wrap style control follows the paragraph; the `.fig` mapping stays open | | 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`. | From f5a52ea528e3e597e753f458d4fde92422b4583c Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 21:20:56 -0500 Subject: [PATCH 020/239] Components: several layers selected, the component button offers Create multiple components (#2088) With two or more layers selected, the Design panel header's component button opens a menu with Create component and Create multiple components, as Figma's does; one layer keeps the plain button. Headless UI tests cover both cases (three frames: menu order, names kept, all selected, one undo; one frame: plain click), and an engine test pins createMultiple's names, positions and single undo step. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- .../engine/src/components_behaviour_tests.rs | 33 +++++ .../ui-egui/src/create_multiple_menu_tests.rs | 115 ++++++++++++++++++ crates/ui-egui/src/lib.rs | 2 + crates/ui-egui/src/panels/right.rs | 13 ++ docs/components-parity.md | 5 +- 5 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 crates/ui-egui/src/create_multiple_menu_tests.rs diff --git a/crates/engine/src/components_behaviour_tests.rs b/crates/engine/src/components_behaviour_tests.rs index 3458b0b22..198151768 100644 --- a/crates/engine/src/components_behaviour_tests.rs +++ b/crates/engine/src/components_behaviour_tests.rs @@ -7,6 +7,7 @@ use serde_json::{Value, json}; use crate::Session; +use crate::automation::params::id_of; use crate::components::tests::{chars, copy_of, ex, fill, healthy, idv, kids, node}; use figcraft_doc::*; @@ -1000,3 +1001,35 @@ fn deleting_a_layer_inside_an_instance_hides_it_instead() { s.execute("edit.delete", &json!({"ids": [k.inst]})).unwrap(); assert!(s.doc().unwrap().node(k.inst).is_none()); } + +/// Create multiple components (#2088): each selected layer becomes its own component in place, +/// keeping its name and position; all stay selected and one undo reverts them all. +#[test] +fn create_multiple_components_keeps_names_and_places_and_is_one_undo_step() { + let mut s = Session::new(); + let mut frames = Vec::new(); + for (i, name) in ["Card", "Badge", "Tile"].into_iter().enumerate() { + let x = 150.0 * i as f64; + let v = s.execute("frame.create", &json!({"x": x, "y": 20, "width": 100, "height": 60})).unwrap(); + let f = id_of(&v["id"]).unwrap(); + s.execute("object.rename", &json!({"ids": [f], "name": name})).unwrap(); + frames.push(f); + } + let before = undo_len(&s); + let out = s.execute("component.createMultiple", &json!({"ids": frames})).unwrap(); + assert_eq!(undo_len(&s), before + 1, "one undo step"); + let made: Vec = out["ids"].as_array().unwrap().iter().filter_map(id_of).collect(); + assert_eq!(made.len(), 3); + assert_eq!(s.selection(), made, "all of them stay selected"); + let doc = s.doc().unwrap(); + for (i, (c, name)) in made.iter().zip(["Card", "Badge", "Tile"]).enumerate() { + let n = doc.node(*c).unwrap(); + assert!(matches!(n.kind, NodeKind::Component { .. }), "{name} is a component"); + assert_eq!(n.name, name); + let b = doc.world_bounds(*c).unwrap(); + assert_eq!((b.x0, b.y0), (150.0 * i as f64, 20.0), "{name} stays in place"); + } + s.undo().unwrap(); + let doc = s.doc().unwrap(); + assert!(frames.iter().all(|f| matches!(doc.node(*f).map(|n| &n.kind), Some(NodeKind::Frame))), "one undo restores the frames"); +} diff --git a/crates/ui-egui/src/create_multiple_menu_tests.rs b/crates/ui-egui/src/create_multiple_menu_tests.rs new file mode 100644 index 000000000..a8c2b3a56 --- /dev/null +++ b/crates/ui-egui/src/create_multiple_menu_tests.rs @@ -0,0 +1,115 @@ +//! With two or more layers selected the Design panel's component button opens a menu (Create +//! component, Create multiple components); one layer keeps the plain click (#2088): drawn headless. + +use egui::accesskit::Node; +use egui::{Event, PointerButton, Pos2, Rect, pos2}; +use figcraft_doc::{NodeId, NodeKind}; +use figcraft_engine::Session; +use serde_json::json; + +use crate::layers_drag_tests::Ui; + +const NAMES: [&str; 3] = ["Card", "Badge", "Tile"]; + +fn id(v: serde_json::Value) -> NodeId { + serde_json::from_value(v["id"].clone()).unwrap() +} + +/// Frames named `NAMES[..n]`, all selected, headless. +fn frames(n: usize) -> (Ui, Vec) { + let mut s = Session::new(); + let mut ids = Vec::new(); + for (i, name) in NAMES.into_iter().take(n).enumerate() { + let f = id(s.execute("frame.create", &json!({"x": 150 * i, "y": 0, "width": 100, "height": 60})).unwrap()); + s.execute("object.rename", &json!({"ids": [f], "name": name})).unwrap(); + ids.push(f); + } + s.execute("select.set", &json!({"ids": ids})).unwrap(); + let mut u = Ui::new(s); + u.frame(vec![]); + (u, ids) +} + +fn nodes(u: &mut Ui) -> Vec { + u.ctx.enable_accesskit(); + u.frame(vec![]); + u.frame_output(vec![]).platform_output.accesskit_update.expect("an AccessKit update").nodes.into_iter().map(|(_, n)| n).collect() +} + +fn bounds(n: &Node) -> Rect { + let b = n.bounds().unwrap(); + Rect::from_min_max(pos2(b.x0 as f32, b.y0 as f32), pos2(b.x1 as f32, b.y1 as f32)) +} + +fn click(u: &mut Ui, at: Pos2) { + for pressed in [true, false] { + u.frame(vec![ + Event::PointerMoved(at), + Event::PointerButton { pos: at, button: PointerButton::Primary, pressed, modifiers: Default::default() }, + ]); + } +} + +fn settle(u: &mut Ui) { + for _ in 0..10 { + u.frame(vec![]); + } +} + +/// The header's component button (its tooltip may carry the shortcut). +fn click_button(u: &mut Ui) { + let all = nodes(u); + let button = all.iter().find(|n| n.label().is_some_and(|l| l.starts_with("Create component"))).expect("the Design panel's component button"); + click(u, bounds(button).center()); + settle(u); +} + +fn undo_len(u: &Ui) -> usize { + u.app.session.ds().unwrap().history.undo.len() +} + +#[test] +fn several_layers_open_a_menu_and_create_multiple_components_in_one_undo_step() { + let (mut u, ids) = frames(3); + let before = undo_len(&u); + click_button(&mut u); + assert_eq!(undo_len(&u), before, "opening the menu changes nothing"); + let all = nodes(&mut u); + // The menu's rows share an x with Create multiple components: exactly these two, in this order. + let multiple = all.iter().find(|n| n.label() == Some("Create multiple components")).expect("the menu's second entry"); + let mb = bounds(multiple); + let mut rows: Vec<(f32, String)> = all + .iter() + .filter(|n| n.label().is_some() && (bounds(n).min.x - mb.min.x).abs() < 1.0 && (bounds(n).min.y - mb.min.y).abs() < 60.0) + .map(|n| (bounds(n).min.y, n.label().unwrap_or("").to_owned())) + .collect(); + rows.sort_by(|a, b| a.0.total_cmp(&b.0)); + let labels: Vec<&str> = rows.iter().map(|(_, l)| l.as_str()).collect(); + assert_eq!(labels, ["Create component", "Create multiple components"], "the menu's entries"); + click(&mut u, bounds(multiple).center()); + settle(&mut u); + let sel = u.app.session.selection(); + assert_eq!(sel.len(), 3); + let doc = u.app.session.doc().unwrap(); + let names: Vec<&str> = sel.iter().map(|i| doc.node(*i).unwrap().name.as_str()).collect(); + assert_eq!(names, NAMES); + assert!(sel.iter().all(|i| matches!(doc.node(*i).unwrap().kind, NodeKind::Component { .. }))); + assert_eq!(undo_len(&u), before + 1); + u.app.session.undo().unwrap(); + let doc = u.app.session.doc().unwrap(); + assert!(ids.iter().all(|i| matches!(doc.node(*i).map(|n| &n.kind), Some(NodeKind::Frame))), "one undo reverts all three"); +} + +#[test] +fn one_layer_keeps_the_plain_button() { + let (mut u, ids) = frames(1); + click_button(&mut u); + let all = nodes(&mut u); + assert!(all.iter().all(|n| n.label() != Some("Create multiple components")), "no menu opens"); + let sel = u.app.session.selection(); + assert_eq!(sel.len(), 1); + let doc = u.app.session.doc().unwrap(); + assert!(matches!(doc.node(sel[0]).unwrap().kind, NodeKind::Component { .. })); + assert_eq!(doc.node(sel[0]).unwrap().name, NAMES[0]); + let _ = ids; +} diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 11c96da74..b47f05fbb 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -88,6 +88,8 @@ mod context_menu_tests; #[cfg(test)] mod corner_individual_tests; #[cfg(test)] +mod create_multiple_menu_tests; +#[cfg(test)] mod crop_image_tests; #[cfg(test)] mod cursors_tests; diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index bba57c778..b408491a2 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -530,6 +530,19 @@ fn header(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { ui.close(); } }); + } else if cmd == "component.create" && sel.len() > 1 { + // Several layers: the button opens a menu, as Figma's does (#2088). One layer keeps the plain click. + // TODO: "Create component set" is the third entry, to add once its naming is measured. + menu_popup(&bresp).width(220.0).show(|ui| { + let multiple = crate::i18n::command("component.createMultiple", "Create multiple components"); + for (c, label) in [("component.create", tr("Create component")), ("component.createMultiple", &multiple)] { + let key = crate::shortcuts::shortcut(c).unwrap_or(""); + if menu_icon_item(ui, None, None, label, key) { + app.run(c, json!({})); + ui.close(); + } + } + }); } else if bresp.clicked() { app.run(cmd, json!({})); } diff --git a/docs/components-parity.md b/docs/components-parity.md index d6b1ee5e6..3ecdae292 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-11-06 · **Change:** minor (the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** minor (with several layers selected the Design panel header's component button offers Create multiple components (#2088); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; 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 @@ -12,7 +12,7 @@ accounts). | Feature | Status | Notes | |---|---|---| -| Create component, instances, detach, reset, go to main, restore main, push changes | done | push from a nested layer goes to the outer main | +| Create component, instances, detach, reset, go to main, restore main, push changes | done | push from a nested layer goes to the outer main; with two or more layers selected the Design panel header's component button opens a menu with Create component and Create multiple components (each layer its own component in place, one undo step), one layer keeps the plain click (#2088); Create component set is not in the menu yet | | 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 (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 | @@ -79,6 +79,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Date | Change | Summary | |---|---|---| +| 2026-11-07 | patch | M3, #2088: with two or more layers selected the Design panel header's component button opens a menu with Create component and Create multiple components, as Figma's does; one layer keeps the plain button. Create component set is left out until its naming is measured. Tests: `create_multiple_menu_tests`, `components_behaviour_tests::create_multiple_components_keeps_names_and_places_and_is_one_undo_step`. Grade unchanged. | | 2026-11-05 | minor | M3, #2002: the Local variables window selects several variables, as the Layers panel selects layers. A click selects one row, Shift+click the range from the anchor through the rows shown, Cmd/Ctrl+click toggles a row, Escape or a click on the empty space below the rows clears; selected rows use the sidebar's selected-row colour. Right-clicking a row that is part of a selection of several offers Delete, Move to group and Scope (all supported properties, hidden from pickers, or only one scope) for the selected local variables, each sent as one `command.batch`, so one undo step; no engine command changed. Renaming and value edits stay single-row. Tests: `variables_select_tests` (headless UI). Grade unchanged | | 2026-11-02 | minor | M3, #1829: text styles carry paragraph spacing and indent, the list style and the OpenType features ("Supported in text styles": "Paragraph spacing and indentation", "Lists", "OpenType features", Create and apply text styles) beside the character properties: `style.create` takes them from the layer (or the selected paragraphs' list) or from a `value` (`paragraphSpacing`, `paragraphIndent`, `listStyle`, `features`), `style.apply` sets them (on a range, the list goes to the paragraphs touched; the rest is the layer's, as in Figma), `style.update` moves them on every linked layer, editing one on a styled text unlinks it as editing its font does, the style editor lists them, and a `.fig` file keeps them with the style (its sample layer). Grade unchanged. | | 2026-11-06 | patch | M3: a glass's light angle bound to a number past ±180 turns round to the same direction (270 is -90), as the angle drawn from it does, instead of stopping at 180. Tests: `effects_tests::a_bound_light_angle_turns_round_instead_of_stopping`. Grade unchanged. | From a1ac22f12f46fd6042b669373231e8a99435ab12 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 21:23:25 -0500 Subject: [PATCH 021/239] =?UTF-8?q?Transform:=20Shift=20while=20rotating?= =?UTF-8?q?=20lands=20on=20multiples=20of=2015=C2=B0,=20not=2015=C2=B0=20s?= =?UTF-8?q?teps=20from=20the=20start?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Measured in Figma: a layer at 7° (or -4.27°) Shift-rotated by its corner ends at 15°; FigCraft rounded the turn since the drag began, so a layer at 7° landed on 7 + k*15. The rotate gesture keeps the selection's shared rotation and Shift rounds base + turn; a selection with different rotations keeps rounding the turn. Test: a layer at 7° Shift-turned by 37° ends at 45°, by 3° at 15°, and a free turn is unchanged. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/canvas/tools.rs | 4 ++- crates/engine/src/canvas/tools/drag.rs | 10 +++--- crates/engine/src/canvas/tools/handles.rs | 7 ++++ .../engine/src/transform_behaviour_tests.rs | 34 +++++++++++++++++++ docs/ui-parity.md | 5 +-- 5 files changed, 53 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/canvas/tools.rs b/crates/engine/src/canvas/tools.rs index a3284cd52..875a88033 100644 --- a/crates/engine/src/canvas/tools.rs +++ b/crates/engine/src/canvas/tools.rs @@ -32,7 +32,7 @@ use handles::DRAG_SLOP_PX; pub(crate) use handles::scale_factor; pub use handles::{ PENCIL_STROKE, SMALL_BOX_PX, anchor_name, anchor_of, box_sides_px, handle_at, handle_at_corners, label_at, locked_in, scale_anchor_point, - selection_box, selection_frame, + selection_box, selection_frame, shared_rotation_degrees, }; pub(crate) use handles::{SNAP_PX, handle_cursor, readable_text_fills, resized_box}; #[cfg(test)] @@ -445,6 +445,8 @@ pub(crate) enum Gesture { Rotate { center: Point, start_angle: f64, + /// The rotation (Design panel convention) the layers share when the drag began, else 0. + base: f64, ids: Vec, }, Draw { diff --git a/crates/engine/src/canvas/tools/drag.rs b/crates/engine/src/canvas/tools/drag.rs index 64d48bc86..38eef540b 100644 --- a/crates/engine/src/canvas/tools/drag.rs +++ b/crates/engine/src/canvas/tools/drag.rs @@ -1,6 +1,6 @@ use super::handles::{ SNAP_PX, handle_at, in_quad, label_at, locked_in, on_corner_square, paints_below, resized_box, scale_factor, selection_box, selection_frame, - shape_hint, + shape_hint, shared_rotation_degrees, }; use super::{ Affine, ArcHandle, ArcHint, Cursor, Document, Gesture, Guide, Handle, ImageScaleMode, LayoutMode, NodeId, NodeKind, PaintKind, Point, @@ -58,7 +58,8 @@ impl Session { .moved_origin() .unwrap_or_else(|| Point::new(b.iter().map(|c| c.x).sum::() / 4.0, b.iter().map(|c| c.y).sum::() / 4.0)); self.begin_interaction("Rotate")?; - self.tool.gesture = Gesture::Rotate { center, start_angle: (ev.p() - center).atan2(), ids }; + self.tool.gesture = + Gesture::Rotate { center, start_angle: (ev.p() - center).atan2(), base: shared_rotation_degrees(&doc, &ids), ids }; return Ok(()); } let nodes: Vec<(NodeId, Affine, f64, f64)> = @@ -350,10 +351,11 @@ impl Session { } return res; } - Gesture::Rotate { center, start_angle, ids } => { + Gesture::Rotate { center, start_angle, base, ids } => { let mut a = ((ev.p() - *center).atan2() - start_angle).to_degrees(); if ev.shift { - a = (a / 15.0).round() * 15.0; + // The panel rotation is base - a; Shift lands it on a multiple of 15 degrees. + a = base - ((base - a) / 15.0).round() * 15.0; } let (c, ids) = (*center, ids.clone()); self.preview(|doc, _| { diff --git a/crates/engine/src/canvas/tools/handles.rs b/crates/engine/src/canvas/tools/handles.rs index 9fa04d9bb..75410ec75 100644 --- a/crates/engine/src/canvas/tools/handles.rs +++ b/crates/engine/src/canvas/tools/handles.rs @@ -132,6 +132,13 @@ pub fn selection_frame(doc: &Document, sel: &[NodeId]) -> Option<(Affine, f64, f Some((rot * Affine::translate((b.x0, b.y0)), b.width(), b.height())) } +/// The rotation the Design panel shows for `ids` (degrees, counter-clockwise positive) when they +/// all share one, else 0 (the handle box is page-aligned then). Axis-aligned layers give 0, which +/// is the same as 90, 180 and 270 for stepping in 15 degrees. +pub fn shared_rotation_degrees(doc: &Document, ids: &[NodeId]) -> f64 { + shared_rotation(doc, ids).map_or(0.0, |a| -a.to_degrees()) +} + /// The rotation (radians) every layer in `ids` shares, unless it's a multiple of 90 degrees (the /// page-aligned box is then the same box). Flipped layers count by their axis, not its direction. fn shared_rotation(doc: &Document, ids: &[NodeId]) -> Option { diff --git a/crates/engine/src/transform_behaviour_tests.rs b/crates/engine/src/transform_behaviour_tests.rs index e22eb0418..1ad84fff0 100644 --- a/crates/engine/src/transform_behaviour_tests.rs +++ b/crates/engine/src/transform_behaviour_tests.rs @@ -369,6 +369,40 @@ fn resizing_and_flipping_one_layer() { assert!(near(rotation(&s, t).abs(), 30.0), "Shift: the nearest 15° step: {}", rotation(&s, t)); } +/// A rotate-handle drag on a layer at `start` degrees, turning it by `turn` degrees in the Design +/// panel's convention (positive is counter-clockwise on screen); returns the rotation it ends at. +fn rotate_drag_from(start: f64, turn: f64, m: Mods) -> f64 { + let mut s = session(); + let r = rect(&mut s, 0.0, 200.0, 100.0, 100.0, None); + set(&mut s, &[r], json!({"rotation": start})); + ex(&mut s, "select.set", json!({"ids": [r]})); + // The handle sits just outside the top-left corner of the turned box; the pointer then circles + // the centre by `turn` (the page angle runs the other way round, y being down). + let world = s.doc().unwrap().world_transform(r); + let (c, corner) = (world * Point::new(50.0, 50.0), world * Point::ZERO); + let from = corner + (corner - c) * 0.15; + let a = (from - c).atan2() - turn.to_radians(); + let to = c + figcraft_geom::Vec2::from_angle(a) * 80.0; + drag(&mut s, from, to, m); + rotation(&s, r) +} + +#[test] +fn shift_rotating_lands_on_multiples_of_15_not_steps_from_the_start() { + // Measured in Figma: a layer at 7° (or -4.27°) Shift-rotated by its corner ends at 15°, so the + // steps are absolute multiples of 15°, not 15° steps from where the drag began. + let got = rotate_drag_from(7.0, 37.0, SHIFT); + assert!(near(got, 45.0), "7° turned by 37° is 44°, nearest multiple of 15 is 45°: {got}"); + // Without Shift the turn is free. + let got = rotate_drag_from(7.0, 37.0, NONE); + assert!(near(got, 44.0), "a free turn: {got}"); + // A small turn: 7° + 3° = 10°, nearest multiple of 15 is 15° (not 7° or 10°). + let got = rotate_drag_from(7.0, 3.0, SHIFT); + assert!(near(got, 15.0), "10° rounds to 15°: {got}"); + let got = rotate_drag_from(-4.27, 2.0, SHIFT); + assert!(near(got, 0.0), "-2.27° rounds to 0°: {got}"); +} + #[test] fn groups_scale_children_keeping_their_rotation_and_flip() { let mut s = session(); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index aa0ef25bd..d91ee685d 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** minor (Shift while rotating lands on absolute multiples of 15°, measured in Figma; the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -61,7 +61,7 @@ interaction feel not yet compared. | Select layer menu (every layer under the click) | done | | | Enter / Shift+Enter (children / parent), Tab / Shift+Tab (siblings) | done | Tab renames the next layer while renaming | | Resize handles: Shift keeps proportions, Alt from centre, constraints-aware | done | Alt shrinks too; past an edge flips (several layers mirror); groups and mixed rotations scale each layer along its own axes, keeping rotation and flip (no skew: children turned off a right angle are approximate); Cmd/Ctrl ignores a frame's constraints (`transform_behaviour_tests`) | -| Rotate just outside a corner; Shift in 15° steps | done | rotated handle box when layers share a rotation | +| Rotate just outside a corner; Shift in 15° steps | done | rotated handle box when layers share a rotation; Shift lands the rotation on multiples of 15° (measured in Figma: a layer at 7° or -4.27° ends at 15°), not 15° steps from where the drag began; layers with different rotations step the turn from 0 | | Flip, rotate 90° | done | | | Rotation origin (Alt+R) | done | a handle at the selection's centre to drag (snaps to the box's corners, edge middles and centre), double-click puts it back, Escape or Alt+R hides it; the corner handles, the rotation field, Rotate 90°/180° and `transform.rotate` turn about it; it follows the layers and lasts as long as the selection, not saved (the documentation doesn't say; pinned) | | Enter with a shape or frame tool chosen | done | places what a click makes (100×100, lines 100 long, sections 400×300) in the middle of the view, selected (`tool.place`); from the toolbar, Enter on the chosen tool. With nothing selected, the arrows first show a crosshair in the middle of the view and then move it by the nudge amounts (`tool.crosshair`; Shift the large one), and Enter places there; Escape or a tool change takes it away ("Use the arrow keys to activate the crosshair cursor. It will appear in the middle of the viewport indicating where the new object will be placed", Accessibility at Figma; #1839) | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-07 | patch | Transform: Shift while rotating lands on absolute multiples of 15°, measured in Figma (a layer at 7° or -4.27° Shift-rotated by its corner ends at 15°); FigCraft rounded the turn since the drag began, so 7° landed on 7 + k*15. The gesture keeps the selection's shared rotation and rounds base + turn; a selection with different rotations keeps rounding the turn. Test: `shift_rotating_lands_on_multiples_of_15_not_steps_from_the_start` | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 071cc86bdf0ca95aff3fdf42d6a101b9cbd08b5e Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 21:30:39 -0500 Subject: [PATCH 022/239] Docs: the .fig note on text styles leaves out the wrap style (#2094 review) components-parity.md said a text style's wrap style is kept by .fig files; the .fig mapping is still open (ui-parity.md, mcp.md and the PR say so), so the row now says so too. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- docs/components-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/components-parity.md b/docs/components-parity.md index e3cf65a07..15fc9e571 100644 --- a/docs/components-parity.md +++ b/docs/components-parity.md @@ -60,7 +60,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Feature | Status | Notes | |---|---|---| -| Paint, text, effect, grid styles; style picker; text styles on character ranges | done | behaviour suite: `styles_behaviour_tests.rs`; a text style carries paragraph spacing and indent, the list style, the wrap style and the OpenType features beside the character properties (`paragraph` next to `style` in `style.list`): applied with it, moved by `style.update`, unlinking when edited, kept by `.fig` files (#1829) | +| Paint, text, effect, grid styles; style picker; text styles on character ranges | done | behaviour suite: `styles_behaviour_tests.rs`; a text style carries paragraph spacing and indent, the list style, the wrap style and the OpenType features beside the character properties (`paragraph` next to `style` in `style.list`): applied with it, moved by `style.update`, unlinking when edited, kept by `.fig` files (#1829; not the wrap style yet: its `.fig` field is unknown, #1827) | | Editing a style updates its layers; detach and delete keep values; editing a styled property unlinks that style | done | an edited fill/stroke/effect/grid list or text chars unlink; applying a style replaces variables bound to what it sets; text styles on text layers only | | Organising styles: folders by `/` names, order, duplicate, rename folder, Local styles list | done | `style.move` (into a folder renames), `style.duplicate` (right below), `style.renameFolder`; the page's Local styles list by type and folder (drag to reorder, right-click) | | Variables inside styles (paint, effect, grid and text styles; each user resolves them in its own modes) | done | `style.bind`, `style_vars_tests`; the editor binds paint colours, shadow colours, blur radii, grid sizes and a text style's font, font style, size, line height and letter spacing, the rest through the command | From c4302902d20233e2117371c53d6cbe16b01ef06c Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 21:36:45 -0500 Subject: [PATCH 023/239] Menus: the sweep test checks the submenu shown is the hovered row's (#2093 review) Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/ui-egui/src/menu_aim_tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/src/menu_aim_tests.rs b/crates/ui-egui/src/menu_aim_tests.rs index 9310149af..f5af573db 100644 --- a/crates/ui-egui/src/menu_aim_tests.rs +++ b/crates/ui-egui/src/menu_aim_tests.rs @@ -251,7 +251,7 @@ fn sweeping_across_rows_shows_only_the_row_under_the_pointer() { u.hover(pos2(r.min.x + 20.0, r.center().y)); // (A panel drawn above the row the pointer is on goes the next frame.) u.frame(vec![]); - assert_eq!(u.tops_shown().len(), 1, "{:?} open on row {i}", u.tops_shown()); + assert_eq!(u.tops_shown(), [TOPS[i]], "wrong submenu open on row {i}"); } assert_eq!(u.tops_shown(), ["Arrange"]); } From 524ad8b1ddfd576ad86dd13d7c1b71f4deaad3e1 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 21:38:30 -0500 Subject: [PATCH 024/239] Components: Create component set in the component button's menu (#2088) The third entry of the menu several selected layers get: each layer becomes a component and they are wrapped in a component set in place, 20 px around, named as Figma names them (measured): "Property 1=" in left-to-right order, prop=value names kept, and layers that all share a name give a set of that name with "Default" variants. Engine tests cover the three measured cases, geometry, selection, one undo and the refusal of instances; the UI test checks the three menu entries in order and that the third makes one set. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/cmd/component.rs | 9 +- crates/engine/src/cmd/component/variants.rs | 55 ++++++++- .../engine/src/components_behaviour_tests.rs | 106 ++++++++++++++++++ .../ui-egui/src/create_multiple_menu_tests.rs | 27 ++++- crates/ui-egui/src/panels/right.rs | 6 +- docs/components-parity.md | 4 +- 6 files changed, 197 insertions(+), 10 deletions(-) diff --git a/crates/engine/src/cmd/component.rs b/crates/engine/src/cmd/component.rs index e0b2e02f4..06e6bf166 100644 --- a/crates/engine/src/cmd/component.rs +++ b/crates/engine/src/cmd/component.rs @@ -24,7 +24,7 @@ use instance::{detach, make_slot, push_changes, remove_slot, reset_instance, res pub(crate) use instance::{swap_at, swap_instance}; use props::{add_prop, bind_prop, delete_prop, edit_prop, set_props}; pub(crate) use props::{apply_prop_bindings, check_prop_binding, describe_props}; -use variants::{add_variant, combine}; +use variants::{add_variant, combine, create_set}; pub use variants::{can_add_variant, can_combine_variants}; /// `component.hideWhenPublishing`: the leading `.` of the names of this file's components and @@ -72,6 +72,13 @@ pub fn specs() -> Vec { s.set_selection(out.iter().filter_map(id_of).collect()); Ok(json!({"ids": out})) }), + spec!( + "component.createSet", + "Create component set", + "{ids? (layers, not components, sets or instances)} (each becomes a component, wrapped in place in a component set: variants \"Property 1=\" left to right, 20 px around)", + true, + create_set + ), spec!( "component.combineVariants", "Combine as variants", diff --git a/crates/engine/src/cmd/component/variants.rs b/crates/engine/src/cmd/component/variants.rs index 5f9e218ac..53e00ca6d 100644 --- a/crates/engine/src/cmd/component/variants.rs +++ b/crates/engine/src/cmd/component/variants.rs @@ -1,6 +1,6 @@ use super::{ - BTreeMap, BTreeSet, Document, EngineError, Node, NodeId, NodeKind, Result, Session, Value, bad, inside_instance, json, owning_instance, - req_targets, roots, set_name_from, string, targets, variant_name, variant_options, variant_props, variant_set, z_sorted, + BTreeMap, BTreeSet, Document, EngineError, Node, NodeId, NodeKind, Result, Session, Value, bad, create, id_of, inside_instance, json, + owning_instance, req_targets, roots, set_name_from, string, targets, variant_name, variant_options, variant_props, variant_set, z_sorted, }; /// Wrap components in a new component set (named after the first) placed around them. @@ -94,6 +94,57 @@ pub(super) fn combine(s: &mut Session, p: &Value) -> Result { Ok(json!({"id": set})) } +/// `component.createSet`: each target becomes a component (as `component.createMultiple` makes +/// them) and all are wrapped in place in a component set, 20 px around, named as Figma names them: +/// variants "Property 1=" in left-to-right order (a name holding `=` is kept); layers +/// that all share a name give a set of that name with "Property 1=Default" variants; otherwise the +/// set is "Component N". +pub(super) fn create_set(s: &mut Session, p: &Value) -> Result { + let cmd = "component.createSet"; + let mut seen = BTreeSet::new(); + let ids: Vec = req_targets(cmd, s, p)?.into_iter().filter(|i| seen.insert(*i)).collect(); + let doc = s.doc()?; + if ids.iter().any(|i| inside_instance(doc, *i)) { + return Err(EngineError::Disabled(cmd.into(), "layers inside an instance can't become components".into())); + } + if ids.iter().any(|i| doc.is_remote(*i)) { + return Err(EngineError::Disabled(cmd.into(), crate::library::READ_ONLY.into())); + } + if ids.iter().any(|i| { + doc.node(*i).is_some_and(|n| matches!(n.kind, NodeKind::Instance { .. } | NodeKind::Component { .. } | NodeKind::ComponentSet { .. })) + }) { + return Err(EngineError::Disabled(cmd.into(), "select layers that aren't components, component sets or instances".into())); + } + let mut made = Vec::new(); + for i in roots(doc, &ids) { + let r = create(s, &json!({"ids": [i]}))?; + made.push(id_of(&r["id"]).ok_or_else(|| bad(cmd, "component creation failed"))?); + } + let doc = s.doc_mut()?; + // Left to right by world x, ties by y: the variants' order, and the values' order. + let mut by_x: Vec<(NodeId, f64, f64)> = made.iter().map(|i| doc.world_bounds(*i).map_or((*i, 0.0, 0.0), |b| (*i, b.x0, b.y0))).collect(); + by_x.sort_by(|a, b| a.1.total_cmp(&b.1).then(a.2.total_cmp(&b.2))); + let names: Vec = by_x.iter().map(|(i, ..)| doc.node(*i).map(|n| n.name.clone()).unwrap_or_default()).collect(); + let same = names.windows(2).all(|w| w.first() == w.get(1)) && names.first().is_some_and(|n| !n.is_empty() && !n.contains('=')); + let set_name = match names.first() { + Some(n) if same => n.clone(), + _ => doc.next_name("Component"), + }; + for ((i, ..), name) in by_x.iter().zip(&names) { + let node = doc.get_mut(*i)?; + if same { + node.name = "Property 1=Default".into(); + } else if !name.contains('=') { + node.name = format!("Property 1={name}"); + } + } + let ordered = z_sorted(doc, &made); + let set = wrap_in_set(cmd, doc, &ordered)?; + doc.get_mut(set)?.name = set_name; + s.set_selection(vec![set]); + Ok(json!({"id": set})) +} + /// Grow a component set so it wraps its variants with 20 px of padding (right and bottom). pub(super) fn fit_set(doc: &mut Document, set: NodeId) { let Some(kids) = doc.node(set).map(|n| n.children.clone()) else { return }; diff --git a/crates/engine/src/components_behaviour_tests.rs b/crates/engine/src/components_behaviour_tests.rs index 198151768..f65049de5 100644 --- a/crates/engine/src/components_behaviour_tests.rs +++ b/crates/engine/src/components_behaviour_tests.rs @@ -1033,3 +1033,109 @@ fn create_multiple_components_keeps_names_and_places_and_is_one_undo_step() { let doc = s.doc().unwrap(); assert!(frames.iter().all(|f| matches!(doc.node(*f).map(|n| &n.kind), Some(NodeKind::Frame))), "one undo restores the frames"); } + +/// Frames named `names` at x = 150 * i (mirrored when `reverse`), y 20, 100 x 60. +fn named_frames(s: &mut Session, names: &[&str], reverse: bool) -> Vec { + let n = names.len(); + names + .iter() + .enumerate() + .map(|(i, name)| { + let x = 150.0 * if reverse { n - 1 - i } else { i } as f64; + let v = s.execute("frame.create", &json!({"x": x, "y": 20, "width": 100, "height": 60})).unwrap(); + let f = id_of(&v["id"]).unwrap(); + s.execute("object.rename", &json!({"ids": [f], "name": name})).unwrap(); + f + }) + .collect() +} + +/// The set's name and its children's names in layer order. +fn set_names(s: &Session, set: NodeId) -> (String, Vec) { + let doc = s.doc().unwrap(); + let n = doc.node(set).unwrap(); + (n.name.clone(), n.children.iter().map(|c| doc.node(*c).unwrap().name.clone()).collect()) +} + +/// The set's variant names ordered by world x. +fn names_by_x(s: &Session, set: NodeId) -> Vec { + let doc = s.doc().unwrap(); + let mut v: Vec<(f64, String)> = + doc.node(set).unwrap().children.iter().map(|c| (doc.world_bounds(*c).unwrap().x0, doc.node(*c).unwrap().name.clone())).collect(); + v.sort_by(|a, b| a.0.total_cmp(&b.0)); + v.into_iter().map(|(_, n)| n).collect() +} + +/// Create component set (#2088, measured in Figma): variants "Property 1=" in left-to-right +/// order, the set "Component 1", wrapped in place 20 px around, selected, one undo step. +#[test] +fn create_set_names_variants_by_layer_name_and_wraps_in_place() { + let mut s = Session::new(); + let frames = named_frames(&mut s, &["Primary", "Secondary", "Ghost"], false); + let before = undo_len(&s); + let out = s.execute("component.createSet", &json!({"ids": frames})).unwrap(); + assert_eq!(undo_len(&s), before + 1, "one undo step"); + let set = id_of(&out["id"]).unwrap(); + assert_eq!(s.selection(), vec![set], "the set is selected"); + assert_eq!(set_names(&s, set).0, "Component 1"); + assert_eq!(names_by_x(&s, set), ["Property 1=Primary", "Property 1=Secondary", "Property 1=Ghost"]); + let doc = s.doc().unwrap(); + for (i, c) in doc.node(set).unwrap().children.iter().enumerate() { + assert!(matches!(doc.node(*c).unwrap().kind, NodeKind::Component { .. })); + let b = doc.world_bounds(*c).unwrap(); + assert_eq!((b.x0, b.y0), (150.0 * i as f64, 20.0), "frames stay put"); + } + let sb = doc.world_bounds(set).unwrap(); + assert_eq!((sb.x0, sb.y0, sb.x1, sb.y1), (-20.0, 0.0, 420.0, 100.0), "20 px on every side"); + s.undo().unwrap(); + let doc = s.doc().unwrap(); + assert!(doc.node(set).is_none()); + assert!(frames.iter().all(|f| matches!(doc.node(*f).map(|n| &n.kind), Some(NodeKind::Frame))), "one undo restores the frames"); +} + +#[test] +fn create_set_orders_left_to_right_whatever_the_selection_order() { + let mut s = Session::new(); + let frames = named_frames(&mut s, &["A", "B", "C"], true); + let out = s.execute("component.createSet", &json!({"ids": frames})).unwrap(); + let set = id_of(&out["id"]).unwrap(); + assert_eq!(names_by_x(&s, set), ["Property 1=C", "Property 1=B", "Property 1=A"]); + let (_, kids) = set_names(&s, set); + assert_eq!(kids.len(), 3); +} + +#[test] +fn create_set_keeps_names_already_in_prop_value_form() { + let mut s = Session::new(); + let frames = named_frames(&mut s, &["Size=Small", "Size=Large", "Size=Medium"], false); + let out = s.execute("component.createSet", &json!({"ids": frames})).unwrap(); + let set = id_of(&out["id"]).unwrap(); + assert_eq!(set_names(&s, set).0, "Component 1"); + assert_eq!(names_by_x(&s, set), ["Size=Small", "Size=Large", "Size=Medium"]); +} + +#[test] +fn create_set_with_one_shared_name_names_the_set_and_makes_default_variants() { + let mut s = Session::new(); + let frames = named_frames(&mut s, &["Card", "Card", "Card"], false); + let out = s.execute("component.createSet", &json!({"ids": frames})).unwrap(); + let set = id_of(&out["id"]).unwrap(); + let (name, kids) = set_names(&s, set); + assert_eq!(name, "Card"); + assert_eq!(kids, ["Property 1=Default", "Property 1=Default", "Property 1=Default"]); +} + +#[test] +fn create_set_refuses_instances_and_leaves_the_document_alone() { + let mut s = Session::new(); + let frames = named_frames(&mut s, &["A", "B"], false); + let c = s.execute("component.create", &json!({"ids": [frames[0]]})).unwrap(); + let comp = id_of(&c["id"]).unwrap(); + let inst = s.execute("instance.create", &json!({"component": comp})).unwrap(); + let inst = id_of(&inst["id"]).unwrap(); + let before = undo_len(&s); + let e = s.execute("component.createSet", &json!({"ids": [inst, frames[1]]})).unwrap_err(); + assert!(matches!(e, crate::EngineError::Disabled(..)), "{e:?}"); + assert_eq!(undo_len(&s), before); + assert!(matches!(s.doc().unwrap().node(frames[1]).unwrap().kind, NodeKind::Frame)); +} diff --git a/crates/ui-egui/src/create_multiple_menu_tests.rs b/crates/ui-egui/src/create_multiple_menu_tests.rs index a8c2b3a56..409b67e54 100644 --- a/crates/ui-egui/src/create_multiple_menu_tests.rs +++ b/crates/ui-egui/src/create_multiple_menu_tests.rs @@ -1,5 +1,5 @@ //! With two or more layers selected the Design panel's component button opens a menu (Create -//! component, Create multiple components); one layer keeps the plain click (#2088): drawn headless. +//! component, Create multiple components, Create component set); one layer keeps the plain click (#2088): drawn headless. use egui::accesskit::Node; use egui::{Event, PointerButton, Pos2, Rect, pos2}; @@ -80,12 +80,12 @@ fn several_layers_open_a_menu_and_create_multiple_components_in_one_undo_step() let mb = bounds(multiple); let mut rows: Vec<(f32, String)> = all .iter() - .filter(|n| n.label().is_some() && (bounds(n).min.x - mb.min.x).abs() < 1.0 && (bounds(n).min.y - mb.min.y).abs() < 60.0) + .filter(|n| n.label().is_some() && (bounds(n).min.x - mb.min.x).abs() < 1.0 && (bounds(n).min.y - mb.min.y).abs() < 90.0) .map(|n| (bounds(n).min.y, n.label().unwrap_or("").to_owned())) .collect(); rows.sort_by(|a, b| a.0.total_cmp(&b.0)); let labels: Vec<&str> = rows.iter().map(|(_, l)| l.as_str()).collect(); - assert_eq!(labels, ["Create component", "Create multiple components"], "the menu's entries"); + assert_eq!(labels, ["Create component", "Create multiple components", "Create component set"], "the menu's entries"); click(&mut u, bounds(multiple).center()); settle(&mut u); let sel = u.app.session.selection(); @@ -113,3 +113,24 @@ fn one_layer_keeps_the_plain_button() { assert_eq!(doc.node(sel[0]).unwrap().name, NAMES[0]); let _ = ids; } + +#[test] +fn the_third_entry_creates_one_component_set() { + let (mut u, ids) = frames(3); + let before = undo_len(&u); + click_button(&mut u); + let all = nodes(&mut u); + let entry = all.iter().find(|n| n.label() == Some("Create component set")).expect("the menu's third entry"); + click(&mut u, bounds(entry).center()); + settle(&mut u); + let sel = u.app.session.selection(); + assert_eq!(sel.len(), 1, "the set is selected"); + let doc = u.app.session.doc().unwrap(); + let set = doc.node(sel[0]).unwrap(); + assert!(matches!(set.kind, NodeKind::ComponentSet { .. })); + assert_eq!(set.children.len(), 3); + assert_eq!(undo_len(&u), before + 1); + u.app.session.undo().unwrap(); + let doc = u.app.session.doc().unwrap(); + assert!(ids.iter().all(|i| matches!(doc.node(*i).map(|n| &n.kind), Some(NodeKind::Frame))), "one undo reverts it all"); +} diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index b408491a2..55b36ebf5 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -532,10 +532,12 @@ fn header(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { }); } else if cmd == "component.create" && sel.len() > 1 { // Several layers: the button opens a menu, as Figma's does (#2088). One layer keeps the plain click. - // TODO: "Create component set" is the third entry, to add once its naming is measured. menu_popup(&bresp).width(220.0).show(|ui| { let multiple = crate::i18n::command("component.createMultiple", "Create multiple components"); - for (c, label) in [("component.create", tr("Create component")), ("component.createMultiple", &multiple)] { + let set = crate::i18n::command("component.createSet", "Create component set"); + for (c, label) in + [("component.create", tr("Create component")), ("component.createMultiple", &multiple), ("component.createSet", &set)] + { let key = crate::shortcuts::shortcut(c).unwrap_or(""); if menu_icon_item(ui, None, None, label, key) { app.run(c, json!({})); diff --git a/docs/components-parity.md b/docs/components-parity.md index 3ecdae292..a28ca6d0e 100644 --- a/docs/components-parity.md +++ b/docs/components-parity.md @@ -12,7 +12,7 @@ accounts). | Feature | Status | Notes | |---|---|---| -| Create component, instances, detach, reset, go to main, restore main, push changes | done | push from a nested layer goes to the outer main; with two or more layers selected the Design panel header's component button opens a menu with Create component and Create multiple components (each layer its own component in place, one undo step), one layer keeps the plain click (#2088); Create component set is not in the menu yet | +| Create component, instances, detach, reset, go to main, restore main, push changes | done | push from a nested layer goes to the outer main; with two or more layers selected the Design panel header's component button opens a menu with Create component, Create multiple components (each layer its own component in place, one undo step) and Create component set (each layer a component, wrapped in place in a set 20 px around: variants `Property 1=` left to right, `prop=value` names kept, layers that all share a name give a set of that name with `Property 1=Default` variants; measured in Figma), one layer keeps the plain click (#2088) | | 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 (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 | @@ -79,7 +79,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Date | Change | Summary | |---|---|---| -| 2026-11-07 | patch | M3, #2088: with two or more layers selected the Design panel header's component button opens a menu with Create component and Create multiple components, as Figma's does; one layer keeps the plain button. Create component set is left out until its naming is measured. Tests: `create_multiple_menu_tests`, `components_behaviour_tests::create_multiple_components_keeps_names_and_places_and_is_one_undo_step`. Grade unchanged. | +| 2026-11-07 | patch | M3, #2088: with two or more layers selected the Design panel header's component button opens a menu with Create component, Create multiple components and Create component set (`component.createSet`, naming measured in Figma), as Figma's does; one layer keeps the plain button. Tests: `create_multiple_menu_tests`, `components_behaviour_tests::create_multiple_components_keeps_names_and_places_and_is_one_undo_step`, `components_behaviour_tests::create_set_*`. Grade unchanged. | | 2026-11-05 | minor | M3, #2002: the Local variables window selects several variables, as the Layers panel selects layers. A click selects one row, Shift+click the range from the anchor through the rows shown, Cmd/Ctrl+click toggles a row, Escape or a click on the empty space below the rows clears; selected rows use the sidebar's selected-row colour. Right-clicking a row that is part of a selection of several offers Delete, Move to group and Scope (all supported properties, hidden from pickers, or only one scope) for the selected local variables, each sent as one `command.batch`, so one undo step; no engine command changed. Renaming and value edits stay single-row. Tests: `variables_select_tests` (headless UI). Grade unchanged | | 2026-11-02 | minor | M3, #1829: text styles carry paragraph spacing and indent, the list style and the OpenType features ("Supported in text styles": "Paragraph spacing and indentation", "Lists", "OpenType features", Create and apply text styles) beside the character properties: `style.create` takes them from the layer (or the selected paragraphs' list) or from a `value` (`paragraphSpacing`, `paragraphIndent`, `listStyle`, `features`), `style.apply` sets them (on a range, the list goes to the paragraphs touched; the rest is the layer's, as in Figma), `style.update` moves them on every linked layer, editing one on a styled text unlinks it as editing its font does, the style editor lists them, and a `.fig` file keeps them with the style (its sample layer). Grade unchanged. | | 2026-11-06 | patch | M3: a glass's light angle bound to a number past ±180 turns round to the same direction (270 is -90), as the angle drawn from it does, instead of stopping at 180. Tests: `effects_tests::a_bound_light_angle_turns_round_instead_of_stopping`. Grade unchanged. | From 8a78214b48dfe6f89bc15fcf18d35723a261ffab Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 21:44:01 -0500 Subject: [PATCH 025/239] Widgets: a mixed checkbox is announced as mixed (#2089 review) Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/ui-egui/src/a11y.rs | 10 +++++++++- crates/ui-egui/src/a11y_tests.rs | 16 ++++++++++++++++ crates/ui-egui/src/widgets.rs | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/a11y.rs b/crates/ui-egui/src/a11y.rs index 502452765..d0e34d6fe 100644 --- a/crates/ui-egui/src/a11y.rs +++ b/crates/ui-egui/src/a11y.rs @@ -883,9 +883,17 @@ pub fn tab(resp: &Response, label: &str, selected: bool) { } pub fn checkbox(resp: &Response, label: &str, on: bool) { + checkbox_tri(resp, label, Some(on)); +} + +/// A checkbox that can be mixed (`None`, announced as "mixed" rather than unchecked). +pub fn checkbox_tri(resp: &Response, label: &str, state: Option) { node(resp, label, |n| { n.set_role(Role::CheckBox); - n.set_toggled(toggled(on)); + n.set_toggled(match state { + Some(on) => toggled(on), + None => Toggled::Mixed, + }); }); } diff --git a/crates/ui-egui/src/a11y_tests.rs b/crates/ui-egui/src/a11y_tests.rs index 14be637dd..2f0fb5a48 100644 --- a/crates/ui-egui/src/a11y_tests.rs +++ b/crates/ui-egui/src/a11y_tests.rs @@ -431,3 +431,19 @@ fn the_custom_panel_edges_never_enter_the_keyboard_or_focus_order() { } assert!(!seen.contains(&left) && !seen.contains(&right), "Tab never stops on a panel edge: {seen:?}"); } + +#[test] +fn a_mixed_checkbox_is_announced_as_mixed_and_a_checked_one_as_true() { + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + let mut out = ctx.run_ui(egui::RawInput::default(), |ui| { + crate::widgets::checkbox_tri(ui, None, "Mixed one"); + crate::widgets::checkbox_tri(ui, Some(true), "Checked one"); + crate::widgets::checkbox_tri(ui, Some(false), "Plain one"); + }); + out.textures_delta.clear(); + let nodes: Vec = out.platform_output.accesskit_update.expect("an AccessKit update").nodes.into_iter().map(|(_, n)| n).collect(); + assert_eq!(find(&nodes, Role::CheckBox, "Mixed one").toggled(), Some(Toggled::Mixed)); + assert_eq!(find(&nodes, Role::CheckBox, "Checked one").toggled(), Some(Toggled::True)); + assert_eq!(find(&nodes, Role::CheckBox, "Plain one").toggled(), Some(Toggled::False)); +} diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 05dbff893..b38acbfa4 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -1282,7 +1282,7 @@ pub fn checkbox(ui: &mut Ui, on: bool, label: &str) -> bool { pub fn checkbox_tri(ui: &mut Ui, state: Option, label: &str) -> bool { let t = Tokens::get(ui.ctx()); let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width().min(200.0), FIELD_H), Sense::click()); - a11y::checkbox(&resp, label, state == Some(true)); + a11y::checkbox_tri(&resp, label, state); let b = Rect::from_min_size(pos2(rect.min.x, rect.center().y - 7.0), vec2(14.0, 14.0)); if state != Some(false) { ui.painter().rect_filled(b, CornerRadius::same(3), t.accent); From 34c44e6063e4eb70f801bf3b8bffc6d6398faf6c Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 22:15:22 -0500 Subject: [PATCH 026/239] Text: a font loaded with text.loadFont wins over the built-in and installed faces of the same family and style (#2092) FigCraft chose the first face added for a family and style, so the embedded Inter 4.x kept Regular, SemiBold and Bold after Inter 3.19 was loaded and only Medium refitted. A loaded font is the counterpart of a font uploaded to the organization, which Figma's help center ranks first ("Manage conflicting fonts"). The test builds its faces from any embedded or installed font (skipped when there is none) and checks a loaded face beats a built-in one, the latest load beats earlier ones, and other styles resolve as before. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/text/src/fontdb.rs | 29 +++++++++++++++++++++--- crates/text/src/fontdb_tests.rs | 39 +++++++++++++++++++++++++++++++++ docs/file-format-parity.md | 2 ++ 3 files changed, 67 insertions(+), 3 deletions(-) diff --git a/crates/text/src/fontdb.rs b/crates/text/src/fontdb.rs index 3c82cd261..5159a68d1 100644 --- a/crates/text/src/fontdb.rs +++ b/crates/text/src/fontdb.rs @@ -92,6 +92,10 @@ pub struct Face { pub italic: bool, pub bytes: FontBytes, pub index: u32, + /// 0 for a built-in or installed face; else the order it was loaded in with `text.loadFont` + /// ([`FontDb::add_loaded`]). A loaded face wins over any other of its family and style, the + /// latest load over earlier ones (#2092). + pub loaded: u32, pub upem: f64, /// Ascent and descent in font units, both positive. pub ascent: f64, @@ -207,6 +211,7 @@ impl Face { family, style, index, + loaded: 0, upem, ascent, descent, @@ -620,6 +625,8 @@ pub struct FontDb { loaded_files: std::collections::BTreeSet<(std::path::PathBuf, u32)>, /// Font files added as bytes (hash and length → families), so loading one again adds nothing. loaded_bytes: std::collections::HashMap<(u64, usize), Vec>, + /// Loads so far ([`Face::loaded`]). + load_seq: u32, system_scanned: bool, /// Browser fonts text asked for and not yet taken by the browser layer. wanted: Vec, @@ -716,8 +723,20 @@ impl FontDb { face } + /// [`add`](Self::add) a face loaded explicitly (`text.loadFont`): it wins over the other faces + /// of its family and style, and over those loaded before it. + pub fn add_loaded(&mut self, mut face: Face) -> Arc { + self.load_seq += 1; + face.loaded = self.load_seq; + self.add(face) + } + /// Add font file bytes (all faces of a collection). Returns the faces added. pub fn add_bytes(&mut self, bytes: Vec) -> Vec> { + self.add_bytes_with(bytes, false) + } + + fn add_bytes_with(&mut self, bytes: Vec, loaded: bool) -> Vec> { let shared = Arc::new(bytes); let count = match FileRef::new(shared.as_slice()) { // A collection's header may name any number of faces, each a few bytes pointing at @@ -727,7 +746,9 @@ impl FontDb { Ok(FileRef::Font(_)) => 1, Err(_) => 0, }; - (0..count).filter_map(|i| Face::from_bytes(FontBytes::Shared(shared.clone()), i, None, None)).map(|f| self.add(f)).collect() + (0..count).filter_map(|i| Face::from_bytes(FontBytes::Shared(shared.clone()), i, None, None)) + .map(|f| if loaded { self.add_loaded(f) } else { self.add(f) }) + .collect() } /// The family and style of the face whose PostScript name is `ps` (ignoring case), loaded or @@ -1035,7 +1056,9 @@ impl FontDb { /// The loaded face of `family` nearest `style`. fn best(&self, family: &str, style: &str) -> Option> { let (_, idx) = self.families.get(&self.key(family))?; - let faces: Vec<&Arc> = idx.iter().filter_map(|i| self.faces.get(*i)).collect(); + let mut faces: Vec<&Arc> = idx.iter().filter_map(|i| self.faces.get(*i)).collect(); + // A loaded font comes first (the latest load first): of faces as near, the first wins. + faces.sort_by_key(|f| std::cmp::Reverse(f.loaded)); let want = norm_style(style); if let Some(f) = faces.iter().find(|f| norm_style(&f.style) == want).or_else(|| faces.iter().find(|f| has_style(f, style))) { return Some((*f).clone()); @@ -1595,7 +1618,7 @@ pub fn load_font_bytes(bytes: Vec) -> Vec { if let Some(families) = db.loaded_bytes.get(&key) { return families.clone(); } - let faces = db.add_bytes(bytes); + let faces = db.add_bytes_with(bytes, true); let mut families: Vec = faces.iter().map(|f| f.family.clone()).collect(); families.dedup(); if !families.is_empty() { diff --git a/crates/text/src/fontdb_tests.rs b/crates/text/src/fontdb_tests.rs index 38e04c790..a3dd15396 100644 --- a/crates/text/src/fontdb_tests.rs +++ b/crates/text/src/fontdb_tests.rs @@ -382,6 +382,45 @@ fn font_bytes_load_into_the_db() { } } +/// #2092: a font loaded with `text.loadFont` wins over the built-in and installed faces of its family +/// and style, the latest load over earlier ones; other styles resolve as before. +#[test] +fn a_loaded_face_wins_over_the_built_in_one_of_its_family_and_style() { + // Any embedded or installed font stands in for the faces (none without craft-fonts on CI). + let stand_in = CRAFT_FONTS.first().map(|f| f.bytes.to_vec()).or_else(|| { + let mut installed = BTreeMap::new(); + for dir in system_font_dirs() { + scan_dir(&dir, 0, &mut installed); + } + installed.values().flat_map(|(_, v)| v).find_map(|p| std::fs::read(&p.path).ok()) + }); + let Some(bytes) = stand_in.map(Arc::new) else { + eprintln!("skipping: no font to stand in"); + return; + }; + let face = |style: &str, name: &str| { + let mut f = Face::from_bytes(FontBytes::Shared(bytes.clone()), 0, Some("Brand Sans"), Some(style)).unwrap(); + f.instances.clear(); + f.postscript = Some(name.into()); + f + }; + let name = |db: &FontDb, style: &str| db.best("Brand Sans", style).and_then(|f| f.postscript.clone()); + let mut db = FontDb::default(); + db.add(face("Regular", "Built-in-Regular")); + db.add(face("Bold", "Built-in-Bold")); + assert_eq!(name(&db, "Regular").as_deref(), Some("Built-in-Regular")); + db.add_loaded(face("Regular", "Loaded-Regular")); + assert_eq!(name(&db, "Regular").as_deref(), Some("Loaded-Regular")); + // Bold wasn't loaded: the built-in one stays. Nor does the loaded Regular stand in for it. + assert_eq!(name(&db, "Bold").as_deref(), Some("Built-in-Bold")); + // The latest load wins. + db.add_loaded(face("Regular", "Loaded-Regular-2")); + assert_eq!(name(&db, "Regular").as_deref(), Some("Loaded-Regular-2")); + // A face added after a load, not loaded, doesn't displace it. + db.add(face("Regular", "Installed-Regular")); + assert_eq!(name(&db, "Regular").as_deref(), Some("Loaded-Regular-2")); +} + /// Apple's system font answers to the names designs and CSS use for it (SF Pro, SF UI Text, /// system-ui, …), unless a font of that name is installed. #[test] diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index bce90b008..0aaf249ca 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -181,6 +181,7 @@ source paint coordinates. | | Figma | FigCraft | |---|---|---| | Local fonts | yes (font helper / desktop app) | yes (system scan) | +| Conflicting fonts | an uploaded organization font comes first, then fonts installed on the device, then Figma's web fonts (help center, "Manage conflicting fonts") | a font loaded with `text.loadFont` wins over the built-in and installed faces of the same family and style, the latest load over earlier ones (#2092); installed versus built-in order is unchanged, and browser local fonts count as installed | | Bundled/shared fonts | Google Fonts in the cloud | optional `CRAFT_FONTS_DIR` build input (storytold/craft-fonts) | | Variable fonts | yes | yes (axes, named instances, per-range axis values) | | Missing-font replacement on open | yes | listed, not replaced: in the desktop app the Missing fonts window opens after a file that uses them opens and from Text ▸ Missing fonts (`text.missingFonts`; `figcraft-cli info` prints `missing font` lines), and their text draws in a fallback font. A family the font store has (Google Fonts, Noto) downloads from the window once the user allows downloading fonts (`font.download`, #754): pinned, checksum-verified files into the Craft apps' shared font folder, after which the text draws in it. A family is found however a file names it: by the legacy name of one of its weights ("Family Medium") or by the typographic name of a family installed one family per weight, and spelt with other case, spaces or hyphens (#1292). No substitute picker | @@ -189,6 +190,7 @@ source paint coordinates. | Date | Change | Summary | |---|---|---| +| 2026-11-07 | patch | Fonts, #2092: a font loaded with `text.loadFont` is the counterpart of a font uploaded to the organization, which Figma's help center ("Manage conflicting fonts") ranks first, ahead of installed fonts and the web fonts. FigCraft chose the first face added for a family and style, so the built-in Inter 4.x kept Regular, SemiBold and Bold after Inter 3.19 was loaded and only Medium refitted. A loaded face now wins over the other faces of its family and style, the latest load over earlier ones; style matching and fallbacks are unchanged, and `refitted` lists the text whose size changes. Installed versus built-in order is not changed here. Test: `fontdb::tests::a_loaded_face_wins_over_the_built_in_one_of_its_family_and_style`. Numbers unchanged. | | 2026-11-03 | patch | M6, #1909: `.jam` import: a connector end whose magnet is `AUTO` (FigJam picks the side when it draws) or `CENTER` (the end aims at the layer's middle) left the side its stale `relativePosition` named, the left one in the reporter's file, so the connectors looped behind their shape or crossed it. It now leaves the side facing the other end, as a board connector drawn here does (`Side::Auto`), for straight, elbowed and curved connectors alike; a named magnet (`TOP`, `RIGHT`, `BOTTOM`, `LEFT`) is unchanged, and an end without a magnet still takes the edge its point lies on. The Plugin API lists the magnets (`ConnectorEndpoint.magnet`: "Which side of the node it attaches to"; NONE, AUTO, TOP, LEFT, BOTTOM, RIGHT, CENTER; "Straight connectors may use only CENTER or NONE magnets"). Test: `connectors_with_an_automatic_side_leave_the_side_facing_the_target`. Numbers unchanged. | | 2026-11-04 | minor | JPG export: `quality` (1 to 100, default 90) on `file.export`, `export.add` / `export.update` and MCP `export`, kept in the export setting; an sRGB file's JPGs embed the sRGB ICC profile, as Display P3 files' JPGs already embedded theirs, since an untagged JPG is only assumed to be sRGB (#2004). | | 2026-11-04 | minor | `.fig` and `.jam` import, #1910: an elbowed connector saved with its path keeps it. FigJam stores `connectorControlPoints`, one per run between the first and the last, each a point on its run (in the connector's parent's coordinates) with the run's axis; the first run leaves the start's side and the last arrives at the end's. They become the `ConnectorPath::Runs` a board connector reshaped by hand has (`figcraft_doc::route_along`), so a connector drawn around a layer in FigJam stays around it instead of being routed through it. Points that don't make such a path (off both axes, two runs in a row the same way, a first or last run sideways to its side or going back into its object, more runs than a hand could make) leave the connector to the router as before, and only connectors routed here count in the "follow FigCraft's own routing" note. A curved connector's `connectorBezierControlPoints` are still not read. Tests: `tail_tests::an_elbow_connector_saved_with_its_path_keeps_it`, `tail_tests::an_elbow_whose_saved_path_doesnt_fit_its_sides_is_routed_here`. | From a375ac06893ed41af6916508c18bb5896e1e527b Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 22:15:41 -0500 Subject: [PATCH 027/239] Format (#2092) Co-Authored-By: Claude Sonnet 5.5 --- crates/text/src/fontdb.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/text/src/fontdb.rs b/crates/text/src/fontdb.rs index 5159a68d1..65df051e7 100644 --- a/crates/text/src/fontdb.rs +++ b/crates/text/src/fontdb.rs @@ -746,7 +746,8 @@ impl FontDb { Ok(FileRef::Font(_)) => 1, Err(_) => 0, }; - (0..count).filter_map(|i| Face::from_bytes(FontBytes::Shared(shared.clone()), i, None, None)) + (0..count) + .filter_map(|i| Face::from_bytes(FontBytes::Shared(shared.clone()), i, None, None)) .map(|f| if loaded { self.add_loaded(f) } else { self.add(f) }) .collect() } From 253e0c3df3951f4a6e6f4f85e6d2ae0a08dfd309 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 22:49:04 -0500 Subject: [PATCH 028/239] Components: Create component set refuses nested layers and is translated (#2095 review) component.createSet now refuses a selection where one layer is inside another, as component.combineVariants does, before changing the document (the nested layer was silently dropped from the set). Adds the component.createSet label to the 22 locale catalogs that list component.createMultiple. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/cmd/component/variants.rs | 3 +++ crates/engine/src/components_behaviour_tests.rs | 14 ++++++++++++++ crates/ui-egui/locales/ar.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/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/locales/zh-Hant.toml | 1 + 24 files changed, 39 insertions(+) diff --git a/crates/engine/src/cmd/component/variants.rs b/crates/engine/src/cmd/component/variants.rs index 53e00ca6d..cfba5accf 100644 --- a/crates/engine/src/cmd/component/variants.rs +++ b/crates/engine/src/cmd/component/variants.rs @@ -115,6 +115,9 @@ pub(super) fn create_set(s: &mut Session, p: &Value) -> Result { }) { return Err(EngineError::Disabled(cmd.into(), "select layers that aren't components, component sets or instances".into())); } + if roots(doc, &ids).len() != ids.len() { + return Err(EngineError::Disabled(cmd.into(), "a layer can't be in a set with one inside it".into())); + } let mut made = Vec::new(); for i in roots(doc, &ids) { let r = create(s, &json!({"ids": [i]}))?; diff --git a/crates/engine/src/components_behaviour_tests.rs b/crates/engine/src/components_behaviour_tests.rs index f65049de5..510fb2e74 100644 --- a/crates/engine/src/components_behaviour_tests.rs +++ b/crates/engine/src/components_behaviour_tests.rs @@ -1139,3 +1139,17 @@ fn create_set_refuses_instances_and_leaves_the_document_alone() { assert_eq!(undo_len(&s), before); assert!(matches!(s.doc().unwrap().node(frames[1]).unwrap().kind, NodeKind::Frame)); } + +#[test] +fn create_set_refuses_a_target_inside_another_target_and_leaves_the_document_alone() { + let mut s = Session::new(); + let frames = named_frames(&mut s, &["Outer", "Inner"], false); + s.execute("node.reparent", &json!({"ids": [frames[1]], "parent": frames[0]})).unwrap(); + let before = undo_len(&s); + let e = s.execute("component.createSet", &json!({"ids": [frames[0], frames[1]]})).unwrap_err(); + assert!(matches!(e, crate::EngineError::Disabled(..)), "{e:?}"); + assert_eq!(undo_len(&s), before); + let doc = s.doc().unwrap(); + assert!(matches!(doc.node(frames[0]).unwrap().kind, NodeKind::Frame)); + assert!(matches!(doc.node(frames[1]).unwrap().kind, NodeKind::Frame)); +} diff --git a/crates/ui-egui/locales/ar.toml b/crates/ui-egui/locales/ar.toml index da4474e79..cbbe8e07d 100644 --- a/crates/ui-egui/locales/ar.toml +++ b/crates/ui-egui/locales/ar.toml @@ -2009,6 +2009,7 @@ status = "draft — needs native review" "component.combineVariants" = "جمع كتنويعات" "component.create" = "إنشاء مكوّن" "component.createMultiple" = "إنشاء مكونات متعددة" +"component.createSet" = "إنشاء مجموعة مكونات" "component.deleteProperty" = "حذف خاصية المكوّن" "component.detach" = "فصل النسخة المثيلة" "component.editProperty" = "تحرير خاصية المكوّن" diff --git a/crates/ui-egui/locales/bs.toml b/crates/ui-egui/locales/bs.toml index 36d71664c..e39053f08 100644 --- a/crates/ui-egui/locales/bs.toml +++ b/crates/ui-egui/locales/bs.toml @@ -2038,6 +2038,7 @@ status = "draft — needs native review" "component.combineVariants" = "Kombinuj kao varijante" "component.create" = "Kreiraj komponentu" "component.createMultiple" = "Kreiraj više komponenti" +"component.createSet" = "Kreiraj skup komponenti" "component.deleteProperty" = "Izbriši svojstvo komponente" "component.detach" = "Odvoji instancu" "component.editProperty" = "Uredi svojstvo komponente" diff --git a/crates/ui-egui/locales/cs.toml b/crates/ui-egui/locales/cs.toml index d401654ac..de7f9cc89 100644 --- a/crates/ui-egui/locales/cs.toml +++ b/crates/ui-egui/locales/cs.toml @@ -1913,6 +1913,7 @@ status = "draft — needs native review" "component.combineVariants" = "Sloučit jako varianty" "component.create" = "Vytvořit komponentu" "component.createMultiple" = "Vytvořit více komponent" +"component.createSet" = "Vytvořit sadu komponent" "component.deleteProperty" = "Smazat vlastnost komponenty" "component.detach" = "Odpojit instanci" "component.editProperty" = "Upravit vlastnost komponenty" diff --git a/crates/ui-egui/locales/de.toml b/crates/ui-egui/locales/de.toml index 6fd1838d6..6256fc1e0 100644 --- a/crates/ui-egui/locales/de.toml +++ b/crates/ui-egui/locales/de.toml @@ -2079,6 +2079,7 @@ status = "draft — needs native review" "component.combineVariants" = "Als Varianten kombinieren" "component.create" = "Komponente erstellen" "component.createMultiple" = "Mehrere Komponenten erstellen" +"component.createSet" = "Komponentensatz erstellen" "component.deleteProperty" = "Komponenteneigenschaft löschen" "component.detach" = "Instanz lösen" "component.editProperty" = "Komponenteneigenschaft bearbeiten" diff --git a/crates/ui-egui/locales/es.toml b/crates/ui-egui/locales/es.toml index 2baa2b31e..6c2d171c3 100644 --- a/crates/ui-egui/locales/es.toml +++ b/crates/ui-egui/locales/es.toml @@ -2002,6 +2002,7 @@ status = "draft — needs native review" "component.combineVariants" = "Combinar como variantes" "component.create" = "Crear componente" "component.createMultiple" = "Crear varios componentes" +"component.createSet" = "Crear conjunto de componentes" "component.deleteProperty" = "Eliminar propiedad de componente" "component.detach" = "Separar instancia" "component.editProperty" = "Editar propiedad de componente" diff --git a/crates/ui-egui/locales/fi.toml b/crates/ui-egui/locales/fi.toml index 2f5db319a..a1b33417f 100644 --- a/crates/ui-egui/locales/fi.toml +++ b/crates/ui-egui/locales/fi.toml @@ -2086,6 +2086,7 @@ status = "draft — needs native review" "component.combineVariants" = "Yhdistä varianteiksi" "component.create" = "Luo komponentti" "component.createMultiple" = "Luo useita komponentteja" +"component.createSet" = "Luo komponenttijoukko" "component.deleteProperty" = "Poista komponentin ominaisuus" "component.detach" = "Irrota ilmentymä" "component.editProperty" = "Muokkaa komponentin ominaisuutta" diff --git a/crates/ui-egui/locales/fr.toml b/crates/ui-egui/locales/fr.toml index d47ad9597..e5feebc9b 100644 --- a/crates/ui-egui/locales/fr.toml +++ b/crates/ui-egui/locales/fr.toml @@ -1958,6 +1958,7 @@ status = "draft — needs native review" "component.combineVariants" = "Combiner en variantes" "component.create" = "Créer un composant" "component.createMultiple" = "Créer plusieurs composants" +"component.createSet" = "Créer un ensemble de composants" "component.deleteProperty" = "Supprimer la propriété de composant" "component.detach" = "Détacher l’instance" "component.editProperty" = "Modifier la propriété de composant" diff --git a/crates/ui-egui/locales/id.toml b/crates/ui-egui/locales/id.toml index cbebaf1c4..3bb5d027c 100644 --- a/crates/ui-egui/locales/id.toml +++ b/crates/ui-egui/locales/id.toml @@ -1917,6 +1917,7 @@ status = "draft — needs native review" "component.combineVariants" = "Gabungkan sebagai variant" "component.create" = "Buat component" "component.createMultiple" = "Buat beberapa component" +"component.createSet" = "Buat set component" "component.deleteProperty" = "Hapus properti component" "component.detach" = "Lepaskan instance" "component.editProperty" = "Edit properti component" diff --git a/crates/ui-egui/locales/it.toml b/crates/ui-egui/locales/it.toml index 364aeedf8..f6b6dfe0d 100644 --- a/crates/ui-egui/locales/it.toml +++ b/crates/ui-egui/locales/it.toml @@ -1861,6 +1861,7 @@ status = "draft — needs native review" "component.combineVariants" = "Combina come varianti" "component.create" = "Crea componente" "component.createMultiple" = "Crea più componenti" +"component.createSet" = "Crea set di componenti" "component.deleteProperty" = "Elimina proprietà del componente" "component.detach" = "Scollega istanza" "component.editProperty" = "Modifica proprietà del componente" diff --git a/crates/ui-egui/locales/ja.toml b/crates/ui-egui/locales/ja.toml index 5a8918a20..c53b03e25 100644 --- a/crates/ui-egui/locales/ja.toml +++ b/crates/ui-egui/locales/ja.toml @@ -1938,6 +1938,7 @@ status = "draft — needs native review" "component.combineVariants" = "バリアントとして結合" "component.create" = "コンポーネントを作成" "component.createMultiple" = "複数のコンポーネントを作成" +"component.createSet" = "コンポーネントセットを作成" "component.deleteProperty" = "コンポーネントプロパティを削除" "component.detach" = "インスタンスを切り離す" "component.editProperty" = "コンポーネントプロパティを編集" diff --git a/crates/ui-egui/locales/ka.toml b/crates/ui-egui/locales/ka.toml index 2af58f385..fa681b9fd 100644 --- a/crates/ui-egui/locales/ka.toml +++ b/crates/ui-egui/locales/ka.toml @@ -2013,6 +2013,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "component.combineVariants" = "ვარიანტებად გაერთიანება" "component.create" = "კომპონენტის შექმნა" "component.createMultiple" = "რამდენიმე კომპონენტის შექმნა" +"component.createSet" = "კომპონენტების ნაკრების შექმნა" "component.deleteProperty" = "კომპონენტის თვისების წაშლა" "component.detach" = "ინსტანსის გამოყოფა" "component.editProperty" = "კომპონენტის თვისების რედაქტირება" diff --git a/crates/ui-egui/locales/ko.toml b/crates/ui-egui/locales/ko.toml index ebea678d1..6b5a39b60 100644 --- a/crates/ui-egui/locales/ko.toml +++ b/crates/ui-egui/locales/ko.toml @@ -1978,6 +1978,7 @@ status = "draft — needs native review" "component.combineVariants" = "배리언트로 결합" "component.create" = "컴포넌트 만들기" "component.createMultiple" = "여러 컴포넌트 만들기" +"component.createSet" = "컴포넌트 세트 만들기" "component.deleteProperty" = "컴포넌트 속성 삭제" "component.detach" = "인스턴스 분리" "component.editProperty" = "컴포넌트 속성 편집" diff --git a/crates/ui-egui/locales/nl.toml b/crates/ui-egui/locales/nl.toml index e43d40b5e..a1d39c7fd 100644 --- a/crates/ui-egui/locales/nl.toml +++ b/crates/ui-egui/locales/nl.toml @@ -1956,6 +1956,7 @@ status = "draft — needs native review" "component.combineVariants" = "Combineren als varianten" "component.create" = "Component maken" "component.createMultiple" = "Meerdere componenten maken" +"component.createSet" = "Componentenset maken" "component.deleteProperty" = "Componenteigenschap verwijderen" "component.detach" = "Instance loskoppelen" "component.editProperty" = "Componenteigenschap bewerken" diff --git a/crates/ui-egui/locales/pl.toml b/crates/ui-egui/locales/pl.toml index 68fe136d7..c479cd1be 100644 --- a/crates/ui-egui/locales/pl.toml +++ b/crates/ui-egui/locales/pl.toml @@ -1969,6 +1969,7 @@ name = "Polski" "component.combineVariants" = "Połącz jako warianty" "component.create" = "Utwórz komponent" "component.createMultiple" = "Utwórz wiele komponentów" +"component.createSet" = "Utwórz zestaw komponentów" "component.deleteProperty" = "Usuń właściwość komponentu" "component.detach" = "Odłącz instancję" "component.editProperty" = "Edytuj właściwość komponentu" diff --git a/crates/ui-egui/locales/pt-BR.toml b/crates/ui-egui/locales/pt-BR.toml index c2ccba835..efcde47fe 100644 --- a/crates/ui-egui/locales/pt-BR.toml +++ b/crates/ui-egui/locales/pt-BR.toml @@ -1975,6 +1975,7 @@ status = "draft — needs native review" "component.combineVariants" = "Combinar como variantes" "component.create" = "Criar componente" "component.createMultiple" = "Criar vários componentes" +"component.createSet" = "Criar conjunto de componentes" "component.deleteProperty" = "Excluir propriedade de componente" "component.detach" = "Desvincular instância" "component.editProperty" = "Editar propriedade de componente" diff --git a/crates/ui-egui/locales/ru.toml b/crates/ui-egui/locales/ru.toml index 01e1d86ac..97980eaed 100644 --- a/crates/ui-egui/locales/ru.toml +++ b/crates/ui-egui/locales/ru.toml @@ -1969,6 +1969,7 @@ name = "Русский" "component.combineVariants" = "Объединить в варианты" "component.create" = "Создать компонент" "component.createMultiple" = "Создать несколько компонентов" +"component.createSet" = "Создать набор компонентов" "component.deleteProperty" = "Удалить свойство компонента" "component.detach" = "Отсоединить экземпляр" "component.editProperty" = "Изменить свойство компонента" diff --git a/crates/ui-egui/locales/sv.toml b/crates/ui-egui/locales/sv.toml index a94feb2a9..0a97701f8 100644 --- a/crates/ui-egui/locales/sv.toml +++ b/crates/ui-egui/locales/sv.toml @@ -2076,6 +2076,7 @@ name = "Svenska" "component.combineVariants" = "Kombinera som varianter" "component.create" = "Skapa komponent" "component.createMultiple" = "Skapa flera komponenter" +"component.createSet" = "Skapa komponentuppsättning" "component.deleteProperty" = "Radera komponentegenskap" "component.detach" = "Koppla bort instans" "component.editProperty" = "Redigera komponentegenskap" diff --git a/crates/ui-egui/locales/th.toml b/crates/ui-egui/locales/th.toml index 81b581ce0..d5e98915f 100644 --- a/crates/ui-egui/locales/th.toml +++ b/crates/ui-egui/locales/th.toml @@ -1934,6 +1934,7 @@ status = "draft — needs native review" "component.combineVariants" = "รวมเป็นแวเรียนต์" "component.create" = "สร้างคอมโพเนนต์" "component.createMultiple" = "สร้างหลายคอมโพเนนต์" +"component.createSet" = "สร้างชุดคอมโพเนนต์" "component.deleteProperty" = "ลบพร็อพเพอร์ตีของคอมโพเนนต์" "component.detach" = "ถอดอินสแตนซ์" "component.editProperty" = "แก้ไขพร็อพเพอร์ตีของคอมโพเนนต์" diff --git a/crates/ui-egui/locales/tr.toml b/crates/ui-egui/locales/tr.toml index b07d25462..25bf777ce 100644 --- a/crates/ui-egui/locales/tr.toml +++ b/crates/ui-egui/locales/tr.toml @@ -1917,6 +1917,7 @@ name = "Türkçe" "component.combineVariants" = "Varyant olarak birleştir" "component.create" = "Bileşen oluştur" "component.createMultiple" = "Birden çok bileşen oluştur" +"component.createSet" = "Bileşen kümesi oluştur" "component.deleteProperty" = "Bileşen özelliğini sil" "component.detach" = "Örneği ayır" "component.editProperty" = "Bileşen özelliğini düzenle" diff --git a/crates/ui-egui/locales/vi.toml b/crates/ui-egui/locales/vi.toml index 9a4d600fe..98420ba48 100644 --- a/crates/ui-egui/locales/vi.toml +++ b/crates/ui-egui/locales/vi.toml @@ -1862,6 +1862,7 @@ status = "draft — needs native review" "component.combineVariants" = "Kết hợp thành các biến thể" "component.create" = "Tạo thành phần" "component.createMultiple" = "Tạo nhiều thành phần" +"component.createSet" = "Tạo bộ thành phần" "component.deleteProperty" = "Xóa thuộc tính thành phần" "component.detach" = "Tách bản thể" "component.editProperty" = "Chỉnh sửa thuộc tính thành phần" diff --git a/crates/ui-egui/locales/zh-Hans.toml b/crates/ui-egui/locales/zh-Hans.toml index b48345acc..7d6bfb0b7 100644 --- a/crates/ui-egui/locales/zh-Hans.toml +++ b/crates/ui-egui/locales/zh-Hans.toml @@ -1871,6 +1871,7 @@ status = "draft — needs native review" "component.combineVariants" = "合并为变体" "component.create" = "创建组件" "component.createMultiple" = "创建多个组件" +"component.createSet" = "创建组件集" "component.deleteProperty" = "删除组件属性" "component.detach" = "分离实例" "component.editProperty" = "编辑组件属性" diff --git a/crates/ui-egui/locales/zh-Hant.toml b/crates/ui-egui/locales/zh-Hant.toml index f14698b00..59b9064de 100644 --- a/crates/ui-egui/locales/zh-Hant.toml +++ b/crates/ui-egui/locales/zh-Hant.toml @@ -2089,6 +2089,7 @@ status = "draft — needs native review" "component.combineVariants" = "合併為變體" "component.create" = "建立元件" "component.createMultiple" = "建立多個元件" +"component.createSet" = "建立元件集" "component.deleteProperty" = "刪除元件屬性" "component.detach" = "分離實例" "component.editProperty" = "編輯元件屬性" From 9c3949fc927d3b4696d90313f36511ffc9c17ef2 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 22:50:11 -0500 Subject: [PATCH 029/239] Variables: Edit variables is offered only when it can open; tests for the bulk editor's paths (#2089 review) The bulk menu already offers Edit variables only for two or more editable, non-inherited variables, so the editor's early close is just a safety net (now commented); a test pins that inherited selections get no entry. A checkbox is already keyboard-operable (Tab, then Space or Enter), pinned by a test. tri() of an empty list is now unchecked. New tests: All supported properties on and off, clearing a checked scope, booleans sharing no scope, mixed-type common scopes, and the painted dash versus tick. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/ui-egui/src/a11y_tests.rs | 61 ++++++++++ crates/ui-egui/src/dialogs/variables_panel.rs | 13 +++ crates/ui-egui/src/variables_select_tests.rs | 105 ++++++++++++++++++ 3 files changed, 179 insertions(+) diff --git a/crates/ui-egui/src/a11y_tests.rs b/crates/ui-egui/src/a11y_tests.rs index 2f0fb5a48..941f5854b 100644 --- a/crates/ui-egui/src/a11y_tests.rs +++ b/crates/ui-egui/src/a11y_tests.rs @@ -447,3 +447,64 @@ fn a_mixed_checkbox_is_announced_as_mixed_and_a_checked_one_as_true() { assert_eq!(find(&nodes, Role::CheckBox, "Checked one").toggled(), Some(Toggled::True)); assert_eq!(find(&nodes, Role::CheckBox, "Plain one").toggled(), Some(Toggled::False)); } + +/// Runs one headless frame of a lone tri-state checkbox; returns whether it was clicked. +fn tri_frame(ctx: &egui::Context, state: Option, events: Vec) -> bool { + let mut clicked = false; + let input = egui::RawInput { events, ..Default::default() }; + let mut out = ctx.run_ui(input, |ui| { + clicked = crate::widgets::checkbox_tri(ui, state, "Keyed one"); + }); + out.textures_delta.clear(); + clicked +} + +fn key(key: Key, pressed: bool) -> Event { + Event::Key { key, physical_key: None, pressed, repeat: false, modifiers: Modifiers::NONE } +} + +#[test] +fn a_checkbox_is_keyboard_operable_tab_to_it_then_space_or_enter_toggles_it() { + for activate in [Key::Space, Key::Enter] { + let ctx = egui::Context::default(); + tri_frame(&ctx, Some(false), vec![]); + tri_frame(&ctx, Some(false), vec![key(Key::Tab, true), key(Key::Tab, false)]); + assert!(ctx.memory(|m| m.focused()).is_some(), "Tab focuses the checkbox"); + tri_frame(&ctx, Some(false), vec![]); + let clicked = tri_frame(&ctx, Some(false), vec![key(activate, true), key(activate, false)]); + assert!(clicked, "{activate:?} on the focused checkbox toggles it"); + } +} + +/// The marks (paths, meshes, segments) painted inside the 14-point box of a lone checkbox. +fn box_marks(state: Option) -> Vec { + fn walk(s: &egui::Shape, out: &mut Vec) { + match s { + egui::Shape::Vec(v) => v.iter().for_each(|s| walk(s, out)), + egui::Shape::Path(_) | egui::Shape::Mesh(_) | egui::Shape::LineSegment { .. } => out.push(s.visual_bounding_rect()), + _ => {} + } + } + let ctx = egui::Context::default(); + let mut out = Vec::new(); + for _ in 0..2 { + let mut o = ctx.run_ui(egui::RawInput::default(), |ui| { + crate::widgets::checkbox_tri(ui, state, "Painted one"); + }); + o.textures_delta.clear(); + out.clear(); + o.shapes.iter().for_each(|c| walk(&c.shape, &mut out)); + } + out +} + +#[test] +fn a_mixed_checkbox_paints_a_dash_and_a_checked_one_a_tick() { + // Icon::Minus is one flat bar; Icon::Check is a taller path. + let mixed = box_marks(None); + assert!(mixed.iter().any(|r| r.width() >= 5.0 && r.height() <= 2.5), "a flat dash is painted for the mixed state: {mixed:?}"); + let checked = box_marks(Some(true)); + assert!(checked.iter().any(|r| r.width() >= 5.0 && r.height() > 3.5), "a tick is painted for the checked state: {checked:?}"); + assert!(!checked.iter().any(|r| r.width() >= 5.0 && r.height() <= 2.5), "no dash on a checked box: {checked:?}"); + assert!(box_marks(Some(false)).is_empty(), "an empty box paints no mark"); +} diff --git a/crates/ui-egui/src/dialogs/variables_panel.rs b/crates/ui-egui/src/dialogs/variables_panel.rs index 4e1219591..4367ac610 100644 --- a/crates/ui-egui/src/dialogs/variables_panel.rs +++ b/crates/ui-egui/src/dialogs/variables_panel.rs @@ -1189,7 +1189,11 @@ fn details(app: &mut FigApp, ctx: &Context, vars: &Variables, st: &mut Editor) { } /// Whether `f` holds for every variable (Some(true)), for none (Some(false)) or only some (None). +/// With no variables nothing is on: Some(false), never a checked box for an empty list. fn tri(vars: &[&T], f: impl Fn(&T) -> bool) -> Option { + if vars.is_empty() { + return Some(false); + } let on = vars.iter().filter(|v| f(v)).count(); if on == vars.len() { Some(true) @@ -1208,6 +1212,9 @@ fn bulk_details(app: &mut FigApp, ctx: &Context, vars: &Variables, st: &mut Edit return; } let list: Vec<&Variable> = st.bulk_edit.iter().filter_map(|id| vars.get_by_id(id)).filter(|v| v.extends.is_none()).collect(); + // The menu offers Edit variables only for two or more editable, non-inherited variables of a + // file collection (`bulk_ids`), so this closes only when they have since gone (deleted, + // undone) or a library was opened: there is nothing left to edit. if list.is_empty() || st.library.is_some() { st.bulk_edit.clear(); return; @@ -1285,6 +1292,12 @@ mod tests { assert_eq!(tri(&[&a, &b], |v| *v), None); } + #[test] + fn tri_of_no_variables_is_not_checked() { + let none: [&bool; 0] = []; + assert_eq!(tri(&none, |v| *v), Some(false)); + } + #[test] fn groups_include_parents_once_and_sorted() { let names = ["space/sm", "space/md", "color/brand/blue", "color/text", "plain", "color/brand/red"]; diff --git a/crates/ui-egui/src/variables_select_tests.rs b/crates/ui-egui/src/variables_select_tests.rs index f27aa3114..1ae91bd57 100644 --- a/crates/ui-egui/src/variables_select_tests.rs +++ b/crates/ui-egui/src/variables_select_tests.rs @@ -317,3 +317,108 @@ fn edit_variables_hides_all_selected_from_publishing_in_one_undo_step() { u.app.session.undo().unwrap(); assert!(flags(&u).iter().all(|f| !f.0)); } + +/// Bravo, charlie and delta of the given types (a value fitting each). +fn typed_window(types: [&str; 3]) -> Ui { + let mut s = Session::new(); + s.execute("variable.createCollection", &json!({"name": "Theme"})).unwrap(); + for (n, t) in ["bravo", "charlie", "delta"].into_iter().zip(types) { + let value = match t { + "number" => json!(1), + "boolean" => json!(true), + "string" => json!("x"), + _ => json!("#ff0000"), + }; + s.execute("variable.create", &json!({"collection": "Theme", "name": n, "type": t, "value": value})).unwrap(); + } + let mut u = Ui::new(s); + u.app.ui.variables = Some(Default::default()); + for _ in 0..10 { + u.frame(vec![]); + } + u +} + +fn scope_tab(u: &mut Ui) -> Vec { + let shapes = open_edit_variables(u); + click(u, text_center(&shapes, "Scope"), PointerButton::Primary, Modifiers::NONE); + flat(&u.frame_output(vec![]).shapes) +} + +fn scopes(u: &Ui) -> Vec>> { + let doc = u.app.session.doc().unwrap(); + ["bravo", "charlie", "delta"].iter().map(|n| doc.variables.variables.iter().find(|v| v.name == *n).unwrap().scopes.clone()).collect() +} + +#[test] +fn all_supported_properties_turns_on_for_every_selected_variable_and_off_again_one_undo_step_each() { + let mut u = colour_window(); + let shapes = scope_tab(&mut u); + assert!(scopes(&u).iter().all(|s| s.is_some()), "each variable starts limited"); + let before = u.app.session.undo_labels(100).len(); + click(&mut u, text_center(&shapes, "All supported properties"), PointerButton::Primary, Modifiers::NONE); + assert!(u.app.ui.last_error.is_none(), "{:?}", u.app.ui.last_error); + assert!(scopes(&u).iter().all(|s| s.is_none()), "on: no variable is limited: {:?}", scopes(&u)); + assert_eq!(u.app.session.undo_labels(100).len(), before + 1, "one undo step"); + let shapes = flat(&u.frame_output(vec![]).shapes); + click(&mut u, text_center(&shapes, "All supported properties"), PointerButton::Primary, Modifiers::NONE); + assert!(u.app.ui.last_error.is_none(), "{:?}", u.app.ui.last_error); + assert!(scopes(&u).iter().all(|s| s.as_ref().is_some_and(|l| l.is_empty())), "off: hidden from pickers: {:?}", scopes(&u)); + assert_eq!(u.app.session.undo_labels(100).len(), before + 2, "one undo step each"); +} + +#[test] +fn clicking_a_checked_scope_clears_it_on_every_selected_variable_in_one_undo_step() { + let mut u = colour_window(); + let shapes = scope_tab(&mut u); + let before = u.app.session.undo_labels(100).len(); + // Frame fill is on for all three: checked, so the click clears it. + click(&mut u, text_center(&shapes, "Frame fill"), PointerButton::Primary, Modifiers::NONE); + assert!(u.app.ui.last_error.is_none(), "{:?}", u.app.ui.last_error); + let doc = u.app.session.doc().unwrap(); + assert!(["bravo", "charlie", "delta"].iter().all(|n| !doc.variables.variables.iter().find(|v| v.name == *n).unwrap().in_scope("FRAME_FILL"))); + assert_eq!(flags(&u), [(false, true), (false, true), (false, false)], "the other scopes stay"); + assert_eq!(u.app.session.undo_labels(100).len(), before + 1, "one undo step"); + u.app.session.undo().unwrap(); + assert!(scopes(&u).iter().all(|s| s.as_ref().is_some_and(|l| l.iter().any(|x| x == "FRAME_FILL")))); +} + +#[test] +fn booleans_share_no_scope_and_the_scope_tab_says_so() { + let mut u = typed_window(["boolean", "boolean", "boolean"]); + let shapes = scope_tab(&mut u); + assert!(has_text(&shapes, "No scope is shared by all the selected variables")); + assert!(!has_text(&shapes, "All supported properties")); +} + +#[test] +fn mixed_types_list_only_the_scopes_every_type_has() { + // Number and string share only Text content; a colour shares nothing with them. + let mut u = typed_window(["number", "number", "string"]); + let shapes = scope_tab(&mut u); + assert!(has_text(&shapes, "Text content"), "the shared scope is shown"); + for other in ["Corner radius", "Font family", "Font size"] { + assert!(!has_text(&shapes, other), "{other} is not common"); + } + assert!(!has_text(&shapes, "No scope is shared by all the selected variables")); + let mut u = typed_window(["number", "color", "string"]); + let shapes = scope_tab(&mut u); + assert!(has_text(&shapes, "No scope is shared by all the selected variables")); +} + +#[test] +fn edit_variables_is_not_offered_when_every_selected_variable_is_inherited() { + let mut u = window(); + u.app.session.execute("variable.extendCollection", &json!({"collection": "Theme"})).unwrap(); + u.app.ui.variables = Some(crate::dialogs::variables_panel::Editor::on(Some("Theme (extended)".into()))); + for _ in 0..10 { + u.frame(vec![]); + } + click_row(&mut u, "bravo", Modifiers::NONE); + click_row(&mut u, "delta", SHIFT); + assert_eq!(selected(&u), ["bravo", "charlie", "delta"]); + let p = row(&mut u, "delta"); + click(&mut u, p, PointerButton::Secondary, Modifiers::NONE); + let menu = flat(&u.frame_output(vec![]).shapes); + assert!(!has_text(&menu, "Edit variables"), "inherited variables are edited in their own collection"); +} From ad7a886e3cb2a722b37dc6779b6e7a3fa5cdf72e Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 23:17:00 -0500 Subject: [PATCH 030/239] Panels: the sidebars' width limits are Figma's (left 240 to 450, right 240 to 500) Measured in Figma's web app: left sidebar 240 default, 240 min, 450 max; right 240 default, 240 min, 500 max; a double-click on the edge resets. FigCraft had left 200 to 480 and right 240 to 480. Widths saved under the old limits are now clamped when the app starts, not only when drawn. The narrow-window give-way (canvas keeps 160 px) is unchanged, with the new 240 floor. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/ui-egui/src/app.rs | 3 +++ crates/ui-egui/src/panel_width_tests.rs | 26 +++++++++++++++++++++++-- crates/ui-egui/src/state.rs | 7 ++++--- docs/ui-parity.md | 3 ++- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 1290f4d5b..9b603c90e 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -22,7 +22,10 @@ impl FigApp { /// state. pub fn new(session: Session, services: Box) -> Self { // The main window's panels open as wide as they were left. + // Widths saved under other limits are clamped to the current ones, not rejected. let (left_width, right_width) = session.prefs.panel_widths; + let within = |w: f32, range: std::ops::RangeInclusive| if w.is_finite() { w.clamp(*range.start(), *range.end()) } else { PANEL_DEFAULT }; + let (left_width, right_width) = (within(left_width, LEFT_PANEL), within(right_width, RIGHT_PANEL)); let pages_height = session.prefs.pages_height; Self { ui: UiState { left_width, right_width, pages_height, ..UiState::default() }, diff --git a/crates/ui-egui/src/panel_width_tests.rs b/crates/ui-egui/src/panel_width_tests.rs index 8c6da05c9..dd8906311 100644 --- a/crates/ui-egui/src/panel_width_tests.rs +++ b/crates/ui-egui/src/panel_width_tests.rs @@ -78,7 +78,15 @@ fn panels_fit_the_window() { ((744.0, None, Some(480.0)), (0.0, 480.0), "with the left panel closed the right one has room"), ((300.0, Some(240.0), Some(240.0)), (l0, r0), "a window smaller than any layout: the least widths"), ((1384.0, Some(f32::NAN), Some(f32::INFINITY)), (PANEL_DEFAULT, PANEL_DEFAULT), "junk widths: the default"), - ((744.0, Some(480.0), None), (480.0, 0.0), "the right panel closed (a board's): the left one keeps its width"), + ((744.0, Some(480.0), None), (l1, 0.0), "the right panel closed (a board's): the left one keeps as much of its width as it may"), + ((744.0, Some(450.0), None), (450.0, 0.0), "the right panel closed: the left one at its most"), + ((1384.0, Some(200.0), Some(480.0)), (l0, 480.0), "a stored left width under 240 (the old limit was 200) is brought up to 240"), + ((1384.0, Some(470.0), Some(520.0)), (l1, r1), "stored widths over the limits (the old ones were 480) are brought down to 450 and 500"), + ( + (744.0, Some(300.0), Some(500.0)), + (240.0, 344.0), + "the smallest window with the right panel at its most: the right gives way last, the left to its 240 floor", + ), ]; for ((avail, left, right), want, why) in rows { assert_eq!(fit_panels(avail, left, right), want, "{why}"); @@ -122,14 +130,17 @@ fn dragging_an_edge_sizes_its_panel_within_its_limits_and_keeps_the_views_centre let (left, right) = edges(&u); drag(&mut u, pos2(left, 300.0), pos2(left + 700.0, 300.0)); assert_eq!(widths(&u).0, *LEFT_PANEL.end()); + assert_eq!(widths(&u).0, 450.0, "Figma's left sidebar stops at 450"); let (left, _) = edges(&u); drag(&mut u, pos2(left, 300.0), pos2(20.0, 300.0)); assert_eq!(widths(&u).0, *LEFT_PANEL.start()); + assert_eq!(widths(&u).0, 240.0, "and at 240 the other way"); drag(&mut u, pos2(right, 300.0), pos2(right + 500.0, 300.0)); assert_eq!(widths(&u).1, *RIGHT_PANEL.start()); let (_, right) = edges(&u); u.drag_to(pos2(right, 300.0), pos2(right - 900.0, 300.0)); assert_eq!(widths(&u).1, *RIGHT_PANEL.end(), "at its most while the pointer is past it"); + assert_eq!(widths(&u).1, 500.0, "Figma's right sidebar stops at 500"); u.frame(vec![Event::PointerMoved(pos2(right - 100.0, 300.0))]); assert_eq!(widths(&u).1, *RIGHT_PANEL.start() + 100.0, "back with the pointer"); u.button(pos2(right - 100.0, 300.0), false); @@ -187,6 +198,17 @@ fn the_widths_come_back_with_the_preferences() { u.frame(vec![]); let (left, right) = edges(&u); assert_eq!((left, 1440.0 - right), (56.0 + *LEFT_PANEL.start(), PANEL_DEFAULT)); + // Widths saved under the old limits (left 200 to 480, right up to 480) or over the new ones + // are clamped when loaded, not rejected. + for (stored, want) in + [((200.0, 240.0), (240.0, 240.0)), ((239.0, 500.0), (240.0, 500.0)), ((451.0, 480.0), (450.0, 480.0)), ((480.0, 600.0), (450.0, 500.0))] + { + let mut s = Session::new(); + s.prefs.panel_widths = stored; + let mut u = Ui::new(s); + u.frame(vec![]); + assert_eq!(widths(&u), want, "stored {stored:?}"); + } } #[test] @@ -264,7 +286,7 @@ fn minimize_collapses_the_rail_and_both_sidebars_and_the_right_one_follows_the_s #[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)] { + for asked in [(240.0, 240.0), (450.0, 500.0), (450.0, 240.0), (240.0, 500.0)] { let mut s = Session::new(); s.prefs.panel_widths = asked; let ctx = egui::Context::default(); diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 6480983f5..7e6b9aa3f 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -27,10 +27,11 @@ pub enum TitleBar { pub type AutoSaveEncoding = std::thread::JoinHandle<(figcraft_engine::cmd::file::FileSnapshot, figcraft_engine::Result>)>; /// The side panels' widths: the least and most a drag of their edge gives, what a double-click on -/// the edge puts back, and how much of the window they leave the canvas. -pub const LEFT_PANEL: std::ops::RangeInclusive = 200.0..=480.0; +/// the edge puts back, and how much of the window they leave the canvas. The limits are Figma's, +/// measured in the web app: left 240 to 450, right 240 to 500, both 240 by default. +pub const LEFT_PANEL: std::ops::RangeInclusive = 240.0..=450.0; -pub const RIGHT_PANEL: std::ops::RangeInclusive = 240.0..=480.0; +pub const RIGHT_PANEL: std::ops::RangeInclusive = 240.0..=500.0; pub const PANEL_DEFAULT: f32 = 240.0; diff --git a/docs/ui-parity.md b/docs/ui-parity.md index aa0ef25bd..dc1d0e387 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -20,7 +20,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 | rail and tab strip icons 20 pt (#553); 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 (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 | +| Resizable panels | done | each panel's edge drags its width (left 240–450, right 240–500, 240 by default, as measured in Figma's web app on 2026-11-08 (`plan/loop/measurements/scrub-and-panels.md`); 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 width saved under other limits is clamped to the current ones on load), 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`). The double-click reset to 240 matches Figma's; 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 | | Context menus | done | canvas and layers; submenus as in the main menu below, and a right-click in a new spot starts a fresh menu (Select layer closed); Shift+F10 or the keyboard's Menu key opens them from the keyboard (at the focused layer row or below the canvas selection) and the menu takes the keyboard (`layers_keyboard_tests`) | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-07 | patch | Panels: the sidebars' width limits are Figma's, measured in its web app (left 240 to 450, right 240 to 500, both 240 by default, a double-click on the edge resets), where FigCraft had left 200 to 480 and right 240 to 480; widths saved under the old limits are clamped on load | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 0fec344f3cc1cc439808aed4781390f9ca76123c Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 23:38:58 -0500 Subject: [PATCH 031/239] M8: copy, cut and paste in vector edit mode act on the selected points and segments (#1875) Measured in Figma: in vector edit mode Copy takes only the selected segments (a lone point, the segments touching it) and a paste outside makes a new vector in place; Cut removes them, splitting the path in the same layer and staying in edit mode; Paste while editing adds the clipboard's segments or a copied layer's outline to the vector's network in place, selecting them. FigCraft copied the whole layer, Cut left nothing to paste, and Paste while editing did nothing. 16 new engine and UI tests cover copy, cut, paste, undo and junk parameters; the whole engine suite passes bar the known font test. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at high --- crates/engine/src/canvas/vectoredit.rs | 2 +- crates/engine/src/cmd/edit.rs | 21 +- crates/engine/src/cmd/edit/clipboard.rs | 62 +++- .../engine/src/cmd/edit/vector_clipboard.rs | 274 +++++++++++++++ .../src/cmd/edit/vector_clipboard_tests.rs | 324 ++++++++++++++++++ crates/ui-egui/src/menus.rs | 10 +- crates/ui-egui/src/shortcuts.rs | 13 +- crates/ui-egui/src/vector_keys_tests.rs | 12 + docs/ui-parity.md | 5 +- 9 files changed, 701 insertions(+), 22 deletions(-) create mode 100644 crates/engine/src/cmd/edit/vector_clipboard.rs create mode 100644 crates/engine/src/cmd/edit/vector_clipboard_tests.rs diff --git a/crates/engine/src/canvas/vectoredit.rs b/crates/engine/src/canvas/vectoredit.rs index 4f265e0f5..749e246c0 100644 --- a/crates/engine/src/canvas/vectoredit.rs +++ b/crates/engine/src/canvas/vectoredit.rs @@ -638,7 +638,7 @@ fn index(cmd: &str, p: &Value, key: &str) -> Result { } /// Delete the points and segments of `parts` (`heal` keeps paths through deleted points closed). -fn delete_selection(s: &mut Session, parts: Vec, heal: bool) -> Result<()> { +pub(crate) fn delete_selection(s: &mut Session, parts: Vec, heal: bool) -> Result<()> { let doc = s.doc_mut()?; for EditPart { id, vertices: verts, segments: segs } in parts { edit(doc, id, |net| { diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index efcb0fc52..19a7d7011 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -17,6 +17,9 @@ mod clipboard; mod props; pub(crate) use props::{edit_region_fills, fill_regions}; mod select; +mod vector_clipboard; +#[cfg(test)] +mod vector_clipboard_tests; pub(crate) use clipboard::apply_copied_props; pub use clipboard::{CLIP_CLOSE, CLIP_OPEN, copy_to_clipboard, design_clipboard_buffer, paste_into}; @@ -117,12 +120,24 @@ pub fn specs() -> Vec { true, duplicate ), - spec!("edit.copy", "Copy", "{ids?}", false, copy), - spec!("edit.cut", "Cut", "{ids?}", true, cut), + spec!( + "edit.copy", + "Copy", + "{ids?} in vector edit mode with points or segments selected (and no ids): just those, the segments touching a selected point, as a new vector with the edited layer's look", + false, + copy + ), + spec!( + "edit.cut", + "Cut", + "{ids?} in vector edit mode with points or segments selected (and no ids): copies them as Copy does, then removes them as Delete does; the path splits in the same layer and edit mode stays on", + true, + cut + ), spec!( "edit.paste", "Paste", - "{parent?, x?, y? (page coordinates of the pasted top-left)} a copied main component pastes as an instance of it within its file (cut ones, and pastes into other files, keep the component)", + "{parent?, x?, y? (page coordinates of the pasted top-left)} in vector edit mode (and no parent): the copied vectors' segments and shapes' outlines join the edited vector's network in place, selected, and the layers that have no outline (text, frames, groups) are skipped (`skipped`); a copied main component pastes as an instance of it within its file (cut ones, and pastes into other files, keep the component)", true, paste ), diff --git a/crates/engine/src/cmd/edit/clipboard.rs b/crates/engine/src/cmd/edit/clipboard.rs index 150a3b577..da5089419 100644 --- a/crates/engine/src/cmd/edit/clipboard.rs +++ b/crates/engine/src/cmd/edit/clipboard.rs @@ -1,6 +1,6 @@ use super::{ - Affine, BTreeMap, BTreeSet, Document, EngineError, ImageData, Node, NodeId, NodeKind, Result, Session, Value, bad, delete, id, json, num, ok, - req_targets, roots, string, targets, z_sorted, + Affine, BTreeMap, BTreeSet, Document, EngineError, ImageData, Node, NodeId, NodeKind, Result, Session, Value, bad, delete, get, id, json, num, + ok, req_targets, roots, string, targets, vector_clipboard, z_sorted, }; /// The copied form of the selection. @@ -12,6 +12,18 @@ pub fn copy_to_clipboard(s: &mut Session, cmd: &str, ids: &[NodeId]) -> Result<( return Err(EngineError::Disabled(cmd.into(), "pages can't be copied; use page.duplicate".into())); } let (nodes, images, bounds) = copied(&ds.doc, &layers); + store_clipboard(s, cmd, nodes, images, bounds) +} + +/// Make `nodes` (the copied layers, each root's transform in page space) the clipboard's layers. +pub(super) fn store_clipboard( + s: &mut Session, + cmd: &str, + nodes: Vec<(NodeId, Vec)>, + images: BTreeMap, + bounds: Option, +) -> Result<()> { + let ds = s.ds()?; let (source, source_path, uid) = (ds.doc.clone(), ds.path.clone(), ds.uid); s.clipboard.source = Some(source); s.clipboard.source_path = source_path; @@ -43,21 +55,26 @@ fn copied(doc: &Document, ids: &[NodeId]) -> Copied { if let Some(r) = sub.first_mut() { r.transform = world; } - for n in &sub { - for p in n.fills.iter().chain(n.strokes.iter()) { - if let figcraft_color::PaintKind::Image(img) = &p.kind - && let Some(d) = doc.images.get(&img.image) - { - images.insert(img.image.clone(), d.clone()); - } - } - } + collect_images(doc, &sub, &mut images); nodes.push((*i, sub)); } let bounds = doc.bounds_of(&ids); (nodes, images, bounds) } +/// The images the paints of `nodes` use, taken from `doc` into `images`. +pub(super) fn collect_images(doc: &Document, nodes: &[Node], images: &mut BTreeMap) { + for n in nodes { + for p in n.fills.iter().chain(n.strokes.iter()) { + if let figcraft_color::PaintKind::Image(img) = &p.kind + && let Some(d) = doc.images.get(&img.image) + { + images.insert(img.image.clone(), d.clone()); + } + } + } +} + /// The markers around the copied layers in the clipboard's HTML, spelt as that format spells them. pub const CLIP_OPEN: &str = "(figma)"; @@ -167,13 +184,32 @@ fn layers_missing_images(doc: &figcraft_doc::Document, ids: &[NodeId]) -> Vec bool { + get(p, "ids").is_some() || get(p, "id").is_some() +} + pub(super) fn copy(s: &mut Session, p: &Value) -> Result { + // In vector edit mode with points or segments selected, Copy takes just those (#1875). + if !names_layers(p) + && let Some(sel) = vector_clipboard::edit_selection(s) + && !sel.parts.is_empty() + { + return vector_clipboard::copy_selection(s, "edit.copy", sel); + } let ids = req_targets("edit.copy", s, p)?; copy_to_clipboard(s, "edit.copy", &ids)?; Ok(json!({"copied": s.clipboard.nodes.len()})) } pub(super) fn cut(s: &mut Session, p: &Value) -> Result { + // In vector edit mode with points or segments selected, Cut takes just those and stays in edit mode (#1875). + if !names_layers(p) + && let Some(sel) = vector_clipboard::edit_selection(s) + && sel.any + { + return vector_clipboard::cut_selection(s, sel); + } let ids = req_targets("edit.cut", s, p)?; copy_to_clipboard(s, "edit.cut", &ids)?; let doc = s.doc()?; @@ -238,6 +274,10 @@ pub fn paste_into(s: &mut Session, parent: NodeId, at: Option<(f64, f64)>) -> Re } pub(super) fn paste(s: &mut Session, p: &Value) -> Result { + // While editing a vector, the copied layers join its network (#1875); `parent` asks for layers. + if id(p, "parent").is_none() && s.ds()?.vector_edit.is_some() { + return vector_clipboard::paste_into_vector(s, p); + } let page = s.page()?; // Figma pastes into the selected frame (if one is selected), at the same position when it fits, // else in the frame's centre; otherwise in place on the page (or the viewport centre). diff --git a/crates/engine/src/cmd/edit/vector_clipboard.rs b/crates/engine/src/cmd/edit/vector_clipboard.rs new file mode 100644 index 000000000..d9efea269 --- /dev/null +++ b/crates/engine/src/cmd/edit/vector_clipboard.rs @@ -0,0 +1,274 @@ +//! Copy, cut and paste in vector edit mode (#1875). +//! +//! With points or segments selected, Copy and Cut take just those: a temporary vector holding the +//! selected segments (and the segments touching a selected point) goes on the ordinary layer +//! clipboard, kept at its place on the page, so a paste outside edit mode is a plain layer paste +//! in place. Cut then removes the selection the way Delete does and stays in edit mode. Paste +//! while editing adds the clipboard's layers to the edited vector's network, in place: a vector +//! with its segments, a shape or boolean with its outline. + +use figcraft_doc::{NodeKind, Region, VectorNetwork}; + +use super::clipboard::{collect_images, store_clipboard}; +use super::{Affine, BTreeMap, BTreeSet, Document, EngineError, Node, NodeId, Result, Session, Value, json, num}; +use crate::canvas::vectoredit::{self, EditPart}; + +/// The most segments a vector network takes through a paste. +const MAX_SEGMENTS: usize = 500_000; + +/// What the edited layers have selected. +pub(super) struct EditSelection { + /// Whether any edited layer has a point or a segment selected. + pub any: bool, + /// Each edited layer with something to copy, and the sub-network that is. + pub parts: Vec<(NodeId, VectorNetwork)>, +} + +/// The selection of the vector being edited (and the other layers edited with it), or `None` when +/// not in vector edit mode. +pub(super) fn edit_selection(s: &Session) -> Option { + let ds = s.ds().ok()?; + let ve = ds.vector_edit.as_ref()?; + let mut sel = EditSelection { any: false, parts: Vec::new() }; + for part in ve.parts() { + if part.vertices.is_empty() && part.segments.is_empty() { + continue; + } + sel.any = true; + let Some(net) = vectoredit::network(&ds.doc, part.id) else { continue }; + let active = part.id == ve.id; + // Points selected only through a selected region don't pull in the segments touching + // them: the region's own segments are the selection. + let vertices: Vec = part.vertices.iter().copied().filter(|v| !active || !ve.region_vertices.contains(v)).collect(); + let mut segments = part.segments.clone(); + if active { + segments.extend(ve.regions.iter().filter_map(|r| net.regions.get(*r)).flat_map(|r| r.loops.iter().flatten().copied())); + } + if let Some(sub) = sub_network(net, &vertices, &segments) { + sel.parts.push((part.id, sub)); + } + } + Some(sel) +} + +/// The part of `net` that is the segments `segments` and those touching a point of `vertices`, +/// with the points they join; `None` when there are none (a lone point with no segment draws +/// nothing). The regions whose every segment is kept stay regions. +fn sub_network(net: &VectorNetwork, vertices: &[usize], segments: &[usize]) -> Option { + let picked: BTreeSet = vertices.iter().copied().collect(); + let mut keep: BTreeSet = segments.iter().copied().filter(|i| *i < net.segments.len()).collect(); + for (i, sg) in net.segments.iter().enumerate() { + if picked.contains(&sg.a) || picked.contains(&sg.b) { + keep.insert(i); + } + } + let used: BTreeSet = keep.iter().filter_map(|i| net.segments.get(*i)).flat_map(|sg| [sg.a, sg.b]).collect(); + let vmap: BTreeMap = used.iter().enumerate().map(|(new, old)| (*old, new)).collect(); + let smap: BTreeMap = keep.iter().enumerate().map(|(new, old)| (*old, new)).collect(); + let mut out = VectorNetwork { + vertices: used.iter().filter_map(|v| net.vertices.get(*v).cloned()).collect(), + segments: keep + .iter() + .filter_map(|i| net.segments.get(*i)) + .filter_map(|sg| { + let mut sg = *sg; + sg.a = *vmap.get(&sg.a)?; + sg.b = *vmap.get(&sg.b)?; + Some(sg) + }) + .collect(), + regions: Vec::new(), + }; + if out.segments.is_empty() || out.segments.len() != keep.len() || out.vertices.len() != used.len() { + return None; + } + for r in &net.regions { + let loops: Option>> = r.loops.iter().map(|l| l.iter().map(|i| smap.get(i).copied()).collect::>>()).collect(); + if let Some(loops) = loops.filter(|l| !l.is_empty()) { + out.regions.push(Region { loops, ..r.clone() }); + } + } + Some(out) +} + +/// The clipboard's layer for edited vector `id` holding `sub`: it keeps the layer's look (fills, +/// strokes, effects, opacity, blend) and its place on the page. A variable width profile runs +/// along the whole path, so it stays only when every segment is copied. +fn clip_node(doc: &Document, id: NodeId, mut sub: VectorNetwork) -> Option { + let mut n = doc.node(id)?.clone(); + let whole = vectoredit::network(doc, id).is_some_and(|all| all.segments.len() == sub.segments.len()); + let b = sub.bounds().filter(|b| b.x0.is_finite() && b.y0.is_finite() && b.width().is_finite() && b.height().is_finite())?; + sub.translate(-b.x0, -b.y0); + n.transform = doc.world_transform(id) * Affine::translate((b.x0, b.y0)); + n.width = b.width(); + n.height = b.height(); + n.kind = NodeKind::Vector { network: sub }; + n.parent = None; + n.children.clear(); + n.name = "Vector".into(); + if !whole { + n.stroke.width_profile = None; + } + Some(n) +} + +/// Put the selection's sub-networks on the layer clipboard. Returns how many segments went. +fn copy_parts(s: &mut Session, cmd: &str, sel: &EditSelection) -> Result { + let doc = s.doc()?; + let mut nodes = Vec::new(); + let mut images = BTreeMap::new(); + let mut bounds: Option = None; + let mut segments = 0; + for (id, sub) in &sel.parts { + segments += sub.segments.len(); + let Some(n) = clip_node(doc, *id, sub.clone()) else { continue }; + let r = figcraft_geom::transform_rect_bbox(n.transform, n.local_rect()); + bounds = Some(bounds.map_or(r, |b| b.union(r))); + collect_images(doc, std::slice::from_ref(&n), &mut images); + nodes.push((*id, vec![n])); + } + if nodes.is_empty() { + return Err(EngineError::Disabled(cmd.into(), "the selection has nothing to copy".into())); + } + store_clipboard(s, cmd, nodes, images, bounds)?; + Ok(segments) +} + +/// Copy the selected segments (see [`edit_selection`]). +pub(super) fn copy_selection(s: &mut Session, cmd: &str, sel: EditSelection) -> Result { + let segments = copy_parts(s, cmd, &sel)?; + Ok(json!({"copied": s.clipboard.nodes.len(), "segments": segments})) +} + +/// Cut: copy the selected segments, then remove the selection as Delete does (the path splits in +/// the same layer and edit mode stays on). A selection that has no segment to copy (lone points +/// with nothing attached) is removed and the clipboard is left as it was. +pub(super) fn cut_selection(s: &mut Session, sel: EditSelection) -> Result { + let segments = if sel.parts.is_empty() { 0 } else { copy_parts(s, "edit.cut", &sel)? }; + let parts: Vec = vectoredit::editing(s)?.parts(); + vectoredit::delete_selection(s, parts, false)?; + Ok(json!({"cut": sel.parts.len(), "segments": segments})) +} + +/// The network of the outline of copied layer `n` in its own coordinates: a vector's segments, a +/// shape's or boolean's outline. `None` for the layers with no outline to add (text, images, +/// frames, groups, instances, …). `doc` is the file the layer was copied from. +fn outline_network(doc: &Document, n: &Node) -> Option { + let net = match &n.kind { + NodeKind::Vector { network } => network.clone(), + k if k.is_shape() || matches!(k, NodeKind::BooleanOp { .. }) => { + let (path, rule) = figcraft_render::node_outline(doc, n)?; + let mut net = VectorNetwork::from_path(&path); + if matches!(n.kind, NodeKind::Line) { + net.regions.clear(); + } + if rule == figcraft_render::FillRule::EvenOdd { + for r in &mut net.regions { + r.winding = figcraft_doc::WindingRule::EvenOdd; + } + } + net + } + _ => return None, + }; + (!net.segments.is_empty()).then_some(net) +} + +/// `net` moved by `m` (points, handles, the regions' paint frames and the points' radii). +fn placed(mut net: VectorNetwork, m: Affine) -> Option { + let c = m.as_coeffs(); + if !c.iter().all(|x| x.is_finite()) { + return None; + } + let linear = Affine::new([c[0], c[1], c[2], c[3], 0.0, 0.0]); + let scale = m.determinant().abs().sqrt(); + for v in &mut net.vertices { + let p = m * v.point(); + (v.x, v.y) = (p.x, p.y); + v.radius *= scale; + } + for sg in &mut net.segments { + let (ta, tb) = (linear * figcraft_geom::Point::new(sg.ta.0, sg.ta.1), linear * figcraft_geom::Point::new(sg.tb.0, sg.tb.1)); + sg.ta = (ta.x, ta.y); + sg.tb = (tb.x, tb.y); + } + for r in &mut net.regions { + if let Some(frame) = r.paint_space.as_mut() { + frame.transform = m * frame.transform; + } + } + let finite = net.vertices.iter().all(|v| v.x.is_finite() && v.y.is_finite()) + && net.segments.iter().all(|sg| [sg.ta.0, sg.ta.1, sg.tb.0, sg.tb.1].iter().all(|x| x.is_finite())); + finite.then_some(net) +} + +/// Paste while editing a vector: the clipboard's layers join its network in place (with `x`, `y`: +/// the copied top-left moved there), their points selected. Layers with no outline are skipped +/// (named in `skipped`); when none has one, nothing is pasted. +pub(super) fn paste_into_vector(s: &mut Session, p: &Value) -> Result { + const CMD: &str = "edit.paste"; + let clip = s.clipboard.clone(); + if clip.nodes.is_empty() { + return Err(EngineError::Disabled(CMD.into(), "the clipboard is empty".into())); + } + let target = vectoredit::editing(s)?.id; + let shift = match (num(p, "x"), num(p, "y"), clip.bounds) { + (Some(x), Some(y), Some(b)) => Affine::translate((x - b.x0, y - b.y0)), + _ => Affine::IDENTITY, + }; + let live = s.doc()?; + let source: &Document = clip.source.as_deref().unwrap_or(live); + let to_local = live.world_transform(target).inverse() * shift; + let mut pieces = Vec::new(); + let mut skipped: Vec = Vec::new(); + for (_, nodes) in &clip.nodes { + let Some(root) = nodes.first() else { continue }; + match outline_network(source, root).and_then(|net| placed(net, to_local * root.transform)) { + Some(net) => pieces.push(net), + None => skipped.push(root.name.clone()), + } + } + if pieces.is_empty() { + return Err(EngineError::Disabled( + CMD.into(), + "none of the copied layers has an outline to add to the vector (text, frames and groups have none)".into(), + )); + } + let have = vectoredit::network(live, target).map_or(0, |n| n.segments.len()); + if have.saturating_add(pieces.iter().map(|n| n.segments.len()).sum::()) > MAX_SEGMENTS { + return Err(EngineError::Disabled(CMD.into(), format!("a vector takes at most {MAX_SEGMENTS} segments"))); + } + let mut pasted: Vec = Vec::new(); + vectoredit::edit(s.doc_mut()?, target, |net| { + for piece in pieces { + let (vo, so) = (net.vertices.len(), net.segments.len()); + pasted.extend(vo..vo + piece.vertices.len()); + net.vertices.extend(piece.vertices); + net.segments.extend(piece.segments.into_iter().map(|mut sg| { + sg.a += vo; + sg.b += vo; + sg + })); + net.regions.extend(piece.regions.into_iter().map(|mut r| { + for i in r.loops.iter_mut().flatten() { + *i += so; + } + r + })); + } + })?; + let selected = pasted.clone(); + vectoredit::set_state(s, |ve| { + ve.clear_selection(); + ve.clear_regions(); + ve.vertices = selected; + ve.anchor = None; + ve.pen_out = None; + ve.width_point = None; + })?; + let mut out = json!({"ids": [], "edited": target, "vertices": pasted.len()}); + if !skipped.is_empty() { + out["skipped"] = json!(skipped); + } + Ok(out) +} diff --git a/crates/engine/src/cmd/edit/vector_clipboard_tests.rs b/crates/engine/src/cmd/edit/vector_clipboard_tests.rs new file mode 100644 index 000000000..012a110fe --- /dev/null +++ b/crates/engine/src/cmd/edit/vector_clipboard_tests.rs @@ -0,0 +1,324 @@ +//! Copy, cut and paste in vector edit mode (#1875), measured in Figma: Copy takes the selected +//! segments (a lone point: the segments touching it) and a paste outside is a new vector in place; +//! Cut removes them, splitting the path in the same layer; Paste while editing adds the clipboard's +//! segments or a copied layer's outline to the vector's network in place, selected. + +use serde_json::{Value, json}; + +use crate::{EngineError, Session, params}; +use figcraft_doc::{NodeId, NodeKind, VectorNetwork}; + +fn ex(s: &mut Session, c: &str, p: Value) -> Value { + s.execute(c, &p).unwrap_or_else(|e| panic!("{c}: {e}")) +} + +fn id_of(v: &Value) -> NodeId { + params::id_of(&v["id"]).unwrap() +} + +/// Open path A-B-C-D (three segments) with a look of its own, in edit mode. +fn path(s: &mut Session) -> NodeId { + let r = ex(s, "vector.create", json!({"points": [[100, 100], [200, 150], [300, 100], [400, 200]], "closed": false})); + let id = id_of(&r); + ex(s, "node.set", json!({"id": id, "props": {"strokeWeight": 7, "opacity": 0.5}})); + ex(s, "vector.edit.begin", json!({"id": id})); + id +} + +fn net(s: &Session, id: NodeId) -> VectorNetwork { + crate::vectoredit::network(s.doc().unwrap(), id).unwrap().clone() +} + +fn layers(s: &Session) -> Vec { + s.doc().unwrap().node(s.page().unwrap()).unwrap().children.clone() +} + +/// The network's points on the page, rounded, in vertex order. +fn page_points(s: &Session, id: NodeId) -> Vec<(i64, i64)> { + let w = s.doc().unwrap().world_transform(id); + net(s, id).vertices.iter().map(|v| w * v.point()).map(|p| (p.x.round() as i64, p.y.round() as i64)).collect() +} + +/// The number of separate paths a network is made of. +fn subpaths(n: &VectorNetwork) -> usize { + let mut group: Vec = (0..n.vertices.len()).collect(); + fn root(g: &[usize], mut i: usize) -> usize { + while g[i] != i { + i = g[i]; + } + i + } + for sg in &n.segments { + let (a, b) = (root(&group, sg.a), root(&group, sg.b)); + group[a] = b; + } + (0..n.vertices.len()).filter(|i| root(&group, *i) == *i && n.segments.iter().any(|sg| root(&group, sg.a) == *i)).count() +} + +fn select(s: &mut Session, vertices: &[usize], segments: &[usize]) { + ex(s, "vector.edit.select", json!({"vertices": vertices, "segments": segments})); +} + +fn leave(s: &mut Session) { + ex(s, "vector.edit.end", json!({})); + assert!(s.ds().unwrap().vector_edit.is_none()); +} + +fn world_rect(s: &Session, id: NodeId) -> (f64, f64, f64, f64) { + let b = s.doc().unwrap().world_bounds(id).unwrap(); + (b.x0, b.y0, b.width(), b.height()) +} + +#[test] +fn a_copied_segment_pastes_outside_as_a_new_vector_in_place() { + let mut s = Session::new(); + let id = path(&mut s); + select(&mut s, &[], &[1]); + let r = ex(&mut s, "edit.copy", json!({})); + assert_eq!(r["segments"], 1); + assert_eq!(net(&s, id).segments.len(), 3, "Copy changes nothing"); + leave(&mut s); + ex(&mut s, "edit.paste", json!({})); + let all = layers(&s); + assert_eq!(all.len(), 2); + let new = all[1]; + let n = net(&s, new); + assert_eq!((n.vertices.len(), n.segments.len()), (2, 1)); + assert_eq!(page_points(&s, new), vec![(200, 150), (300, 100)], "at the segment's own page position"); + assert_eq!(world_rect(&s, new), (200.0, 100.0, 100.0, 50.0)); + // The layer's look comes along (the width profile aside). + let node = s.doc().unwrap().node(new).unwrap(); + assert_eq!((node.stroke.weight, node.opacity), (7.0, 0.5)); + assert_eq!(s.selection(), vec![new]); +} + +#[test] +fn a_copied_point_takes_the_segments_touching_it() { + let mut s = Session::new(); + path(&mut s); + select(&mut s, &[1], &[]); + ex(&mut s, "edit.copy", json!({})); + leave(&mut s); + ex(&mut s, "edit.paste", json!({})); + let new = *layers(&s).last().unwrap(); + let n = net(&s, new); + assert_eq!((n.vertices.len(), n.segments.len()), (3, 2), "A-B and B-C"); + assert_eq!(page_points(&s, new), vec![(100, 100), (200, 150), (300, 100)]); +} + +#[test] +fn nothing_selected_still_copies_the_whole_layer() { + let mut s = Session::new(); + path(&mut s); + ex(&mut s, "edit.copy", json!({})); + leave(&mut s); + ex(&mut s, "edit.paste", json!({})); + let new = *layers(&s).last().unwrap(); + assert_eq!(net(&s, new).segments.len(), 3); +} + +#[test] +fn cut_removes_the_segment_in_the_same_layer_and_stays_in_edit_mode() { + let mut s = Session::new(); + let id = path(&mut s); + select(&mut s, &[], &[1]); + ex(&mut s, "edit.cut", json!({})); + assert_eq!(layers(&s), vec![id], "no new layer"); + let n = net(&s, id); + assert_eq!(n.segments.len(), 2); + assert_eq!(subpaths(&n), 2, "the path split in two"); + let ve = s.ds().unwrap().vector_edit.clone().expect("edit mode stays on"); + assert!(ve.segments.is_empty() && ve.vertices.is_empty()); + leave(&mut s); + ex(&mut s, "edit.paste", json!({})); + let all = layers(&s); + assert_eq!(all.len(), 2); + let new = all[1]; + assert_eq!(net(&s, new).segments.len(), 1); + assert_eq!(page_points(&s, new), vec![(200, 150), (300, 100)]); +} + +#[test] +fn cut_is_one_undo_step() { + let mut s = Session::new(); + let id = path(&mut s); + select(&mut s, &[], &[1]); + ex(&mut s, "edit.cut", json!({})); + assert_eq!(net(&s, id).segments.len(), 2); + s.undo().unwrap(); + assert_eq!(net(&s, id).segments.len(), 3); + assert_eq!(page_points(&s, id), vec![(100, 100), (200, 150), (300, 100), (400, 200)]); +} + +#[test] +fn a_cut_point_takes_its_segments_with_it() { + let mut s = Session::new(); + let id = path(&mut s); + select(&mut s, &[1], &[]); + ex(&mut s, "edit.cut", json!({})); + assert_eq!(net(&s, id).segments.len(), 1, "only C-D is left"); + leave(&mut s); + ex(&mut s, "edit.paste", json!({})); + let new = *layers(&s).last().unwrap(); + assert_eq!(net(&s, new).segments.len(), 2, "A-B and B-C"); +} + +#[test] +fn pasting_segments_while_editing_adds_them_to_the_same_network_in_place() { + let mut s = Session::new(); + let id = path(&mut s); + select(&mut s, &[], &[1]); + ex(&mut s, "edit.copy", json!({})); + let r = ex(&mut s, "edit.paste", json!({})); + assert_eq!(r["vertices"], 2); + assert_eq!(layers(&s), vec![id], "no new layer"); + let n = net(&s, id); + assert_eq!((n.vertices.len(), n.segments.len()), (6, 4)); + assert_eq!(page_points(&s, id)[4..], [(200, 150), (300, 100)], "on top of the original"); + let ve = s.ds().unwrap().vector_edit.clone().unwrap(); + assert_eq!(ve.vertices, vec![4, 5], "the pasted points are selected"); + assert!(ve.segments.is_empty()); + // One undo reverts it. + s.undo().unwrap(); + assert_eq!(net(&s, id).segments.len(), 3); + assert_eq!(net(&s, id).vertices.len(), 4); +} + +#[test] +fn pasting_at_a_point_moves_the_copied_top_left_there() { + let mut s = Session::new(); + let id = path(&mut s); + select(&mut s, &[], &[1]); + ex(&mut s, "edit.copy", json!({})); + ex(&mut s, "edit.paste", json!({"x": 0, "y": 0})); + assert_eq!(page_points(&s, id)[4..], [(0, 50), (100, 0)]); +} + +#[test] +fn pasting_a_rectangle_while_editing_adds_its_outline_in_the_vectors_coordinates() { + let mut s = Session::new(); + let rect = id_of(&ex(&mut s, "shape.rectangle", json!({"x": 500, "y": 300, "width": 60, "height": 40}))); + ex(&mut s, "select.set", json!({"ids": [rect]})); + ex(&mut s, "edit.copy", json!({})); + let id = path(&mut s); + let before = world_rect(&s, id); + ex(&mut s, "edit.paste", json!({})); + assert_eq!(layers(&s), vec![rect, id], "no new layer"); + let n = net(&s, id); + assert_eq!((n.vertices.len(), n.segments.len()), (8, 7), "four corners, four sides, joined to the path"); + let mut corners: Vec<(i64, i64)> = page_points(&s, id)[4..].to_vec(); + corners.sort_unstable(); + assert_eq!(corners, vec![(500, 300), (500, 340), (560, 300), (560, 340)]); + let ve = s.ds().unwrap().vector_edit.clone().unwrap(); + assert_eq!(ve.vertices, vec![4, 5, 6, 7]); + let after = world_rect(&s, id); + assert!(after.2 > before.2 && after.3 > before.3, "the vector's bounds grow: {before:?} to {after:?}"); + assert_eq!((after.0, after.1), (before.0, before.1)); + assert_eq!(after.0 + after.2, 560.0); + s.undo().unwrap(); + assert_eq!(net(&s, id).vertices.len(), 4); + assert_eq!(world_rect(&s, id), before); +} + +#[test] +fn a_rotated_vector_takes_pasted_points_in_its_own_coordinates() { + let mut s = Session::new(); + let id = path(&mut s); + ex(&mut s, "node.set", json!({"id": id, "props": {"rotation": 90}})); + select(&mut s, &[], &[1]); + ex(&mut s, "edit.copy", json!({})); + let before = page_points(&s, id); + assert_ne!(before[0], (100, 100), "the vector is rotated"); + ex(&mut s, "edit.paste", json!({})); + let after = page_points(&s, id); + assert_eq!(after[4..], before[1..3]); +} + +#[test] +fn layers_with_no_outline_are_skipped_and_named() { + let mut s = Session::new(); + let rect = id_of(&ex(&mut s, "shape.rectangle", json!({"x": 500, "y": 300, "width": 60, "height": 40}))); + let text = id_of(&ex(&mut s, "text.create", json!({"text": "hello", "x": 500, "y": 400}))); + let name = s.doc().unwrap().node(text).unwrap().name.clone(); + // Only text: nothing to add, and nothing changes. + ex(&mut s, "select.set", json!({"ids": [text]})); + ex(&mut s, "edit.copy", json!({})); + let id = path(&mut s); + let err = s.execute("edit.paste", &json!({})).unwrap_err(); + assert!(matches!(err, EngineError::Disabled(..)), "{err}"); + assert_eq!(net(&s, id).vertices.len(), 4); + // The rectangle joins, the text is named as skipped. + leave(&mut s); + ex(&mut s, "edit.copy", json!({"ids": [rect, text]})); + ex(&mut s, "vector.edit.begin", json!({"id": id})); + let r = ex(&mut s, "edit.paste", json!({})); + assert_eq!(r["skipped"], json!([name])); + assert_eq!(net(&s, id).vertices.len(), 8); +} + +#[test] +fn a_parent_still_pastes_layers_while_editing() { + let mut s = Session::new(); + let id = path(&mut s); + select(&mut s, &[], &[1]); + ex(&mut s, "edit.copy", json!({})); + let page = s.page().unwrap(); + ex(&mut s, "edit.paste", json!({"parent": page})); + assert_eq!(layers(&s).len(), 2); + assert_eq!(net(&s, id).segments.len(), 3); +} + +#[test] +fn an_empty_clipboard_refuses_to_paste_while_editing() { + let mut s = Session::new(); + path(&mut s); + assert!(matches!(s.execute("edit.paste", &json!({})), Err(EngineError::Disabled(..)))); +} + +#[test] +fn a_selected_face_copies_its_own_outline_with_the_fill() { + let mut s = Session::new(); + let r = ex(&mut s, "shape.rectangle", json!({"x": 100, "y": 100, "width": 80, "height": 60})); + let id = id_of(&r); + ex(&mut s, "vector.edit.begin", json!({"id": id})); + select(&mut s, &[], &[0, 1, 2, 3]); + ex(&mut s, "edit.copy", json!({})); + leave(&mut s); + ex(&mut s, "edit.paste", json!({})); + let new = *layers(&s).last().unwrap(); + let n = net(&s, new); + assert_eq!((n.segments.len(), n.regions.len()), (4, 1), "the closed shape stays filled"); + assert!(matches!(s.doc().unwrap().node(new).unwrap().kind, NodeKind::Vector { .. })); +} + +#[test] +fn copy_cut_and_paste_survive_junk_in_vector_edit_mode() { + let junk = [ + json!({}), + json!(null), + json!([1, 2]), + json!({"ids": ["x", -1, 99999]}), + json!({"id": "nope", "x": "NaN", "y": 1e308}), + json!({"parent": "nope", "x": -1e308, "y": "x"}), + json!({"x": 1e308, "y": 1e308}), + ]; + for cmd in ["edit.copy", "edit.cut", "edit.paste", "edit.pasteOver", "edit.pasteReplace"] { + for j in &junk { + let mut s = Session::new(); + path(&mut s); + select(&mut s, &[1], &[0]); + ex(&mut s, "text.create", json!({"text": "t"})); + if let Err(EngineError::Internal { cmd, msg }) = s.execute(cmd, j) { + panic!("{cmd} panicked on {j}: {msg}"); + } + // And after something was copied from the edit selection. + let mut s = Session::new(); + path(&mut s); + select(&mut s, &[2], &[]); + let _ = s.execute("edit.copy", &json!({})); + if let Err(EngineError::Internal { cmd, msg }) = s.execute(cmd, j) { + panic!("{cmd} panicked on {j}: {msg}"); + } + } + } +} diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 98fd881d1..8ef67ef66 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -197,7 +197,15 @@ pub fn invoke(app: &mut FigApp, id: &str) { let ids = app.session.selection(); // For other apps: text layers' text, other layers as SVG; taken before a cut removes them. let doc = app.session.doc().ok(); - let mirror = doc.and_then(|d| text_layers_text(d, &ids).or_else(|| figcraft_svg_export(d, &ids))); + // Points or segments selected in vector edit mode copy just those: the whole vector's + // SVG would misdescribe them. + let partial = app + .session + .ds() + .ok() + .and_then(|d| d.vector_edit.as_ref()) + .is_some_and(|ve| ve.parts().iter().any(|p| !p.vertices.is_empty() || !p.segments.is_empty())); + let mirror = doc.filter(|_| !partial).and_then(|d| text_layers_text(d, &ids).or_else(|| figcraft_svg_export(d, &ids))); app.run(id, json!({})); // Mirror to the system clipboard (text or SVG, else a marker) and remember it, so a // later paste knows whether the clipboard still holds our layers. Control-channel diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index 26bdb60d2..48b61c39c 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -178,7 +178,7 @@ pub(crate) fn handle_input( let props = ctx.input(|i| i.modifiers.alt); crate::menus::invoke(app, if props { "edit.copyProperties" } else { "edit.copy" }); } - Event::Cut => cut(app), + Event::Cut => cut(app, ctx.input(|i| i.modifiers)), Event::Paste(text) if !paste.drop_text => crate::menus::paste(app, Some(text), None), Event::Key { key, physical_key, pressed: true, modifiers, repeat } if key_event(app, *key, *physical_key, *modifiers, *repeat, now, ctx) => @@ -192,13 +192,18 @@ pub(crate) fn handle_input( /// Cut: usually the layers. Windows sends Shift+Delete (remove the points and heal the path) /// as a cut command and never as a key, so in vector edit mode the selection is points: they are -/// removed, a heal joining the path through them. -fn cut(app: &mut FigApp) { +/// removed, a heal joining the path through them. Ctrl/Cmd+X is the real Cut: with points or +/// segments selected the engine copies them and removes them, staying in edit mode (#1875). +fn cut(app: &mut FigApp, modifiers: egui::Modifiers) { let Some(ve) = app.session.ds().ok().and_then(|d| d.vector_edit.clone()) else { crate::menus::invoke(app, "edit.cut"); return; }; - if ve.parts().iter().any(|p| !p.vertices.is_empty()) { + if modifiers.command { + if ve.parts().iter().any(|p| !p.vertices.is_empty() || !p.segments.is_empty()) { + crate::menus::invoke(app, "edit.cut"); + } + } else if ve.parts().iter().any(|p| !p.vertices.is_empty()) { app.run("vector.deleteHeal", json!({})); } else if ve.parts().iter().any(|p| !p.segments.is_empty()) { app.run("vector.edit.delete", json!({})); diff --git a/crates/ui-egui/src/vector_keys_tests.rs b/crates/ui-egui/src/vector_keys_tests.rs index dce51717d..9b3d0cb04 100644 --- a/crates/ui-egui/src/vector_keys_tests.rs +++ b/crates/ui-egui/src/vector_keys_tests.rs @@ -49,6 +49,18 @@ fn a_cut_command_in_edit_mode_takes_the_selected_points_not_the_layer() { assert_eq!(net(&u, path).vertices.len(), 2, "it takes the selected point"); } +#[test] +fn ctrl_x_on_selected_segments_puts_them_on_the_clipboard_and_keeps_the_layer() { + let mut u = Ui::new(Session::new()); + let path = abc(&mut u); + u.app.session.execute("vector.edit.select", &json!({"segments": [0]})).unwrap(); + u.frame_with(vec![Event::Cut], Modifiers::COMMAND); + assert!(u.app.session.doc().unwrap().node(path).is_some(), "Ctrl+X keeps the layer"); + assert_eq!(net(&u, path).segments.len(), 1, "the segment is gone"); + assert_eq!(u.app.session.clipboard.nodes.len(), 1, "and on the clipboard"); + assert!(u.app.session.ds().unwrap().vector_edit.is_some(), "edit mode stays on"); +} + #[test] fn a_cut_command_in_edit_mode_with_nothing_selected_keeps_the_layer() { let mut u = Ui::new(Session::new()); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index aa0ef25bd..98816af28 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-04 · **Change:** minor (copy, cut and paste in vector edit mode act on the selected points and segments (#1875); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -92,7 +92,7 @@ interaction feel not yet compared. | Rectangle, ellipse (arc handles and Design panel arc fields), polygon, star, line, arrow; Shift/Alt | done | Alt draws lines from the centre too (`shapes_behaviour_tests`) | | Corner radius handles (inside each corner of a rectangle or frame, a polygon's or star's top point; Alt: one corner), star ratio handle; Count and Ratio fields | done | handles hide under 48 px on screen; no count handle on the canvas (the Count field instead); corner smoothing rounds rectangles and frames only | | Pen: vector networks, branch, close, bend; pencil | done | pen pressure on Windows and from browser styluses only; outside edit mode the Pen closes on its first point, connects to its other points and continues a selected open path from an end point (`vector_multi_behaviour_tests`); Escape ends the path and keeps its layer in edit mode with the pen, so the next path joins the same vector and another Escape leaves edit mode (#760, `pen_end_tests`); Enter or a double-click ends the path (at the double-click's point, added once) and edits the vector with the Move tool, a double-click with the idle pen edits the layer under it, and in edit mode the pen's Enter or double-click takes the Move tool (#1430, `pen_vector_edit_tests`); switching from Design to Prototype or Inspect ends the path and returns to Move (#308) | -| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). Not yet: areas of other layers edited at once | +| 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); Copy and Cut with points or segments selected take just those (a lone point: the segments touching it) as a vector with the layer's look, at their own place, so a paste outside edit mode is a new layer in place; Cut removes them as Delete does, the path splitting in the same layer with edit mode staying on; Paste while editing adds the clipboard's segments, or a copied shape's or boolean's outline, to the edited network in place with the new points selected, skipping layers with no outline (text, frames, groups; named in `skipped`) and refusing when none has one, as measured in Figma (`vector_clipboard_tests`, #1875). Not yet: areas of other layers edited at once | | Shape builder (Shift+M) on fills, strokes and open paths; variable width (Shift+W), one side with Alt | done | | | Boolean groups: clicked where the result is, double-click or Cmd/Ctrl-click into operands, live results while dragging or editing points, per-operand operations | done | a group past the path operations' caps (250 000 segments, 2 million possible crossings, 4 million segments swept over a fold) draws without its result, with a warning, and Flatten refuses it (#1104); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | | 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 | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-07 | minor | Vector edit mode, #1875, measured in Figma (web, real keys): Copy with segments selected takes only those (with just a point selected, the segments touching it) and a paste outside edit mode is a new vector layer in place; Cut removes them, the path splitting into subpaths in the same layer with edit mode staying on, and a paste outside gives a new layer with the cut segments; Paste while editing a vector adds the clipboard's segments, or a copied layer's outline, to the same network in place, selecting the pasted points, with no new layer and the bounds growing. FigCraft copied the whole layer, Cut left nothing to paste and Paste did nothing. `edit.copy`, `edit.cut` and `edit.paste` act so with no `ids`/`parent` given (Ctrl+X is the real Cut again; Shift+Delete still heals); the copy carries the layer's look (fills, strokes, effects, opacity, blend; the width profile only when every segment is copied); layers with no outline are skipped. Tests: `vector_clipboard_tests` | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From d14c637de8e817e25b2458db8924c0b9fdd3fff5 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 23:47:15 -0500 Subject: [PATCH 032/239] Text: tests for the layer-level wrap style, the Type settings control, old files and inspect (#2094 review) Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/doc/src/text.rs | 43 ++++++++++++ crates/engine/src/text_behaviour_tests.rs | 40 ++++++++++++ crates/ui-egui/src/panels/typography.rs | 80 ++++++++++++++++++++++- 3 files changed, 162 insertions(+), 1 deletion(-) diff --git a/crates/doc/src/text.rs b/crates/doc/src/text.rs index 9ba29e5a0..48f690b8a 100644 --- a/crates/doc/src/text.rs +++ b/crates/doc/src/text.rs @@ -1168,6 +1168,49 @@ mod case_tests { assert!(t.paragraphs.is_empty()); assert_eq!((t.para_wrap_style(0), t.para_wrap_style(1)), (Pretty, Pretty)); } + + #[test] + fn wrap_style_loads_from_old_paragraph_styles_and_texts() { + use WrapStyle::Auto; + // A paragraph style saved before it carried a wrap style. + let old = r#"{"paragraph_spacing":4.0,"list":"bulleted"}"#; + let ps: ParagraphStyle = serde_json::from_str(old).unwrap(); + assert_eq!((ps.wrap_style, ps.paragraph_spacing, ps.list), (Auto, 4.0, ListStyle::Bulleted)); + assert!(!serde_json::to_string(&ParagraphStyle::default()).unwrap().contains("wrap_style"), "Auto is not saved"); + // A text saved before its paragraphs carried a wrap style. + let mut t = TextData::new("a\nb"); + t.set_para_lists(0, 0, |p| p.list = ListStyle::Bulleted); + let mut v = serde_json::to_value(&t).unwrap(); + for p in v["paragraphs"].as_array_mut().unwrap() { + assert!(p.as_object_mut().unwrap().remove("wrap").is_none(), "Auto is not saved"); + } + v.as_object_mut().unwrap().remove("wrap_style"); + let old: TextData = serde_json::from_value(v).unwrap(); + assert_eq!(old.wrap_style, Auto); + assert_eq!(old.paragraphs.len(), 2); + assert!(old.paragraphs.iter().all(|p| p.wrap.is_none())); + assert_eq!((old.para_wrap_style(0), old.para_wrap_style(1)), (Auto, Auto)); + assert_eq!(old, t); + } + + #[test] + fn set_wrap_style_clears_an_override_on_the_empty_last_paragraph() { + use WrapStyle::{Auto, Balance, Pretty}; + let mut t = TextData::new("ab\n"); + assert_eq!(t.paragraph_count(), 2); + // The empty paragraph after the final newline: a caret there reaches it. + t.set_para_wrap_styles(3, 3, Balance); + assert_eq!((t.para_wrap_style(0), t.para_wrap_style(1)), (Auto, Balance)); + t.set_wrap_style(Pretty); + assert!(t.paragraphs.is_empty(), "{:?}", t.paragraphs); + assert_eq!((t.para_wrap_style(0), t.para_wrap_style(1)), (Pretty, Pretty)); + // Back to the layer's own style: no override is left on either paragraph. + t.set_para_wrap_styles(3, 3, Auto); + assert_eq!(t.para_wrap_style(1), Auto); + t.set_wrap_style(Auto); + assert!(t.paragraphs.is_empty()); + assert_eq!(t.common_wrap_style(0, t.char_count()), Some(Auto)); + } } #[cfg(test)] diff --git a/crates/engine/src/text_behaviour_tests.rs b/crates/engine/src/text_behaviour_tests.rs index 779002dc1..f6a308eec 100644 --- a/crates/engine/src/text_behaviour_tests.rs +++ b/crates/engine/src/text_behaviour_tests.rs @@ -541,6 +541,46 @@ fn wrap_style_per_paragraph_overrides_the_layers() { assert!(s.execute("node.set", &json!({"id": t, "props": {"wrapStyle": "zigzag", "start": 0, "end": 0}})).is_err()); } +#[test] +fn text_wrap_style_without_editing_sets_the_layer_and_folds_paragraph_overrides() { + let mut s = Session::new(); + let t = text(&mut s, "one\ntwo\nthree", json!({})); + let inspect = |s: &Session| crate::inspect::node_json(s.doc().unwrap(), t, 0); + let td = |s: &Session| s.doc().unwrap().node(t).unwrap().kind.text().unwrap().clone(); + s.execute("node.set", &json!({"id": t, "props": {"wrapStyle": "balance", "start": 5, "end": 5}})).unwrap(); + s.execute("node.set", &json!({"id": t, "props": {"wrapStyle": "pretty", "start": 9, "end": 9}})).unwrap(); + assert_eq!(inspect(&s)["lineWrapStyles"], json!(["auto", "balance", "pretty"])); + assert!(s.ds().unwrap().text_edit.is_none(), "no edit session"); + s.execute("text.wrapStyle", &json!({"ids": [t], "style": "balance"})).unwrap(); + let after = td(&s); + assert!(after.paragraphs.iter().all(|p| p.wrap.is_none()), "{:?}", after.paragraphs); + assert_eq!(after.wrap_style, figcraft_doc::WrapStyle::Balance); + assert!((0..3).all(|p| after.para_wrap_style(p) == figcraft_doc::WrapStyle::Balance)); + assert_eq!(inspect(&s)["wrapStyle"], json!("balance")); + assert!(inspect(&s).get("lineWrapStyles").is_none()); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(inspect(&s)["lineWrapStyles"], json!(["auto", "balance", "pretty"]), "undo restores the overrides"); +} + +#[test] +fn inspect_reports_wrap_style_only_when_not_auto_and_counts_a_trailing_empty_paragraph() { + let mut s = Session::new(); + let t = text(&mut s, "one\ntwo\n", json!({})); + let inspect = |s: &Session| crate::inspect::node_json(s.doc().unwrap(), t, 0); + let quiet = |s: &Session| inspect(s).get("wrapStyle").is_none() && inspect(s).get("lineWrapStyles").is_none(); + assert!(quiet(&s), "uniform Auto says nothing"); + // An override on the empty last paragraph (a caret after the final newline) is listed with the others. + s.execute("node.set", &json!({"id": t, "props": {"wrapStyle": "balance", "start": 8, "end": 8}})).unwrap(); + assert_eq!(inspect(&s)["lineWrapStyles"], json!(["auto", "auto", "balance"])); + assert!(inspect(&s).get("wrapStyle").is_none()); + // Every paragraph the same non-Auto style: the one key; back to Auto: neither. + s.execute("node.set", &json!({"id": t, "props": {"wrapStyle": "balance"}})).unwrap(); + assert_eq!(inspect(&s)["wrapStyle"], json!("balance")); + assert!(inspect(&s).get("lineWrapStyles").is_none()); + s.execute("node.set", &json!({"id": t, "props": {"wrapStyle": "auto"}})).unwrap(); + assert!(quiet(&s)); +} + #[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 diff --git a/crates/ui-egui/src/panels/typography.rs b/crates/ui-egui/src/panels/typography.rs index a3a5bd66a..ccd970bea 100644 --- a/crates/ui-egui/src/panels/typography.rs +++ b/crates/ui-egui/src/panels/typography.rs @@ -210,6 +210,7 @@ pub(crate) fn field_row(ui: &mut Ui, label: &str, add: impl FnOnce(&mut Ui, f #[cfg(test)] mod variable_tests { use egui::{Event, Modifiers, PointerButton, Pos2, RawInput}; + use figcraft_doc::WrapStyle; use figcraft_engine::Session; use super::*; @@ -223,6 +224,8 @@ mod variable_tests { ctx: egui::Context, time: f64, text: NodeId, + /// The AccessKit nodes of the last frame. + nodes: Vec, } impl Panel { @@ -236,7 +239,8 @@ mod variable_tests { s.execute("variable.create", &json!({"collection": "Type", "name": name, "type": ty, "values": {"Base": value}})).unwrap(); } s.execute("select.set", &json!({ "ids": [text] })).unwrap(); - let mut p = Self { app: FigApp::new(s, Box::new(NoServices)), ctx: egui::Context::default(), time: 0.0, text }; + let mut p = Self { app: FigApp::new(s, Box::new(NoServices)), ctx: egui::Context::default(), time: 0.0, text, nodes: Vec::new() }; + p.ctx.enable_accesskit(); crate::theme::install_fonts(&p.ctx, false, 0); crate::theme::apply(&p.ctx, Tokens::light()); for _ in 0..3 { @@ -269,6 +273,9 @@ mod variable_tests { crate::variable_ui::picker(&mut self.app, ui.ctx()); }); out.textures_delta.clear(); + if let Some(update) = out.platform_output.accesskit_update.take() { + self.nodes = update.nodes.into_iter().map(|(_, n)| n).collect(); + } let mut texts = Vec::new(); for c in out.shapes { walk(&c.shape, &mut texts); @@ -351,4 +358,75 @@ mod variable_tests { assert!(shows(&texts, "Inter") && shows(&texts, "Bold"), "the dropdowns show the last values"); assert!(p.app.ui.last_error.is_none(), "{:?}", p.app.ui.last_error); } + + /// The centre of the AccessKit node labelled `label` (a button, say). + fn node_center(p: &Panel, label: &str) -> Pos2 { + let n = p.nodes.iter().find(|n| n.label() == Some(label)).unwrap_or_else(|| panic!("no node {label:?}")); + let r = n.bounds().expect("bounds"); + Pos2::new(((r.x0 + r.x1) / 2.0) as f32, ((r.y0 + r.y1) / 2.0) as f32) + } + + const WRAP: [&str; 3] = [ + "Auto: as many words as fit on each line", + "Balance: every line close to the same length", + "Pretty: full lines, no one word alone on the last", + ]; + + /// The Wrap style buttons that are on, by short name. + fn wrap_on(p: &Panel) -> Vec<&'static str> { + let on = |label: &str| p.nodes.iter().find(|n| n.label() == Some(label)).unwrap_or_else(|| panic!("no node {label:?}")).toggled(); + ["Auto", "Balance", "Pretty"].into_iter().zip(WRAP).filter(|(_, l)| on(l) == Some(egui::accesskit::Toggled::True)).map(|(n, _)| n).collect() + } + + /// The panel with the Type settings popover open, over two paragraphs. + fn settings_panel() -> Panel { + let mut p = Panel::new(); + p.app.session.execute("node.set", &json!({"id": p.text, "props": {"characters": "one\ntwo"}})).unwrap(); + p.frame(vec![]); + let at = node_center(&p, "Type settings"); + p.click(at); + p.frame(vec![]); + p + } + + #[test] + fn wrap_style_control_follows_the_caret_paragraph() { + // #1827: with the caret in one paragraph the control shows and sets that paragraph's style. + let mut p = settings_panel(); + assert_eq!(wrap_on(&p), ["Auto"], "the layer's style when not editing"); + figcraft_engine::textedit::begin(&mut p.app.session, p.text, Some(5), false).unwrap(); + p.frame(vec![]); + assert_eq!(wrap_on(&p), ["Auto"]); + let at = node_center(&p, WRAP[1]); + p.click(at); + let td = |p: &Panel| p.app.session.doc().unwrap().node(p.text).unwrap().kind.text().unwrap().clone(); + assert_eq!((td(&p).para_wrap_style(0), td(&p).para_wrap_style(1)), (WrapStyle::Auto, WrapStyle::Balance), "only the caret's paragraph"); + assert_eq!(td(&p).wrap_style, WrapStyle::Auto); + assert_eq!(wrap_on(&p), ["Balance"], "the control shows the paragraph's value"); + figcraft_engine::textedit::set_caret(&mut p.app.session, 1, false).unwrap(); + p.frame(vec![]); + assert_eq!(wrap_on(&p), ["Auto"], "another paragraph shows its own"); + assert!(p.app.ui.last_error.is_none(), "{:?}", p.app.ui.last_error); + } + + #[test] + fn wrap_style_control_has_nothing_active_for_mixed_paragraphs() { + let mut p = settings_panel(); + figcraft_engine::textedit::begin(&mut p.app.session, p.text, Some(5), false).unwrap(); + p.frame(vec![]); + let at = node_center(&p, WRAP[2]); + p.click(at); + assert_eq!(wrap_on(&p), ["Pretty"]); + // A selection across both paragraphs, which differ: none is on. + figcraft_engine::textedit::set_caret(&mut p.app.session, 1, false).unwrap(); + figcraft_engine::textedit::set_caret(&mut p.app.session, 6, true).unwrap(); + p.frame(vec![]); + assert!(wrap_on(&p).is_empty(), "{:?}", wrap_on(&p)); + // Choosing one sets both paragraphs. + let at = node_center(&p, WRAP[1]); + p.click(at); + assert_eq!(wrap_on(&p), ["Balance"]); + let t = p.app.session.doc().unwrap().node(p.text).unwrap().kind.text().unwrap().clone(); + assert_eq!((t.para_wrap_style(0), t.para_wrap_style(1)), (WrapStyle::Balance, WrapStyle::Balance)); + } } From 75f54e0ae96cb6f9e0e2e481fee4b4d67d508a04 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 7 Nov 2026 23:59:04 -0500 Subject: [PATCH 033/239] View: the arrow keys pan 64 px, 320 with Shift, as measured in Figma With nothing selected, one arrow press panned 20 px (200 with Shift); Figma pans about 64 px and five times that with Shift (measured at 100%, about +/-3 px). New engine test pins both steps; no existing test pinned the old values. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at low --- crates/engine/src/cmd/view.rs | 22 +++++++++++++++++++--- docs/ui-parity.md | 3 ++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/view.rs b/crates/engine/src/cmd/view.rs index c33878066..c58c31d94 100644 --- a/crates/engine/src/cmd/view.rs +++ b/crates/engine/src/cmd/view.rs @@ -100,12 +100,16 @@ fn zoom_to(s: &mut Session, z: f64) -> Result { Ok(json!({"zoom": v.zoom})) } -/// How far an arrow key pans the view with nothing selected (screen pixels; Shift: ten times). -pub const PAN_STEP_PX: f64 = 20.0; +/// How far an arrow key pans the view with nothing selected (screen pixels). Measured in Figma at +/// 100% zoom: about 64 px (62-64 in two trials, +/-3 px). +pub const PAN_STEP_PX: f64 = 64.0; + +/// Shift multiplies the arrow pan by this much (Figma: about 320 px, five steps). +pub const PAN_BIG_STEPS: f64 = 5.0; /// `view.pan`: the arrow keys with nothing selected move the view by keyboard steps. fn pan(s: &mut Session, p: &Value) -> Result { - let step = if boolean(p, "big").unwrap_or(false) { PAN_STEP_PX * 10.0 } else { PAN_STEP_PX }; + let step = if boolean(p, "big").unwrap_or(false) { PAN_STEP_PX * PAN_BIG_STEPS } else { PAN_STEP_PX }; let dir = |k| num(p, k).filter(|v| v.is_finite()).unwrap_or(0.0).clamp(-100.0, 100.0) * step; let (dx, dy) = (dir("dx"), dir("dy")); let v = view(s)?; @@ -672,4 +676,16 @@ mod start_on_home_tests { let old: crate::Prefs = serde_json::from_value(json!({"theme": "dark"})).unwrap(); assert!(!old.start_on_home); } + + #[test] + fn the_arrows_pan_64_px_and_320_with_shift_as_measured_in_figma() { + let mut s = crate::Session::new(); + s.execute("view.set", &json!({"zoom": 1.0, "cx": 300, "cy": 200})).unwrap(); + s.execute("view.pan", &json!({"dx": 1})).unwrap(); + let v = &s.ds().unwrap().view; + assert_eq!((v.cx, v.cy), (364.0, 200.0), "one press pans 64 px"); + s.execute("view.pan", &json!({"dy": -1, "big": true})).unwrap(); + let v = &s.ds().unwrap().view; + assert_eq!((v.cx, v.cy), (364.0, -120.0), "Shift pans 320 px"); + } } diff --git a/docs/ui-parity.md b/docs/ui-parity.md index aa0ef25bd..0564d7ce3 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -109,7 +109,7 @@ interaction feel not yet compared. | Item | Status | Notes | |---|---|---| -| Pan/zoom: wheel, pinch, Space-drag, Shift+0/1/2, Cmd+0, `+`/`-` | done | Shift-wheel pans sideways, pinch and the zoom tool keep the point under the pointer; Preferences ▸ Scroll wheel zoom makes a mouse wheel zoom about the pointer and Cmd/Ctrl+wheel scroll (a wheel told from a trackpad by the device macOS reports, elsewhere by line versus pixel steps; #1390); zoom steps, limits (2%–25,600%) and frame order pinned where the documentation is silent (`view_behaviour_tests`) | +| Pan/zoom: wheel, pinch, Space-drag, Shift+0/1/2, Cmd+0, `+`/`-` | done | Shift-wheel pans sideways, pinch and the zoom tool keep the point under the pointer; Preferences ▸ Scroll wheel zoom makes a mouse wheel zoom about the pointer and Cmd/Ctrl+wheel scroll (a wheel told from a trackpad by the device macOS reports, elsewhere by line versus pixel steps; #1390); the arrows pan the view with nothing selected by 64 px, 320 px (five steps) with Shift (`view.pan`; measured in Figma's web app at 100% zoom: one Right press 62–64 px in two trials, Shift+Right about 320 px, reading offsets from screenshots, about ±3 px); zoom steps, limits (2%–25,600%) and frame order pinned where the documentation is silent (`view_behaviour_tests`) | | Rulers and guides (drag out, move, remove; rotated frames; frame guides) | done | guides belong to the page or a top-level frame (a frame moved into another keeps its guides but they stop applying); a click selects one for Delete, the arrows or the context menu's Remove guide; Alt-drag drops a copy; Alt while dragging measures to the layers in the frame it crosses; ruler numbering checked by eye only | | Frame labels (rotated, right-to-left), size badge | done | | | Outline mode | done | Outlines, outlines for the selection, mask outlines, frame outlines; shapes are clicked on their outlines, reaching layers behind; View ▸ Outlines ▸ Include hidden layers (`view.outlinesHiddenLayers`) outlines hidden layers too and Include object bounds (`view.outlinesObjectBounds`) draws the box of every layer whose outline isn't its box (groups, text, ellipses, vectors); what either draws can be clicked there (a hidden layer on its outline, a group on its box) and nothing else can; both are view settings like the other outline flags (per file, off in a new one, checked in the menu); the lines are light on a dark page (`outline_options_tests`). The main menu now shows a check mark beside every View toggle that is on | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-07 | patch | View: the arrow keys with nothing selected pan 64 px, 320 with Shift (five steps), as measured in Figma's web app at 100% zoom (62–64 px in two trials, about 320 px with Shift, about ±3 px); they panned 20 px (200 with Shift). Test: `cmd::view::start_on_home_tests::the_arrows_pan_64_px_and_320_with_shift_as_measured_in_figma` | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From a285fd293b8a31b6583228f5a4654841d8158723 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 00:11:49 -0500 Subject: [PATCH 034/239] Selection: Escape clears the selection instead of stepping out to the parent, as in Figma Measured in Figma: with a layer inside a group inside a frame selected (from the canvas, from the Layers panel, or after Tab), one Escape selects nothing; FigCraft selected the parent first. Escape still leaves text and vector editing, ends gestures and the pen first. Three tests updated to the measured rule (selection_behaviour, devfocus, proto_editor); the rest of the suites pass. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at low --- crates/engine/src/canvas/tools/keys.rs | 20 ++++--------------- crates/engine/src/devfocus_tests.rs | 6 +++--- .../engine/src/selection_behaviour_tests.rs | 8 +++----- crates/ui-egui/src/proto_editor_tests.rs | 12 ++++------- docs/ui-parity.md | 2 ++ 5 files changed, 16 insertions(+), 32 deletions(-) diff --git a/crates/engine/src/canvas/tools/keys.rs b/crates/engine/src/canvas/tools/keys.rs index 2b56aecd3..870565207 100644 --- a/crates/engine/src/canvas/tools/keys.rs +++ b/crates/engine/src/canvas/tools/keys.rs @@ -1,4 +1,4 @@ -use super::{Document, Gesture, Node, NodeId, Overlay, Point, PointerEvent, PointerKind, Result, Session, ShapeHandle, ToolId, json, textedit}; +use super::{Document, Gesture, NodeId, Overlay, Point, PointerEvent, PointerKind, Result, Session, ShapeHandle, ToolId, json, textedit}; impl Session { /// Keys the current mode handles before menu shortcuts (vector edit mode's tools and point @@ -146,21 +146,9 @@ impl Session { self.ds_mut()?.focus = None; return Ok(()); } - // Escape selects the parent, then nothing. - let doc = self.doc()?; - let parents: Vec = - sel.iter().filter_map(|i| doc.node(*i).and_then(|n| n.parent)).filter(|p| !doc.node(*p).is_some_and(Node::is_page)).collect(); - if !parents.is_empty() { - let mut uniq = Vec::new(); - for p in parents { - if !uniq.contains(&p) { - uniq.push(p); - } - } - self.set_selection(uniq); - } else { - self.set_selection(vec![]); - } + // Escape clears the selection whatever its nesting (measured in Figma: it never selects the + // parent). + self.set_selection(vec![]); Ok(()) } diff --git a/crates/engine/src/devfocus_tests.rs b/crates/engine/src/devfocus_tests.rs index 0801746de..f36af7ee6 100644 --- a/crates/engine/src/devfocus_tests.rs +++ b/crates/engine/src/devfocus_tests.rs @@ -84,12 +84,12 @@ fn only_the_focused_frame_is_hit_and_escape_leaves() { click(&mut s, 75.0, 75.0); assert_eq!(s.selection(), vec![in_a], "the layer on top of it isn't hit either"); assert_ne!(s.selection(), vec![over]); - // Escape: selection up to the frame, then out of the focus view. + // Escape: the selection goes, then out of the focus view. s.escape().unwrap(); - assert_eq!(s.selection(), vec![a]); + assert!(s.selection().is_empty(), "Escape selects nothing, not the parent frame"); assert_eq!(focused(&s), Some(a)); s.escape().unwrap(); - assert_eq!(focused(&s), None, "Escape with the frame selected leaves"); + assert_eq!(focused(&s), None, "Escape with nothing selected leaves"); click(&mut s, 350.0, 100.0); assert_eq!(s.selection(), vec![b], "everything is hit again"); } diff --git a/crates/engine/src/selection_behaviour_tests.rs b/crates/engine/src/selection_behaviour_tests.rs index c58527286..b3289c6c3 100644 --- a/crates/engine/src/selection_behaviour_tests.rs +++ b/crates/engine/src/selection_behaviour_tests.rs @@ -271,14 +271,12 @@ fn keyboard_selection() { ex(&mut s, cmd, json!({})); assert_eq!(sorted(s.selection()), sorted(after), "{why}"); } - // Esc steps out to the parent, then deselects. + // Esc clears the selection at once, whatever the nesting (measured in Figma). ex(&mut s, "select.set", json!({"ids": [k.a]})); s.escape().unwrap(); - assert_eq!(s.selection(), vec![k.g], "Esc selects the parent"); + assert_eq!(s.selection(), Vec::::new(), "Esc from a nested layer selects nothing, not the parent"); s.escape().unwrap(); - assert_eq!(s.selection(), vec![k.f]); - s.escape().unwrap(); - assert_eq!(s.selection(), Vec::::new(), "Esc on a top-level layer deselects"); + assert_eq!(s.selection(), Vec::::new()); } #[test] diff --git a/crates/ui-egui/src/proto_editor_tests.rs b/crates/ui-egui/src/proto_editor_tests.rs index b16894425..45fbe4d65 100644 --- a/crates/ui-egui/src/proto_editor_tests.rs +++ b/crates/ui-egui/src/proto_editor_tests.rs @@ -328,8 +328,8 @@ fn edit_delete_from_the_menu_removes_the_open_interaction_not_the_layer() { } #[test] -fn escape_closes_prototype_editor_without_deselecting_layer() { - let (s, a, _b, btn) = setup(); +fn escape_closes_prototype_editor_and_the_next_deselects() { + let (s, _a, _b, btn) = setup(); let mut u = Ui::new(s); u.app.ui.right_tab = crate::RightTab::Prototype; u.run("select.set", json!({"ids": [btn]})); @@ -344,13 +344,9 @@ fn escape_closes_prototype_editor_without_deselecting_layer() { assert_eq!(crate::proto_panel::editor(&u.ctx), None); assert_eq!(u.app.session.selection(), vec![btn], "layer remains selected"); - // Second Escape steps out to parent frame. + // Second Escape clears the selection, not stepping out to the parent frame. u.key(pos2(100.0, 100.0), egui::Key::Escape); - assert_eq!(u.app.session.selection(), vec![a], "steps out to parent frame"); - - // Third Escape deselects all. - u.key(pos2(100.0, 100.0), egui::Key::Escape); - assert!(u.app.session.selection().is_empty(), "selection cleared on third escape"); + assert!(u.app.session.selection().is_empty(), "the second Escape deselects"); } /// After a click in the Pages list, Delete that removes an interaction ends the list's hold on the diff --git a/docs/ui-parity.md b/docs/ui-parity.md index aa0ef25bd..e48e8b0ef 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -59,6 +59,7 @@ interaction feel not yet compared. | Click, Shift-click, marquee, Shift-marquee toggle | done | Shift-drag on a selected layer moves the selection, kept to one axis (#498); a marquee selects what it touches; from a top-level frame's background, the layers inside it; locked and hidden layers are skipped (`selection_behaviour_tests`) | | Deep select (Cmd/Ctrl-click, Cmd/Ctrl-marquee) | done | | | Select layer menu (every layer under the click) | done | | +| Escape with layers selected | done | clears the selection at once, whatever the nesting; it never selects the parent. Measured in the Figma web app (2026-11-08) with a rectangle in a group in a frame, selected from the canvas (a double-click into the group), from the Layers panel, and after Tab moved the selection to its sibling: one Escape selects nothing, a second leaves nothing selected. Escape still leaves text and vector editing, ends gestures and the pen first, and ends the focus view once nothing or the focused frame is selected (`selection_behaviour_tests`, `devfocus_tests`) | | Enter / Shift+Enter (children / parent), Tab / Shift+Tab (siblings) | done | Tab renames the next layer while renaming | | Resize handles: Shift keeps proportions, Alt from centre, constraints-aware | done | Alt shrinks too; past an edge flips (several layers mirror); groups and mixed rotations scale each layer along its own axes, keeping rotation and flip (no skew: children turned off a right angle are approximate); Cmd/Ctrl ignores a frame's constraints (`transform_behaviour_tests`) | | Rotate just outside a corner; Shift in 15° steps | done | rotated handle box when layers share a rotation | @@ -186,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look ## Revision history | Date | Change | Summary | +| 2026-11-08 | patch | Selection: Escape with layers selected clears the selection instead of stepping out to the parent first. Measured in the Figma web app with a rectangle in a group in a frame, selected from the canvas, from the Layers panel and after Tab: one Escape selects nothing. Editing, gestures and the pen still end first | |---|---|---| | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | From 476daeab8ea7ecc2174336d932f53deec30226bc Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 00:23:51 -0500 Subject: [PATCH 035/239] Tests: paste lands in place, at the view's centre, or in a selected frame's centre, as measured in Figma Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at low --- crates/engine/src/design_paste_tests.rs | 63 +++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/crates/engine/src/design_paste_tests.rs b/crates/engine/src/design_paste_tests.rs index 52dc42305..497ce2f33 100644 --- a/crates/engine/src/design_paste_tests.rs +++ b/crates/engine/src/design_paste_tests.rs @@ -106,3 +106,66 @@ fn other_content_is_refused_without_changes() { assert_eq!(s.doc().unwrap().nodes().count(), before); assert!(s.clipboard.nodes.is_empty()); } + +// The next four pin the paste-placement rules measured in Figma's web app on 2026-11-08 (a +// synthetic file): in place when the original is in view, at the view's centre when it is off +// screen, in a selected frame's centre when the frame is elsewhere, and in place inside a selected +// frame that contains the original. + +fn copied_rect(s: &mut Session) -> NodeId { + let r = id(&s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 50, "height": 50})).unwrap()); + s.execute("edit.copy", &json!({"ids": [r]})).unwrap(); + r +} + +fn pasted(s: &mut Session) -> NodeId { + let r = s.execute("edit.paste", &json!({})).unwrap(); + params::id_of(&r["ids"][0]).unwrap() +} + +#[test] +fn paste_with_the_original_in_view_lands_in_place_above_it() { + let mut s = Session::new(); + let page = s.page().unwrap(); + let r = copied_rect(&mut s); + s.execute("view.set", &json!({"zoom": 1, "cx": 125, "cy": 125})).unwrap(); + let c = pasted(&mut s); + let b = s.doc().unwrap().world_bounds(c).unwrap(); + assert_eq!((b.x0, b.y0), (100.0, 100.0)); + assert_eq!(s.selection(), [c]); + assert_eq!(s.doc().unwrap().node(page).unwrap().children, [r, c]); +} + +#[test] +fn paste_with_the_original_off_screen_lands_at_the_view_centre() { + let mut s = Session::new(); + copied_rect(&mut s); + s.execute("view.set", &json!({"zoom": 1, "cx": 5000, "cy": 3000})).unwrap(); + let c = pasted(&mut s); + let b = s.doc().unwrap().world_bounds(c).unwrap(); + assert_eq!((b.center().x, b.center().y), (5000.0, 3000.0)); +} + +#[test] +fn paste_into_a_selected_far_frame_lands_at_its_centre() { + let mut s = Session::new(); + copied_rect(&mut s); + let f = id(&s.execute("frame.create", &json!({"x": 2000, "y": 1000, "width": 300, "height": 300})).unwrap()); + s.execute("select.set", &json!({"ids": [f]})).unwrap(); + let c = pasted(&mut s); + assert_eq!(s.doc().unwrap().node(c).unwrap().parent, Some(f)); + let b = s.doc().unwrap().world_bounds(c).unwrap(); + assert_eq!((b.center().x, b.center().y), (2150.0, 1150.0)); +} + +#[test] +fn paste_into_a_selected_frame_holding_the_original_keeps_its_place() { + let mut s = Session::new(); + copied_rect(&mut s); + let f = id(&s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 500, "height": 500})).unwrap()); + s.execute("select.set", &json!({"ids": [f]})).unwrap(); + let c = pasted(&mut s); + assert_eq!(s.doc().unwrap().node(c).unwrap().parent, Some(f)); + let b = s.doc().unwrap().world_bounds(c).unwrap(); + assert_eq!((b.x0, b.y0), (100.0, 100.0)); +} From bceb5476e0d9d170155dfff32107e6ec366a698e Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 00:31:58 -0500 Subject: [PATCH 036/239] Docs: the new history row below the table's separator (#2107 review) Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- docs/ui-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index e48e8b0ef..70d495bd0 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -187,8 +187,8 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look ## Revision history | Date | Change | Summary | -| 2026-11-08 | patch | Selection: Escape with layers selected clears the selection instead of stepping out to the parent first. Measured in the Figma web app with a rectangle in a group in a frame, selected from the canvas, from the Layers panel and after Tab: one Escape selects nothing. Editing, gestures and the pen still end first | |---|---|---| +| 2026-11-08 | patch | Selection: Escape with layers selected clears the selection instead of stepping out to the parent first. Measured in the Figma web app with a rectangle in a group in a frame, selected from the canvas, from the Layers panel and after Tab: one Escape selects nothing. Editing, gestures and the pen still end first | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 1b7ce67966a3d74b9f2aba23e69108de2aea74fe Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 00:31:58 -0500 Subject: [PATCH 037/239] Docs: a stored width that isn't a number falls back to 240; one date; no local notes path (#2103 review) Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/ui-egui/src/app.rs | 3 ++- docs/ui-parity.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 9b603c90e..3160161da 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -22,7 +22,8 @@ impl FigApp { /// state. pub fn new(session: Session, services: Box) -> Self { // The main window's panels open as wide as they were left. - // Widths saved under other limits are clamped to the current ones, not rejected. + // Widths saved under other limits are clamped to the current ones, not rejected; one that + // isn't finite falls back to the default. let (left_width, right_width) = session.prefs.panel_widths; let within = |w: f32, range: std::ops::RangeInclusive| if w.is_finite() { w.clamp(*range.start(), *range.end()) } else { PANEL_DEFAULT }; let (left_width, right_width) = (within(left_width, LEFT_PANEL), within(right_width, RIGHT_PANEL)); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index dc1d0e387..022a362e8 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -20,7 +20,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 | rail and tab strip icons 20 pt (#553); 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 (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 240–450, right 240–500, 240 by default, as measured in Figma's web app on 2026-11-08 (`plan/loop/measurements/scrub-and-panels.md`); 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 width saved under other limits is clamped to the current ones on load), 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`). The double-click reset to 240 matches Figma's; no snap points | +| Resizable panels | done | each panel's edge drags its width (left 240–450, right 240–500, 240 by default, as measured in Figma's web app on 2026-11-08; 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 width saved under other limits is clamped to the current ones on load, and one that isn't a number, NaN or infinite, falls back to 240), 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`). The double-click reset to 240 matches Figma's; 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 | | Context menus | done | canvas and layers; submenus as in the main menu below, and a right-click in a new spot starts a fresh menu (Select layer closed); Shift+F10 or the keyboard's Menu key opens them from the keyboard (at the focused layer row or below the canvas selection) and the menu takes the keyboard (`layers_keyboard_tests`) | @@ -187,7 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| -| 2026-11-07 | patch | Panels: the sidebars' width limits are Figma's, measured in its web app (left 240 to 450, right 240 to 500, both 240 by default, a double-click on the edge resets), where FigCraft had left 200 to 480 and right 240 to 480; widths saved under the old limits are clamped on load | +| 2026-11-08 | patch | Panels: the sidebars' width limits are Figma's, measured in its web app (left 240 to 450, right 240 to 500, both 240 by default, a double-click on the edge resets), where FigCraft had left 200 to 480 and right 240 to 480; widths saved under the old limits are clamped on load | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From ad701088a27b69be2cb22c5d2f51055d56bed966 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 00:38:49 -0500 Subject: [PATCH 038/239] Vector edit: Cut deletes exactly what it copies for a selected region (#2105 review) Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- .../engine/src/cmd/edit/vector_clipboard.rs | 11 +++++--- .../src/cmd/edit/vector_clipboard_tests.rs | 25 +++++++++++++++++++ docs/ui-parity.md | 4 +-- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/cmd/edit/vector_clipboard.rs b/crates/engine/src/cmd/edit/vector_clipboard.rs index d9efea269..1a600f119 100644 --- a/crates/engine/src/cmd/edit/vector_clipboard.rs +++ b/crates/engine/src/cmd/edit/vector_clipboard.rs @@ -22,6 +22,8 @@ pub(super) struct EditSelection { pub any: bool, /// Each edited layer with something to copy, and the sub-network that is. pub parts: Vec<(NodeId, VectorNetwork)>, + /// What Cut removes, per edited layer: the same points and segments the copy was built from. + pub delete: Vec, } /// The selection of the vector being edited (and the other layers edited with it), or `None` when @@ -29,7 +31,7 @@ pub(super) struct EditSelection { pub(super) fn edit_selection(s: &Session) -> Option { let ds = s.ds().ok()?; let ve = ds.vector_edit.as_ref()?; - let mut sel = EditSelection { any: false, parts: Vec::new() }; + let mut sel = EditSelection { any: false, parts: Vec::new(), delete: Vec::new() }; for part in ve.parts() { if part.vertices.is_empty() && part.segments.is_empty() { continue; @@ -44,6 +46,7 @@ pub(super) fn edit_selection(s: &Session) -> Option { if active { segments.extend(ve.regions.iter().filter_map(|r| net.regions.get(*r)).flat_map(|r| r.loops.iter().flatten().copied())); } + sel.delete.push(EditPart { id: part.id, vertices: vertices.clone(), segments: segments.clone() }); if let Some(sub) = sub_network(net, &vertices, &segments) { sel.parts.push((part.id, sub)); } @@ -144,10 +147,10 @@ pub(super) fn copy_selection(s: &mut Session, cmd: &str, sel: EditSelection) -> /// the same layer and edit mode stays on). A selection that has no segment to copy (lone points /// with nothing attached) is removed and the clipboard is left as it was. pub(super) fn cut_selection(s: &mut Session, sel: EditSelection) -> Result { + let cut = sel.parts.len(); let segments = if sel.parts.is_empty() { 0 } else { copy_parts(s, "edit.cut", &sel)? }; - let parts: Vec = vectoredit::editing(s)?.parts(); - vectoredit::delete_selection(s, parts, false)?; - Ok(json!({"cut": sel.parts.len(), "segments": segments})) + vectoredit::delete_selection(s, sel.delete, false)?; + Ok(json!({"cut": cut, "segments": segments})) } /// The network of the outline of copied layer `n` in its own coordinates: a vector's segments, a diff --git a/crates/engine/src/cmd/edit/vector_clipboard_tests.rs b/crates/engine/src/cmd/edit/vector_clipboard_tests.rs index 012a110fe..4490a21f2 100644 --- a/crates/engine/src/cmd/edit/vector_clipboard_tests.rs +++ b/crates/engine/src/cmd/edit/vector_clipboard_tests.rs @@ -322,3 +322,28 @@ fn copy_cut_and_paste_survive_junk_in_vector_edit_mode() { } } } + +#[test] +fn cutting_a_selected_region_deletes_exactly_the_segments_it_copies_and_keeps_a_tail() { + let mut s = Session::new(); + let r = ex(&mut s, "vector.create", json!({"points": [[100, 100], [200, 100], [150, 200]], "closed": true})); + let id = id_of(&r); + // A tail: one open segment from the first corner to a new point. + crate::vectoredit::edit(s.doc_mut().unwrap(), id, |n| { + n.vertices.push(figcraft_doc::Vertex::new(20.0, 20.0)); + let tail = n.vertices.len() - 1; + crate::vectoredit::ops::connect(n, 0, tail, (0.0, 0.0), (0.0, 0.0)); + }) + .unwrap(); + assert_eq!((net(&s, id).segments.len(), net(&s, id).regions.len()), (4, 1)); + ex(&mut s, "vector.edit.begin", json!({"id": id})); + ex(&mut s, "vector.edit.select", json!({"regions": [0]})); + ex(&mut s, "edit.cut", json!({})); + let n = net(&s, id); + assert_eq!(n.segments.len(), 1, "only the tail is left"); + assert!(n.regions.is_empty()); + leave(&mut s); + ex(&mut s, "edit.paste", json!({})); + let new = *layers(&s).last().unwrap(); + assert_eq!(net(&s, new).segments.len(), 3, "the copy holds the region's three segments, not the tail"); +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 98816af28..930f41cb6 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-04 · **Change:** minor (copy, cut and paste in vector edit mode act on the selected points and segments (#1875); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-08 · **Change:** minor (copy, cut and paste in vector edit mode act on the selected points and segments (#1875); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -187,7 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| -| 2026-11-07 | minor | Vector edit mode, #1875, measured in Figma (web, real keys): Copy with segments selected takes only those (with just a point selected, the segments touching it) and a paste outside edit mode is a new vector layer in place; Cut removes them, the path splitting into subpaths in the same layer with edit mode staying on, and a paste outside gives a new layer with the cut segments; Paste while editing a vector adds the clipboard's segments, or a copied layer's outline, to the same network in place, selecting the pasted points, with no new layer and the bounds growing. FigCraft copied the whole layer, Cut left nothing to paste and Paste did nothing. `edit.copy`, `edit.cut` and `edit.paste` act so with no `ids`/`parent` given (Ctrl+X is the real Cut again; Shift+Delete still heals); the copy carries the layer's look (fills, strokes, effects, opacity, blend; the width profile only when every segment is copied); layers with no outline are skipped. Tests: `vector_clipboard_tests` | +| 2026-11-08 | minor | Vector edit mode, #1875, measured in Figma (web, real keys): Copy with segments selected takes only those (with just a point selected, the segments touching it) and a paste outside edit mode is a new vector layer in place; Cut removes them, the path splitting into subpaths in the same layer with edit mode staying on, and a paste outside gives a new layer with the cut segments; Paste while editing a vector adds the clipboard's segments, or a copied layer's outline, to the same network in place, selecting the pasted points, with no new layer and the bounds growing. FigCraft copied the whole layer, Cut left nothing to paste and Paste did nothing. `edit.copy`, `edit.cut` and `edit.paste` act so with no `ids`/`parent` given (Ctrl+X is the real Cut again; Shift+Delete still heals); the copy carries the layer's look (fills, strokes, effects, opacity, blend; the width profile only when every segment is copied); layers with no outline are skipped. Tests: `vector_clipboard_tests` | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From d036eb2f9b4255f0c03531a1aee1bc2897fba179 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 00:42:50 -0500 Subject: [PATCH 039/239] Tests: the UI arrow-pan test at the new step; the step at other zooms and on both axes (#2106 review) Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at low --- crates/engine/src/cmd/view.rs | 29 ++++++++++++++++++++++ crates/ui-egui/src/inspect_fields_tests.rs | 6 ++--- crates/ui-egui/src/shortcut_keys_tests.rs | 6 ++--- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/cmd/view.rs b/crates/engine/src/cmd/view.rs index c58c31d94..0dfd4f28a 100644 --- a/crates/engine/src/cmd/view.rs +++ b/crates/engine/src/cmd/view.rs @@ -688,4 +688,33 @@ mod start_on_home_tests { let v = &s.ds().unwrap().view; assert_eq!((v.cx, v.cy), (364.0, -120.0), "Shift pans 320 px"); } + + #[test] + fn the_arrow_pan_is_the_same_screen_distance_at_any_zoom_on_both_axes() { + // (zoom, dx, dy, big, expected centre change in document px) + let cases = [ + (2.0, 1.0, 0.0, false, 32.0, 0.0), + (0.5, 1.0, 0.0, false, 128.0, 0.0), + (2.0, 0.0, 1.0, true, 0.0, 160.0), + (0.5, 0.0, 1.0, true, 0.0, 640.0), + (1.0, -1.0, 0.0, false, -64.0, 0.0), + (1.0, 1.0, 0.0, true, 320.0, 0.0), + (1.0, -1.0, 0.0, true, -320.0, 0.0), + (1.0, 0.0, -1.0, false, 0.0, -64.0), + (1.0, 0.0, 1.0, false, 0.0, 64.0), + (1.0, 0.0, -1.0, true, 0.0, -320.0), + ]; + for (zoom, dx, dy, big, ex, ey) in cases { + let mut s = crate::Session::new(); + s.execute("view.set", &json!({"zoom": zoom, "cx": 300, "cy": 200})).unwrap(); + s.execute("view.pan", &json!({"dx": dx, "dy": dy, "big": big})).unwrap(); + let v = &s.ds().unwrap().view; + let got = (v.cx - 300.0, v.cy - 200.0); + assert!( + (got.0 - ex).abs() < 1e-6 && (got.1 - ey).abs() < 1e-6, + "zoom {zoom} dx {dx} dy {dy} big {big}: moved {got:?}, expected {:?}", + (ex, ey) + ); + } + } } diff --git a/crates/ui-egui/src/inspect_fields_tests.rs b/crates/ui-egui/src/inspect_fields_tests.rs index bdd0abcd8..9164f02b8 100644 --- a/crates/ui-egui/src/inspect_fields_tests.rs +++ b/crates/ui-egui/src/inspect_fields_tests.rs @@ -62,12 +62,12 @@ fn control_key_arrows_pan_with_nothing_selected() { (v.cx, v.cy) }; call(&mut u, "ui.key", json!({"key": "ArrowRight"})).unwrap(); - assert_eq!(view(&u), (10.0, 0.0), "20 screen pixels at 200%"); + assert_eq!(view(&u), (32.0, 0.0), "64 screen pixels at 200% are 32 document pixels"); call(&mut u, "ui.key", json!({"key": "ArrowUp", "shift": true})).unwrap(); - assert_eq!(view(&u), (10.0, -100.0), "Shift: ten times as far"); + assert_eq!(view(&u), (32.0, -160.0), "Shift: 320 screen pixels, 160 document pixels"); u.app.run("select.set", json!({"ids": [r]})); call(&mut u, "ui.key", json!({"key": "ArrowRight"})).unwrap(); - assert_eq!(view(&u), (10.0, -100.0), "with a selection the view stays"); + assert_eq!(view(&u), (32.0, -160.0), "with a selection the view stays"); let id = figcraft_engine::params::id_of(&r).unwrap(); assert_eq!(u.app.session.doc().unwrap().world_bounds(id).unwrap().x0, 1.0, "the selection moved instead"); // With a shape tool chosen and nothing selected the arrows move the placement crosshair diff --git a/crates/ui-egui/src/shortcut_keys_tests.rs b/crates/ui-egui/src/shortcut_keys_tests.rs index dbe6ab3b9..e48a3d0bb 100644 --- a/crates/ui-egui/src/shortcut_keys_tests.rs +++ b/crates/ui-egui/src/shortcut_keys_tests.rs @@ -44,13 +44,13 @@ fn arrows_pan_the_view_when_nothing_is_selected() { u.app.run("select.set", json!({"ids": []})); u.app.run("view.set", json!({"zoom": 2.0, "cx": 0, "cy": 0})); press(&mut u, Key::ArrowRight, Modifiers::NONE); - assert_eq!(view(&u), (10.0, 0.0, 2.0), "20 screen pixels at 200%"); + assert_eq!(view(&u), (32.0, 0.0, 2.0), "64 screen pixels at 200% are 32 document pixels"); press(&mut u, Key::ArrowUp, Modifiers::SHIFT); - assert_eq!(view(&u), (10.0, -100.0, 2.0), "Shift: ten times as far"); + assert_eq!(view(&u), (32.0, -160.0, 2.0), "Shift: 320 screen pixels, 160 document pixels"); // With a selection the arrows nudge it and the view stays. u.app.run("select.set", json!({"ids": [r]})); press(&mut u, Key::ArrowRight, Modifiers::NONE); - assert_eq!(view(&u), (10.0, -100.0, 2.0)); + assert_eq!(view(&u), (32.0, -160.0, 2.0)); assert_eq!(u.app.session.doc().unwrap().world_bounds(r).unwrap().x0, 1.0); } From db1bec08c87626d1c0f7fd161119693330984040 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sun, 8 Nov 2026 06:31:13 +0000 Subject: [PATCH 040/239] Reject invalid layer ids in file.export and file.exportLayers Found while testing crates/engine/src/cmd/file/export.rs:89 (export; same pattern at :332 in export_layers) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd/file/export.rs | 17 ++++++++++++++--- crates/engine/src/export_behaviour_tests.rs | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/file/export.rs b/crates/engine/src/cmd/file/export.rs index 542ee246c..de426ba89 100644 --- a/crates/engine/src/cmd/file/export.rs +++ b/crates/engine/src/cmd/file/export.rs @@ -1,7 +1,7 @@ use super::load::{ext, write}; use super::save::thumbnail; use super::*; -use crate::params::f64_of; +use crate::params::{f64_of, req_targets}; /// Encode `ids` (or the page) in `format` at `scale`. pub fn export_bytes(doc: &Document, ids: &[NodeId], format: ExportFormat, scale: f64) -> Result> { @@ -86,7 +86,7 @@ pub(super) fn export(s: &mut Session, p: &Value) -> Result { _ => {} } let doc = s.doc()?; - let mut ids = targets(s, p); + let mut ids = export_targets(cmd, s, p)?; if ids.is_empty() { ids = doc.get(s.page()?)?.children.clone(); } @@ -325,11 +325,22 @@ pub fn exportable_layers(doc: &Document, page: NodeId) -> Vec { doc.subtree(page).into_iter().skip(1).filter(|i| doc.node(*i).is_some_and(|n| !n.exports.is_empty())).collect() } +/// Named layers (`ids` / `id`), checked like other commands; empty when none are named, so the +/// caller can fall back to its default instead of silently dropping a bad id. +fn export_targets(cmd: &str, s: &Session, p: &Value) -> Result> { + let named = match get(p, "ids") { + Some(Value::Array(a)) if !a.is_empty() => true, + Some(Value::Array(_) | Value::Null) | None => get(p, "id").is_some_and(|v| !v.is_null()), + Some(_) => true, + }; + if named { req_targets(cmd, s, p) } else { Ok(targets(s, p)) } +} + pub(super) fn export_layers(s: &mut Session, p: &Value) -> Result { let cmd = "file.exportLayers"; let doc = s.doc()?; let assets = boolean(p, "assets").unwrap_or(false); - let mut ids = targets(s, p); + let mut ids = export_targets(cmd, s, p)?; if ids.is_empty() { ids = if assets { vec![s.page()?] } else { exportable_layers(doc, s.page()?) }; } diff --git a/crates/engine/src/export_behaviour_tests.rs b/crates/engine/src/export_behaviour_tests.rs index 1cd836784..492fbf881 100644 --- a/crates/engine/src/export_behaviour_tests.rs +++ b/crates/engine/src/export_behaviour_tests.rs @@ -384,3 +384,17 @@ fn copy_as_png_svg_and_code() { let css = crate::codegen::code_for(doc, a, crate::codegen::CodeLang::Css); assert!(css.contains("background: #FF0000;"), "Copy as CSS is the layer's CSS from Inspect"); } + +#[test] +fn export_rejects_an_invalid_layer_id_instead_of_exporting_the_page() { + let mut s = Session::new(); + let r = rect(&mut s, 0.0, 0.0, 10.0, 10.0, "#ff0000", None); + ex(&mut s, "export.add", json!({"ids": [r]})); + for cmd in ["file.export", "file.exportLayers"] { + for p in [json!({"ids": ["abc"], "format": "svg"}), json!({"id": "abc", "format": "svg"}), json!({"ids": [], "id": "abc", "format": "svg"})] { + let res = s.execute(cmd, &p); + assert!(res.is_err(), "{cmd} {p} exported for an invalid id: {res:?}"); + } + } + assert!(s.execute("file.export", &json!({"format": "svg"})).is_ok()); +} From ebd463fa5f4172a549839604691ffd38eebff949 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 01:31:31 -0500 Subject: [PATCH 041/239] Tests: the comment says which paste cases were measured and which pins FigCraft's own branch (#2108 review) Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/engine/src/design_paste_tests.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/design_paste_tests.rs b/crates/engine/src/design_paste_tests.rs index 497ce2f33..6823645ed 100644 --- a/crates/engine/src/design_paste_tests.rs +++ b/crates/engine/src/design_paste_tests.rs @@ -107,10 +107,11 @@ fn other_content_is_refused_without_changes() { assert!(s.clipboard.nodes.is_empty()); } -// The next four pin the paste-placement rules measured in Figma's web app on 2026-11-08 (a +// The next three pin the paste-placement rules measured in Figma's web app on 2026-11-08 (a // synthetic file): in place when the original is in view, at the view's centre when it is off -// screen, in a selected frame's centre when the frame is elsewhere, and in place inside a selected -// frame that contains the original. +// screen, and in a selected frame's centre when the frame is elsewhere. The fourth pins +// FigCraft's own branch for a selected frame that contains the original (in place inside it), +// which was not measured. fn copied_rect(s: &mut Session) -> NodeId { let r = id(&s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 50, "height": 50})).unwrap()); From 87ce9612e6f2225ab1d288fe06edc89caf052475 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 01:44:23 -0500 Subject: [PATCH 042/239] Vector edit clipboard: Cut and Copy with only lone points are refused; one x/y refused; the system clipboard gets the partial copy; specs match (#2105 review) Cut with nothing to copy (only points that touch no segment) is Disabled and changes nothing, as Copy now is (Copy used to fall through to the whole layer); paste borrows the clipboard instead of cloning it; a partial copy or cut mirrors its SVG to the system clipboard; x without y (or y without x) is refused; the junk test asserts refusals change nothing and accepted results are finite; the edit.copy, edit.cut and edit.paste specs state the behaviour and the mode-specific paste response. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/cmd/edit.rs | 7 +- crates/engine/src/cmd/edit/clipboard.rs | 4 +- .../engine/src/cmd/edit/vector_clipboard.rs | 40 +++++- .../src/cmd/edit/vector_clipboard_tests.rs | 121 ++++++++++++++++-- crates/ui-egui/src/menus.rs | 7 +- 5 files changed, 152 insertions(+), 27 deletions(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 19a7d7011..c03721af4 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -18,6 +18,7 @@ mod props; pub(crate) use props::{edit_region_fills, fill_regions}; mod select; mod vector_clipboard; +pub use vector_clipboard::clipboard_svg; #[cfg(test)] mod vector_clipboard_tests; @@ -123,21 +124,21 @@ pub fn specs() -> Vec { spec!( "edit.copy", "Copy", - "{ids?} in vector edit mode with points or segments selected (and no ids): just those, the segments touching a selected point, as a new vector with the edited layer's look", + "{ids?} in vector edit mode with points or segments selected (and no ids): just those, the segments touching a selected point, as a temporary vector on the clipboard (one per edited layer) with the edited layer's look, kept at its place on the page; points that touch no segment have nothing to copy, so Copy with only those is refused (Disabled). Returns {copied, segments}", false, copy ), spec!( "edit.cut", "Cut", - "{ids?} in vector edit mode with points or segments selected (and no ids): copies them as Copy does, then removes them as Delete does; the path splits in the same layer and edit mode stays on", + "{ids?} in vector edit mode with points or segments selected (and no ids): copies them as Copy does, then removes them as Delete does; the path splits in the same layer and edit mode stays on. Returns {cut (layers), segments}. With only lone points (nothing to copy) it is refused (Disabled) and changes nothing, as Copy is; Delete removes lone points", true, cut ), spec!( "edit.paste", "Paste", - "{parent?, x?, y? (page coordinates of the pasted top-left)} in vector edit mode (and no parent): the copied vectors' segments and shapes' outlines join the edited vector's network in place, selected, and the layers that have no outline (text, frames, groups) are skipped (`skipped`); a copied main component pastes as an instance of it within its file (cut ones, and pastes into other files, keep the component)", + "{parent?, x?, y? (page coordinates of the pasted top-left; give both or neither, one alone is refused)} in vector edit mode (and no parent): the copied vectors' segments and the outlines of shapes, booleans and lines join the edited vector's network (at x/y when given, else in place), their points selected, as one undo step; layers with no outline (text, images, instances, frames, groups) are skipped and named in `skipped` (present only when some were), and when none has an outline the paste is refused (Disabled), as it is past 500,000 segments in one vector. Returns {ids: [] (always empty: no layer is created), edited (the vector's id), vertices (points added), skipped?}, unlike a paste outside edit mode, which returns the new layers' `ids`; a copied main component pastes as an instance of it within its file (cut ones, and pastes into other files, keep the component)", true, paste ), diff --git a/crates/engine/src/cmd/edit/clipboard.rs b/crates/engine/src/cmd/edit/clipboard.rs index da5089419..a04bfcb5c 100644 --- a/crates/engine/src/cmd/edit/clipboard.rs +++ b/crates/engine/src/cmd/edit/clipboard.rs @@ -193,8 +193,9 @@ pub(super) fn copy(s: &mut Session, p: &Value) -> Result { // In vector edit mode with points or segments selected, Copy takes just those (#1875). if !names_layers(p) && let Some(sel) = vector_clipboard::edit_selection(s) - && !sel.parts.is_empty() + && sel.any { + // Only lone points selected: nothing to copy, and not the whole layer either. return vector_clipboard::copy_selection(s, "edit.copy", sel); } let ids = req_targets("edit.copy", s, p)?; @@ -208,6 +209,7 @@ pub(super) fn cut(s: &mut Session, p: &Value) -> Result { && let Some(sel) = vector_clipboard::edit_selection(s) && sel.any { + // Lone points with nothing to copy: `cut_selection` refuses, as Copy does. return vector_clipboard::cut_selection(s, sel); } let ids = req_targets("edit.cut", s, p)?; diff --git a/crates/engine/src/cmd/edit/vector_clipboard.rs b/crates/engine/src/cmd/edit/vector_clipboard.rs index 1a600f119..72c60bf02 100644 --- a/crates/engine/src/cmd/edit/vector_clipboard.rs +++ b/crates/engine/src/cmd/edit/vector_clipboard.rs @@ -7,6 +7,7 @@ //! while editing adds the clipboard's layers to the edited vector's network, in place: a vector //! with its segments, a shape or boolean with its outline. +use crate::bad; use figcraft_doc::{NodeKind, Region, VectorNetwork}; use super::clipboard::{collect_images, store_clipboard}; @@ -144,15 +145,37 @@ pub(super) fn copy_selection(s: &mut Session, cmd: &str, sel: EditSelection) -> } /// Cut: copy the selected segments, then remove the selection as Delete does (the path splits in -/// the same layer and edit mode stays on). A selection that has no segment to copy (lone points -/// with nothing attached) is removed and the clipboard is left as it was. +/// the same layer and edit mode stays on). Cut is Copy plus Delete, so it is refused exactly where +/// Copy is: a selection with nothing to copy (only lone points that touch no segment) is +/// `Disabled` and changes nothing, clipboard included. Delete removes such points. pub(super) fn cut_selection(s: &mut Session, sel: EditSelection) -> Result { + if sel.parts.is_empty() { + return Err(EngineError::Disabled("edit.cut".into(), "the selection has nothing to copy (Delete removes lone points)".into())); + } let cut = sel.parts.len(); - let segments = if sel.parts.is_empty() { 0 } else { copy_parts(s, "edit.cut", &sel)? }; + let segments = copy_parts(s, "edit.cut", &sel)?; vectoredit::delete_selection(s, sel.delete, false)?; Ok(json!({"cut": cut, "segments": segments})) } +/// The SVG of the layers a partial vector-edit copy or cut put on the clipboard, for the system +/// clipboard: they are temporary layers that live only in the clipboard, so they are placed in a +/// scratch document to export. `None` when the clipboard holds none or the export fails. +pub fn clipboard_svg(s: &Session) -> Option { + let mut scratch = Document::new("Clipboard"); + let page = scratch.current_page?; + for (k, v) in &s.clipboard.images { + scratch.images.insert(k.clone(), v.clone()); + } + let mut ids = Vec::new(); + for (root, nodes) in &s.clipboard.nodes { + let map: BTreeMap = nodes.iter().map(|n| (n.id, scratch.alloc_id())).collect(); + ids.push(scratch.paste_nodes(nodes, &map, *root, page, None).ok()?); + } + let bytes = crate::cmd::file::export_bytes(&scratch, &ids, figcraft_doc::ExportFormat::Svg, 1.0).ok()?; + String::from_utf8(bytes).ok() +} + /// The network of the outline of copied layer `n` in its own coordinates: a vector's segments, a /// shape's or boolean's outline. `None` for the layers with no outline to add (text, images, /// frames, groups, instances, …). `doc` is the file the layer was copied from. @@ -210,16 +233,18 @@ fn placed(mut net: VectorNetwork, m: Affine) -> Option { /// (named in `skipped`); when none has one, nothing is pasted. pub(super) fn paste_into_vector(s: &mut Session, p: &Value) -> Result { const CMD: &str = "edit.paste"; - let clip = s.clipboard.clone(); - if clip.nodes.is_empty() { + if s.clipboard.nodes.is_empty() { return Err(EngineError::Disabled(CMD.into(), "the clipboard is empty".into())); } let target = vectoredit::editing(s)?.id; - let shift = match (num(p, "x"), num(p, "y"), clip.bounds) { + let shift = match (num(p, "x"), num(p, "y"), s.clipboard.bounds) { (Some(x), Some(y), Some(b)) => Affine::translate((x - b.x0, y - b.y0)), - _ => Affine::IDENTITY, + (None, None, _) | (Some(_), Some(_), None) => Affine::IDENTITY, + _ => return Err(bad(CMD, "give both x and y, or neither")), }; let live = s.doc()?; + // Borrow the clipboard (it holds the source document and the images) to build the pieces. + let clip = &s.clipboard; let source: &Document = clip.source.as_deref().unwrap_or(live); let to_local = live.world_transform(target).inverse() * shift; let mut pieces = Vec::new(); @@ -269,6 +294,7 @@ pub(super) fn paste_into_vector(s: &mut Session, p: &Value) -> Result { ve.pen_out = None; ve.width_point = None; })?; + // `ids` stays empty: no layer is created, the pasted outlines joined layer `edited`. let mut out = json!({"ids": [], "edited": target, "vertices": pasted.len()}); if !skipped.is_empty() { out["skipped"] = json!(skipped); diff --git a/crates/engine/src/cmd/edit/vector_clipboard_tests.rs b/crates/engine/src/cmd/edit/vector_clipboard_tests.rs index 4490a21f2..e737c11d6 100644 --- a/crates/engine/src/cmd/edit/vector_clipboard_tests.rs +++ b/crates/engine/src/cmd/edit/vector_clipboard_tests.rs @@ -291,6 +291,19 @@ fn a_selected_face_copies_its_own_outline_with_the_fill() { assert!(matches!(s.doc().unwrap().node(new).unwrap().kind, NodeKind::Vector { .. })); } +/// Everything junk must not change when a command is refused: the vector, the layers, the edit +/// selection and what the clipboard holds. +fn state(s: &Session, id: NodeId) -> String { + let ve = s.ds().unwrap().vector_edit.clone(); + let clip: Vec = s.clipboard.nodes.iter().flat_map(|(_, n)| n).map(|n| format!("{:?}", n.kind)).collect(); + format!("{:?}|{:?}|{:?}|{:?}|{}", net(s, id), layers(s), ve.map(|v| (v.vertices, v.segments)), clip, s.clipboard.layers_generation) +} + +fn finite(n: &VectorNetwork) -> bool { + n.vertices.iter().all(|v| v.x.is_finite() && v.y.is_finite()) + && n.segments.iter().all(|sg| [sg.ta.0, sg.ta.1, sg.tb.0, sg.tb.1].iter().all(|x| x.is_finite())) +} + #[test] fn copy_cut_and_paste_survive_junk_in_vector_edit_mode() { let junk = [ @@ -301,28 +314,108 @@ fn copy_cut_and_paste_survive_junk_in_vector_edit_mode() { json!({"id": "nope", "x": "NaN", "y": 1e308}), json!({"parent": "nope", "x": -1e308, "y": "x"}), json!({"x": 1e308, "y": 1e308}), + json!({"x": 1e308}), ]; for cmd in ["edit.copy", "edit.cut", "edit.paste", "edit.pasteOver", "edit.pasteReplace"] { for j in &junk { - let mut s = Session::new(); - path(&mut s); - select(&mut s, &[1], &[0]); - ex(&mut s, "text.create", json!({"text": "t"})); - if let Err(EngineError::Internal { cmd, msg }) = s.execute(cmd, j) { - panic!("{cmd} panicked on {j}: {msg}"); - } - // And after something was copied from the edit selection. - let mut s = Session::new(); - path(&mut s); - select(&mut s, &[2], &[]); - let _ = s.execute("edit.copy", &json!({})); - if let Err(EngineError::Internal { cmd, msg }) = s.execute(cmd, j) { - panic!("{cmd} panicked on {j}: {msg}"); + // Both a selection with a text layer next to it, and after a copy from the selection. + for copied in [false, true] { + let mut s = Session::new(); + let id = path(&mut s); + if copied { + select(&mut s, &[2], &[]); + let _ = s.execute("edit.copy", &json!({})); + } else { + select(&mut s, &[1], &[0]); + ex(&mut s, "text.create", json!({"text": "t"})); + ex(&mut s, "vector.edit.begin", json!({"id": id})); + select(&mut s, &[1], &[0]); + } + let before = state(&s, id); + match s.execute(cmd, j) { + Err(EngineError::Internal { cmd, msg }) => panic!("{cmd} panicked on {j}: {msg}"), + Err(_) => { + if cmd != "edit.pasteOver" && cmd != "edit.pasteReplace" { + assert_eq!(state(&s, id), before, "{cmd} {j} was refused but changed something"); + } + } + // Accepted: whatever it made has finite coordinates. + Ok(_) => { + if let Some(n) = crate::vectoredit::network(s.doc().unwrap(), id) { + assert!(finite(n), "{cmd} {j} left non-finite coordinates"); + } + } + } } } } } +#[test] +fn a_huge_paste_position_is_refused_or_stays_finite() { + let mut s = Session::new(); + let id = path(&mut s); + select(&mut s, &[], &[0]); + ex(&mut s, "edit.copy", json!({})); + let before = state(&s, id); + match s.execute("edit.paste", &json!({"x": 1e308, "y": 1e308})) { + Err(e) => { + assert!(!matches!(e, EngineError::Internal { .. }), "{e}"); + assert_eq!(state(&s, id), before, "a refused paste changed something"); + } + // It is accepted here: 1e308 plus a few hundred is still finite, so the points are too. + Ok(_) => assert!(finite(&net(&s, id)), "the points are finite"), + } +} + +#[test] +fn cut_with_only_lone_points_is_refused_like_copy_and_changes_nothing() { + let mut s = Session::new(); + let id = path(&mut s); + // A point no segment touches. + crate::vectoredit::edit(s.doc_mut().unwrap(), id, |n| n.vertices.push(figcraft_doc::Vertex::new(50.0, 50.0))).unwrap(); + // Something on the clipboard first, then only the lone point selected. + select(&mut s, &[0], &[]); + ex(&mut s, "edit.copy", json!({})); + select(&mut s, &[4], &[]); + let before = state(&s, id); + for cmd in ["edit.copy", "edit.cut"] { + let err = s.execute(cmd, &json!({})).expect_err(cmd); + assert!(matches!(err, EngineError::Disabled(..)), "{cmd}: {err}"); + assert_eq!(state(&s, id), before, "{cmd} changed something"); + } + // Delete is the way to remove it. + ex(&mut s, "vector.edit.delete", json!({})); + assert_eq!(net(&s, id).vertices.len(), 4); +} + +#[test] +fn only_one_of_x_and_y_is_refused_and_pastes_nothing() { + let mut s = Session::new(); + let id = path(&mut s); + select(&mut s, &[], &[0]); + ex(&mut s, "edit.copy", json!({})); + let before = state(&s, id); + for p in [json!({"x": 10}), json!({"y": 10})] { + let err = s.execute("edit.paste", &p).expect_err("one coordinate"); + assert!(err.to_string().contains("give both x and y, or neither"), "{err}"); + assert_eq!(state(&s, id), before); + } + ex(&mut s, "edit.paste", json!({"x": 10, "y": 10})); +} + +#[test] +fn a_partial_copy_has_an_svg_for_the_system_clipboard() { + let mut s = Session::new(); + let r = ex(&mut s, "shape.rectangle", json!({"x": 100, "y": 100, "width": 80, "height": 60})); + assert!(crate::cmd::edit::clipboard_svg(&s).is_none(), "nothing copied yet"); + ex(&mut s, "vector.edit.begin", json!({"id": id_of(&r)})); + select(&mut s, &[], &[0, 1, 2, 3]); + ex(&mut s, "edit.copy", json!({})); + let svg = crate::cmd::edit::clipboard_svg(&s).expect("svg"); + assert!(svg.contains(" Date: Sun, 8 Nov 2026 01:47:50 -0500 Subject: [PATCH 043/239] Components: the component button shows its menu arrow, Create component set is offered only where it works; tests for every refusal (#2095 review) Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/cmd/component.rs | 2 +- crates/engine/src/cmd/component/variants.rs | 41 ++++++--- .../engine/src/components_behaviour_tests.rs | 90 +++++++++++++++++++ .../ui-egui/src/create_multiple_menu_tests.rs | 29 ++++++ crates/ui-egui/src/panels/right.rs | 37 +++++--- 5 files changed, 175 insertions(+), 24 deletions(-) diff --git a/crates/engine/src/cmd/component.rs b/crates/engine/src/cmd/component.rs index 06e6bf166..f68fac714 100644 --- a/crates/engine/src/cmd/component.rs +++ b/crates/engine/src/cmd/component.rs @@ -25,7 +25,7 @@ pub(crate) use instance::{swap_at, swap_instance}; use props::{add_prop, bind_prop, delete_prop, edit_prop, set_props}; pub(crate) use props::{apply_prop_bindings, check_prop_binding, describe_props}; use variants::{add_variant, combine, create_set}; -pub use variants::{can_add_variant, can_combine_variants}; +pub use variants::{can_add_variant, can_combine_variants, can_create_set}; /// `component.hideWhenPublishing`: the leading `.` of the names of this file's components and /// sets (those `ids` are or are in), put on or taken off. diff --git a/crates/engine/src/cmd/component/variants.rs b/crates/engine/src/cmd/component/variants.rs index cfba5accf..96de6ba3a 100644 --- a/crates/engine/src/cmd/component/variants.rs +++ b/crates/engine/src/cmd/component/variants.rs @@ -94,6 +94,32 @@ pub(super) fn combine(s: &mut Session, p: &Value) -> Result { Ok(json!({"id": set})) } +/// Why `ids` (distinct) can't each become a component of a new set (`component.createSet`), or +/// `None` when they can: layers inside an instance, library copies, instances, components and +/// component sets, and a layer inside another one of `ids`. +fn create_set_refusal(doc: &Document, ids: &[NodeId]) -> Option<&'static str> { + if ids.iter().any(|i| inside_instance(doc, *i)) { + Some("layers inside an instance can't become components") + } else if ids.iter().any(|i| doc.is_remote(*i)) { + Some(crate::library::READ_ONLY) + } else if ids.iter().any(|i| { + doc.node(*i).is_some_and(|n| matches!(n.kind, NodeKind::Instance { .. } | NodeKind::Component { .. } | NodeKind::ComponentSet { .. })) + }) { + Some("select layers that aren't components, component sets or instances") + } else if roots(doc, ids).len() != ids.len() { + Some("a layer can't be in a set with one inside it") + } else { + None + } +} + +/// Whether "Create component set" is on offer for `ids`: at least one layer that +/// [`create_set_refusal`] lets through. +pub fn can_create_set(doc: &Document, ids: &[NodeId]) -> bool { + let distinct: Vec = ids.iter().copied().collect::>().into_iter().collect(); + !distinct.is_empty() && distinct.iter().all(|i| doc.contains(*i)) && create_set_refusal(doc, &distinct).is_none() +} + /// `component.createSet`: each target becomes a component (as `component.createMultiple` makes /// them) and all are wrapped in place in a component set, 20 px around, named as Figma names them: /// variants "Property 1=" in left-to-right order (a name holding `=` is kept); layers @@ -104,19 +130,8 @@ pub(super) fn create_set(s: &mut Session, p: &Value) -> Result { let mut seen = BTreeSet::new(); let ids: Vec = req_targets(cmd, s, p)?.into_iter().filter(|i| seen.insert(*i)).collect(); let doc = s.doc()?; - if ids.iter().any(|i| inside_instance(doc, *i)) { - return Err(EngineError::Disabled(cmd.into(), "layers inside an instance can't become components".into())); - } - if ids.iter().any(|i| doc.is_remote(*i)) { - return Err(EngineError::Disabled(cmd.into(), crate::library::READ_ONLY.into())); - } - if ids.iter().any(|i| { - doc.node(*i).is_some_and(|n| matches!(n.kind, NodeKind::Instance { .. } | NodeKind::Component { .. } | NodeKind::ComponentSet { .. })) - }) { - return Err(EngineError::Disabled(cmd.into(), "select layers that aren't components, component sets or instances".into())); - } - if roots(doc, &ids).len() != ids.len() { - return Err(EngineError::Disabled(cmd.into(), "a layer can't be in a set with one inside it".into())); + if let Some(why) = create_set_refusal(doc, &ids) { + return Err(EngineError::Disabled(cmd.into(), why.into())); } let mut made = Vec::new(); for i in roots(doc, &ids) { diff --git a/crates/engine/src/components_behaviour_tests.rs b/crates/engine/src/components_behaviour_tests.rs index 510fb2e74..3565a3165 100644 --- a/crates/engine/src/components_behaviour_tests.rs +++ b/crates/engine/src/components_behaviour_tests.rs @@ -1153,3 +1153,93 @@ fn create_set_refuses_a_target_inside_another_target_and_leaves_the_document_alo assert!(matches!(doc.node(frames[0]).unwrap().kind, NodeKind::Frame)); assert!(matches!(doc.node(frames[1]).unwrap().kind, NodeKind::Frame)); } + +/// Every node's id, parent, name and kind, to compare a document before and after a refused command. +fn snapshot(s: &Session) -> Vec { + s.doc().unwrap().nodes().map(|n| format!("{:?}|{:?}|{}|{:?}", n.id, n.parent, n.name, n.kind)).collect() +} + +/// A refused `component.createSet`: `Disabled`, no undo step, the document and the selection as they were. +fn assert_create_set_refused(s: &mut Session, ids: &[NodeId]) { + let (before, undo, selection) = (snapshot(s), undo_len(s), s.selection()); + let e = s.execute("component.createSet", &json!({"ids": ids})).unwrap_err(); + assert!(matches!(e, crate::EngineError::Disabled(..)), "{e:?}"); + assert_eq!(undo_len(s), undo, "no undo step"); + assert_eq!(snapshot(s), before, "the document is unchanged"); + assert_eq!(s.selection(), selection, "the selection is unchanged"); +} + +/// Nothing to wrap is refused before anything is created. +#[test] +fn create_set_refuses_no_layers_and_leaves_the_document_alone() { + let mut s = Session::new(); + named_frames(&mut s, &["A"], false); + s.execute("select.set", &json!({"ids": []})).unwrap(); + assert_create_set_refused(&mut s, &[]); +} + +/// One layer is allowed: a set of one variant, as many layers would make. +#[test] +fn create_set_with_one_layer_makes_a_one_variant_set() { + let mut s = Session::new(); + let frames = named_frames(&mut s, &["Solo"], false); + let before = undo_len(&s); + let out = s.execute("component.createSet", &json!({"ids": frames})).unwrap(); + assert_eq!(undo_len(&s), before + 1, "one undo step"); + let set = id_of(&out["id"]).unwrap(); + let doc = s.doc().unwrap(); + assert_eq!(doc.node(set).unwrap().children.len(), 1); + assert_eq!(names_by_x(&s, set), ["Property 1=Default"], "a lone layer shares its name with itself"); + assert!(matches!(doc.node(doc.node(set).unwrap().children[0]).unwrap().kind, NodeKind::Component { .. })); + s.undo().unwrap(); + assert!(matches!(s.doc().unwrap().node(frames[0]).unwrap().kind, NodeKind::Frame)); +} + +/// Each refusal branch of `create_set`, with `can_create_set` agreeing with it. +#[test] +fn create_set_refuses_every_ineligible_selection_and_leaves_the_document_alone() { + use crate::cmd::component::can_create_set; + let mut s = Session::new(); + let frames = named_frames(&mut s, &["A", "B", "C"], false); + let comp = id_of(&s.execute("component.create", &json!({"ids": [frames[0]]})).unwrap()["id"]).unwrap(); + let inst = id_of(&s.execute("instance.create", &json!({"component": comp})).unwrap()["id"]).unwrap(); + let set_frames = named_frames(&mut s, &["V1", "V2"], false); + let set = id_of(&s.execute("component.createSet", &json!({"ids": set_frames})).unwrap()["id"]).unwrap(); + // A layer inside the instance (its copy of the card's content). + let in_inst = s.doc().unwrap().node(inst).unwrap().children.first().copied(); + // A library copy. + let remote = { + let doc = s.doc_mut().unwrap(); + let store = doc.ensure_library_store(); + let remote = doc.alloc_id(); + doc.insert(Node::new(remote, NodeKind::Frame, "Remote", 10.0, 10.0), store, None).unwrap(); + remote + }; + let ok = frames[1]; + assert!(can_create_set(s.doc().unwrap(), &[ok, frames[2]])); + assert!(!can_create_set(s.doc().unwrap(), &[])); + let mut cases = vec![("instance", inst), ("library copy", remote), ("component", comp), ("component set", set)]; + if let Some(i) = in_inst { + cases.push(("inside an instance", i)); + } + for (what, bad) in cases { + assert!(!can_create_set(s.doc().unwrap(), &[ok, bad]), "{what}: not offered"); + assert_create_set_refused(&mut s, &[ok, bad]); + assert_create_set_refused(&mut s, &[bad]); + } +} + +/// A command that fails leaves no trace: the checks before the creation loop catch every +/// refusal the loop's own commands could hit, and `Session::execute` restores the document, the +/// selection and the undo stack on any error, so no half-made components can survive. +#[test] +fn a_failing_create_set_leaves_no_components_behind() { + let mut s = Session::new(); + let frames = named_frames(&mut s, &["A", "B"], false); + let (before, undo, selection) = (snapshot(&s), undo_len(&s), s.selection()); + let e = s.execute("component.createSet", &json!({"ids": [frames[0], NodeId(u64::MAX)]})); + assert!(e.is_err()); + assert_eq!(undo_len(&s), undo); + assert_eq!(snapshot(&s), before); + assert_eq!(s.selection(), selection); +} diff --git a/crates/ui-egui/src/create_multiple_menu_tests.rs b/crates/ui-egui/src/create_multiple_menu_tests.rs index 409b67e54..60d22a993 100644 --- a/crates/ui-egui/src/create_multiple_menu_tests.rs +++ b/crates/ui-egui/src/create_multiple_menu_tests.rs @@ -134,3 +134,32 @@ fn the_third_entry_creates_one_component_set() { let doc = u.app.session.doc().unwrap(); assert!(ids.iter().all(|i| matches!(doc.node(*i).map(|n| &n.kind), Some(NodeKind::Frame))), "one undo reverts it all"); } + +/// The component button's width in the Design panel: wider with a dropdown chevron beside the icon. +fn button_width(u: &mut Ui) -> f32 { + let all = nodes(u); + let button = all.iter().find(|n| n.label().is_some_and(|l| l.starts_with("Create component"))).expect("the Design panel's component button"); + bounds(button).width() +} + +#[test] +fn the_dropdown_chevron_is_there_only_for_several_layers() { + let (mut one, _) = frames(1); + let (mut two, _) = frames(2); + let (single, several) = (button_width(&mut one), button_width(&mut two)); + assert_eq!(single, 24.0, "one layer: the plain icon button"); + assert_eq!(several, 34.0, "several layers: room for the chevron"); +} + +#[test] +fn create_component_set_is_offered_only_where_it_works() { + let (mut u, ids) = frames(3); + // Make the first a component: the set can't take it, so the entry is left out. + u.app.session.execute("component.create", &json!({"ids": [ids[0]]})).unwrap(); + u.app.session.execute("select.set", &json!({"ids": ids})).unwrap(); + u.frame(vec![]); + click_button(&mut u); + let all = nodes(&mut u); + assert!(all.iter().any(|n| n.label() == Some("Create multiple components")), "the menu is open"); + assert!(all.iter().all(|n| n.label() != Some("Create component set")), "left out for a selection with a component"); +} diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index 55b36ebf5..4d7ce1b19 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -494,7 +494,10 @@ fn header(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { // Layers in boolean groups, or one boolean group: the operation they use (checked in the menu). let current = figcraft_engine::booleans::shown_op(doc, sel); for (icon, label, cmd) in actions.into_iter().rev() { - let br = Rect::from_min_size(pos2(x - 24.0, r.center().y - 12.0), vec2(24.0, 24.0)); + // With several layers the component button is a dropdown: a small chevron sits beside its icon. + let dropdown = cmd == "component.create" && sel.len() > 1; + let bw = if dropdown { 34.0 } else { 24.0 }; + let br = Rect::from_min_size(pos2(x - bw, r.center().y - 12.0), vec2(bw, 24.0)); let tip = if cmd == "bool.union" { label } else { crate::shortcuts::tip(label, cmd) }; let bresp = ui.interact(br, ui.scope_id().with(("qa", cmd)), Sense::click()).tip(tip); if bresp.hovered() { @@ -505,7 +508,11 @@ fn header(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { ("bool.union", Some(op)) => crate::layers::op_icon(op), _ => icon, }; - icons::paint(ui.painter(), br.shrink(5.0), icon, t.icon); + let icon_rect = Rect::from_min_size(br.min, vec2(24.0, 24.0)).shrink(5.0); + icons::paint(ui.painter(), icon_rect, icon, t.icon); + if dropdown { + icons::paint(ui.painter(), Rect::from_center_size(pos2(br.max.x - 6.0, br.center().y), vec2(8.0, 8.0)), Icon::Chevron, t.icon_secondary); + } if cmd == "bool.union" { menu_popup(&bresp).width(180.0).show(|ui| { for (op, c) in [ @@ -532,14 +539,24 @@ fn header(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { }); } else if cmd == "component.create" && sel.len() > 1 { // Several layers: the button opens a menu, as Figma's does (#2088). One layer keeps the plain click. - menu_popup(&bresp).width(220.0).show(|ui| { - let multiple = crate::i18n::command("component.createMultiple", "Create multiple components"); - let set = crate::i18n::command("component.createSet", "Create component set"); - for (c, label) in - [("component.create", tr("Create component")), ("component.createMultiple", &multiple), ("component.createSet", &set)] - { + let create = crate::i18n::command("component.create", "Create component"); + let multiple = crate::i18n::command("component.createMultiple", "Create multiple components"); + let set = crate::i18n::command("component.createSet", "Create component set"); + // Like the layers menu, leave out what the selection can't use. + let can_set = figcraft_engine::cmd::component::can_create_set(doc, sel); + let mut entries = vec![("component.create", &create), ("component.createMultiple", &multiple)]; + if can_set { + entries.push(("component.createSet", &set)); + } + // Wide enough for the longest translated label (the rows grow with it, the menu never clips). + let widest = entries + .iter() + .map(|(_, l)| ui.painter().layout_no_wrap(l.to_string(), regular(11.5), Color32::PLACEHOLDER).size().x) + .fold(0.0f32, f32::max); + menu_popup(&bresp).width(menu::menu_row_width(widest, 0.0).ceil().max(160.0)).show(|ui| { + for (c, label) in &entries { let key = crate::shortcuts::shortcut(c).unwrap_or(""); - if menu_icon_item(ui, None, None, label, key) { + if menu_item(ui, label, key) { app.run(c, json!({})); ui.close(); } @@ -548,7 +565,7 @@ fn header(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { } else if bresp.clicked() { app.run(cmd, json!({})); } - x -= 26.0; + x -= bw + 2.0; } crate::component_panel::instance_section(app, ui, doc, sel); } From b6739cd04f7fad411112a1b70834b0b35646dd4a Mon Sep 17 00:00:00 2001 From: Janiz-zzz <267742026+Janiz-zzz@users.noreply.github.com> Date: Sun, 8 Nov 2026 12:33:55 +0200 Subject: [PATCH 044/239] i18n(fi): translate the 50 labels Finnish lacks; Past year - "Past year" was "Viimeinen vuosi" (the last calendar year); the filter means the last 12 months: "Viimeiset 12 kuukautta" (CodeRabbit on #1993). - 40 UI strings (pick select, field scrubbing, live session reconnect, text direction, padding, variable scopes), 7 command labels, 3 menu wordings. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/locales/fi.toml | 52 +++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/locales/fi.toml b/crates/ui-egui/locales/fi.toml index 2f5db319a..d240a26b5 100644 --- a/crates/ui-egui/locales/fi.toml +++ b/crates/ui-egui/locales/fi.toml @@ -126,6 +126,7 @@ status = "draft — needs native review" "Another server, or one that needs its key. The usual server is set in Preferences." = "Toinen palvelin tai avainta tarvitseva palvelin. Tavallinen palvelin asetetaan asetuksissa." "Any status" = "Kaikki tilat" "Anyone on your network with this code can edit the file, while this app stays open." = "Kuka tahansa lähiverkossasi voi muokata tiedostoa tällä koodilla niin kauan kuin sovellus on auki." +"Anyone on your network with this code can look at the file, not change it, while this app stays open." = "Kuka tahansa verkossasi oleva voi tällä koodilla katsoa tiedostoa muttei muuttaa sitä, niin kauan kuin tämä sovellus on auki." "Anyone with the edit link can change the file; the view link only lets people look. The links carry their secrets: share them like passwords. `figcraft-server links` makes more and revokes them." = "Kuka tahansa muokkauslinkin saanut voi muuttaa tiedostoa. Katselulinkillä voi vain katsella. Linkit sisältävät salaiset tunnisteet: jaa niitä kuin salasanoja. `figcraft-server links` luo lisää linkkejä ja peruu niitä." "Anyone with this code can edit the file." = "Kuka tahansa tämän koodin saanut voi muokata tiedostoa." "Anyone with this code can look at the file, not change it." = "Kuka tahansa tämän koodin saanut voi katsella tiedostoa, mutta ei muuttaa sitä." @@ -160,6 +161,7 @@ status = "draft — needs native review" "Auto layout" = "Automaattinen asettelu" "Auto rows" = "Automaattiset rivit" "Auto width" = "Automaattinen leveys" +"Auto: by the first letter with a direction" = "Automaattinen: ensimmäisen suunnallisen kirjaimen mukaan" "Back" = "Takaisin" "Back to Ready for dev" = "Palauta kehitysvalmiiksi" "Back to Ready for dev: the next change compares with how it is now" = "Palauta kehitysvalmiiksi: seuraavaa muutosta verrataan nykyiseen tilaan" @@ -224,6 +226,7 @@ status = "draft — needs native review" "Changed {date}" = "Muutettu {date}" "CMYK colour" = "CMYK-väri" "CSS custom properties…" = "CSS:n mukautetut ominaisuudet…" +"Ctrl+click a padding field" = "Ctrl+napsauta sisämarginaalikenttää" "Dart constants for Flutter…" = "Dart-vakiot Flutterille…" "Calculated from other variables; it follows them" = "Lasketaan muista muuttujista ja seuraa niitä" "Can edit" = "Voi muokata" @@ -419,6 +422,7 @@ status = "draft — needs native review" "Delete the style (layers keep their values)" = "Poista tyyli (tasojen arvot säilyvät)" "Delete thread" = "Poista keskustelu" "Delete variable" = "Poista muuttuja" +"Delete {n} variables" = { one = "Poista {n} muuttuja", other = "Poista {n} muuttujaa" } "Delete “{name}”? This can't be undone." = "Poistetaanko ”{name}”? Tätä ei voi kumota." "Density" = "Tiheys" "Depth" = "Syvyys" @@ -450,6 +454,9 @@ status = "draft — needs native review" "Dimensions" = "Mitat" "Direction" = "Suunta" "Disconnect from code" = "Katkaise yhteys koodiin" +"Disconnected. Reconnecting…" = "Yhteys katkesi. Yhdistetään uudelleen…" +"Disconnected. Your edits stay here and sync when the connection returns. Reconnecting…" = "Yhteys katkesi. Muokkauksesi säilyvät täällä ja synkronoituvat, kun yhteys palaa. Yhdistetään uudelleen…" +"Dismiss" = "Ohita" "Dispersion" = "Hajonta" "Display name" = "Näyttönimi" "Dissolve" = "Häivytys" @@ -489,6 +496,7 @@ status = "draft — needs native review" "Edit dev resource" = "Muokkaa kehittäjäresurssia" "Edit link" = "Muokkaa linkkiä" "Edit link copied" = "Muokkauslinkki kopioitu" +"Edit padding on all sides" = "Muokkaa sisämarginaalia kaikilta sivuilta" "Edit style" = "Muokkaa tyyliä" "Edit variable" = "Muokkaa muuttujaa" "Edit with the builder" = "Muokkaa rakentimella" @@ -509,6 +517,7 @@ status = "draft — needs native review" "End vote" = "Lopeta äänestys" "Ends the session; everyone keeps their copy" = "Lopettaa istunnon. Kaikki säilyttävät oman kopionsa." "Enter" = "Enter" +"Enter / Shift+Enter" = "Enter / Shift+Enter" "Enter the address of a figcraft-server and press Browse to see the plugins it offers." = "Anna figcraft-server-palvelimen osoite ja näytä sen tarjoamat liitännäiset painamalla Selaa." "Enter to save · Esc to cancel" = "Tallenna Enterillä · peruuta Escillä" "Eraser" = "Pyyhekumi" @@ -784,6 +793,7 @@ status = "draft — needs native review" "Left padding" = "Vasen sisämarginaali" "Left side" = "Vasen puoli" "Left side width" = "Vasemman puolen leveys" +"Left to right" = "Vasemmalta oikealle" "Letter case" = "Kirjainkoko" "Letter spacing" = "Merkkiväli" "Libraries" = "Kirjastot" @@ -829,13 +839,36 @@ status = "draft — needs native review" "Main menu" = "Päävalikko" "Make a component" = "Luo komponentti" "Make slot" = "Luo sisältöpaikka" +"Move out of any group" = "Siirrä pois kaikista ryhmistä" +"Move to group {group}" = "Siirrä ryhmään {group}" +"Move up or down while dragging its label" = "Siirrä ylös tai alas vetämällä sen otsikkoa" "Nobody shares a file there now." = "Kukaan ei jaa siellä nyt tiedostoa." "New collection" = "Uusi kokoelma" +"Not connected: {reason}. Your work is still in this tab." = "Ei yhteyttä: {reason}. Työsi on yhä tässä välilehdessä." +"Nothing to pick: the page is empty" = "Ei mitään poimittavaa: sivu on tyhjä" "Pasted design layers" = "Liitetyt suunnittelutasot" "Pasted design layers; the clipboard didn't carry the images of: {layers}" = "Suunnittelutasot liitetty; leikepöydällä ei ollut näiden kuvia: {layers}" +"Pick select: Tab and Shift+Tab move between layers, Enter goes into one, Shift+Enter out, Space selects, Escape cancels" = "Poimintavalinta: Tab ja Shift+Tab siirtävät tasojen välillä, Enter siirtyy tason sisään, Shift+Enter ulos, välilyönti valitsee, Escape peruuttaa" +"Pick select: into a layer, out to its parent" = "Poimintavalinta: tason sisään, ulos sen ylätasoon" +"Pick select: next or previous layer" = "Poimintavalinta: seuraava tai edellinen taso" +"Pick select: select the picked layer" = "Poimintavalinta: valitse poimittu taso" "Remove these results from the file" = "Poista nämä tulokset tiedostosta" +"Retry now" = "Yritä nyt uudelleen" +"Right to left" = "Oikealta vasemmalle" +"Same as file ({profile})" = "Sama kuin tiedostossa ({profile})" +"Save a copy…" = "Tallenna kopio…" +"Scope: all supported properties" = "Käyttöalue: kaikki tuetut ominaisuudet" +"Scope: hidden from pickers" = "Käyttöalue: piilotettu valitsimista" +"Scope: only {scope}" = "Käyttöalue: vain {scope}" "Scroll wheel zoom" = "Zoomaus hiiren rullalla" +"Scrub a field faster (2x) or slower (1/2, 1/4)" = "Säädä kenttää vetämällä nopeammin (2x) tai hitaammin (1/2, 1/4)" +"Scrubbing at 1/2" = "Vetosäätö nopeudella 1/2" +"Scrubbing at 1/4" = "Vetosäätö nopeudella 1/4" +"Scrubbing at 1x" = "Vetosäätö nopeudella 1x" +"Scrubbing at 2x" = "Vetosäätö nopeudella 2x" +"Selection box: switch to pick select" = "Valintalaatikko: vaihda poimintavalintaan" "Shared by your team on {server}" = "Tiimisi jakama palvelimella {server}" +"Show and move the placement crosshair (its tool chosen, nothing selected)" = "Näytä ja siirrä sijoitusristikkoa (sen työkalu valittuna, ei valintaa)" "Slot name" = "Sisältöpaikan nimi" "Mar" = "maalisk." "Margin" = "Marginaali" @@ -977,7 +1010,10 @@ status = "draft — needs native review" "Check for updates…" = "Tarkista päivitykset…" "Not checked yet" = "Ei vielä tarkistettu" "Someone who left" = "Joku, joka lähti" +"Space" = "Välilyönti" +"Tab or Ctrl+Space again" = "Tab tai Ctrl+välilyönti uudelleen" "Take the results off the board; they stay in the file" = "Poista tulokset taululta; ne jäävät tiedostoon" +"Text direction" = "Tekstin suunta" "This file uses team libraries on servers you haven't used here. They aren't contacted until you check them." = "Tämä tiedosto käyttää tiimikirjastoja palvelimilla, joita et ole käyttänyt täällä. Niihin ei oteta yhteyttä ennen kuin tarkistat ne." "Not shared" = "Ei jaettu" "Note {n}" = "Huomautus {n}" @@ -1886,6 +1922,7 @@ status = "draft — needs native review" "{name} · published version {v}" = "{name} · julkaistu versio {v}" "{name} · version {v} on the server" = "{name} · versio {v} palvelimella" "{name} ×{n}" = "{name} ×{n}" +"{name}, disconnected from its live session" = "{name}, irrotettu live-istunnostaan" "{name}, in a live session" = "{name}, reaaliaikaisessa istunnossa" "{name}, online, open only to you" = "{name}, verkossa, vain sinun käytössäsi" "{name}, {kind}, {w} by {h}, selected" = "{name}, {kind}, {w} × {h}, valittu" @@ -1944,9 +1981,12 @@ status = "draft — needs native review" "← → ↑ ↓" = "← → ↑ ↓" "→, Space or N" = "→, Space or N" "↵" = "↵" +"↵ / ⇧↵" = "↵ / ⇧↵" "⇥ / ⇧⇥" = "⇥ / ⇧⇥" +"⇥ or ⌥ Space again" = "⇥ tai ⌥ välilyönti uudelleen" "⌘ arrows" = "⌘ arrows" "⌘ click" = "⌘ click" +"⌘ click a padding field" = "⌘-napsauta sisämarginaalikenttää" "⌘ scroll" = "⌘ scroll" "⌥ drag" = "⌥ drag" "1 year" = "1 vuosi" @@ -1968,7 +2008,7 @@ status = "draft — needs native review" "Hide UI" = "Piilota käyttöliittymä" "Past 30 days" = "Viimeiset 30 päivää" "Past 90 days" = "Viimeiset 90 päivää" -"Past year" = "Viimeinen vuosi" +"Past year" = "Viimeiset 12 kuukautta" "Nothing counted yet" = "Mitään ei ole vielä laskettu" "Rotate a degree (Shift: 15)" = "Kierrä asteen verran (Shift: 15)" "⌥⌘ ← ↑ → ↓" = "⌥⌘ ← ↑ → ↓" @@ -2057,6 +2097,7 @@ status = "draft — needs native review" "collab.openFile" = "Avaa verkkotiedosto" "collab.peers" = "Tämän tiedoston käyttäjät" "collab.publish" = "Julkaise palvelimelle" +"collab.reconnect" = "Yhdistä live-istuntoon uudelleen" "collab.recoverFile" = "Palauta verkkotiedosto" "collab.registerLinks" = "Avaa kutsulinkit FigCraftissa" "collab.removePerson" = "Poista istunnosta" @@ -2348,6 +2389,7 @@ status = "draft — needs native review" "selection.applyColorStyle" = "Käytä valinnan värityyliä" "selection.bindColorVariable" = "Käytä valinnan värimuuttujaa" "selection.colors" = "Valinnan värit" +"selection.createColorStyle" = "Luo valinnan värityyli" "selection.detachColor" = "Irrota valinnan väri" "selection.selectColor" = "Valitse tämänväriset tasot" "selection.setPaint" = "Muuta valinnan väriä" @@ -2392,6 +2434,10 @@ status = "draft — needs native review" "text.caseUpper" = "Isot kirjaimet" "text.create" = "Teksti" "text.decoration" = "Koristelu" +"text.direction" = "Tekstin suunta" +"text.directionAuto" = "Tekstin suunta: automaattinen" +"text.directionLtr" = "Tekstin suunta: vasemmalta oikealle" +"text.directionRtl" = "Tekstin suunta: oikealta vasemmalle" "text.edit.begin" = "Muokkaa tekstiä" "text.edit.caret" = "Aseta kohdistin" "text.edit.end" = "Lopeta tekstin muokkaus" @@ -2437,6 +2483,7 @@ status = "draft — needs native review" "tool.arrow" = "Nuoli" "tool.comment" = "Kommentti" "tool.connector" = "Yhdistin" +"tool.crosshair" = "Siirrä sijoitusristikkoa" "tool.ellipse" = "Ellipsi" "tool.eraser" = "Pyyhekumi" "tool.frame" = "Kehys" @@ -2647,6 +2694,9 @@ status = "draft — needs native review" "text.alignJustify" = "Tasaa tekstin molemmat reunat" "text.alignLeft" = "Tasaa teksti vasemmalle" "text.alignRight" = "Tasaa teksti oikealle" +"text.directionAuto" = "Automaattinen" +"text.directionLtr" = "Vasemmalta oikealle" +"text.directionRtl" = "Oikealta vasemmalle" "view.assets" = "Resurssit" "view.design" = "Suunnittelu" "view.layers" = "Tasot" From 10d97e2716a7b68724e95c3326425ab58f4681fe Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sun, 8 Nov 2026 11:00:14 +0000 Subject: [PATCH 045/239] Reject negative or fractional index in node.reparent Found while testing crates/engine/src/cmd/edit/props.rs:248 (reparent, `index = num(p, "index").map(|i| i.max(0.0) as usize)`) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd/edit/props.rs | 2 +- crates/engine/src/panels_behaviour_tests.rs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/edit/props.rs b/crates/engine/src/cmd/edit/props.rs index fb8a1c17f..e7f04d7a1 100644 --- a/crates/engine/src/cmd/edit/props.rs +++ b/crates/engine/src/cmd/edit/props.rs @@ -245,7 +245,7 @@ pub(super) fn stroke_brush(s: &mut Session, p: &Value) -> Result { pub(super) fn reparent(s: &mut Session, p: &Value) -> Result { let ids = req_targets("node.reparent", s, p)?; let parent = req_id("node.reparent", p, "parent")?; - let index = num(p, "index").map(|i| i.max(0.0) as usize); + let index = opt_index("node.reparent", p, "index")?; let doc = s.doc_mut()?; let ids = z_sorted(doc, &roots(doc, &ids)); // `index` is where the first moved layer ends up among the parent's children (bottom first), diff --git a/crates/engine/src/panels_behaviour_tests.rs b/crates/engine/src/panels_behaviour_tests.rs index 585fc3e08..60450dcbe 100644 --- a/crates/engine/src/panels_behaviour_tests.rs +++ b/crates/engine/src/panels_behaviour_tests.rs @@ -200,6 +200,22 @@ fn reparent_index_is_the_final_position_in_auto_layout_and_across_parents() { assert!(kids(&s, row).is_empty()); } +#[test] +fn reparent_rejects_a_negative_or_fractional_index() { + let mut s = Session::new(); + let frame = id(&ex(&mut s, "node.create", json!({"type": "frame", "name": "F"}))); + let rect = |s: &mut Session, n: &str, parent: NodeId| id(&ex(s, "node.create", json!({"type": "rectangle", "name": n, "parent": parent}))); + let (a, b) = (rect(&mut s, "a", frame), rect(&mut s, "b", frame)); + let free = id(&ex(&mut s, "node.create", json!({"type": "rectangle", "name": "free"}))); + for bad in [json!(-1), json!(1.5), json!("x")] { + let r = s.execute("node.reparent", &json!({"ids": [free], "parent": frame, "index": bad})); + assert!(r.is_err(), "index {bad} accepted"); + assert_eq!(kids(&s, frame), [a, b], "the tree is unchanged for index {bad}"); + } + ex(&mut s, "node.reparent", json!({"ids": [free], "parent": frame, "index": 0})); + assert_eq!(kids(&s, frame), [free, a, b]); +} + #[test] fn renaming_several_layers_by_the_documented_codes() { // Three layers named `names`, bottom to top; (names, params, new names, derivation). From 6222fce8d13289dc30f909df17b3ae3f913bfeb0 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sun, 8 Nov 2026 12:22:45 +0000 Subject: [PATCH 046/239] Reject signs and exponents in ExportSize::parse Found while testing crates/doc/src/props.rs:1394 (ExportSize::parse, `num.parse::()`) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/doc/src/props.rs | 4 ++++ crates/engine/src/import_export_tests.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/doc/src/props.rs b/crates/doc/src/props.rs index 99b9d9c39..15d557d88 100644 --- a/crates/doc/src/props.rs +++ b/crates/doc/src/props.rs @@ -1399,6 +1399,10 @@ impl ExportSize { Some((i, c)) if c.is_ascii_alphabetic() => (s.get(..i)?.trim(), Some(c)), _ => (s.as_str(), None), }; + // Plain decimal only: no sign, exponent, "inf" or "nan". + if !num.bytes().all(|b| b.is_ascii_digit() || b == b'.') { + return None; + } let value: f64 = num.parse().ok()?; match unit { None | Some('x') => ExportSize::Scale { value }, diff --git a/crates/engine/src/import_export_tests.rs b/crates/engine/src/import_export_tests.rs index 4acc86216..fdc8b29d4 100644 --- a/crates/engine/src/import_export_tests.rs +++ b/crates/engine/src/import_export_tests.rs @@ -283,7 +283,7 @@ fn export_sizes_parse_and_label() { assert_eq!(ExportSize::parse(text), Some(want), "{text}"); assert_eq!(ExportSize::parse(&want.label()), Some(want)); } - for bad in ["", "x", "0x", "-1x", "NaNx", "infx", "65x", "20000w", "2q", "2xx"] { + for bad in ["", "x", "0x", "-1x", "NaNx", "infx", "65x", "20000w", "2q", "2xx", "+2x", "+512w", "2e0x", "2E0x", "+0.5x"] { assert_eq!(ExportSize::parse(bad), None, "{bad}"); } let e = |size, suffix: &str, format| ExportSetting { size, suffix: suffix.into(), format, ..Default::default() }; From 6ac20c7d53057f9b16b320fadb50cb020ad7d6a8 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 07:53:14 -0500 Subject: [PATCH 047/239] M8: points' X and Y in vector edit mode show Mixed and set every selected point, as in Figma Cause: with several points selected, the Point section's X and Y showed the selection's top-left and `vector.edit.position` moved the group so that its top-left landed on the typed value. Figma shows the value the selected points share (Mixed when they differ) and sets every selected point's own coordinate. Fix: `vector.edit.position {x?, y?}` takes, per axis, a number (every selected point's own coordinate becomes it, in the parent's coordinates) or `{add}`, `{mul}`, `{div}` applied to each point's own coordinate; each point moves by its own delta with its handles, in one undo step; a zero divisor, a non-finite result, unknown keys and other junk are refused. A new `selected_parent_points` gives the panel the points in the parent's coordinates. The panel's X and Y are mixed-value fields: the shared value (compared within 1e-6) or Mixed, a typed value sets every point, and a relative edit typed into a Mixed field sends the object form. A scrub only starts from a shared value and sets it absolutely each frame inside one interaction, as the other point fields do. Verified: engine tests for two points at different x, one point, add, mul and div, curve handles, one undo, the parent's coordinates and refused junk; panel tests for Mixed, typing -200 and a relative edit on a Mixed field, and a single point's value; the engine lib tests, the vector and field panel tests, clippy and fmt. Measured in Figma on 2026-11-08. Not changed: the W and H row, other edited layers' points, and scrubbing semantics (the Mixed field cannot be scrubbed, as no start value exists). Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove, measured and briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/canvas/vectoredit.rs | 102 +++++++++++++-- .../src/canvas/vectoredit/position_tests.rs | 122 ++++++++++++++++++ crates/ui-egui/src/field_tests.rs | 4 +- crates/ui-egui/src/lib.rs | 2 + crates/ui-egui/src/panels/vector_panel.rs | 34 ++++- crates/ui-egui/src/vector_point_xy_tests.rs | 60 +++++++++ docs/target-app-parity.md | 3 +- docs/ui-parity.md | 5 +- 8 files changed, 309 insertions(+), 23 deletions(-) create mode 100644 crates/engine/src/canvas/vectoredit/position_tests.rs create mode 100644 crates/ui-egui/src/vector_point_xy_tests.rs diff --git a/crates/engine/src/canvas/vectoredit.rs b/crates/engine/src/canvas/vectoredit.rs index 4f265e0f5..5dcd8c0ba 100644 --- a/crates/engine/src/canvas/vectoredit.rs +++ b/crates/engine/src/canvas/vectoredit.rs @@ -10,6 +10,8 @@ pub mod ops; pub(crate) mod point_snap; mod pointer; +#[cfg(test)] +mod position_tests; pub mod regions; #[cfg(test)] mod regions_tests; @@ -706,6 +708,60 @@ fn handle_list(p: &Value, key: &str) -> Option> { } } +/// One axis of `vector.edit.position`: left alone, set, or relative to each point's own value. +#[derive(Clone, Copy)] +enum AxisEdit { + Keep, + Set(f64), + Add(f64), + Mul(f64), + Div(f64), +} + +impl AxisEdit { + fn apply(self, cur: f64) -> Result { + let v = match self { + AxisEdit::Keep => cur, + AxisEdit::Set(v) => v, + AxisEdit::Add(n) => cur + n, + AxisEdit::Mul(n) => cur * n, + AxisEdit::Div(n) if n != 0.0 => cur / n, + AxisEdit::Div(_) => return Err(bad("vector.edit.position", "cannot divide by zero")), + }; + if v.is_finite() { Ok(v) } else { Err(bad("vector.edit.position", "the result is not a number")) } + } +} + +/// Parse `p[key]`: absent is `Keep`, a number is `Set`, `{add|mul|div: n}` is relative; anything else is refused. +fn axis_edit(p: &Value, key: &str) -> Result { + let junk = || bad("vector.edit.position", format!("`{key}` must be a number or {{add|mul|div: number}}")); + match get(p, key) { + None => Ok(AxisEdit::Keep), + Some(Value::Object(o)) => { + let (Some((k, v)), 1) = (o.iter().next(), o.len()) else { return Err(junk()) }; + let n = match v { + Value::Number(n) => n.as_f64().filter(|n| n.is_finite()), + _ => None, + } + .ok_or_else(junk)?; + match k.as_str() { + "add" => Ok(AxisEdit::Add(n)), + "mul" => Ok(AxisEdit::Mul(n)), + "div" if n != 0.0 => Ok(AxisEdit::Div(n)), + _ => Err(junk()), + } + } + Some(v) => f64_of(v).filter(|_| !v.is_boolean()).map(AxisEdit::Set).ok_or_else(junk), + } +} + +/// The selected points in the parent's coordinates (what the X/Y fields show). +pub fn selected_parent_points(doc: &Document, ve: &VectorEdit) -> Vec { + let Some(net) = network(doc, ve.id) else { return Vec::new() }; + let t = doc.node(ve.id).map(|n| n.transform).unwrap_or_default(); + selected_points(net, ve).into_iter().filter_map(|v| net.vertices.get(v)).map(|v| t * v.point()).collect() +} + /// Selection bounds' top-left in the parent's coordinates (what the X/Y fields show). pub fn selection_position(doc: &Document, ve: &VectorEdit) -> Option { let net = network(doc, ve.id)?; @@ -935,18 +991,40 @@ pub fn specs() -> Vec { edit_sets(s, sets, |net, v, w| ops::move_vertices(net, v, local_offset(w, d)))?; Ok(json!({"ok": true})) }), - spec!("vector.edit.position", "Point position", "{x?, y?} (the selected points' top-left, in the parent's coordinates)", true, |s, p| { - let ve = editing(s)?; - let doc = s.doc()?; - let cur = selection_position(doc, &ve).ok_or_else(|| bad("vector.edit.position", "select points"))?; - let target = Point::new(num_or(p, "x", cur.x), num_or(p, "y", cur.y)); - let t = doc.node(ve.id).map(|n| n.transform).unwrap_or_default(); - let inv = t.inverse(); - let d = inv * target - inv * cur; - let v = network(doc, ve.id).map(|n| selected_points(n, &ve)).unwrap_or_default(); - edit(s.doc_mut()?, ve.id, |net| ops::move_vertices(net, &v, d))?; - Ok(json!({"ok": true})) - }), + spec!( + "vector.edit.position", + "Point position", + "{x?, y?}: each a number (every selected point's own coordinate becomes it) or {add: n}, {mul: n} or {div: n} (applied to each selected point's own coordinate); in the parent's coordinates", + true, + |s, p| { + let ve = editing(s)?; + let doc = s.doc()?; + let (ax, ay) = (axis_edit(p, "x")?, axis_edit(p, "y")?); + let t = doc.node(ve.id).map(|n| n.transform).unwrap_or_default(); + let inv = t.inverse(); + let net = network(doc, ve.id).ok_or_else(|| bad("vector.edit.position", "select points"))?; + let mut moves: Vec<(usize, Vec2)> = Vec::new(); + for i in selected_points(net, &ve) { + let Some(v) = net.vertices.get(i) else { continue }; + let cur = t * v.point(); + let target = Point::new(ax.apply(cur.x)?, ay.apply(cur.y)?); + let d = inv * target - v.point(); + if !(d.x.is_finite() && d.y.is_finite()) { + return Err(bad("vector.edit.position", "the result is not a number")); + } + moves.push((i, d)); + } + if moves.is_empty() { + return Err(bad("vector.edit.position", "select points")); + } + edit(s.doc_mut()?, ve.id, |net| { + for (i, d) in &moves { + ops::move_vertices(net, &[*i], *d); + } + })?; + Ok(json!({"ok": true})) + } + ), spec!("vector.edit.setHandle", "Set handle", "{segment, start (bool), x, y (local), independent?}", true, |s, p| { let ve = editing(s)?; let seg = index("vector.edit.setHandle", p, "segment")?; diff --git a/crates/engine/src/canvas/vectoredit/position_tests.rs b/crates/engine/src/canvas/vectoredit/position_tests.rs new file mode 100644 index 000000000..d092227e0 --- /dev/null +++ b/crates/engine/src/canvas/vectoredit/position_tests.rs @@ -0,0 +1,122 @@ +//! `vector.edit.position`: with several points, a number sets every selected point's own +//! coordinate, and `{add}`, `{mul}`, `{div}` apply to each point's own. + +use serde_json::json; + +use super::tests::{ex, net, rect}; +use super::*; +use crate::Session; + +/// Every point in the parent's coordinates (the layer re-fits its box after an edit, so its own +/// coordinates shift). +fn xs(s: &Session, id: NodeId) -> Vec<(f64, f64)> { + let t = s.doc().unwrap().node(id).unwrap().transform; + net(s, id).vertices.iter().map(|v| t * v.point()).map(|p| (p.x, p.y)).collect() +} + +fn parent_xy(s: &Session) -> Vec<(f64, f64)> { + let ve = s.ds().unwrap().vector_edit.clone().unwrap(); + selected_parent_points(s.doc().unwrap(), &ve).iter().map(|p| (p.x, p.y)).collect() +} + +fn near(a: f64, b: f64) -> bool { + (a - b).abs() < 1e-6 +} + +#[test] +fn a_number_sets_every_selected_points_own_coordinate() { + let mut s = Session::new(); + let id = rect(&mut s); + let before = xs(&s, id); + ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); + // The rectangle's points 0 and 1 differ in x; both end at -200 and keep their y. + assert!(!near(before[0].0, before[1].0)); + ex(&mut s, "vector.edit.position", json!({"x": -200})); + let after = xs(&s, id); + assert!(near(after[0].0, -200.0) && near(after[1].0, -200.0), "{after:?}"); + assert!(near(after[0].1, before[0].1) && near(after[1].1, before[1].1)); + assert_eq!(after[2], before[2]); + // One undo step restores. + assert!(s.undo().unwrap()); + assert_eq!(xs(&s, id), before); +} + +#[test] +fn one_point_sets_its_own_coordinates() { + let mut s = Session::new(); + let id = rect(&mut s); + let before = xs(&s, id); + ex(&mut s, "vector.edit.select", json!({"vertices": [2]})); + ex(&mut s, "vector.edit.position", json!({"x": 7, "y": 9})); + let after = xs(&s, id); + assert!(near(after[2].0, 7.0) && near(after[2].1, 9.0)); + assert_eq!(after[0], before[0]); +} + +#[test] +fn relative_edits_apply_to_each_points_own_value() { + let mut s = Session::new(); + let id = rect(&mut s); + let before = xs(&s, id); + ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); + ex(&mut s, "vector.edit.position", json!({"x": {"add": 10}})); + let a = xs(&s, id); + assert!(near(a[0].0, before[0].0 + 10.0) && near(a[1].0, before[1].0 + 10.0), "{a:?}"); + ex(&mut s, "vector.edit.position", json!({"y": {"mul": 2}})); + let b = xs(&s, id); + assert!(near(b[0].1, a[0].1 * 2.0) && near(b[1].1, a[1].1 * 2.0), "{b:?}"); + ex(&mut s, "vector.edit.position", json!({"x": {"div": 2}})); + let c = xs(&s, id); + assert!(near(c[0].0, a[0].0 / 2.0) && near(c[1].0, a[1].0 / 2.0), "{c:?}"); +} + +#[test] +fn a_point_keeps_its_handles_relative_to_it() { + let mut s = Session::new(); + let id = rect(&mut s); + ex(&mut s, "vector.edit.select", json!({"vertices": [1]})); + ex(&mut s, "vector.edit.smooth", json!({})); + let before = net(&s, id); + assert!(before.segments.iter().any(|g| g.ta != (0.0, 0.0) || g.tb != (0.0, 0.0))); + ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); + ex(&mut s, "vector.edit.position", json!({"x": {"add": 25}})); + let after = net(&s, id); + let tangents = |n: &VectorNetwork| n.segments.iter().map(|g| (g.ta, g.tb)).collect::>(); + assert_eq!(tangents(&before), tangents(&after)); +} + +#[test] +fn the_values_are_in_the_parents_coordinates() { + let mut s = Session::new(); + let r = ex(&mut s, "shape.rectangle", json!({"x": 40, "y": 30, "width": 100, "height": 100})); + let id = crate::params::id_of(&r["id"]).unwrap(); + ex(&mut s, "vector.edit.begin", json!({"id": id})); + ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); + let before = parent_xy(&s); + assert!(near(before[0].0, 40.0), "{before:?}"); + ex(&mut s, "vector.edit.position", json!({"x": 10})); + let after = parent_xy(&s); + assert!(near(after[0].0, 10.0) && near(after[1].0, 10.0), "{after:?}"); + assert!(near(after[0].1, before[0].1)); +} + +#[test] +fn junk_is_refused_and_changes_nothing() { + let mut s = Session::new(); + let id = rect(&mut s); + let before = xs(&s, id); + ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); + for junk in [ + json!({"x": {"div": 0}}), + json!({"x": {"pow": 2}}), + json!({"x": "a"}), + json!({"x": {"add": 1, "mul": 2}}), + json!({"y": {"add": "x"}}), + json!({"x": {}}), + json!({"x": [1]}), + json!({"x": {"mul": 1e308}}), + ] { + assert!(s.execute("vector.edit.position", &junk).is_err(), "{junk}"); + } + assert_eq!(xs(&s, id), before); +} diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index e3bdad1dd..2b1ead4aa 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -189,7 +189,7 @@ fn setup() -> (Ui, NodeId, NodeId) { /// The topmost field named `name` in the Design panel: its value centre and displayed text. /// Layer opacity precedes the equally named opacity fields in paint rows. -fn field(u: &mut Ui, name: &str) -> (Pos2, String) { +pub(crate) fn field(u: &mut Ui, name: &str) -> (Pos2, String) { u.frame(vec![]); let out = u.frame_output(vec![]); let nodes = out.platform_output.accesskit_update.expect("an AccessKit update").nodes; @@ -252,7 +252,7 @@ fn click(u: &mut Ui, p: Pos2) { } /// Click into field `name`, type `text` over what it shows and press `end`. -fn type_into(u: &mut Ui, name: &str, text: &str, end: Key) { +pub(crate) fn type_into(u: &mut Ui, name: &str, text: &str, end: Key) { let (p, _) = field(u, name); click(u, p); u.frame(vec![Event::Text(text.into())]); diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 11c96da74..5532b6dc4 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -279,6 +279,8 @@ mod vector_keys_tests; #[cfg(test)] mod vector_panel_tests; #[cfg(test)] +mod vector_point_xy_tests; +#[cfg(test)] mod vector_tail_ui_tests; #[cfg(test)] mod vote_history_ui_tests; diff --git a/crates/ui-egui/src/panels/vector_panel.rs b/crates/ui-egui/src/panels/vector_panel.rs index 07dda3ff4..3b91c9ffc 100644 --- a/crates/ui-egui/src/panels/vector_panel.rs +++ b/crates/ui-egui/src/panels/vector_panel.rs @@ -12,7 +12,7 @@ use crate::FigApp; use crate::i18n::tr; use crate::icons::Icon; use crate::right::{CAP_ART_W, cap_art, join_label, menu_item, menu_item_with, menu_popup, row}; -use crate::widgets::{self, FieldEdit, Lead}; +use crate::widgets::{self, Edit, FieldEdit, Lead, Rel}; /// Run a point command from a field: typed values are one step, scrubs one step when released. fn point_field(app: &mut FigApp, cmd: &str, edit: Option, params: impl Fn(f64) -> Value) { @@ -31,6 +31,23 @@ fn point_field(app: &mut FigApp, cmd: &str, edit: Option, params: imp } } +/// A point position field's edit: a value (typed or scrubbed) sets every selected point's own +/// coordinate; a relative edit of a Mixed field (`+10`, `*2`) applies to each point's own. +fn point_edit(app: &mut FigApp, axis: &'static str, edit: Option) { + match edit { + Some(Edit::All(e)) => point_field(app, "vector.edit.position", Some(e), |v| json!({ axis: v })), + Some(Edit::Each(rel)) => { + let op = match rel { + Rel::Add(n) => json!({"add": n}), + Rel::Mul(n) => json!({"mul": n}), + Rel::Div(n) => json!({"div": n}), + }; + app.run("vector.edit.position", json!({ axis: op })); + } + None => {} + } +} + /// The Variable width tool's selected width point: where it is along the path and its width. fn width_point(app: &mut FigApp, ui: &mut Ui, doc: &Document, ve: &VectorEdit) { widgets::section_header(ui, tr("Width point"), &[], false); @@ -88,14 +105,19 @@ pub fn points(app: &mut FigApp, ui: &mut Ui, doc: &Document, ve: &VectorEdit) { return; } let col = widgets::col_width(ui.available_width()); - let pos = vectoredit::selection_position(doc, ve); let round = |v: f64| (v * 100.0).round() / 100.0; + let parent_pts = vectoredit::selected_parent_points(doc, ve); + // The value the selected points share (within 1e-6), or none: Mixed. + let shared = |axis: fn(&figcraft_geom::Point) -> f64| { + let first = parent_pts.first().map(axis)?; + parent_pts.iter().all(|p| (axis(p) - first).abs() < 1e-6).then(|| round(first)) + }; widgets::sublabels(ui, tr("Position"), None); row(ui, 32.0, |ui| { - let e = widgets::number_field(ui, Id::unique("vpt_x"), Lead::Text("X"), pos.map(|p| round(p.x)), "", col, 1.0); - point_field(app, "vector.edit.position", e, |v| json!({"x": v})); - let e = widgets::number_field(ui, Id::unique("vpt_y"), Lead::Text("Y"), pos.map(|p| round(p.y)), "", col, 1.0); - point_field(app, "vector.edit.position", e, |v| json!({"y": v})); + let e = widgets::number_field_mixed(ui, Id::unique("vpt_x"), Lead::Text("X"), shared(|p| p.x), "", col, 1.0); + point_edit(app, "x", e); + let e = widgets::number_field_mixed(ui, Id::unique("vpt_y"), Lead::Text("Y"), shared(|p| p.y), "", col, 1.0); + point_edit(app, "y", e); }); if let Some(b) = vectoredit::transform::point_box(doc, ve).filter(|b| b.points.len() > 1) { widgets::sublabels(ui, tr("Dimensions"), None); diff --git a/crates/ui-egui/src/vector_point_xy_tests.rs b/crates/ui-egui/src/vector_point_xy_tests.rs new file mode 100644 index 000000000..8ab7bce4d --- /dev/null +++ b/crates/ui-egui/src/vector_point_xy_tests.rs @@ -0,0 +1,60 @@ +//! The vector edit panel's Point section: X and Y show the value the selected points share, or +//! "Mixed", and a typed value sets every selected point's own coordinate. + +use egui::Key; +use figcraft_doc::NodeId; +use figcraft_engine::Session; +use serde_json::json; + +use crate::field_tests::{field, type_into}; +use crate::layers_drag_tests::Ui; + +fn setup() -> (Ui, NodeId) { + let mut s = Session::new(); + let r = s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 100, "height": 60})).unwrap(); + let id = NodeId(r["id"].as_u64().unwrap()); + s.execute("select.set", &json!({"ids": [id]})).unwrap(); + s.execute("vector.edit.begin", &json!({"id": id})).unwrap(); + let mut u = Ui::new(s); + u.ctx.enable_accesskit(); + u.frame(vec![]); + (u, id) +} + +fn xs(u: &Ui, id: NodeId) -> Vec<(f64, f64)> { + let doc = u.app.session.doc().unwrap(); + // In the parent's coordinates: the layer re-fits its box after an edit. + let t = doc.node(id).unwrap().transform; + figcraft_engine::vectoredit::network(doc, id).unwrap().vertices.iter().map(|v| t * v.point()).map(|p| (p.x, p.y)).collect() +} + +#[test] +fn x_reads_mixed_for_points_that_differ_and_typing_sets_every_point() { + let (mut u, id) = setup(); + u.app.session.execute("vector.edit.select", &json!({"vertices": [0, 1]})).unwrap(); + let before = xs(&u, id); + // Points 0 and 1 share their y but not their x. + assert_eq!(field(&mut u, "X").1, "Mixed"); + assert_eq!(field(&mut u, "Y").1, "0"); + type_into(&mut u, "X", "-200", Key::Enter); + let after = xs(&u, id); + assert_eq!((after[0].0, after[1].0), (-200.0, -200.0)); + assert_eq!((after[0].1, after[1].1), (before[0].1, before[1].1)); + assert_eq!(field(&mut u, "X").1, "-200", "the points share an x now"); + // A relative edit of a Mixed field goes to each point from its own value. + u.app.session.execute("vector.edit.select", &json!({"vertices": [1, 2]})).unwrap(); + assert_eq!(field(&mut u, "X").1, "Mixed"); + let b = xs(&u, id); + type_into(&mut u, "X", "+10", Key::Enter); + let a = xs(&u, id); + assert_eq!((a[1].0, a[2].0), (b[1].0 + 10.0, b[2].0 + 10.0)); +} + +#[test] +fn one_point_shows_its_own_value() { + let (mut u, id) = setup(); + u.app.session.execute("vector.edit.select", &json!({"vertices": [2]})).unwrap(); + let p = xs(&u, id)[2]; + assert_eq!(field(&mut u, "X").1, format!("{}", p.0)); + assert_eq!(field(&mut u, "Y").1, format!("{}", p.1)); +} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 031521f51..16098efdc 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-06 · **Change:** minor (justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-08 · **Change:** minor (the Point section's X and Y in vector edit mode show Mixed and set every selected point, as in Figma; justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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 @@ -652,6 +652,7 @@ Carried over from the ROADMAP's "Shipped so far" (2026-10-10). The test count th | Date | Change | Summary | |---|---|---| +| 2026-11-08 | minor | M8: measured in Figma on 2026-11-08, vector edit mode's Point section: X and Y show the value the selected points share, or Mixed when they differ, and a typed value sets every selected point's own coordinate (it moved the group's top-left before); a relative edit (`+10`, `*2`, `/2`) typed into a Mixed field applies to each point's own value (`vector.edit.position` takes a number or `{add}`, `{mul}`, `{div}` per axis); the W and H row and other edited layers' points are unchanged. | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`) draft catalog: 1,975 UI strings, 641 command labels and 31 menu wordings, clean-room from the English source; zh-TW, zh-HK, zh-MO and zh-Hant read it, explicit Hans stays Simplified; Noto Sans CJK TC then Taiwan system faces; no bundled font; native review pending. Numbers unchanged | | 2026-11-04 | patch | M4, #1970: justified Chinese, Japanese and Korean text, written without spaces between words, aligns its right edge: the room on each line but a paragraph's last goes between its characters, each a word of its own as for line breaking ("Justify aligns the first word in each line of text to the left-most edge, and the last to the right-most edge"), wherever a line could break there, so none opens before a full stop or closing bracket, nor after an opening one. Latin text widens its spaces as before; mixed text widens both. A gap is reordered with the line's runs as a space of no width would be, so one beside a Hebrew word in Chinese text, or beside a Chinese word within that Hebrew, opens beside the word, not inside it. `figcraft_text::breaks::justify_between`, beside `break_between`, says where. Evidence: `tests::justified_ideographs_spread_the_room_between_characters` (fails on main). | | 2026-11-04 | patch | M8, #1951 (#1506 again): a path broken open by deleting a point (Delete, not Shift+Delete) is filled closed by a straight line across the gap, as an open path's fill is; joining its two ends again (the pen onto the other end, Connect, ⌘J) left the loop without the new segment, so once the points were rounded the fill and the selection outline ran straight across while the stroke followed the segment and its arcs. Joining now closes the loop through the new segment ("Click to close the path."; "You can use the Paint tool to add fills to any closed regions of a vector network."): `ops::connect` puts it into the loop whose segments are the chain between the ends, at the gap and in the loop's own order, so a hole keeps its winding whichever end was clicked first; a loop listed out of walking order is left as it was. Evidence: `vectoredit::tests::a_rounded_chamfer_made_other_ways_fills_along_its_arcs` (fails on main: the loop kept 4 of 5 segments), `a_rounded_chamfer_cut_in_the_editor_fills_along_its_arcs` (Shift+Delete, with and without a region fill), `doc::tests::a_chamfered_rectangles_rounded_fill_is_cut_at_every_point` (fill, region path and stroke agree for every loop order and segment direction of a chamfered rectangle). | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index aa0ef25bd..6c0fd92e6 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-08 · **Change:** minor (the Point section's X and Y in vector edit mode show Mixed and set every selected point, as in Figma; the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -92,7 +92,7 @@ interaction feel not yet compared. | Rectangle, ellipse (arc handles and Design panel arc fields), polygon, star, line, arrow; Shift/Alt | done | Alt draws lines from the centre too (`shapes_behaviour_tests`) | | Corner radius handles (inside each corner of a rectangle or frame, a polygon's or star's top point; Alt: one corner), star ratio handle; Count and Ratio fields | done | handles hide under 48 px on screen; no count handle on the canvas (the Count field instead); corner smoothing rounds rectangles and frames only | | Pen: vector networks, branch, close, bend; pencil | done | pen pressure on Windows and from browser styluses only; outside edit mode the Pen closes on its first point, connects to its other points and continues a selected open path from an end point (`vector_multi_behaviour_tests`); Escape ends the path and keeps its layer in edit mode with the pen, so the next path joins the same vector and another Escape leaves edit mode (#760, `pen_end_tests`); Enter or a double-click ends the path (at the double-click's point, added once) and edits the vector with the Move tool, a double-click with the idle pen edits the layer under it, and in edit mode the pen's Enter or double-click takes the Move tool (#1430, `pen_vector_edit_tests`); switching from Design to Prototype or Inspect ends the path and returns to Move (#308) | -| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). Not yet: areas of other layers edited at once | +| 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). Not yet: areas of other layers edited at once; the Point section's X and Y show the shared value or Mixed and set every selected point (measured in Figma on 2026-11-08) | | Shape builder (Shift+M) on fills, strokes and open paths; variable width (Shift+W), one side with Alt | done | | | Boolean groups: clicked where the result is, double-click or Cmd/Ctrl-click into operands, live results while dragging or editing points, per-operand operations | done | a group past the path operations' caps (250 000 segments, 2 million possible crossings, 4 million segments swept over a fold) draws without its result, with a warning, and Flatten refuses it (#1104); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | | 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 | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-08 | minor | M8: measured in Figma on 2026-11-08, vector edit mode's Point section: X and Y show the value the selected points share, or Mixed when they differ, and a typed value sets every selected point's own coordinate (it moved the group's top-left before); a relative edit (`+10`, `*2`, `/2`) typed into a Mixed field applies to each point's own value (`vector.edit.position` takes a number or `{add}`, `{mul}`, `{div}` per axis); the W and H row and other edited layers' points are unchanged. | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 767ebb67cc8a966110d43a258964d7eb8aa41b74 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 07:53:27 -0500 Subject: [PATCH 048/239] M8: store the new vector point tests with LF line endings Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove, measured and briefed; Sonnet 5.5 wrote at medium --- .../src/canvas/vectoredit/position_tests.rs | 244 +++++++++--------- crates/ui-egui/src/vector_point_xy_tests.rs | 120 ++++----- 2 files changed, 182 insertions(+), 182 deletions(-) diff --git a/crates/engine/src/canvas/vectoredit/position_tests.rs b/crates/engine/src/canvas/vectoredit/position_tests.rs index d092227e0..f64da34d5 100644 --- a/crates/engine/src/canvas/vectoredit/position_tests.rs +++ b/crates/engine/src/canvas/vectoredit/position_tests.rs @@ -1,122 +1,122 @@ -//! `vector.edit.position`: with several points, a number sets every selected point's own -//! coordinate, and `{add}`, `{mul}`, `{div}` apply to each point's own. - -use serde_json::json; - -use super::tests::{ex, net, rect}; -use super::*; -use crate::Session; - -/// Every point in the parent's coordinates (the layer re-fits its box after an edit, so its own -/// coordinates shift). -fn xs(s: &Session, id: NodeId) -> Vec<(f64, f64)> { - let t = s.doc().unwrap().node(id).unwrap().transform; - net(s, id).vertices.iter().map(|v| t * v.point()).map(|p| (p.x, p.y)).collect() -} - -fn parent_xy(s: &Session) -> Vec<(f64, f64)> { - let ve = s.ds().unwrap().vector_edit.clone().unwrap(); - selected_parent_points(s.doc().unwrap(), &ve).iter().map(|p| (p.x, p.y)).collect() -} - -fn near(a: f64, b: f64) -> bool { - (a - b).abs() < 1e-6 -} - -#[test] -fn a_number_sets_every_selected_points_own_coordinate() { - let mut s = Session::new(); - let id = rect(&mut s); - let before = xs(&s, id); - ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); - // The rectangle's points 0 and 1 differ in x; both end at -200 and keep their y. - assert!(!near(before[0].0, before[1].0)); - ex(&mut s, "vector.edit.position", json!({"x": -200})); - let after = xs(&s, id); - assert!(near(after[0].0, -200.0) && near(after[1].0, -200.0), "{after:?}"); - assert!(near(after[0].1, before[0].1) && near(after[1].1, before[1].1)); - assert_eq!(after[2], before[2]); - // One undo step restores. - assert!(s.undo().unwrap()); - assert_eq!(xs(&s, id), before); -} - -#[test] -fn one_point_sets_its_own_coordinates() { - let mut s = Session::new(); - let id = rect(&mut s); - let before = xs(&s, id); - ex(&mut s, "vector.edit.select", json!({"vertices": [2]})); - ex(&mut s, "vector.edit.position", json!({"x": 7, "y": 9})); - let after = xs(&s, id); - assert!(near(after[2].0, 7.0) && near(after[2].1, 9.0)); - assert_eq!(after[0], before[0]); -} - -#[test] -fn relative_edits_apply_to_each_points_own_value() { - let mut s = Session::new(); - let id = rect(&mut s); - let before = xs(&s, id); - ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); - ex(&mut s, "vector.edit.position", json!({"x": {"add": 10}})); - let a = xs(&s, id); - assert!(near(a[0].0, before[0].0 + 10.0) && near(a[1].0, before[1].0 + 10.0), "{a:?}"); - ex(&mut s, "vector.edit.position", json!({"y": {"mul": 2}})); - let b = xs(&s, id); - assert!(near(b[0].1, a[0].1 * 2.0) && near(b[1].1, a[1].1 * 2.0), "{b:?}"); - ex(&mut s, "vector.edit.position", json!({"x": {"div": 2}})); - let c = xs(&s, id); - assert!(near(c[0].0, a[0].0 / 2.0) && near(c[1].0, a[1].0 / 2.0), "{c:?}"); -} - -#[test] -fn a_point_keeps_its_handles_relative_to_it() { - let mut s = Session::new(); - let id = rect(&mut s); - ex(&mut s, "vector.edit.select", json!({"vertices": [1]})); - ex(&mut s, "vector.edit.smooth", json!({})); - let before = net(&s, id); - assert!(before.segments.iter().any(|g| g.ta != (0.0, 0.0) || g.tb != (0.0, 0.0))); - ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); - ex(&mut s, "vector.edit.position", json!({"x": {"add": 25}})); - let after = net(&s, id); - let tangents = |n: &VectorNetwork| n.segments.iter().map(|g| (g.ta, g.tb)).collect::>(); - assert_eq!(tangents(&before), tangents(&after)); -} - -#[test] -fn the_values_are_in_the_parents_coordinates() { - let mut s = Session::new(); - let r = ex(&mut s, "shape.rectangle", json!({"x": 40, "y": 30, "width": 100, "height": 100})); - let id = crate::params::id_of(&r["id"]).unwrap(); - ex(&mut s, "vector.edit.begin", json!({"id": id})); - ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); - let before = parent_xy(&s); - assert!(near(before[0].0, 40.0), "{before:?}"); - ex(&mut s, "vector.edit.position", json!({"x": 10})); - let after = parent_xy(&s); - assert!(near(after[0].0, 10.0) && near(after[1].0, 10.0), "{after:?}"); - assert!(near(after[0].1, before[0].1)); -} - -#[test] -fn junk_is_refused_and_changes_nothing() { - let mut s = Session::new(); - let id = rect(&mut s); - let before = xs(&s, id); - ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); - for junk in [ - json!({"x": {"div": 0}}), - json!({"x": {"pow": 2}}), - json!({"x": "a"}), - json!({"x": {"add": 1, "mul": 2}}), - json!({"y": {"add": "x"}}), - json!({"x": {}}), - json!({"x": [1]}), - json!({"x": {"mul": 1e308}}), - ] { - assert!(s.execute("vector.edit.position", &junk).is_err(), "{junk}"); - } - assert_eq!(xs(&s, id), before); -} +//! `vector.edit.position`: with several points, a number sets every selected point's own +//! coordinate, and `{add}`, `{mul}`, `{div}` apply to each point's own. + +use serde_json::json; + +use super::tests::{ex, net, rect}; +use super::*; +use crate::Session; + +/// Every point in the parent's coordinates (the layer re-fits its box after an edit, so its own +/// coordinates shift). +fn xs(s: &Session, id: NodeId) -> Vec<(f64, f64)> { + let t = s.doc().unwrap().node(id).unwrap().transform; + net(s, id).vertices.iter().map(|v| t * v.point()).map(|p| (p.x, p.y)).collect() +} + +fn parent_xy(s: &Session) -> Vec<(f64, f64)> { + let ve = s.ds().unwrap().vector_edit.clone().unwrap(); + selected_parent_points(s.doc().unwrap(), &ve).iter().map(|p| (p.x, p.y)).collect() +} + +fn near(a: f64, b: f64) -> bool { + (a - b).abs() < 1e-6 +} + +#[test] +fn a_number_sets_every_selected_points_own_coordinate() { + let mut s = Session::new(); + let id = rect(&mut s); + let before = xs(&s, id); + ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); + // The rectangle's points 0 and 1 differ in x; both end at -200 and keep their y. + assert!(!near(before[0].0, before[1].0)); + ex(&mut s, "vector.edit.position", json!({"x": -200})); + let after = xs(&s, id); + assert!(near(after[0].0, -200.0) && near(after[1].0, -200.0), "{after:?}"); + assert!(near(after[0].1, before[0].1) && near(after[1].1, before[1].1)); + assert_eq!(after[2], before[2]); + // One undo step restores. + assert!(s.undo().unwrap()); + assert_eq!(xs(&s, id), before); +} + +#[test] +fn one_point_sets_its_own_coordinates() { + let mut s = Session::new(); + let id = rect(&mut s); + let before = xs(&s, id); + ex(&mut s, "vector.edit.select", json!({"vertices": [2]})); + ex(&mut s, "vector.edit.position", json!({"x": 7, "y": 9})); + let after = xs(&s, id); + assert!(near(after[2].0, 7.0) && near(after[2].1, 9.0)); + assert_eq!(after[0], before[0]); +} + +#[test] +fn relative_edits_apply_to_each_points_own_value() { + let mut s = Session::new(); + let id = rect(&mut s); + let before = xs(&s, id); + ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); + ex(&mut s, "vector.edit.position", json!({"x": {"add": 10}})); + let a = xs(&s, id); + assert!(near(a[0].0, before[0].0 + 10.0) && near(a[1].0, before[1].0 + 10.0), "{a:?}"); + ex(&mut s, "vector.edit.position", json!({"y": {"mul": 2}})); + let b = xs(&s, id); + assert!(near(b[0].1, a[0].1 * 2.0) && near(b[1].1, a[1].1 * 2.0), "{b:?}"); + ex(&mut s, "vector.edit.position", json!({"x": {"div": 2}})); + let c = xs(&s, id); + assert!(near(c[0].0, a[0].0 / 2.0) && near(c[1].0, a[1].0 / 2.0), "{c:?}"); +} + +#[test] +fn a_point_keeps_its_handles_relative_to_it() { + let mut s = Session::new(); + let id = rect(&mut s); + ex(&mut s, "vector.edit.select", json!({"vertices": [1]})); + ex(&mut s, "vector.edit.smooth", json!({})); + let before = net(&s, id); + assert!(before.segments.iter().any(|g| g.ta != (0.0, 0.0) || g.tb != (0.0, 0.0))); + ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); + ex(&mut s, "vector.edit.position", json!({"x": {"add": 25}})); + let after = net(&s, id); + let tangents = |n: &VectorNetwork| n.segments.iter().map(|g| (g.ta, g.tb)).collect::>(); + assert_eq!(tangents(&before), tangents(&after)); +} + +#[test] +fn the_values_are_in_the_parents_coordinates() { + let mut s = Session::new(); + let r = ex(&mut s, "shape.rectangle", json!({"x": 40, "y": 30, "width": 100, "height": 100})); + let id = crate::params::id_of(&r["id"]).unwrap(); + ex(&mut s, "vector.edit.begin", json!({"id": id})); + ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); + let before = parent_xy(&s); + assert!(near(before[0].0, 40.0), "{before:?}"); + ex(&mut s, "vector.edit.position", json!({"x": 10})); + let after = parent_xy(&s); + assert!(near(after[0].0, 10.0) && near(after[1].0, 10.0), "{after:?}"); + assert!(near(after[0].1, before[0].1)); +} + +#[test] +fn junk_is_refused_and_changes_nothing() { + let mut s = Session::new(); + let id = rect(&mut s); + let before = xs(&s, id); + ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); + for junk in [ + json!({"x": {"div": 0}}), + json!({"x": {"pow": 2}}), + json!({"x": "a"}), + json!({"x": {"add": 1, "mul": 2}}), + json!({"y": {"add": "x"}}), + json!({"x": {}}), + json!({"x": [1]}), + json!({"x": {"mul": 1e308}}), + ] { + assert!(s.execute("vector.edit.position", &junk).is_err(), "{junk}"); + } + assert_eq!(xs(&s, id), before); +} diff --git a/crates/ui-egui/src/vector_point_xy_tests.rs b/crates/ui-egui/src/vector_point_xy_tests.rs index 8ab7bce4d..07acb17da 100644 --- a/crates/ui-egui/src/vector_point_xy_tests.rs +++ b/crates/ui-egui/src/vector_point_xy_tests.rs @@ -1,60 +1,60 @@ -//! The vector edit panel's Point section: X and Y show the value the selected points share, or -//! "Mixed", and a typed value sets every selected point's own coordinate. - -use egui::Key; -use figcraft_doc::NodeId; -use figcraft_engine::Session; -use serde_json::json; - -use crate::field_tests::{field, type_into}; -use crate::layers_drag_tests::Ui; - -fn setup() -> (Ui, NodeId) { - let mut s = Session::new(); - let r = s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 100, "height": 60})).unwrap(); - let id = NodeId(r["id"].as_u64().unwrap()); - s.execute("select.set", &json!({"ids": [id]})).unwrap(); - s.execute("vector.edit.begin", &json!({"id": id})).unwrap(); - let mut u = Ui::new(s); - u.ctx.enable_accesskit(); - u.frame(vec![]); - (u, id) -} - -fn xs(u: &Ui, id: NodeId) -> Vec<(f64, f64)> { - let doc = u.app.session.doc().unwrap(); - // In the parent's coordinates: the layer re-fits its box after an edit. - let t = doc.node(id).unwrap().transform; - figcraft_engine::vectoredit::network(doc, id).unwrap().vertices.iter().map(|v| t * v.point()).map(|p| (p.x, p.y)).collect() -} - -#[test] -fn x_reads_mixed_for_points_that_differ_and_typing_sets_every_point() { - let (mut u, id) = setup(); - u.app.session.execute("vector.edit.select", &json!({"vertices": [0, 1]})).unwrap(); - let before = xs(&u, id); - // Points 0 and 1 share their y but not their x. - assert_eq!(field(&mut u, "X").1, "Mixed"); - assert_eq!(field(&mut u, "Y").1, "0"); - type_into(&mut u, "X", "-200", Key::Enter); - let after = xs(&u, id); - assert_eq!((after[0].0, after[1].0), (-200.0, -200.0)); - assert_eq!((after[0].1, after[1].1), (before[0].1, before[1].1)); - assert_eq!(field(&mut u, "X").1, "-200", "the points share an x now"); - // A relative edit of a Mixed field goes to each point from its own value. - u.app.session.execute("vector.edit.select", &json!({"vertices": [1, 2]})).unwrap(); - assert_eq!(field(&mut u, "X").1, "Mixed"); - let b = xs(&u, id); - type_into(&mut u, "X", "+10", Key::Enter); - let a = xs(&u, id); - assert_eq!((a[1].0, a[2].0), (b[1].0 + 10.0, b[2].0 + 10.0)); -} - -#[test] -fn one_point_shows_its_own_value() { - let (mut u, id) = setup(); - u.app.session.execute("vector.edit.select", &json!({"vertices": [2]})).unwrap(); - let p = xs(&u, id)[2]; - assert_eq!(field(&mut u, "X").1, format!("{}", p.0)); - assert_eq!(field(&mut u, "Y").1, format!("{}", p.1)); -} +//! The vector edit panel's Point section: X and Y show the value the selected points share, or +//! "Mixed", and a typed value sets every selected point's own coordinate. + +use egui::Key; +use figcraft_doc::NodeId; +use figcraft_engine::Session; +use serde_json::json; + +use crate::field_tests::{field, type_into}; +use crate::layers_drag_tests::Ui; + +fn setup() -> (Ui, NodeId) { + let mut s = Session::new(); + let r = s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 100, "height": 60})).unwrap(); + let id = NodeId(r["id"].as_u64().unwrap()); + s.execute("select.set", &json!({"ids": [id]})).unwrap(); + s.execute("vector.edit.begin", &json!({"id": id})).unwrap(); + let mut u = Ui::new(s); + u.ctx.enable_accesskit(); + u.frame(vec![]); + (u, id) +} + +fn xs(u: &Ui, id: NodeId) -> Vec<(f64, f64)> { + let doc = u.app.session.doc().unwrap(); + // In the parent's coordinates: the layer re-fits its box after an edit. + let t = doc.node(id).unwrap().transform; + figcraft_engine::vectoredit::network(doc, id).unwrap().vertices.iter().map(|v| t * v.point()).map(|p| (p.x, p.y)).collect() +} + +#[test] +fn x_reads_mixed_for_points_that_differ_and_typing_sets_every_point() { + let (mut u, id) = setup(); + u.app.session.execute("vector.edit.select", &json!({"vertices": [0, 1]})).unwrap(); + let before = xs(&u, id); + // Points 0 and 1 share their y but not their x. + assert_eq!(field(&mut u, "X").1, "Mixed"); + assert_eq!(field(&mut u, "Y").1, "0"); + type_into(&mut u, "X", "-200", Key::Enter); + let after = xs(&u, id); + assert_eq!((after[0].0, after[1].0), (-200.0, -200.0)); + assert_eq!((after[0].1, after[1].1), (before[0].1, before[1].1)); + assert_eq!(field(&mut u, "X").1, "-200", "the points share an x now"); + // A relative edit of a Mixed field goes to each point from its own value. + u.app.session.execute("vector.edit.select", &json!({"vertices": [1, 2]})).unwrap(); + assert_eq!(field(&mut u, "X").1, "Mixed"); + let b = xs(&u, id); + type_into(&mut u, "X", "+10", Key::Enter); + let a = xs(&u, id); + assert_eq!((a[1].0, a[2].0), (b[1].0 + 10.0, b[2].0 + 10.0)); +} + +#[test] +fn one_point_shows_its_own_value() { + let (mut u, id) = setup(); + u.app.session.execute("vector.edit.select", &json!({"vertices": [2]})).unwrap(); + let p = xs(&u, id)[2]; + assert_eq!(field(&mut u, "X").1, format!("{}", p.0)); + assert_eq!(field(&mut u, "Y").1, format!("{}", p.1)); +} From 8edcc02aee7993e9cb38bf1a2ac5cf41a2ab0bcf Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 07:57:54 -0500 Subject: [PATCH 049/239] M8: points moved by one offset still carry the regions' paint frames Setting each point's own coordinate moved the points one at a time, so when every point of a layer moved by the same offset (`{"x": {"add": 10}}` on all of them) `ops::move_vertices` no longer saw the whole network move and left the regions' paint frames behind. Points with the same offset now move together. Verified: `moving_every_point_by_one_offset_carries_the_regions_paint_frame` failed before this and passes; vectoredit tests 92 passed, junk sweep 49 passed, clippy and fmt clean. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/engine/src/canvas/vectoredit.rs | 13 ++++++++-- .../src/canvas/vectoredit/position_tests.rs | 26 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/canvas/vectoredit.rs b/crates/engine/src/canvas/vectoredit.rs index 5dcd8c0ba..47597ea92 100644 --- a/crates/engine/src/canvas/vectoredit.rs +++ b/crates/engine/src/canvas/vectoredit.rs @@ -1017,9 +1017,18 @@ pub fn specs() -> Vec { if moves.is_empty() { return Err(bad("vector.edit.position", "select points")); } + // Points with the same offset move together, so moving every point by one offset + // still carries the regions' paint frames, as a drag of all of them does. + let mut groups: Vec<(Vec2, Vec)> = Vec::new(); + for (i, d) in moves { + match groups.iter_mut().find(|(g, _)| (*g - d).hypot() < 1e-9) { + Some((_, v)) => v.push(i), + None => groups.push((d, vec![i])), + } + } edit(s.doc_mut()?, ve.id, |net| { - for (i, d) in &moves { - ops::move_vertices(net, &[*i], *d); + for (d, v) in &groups { + ops::move_vertices(net, v, *d); } })?; Ok(json!({"ok": true})) diff --git a/crates/engine/src/canvas/vectoredit/position_tests.rs b/crates/engine/src/canvas/vectoredit/position_tests.rs index f64da34d5..fb6af9105 100644 --- a/crates/engine/src/canvas/vectoredit/position_tests.rs +++ b/crates/engine/src/canvas/vectoredit/position_tests.rs @@ -100,6 +100,32 @@ fn the_values_are_in_the_parents_coordinates() { assert!(near(after[0].1, before[0].1)); } +#[test] +fn moving_every_point_by_one_offset_carries_the_regions_paint_frame() { + // `{add}` on every point is a plain translation: the region's paint frame goes with the + // points, as when they are dragged together. + let mut s = Session::new(); + let id = rect(&mut s); + { + let node = s.doc_mut().unwrap().get_mut(id).unwrap(); + let NodeKind::Vector { network } = &mut node.kind else { panic!("expected a vector") }; + assert!(!network.regions.is_empty(), "the rectangle has a region"); + for region in &mut network.regions { + region.paint_space = Some(figcraft_doc::RegionPaintSpace { width: 100.0, height: 100.0, transform: Affine::IDENTITY }); + } + } + let frame = |s: &Session| { + let world = s.doc().unwrap().world_transform(id); + world * net(s, id).regions[0].paint_space.as_ref().unwrap().transform + }; + let before = frame(&s); + let all: Vec = (0..net(&s, id).vertices.len()).collect(); + ex(&mut s, "vector.edit.select", json!({"vertices": all})); + ex(&mut s, "vector.edit.position", json!({"x": {"add": 10}})); + let (want, got) = ((Affine::translate((10.0, 0.0)) * before).as_coeffs(), frame(&s).as_coeffs()); + assert!(want.iter().zip(got).all(|(a, b)| near(*a, b)), "{got:?} vs {want:?}"); +} + #[test] fn junk_is_refused_and_changes_nothing() { let mut s = Session::new(); From 194a4a13298fdb10469ed283c56fe0f7ac74650b Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 08:31:06 -0500 Subject: [PATCH 050/239] M8: the parity row lists the points' X and Y as done, not under Not yet CodeRabbit on #2121: the Vector edit mode row in ui-parity.md put the new Point-section X/Y behaviour after "Not yet:", contradicting the row's done status and the revision entry. It now sits with the implemented features; only areas of other layers edited at once stay under Not yet. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- docs/ui-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 6c0fd92e6..bad1cb900 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -92,7 +92,7 @@ interaction feel not yet compared. | Rectangle, ellipse (arc handles and Design panel arc fields), polygon, star, line, arrow; Shift/Alt | done | Alt draws lines from the centre too (`shapes_behaviour_tests`) | | Corner radius handles (inside each corner of a rectangle or frame, a polygon's or star's top point; Alt: one corner), star ratio handle; Count and Ratio fields | done | handles hide under 48 px on screen; no count handle on the canvas (the Count field instead); corner smoothing rounds rectangles and frames only | | Pen: vector networks, branch, close, bend; pencil | done | pen pressure on Windows and from browser styluses only; outside edit mode the Pen closes on its first point, connects to its other points and continues a selected open path from an end point (`vector_multi_behaviour_tests`); Escape ends the path and keeps its layer in edit mode with the pen, so the next path joins the same vector and another Escape leaves edit mode (#760, `pen_end_tests`); Enter or a double-click ends the path (at the double-click's point, added once) and edits the vector with the Move tool, a double-click with the idle pen edits the layer under it, and in edit mode the pen's Enter or double-click takes the Move tool (#1430, `pen_vector_edit_tests`); switching from Design to Prototype or Inspect ends the path and returns to Move (#308) | -| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). Not yet: areas of other layers edited at once; the Point section's X and Y show the shared value or Mixed and set every selected point (measured in Figma on 2026-11-08) | +| 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); the Point section's X and Y show the value the selected points share, or Mixed, and a typed value sets every selected point's own coordinate (measured in Figma on 2026-11-08). 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); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | | 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 | From 62e7e3a41a7231b8b35561f530b94f2a43780aca Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 09:32:09 -0500 Subject: [PATCH 051/239] M8: the parity docs scope the points' X and Y to the layer being edited CodeRabbit on #2121: with points selected in several edited layers, the X and Y fields read and set only the active layer's points (`selected_parent_points` and `vector.edit.position` use the edited layer), so the status lines, the vector edit row and the revision entries now say so, and the row lists X and Y over several edited layers under Not yet. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- docs/target-app-parity.md | 4 ++-- docs/ui-parity.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 16098efdc..7f5f0eed1 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-08 · **Change:** minor (the Point section's X and Y in vector edit mode show Mixed and set every selected point, as in Figma; justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-08 · **Change:** minor (the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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 @@ -652,7 +652,7 @@ Carried over from the ROADMAP's "Shipped so far" (2026-10-10). The test count th | Date | Change | Summary | |---|---|---| -| 2026-11-08 | minor | M8: measured in Figma on 2026-11-08, vector edit mode's Point section: X and Y show the value the selected points share, or Mixed when they differ, and a typed value sets every selected point's own coordinate (it moved the group's top-left before); a relative edit (`+10`, `*2`, `/2`) typed into a Mixed field applies to each point's own value (`vector.edit.position` takes a number or `{add}`, `{mul}`, `{div}` per axis); the W and H row and other edited layers' points are unchanged. | +| 2026-11-08 | minor | M8: measured in Figma on 2026-11-08, vector edit mode's Point section: X and Y show the value the selected points share, or Mixed when they differ, and a typed value sets every selected point's own coordinate in the layer being edited, points of other edited layers left as they are (it moved the group's top-left before); a relative edit (`+10`, `*2`, `/2`) typed into a Mixed field applies to each point's own value (`vector.edit.position` takes a number or `{add}`, `{mul}`, `{div}` per axis); the W and H row and other edited layers' points are unchanged. | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`) draft catalog: 1,975 UI strings, 641 command labels and 31 menu wordings, clean-room from the English source; zh-TW, zh-HK, zh-MO and zh-Hant read it, explicit Hans stays Simplified; Noto Sans CJK TC then Taiwan system faces; no bundled font; native review pending. Numbers unchanged | | 2026-11-04 | patch | M4, #1970: justified Chinese, Japanese and Korean text, written without spaces between words, aligns its right edge: the room on each line but a paragraph's last goes between its characters, each a word of its own as for line breaking ("Justify aligns the first word in each line of text to the left-most edge, and the last to the right-most edge"), wherever a line could break there, so none opens before a full stop or closing bracket, nor after an opening one. Latin text widens its spaces as before; mixed text widens both. A gap is reordered with the line's runs as a space of no width would be, so one beside a Hebrew word in Chinese text, or beside a Chinese word within that Hebrew, opens beside the word, not inside it. `figcraft_text::breaks::justify_between`, beside `break_between`, says where. Evidence: `tests::justified_ideographs_spread_the_room_between_characters` (fails on main). | | 2026-11-04 | patch | M8, #1951 (#1506 again): a path broken open by deleting a point (Delete, not Shift+Delete) is filled closed by a straight line across the gap, as an open path's fill is; joining its two ends again (the pen onto the other end, Connect, ⌘J) left the loop without the new segment, so once the points were rounded the fill and the selection outline ran straight across while the stroke followed the segment and its arcs. Joining now closes the loop through the new segment ("Click to close the path."; "You can use the Paint tool to add fills to any closed regions of a vector network."): `ops::connect` puts it into the loop whose segments are the chain between the ends, at the gap and in the loop's own order, so a hole keeps its winding whichever end was clicked first; a loop listed out of walking order is left as it was. Evidence: `vectoredit::tests::a_rounded_chamfer_made_other_ways_fills_along_its_arcs` (fails on main: the loop kept 4 of 5 segments), `a_rounded_chamfer_cut_in_the_editor_fills_along_its_arcs` (Shift+Delete, with and without a region fill), `doc::tests::a_chamfered_rectangles_rounded_fill_is_cut_at_every_point` (fill, region path and stroke agree for every loop order and segment direction of a chamfered rectangle). | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index bad1cb900..9b3546b93 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-08 · **Change:** minor (the Point section's X and Y in vector edit mode show Mixed and set every selected point, as in Figma; the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-08 · **Change:** minor (the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -92,7 +92,7 @@ interaction feel not yet compared. | Rectangle, ellipse (arc handles and Design panel arc fields), polygon, star, line, arrow; Shift/Alt | done | Alt draws lines from the centre too (`shapes_behaviour_tests`) | | Corner radius handles (inside each corner of a rectangle or frame, a polygon's or star's top point; Alt: one corner), star ratio handle; Count and Ratio fields | done | handles hide under 48 px on screen; no count handle on the canvas (the Count field instead); corner smoothing rounds rectangles and frames only | | Pen: vector networks, branch, close, bend; pencil | done | pen pressure on Windows and from browser styluses only; outside edit mode the Pen closes on its first point, connects to its other points and continues a selected open path from an end point (`vector_multi_behaviour_tests`); Escape ends the path and keeps its layer in edit mode with the pen, so the next path joins the same vector and another Escape leaves edit mode (#760, `pen_end_tests`); Enter or a double-click ends the path (at the double-click's point, added once) and edits the vector with the Move tool, a double-click with the idle pen edits the layer under it, and in edit mode the pen's Enter or double-click takes the Move tool (#1430, `pen_vector_edit_tests`); switching from Design to Prototype or Inspect ends the path and returns to Move (#308) | -| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); the Point section's X and Y show the value the selected points share, or Mixed, and a typed value sets every selected point's own coordinate (measured in Figma on 2026-11-08). Not yet: areas of other layers edited at once | +| 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); the Point section's X and Y show the value the selected points share, or Mixed, and a typed value sets every selected point's own coordinate, in the layer being edited (measured in Figma on 2026-11-08). Not yet: areas of other layers edited at once; the Point section's X and Y over points of several edited layers | | Shape builder (Shift+M) on fills, strokes and open paths; variable width (Shift+W), one side with Alt | done | | | Boolean groups: clicked where the result is, double-click or Cmd/Ctrl-click into operands, live results while dragging or editing points, per-operand operations | done | a group past the path operations' caps (250 000 segments, 2 million possible crossings, 4 million segments swept over a fold) draws without its result, with a warning, and Flatten refuses it (#1104); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | | 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 | @@ -187,7 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| -| 2026-11-08 | minor | M8: measured in Figma on 2026-11-08, vector edit mode's Point section: X and Y show the value the selected points share, or Mixed when they differ, and a typed value sets every selected point's own coordinate (it moved the group's top-left before); a relative edit (`+10`, `*2`, `/2`) typed into a Mixed field applies to each point's own value (`vector.edit.position` takes a number or `{add}`, `{mul}`, `{div}` per axis); the W and H row and other edited layers' points are unchanged. | +| 2026-11-08 | minor | M8: measured in Figma on 2026-11-08, vector edit mode's Point section: X and Y show the value the selected points share, or Mixed when they differ, and a typed value sets every selected point's own coordinate in the layer being edited, points of other edited layers left as they are (it moved the group's top-left before); a relative edit (`+10`, `*2`, `/2`) typed into a Mixed field applies to each point's own value (`vector.edit.position` takes a number or `{add}`, `{mul}`, `{div}` per axis); the W and H row and other edited layers' points are unchanged. | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From a6be897d3141f11f396cdf5a63a797463d69428b Mon Sep 17 00:00:00 2001 From: Giovanni Almeida Date: Sun, 8 Nov 2026 13:53:24 -0300 Subject: [PATCH 052/239] M6: a vector point without a corner radius of its own takes the layer's on .fig import (#2114) Figma rounds every point whose style doesn't set a corner radius with the layer's cornerRadius. The import read only the point's style, so those vectors came in sharp. Points now fall back to the layer's radius, at the scale of the layer that carries it (#2091), and the network cache keys on it. The export writes an explicit 0 for a sharp point on a rounded vector so it stays sharp. --- contributors/people.toml | 3 + crates/format/src/fig/export/shape.rs | 4 +- crates/format/src/fig/export_tests.rs | 19 ++++++ crates/format/src/fig/map.rs | 5 +- crates/format/src/fig/map/layer.rs | 7 ++- crates/format/src/fig/tail_tests.rs | 90 +++++++++++++++++++++++++++ 6 files changed, 123 insertions(+), 5 deletions(-) diff --git a/contributors/people.toml b/contributors/people.toml index c6924df5f..34f849ed7 100644 --- a/contributors/people.toml +++ b/contributors/people.toml @@ -115,3 +115,6 @@ display_name = "Hamza0101" [people.ashokram-si] real_name = "Ashok Ram" + +[people.GiovanniBot] +sync_github_name = true diff --git a/crates/format/src/fig/export/shape.rs b/crates/format/src/fig/export/shape.rs index ca5846cde..bfc2b0224 100644 --- a/crates/format/src/fig/export/shape.rs +++ b/crates/format/src/fig/export/shape.rs @@ -207,7 +207,9 @@ impl<'d> Exporter<'d> { .enumerate() .map(|(i, v)| { let mut st: Fields = Vec::new(); - if v.radius > 0.0 { + // A point without a radius of its own is drawn with the layer's, so a sharp + // point on a rounded layer says so. + if v.radius > 0.0 || n.corners.radii[0] > 0.0 { st.push(("cornerRadius", fl(v.radius))); } if let Some(m) = v.mirror { diff --git a/crates/format/src/fig/export_tests.rs b/crates/format/src/fig/export_tests.rs index 9651a1025..4fd533545 100644 --- a/crates/format/src/fig/export_tests.rs +++ b/crates/format/src/fig/export_tests.rs @@ -955,6 +955,25 @@ fn closed_vector_geometry_is_written_with_its_corner_smoothing() { assert_eq!(radii, vec![20.0, 0.0, 10.0, 0.0], "each point keeps its own radius"); } +#[test] +fn sharp_points_on_a_rounded_vector_stay_sharp() { + // A point without a radius takes the layer's when read, so a sharp point on a vector with a + // layer radius is written with its own zero. + let mut doc = Document::new("sharp point"); + let page = doc.first_page().unwrap(); + let mut network = VectorNetwork::from_points(&[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)].map(|(x, y)| Point::new(x, y)), true); + for (v, r) in network.vertices.iter_mut().zip([8.0, 0.0, 8.0, 0.0]) { + v.radius = r; + } + let id = doc.create(page, NodeKind::Vector { network }, "V", 0.0, 0.0, 100.0, 100.0).unwrap(); + doc.node_mut(id).unwrap().corners.radii = [8.0; 4]; + let (back, _) = round_trip(&doc, "sharp point"); + let v = back.nodes().find(|n| matches!(n.kind, NodeKind::Vector { .. })).unwrap(); + let NodeKind::Vector { network } = &v.kind else { panic!("vector") }; + let radii: Vec = network.vertices.iter().map(|x| x.radius).collect(); + assert_eq!(radii, vec![8.0, 0.0, 8.0, 0.0]); +} + #[test] fn the_written_schema_parses_and_round_trips() { let schema = Schema::parse(export::SCHEMA).unwrap(); diff --git a/crates/format/src/fig/map.rs b/crates/format/src/fig/map.rs index fd1b47575..aa0db5cf4 100644 --- a/crates/format/src/fig/map.rs +++ b/crates/format/src/fig/map.rs @@ -356,8 +356,9 @@ struct Mapper<'a> { /// holding it) name it by `vectorNetworkRef`. Kept out of the JSON, where a large file's /// networks took gigabytes. networks: Vec>, - /// Index in `networks` by its blob, position scale, style table and point-radius scale. - network_ids: HashMap<(usize, u64, u64, usize, u64), usize>, + /// Index in `networks` by its blob, position scale, style table, point-radius scale and the + /// layer's corner radius (which points without one of their own take). + network_ids: HashMap<(usize, u64, u64, usize, u64, u64), usize>, /// Region paint elements (paints and gradient stops) read so far: one budget for the whole /// file, since layers with region paints don't share their network. region_paint_elements: usize, diff --git a/crates/format/src/fig/map/layer.rs b/crates/format/src/fig/map/layer.rs index e3de96368..a69bb7d46 100644 --- a/crates/format/src/fig/map/layer.rs +++ b/crates/format/src/fig/map/layer.rs @@ -668,6 +668,8 @@ impl<'a> Mapper<'a> { size.zip(norm).filter(|(s, n)| s.is_finite() && *n > 1e-9).map_or(1.0, |(s, n)| s / n) }; let (sx, sy) = (scale("x"), scale("y")); + // A point whose style doesn't set a radius takes the layer's, as the editor draws it. + let layer_radius = v.len("cornerRadius"); let vertices: Vec = net .vertices .iter() @@ -676,7 +678,7 @@ impl<'a> Mapper<'a> { let st = style(p.style); // Point radii are lengths in this row's space, unlike the normalized positions. // An override/derived row already carries the instance's scale. - if let Some(r) = st.and_then(|s| num(s, "cornerRadius")).and_then(|r| scaled(r, radius_scale)).filter(|r| *r > 0.0) { + if let Some(r) = st.and_then(|s| num(s, "cornerRadius")).and_then(|r| scaled(r, radius_scale)).or(layer_radius).filter(|r| *r > 0.0) { out["radius"] = json!(r); } match st.and_then(|s| s.get("handleMirroring")).and_then(Kv::str) { @@ -793,7 +795,8 @@ impl<'a> Mapper<'a> { return true; } // A resized instance and a K-scaled one can have the same box but different radii. - let key = (blob_id, sx.to_bits(), sy.to_bits(), std::ptr::from_ref(vd) as usize, radius_scale.to_bits()); + let key = + (blob_id, sx.to_bits(), sy.to_bits(), std::ptr::from_ref(vd) as usize, radius_scale.to_bits(), layer_radius.unwrap_or(0.0).to_bits()); let id = match self.network_ids.get(&key) { Some(id) => *id, None => { diff --git a/crates/format/src/fig/tail_tests.rs b/crates/format/src/fig/tail_tests.rs index 176c95c9b..663d6002b 100644 --- a/crates/format/src/fig/tail_tests.rs +++ b/crates/format/src/fig/tail_tests.rs @@ -521,6 +521,96 @@ fn network_of<'d>(doc: &'d figcraft_doc::Document, name: &str) -> &'d figcraft_d } } +#[test] +fn vector_points_without_a_radius_of_their_own_take_the_layers() { + // A vector rounded from the layer's corner radius: the editor rounds every point whose + // style doesn't set a radius (no style, or one without `cornerRadius`) with the layer's, + // while a point's own radius, zero included, wins. + let mut message = tail_message(); + let Kv::Array(nodes) = field_mut(&mut message, "nodeChanges").unwrap() else { panic!() }; + let wave = nodes.iter_mut().find(|node| node.get("name").and_then(Kv::str) == Some("Wave")).unwrap(); + let Kv::Object(fields) = wave else { panic!() }; + fields.push(("cornerRadius", f(6.0))); + let vector_data = field_mut(wave, "vectorData").unwrap(); + let Kv::Array(styles) = field_mut(vector_data, "styleOverrideTable").unwrap() else { panic!() }; + let Kv::Object(sharp) = styles.get_mut(2).unwrap() else { panic!() }; + sharp.push(("cornerRadius", f(0.0))); + let (doc, _) = import(&canvas(&schema(), &message), "Rounded").unwrap(); + let radii: Vec = network_of(&doc, "Wave").vertices.iter().map(|v| v.radius).collect(); + assert_eq!(radii, [6.0, 4.0, 6.0, 0.0], "no style, own radius, style without one, own zero"); + // Without a layer radius, the points without one of their own stay sharp. + let (doc, _) = import(&tail_canvas(), "Tail").unwrap(); + let radii: Vec = network_of(&doc, "Wave").vertices.iter().map(|v| v.radius).collect(); + assert_eq!(radii, [0.0, 4.0, 0.0, 0.0]); +} + +#[test] +fn an_instance_that_rounds_a_vector_keeps_its_own_points() { + // An instance's copy shares its main's vector data; overriding the layer's radius must not + // reuse the main's network, nor hand the instance's to the main. + let mut message = tail_message(); + let Kv::Array(nodes) = field_mut(&mut message, "nodeChanges").unwrap() else { panic!() }; + let wave = nodes.iter_mut().find(|node| node.get("name").and_then(Kv::str) == Some("Wave")).unwrap(); + *field_mut(wave, "parentIndex").unwrap() = o(vec![("guid", g(50)), ("position", s("!"))]); + *field_mut(wave, "transform").unwrap() = at(0.0, 0.0); + let rounded = o(vec![("guidPath", o(vec![("guids", arr(vec![g(30)]))])), ("cornerRadius", f(6.0))]); + nodes.push(node(50, Some((1, "~")), "SYMBOL", "Mark", vec![("size", xy(200.0, 100.0)), ("transform", at(700.0, 0.0))])); + nodes.push(node( + 51, + Some((1, "~!")), + "INSTANCE", + "Rounded mark", + vec![ + ("size", xy(200.0, 100.0)), + ("transform", at(700.0, 400.0)), + ("symbolData", o(vec![("symbolID", g(50)), ("symbolOverrides", arr(vec![rounded]))])), + ], + )); + let (doc, _) = import(&canvas(&schema(), &message), "Instance").unwrap(); + let radii_under = |parent: &str| -> Vec { + let p = named(&doc, parent); + let wave = p.children.iter().map(|c| doc.node(*c).unwrap()).find(|n| n.name == "Wave").unwrap(); + let NodeKind::Vector { network } = &wave.kind else { panic!() }; + network.vertices.iter().map(|v| v.radius).collect() + }; + assert_eq!(radii_under("Mark"), [0.0, 4.0, 0.0, 0.0]); + assert_eq!(radii_under("Rounded mark"), [6.0, 4.0, 6.0, 6.0]); +} + +#[test] +fn a_scaled_instance_scales_its_vectors_point_radii() { + // Point radii are lengths: an instance scaled with the Scale tool draws its main's, from a + // point's own style or from the layer, times the factor (#2091). + let mut message = tail_message(); + let Kv::Array(nodes) = field_mut(&mut message, "nodeChanges").unwrap() else { panic!() }; + let wave = nodes.iter_mut().find(|node| node.get("name").and_then(Kv::str) == Some("Wave")).unwrap(); + *field_mut(wave, "parentIndex").unwrap() = o(vec![("guid", g(50)), ("position", s("!"))]); + *field_mut(wave, "transform").unwrap() = at(0.0, 0.0); + let Kv::Object(fields) = wave else { panic!() }; + fields.push(("cornerRadius", f(3.0))); + nodes.push(node(50, Some((1, "~")), "SYMBOL", "Mark", vec![("size", xy(200.0, 100.0)), ("transform", at(700.0, 0.0))])); + nodes.push(node( + 51, + Some((1, "~!")), + "INSTANCE", + "Big mark", + vec![ + ("size", xy(400.0, 200.0)), + ("transform", at(700.0, 400.0)), + ("symbolData", o(vec![("symbolID", g(50)), ("uniformScaleFactor", f(2.0))])), + ], + )); + let (doc, _) = import(&canvas(&schema(), &message), "Scaled").unwrap(); + let radii_under = |parent: &str| -> Vec { + let p = named(&doc, parent); + let wave = p.children.iter().map(|c| doc.node(*c).unwrap()).find(|n| n.name == "Wave").unwrap(); + let NodeKind::Vector { network } = &wave.kind else { panic!() }; + network.vertices.iter().map(|v| v.radius).collect() + }; + assert_eq!(radii_under("Mark"), [3.0, 4.0, 3.0, 3.0]); + assert_eq!(radii_under("Big mark"), [6.0, 8.0, 6.0, 6.0]); +} + #[test] fn vectors_import_as_editable_networks() { let (doc, warnings) = import(&tail_canvas(), "Tail").unwrap(); From a6d9b74df9b1d52e1c15ecc6f5e43a9694ac55ce Mon Sep 17 00:00:00 2001 From: impulsado <72570835+impulsado@users.noreply.github.com> Date: Sun, 8 Nov 2026 18:23:08 +0100 Subject: [PATCH 053/239] M3: resolve inherited slot properties by their defining component --- crates/engine/src/assets/components/sync.rs | 23 +++- crates/engine/src/slot_tests.rs | 119 ++++++++++++++++++++ 2 files changed, 137 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/assets/components/sync.rs b/crates/engine/src/assets/components/sync.rs index 7b34c33c2..17836b111 100644 --- a/crates/engine/src/assets/components/sync.rs +++ b/crates/engine/src/assets/components/sync.rs @@ -34,7 +34,7 @@ pub(super) fn sync_instance_depth(doc: &mut Document, inst: NodeId, depth: usize let nid = doc.alloc_id(); map.insert(s, nid); } - let Copies { nodes: new_nodes, nested, mut remeasure } = copy_layers(doc, inst, &src, &map, &old, &edited, eff_props); + let Copies { nodes: new_nodes, nested, mut remeasure } = copy_layers(doc, inst, component, &src, &map, &old, &edited, eff_props); for n in new_nodes { let (id, parent) = (n.id, n.parent); if insert_linked(doc, n).is_err() @@ -132,6 +132,7 @@ struct Copies { fn copy_layers( doc: &Document, inst: NodeId, + component: NodeId, src: &[NodeId], map: &BTreeMap, old: &BTreeMap>, @@ -139,7 +140,7 @@ fn copy_layers( props: BTreeMap, ) -> Copies { let mut enclosing: BTreeMap> = BTreeMap::from([(inst, vec![inst])]); - let mut inst_props: BTreeMap> = BTreeMap::from([(inst, props)]); + let mut inst_props: BTreeMap)> = BTreeMap::from([(inst, (component, props))]); let mut out = Copies { nodes: Vec::new(), nested: Vec::new(), remeasure: Vec::new() }; for s in src { let Some(orig) = doc.node(*s) else { continue }; @@ -169,7 +170,7 @@ fn copy_layers( let enc = enclosing.get(&parent).cloned().unwrap_or_default(); apply_enclosing_props(doc, &mut n, orig, &enc, &inst_props); if let NodeKind::Instance { component: c, props } = &n.kind { - inst_props.insert(nid, props.clone()); + inst_props.insert(nid, (*c, props.clone())); let mut e = enc; e.push(nid); enclosing.insert(nid, e); @@ -253,14 +254,26 @@ fn rebuild_nested(doc: &mut Document, nested: Vec, old: &BTreeMap>) { +fn apply_enclosing_props( + doc: &Document, + n: &mut Node, + orig: &Node, + enc: &[NodeId], + inst_props: &BTreeMap)>, +) { let mut chain: Vec<&Node> = vec![orig]; while chain.len() < enc.len() { let Some(next) = chain.last().and_then(|c| c.source).and_then(|x| doc.node(x)) else { break }; chain.push(next); } for (j, level) in chain.iter().enumerate().rev() { - let Some(props) = enc.get(j).and_then(|e| inst_props.get(e)) else { continue }; + if level.prop_refs.is_empty() { + continue; + } + let Some(owner) = owning_component(doc, level.id) else { continue }; + // Instance-owned slot content skips a source hop through the slot's component. Match + // the binding's defining component, not the position in the enclosing instance chain. + let Some((_, props)) = enc.iter().rev().filter_map(|e| inst_props.get(e)).find(|(component, _)| *component == owner) else { continue }; for (field, prop) in &level.prop_refs { let g = field_group(field); if n.overrides.contains(g) || (j > 0 && orig.overrides.contains(g)) { diff --git a/crates/engine/src/slot_tests.rs b/crates/engine/src/slot_tests.rs index 01a5db08e..a3f9c868a 100644 --- a/crates/engine/src/slot_tests.rs +++ b/crates/engine/src/slot_tests.rs @@ -376,6 +376,125 @@ fn slots_of_nested_instances_fill_from_the_outer_main_and_its_instances() { assert_eq!(fill(&s, *kids(&s, nslot).first().unwrap()), "CCCCCC", "content no longer follows the Card main"); } +/// Wrap a component instance in another main, keeping the nested instance addressable. +fn slot_text_wrapper(s: &mut Session, component: NodeId, name: &str) -> (NodeId, NodeId) { + let frame = idv(&ex(s, "frame.create", json!({"width": 300, "height": 200, "name": name}))); + let nested = idv(&ex(s, "instance.create", json!({"component": component, "parent": frame}))); + (idv(&ex(s, "component.create", json!({"ids": [frame]}))), nested) +} + +/// Content.Label binds Text; Composition holds Base, whose Body uses default or own Content. +/// Returns (Content main, Label, Base main, Composition main, nested Content instance). +fn slot_text_composition(s: &mut Session, own: bool) -> (NodeId, NodeId, NodeId, NodeId, NodeId) { + let frame = idv(&ex(s, "frame.create", json!({"width": 100, "height": 40, "name": "Content"}))); + let label = idv(&ex(s, "text.create", json!({"text": "Default", "parent": frame, "props": {"name": "Label"}}))); + let content = idv(&ex(s, "component.create", json!({"ids": [frame]}))); + ex(s, "component.addProperty", json!({"id": content, "name": "Text", "type": "text", "default": "Default", "layer": label})); + let frame = idv(&ex(s, "frame.create", json!({"width": 200, "height": 100, "name": "Base"}))); + let body = idv(&ex(s, "frame.create", json!({"width": 180, "height": 80, "name": "Body", "parent": frame}))); + let default = (!own).then(|| idv(&ex(s, "instance.create", json!({"component": content, "parent": body})))); + let base = idv(&ex(s, "component.create", json!({"ids": [frame]}))); + ex(s, "component.makeSlot", json!({"id": body})); + let (composition, nested_base) = slot_text_wrapper(s, base, "Composition"); + let nested_content = if let Some(default) = default { + copy_of(s, nested_base, default) + } else { + idv(&ex(s, "instance.slotInsert", json!({"id": nested_base, "slot": "Body", "component": content}))) + }; + (content, label, base, composition, nested_content) +} + +fn assert_slot_text(s: &mut Session, instance: NodeId, expected: &str) { + let label = kids(s, instance)[0]; + let characters = node(s, label).kind.text().unwrap().characters.clone(); + let html = ex(s, "inspect.code", json!({"id": instance, "language": "html"}))["code"].as_str().unwrap().to_string(); + assert_eq!(characters, expected, "slot Label characters; HTML: {html}"); + assert!(html.contains(&format!(">{expected}

")), "slot Label HTML: {html}"); +} + +fn assert_local_slot_text(s: &mut Session, instance: NodeId, expected: &str) { + assert!(matches!(&node(s, instance).kind, NodeKind::Instance { props, .. } if props.get("Text") == Some(&json!(expected)))); + let properties = props_of(s, instance); + assert_eq!(properties.iter().find(|p| p["name"] == "Text").unwrap()["value"], expected); +} + +#[test] +fn slot_text_properties_stay_local_in_default_and_own_content() { + for own in [false, true] { + let mut s = Session::new(); + let (content, label, _base, composition, main_content) = slot_text_composition(&mut s, own); + let a = idv(&ex(&mut s, "instance.create", json!({"component": composition, "x": 400}))); + let b = idv(&ex(&mut s, "instance.create", json!({"component": composition, "x": 800}))); + let ac = copy_of(&s, a, main_content); + let bc = copy_of(&s, b, main_content); + ex(&mut s, "instance.setProperties", json!({"ids": [ac], "properties": {"Text": "Custom"}})); + assert_local_slot_text(&mut s, ac, "Custom"); + assert_slot_text(&mut s, ac, "Custom"); + assert_slot_text(&mut s, bc, "Default"); + assert_slot_text(&mut s, main_content, "Default"); + assert_eq!(node(&s, label).kind.text().unwrap().characters, "Default"); + // Main property edits propagate without replacing another instance's local value. + ex(&mut s, "instance.setProperties", json!({"ids": [main_content], "properties": {"Text": "Main value"}})); + assert_slot_text(&mut s, ac, "Custom"); + assert_slot_text(&mut s, bc, "Main value"); + assert_slot_text(&mut s, main_content, "Main value"); + ex(&mut s, "component.editProperty", json!({"id": content, "name": "Text", "default": "New default"})); + assert_slot_text(&mut s, ac, "Custom"); + assert_slot_text(&mut s, bc, "Main value"); + healthy(&s); + } +} + +#[test] +fn slot_text_properties_do_not_read_an_unbound_base_property() { + let mut s = Session::new(); + let (_content, _label, base, composition, main_content) = slot_text_composition(&mut s, true); + ex(&mut s, "component.addProperty", json!({"id": base, "name": "Text", "type": "text", "default": "Wrong owner"})); + let i = idv(&ex(&mut s, "instance.create", json!({"component": composition, "x": 400}))); + let nested = copy_of(&s, i, main_content); + assert_slot_text(&mut s, nested, "Default"); + ex(&mut s, "instance.setProperties", json!({"ids": [nested], "properties": {"Text": "Custom"}})); + assert_local_slot_text(&mut s, nested, "Custom"); + assert_slot_text(&mut s, nested, "Custom"); + assert_slot_text(&mut s, main_content, "Default"); + healthy(&s); +} + +#[test] +fn slot_text_properties_survive_inherited_own_content_and_persistence() { + let mut s = Session::new(); + let (_content, _label, _base, composition, main_content) = slot_text_composition(&mut s, true); + let (outer, inherited) = slot_text_wrapper(&mut s, composition, "Outer composition"); + let inherited_content = copy_of(&s, inherited, main_content); + let a = idv(&ex(&mut s, "instance.create", json!({"component": outer, "x": 400}))); + let b = idv(&ex(&mut s, "instance.create", json!({"component": outer, "x": 800}))); + let ac = copy_of(&s, a, inherited_content); + let bc = copy_of(&s, b, inherited_content); + ex(&mut s, "instance.setProperties", json!({"ids": [ac], "properties": {"Text": "Custom"}})); + assert_local_slot_text(&mut s, ac, "Custom"); + let bytes = figcraft_format::save_bytes(s.doc().unwrap(), None).unwrap(); + let (back, _) = figcraft_format::load_bytes(&bytes).unwrap(); + let mut s = Session::with_document(back); + assert_local_slot_text(&mut s, ac, "Custom"); + assert_slot_text(&mut s, ac, "Custom"); + assert_slot_text(&mut s, bc, "Default"); + assert_slot_text(&mut s, inherited_content, "Default"); + assert_slot_text(&mut s, main_content, "Default"); + // Explicit characters override the bound property, even after a main update. + let alabel = kids(&s, ac)[0]; + ex(&mut s, "text.set", json!({"id": alabel, "characters": "Explicit"})); + ex(&mut s, "instance.setProperties", json!({"ids": [ac], "properties": {"Text": "Later"}})); + ex(&mut s, "instance.setProperties", json!({"ids": [main_content], "properties": {"Text": "Main value"}})); + assert_local_slot_text(&mut s, ac, "Later"); + assert_slot_text(&mut s, ac, "Explicit"); + assert_slot_text(&mut s, bc, "Main value"); + ex(&mut s, "component.resetOverride", json!({"id": alabel, "group": "characters"})); + assert_slot_text(&mut s, ac, "Later"); + s.undo().unwrap(); + assert_slot_text(&mut s, ac, "Explicit"); + healthy(&s); +} + /// Random slot edits, main edits and resets keep every instance mirroring its main. #[test] fn random_slot_edits_keep_instances_consistent() { From 0ff3a3682ea8b2e2df68fab3156c2c99d4b8c442 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sun, 8 Nov 2026 19:22:04 +0000 Subject: [PATCH 054/239] Reject negative and fractional index in file.openRecent Found while testing crates/engine/src/cmd/file/open.rs:33 (open_recent, `.nth(i.max(0.0) as usize)`) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd/file/open.rs | 5 ++++- crates/engine/src/menu_gaps_tests.rs | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/file/open.rs b/crates/engine/src/cmd/file/open.rs index e4c3e0fb7..b6e154c35 100644 --- a/crates/engine/src/cmd/file/open.rs +++ b/crates/engine/src/cmd/file/open.rs @@ -31,7 +31,10 @@ pub(super) fn open_recent(s: &mut Session, p: &Value) -> Result { Some(path) } (None, Some(i)) => { - Some(s.prefs.recent_files.iter().filter(|r| listed(r)).nth(i.max(0.0) as usize).cloned().ok_or_else(|| bad(CMD, "no such recent file"))?) + if !(i >= 0.0 && i.fract() == 0.0) { + return Err(bad(CMD, "no such recent file")); + } + Some(s.prefs.recent_files.iter().filter(|r| listed(r)).nth(i as usize).cloned().ok_or_else(|| bad(CMD, "no such recent file"))?) } _ => None, }; diff --git a/crates/engine/src/menu_gaps_tests.rs b/crates/engine/src/menu_gaps_tests.rs index 057c5119a..fa32f5d8f 100644 --- a/crates/engine/src/menu_gaps_tests.rs +++ b/crates/engine/src/menu_gaps_tests.rs @@ -84,3 +84,20 @@ fn outlined_layers_draw_as_outlines_and_the_rest_normally() { assert_eq!(outlined.pixel(20, 20).unwrap(), empty, "only its outline"); assert_eq!(outlined.pixel(80, 20).unwrap(), plain.pixel(80, 20).unwrap(), "the other layer draws normally"); } + +#[test] +fn open_recent_rejects_negative_and_fractional_index() { + let dir = std::env::temp_dir().join(format!("figcraft-recent-bad-{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + let a = dir.join("a.figcraft").to_string_lossy().to_string(); + let b = dir.join("b.figcraft").to_string_lossy().to_string(); + let mut s = Session::new(); + s.execute("file.save", &json!({"path": a})).unwrap(); + s.execute("file.saveAs", &json!({"path": b})).unwrap(); + let recent = s.prefs.recent_files.clone(); + for i in [json!(-1), json!(1.5), json!(-0.5)] { + assert!(s.execute("file.openRecent", &json!({"index": i})).is_err(), "index {i} must be an error"); + } + assert_eq!(s.prefs.recent_files, recent); + let _ = std::fs::remove_dir_all(&dir); +} From dc841f854805fabefbf4d4e102f4006c01e08ef2 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 14:44:47 -0500 Subject: [PATCH 055/239] M8: vector.edit.position moves points in one pass; refusal, empty-selection and scrub tests The handler grouped equal offsets by a linear scan per point, quadratic when every point moves by its own offset. Only a single move covering every point carries the regions' paint frames, so it now checks in one pass whether all offsets are equal: if so the points move as one, otherwise each moves by its own offset. The result is the same as before. Tests: booleans, a valid x with a refused y, and the overflow case are refused with no undo step; nothing selected is refused; a shared Y scrubs every point in one undo step and a Mixed X doesn't scrub. selection_position's doc comment names its one user, vector.edit.bounds. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/engine/src/canvas/vectoredit.rs | 25 ++++++++++--------- .../src/canvas/vectoredit/position_tests.rs | 23 +++++++++++++++++ crates/ui-egui/src/field_tests.rs | 4 +-- crates/ui-egui/src/vector_point_xy_tests.rs | 23 +++++++++++++++-- 4 files changed, 59 insertions(+), 16 deletions(-) diff --git a/crates/engine/src/canvas/vectoredit.rs b/crates/engine/src/canvas/vectoredit.rs index 47597ea92..db4dfc099 100644 --- a/crates/engine/src/canvas/vectoredit.rs +++ b/crates/engine/src/canvas/vectoredit.rs @@ -762,7 +762,7 @@ pub fn selected_parent_points(doc: &Document, ve: &VectorEdit) -> Vec { selected_points(net, ve).into_iter().filter_map(|v| net.vertices.get(v)).map(|v| t * v.point()).collect() } -/// Selection bounds' top-left in the parent's coordinates (what the X/Y fields show). +/// Selection bounds' top-left in the parent's coordinates (the `x` and `y` of `vector.edit.bounds`). pub fn selection_position(doc: &Document, ve: &VectorEdit) -> Option { let net = network(doc, ve.id)?; let t = doc.node(ve.id)?.transform; @@ -1017,18 +1017,19 @@ pub fn specs() -> Vec { if moves.is_empty() { return Err(bad("vector.edit.position", "select points")); } - // Points with the same offset move together, so moving every point by one offset - // still carries the regions' paint frames, as a drag of all of them does. - let mut groups: Vec<(Vec2, Vec)> = Vec::new(); - for (i, d) in moves { - match groups.iter_mut().find(|(g, _)| (*g - d).hypot() < 1e-9) { - Some((_, v)) => v.push(i), - None => groups.push((d, vec![i])), - } - } + // Points that all share one offset move as one, so moving every point of a layer + // by one offset still carries the regions' paint frames, as a drag of all of them + // does. Otherwise no one move covers every point, so each point moves alone. + let d0 = moves[0].1; + let uniform = moves.iter().all(|(_, d)| (*d - d0).hypot() < 1e-9); edit(s.doc_mut()?, ve.id, |net| { - for (d, v) in &groups { - ops::move_vertices(net, v, *d); + if uniform { + let all: Vec = moves.iter().map(|(i, _)| *i).collect(); + ops::move_vertices(net, &all, d0); + } else { + for (i, d) in &moves { + ops::move_vertices(net, &[*i], *d); + } } })?; Ok(json!({"ok": true})) diff --git a/crates/engine/src/canvas/vectoredit/position_tests.rs b/crates/engine/src/canvas/vectoredit/position_tests.rs index fb6af9105..efbddab8d 100644 --- a/crates/engine/src/canvas/vectoredit/position_tests.rs +++ b/crates/engine/src/canvas/vectoredit/position_tests.rs @@ -19,6 +19,10 @@ fn parent_xy(s: &Session) -> Vec<(f64, f64)> { selected_parent_points(s.doc().unwrap(), &ve).iter().map(|p| (p.x, p.y)).collect() } +fn undo_steps(s: &Session) -> usize { + s.ds().unwrap().history.undo.len() +} + fn near(a: f64, b: f64) -> bool { (a - b).abs() < 1e-6 } @@ -132,6 +136,7 @@ fn junk_is_refused_and_changes_nothing() { let id = rect(&mut s); let before = xs(&s, id); ex(&mut s, "vector.edit.select", json!({"vertices": [0, 1]})); + let steps = undo_steps(&s); for junk in [ json!({"x": {"div": 0}}), json!({"x": {"pow": 2}}), @@ -140,9 +145,27 @@ fn junk_is_refused_and_changes_nothing() { json!({"y": {"add": "x"}}), json!({"x": {}}), json!({"x": [1]}), + json!({"x": true}), + json!({"x": {"add": true}}), + // A valid x with a refused y changes neither. + json!({"x": 5, "y": {"div": 0}}), + // Point 1's x of 100 overflows; point 0's 0 alone would not. json!({"x": {"mul": 1e308}}), ] { assert!(s.execute("vector.edit.position", &junk).is_err(), "{junk}"); } assert_eq!(xs(&s, id), before); + assert_eq!(undo_steps(&s), steps, "a refused edit leaves no undo step"); +} + +#[test] +fn nothing_selected_is_refused() { + let mut s = Session::new(); + let id = rect(&mut s); + ex(&mut s, "vector.edit.select", json!({"vertices": []})); + let (before, steps) = (xs(&s, id), undo_steps(&s)); + assert!(parent_xy(&s).is_empty()); + let err = s.execute("vector.edit.position", &json!({"x": 5})).unwrap_err(); + assert!(err.to_string().contains("select points"), "{err}"); + assert_eq!((xs(&s, id), undo_steps(&s)), (before, steps)); } diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index 2b1ead4aa..001187a91 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -234,7 +234,7 @@ fn geom(u: &Ui, n: NodeId) -> (f64, f64, f64, f64) { (b.x0, b.y0, b.width(), b.height()) } -fn undo_steps(u: &Ui) -> usize { +pub(crate) fn undo_steps(u: &Ui) -> usize { u.app.session.ds().unwrap().history.undo.len() } @@ -261,7 +261,7 @@ pub(crate) fn type_into(u: &mut Ui, name: &str, text: &str, end: Key) { } /// Scrub field `name` by its label: `dx` points with `modifiers` held, then let go. -fn scrub(u: &mut Ui, name: &str, dx: f32, modifiers: Modifiers) { +pub(crate) fn scrub(u: &mut Ui, name: &str, dx: f32, modifiers: Modifiers) { let from = label(u, name); drag(u, from, dx, modifiers); } diff --git a/crates/ui-egui/src/vector_point_xy_tests.rs b/crates/ui-egui/src/vector_point_xy_tests.rs index 07acb17da..e93f62873 100644 --- a/crates/ui-egui/src/vector_point_xy_tests.rs +++ b/crates/ui-egui/src/vector_point_xy_tests.rs @@ -1,12 +1,12 @@ //! The vector edit panel's Point section: X and Y show the value the selected points share, or //! "Mixed", and a typed value sets every selected point's own coordinate. -use egui::Key; +use egui::{Key, Modifiers}; use figcraft_doc::NodeId; use figcraft_engine::Session; use serde_json::json; -use crate::field_tests::{field, type_into}; +use crate::field_tests::{field, scrub, type_into, undo_steps}; use crate::layers_drag_tests::Ui; fn setup() -> (Ui, NodeId) { @@ -58,3 +58,22 @@ fn one_point_shows_its_own_value() { assert_eq!(field(&mut u, "X").1, format!("{}", p.0)); assert_eq!(field(&mut u, "Y").1, format!("{}", p.1)); } + +#[test] +fn a_shared_value_scrubs_every_point_in_one_step_and_mixed_does_not_scrub() { + let (mut u, id) = setup(); + // Points 0 and 1 share their y: a scrub moves both to the same new y, as one undo step. + u.app.session.execute("vector.edit.select", &json!({"vertices": [0, 1]})).unwrap(); + let (before, steps) = (xs(&u, id), undo_steps(&u)); + scrub(&mut u, "Y", 20.0, Modifiers::NONE); + let after = xs(&u, id); + assert!(after[0].1 > before[0].1, "the scrub moved y: {before:?} -> {after:?}"); + assert_eq!(after[0].1, after[1].1, "both points take the scrubbed value"); + assert_eq!((after[0].0, after[1].0), (before[0].0, before[1].0), "x is untouched"); + assert_eq!(undo_steps(&u), steps + 1, "one undo step for the whole scrub"); + // Their x differs (Mixed): there is no value to scrub from, so nothing moves. + assert_eq!(field(&mut u, "X").1, "Mixed"); + let (before, steps) = (xs(&u, id), undo_steps(&u)); + scrub(&mut u, "X", 20.0, Modifiers::NONE); + assert_eq!((xs(&u, id), undo_steps(&u)), (before, steps)); +} From 9c2c2cb74eb3a960dc3f36ab55bd7e603a1e2601 Mon Sep 17 00:00:00 2001 From: Davit Matchakhelidze Date: Mon, 9 Nov 2026 00:59:12 +0400 Subject: [PATCH 056/239] i18n(ka): place the new rows next to their English keys (review) --- crates/ui-egui/locales/ka.toml | 228 ++++++++++++++++----------------- 1 file changed, 114 insertions(+), 114 deletions(-) diff --git a/crates/ui-egui/locales/ka.toml b/crates/ui-egui/locales/ka.toml index 8a4a70475..80b99a957 100644 --- a/crates/ui-egui/locales/ka.toml +++ b/crates/ui-egui/locales/ka.toml @@ -16,7 +16,10 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "({n} warnings: some entries were skipped)" = { one = "(გაფრთხილება: {n}; ზოგი ჩანაწერი გამოტოვებულია)", other = "(გაფრთხილება: {n}; ზოგი ჩანაწერი გამოტოვებულია)" } "+ Create variable" = "+ ცვლადის შექმნა" ".fig (experimental)" = ".fig (ექსპერიმენტული)" +"1 year" = "1 წელი" "1…9, 0" = "1…9, 0" +"30 days" = "30 დღე" +"90 days" = "90 დღე" "@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{bin_added} / −{bin_deleted} binary assets, {first} – {last}" = "@{login}: PR: {prs}, კომიტი: {commits}, +{added} / −{deleted} სტრიქონი (Δ {delta}), +{bin_added} / −{bin_deleted} ბინარული რესურსი, {first} – {last}" "A collection of this file with these modes and variables: override their values per mode and add variables of its own" = "ამ ფაილის კოლექცია ამ რეჟიმებითა და ცვლადებით: შეცვალეთ მათი მნიშვნელობები თითოეული რეჟიმისთვის და დაამატეთ საკუთარი ცვლადები" "A .figcraft file with this name already exists. Choose its full name to confirm replacement." = "ამ სახელით .figcraft ფაილი უკვე არსებობს. ჩანაცვლების დასადასტურებლად აირჩიეთ მისი სრული სახელი." @@ -105,13 +108,14 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "All supported properties" = "ყველა მხარდაჭერილი თვისება" "All the fonts this file uses are installed" = "ამ ფაილის ყველა შრიფტი დაინსტალირებულია" "All variables" = "ყველა ცვლადი" +"Allow and download" = "დაშვება და ჩამოტვირთვა" +"Allow downloading fonts?" = "დაიშვას შრიფტების ჩამოტვირთვა?" "Along the bottom" = "ქვედა კიდის გასწვრივ" "Along the left" = "მარცხენა კიდის გასწვრივ" "Along the right" = "მარჯვენა კიდის გასწვრივ" "Along the top" = "ზედა კიდის გასწვრივ" "Alpha" = "ალფა" "Alphabetical" = "ანბანის მიხედვით" -"Alt+double-click an edge of an auto layout child" = "Alt+ორმაგი დაწკაპუნება ავტოგანლაგების შვილობილი ელემენტის კიდეზე" "Alt+drag" = "Alt+გადათრევა" "An analytics screen on a grid: figures, charts drawn from vectors and a table" = "ანალიტიკა ბადეზე: ციფრები, დიაგრამები და ცხრილი" "An earlier vote" = "ადრინდელი კენჭისყრა" @@ -160,7 +164,6 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Auto layout" = "ავტოგანლაგება" "Auto rows" = "ავტომატური სტრიქონები" "Auto width" = "ავტომატური სიგანე" -"Auto: by the first letter with a direction" = "ავტომატური: მიმართულების მქონე პირველი ასოს მიხედვით" "Back to the FigCraft server" = "FigCraft-ის სერვერზე დაბრუნება" "Back to the font's value" = "შრიფტის მნიშვნელობაზე დაბრუნება" "Back" = "უკან" @@ -189,6 +192,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Blend mode" = "შერევის რეჟიმი" "Blue" = "ლურჯი" "Blur" = "გაბუნდოვნება" +"Board grid" = "დაფის ბადე" "Boolean" = "ლოგიკური" "Boolean groups" = "ლოგიკური ოპერაციების ჯგუფები" "Both directions" = "ორივე მიმართულება" @@ -220,6 +224,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Bulleted list" = "ბურთულებიანი სია" "C or Shift+C" = "C ან Shift+C" "C or ⇧C" = "C ან ⇧C" +"Changed {date}" = "შეცვლილია: {date}" "CMYK colour" = "CMYK ფერი" "Can view" = "შეუძლია ნახვა" "Can comment" = "შეუძლია კომენტარი" @@ -237,6 +242,8 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Connector" = "შემაერთებელი" "Convert to frame" = "ჩარჩოდ გარდაქმნა" "Convert to section" = "სექციად გარდაქმნა" +"Copy browser link" = "ბრაუზერის ბმულის კოპირება" +"Couldn't reach {server} for its team list." = "{server}-იდან გუნდის სიის მიღება ვერ მოხერხდა." "CSS custom properties…" = "CSS-ის მორგებული თვისებები…" "Can edit" = "შეუძლია რედაქტირება" "Can't read this library: {e}" = "ამ ბიბლიოთეკის წაკითხვა ვერ მოხერხდა: {e}" @@ -341,7 +348,6 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Copy as PNG" = "კოპირება როგორც PNG" "Copy as SVG" = "კოპირება როგორც SVG" "Copy code" = "კოდის კოპირება" -"Copy for AI" = "კოპირება AI-სთვის" "Copy link" = "ბმულის კოპირება" "Copy the {label}" = "კოპირება: {label}" "Copy {value}" = "კოპირება: {value}" @@ -368,11 +374,12 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Create style from the selected text" = "სტილის შექმნა მონიშნული ტექსტიდან" "Created" = "შექმნილია" "Crop" = "ჩამოჭრა" +"Crop image" = "გამოსახულების ჩამოჭრა" "Crop marks" = "ჭრის ნიშნები" -"Ctrl+Alt+← ↑ → ↓" = "Ctrl+Alt+← ↑ → ↓" "Ctrl+arrows" = "Ctrl+ისრები" "Ctrl+click" = "Ctrl+დაწკაპუნება" "Ctrl+click a padding field" = "Ctrl+დაწკაპუნება შიდა დაშორების ველზე" +"⌘ click a padding field" = "⌘ დაწკაპუნება შიდა დაშორების ველზე" "Ctrl+scroll" = "Ctrl+გადახვევა" "Current name" = "მიმდინარე სახელი" "Current version" = "მიმდინარე ვერსია" @@ -392,53 +399,40 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Decoration style" = "გაფორმების სტილი" "Decoration" = "გაფორმება" "Deep select" = "ღრმა მონიშვნა" +"Scrub a field faster (2x) or slower (1/2, 1/4)" = "ველის მნიშვნელობის გადათრევით ცვლა უფრო სწრაფად (2x) ან ნელა (1/2, 1/4)" +"Move up or down while dragging its label" = "ზემოთ ან ქვემოთ გადაადგილება მისი იარლიყის გადათრევისას" +"Scrubbing at 2x" = "გადათრევით ცვლა: 2x" +"Scrubbing at 1x" = "გადათრევით ცვლა: 1x" +"Scrubbing at 1/2" = "გადათრევით ცვლა: 1/2" +"Scrubbing at 1/4" = "გადათრევით ცვლა: 1/4" "Delete {n} variables" = { one = "ცვლადის წაშლა: {n}", other = "ცვლადის წაშლა: {n}" } -"Disconnected. Reconnecting…" = "კავშირი გაწყდა. ხელახლა დაკავშირება…" -"Disconnected. Your edits stay here and sync when the connection returns. Reconnecting…" = "კავშირი გაწყდა. თქვენი ცვლილებები აქ რჩება და სინქრონიზდება, როცა კავშირი აღდგება. ხელახლა დაკავშირება…" -"Dismiss" = "უგულებელყოფა" -"Double-click an edge of an auto layout frame" = "ორმაგი დაწკაპუნება ავტოგანლაგების ჩარჩოს კიდეზე" -"Edit padding on all sides" = "შიდა დაშორების რედაქტირება ყველა მხარეს" -"Enter / Shift+Enter" = "Enter / Shift+Enter" -"Expand the interface" = "ინტერფეისის გაშლა" -"Hide UI" = "ინტერფეისის დამალვა" -"Left to right" = "მარცხნიდან მარჯვნივ" "Move out of any group" = "ჯგუფიდან გამოტანა" "Move to group {group}" = "ჯგუფში გადატანა: {group}" -"Move up or down while dragging its label" = "ზემოთ ან ქვემოთ გადაადგილება მისი იარლიყის გადათრევისას" -"Not connected: {reason}. Your work is still in this tab." = "კავშირი არ არის: {reason}. თქვენი ნამუშევარი ისევ ამ ჩანართშია." -"Nothing to pick: the page is empty" = "ასარჩევი არაფერია: გვერდი ცარიელია" -"Pick select: Tab and Shift+Tab move between layers, Enter goes into one, Shift+Enter out, Space selects, Escape cancels" = "შრის არჩევა: Tab და Shift+Tab შრეებს შორის გადაადგილდება, Enter შრეში შედის, Shift+Enter გამოდის, Space მონიშნავს, Escape გააუქმებს" -"Pick select: into a layer, out to its parent" = "შრის არჩევა: შრეში შესვლა, მშობელზე გასვლა" -"Pick select: next or previous layer" = "შრის არჩევა: შემდეგი ან წინა შრე" -"Pick select: select the picked layer" = "შრის არჩევა: არჩეული შრის მონიშვნა" -"Remove all auto layout" = "ყველა ავტოგანლაგების მოხსნა" -"Retry now" = "ახლავე ხელახლა ცდა" -"Right to left" = "მარჯვნიდან მარცხნივ" -"Rotate a degree (Shift: 15)" = "ერთი გრადუსით შემობრუნება (Shift: 15)" -"Same as file ({profile})" = "როგორც ფაილში ({profile})" -"Save a copy…" = "ასლის შენახვა…" "Scope: all supported properties" = "არე: ყველა მხარდაჭერილი თვისება" "Scope: hidden from pickers" = "არე: ამომრჩევებში დამალული" "Scope: only {scope}" = "არე: მხოლოდ {scope}" -"Scrub a field faster (2x) or slower (1/2, 1/4)" = "ველის მნიშვნელობის გადათრევით ცვლა უფრო სწრაფად (2x) ან ნელა (1/2, 1/4)" -"Scrubbing at 1/2" = "გადათრევით ცვლა: 1/2" -"Scrubbing at 1/4" = "გადათრევით ცვლა: 1/4" -"Scrubbing at 1x" = "გადათრევით ცვლა: 1x" -"Scrubbing at 2x" = "გადათრევით ცვლა: 2x" -"Selection box: switch to pick select" = "მონიშვნის ჩარჩო: შრის არჩევაზე გადართვა" -"Set fill container" = "ზომა: კონტეინერის შევსება" -"Set hug contents" = "ზომა: შიგთავსზე მორგება" -"Show and move the placement crosshair (its tool chosen, nothing selected)" = "განთავსების ჯვრის ჩვენება და გადაადგილება (არჩეული ხელსაწყოთი, როცა არაფერია მონიშნული)" -"Space" = "Space" -"Tab or Ctrl+Space again" = "Tab ან ხელახლა Ctrl+Space" -"Text direction" = "ტექსტის მიმართულება" -"The bars are hidden. {shortcut} shows them again" = "ზოლები დამალულია. {shortcut} ისევ აჩვენებს მათ" +"Disconnected. Reconnecting…" = "კავშირი გაწყდა. ხელახლა დაკავშირება…" +"Disconnected. Your edits stay here and sync when the connection returns. Reconnecting…" = "კავშირი გაწყდა. თქვენი ცვლილებები აქ რჩება და სინქრონიზდება, როცა კავშირი აღდგება. ხელახლა დაკავშირება…" +"Dismiss" = "უგულებელყოფა" +"Not connected: {reason}. Your work is still in this tab." = "კავშირი არ არის: {reason}. თქვენი ნამუშევარი ისევ ამ ჩანართშია." +"Retry now" = "ახლავე ხელახლა ცდა" +"Save a copy…" = "ასლის შენახვა…" "Wrap style" = "გადატანის სტილი" +"Text direction" = "ტექსტის მიმართულება" +"Auto: by the first letter with a direction" = "ავტომატური: მიმართულების მქონე პირველი ასოს მიხედვით" +"Left to right" = "მარცხნიდან მარჯვნივ" +"Right to left" = "მარჯვნიდან მარცხნივ" "Balance" = "დაბალანსებული" "Pretty" = "მოწესრიგებული" "Auto: as many words as fit on each line" = "ავტომატური: თითო სტრიქონში იმდენი სიტყვა, რამდენიც ეტევა" "Balance: every line close to the same length" = "დაბალანსებული: ყველა სტრიქონი დაახლოებით ერთი სიგრძისაა" "Pretty: full lines, no one word alone on the last" = "მოწესრიგებული: სავსე სტრიქონები, ბოლო სტრიქონზე ერთი სიტყვა მარტო არ რჩება" +"Set hug contents" = "ზომა: შიგთავსზე მორგება" +"Set fill container" = "ზომა: კონტეინერის შევსება" +"Double-click an edge of an auto layout frame" = "ორმაგი დაწკაპუნება ავტოგანლაგების ჩარჩოს კიდეზე" +"{name}, disconnected from its live session" = "{name}, ცოცხალ სესიასთან კავშირი გაწყვეტილია" +"⌥ double-click an edge of an auto layout child" = "⌥ ორმაგი დაწკაპუნება ავტოგანლაგების შვილობილი ელემენტის კიდეზე" +"Alt+double-click an edge of an auto layout child" = "Alt+ორმაგი დაწკაპუნება ავტოგანლაგების შვილობილი ელემენტის კიდეზე" "Default" = "ნაგულისხმევი" "Default content" = "ნაგულისხმევი შიგთავსი" "Default value (the top-left variant)" = "ნაგულისხმევი მნიშვნელობა (ზედა მარცხენა ვარიანტი)" @@ -468,6 +462,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Desktop" = "დესკტოპი" "Destination" = "დანიშნულება" "Detach alias" = "ალიასის გამოყოფა" +"Detach calculation" = "გამოთვლის გამოყოფა" "Detach instance" = "ინსტანსის გამოყოფა" "Detach property" = "თვისების გამოყოფა" "Detach style" = "სტილის გამოყოფა" @@ -499,6 +494,8 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Dots" = "წერტილები" "Dotted" = "პუნქტირი" "Down" = "ქვემოთ" +"Download" = "ჩამოტვირთვა" +"Downloading… {percent}%" = "ჩამოტვირთვა… {percent}%" "Drafts" = "მონახაზები" "Drag the stroke to add a width point" = "გადაათრიეთ კონტური სიგანის წერტილის დასამატებლად" "Draw" = "ხატვა" @@ -508,6 +505,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Drop to import" = "ჩააგდეთ იმპორტისთვის" "Drop to open" = "ჩააგდეთ გასახსნელად" "Drop shadow" = "ჩრდილი" +"Drop to use this image" = "ჩააგდეთ ამ გამოსახულების გამოსაყენებლად" "Dual-licensed MIT OR Apache-2.0. Made by the ArtCraft team and community." = "ორმაგი ლიცენზია: MIT OR Apache-2.0. შექმნილია ArtCraft-ის გუნდისა და საზოგადოების მიერ." "Duo" = "დუო" "Duplicate" = "დუბლირება" @@ -521,6 +519,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Edit dev resource" = "დეველოპერის რესურსის რედაქტირება" "Edit link" = "რედაქტირების ბმული" "Edit link copied" = "რედაქტირების ბმული დაკოპირდა" +"Edit padding on all sides" = "შიდა დაშორების რედაქტირება ყველა მხარეს" "Edit style" = "სტილის რედაქტირება" "Edit variable" = "ცვლადის რედაქტირება" "Edit with the builder" = "კონსტრუქტორით რედაქტირება" @@ -548,6 +547,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Essential" = "ძირითადი" "Every conflict has a choice." = "ყველა კონფლიქტს არჩევანი აქვს." "Every top-level frame already starts a flow" = "ყველა ზედა დონის ჩარჩო უკვე იწყებს ნაკადს" +"Everyone who reaches this server can open these files while they are shared." = "ამ სერვერთან წვდომის მქონე ყველას შეუძლია ამ ფაილების გახსნა, სანამ ისინი გაზიარებულია." "Exact opacity (4 then 5: 45%)" = "ზუსტი გაუმჭვირვალობა (4, შემდეგ 5: 45%)" "Exclude" = "გამორიცხვა" "Excluded" = "გამორიცხული" @@ -556,6 +556,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Exclusion" = "გამორიცხვა" "Exit focus view (Esc)" = "ფოკუსის ხედიდან გასვლა (Esc)" "Expand" = "გაშლა" +"Expand the interface" = "ინტერფეისის გაშლა" "Export" = "ექსპორტირება" "Export all" = "ყველაფრის ექსპორტირება" "Export frames and layers as PNG, JPG, SVG or PDF" = "ჩარჩოები და შრეები PNG, JPG, SVG ან PDF ფორმატში" @@ -582,6 +583,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Fetching from the server…" = "სერვერიდან მიღება…" "FigCraft couldn't open its window: {error}" = "FigCraft-მა ფანჯრის გახსნა ვერ შეძლო: {error}" "FigCraft doesn't support every feature of these files yet. The notes list what was left out or changed in the imported copy; the original file is unchanged." = "FigCraft ჯერ ამ ფაილების ყველა შესაძლებლობას არ უჭერს მხარს. შენიშვნებში ჩამოთვლილია, რა გამოტოვდა ან შეიცვალა იმპორტირებულ ასლში; ორიგინალი ფაილი უცვლელია." +"FigCraft stopped because of an internal error." = "FigCraft-ის მუშაობა შიდა შეცდომის გამო შეწყდა." "File" = "ფაილი" "File name" = "ფაილის სახელი" "File not found" = "ფაილი ვერ მოიძებნა" @@ -638,6 +640,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Frame selection" = "მონიშნულის ჩარჩოში მოქცევა" "Frame tools" = "ჩარჩოს ხელსაწყოები" "Frames" = "ჩარჩოები" +"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." = "უფასო შრიფტები Google Fonts-იდან და Noto-დან მოდის, jsDelivr-ისა და GitHub-ის გავლით. თითოეული ფაილი შრიფტების ინდექსთან მოწმდება, სანამ Craft-აპების საერთო შრიფტების საქაღალდეში დაინსტალირდება. სანამ არ დაუშვებთ, არაფერი ჩამოიტვირთება." "From the library \"{name}\": read-only" = "ბიბლიოთეკიდან „{name}“: მხოლოდ წასაკითხად" "From {name}" = "წყარო: {name}" "From {server}" = "წყარო: {server}" @@ -653,6 +656,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Go to {name}" = "{name}-ზე გადასვლა" "Grab bag" = "სხვადასხვა" "Gradient" = "გრადიენტი" +"Graph paper" = "მილიმეტრიანი ქაღალდი" "Gray" = "ნაცრისფერი" "Green" = "მწვანე" "Greyscale components and two example screens to sketch a flow with" = "ნაცრისფერი კომპონენტები ნაკადის ჩანახატისთვის" @@ -675,6 +679,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Help page" = "დახმარების გვერდი" "Here: {names}" = "აქ: {names}" "Hidden" = "დამალული" +"Hide UI" = "ინტერფეისის დამალვა" "Hide contents" = "შიგთავსის დამალვა" "Hide from publishing" = "გამოქვეყნებისას დამალვა" "Hide section contents" = "სექციის შიგთავსის დამალვა" @@ -766,6 +771,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Join with a code" = "კოდით შეერთება" "Joined" = "შეერთებულია" "Joined {file}" = "შეერთებულია: {file}" +"Joining live session…" = "ცოცხალ სესიასთან შეერთება…" "Joining…" = "შეერთება…" "Join|stroke" = "შეერთება" "Jul" = "ივლ" @@ -827,6 +833,8 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Lines deleted" = "წაშლილი სტრიქონები" "Link" = "ბმული" "Link copied" = "ბმული დაკოპირდა" +"Link copied: it opens the file in FigCraft" = "ბმული დაკოპირდა: ის ფაილს FigCraft-ში ხსნის" +"Link copied: it opens the file in the browser" = "ბმული დაკოპირდა: ის ფაილს ბრაუზერში ხსნის" "Link docs, code or tickets for developers." = "მიაბით დოკუმენტაცია, კოდი ან ტიკეტები დეველოპერებისთვის." "Link frames on the Prototype tab, then present the flow" = "დააკავშირეთ ჩარჩოები და წარადგინეთ ნაკადი" "Link this component to its code component: instances then show your real snippet with their values." = "დააკავშირეთ ეს კომპონენტი მის კოდის კომპონენტთან: ინსტანსები მაშინ თქვენს რეალურ ფრაგმენტს აჩვენებს მათი მნიშვნელობებით." @@ -849,10 +857,15 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Make a component" = "შექმენით კომპონენტი" "Make slot" = "სლოტად გადაქცევა" "New collection" = "ახალი კოლექცია" +"Nobody shares a file there now." = "იქ ახლა არავინ აზიარებს ფაილს." +"Past 30 days" = "ბოლო 30 დღე" +"Past 90 days" = "ბოლო 90 დღე" +"Past year" = "ბოლო წელი" "Pasted design layers" = "ჩასმული დიზაინის ფენები" "Pasted design layers; the clipboard didn't carry the images of: {layers}" = "დიზაინის ფენები ჩაისვა; ბუფერში არ იყო შემდეგის სურათები: {layers}" "Remove these results from the file" = "ამ შედეგების ფაილიდან წაშლა" "Scroll wheel zoom" = "მასშტაბირება გადახვევის ბორბლით" +"Shared by your team on {server}" = "თქვენი გუნდის მიერ {server}-ზე გაზიარებული" "Slot name" = "სლოტის სახელი" "Mar" = "მარ" "Margin" = "ველი" @@ -987,15 +1000,18 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Not bound" = "მიბმული არ არის" "Not in a live session" = "ცოცხალ სესიაში არ ხართ" "Not in this font" = "ამ შრიფტში არ არის" +"Not now" = "ახლა არა" "Not properties, kept as written: {names}" = "არ არის თვისებები, დარჩა დაწერილი სახით: {names}" "Not read yet" = "ჯერ არ არის წაკითხული" "Check for updates" = "განახლებების შემოწმება" "Not checked yet" = "ჯერ არ არის შემოწმებული" "Someone who left" = "ვინც წავიდა" "Take the results off the board; they stay in the file" = "შედეგების დაფიდან მოხსნა; ფაილში დარჩება" +"Upload from computer" = "კომპიუტერიდან ატვირთვა" "This file uses team libraries on servers you haven't used here. They aren't contacted until you check them." = "ეს ფაილი იყენებს გუნდის ბიბლიოთეკებს სერვერებზე, რომლებიც აქ არ გამოგიყენებიათ. მათ არ დავუკავშირდებით, სანამ არ შეამოწმებთ." "Not shared" = "არ არის გაზიარებული" "Note {n}" = "შენიშვნა {n}" +"Nothing counted yet" = "ჯერ არაფერი დათვლილა" "Nothing changed since this version." = "ამ ვერსიის შემდეგ არაფერი შეცვლილა." "Nothing changed since this was marked ready for dev." = "მას შემდეგ, რაც მზად დეველოპერისთვის მოინიშნა, არაფერი შეცვლილა." "Nothing here yet. Set a frame's status to list it." = "აქ ჯერ არაფერია. ჩარჩოს სიაში გამოსაჩენად მიანიჭეთ სტატუსი." @@ -1004,6 +1020,9 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Nov" = "ნოე" "Now" = "ახლა" "Nudge (Shift: big nudge)" = "მცირედ გადაწევა (Shift: დიდი ბიჯით)" +"Rotate a degree (Shift: 15)" = "ერთი გრადუსით შემობრუნება (Shift: 15)" +"⌥⌘ ← ↑ → ↓" = "⌥⌘ ← ↑ → ↓" +"Ctrl+Alt+← ↑ → ↓" = "Ctrl+Alt+← ↑ → ↓" "Nudge amount" = "მცირედ გადაწევის ბიჯი" "Number" = "რიცხვი" "Number ↑" = "რიცხვი ↑" @@ -1080,6 +1099,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Pages: {pages}" = "გვერდი: {pages}" "Paint bucket" = "საღებავის ვედრო" "Pan the canvas" = "ტილოს გადაადგილება" +"Show and move the placement crosshair (its tool chosen, nothing selected)" = "განთავსების ჯვრის ჩვენება და გადაადგილება (არჩეული ხელსაწყოთი, როცა არაფერია მონიშნული)" "Pan with nothing selected (Shift: farther)" = "გადაადგილება, როცა არაფერია მონიშნული (Shift: უფრო შორს)" "Panels" = "პანელები" "Paper" = "ქაღალდი" @@ -1189,9 +1209,13 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Regular expression" = "რეგულარული გამოსახულება" "Relative to" = "მიმართ" "Relative to your system's display scaling (100% is the system's own size). Document zoom is separate." = "სისტემის ეკრანის მასშტაბირებასთან მიმართებით (100% სისტემის საკუთარი ზომაა). დოკუმენტის მასშტაბი ცალკე რეგულირდება." +"Reload the page to get back the unsaved files the browser had room for." = "განაახლეთ გვერდი, რომ დაიბრუნოთ ის შეუნახავი ფაილები, რომლებიც ბრაუზერში დაეტია." +"Reload the page to get your unsaved files back." = "განაახლეთ გვერდი, რომ შეუნახავი ფაილები დაიბრუნოთ." +"Reload the page to start again." = "თავიდან დასაწყებად განაახლეთ გვერდი." "Remove" = "წაშლა" "Remove all" = "ყველას წაშლა" "Remove annotation" = "ანოტაციის წაშლა" +"Remove all auto layout" = "ყველა ავტოგანლაგების მოხსნა" "Remove auto layout" = "ავტოგანლაგების მოხსნა" "Remove column" = "სვეტის წაშლა" "Remove dev resource" = "დეველოპერის რესურსის წაშლა" @@ -1243,6 +1267,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Reset adjustments" = "კორექციების ჩამოყრა" "Reset all changes" = "ყველა ცვლილების ჩამოყრა" "Reset all overrides on this layer" = "ამ შრის ყველა გადაფარვის ჩამოყრა" +"Reset grid" = "ბადის ჩამოყრა" "Reset overrides" = "გადაფარვების ჩამოყრა" "Reset slot" = "სლოტის ჩამოყრა" "Reset this override" = "ამ გადაფარვის ჩამოყრა" @@ -1297,6 +1322,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "See all templates" = "ყველა შაბლონის ნახვა" "Select layers and they space themselves as their content changes" = "შრეები შიგთავსის ცვლილებისას თავად დაშორდება" "SHA-256: {sha}…" = "SHA-256: {sha}…" +"Same as file ({profile})" = "როგორც ფაილში ({profile})" "Same as layer" = "შრის მსგავსად" "Saturation" = "გაჯერება" "Save" = "შენახვა" @@ -1322,6 +1348,8 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Search files and templates" = "ფაილებისა და შაბლონების ძიება" "Search results" = "ძიების შედეგები" "Search fonts" = "შრიფტების ძიება" +"This server doesn't count insertions" = "ეს სერვერი ჩასმებს არ ითვლის" +"This server doesn't count styles and variables" = "ეს სერვერი სტილებსა და ცვლადებს არ ითვლის" "Use fonts installed on this computer…" = "ამ კომპიუტერზე დაყენებული შრიფტების გამოყენება…" "Search layers" = "შრეების ძიება" "Search shortcuts" = "მალსახმობების ძიება" @@ -1381,6 +1409,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Show device frame" = "მოწყობილობის კორპუსის ჩვენება" "Show dimensions on objects" = "ზომების ჩვენება ობიექტებზე" "Show hotspot hints" = "აქტიური არეების მინიშნებების ჩვენება" +"The bars are hidden. {shortcut} shows them again" = "ზოლები დამალულია. {shortcut} ისევ აჩვენებს მათ" "Show in Explorer" = "Explorer-ში ჩვენება" "Show in Finder" = "Finder-ში ჩვენება" "Show in folder" = "საქაღალდეში ჩვენება" @@ -1484,6 +1513,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Stroke style" = "კონტურის სტილი" "Stroke weight" = "კონტურის სისქე" "Strokes" = "კონტურები" +"Strong line every" = "მუქი ხაზის ბიჯი" "Style" = "სტილი" "Styles" = "სტილები" "Stylistic set 1" = "სტილისტური ნაკრები 1" @@ -1707,6 +1737,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Your copy stays open; the file stays on the server" = "თქვენი ასლი ღია რჩება; ფაილი სერვერზე რჩება" "Your name" = "თქვენი სახელი" "Your system asks for reduced motion: animations stay off." = "თქვენი სისტემა ითხოვს მოძრაობის შემცირებას: ანიმაციები გამორთული რჩება." +"Your unsaved files were too large for the browser to keep." = "თქვენი შეუნახავი ფაილები ბრაუზერისთვის შესანახად ზედმეტად დიდი იყო." "Z" = "Z" "Z to A" = "ჰ-დან ა-მდე" "Zoom" = "მასშტაბი" @@ -1740,6 +1771,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "connector label was skipped: text style data is missing" = "შემაერთებლის იარლიყი გამოტოვებულია: ტექსტის სტილის მონაცემები აკლია" "connector label was skipped: text transform is invalid" = "შემაერთებლის იარლიყი გამოტოვებულია: ტექსტის გარდაქმნა არასწორია" "connector labels were skipped" = "შემაერთებლების იარლიყები გამოტოვებულია" +"connector labels without a saved snapshot are centred on the line, without their background" = "შენახული სნეპშოტის გარეშე შემაერთებლის იარლიყები ხაზზე ცენტრდება, ფონის გარეშე" "connector layers import as static frame/vector snapshots with labels when present; live endpoint bindings are not retained" = "შემაერთებლის შრეები იმპორტირდება ჩარჩოს ან ვექტორის სტატიკური სნეპშოტების სახით, იარლიყებით (თუ არის); ბოლოების ცოცხალი მიბმები არ ნარჩუნდება" "connector snapshot vector data is missing; connector was left empty" = "შემაერთებლის სნეპშოტის ვექტორული მონაცემები აკლია; შემაერთებელი ცარიელი დარჩა" "connectors whose ends can't be placed are empty" = "შემაერთებლები, რომელთა ბოლოების განთავსება ვერ ხერხდება, ცარიელია" @@ -1751,6 +1783,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "duplicate grid track sizing entries use equal tracks" = "ბადის ტრეკის ზომის დუბლირებული ჩანაწერებისას ტრეკები თანაბარია" "e.g. count + 1" = "მაგ. count + 1" "e.g. count >= 3 and not done" = "მაგ. count >= 3 and not done" +"elbowed and curved connectors without a saved path follow FigCraft's own routing" = "შენახული ტრაექტორიის გარეშე კუთხოვანი და მრუდი შემაერთებლები FigCraft-ის საკუთარ მარშრუტს მიჰყვება" "entries without a node type were skipped" = "კვანძის ტიპის გარეშე ჩანაწერები გამოტოვებულია" "figcraft:// links from a browser, chat or email open this app and join the session." = "ბრაუზერიდან, ჩატიდან ან ელფოსტიდან figcraft:// ბმულები ხსნის ამ აპს და უერთდება სესიას." "from {server}" = "წყარო: {server}" @@ -1772,12 +1805,15 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "invalid internal .fig text path data was ignored" = ".fig-ის შიდა ტექსტის ტრაექტორიის არასწორი მონაცემები იგნორირებულია" "invalid or oversized vector networks import as outlines" = "არასწორი ან ზედმეტად დიდი ვექტორული ქსელები კონტურებად იმპორტირდება" "invalid or oversized vector path data was skipped" = "ვექტორული ტრაექტორიის არასწორი ან ზედმეტად დიდი მონაცემები გამოტოვებულია" +"invalid vector region fill paint list; layer fill used" = "ვექტორული არის შევსების საღებავების სია არასწორია; გამოყენებულია შრის შევსება" +"invalid vector region paints were skipped" = "ვექტორული არის არასწორი საღებავები გამოტოვებულია" "just now" = "ახლახან" "key triggers without a supported key were skipped" = "მხარდაჭერილი კლავიშის გარეშე კლავიშის გამშვებები გამოტოვებულია" "key up triggers import as key presses" = "კლავიშის აშვების გამშვებები კლავიშის დაჭერებად იმპორტირდება" "layers without a position were placed at their parent's origin" = "პოზიციის გარეშე შრეები მშობლის საწყის წერტილში განთავსდა" "layers without a type were skipped" = "ტიპის გარეშე შრეები გამოტოვებულია" "legacy image filter container is unsupported; filter conversion was skipped" = "გამოსახულების ფილტრების ძველი კონტეინერი მხარდაუჭერელია; ფილტრების გარდაქმნა გამოტოვებულია" +"linked vector region fill styles keep resolved appearance; live style links were left out" = "ვექტორული არის მიბმული შევსების სტილები გამოთვლილ იერსახეს ინარჩუნებს; სტილების ცოცხალი კავშირები არ გადმოვიდა" "links to shared styles that aren't in the file kept the layers' own values" = "ფაილში არარსებულ საერთო სტილებზე ბმულებმა შეინარჩუნეს ფენების საკუთარი მნიშვნელობები" "locked" = "ჩაკეტილი" "malformed image filters container was skipped" = "გამოსახულების ფილტრების დაზიანებული კონტეინერი გამოტოვებულია" @@ -1786,6 +1822,10 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "no bleed" = "ჭრისპირა არის გარეშე" "nobody else here yet" = "აქ ჯერ სხვა არავინაა" "non-default slot settings are not represented and were skipped" = "სლოტის არანაგულისხმევი პარამეტრები არ არის წარმოდგენილი და გამოტოვებულია" +"note or shape generated child has invalid bounds; child skipped" = "შენიშვნის ან ფიგურის გენერირებულ შვილობილ ელემენტს არასწორი საზღვრები აქვს; ელემენტი გამოტოვებულია" +"note or shape generated child is missing its style or bounds; child skipped" = "შენიშვნის ან ფიგურის გენერირებულ შვილობილ ელემენტს სტილი ან საზღვრები აკლია; ელემენტი გამოტოვებულია" +"note or shape generated children exceed the layer or nesting limit; remaining children skipped" = "შენიშვნის ან ფიგურის გენერირებული შვილობილი ელემენტები შრეების ან ჩადგმის ლიმიტს აჭარბებს; დანარჩენი ელემენტები გამოტოვებულია" +"note or shape generated layout is missing or unsupported; using its outer frame" = "შენიშვნის ან ფიგურის გენერირებული განლაგება აკლია ან მხარდაუჭერელია; გამოიყენება მისი გარე ჩარჩო" "now" = "ახლა" "offer files to save if it asks to (you choose where each one goes)" = "შესანახად ფაილების შეთავაზება, თუ ამას ითხოვს (თითოეულის ადგილს თქვენ ირჩევთ)" "only in a text style or variable" = "მხოლოდ ტექსტის სტილში ან ცვლადში" @@ -1809,6 +1849,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "set-variable actions with values that don't fit the variable were skipped" = "ცვლადის დაყენების მოქმედებები, რომელთა მნიშვნელობა ცვლადს არ შეესაბამება, გამოტოვებულია" "set-variable actions without a value were skipped" = "მნიშვნელობის გარეშე ცვლადის დაყენების მოქმედებები გამოტოვებულია" "set-variable-mode actions on collections or modes that aren't in the variables JSON were skipped" = "ცვლადის რეჟიმის დაყენების მოქმედებები იმ კოლექციებზე ან რეჟიმებზე, რომლებიც ცვლადების JSON-ში არ არის, გამოტოვებულია" +"shape generated outline is missing or damaged; using its rectangle" = "ფიგურის გენერირებული კონტური აკლია ან დაზიანებულია; გამოიყენება მისი მართკუთხედი" "slot content assignment target is missing or is not slot content" = "სლოტის შიგთავსის მინიჭების სამიზნე აკლია ან სლოტის შიგთავსი არ არის" "slot content assignment uses the empty GUID sentinel and was skipped" = "სლოტის შიგთავსის მინიჭება ცარიელ GUID მარკერს იყენებს და გამოტოვებულია" "slot layers without a matching slot property were imported as frames" = "სლოტის შრეები, რომლებსაც შესაბამისი სლოტის თვისება არ აქვს, ჩარჩოებად იმპორტირდა" @@ -1834,10 +1875,13 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "variable modes of collections that aren't in the file were skipped" = "იმ კოლექციების ცვლადის რეჟიმები, რომლებიც ფაილში არ არის, გამოტოვებულია" "variable modes of collections that aren't in the variables JSON were skipped" = "იმ კოლექციების ცვლადის რეჟიმები, რომლებიც ცვლადების JSON-ში არ არის, გამოტოვებულია" "variable values that don't match their type (or composed colours) were skipped" = "ცვლადის მნიშვნელობები, რომლებიც თავიანთ ტიპს არ შეესაბამება (ან შედგენილი ფერები), გამოტოვებულია" +"variable-bound vector region paints keep resolved appearance; live bindings were left out" = "ცვლადებზე მიბმული ვექტორული არის საღებავები გამოთვლილ იერსახეს ინარჩუნებს; ცოცხალი მიბმები არ გადმოვიდა" "variables of unknown types were skipped" = "უცნობი ტიპის ცვლადები გამოტოვებულია" "variables whose collection isn't in the variables JSON were skipped" = "ცვლადები, რომელთა კოლექცია ცვლადების JSON-ში არ არის, გამოტოვებულია" "variables without readable values were skipped" = "წაკითხვადი მნიშვნელობების გარეშე ცვლადები გამოტოვებულია" "vector points with unknown stroke joins use the layer join" = "უცნობი კონტურის შეერთების მქონე ვექტორული წერტილები შრის შეერთებას იყენებს" +"vector region paint data exceeded import limits and was skipped" = "ვექტორული არის საღებავის მონაცემებმა იმპორტის ლიმიტებს გადააჭარბა და გამოტოვებულია" +"vector region references a missing fill style; layer fill used" = "ვექტორული არე მიუთითებს შევსების არარსებულ სტილზე; გამოყენებულია შრის შევსება" "vectors without geometry are empty" = "გეომეტრიის გარეშე ვექტორები ცარიელია" "vectors without geometry are empty (export the file JSON with geometry=paths)" = "გეომეტრიის გარეშე ვექტორები ცარიელია (ფაილის JSON-ის ექსპორტი გააკეთეთ geometry=paths პარამეტრით)" "very long text was cut to 1,048,576 characters" = "ძალიან გრძელი ტექსტი 1 048 576 სიმბოლომდე შემოკლდა" @@ -1845,6 +1889,8 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "video actions are not supported and were skipped" = "ვიდეოს მოქმედებები მხარდაუჭერელია და გამოტოვებულია" "video triggers are not supported and were skipped" = "ვიდეოს გამშვებები მხარდაუჭერელია და გამოტოვებულია" "yesterday" = "გუშინ" +"{count} in it now · Changed {date}" = "ახლა მასშია: {count} · შეცვლილია: {date}" +"{insertions} · {detachments}" = "{insertions} · {detachments}" "{instances} in {files}" = "{instances} — {files}" "{language}: draft translation, waiting for a native speaker's review." = "{language}: თარგმანის მონახაზი, ელოდება მშობლიური ენის მცოდნის განხილვას." "{length} bleed" = "ჭრისპირა არე: {length}" @@ -1853,7 +1899,6 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "{name} is forgotten on this computer; the file stays on {server}" = "{name} დავიწყებულია ამ კომპიუტერზე; ფაილი {server}-ზე რჩება" "{name} is on the server." = "{name} სერვერზეა." "{name} is spotlighting" = "ყურადღება {name}-ზეა" -"{name}, disconnected from its live session" = "{name}, ცოცხალ სესიასთან კავშირი გაწყვეტილია" "{name}\nClick to apply to the selection" = "{name}\nდაწკაპეთ მონიშნულზე გამოსაყენებლად" "{name}\nDrag onto the canvas, or click to place in the middle of the view.\nHold Alt (Option) while dropping onto an instance to swap it." = "{name}\nგადაათრიეთ ტილოზე ან დაწკაპეთ ხედის შუაში განსათავსებლად.\nინსტანსის ჩასანაცვლებლად მასზე ჩაგდებისას დააჭირეთ Alt-ს (Option)." "{name} (from {library})" = "{name} ({library}-იდან)" @@ -1881,8 +1926,10 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "{n} components and styles have newer versions" = { one = "ახალი ვერსია აქვს კომპონენტს ან სტილს: {n}", other = "ახალი ვერსია აქვს კომპონენტს ან სტილს: {n}" } "{n} conflicts to resolve" = { one = "გადასაწყვეტი კონფლიქტი: {n}", other = "გადასაწყვეტი კონფლიქტი: {n}" } "{n} days ago" = { one = "{n} დღის წინ", other = "{n} დღის წინ" } +"{n} detached" = { one = "გამოყოფილი: {n}", other = "გამოყოფილი: {n}" } "{n} files" = { one = "ფაილი: {n}", other = "ფაილი: {n}" } "{n} hours ago" = { one = "{n} საათის წინ", other = "{n} საათის წინ" } +"{n} inserted" = { one = "ჩასმული: {n}", other = "ჩასმული: {n}" } "{n} instances" = { one = "ინსტანსი: {n}", other = "ინსტანსი: {n}" } "{n} layers" = { one = "შრე: {n}", other = "შრე: {n}" } "{n} layers as one file" = { one = "შრე: {n}, ერთ ფაილად", other = "შრე: {n}, ერთ ფაილად" } @@ -1913,12 +1960,15 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "{n}w" = "{n} კვ" "{page}, nothing selected" = "{page}, არაფერია მონიშნული" "{percent}%" = "{percent}%" +"{period}: {counts}" = "{period}: {counts}" "{profile} (current)" = "{profile} (მიმდინარე)" "{property} is its value; {property ? \"a\" : \"b\"} picks a string. Other {…} stays as written." = "{property} მისი მნიშვნელობაა; {property ? \"a\" : \"b\"} ირჩევს სტრიქონს. ნებისმიერი სხვა {…} რჩება დაწერილი სახით." "{server} can't say what became of your files (it is older than this app)." = "{server} ვერ გეტყვით, რა მოუვიდა თქვენს ფაილებს (ის ამ აპზე ძველია)." "{server} · No longer on the server" = "{server} · სერვერზე აღარ არის" "{server} · {shared} · Opened {date}" = "{server} · {shared} · გაიხსნა {date}" "{tool} hold {key}" = "{tool} დააჭირეთ {key}" +"{used} · {detached}" = "{used} · {detached}" +"{used} · {inserted}" = "{used} · {inserted}" "{value} isn't a colour" = "{value} ფერი არ არის" "{when} · edited" = "{when} · რედაქტირებულია" "← ↑ → ↓" = "← ↑ → ↓" @@ -1926,23 +1976,32 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "←" = "←" "→, Space or N" = "→, Space ან N" "↵" = "↵" -"↵ / ⇧↵" = "↵ / ⇧↵" "⇥ / ⇧⇥" = "⇥ / ⇧⇥" -"⇥ or ⌥ Space again" = "⇥ ან ხელახლა ⌥ Space" "⌘ arrows" = "⌘ ისრები" "⌘ click" = "⌘ დაწკაპუნება" -"⌘ click a padding field" = "⌘ დაწკაპუნება შიდა დაშორების ველზე" "⌘ scroll" = "⌘ გადახვევა" -"⌥ double-click an edge of an auto layout child" = "⌥ ორმაგი დაწკაპუნება ავტოგანლაგების შვილობილი ელემენტის კიდეზე" "⌥ drag" = "⌥ გადათრევა" +"Selection box: switch to pick select" = "მონიშვნის ჩარჩო: შრის არჩევაზე გადართვა" +"Pick select: next or previous layer" = "შრის არჩევა: შემდეგი ან წინა შრე" +"Pick select: into a layer, out to its parent" = "შრის არჩევა: შრეში შესვლა, მშობელზე გასვლა" +"Pick select: select the picked layer" = "შრის არჩევა: არჩეული შრის მონიშვნა" +"⇥ or ⌥ Space again" = "⇥ ან ხელახლა ⌥ Space" +"Tab or Ctrl+Space again" = "Tab ან ხელახლა Ctrl+Space" +"↵ / ⇧↵" = "↵ / ⇧↵" +"Enter / Shift+Enter" = "Enter / Shift+Enter" +"Space" = "Space" +"Nothing to pick: the page is empty" = "ასარჩევი არაფერია: გვერდი ცარიელია" +"Pick select: Tab and Shift+Tab move between layers, Enter goes into one, Shift+Enter out, Space selects, Escape cancels" = "შრის არჩევა: Tab და Shift+Tab შრეებს შორის გადაადგილდება, Enter შრეში შედის, Shift+Enter გამოდის, Space მონიშნავს, Escape გააუქმებს" "Android Vector Drawable" = "Android Vector Drawable" "Best effort" = "მაქსიმალური მიახლოება" "Check for Updates" = "განახლებების შემოწმება" "Check for updates…" = "განახლებების შემოწმება…" "Compatibility" = "თავსებადობა" "Dart constants for Flutter…" = "Dart-ის კონსტანტები Flutter-ისთვის…" +"Calculated from other variables; it follows them" = "გამოითვლება სხვა ცვლადებიდან და მათ მიჰყვება" "Copy effect" = "ეფექტის კოპირება" "Copy fill" = "შევსების კოპირება" +"Copy for AI" = "კოპირება AI-სთვის" "Copy stroke" = "კონტურის კოპირება" "Couldn't download {name}" = "{name} ვერ ჩამოიტვირთა" "Don't show this again" = "აღარ აჩვენო" @@ -1959,70 +2018,11 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Set corner smoothing to 60%" = "კუთხეების დარბილების 60%-ზე დაყენება" "Text on a path" = "ტექსტი ტრაექტორიაზე" "This link opens a website outside the prototype:" = "ეს ბმული პროტოტიპის გარეთ ვებსაიტს ხსნის:" +"This link opens your mail app to write a message:" = "ეს ბმული წერილის დასაწერად თქვენს საფოსტო აპს ხსნის:" +"This server doesn't count detached instances" = "ეს სერვერი გამოყოფილ ინსტანსებს არ ითვლის" "Update check is not supported in the web browser." = "ვებბრაუზერში განახლებების შემოწმება მხარდაჭერილი არ არის." "instance swap properties whose default component was past the layer limit were skipped" = "ინსტანსის ჩანაცვლების თვისებები, რომელთა ნაგულისხმევი კომპონენტი შრეების ზღვარს მიღმა იყო, გამოტოვებულია" "instances whose component was past the layer limit were imported as frames" = "ინსტანსები, რომელთა კომპონენტი შრეების ზღვარს მიღმა იყო, ჩარჩოებად იმპორტირდა" -"1 year" = "1 წელი" -"30 days" = "30 დღე" -"90 days" = "90 დღე" -"Allow and download" = "დაშვება და ჩამოტვირთვა" -"Allow downloading fonts?" = "დაიშვას შრიფტების ჩამოტვირთვა?" -"Board grid" = "დაფის ბადე" -"Changed {date}" = "შეცვლილია: {date}" -"Copy browser link" = "ბრაუზერის ბმულის კოპირება" -"Couldn't reach {server} for its team list." = "{server}-იდან გუნდის სიის მიღება ვერ მოხერხდა." -"Calculated from other variables; it follows them" = "გამოითვლება სხვა ცვლადებიდან და მათ მიჰყვება" -"Crop image" = "გამოსახულების ჩამოჭრა" -"Detach calculation" = "გამოთვლის გამოყოფა" -"Download" = "ჩამოტვირთვა" -"Downloading… {percent}%" = "ჩამოტვირთვა… {percent}%" -"Drop to use this image" = "ჩააგდეთ ამ გამოსახულების გამოსაყენებლად" -"Everyone who reaches this server can open these files while they are shared." = "ამ სერვერთან წვდომის მქონე ყველას შეუძლია ამ ფაილების გახსნა, სანამ ისინი გაზიარებულია." -"FigCraft stopped because of an internal error." = "FigCraft-ის მუშაობა შიდა შეცდომის გამო შეწყდა." -"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." = "უფასო შრიფტები Google Fonts-იდან და Noto-დან მოდის, jsDelivr-ისა და GitHub-ის გავლით. თითოეული ფაილი შრიფტების ინდექსთან მოწმდება, სანამ Craft-აპების საერთო შრიფტების საქაღალდეში დაინსტალირდება. სანამ არ დაუშვებთ, არაფერი ჩამოიტვირთება." -"Graph paper" = "მილიმეტრიანი ქაღალდი" -"Joining live session…" = "ცოცხალ სესიასთან შეერთება…" -"Link copied: it opens the file in FigCraft" = "ბმული დაკოპირდა: ის ფაილს FigCraft-ში ხსნის" -"Link copied: it opens the file in the browser" = "ბმული დაკოპირდა: ის ფაილს ბრაუზერში ხსნის" -"Nobody shares a file there now." = "იქ ახლა არავინ აზიარებს ფაილს." -"Past 30 days" = "ბოლო 30 დღე" -"Past 90 days" = "ბოლო 90 დღე" -"Past year" = "ბოლო წელი" -"Shared by your team on {server}" = "თქვენი გუნდის მიერ {server}-ზე გაზიარებული" -"Not now" = "ახლა არა" -"Nothing counted yet" = "ჯერ არაფერი დათვლილა" -"Reload the page to get back the unsaved files the browser had room for." = "განაახლეთ გვერდი, რომ დაიბრუნოთ ის შეუნახავი ფაილები, რომლებიც ბრაუზერში დაეტია." -"Reload the page to get your unsaved files back." = "განაახლეთ გვერდი, რომ შეუნახავი ფაილები დაიბრუნოთ." -"Reload the page to start again." = "თავიდან დასაწყებად განაახლეთ გვერდი." -"Reset grid" = "ბადის ჩამოყრა" -"This server doesn't count insertions" = "ეს სერვერი ჩასმებს არ ითვლის" -"This server doesn't count styles and variables" = "ეს სერვერი სტილებსა და ცვლადებს არ ითვლის" -"Upload from computer" = "კომპიუტერიდან ატვირთვა" -"Strong line every" = "მუქი ხაზის ბიჯი" -"This link opens your mail app to write a message:" = "ეს ბმული წერილის დასაწერად თქვენს საფოსტო აპს ხსნის:" -"This server doesn't count detached instances" = "ეს სერვერი გამოყოფილ ინსტანსებს არ ითვლის" -"Your unsaved files were too large for the browser to keep." = "თქვენი შეუნახავი ფაილები ბრაუზერისთვის შესანახად ზედმეტად დიდი იყო." -"connector labels without a saved snapshot are centred on the line, without their background" = "შენახული სნეპშოტის გარეშე შემაერთებლის იარლიყები ხაზზე ცენტრდება, ფონის გარეშე" -"elbowed and curved connectors without a saved path follow FigCraft's own routing" = "შენახული ტრაექტორიის გარეშე კუთხოვანი და მრუდი შემაერთებლები FigCraft-ის საკუთარ მარშრუტს მიჰყვება" -"invalid vector region fill paint list; layer fill used" = "ვექტორული არის შევსების საღებავების სია არასწორია; გამოყენებულია შრის შევსება" -"invalid vector region paints were skipped" = "ვექტორული არის არასწორი საღებავები გამოტოვებულია" -"linked vector region fill styles keep resolved appearance; live style links were left out" = "ვექტორული არის მიბმული შევსების სტილები გამოთვლილ იერსახეს ინარჩუნებს; სტილების ცოცხალი კავშირები არ გადმოვიდა" -"note or shape generated child has invalid bounds; child skipped" = "შენიშვნის ან ფიგურის გენერირებულ შვილობილ ელემენტს არასწორი საზღვრები აქვს; ელემენტი გამოტოვებულია" -"note or shape generated child is missing its style or bounds; child skipped" = "შენიშვნის ან ფიგურის გენერირებულ შვილობილ ელემენტს სტილი ან საზღვრები აკლია; ელემენტი გამოტოვებულია" -"note or shape generated children exceed the layer or nesting limit; remaining children skipped" = "შენიშვნის ან ფიგურის გენერირებული შვილობილი ელემენტები შრეების ან ჩადგმის ლიმიტს აჭარბებს; დანარჩენი ელემენტები გამოტოვებულია" -"note or shape generated layout is missing or unsupported; using its outer frame" = "შენიშვნის ან ფიგურის გენერირებული განლაგება აკლია ან მხარდაუჭერელია; გამოიყენება მისი გარე ჩარჩო" -"shape generated outline is missing or damaged; using its rectangle" = "ფიგურის გენერირებული კონტური აკლია ან დაზიანებულია; გამოიყენება მისი მართკუთხედი" -"variable-bound vector region paints keep resolved appearance; live bindings were left out" = "ცვლადებზე მიბმული ვექტორული არის საღებავები გამოთვლილ იერსახეს ინარჩუნებს; ცოცხალი მიბმები არ გადმოვიდა" -"vector region paint data exceeded import limits and was skipped" = "ვექტორული არის საღებავის მონაცემებმა იმპორტის ლიმიტებს გადააჭარბა და გამოტოვებულია" -"vector region references a missing fill style; layer fill used" = "ვექტორული არე მიუთითებს შევსების არარსებულ სტილზე; გამოყენებულია შრის შევსება" -"{count} in it now · Changed {date}" = "ახლა მასშია: {count} · შეცვლილია: {date}" -"{insertions} · {detachments}" = "{insertions} · {detachments}" -"{period}: {counts}" = "{period}: {counts}" -"{used} · {detached}" = "{used} · {detached}" -"{used} · {inserted}" = "{used} · {inserted}" -"{n} detached" = { one = "გამოყოფილი: {n}", other = "გამოყოფილი: {n}" } -"{n} inserted" = { one = "ჩასმული: {n}", other = "ჩასმული: {n}" } -"⌥⌘ ← ↑ → ↓" = "⌥⌘ ← ↑ → ↓" [commands] "align.bottom" = "ქვემოთ სწორება" @@ -2053,10 +2053,12 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "arrange.tidy" = "მოწესრიგება" "board.addConnected" = "დაკავშირებული ფიგურის დამატება" "board.connector" = "შემაერთებელი" +"board.grid" = "დაფის ბადე" "board.ink" = "მარკერის შტრიხი" "board.label" = "შემაერთებლის წარწერა" "board.nextSticky" = "შემდეგი სტიკერი" "board.reattach" = "შემაერთებლის ხელახლა მიმაგრება" +"board.reshape" = "შემაერთებლის ფორმის შეცვლა" "board.setColor" = "დაფის ფერი" "board.setStyle" = "დაფის სტილი" "board.shape" = "ფიგურა ტექსტით" @@ -2218,6 +2220,8 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "fill.pattern" = "პატერნით შევსება" "fill.remove" = "შევსების წაშლა" "fill.set" = "შევსების დაყენება" +"font.download" = "შრიფტის ჩამოტვირთვა" +"font.downloads" = "შრიფტების ჩამოტვირთვები" "frame.create" = "ჩარჩოს შექმნა" "frame.presets" = "ჩარჩოს პრესეტების სია" "frame.swapOrientation" = "ორიენტაციის შეცვლა" @@ -2234,9 +2238,11 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "help.page" = "დახმარების გვერდი" "help.shortcuts" = "კლავიატურის მალსახმობები" "image.adjust" = "გამოსახულების კორექცია" +"image.crop" = "გამოსახულების ჩამოჭრა" "image.deletePreset" = "გამოსახულების პრესეტის წაშლა" "image.place" = "გამოსახულების განთავსება" "image.presets" = "გამოსახულების პრესეტები" +"image.replace" = "გამოსახულების ჩანაცვლება" "image.savePreset" = "გამოსახულების პრესეტის შენახვა" "inspect.assets" = "რესურსების ინსპექტირება" "inspect.code" = "შრის კოდი" @@ -2263,6 +2269,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "library.aliasVariable" = "ბიბლიოთეკის ცვლადის ალიასი" "library.applyStyle" = "ბიბლიოთეკის სტილის გამოყენება" "library.bindVariable" = "ბიბლიოთეკის ცვლადის მიბმა" +"library.check" = "გუნდის ბიბლიოთეკების განახლებების შემოწმება" "library.extendCollection" = "ბიბლიოთეკის კოლექციის გაფართოება" "library.import" = "ბიბლიოთეკის კომპონენტის იმპორტი" "library.importVariable" = "ბიბლიოთეკის ცვლადის იმპორტი" @@ -2524,6 +2531,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "variable.deleteCollection" = "კოლექციის წაშლა" "variable.duplicate" = "ცვლადის დუბლირება" "variable.export" = "ცვლადების ექსპორტირება" +"variable.extendCollection" = "კოლექციის გაფართოება" "variable.import" = "ცვლადების იმპორტი" "variable.list" = "ცვლადების სია" "variable.moveMode" = "რეჟიმის გადატანა" @@ -2633,6 +2641,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "view.zoomOut" = "დაპატარავება" "view.zoomSelection" = "მონიშნულის მასშტაბირება" "widget.click" = "ვიჯეტზე დაწკაპუნება" +"widget.hover" = "ვიჯეტზე მაჩვენებლის მიტანა" "widget.insert" = "ვიჯეტის ჩასმა" "widget.list" = "ვიჯეტების სია" "widget.menu" = "ვიჯეტის მენიუ" @@ -2650,15 +2659,6 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "file.markSaved" = "შენახულად მარკირება" "text.fit" = "ტექსტის ჩატევა თავის საზღვრებში" "data.fill" = "ასლების მონაცემებით შევსება" -"board.grid" = "დაფის ბადე" -"font.download" = "შრიფტის ჩამოტვირთვა" -"font.downloads" = "შრიფტების ჩამოტვირთვები" -"image.crop" = "გამოსახულების ჩამოჭრა" -"library.check" = "გუნდის ბიბლიოთეკების განახლებების შემოწმება" -"board.reshape" = "შემაერთებლის ფორმის შეცვლა" -"image.replace" = "გამოსახულების ჩანაცვლება" -"variable.extendCollection" = "კოლექციის გაფართოება" -"widget.hover" = "ვიჯეტზე მაჩვენებლის მიტანა" [menu] "bool.exclude" = "გამორიცხვა" From 92cf9849027aff7dc4a2aee82ecdc1bd1d7a0cd1 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 17:38:13 -0500 Subject: [PATCH 057/239] Selection: Escape tests for a top-level layer, several layers and the focused frame (#2107 review) One Escape selects nothing for a top-level frame, a top-level layer, two layers in one group, layers in different parents, and a nested layer with a top-level one. With the focused frame itself selected, one Escape leaves the focus view. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/engine/src/devfocus_tests.rs | 6 ++++++ crates/engine/src/selection_behaviour_tests.rs | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/crates/engine/src/devfocus_tests.rs b/crates/engine/src/devfocus_tests.rs index f36af7ee6..b7a4f9341 100644 --- a/crates/engine/src/devfocus_tests.rs +++ b/crates/engine/src/devfocus_tests.rs @@ -92,6 +92,12 @@ fn only_the_focused_frame_is_hit_and_escape_leaves() { assert_eq!(focused(&s), None, "Escape with nothing selected leaves"); click(&mut s, 350.0, 100.0); assert_eq!(s.selection(), vec![b], "everything is hit again"); + // With the focused frame itself selected, one Escape leaves the focus view. + ex(&mut s, "dev.focus", json!({"id": a})); + ex(&mut s, "select.set", json!({"ids": [a]})); + assert_eq!(focused(&s), Some(a)); + s.escape().unwrap(); + assert_eq!(focused(&s), None, "Escape with the focused frame selected leaves at once"); } #[test] diff --git a/crates/engine/src/selection_behaviour_tests.rs b/crates/engine/src/selection_behaviour_tests.rs index b3289c6c3..6498b8cb5 100644 --- a/crates/engine/src/selection_behaviour_tests.rs +++ b/crates/engine/src/selection_behaviour_tests.rs @@ -277,6 +277,20 @@ fn keyboard_selection() { assert_eq!(s.selection(), Vec::::new(), "Esc from a nested layer selects nothing, not the parent"); s.escape().unwrap(); assert_eq!(s.selection(), Vec::::new()); + // A top-level layer, and several layers, nested or not: one Esc selects nothing. + let cases: Vec<(Vec, &str)> = vec![ + (vec![k.f], "a top-level frame"), + (vec![k.r], "a top-level layer"), + (vec![k.a, k.b], "two layers in one group (not their group)"), + (vec![k.a, k.d], "layers in different parents (not the parents)"), + (vec![k.a, k.r], "a nested layer and a top-level one"), + ]; + for (ids, why) in cases { + ex(&mut s, "select.set", json!({"ids": ids})); + assert_eq!(sorted(s.selection()), sorted(ids.clone()), "{why}: selected"); + s.escape().unwrap(); + assert_eq!(s.selection(), Vec::::new(), "Esc on {why} selects nothing"); + } } #[test] From fceb606314c4cecd01dd8bf35efb424c43715d79 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sun, 8 Nov 2026 23:55:45 -0500 Subject: [PATCH 058/239] M8: Zoom to selection leaves Figma's 40 pt margin and clears the bottom toolbar Zoom to selection (Shift+2) fits the selection into the canvas above the floating bottom toolbar with a 40 pt margin on all sides, centred in that area (measured in Figma's web app, 2026-11-09). ViewState gains an unsaved bottom_inset, set by the UI each frame from the toolbar pill and by view.set bottomInset. Zoom to fit is unchanged. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 measured and wrote at medium --- crates/engine/src/cmd/view.rs | 39 +++++++++++------- crates/engine/src/view_behaviour_tests.rs | 50 ++++++++++++++++++++++- crates/engine/src/view_state.rs | 23 +++++++++++ crates/ui-egui/src/app.rs | 6 +++ crates/ui-egui/src/shortcuts_tests.rs | 5 ++- docs/ui-parity.md | 5 ++- 6 files changed, 108 insertions(+), 20 deletions(-) diff --git a/crates/engine/src/cmd/view.rs b/crates/engine/src/cmd/view.rs index c33878066..d620e9129 100644 --- a/crates/engine/src/cmd/view.rs +++ b/crates/engine/src/cmd/view.rs @@ -259,25 +259,34 @@ pub fn specs() -> Vec { spec!("view.zoomSelection", "Zoom to selection", "{}", false, |s, _| { let ds = s.ds_mut()?; if let Some(b) = ds.doc.bounds_of(&ds.selection) { - ds.view.fit(b, 256.0); + ds.view.fit_selection(b, 256.0); } Ok(json!({"zoom": ds.view.zoom})) }), - spec!("view.set", "Set view", "{zoom?, cx?, cy? (page coordinate at the centre), vw?, vh? (viewport size)}", false, |s, p| { - let v = view(s)?; - if let Some(z) = num(p, "zoom") { - v.zoom = z.clamp(ViewState::MIN_ZOOM, ViewState::MAX_ZOOM); + spec!( + "view.set", + "Set view", + "{zoom?, cx?, cy? (page coordinate at the centre), vw?, vh? (viewport size), bottomInset? (height of the strip the bottom toolbar covers)}", + false, + |s, p| { + let v = view(s)?; + if let Some(z) = num(p, "zoom") { + v.zoom = z.clamp(ViewState::MIN_ZOOM, ViewState::MAX_ZOOM); + } + v.cx = num_or(p, "cx", v.cx); + v.cy = num_or(p, "cy", v.cy); + if let Some(w) = num(p, "vw") { + v.vw = w.clamp(10.0, 20000.0); + } + if let Some(h) = num(p, "vh") { + v.vh = h.clamp(10.0, 20000.0); + } + if let Some(i) = num(p, "bottomInset") { + v.bottom_inset = i.clamp(0.0, 20000.0); + } + Ok(serde_json::to_value(&*v).unwrap_or(Value::Null)) } - v.cx = num_or(p, "cx", v.cx); - v.cy = num_or(p, "cy", v.cy); - if let Some(w) = num(p, "vw") { - v.vw = w.clamp(10.0, 20000.0); - } - if let Some(h) = num(p, "vh") { - v.vh = h.clamp(10.0, 20000.0); - } - Ok(serde_json::to_value(&*v).unwrap_or(Value::Null)) - }), + ), spec!( "view.zoomAt", "Zoom tool", diff --git a/crates/engine/src/view_behaviour_tests.rs b/crates/engine/src/view_behaviour_tests.rs index 7f9e5a844..974c9f44f 100644 --- a/crates/engine/src/view_behaviour_tests.rs +++ b/crates/engine/src/view_behaviour_tests.rs @@ -131,7 +131,7 @@ fn zoom_to_fit_selection_and_frames() { // (command, selection before, zoom, centre, selection after, derivation) let rows: Vec<(&str, Vec, f64, (f64, f64), Vec, &str)> = vec![ ("view.zoomFit", vec![], fit(content), (470.0, 300.0), vec![], "Shift+1 fits everything on the page into the view"), - ("view.zoomSelection", vec![r], fit(Rect::new(0.0, 0.0, 40.0, 40.0)), (920.0, 20.0), vec![r], "Shift+2 zooms to the selection"), + ("view.zoomSelection", vec![r], (800.0 - 80.0) / 40.0, (920.0, 20.0), vec![r], "Shift+2 zooms to the selection, with a 40-point margin"), ( "view.nextFrame", vec![], @@ -225,7 +225,7 @@ fn view_shortcuts_follow_the_documented_keys() { (Platform::Other, "-", m(true, false, false, false), "view.zoomOut", "Shift and - zooms out"), (Platform::Mac, "0", m(true, false, false, false), "view.zoom100", "Shift+0 zooms to 100%"), (Platform::Other, "1", m(true, false, false, false), "view.zoomFit", "Shift+1 zooms to fit"), - (Platform::Mac, "2", m(true, false, false, false), "view.zoomSelection", "Shift+2 zooms to the selection"), + (Platform::Mac, "2", m(true, false, false, false), "view.zoomSelection", "Shift+2 zooms to the selection, with a 40-point margin"), (Platform::Mac, "N", m(false, false, false, false), "view.nextFrame", "N zooms to the next frame"), (Platform::Other, "N", m(true, false, false, false), "view.prevFrame", "Shift+N zooms to the previous frame"), (Platform::Mac, "R", m(true, false, false, false), "view.rulers", "Shift+R shows and hides the rulers"), @@ -771,3 +771,49 @@ fn view_toggles_are_kept_for_the_next_launch() { } assert!(!view.outlines && !view.outlines_selection && !view.proof_srgb, "{view:?}"); } + +/// Select a fresh rectangle at the origin, set the view and run `cmd`; the rect's screen box is +/// returned as (left, top, right, bottom). +fn zoom_on(cmd: &str, inset: f64, w: f64, h: f64) -> (ViewState, (f64, f64, f64, f64)) { + let mut s = Session::new(); + let r = rect(&mut s, 0.0, 0.0, w, h, None); + ex(&mut s, "view.set", json!({"vw": 1389, "vh": 903, "bottomInset": inset})); + ex(&mut s, "select.set", json!({"ids": [r]})); + ex(&mut s, cmd, json!({})); + let v = view(&s); + let (l, t) = v.page_to_screen(0.0, 0.0); + let (rr, b) = v.page_to_screen(w, h); + (v, (l, t, rr, b)) +} + +#[test] +fn zoom_to_selection_leaves_forty_points_and_clears_the_toolbar() { + // Measured in Figma's web app, 2026-11-09: 40 points on every side of the canvas above the toolbar. + let (v, (l, t, r, b)) = zoom_on("view.zoomSelection", 58.0, 100.0, 100.0); + assert!((v.zoom - 7.65).abs() < 0.01, "{}", v.zoom); + assert!((t - 40.0).abs() < 0.5 && (b - (845.0 - 40.0)).abs() < 0.5, "top {t}, bottom {b}"); + assert!((l - (1389.0 - r)).abs() < 0.5, "left {l}, right {r}"); +} + +#[test] +fn zoom_to_selection_on_a_wide_layer_is_limited_by_the_width() { + let (v, (l, _, r, _)) = zoom_on("view.zoomSelection", 58.0, 1000.0, 200.0); + assert!((v.zoom - (1389.0 - 80.0) / 1000.0).abs() < 0.001, "{}", v.zoom); + assert!((l - 40.0).abs() < 0.5 && ((1389.0 - r) - 40.0).abs() < 0.5, "left {l}, right {r}"); +} + +#[test] +fn zoom_to_selection_without_a_toolbar_inset_uses_the_whole_height() { + let (v, _) = zoom_on("view.zoomSelection", 0.0, 100.0, 100.0); + assert!((v.zoom - (903.0 - 80.0) / 100.0).abs() < 1e-6, "{}", v.zoom); +} + +#[test] +fn zoom_to_fit_is_unchanged() { + // Left alone on purpose: its 64-point margin is not measured against Figma yet. + let mut s = Session::new(); + rect(&mut s, 0.0, 0.0, 100.0, 100.0, None); + ex(&mut s, "view.set", json!({"vw": 1389, "vh": 903, "bottomInset": 58})); + ex(&mut s, "view.zoomFit", json!({})); + assert!((view(&s).zoom - (903.0 - 128.0) / 100.0).abs() < 1e-6); +} diff --git a/crates/engine/src/view_state.rs b/crates/engine/src/view_state.rs index fd70b4b11..bfbb36f66 100644 --- a/crates/engine/src/view_state.rs +++ b/crates/engine/src/view_state.rs @@ -12,6 +12,10 @@ pub struct ViewState { /// Viewport size in logical pixels (set by the UI; used by zoom-to-fit). pub vw: f64, pub vh: f64, + /// Height in screen points of the strip the floating bottom toolbar covers (from its top edge to + /// the canvas's bottom edge); set by the UI every frame, 0 when it's hidden. Never saved. + #[serde(skip)] + pub bottom_inset: f64, pub pixel_grid: bool, pub layout_grids: bool, pub rulers: bool, @@ -51,6 +55,7 @@ impl Default for ViewState { zoom: 1.0, vw: 1200.0, vh: 800.0, + bottom_inset: 0.0, pixel_grid: true, layout_grids: true, rulers: false, @@ -105,6 +110,24 @@ impl ViewState { self.cx = r.center().x; self.cy = r.center().y; } + /// Fit a page rectangle for Zoom to selection: a 40 point margin on all four sides of the area + /// above the bottom toolbar (`vw` by `vh - bottom_inset`), centred in that area. + pub fn fit_selection(&mut self, r: figcraft_geom::Rect, max_zoom: f64) { + if !(r.width() > 0.0 || r.height() > 0.0) || !r.x0.is_finite() { + self.cx = r.center().x; + self.cy = r.center().y; + return; + } + let margin = 40.0; + let inset = if self.bottom_inset.is_finite() { self.bottom_inset.clamp(0.0, (self.vh - 100.0).max(0.0)) } else { 0.0 }; + let area_h = self.vh - inset; + let zx = (self.vw - margin * 2.0).max(50.0) / r.width().max(1e-6); + let zy = (area_h - margin * 2.0).max(50.0) / r.height().max(1e-6); + self.zoom = zx.min(zy).clamp(Self::MIN_ZOOM, max_zoom); + // The rect's centre lands at screen y = area_h / 2, the page centre `(vh - area_h) / 2` below it. + self.cx = r.center().x; + self.cy = r.center().y + (self.vh - area_h) / 2.0 / self.zoom; + } /// The zoom from which the pixel grid shows (400%). pub const PIXEL_GRID_ZOOM: f64 = 4.0; /// Whether the pixel grid draws: it's on and the canvas is zoomed in to 400% or more. diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 1290f4d5b..f2e85e194 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -371,6 +371,12 @@ impl FigApp { let worker = self.worker.take(); let mut worker = worker.unwrap_or_else(|| render_worker::Worker::new(ctx.clone())); canvas::show(self, ui, &mut worker); + // The strip the floating bottom toolbar covers, for Zoom to selection (0 when it's hidden). + let inset = + if !hidden && mobile.is_none() { f64::from(self.canvas.rect.max.y - toolbar::pill_rect(self.canvas.rect, 0.0).min.y) } else { 0.0 }; + if let Ok(ds) = self.session.ds_mut() { + ds.view.bottom_inset = inset; + } self.worker = Some(worker); if !hidden && mobile.is_none() { ui.scope_builder(egui::UiBuilder::new().id_salt("toolbar"), |ui| { diff --git a/crates/ui-egui/src/shortcuts_tests.rs b/crates/ui-egui/src/shortcuts_tests.rs index 4b223b211..e9c822c2b 100644 --- a/crates/ui-egui/src/shortcuts_tests.rs +++ b/crates/ui-egui/src/shortcuts_tests.rs @@ -90,7 +90,10 @@ fn shift_digits_zoom() { press(&mut u, Key::Num2, Modifiers::SHIFT); assert!(zoom(&u) > fit, "Shift+2 fits the smaller selection"); let v = &u.app.session.ds().unwrap().view; - assert_eq!((v.cx, v.cy), (110.0, 40.0), "centred on it"); + // Centred in the canvas above the bottom toolbar: the page centre sits half the toolbar's strip lower. + let expect_cy = 40.0 + v.bottom_inset / 2.0 / v.zoom; + assert_eq!(v.cx, 110.0, "centred on it"); + assert!((v.cy - expect_cy).abs() < 1e-9, "centred above the toolbar: {} vs {expect_cy}", v.cy); // `+` and `-` step the zoom. let z = zoom(&u); press(&mut u, Key::Minus, Modifiers::NONE); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index aa0ef25bd..0674a3359 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** patch (Zoom to selection leaves a 40 pt margin and clears the bottom toolbar, measured in Figma's web app; the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -109,7 +109,7 @@ interaction feel not yet compared. | Item | Status | Notes | |---|---|---| -| Pan/zoom: wheel, pinch, Space-drag, Shift+0/1/2, Cmd+0, `+`/`-` | done | Shift-wheel pans sideways, pinch and the zoom tool keep the point under the pointer; Preferences ▸ Scroll wheel zoom makes a mouse wheel zoom about the pointer and Cmd/Ctrl+wheel scroll (a wheel told from a trackpad by the device macOS reports, elsewhere by line versus pixel steps; #1390); zoom steps, limits (2%–25,600%) and frame order pinned where the documentation is silent (`view_behaviour_tests`) | +| Pan/zoom: wheel, pinch, Space-drag, Shift+0/1/2, Cmd+0, `+`/`-` | done | Shift-wheel pans sideways, pinch and the zoom tool keep the point under the pointer; Preferences ▸ Scroll wheel zoom makes a mouse wheel zoom about the pointer and Cmd/Ctrl+wheel scroll (a wheel told from a trackpad by the device macOS reports, elsewhere by line versus pixel steps; #1390); zoom steps, limits (2%–25,600%) and frame order pinned where the documentation is silent (`view_behaviour_tests`); Zoom to selection (Shift+2) fits the selection into the canvas above the floating bottom toolbar with a 40 pt margin on all four sides, centred in that area, at a continuous zoom (measured in Figma's web app, 2026-11-09; `zoom_to_selection_leaves_forty_points_and_clears_the_toolbar`, `zoom_to_selection_on_a_wide_layer_is_limited_by_the_width`, `zoom_to_selection_without_a_toolbar_inset_uses_the_whole_height`); Zoom to fit (Shift+1) keeps its 64 pt margin, margin not measured yet (`zoom_to_fit_is_unchanged`) | | Rulers and guides (drag out, move, remove; rotated frames; frame guides) | done | guides belong to the page or a top-level frame (a frame moved into another keeps its guides but they stop applying); a click selects one for Delete, the arrows or the context menu's Remove guide; Alt-drag drops a copy; Alt while dragging measures to the layers in the frame it crosses; ruler numbering checked by eye only | | Frame labels (rotated, right-to-left), size badge | done | | | Outline mode | done | Outlines, outlines for the selection, mask outlines, frame outlines; shapes are clicked on their outlines, reaching layers behind; View ▸ Outlines ▸ Include hidden layers (`view.outlinesHiddenLayers`) outlines hidden layers too and Include object bounds (`view.outlinesObjectBounds`) draws the box of every layer whose outline isn't its box (groups, text, ellipses, vectors); what either draws can be clicked there (a hidden layer on its outline, a group on its box) and nothing else can; both are view settings like the other outline flags (per file, off in a new one, checked in the menu); the lines are light on a dark page (`outline_options_tests`). The main menu now shows a check mark beside every View toggle that is on | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-09 | patch | Zoom to selection: the selection is fitted with a 40 pt margin into the canvas above the floating bottom toolbar (`ViewState::bottom_inset`, set by the UI each frame, never saved; `view.set` takes `bottomInset`) and centred in that area, as measured in Figma's web app on 2026-11-09. Zoom to fit is unchanged (margin not measured yet). Numbers unchanged. | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 0aba3f7632457150cfe18c96510022e1566151c6 Mon Sep 17 00:00:00 2001 From: ljkx <177671075+ljkx@users.noreply.github.com> Date: Mon, 9 Nov 2026 06:15:26 +0100 Subject: [PATCH 059/239] M4: a Pencil stroke stays where it was drawn, without spikes off it (#1741) kurbo's simplify_bezpath, which smooths Pencil samples and runs Simplify path, fitted two common shapes with a curve that ran far off the path: a stroke that goes out and back to the very point it left (kurbo keeps a reversal as a smooth join) and nearly collinear samples (kurbo measures its error across the path, not along it). figcraft_geom::simplify_path cuts the path where it turns back by more than a right angle, simplifies each run with kurbo, and keeps a run as it was when its fit strays more than twice the accuracy from it. The Pencil and vector.simplify use it. --- crates/engine/src/brush_tests.rs | 46 +++++++ crates/engine/src/canvas/tools/pen.rs | 5 +- crates/engine/src/cmd/structure.rs | 8 +- crates/engine/src/vector_behaviour_tests.rs | 21 +++ crates/geom/src/lib.rs | 2 + crates/geom/src/simplify.rs | 140 ++++++++++++++++++++ crates/geom/src/tests.rs | 117 ++++++++++++++++ 7 files changed, 333 insertions(+), 6 deletions(-) create mode 100644 crates/geom/src/simplify.rs diff --git a/crates/engine/src/brush_tests.rs b/crates/engine/src/brush_tests.rs index 35dba6a7f..50317496d 100644 --- a/crates/engine/src/brush_tests.rs +++ b/crates/engine/src/brush_tests.rs @@ -149,3 +149,49 @@ fn the_pencil_draws_white_on_a_dark_background() { assert_eq!(stroke(&mut s, 0.0, 600.0).0, want, "on {bg}"); } } + +/// A Pencil stroke stays where it was drawn: the fitted curve shot far off the stroke, a spike +/// (#1741, its second point), where the stroke went out and back to the very point it left and +/// where samples ran on nearly straight. Pointer pixels become fractional page points, so going +/// back to a pixel lands on exactly the same point. Both sample runs are ones kurbo's fit took +/// hundreds of units off. +#[test] +fn the_pencil_keeps_its_stroke_where_it_was_drawn() { + let mut s = Session::new(); + s.execute("tool.set", &json!({"tool": "pencil"})).unwrap(); + let (p, q) = ((86.043_565_719_086_97, -173.744_402_349_100_94), (87.851_850_739_335_35, -179.202_846_445_954_52)); + let back = [(80.0, -160.0), p, q, p, (95.0, -185.0)]; + let straight = [ + (204.0, -198.0), + (209.598_690_794_015_5, -204.909_328_119_739_88), + (211.277_914_263_870_97, -207.190_974_020_753_4), + (214.246_506_828_720_84, -211.228_827_590_623_24), + (218.0, -214.0), + ]; + for (what, samples) in [("out and back", &back[..]), ("nearly straight", &straight[..])] { + let (first, last) = (samples[0], samples[samples.len() - 1]); + s.pointer(&PointerEvent::at(PointerKind::Down, first.0, first.1, 1.0)).unwrap(); + for (x, y) in &samples[1..] { + s.pointer(&PointerEvent::at(PointerKind::Move, *x, *y, 1.0)).unwrap(); + } + s.pointer(&PointerEvent::at(PointerKind::Up, last.0, last.1, 1.0)).unwrap(); + let doc = s.doc().unwrap(); + let n = doc.nodes().filter(|n| matches!(n.kind, NodeKind::Vector { .. })).max_by_key(|n| n.id).unwrap(); + let NodeKind::Vector { network } = &n.kind else { panic!("{what}: not a vector") }; + let drawn = doc.world_transform(n.id) * network.stroke_path(); + let samples_box = figcraft_geom::points_bounds(samples.iter().map(|(x, y)| Point::new(*x, *y))).unwrap(); + let (path_box, node_box) = (figcraft_geom::Shape::bounding_box(&drawn), doc.world_bounds(n.id).unwrap()); + assert!( + samples_box.inflate(1.5, 1.5).contains_rect(path_box), + "{what}: the stroke {path_box:?} goes past the samples {samples_box:?}: {}", + drawn.to_svg() + ); + assert!(samples_box.inflate(1.5, 1.5).contains_rect(node_box), "{what}: the layer {node_box:?}, the samples {samples_box:?}"); + } + // The turn is a point of the stroke, where it was drawn. + let doc = s.doc().unwrap(); + let turned = doc.nodes().find(|n| n.name == "Vector" && doc.world_bounds(n.id).is_some_and(|b| b.y1 < -150.0 && b.x1 < 100.0)).unwrap(); + let NodeKind::Vector { network } = &turned.kind else { panic!("not a vector") }; + let xf = doc.world_transform(turned.id); + assert!(network.vertices.iter().any(|v| (xf * Point::new(v.x, v.y) - Point::new(q.0, q.1)).hypot() < 1e-6), "no point at the turn"); +} diff --git a/crates/engine/src/canvas/tools/pen.rs b/crates/engine/src/canvas/tools/pen.rs index 4b98ccee1..3f8b47e59 100644 --- a/crates/engine/src/canvas/tools/pen.rs +++ b/crates/engine/src/canvas/tools/pen.rs @@ -313,7 +313,8 @@ impl Session { if points.len() < 2 { return Ok(()); } - // Smooth: fit a curve through the samples. + // Smooth: fit a curve through the samples, kept from shooting past them where the stroke + // turns back or runs nearly straight (#1741). let mut poly = figcraft_geom::BezPath::new(); for (k, p) in points.iter().enumerate() { if k == 0 { @@ -322,7 +323,7 @@ impl Session { poly.line_to(*p); } } - let fitted = figcraft_geom::kurbo::simplify::simplify_bezpath(poly.iter(), 0.75, &Default::default()); + let fitted = figcraft_geom::simplify_path(&poly, 0.75); let d = fitted.to_svg(); if matches!(self.tool.tool, ToolId::Marker | ToolId::Highlighter) { return self.ink_finish(&d); diff --git a/crates/engine/src/cmd/structure.rs b/crates/engine/src/cmd/structure.rs index 3339faa38..34cc91fbb 100644 --- a/crates/engine/src/cmd/structure.rs +++ b/crates/engine/src/cmd/structure.rs @@ -799,7 +799,7 @@ fn simplify(s: &mut Session, p: &Value) -> Result { WindingRule::NonZero }; let path = drawn.fill_path(); - let path = figcraft_geom::kurbo::simplify::simplify_bezpath(path.iter(), tol, &Default::default()); + let path = figcraft_geom::simplify_path(&path, tol); let (path, output_winding) = match figcraft_pathops::simplify_with_rule(&path, winding == WindingRule::EvenOdd) { Ok(path) => (path, WindingRule::EvenOdd), Err(_) => (path, winding), @@ -809,7 +809,7 @@ fn simplify(s: &mut Session, p: &Value) -> Result { } else { for (index, region) in source.regions.iter().enumerate() { let Some(path) = drawn.region_path(index) else { continue }; - let path = figcraft_geom::kurbo::simplify::simplify_bezpath(path.iter(), tol, &Default::default()); + let path = figcraft_geom::simplify_path(&path, tol); let path = figcraft_pathops::simplify_with_rule(&path, region.winding == WindingRule::EvenOdd).unwrap_or(path); append_region_path(&mut net, &path, region, region.winding); } @@ -826,7 +826,7 @@ fn simplify(s: &mut Session, p: &Value) -> Result { open.regions.clear(); if !open.segments.is_empty() { let path = open.stroke_path(); - let simplified = figcraft_geom::kurbo::simplify::simplify_bezpath(path.iter(), tol, &Default::default()); + let simplified = figcraft_geom::simplify_path(&path, tol); let mut loose = VectorNetwork::from_path(&simplified); loose.regions.clear(); append_network(&mut net, loose); @@ -834,7 +834,7 @@ fn simplify(s: &mut Session, p: &Value) -> Result { } if source.regions.is_empty() { let path = source.stroke_path(); - let simplified = figcraft_geom::kurbo::simplify::simplify_bezpath(path.iter(), tol, &Default::default()); + let simplified = figcraft_geom::simplify_path(&path, tol); net = VectorNetwork::from_path(&simplified); net.regions.clear(); } diff --git a/crates/engine/src/vector_behaviour_tests.rs b/crates/engine/src/vector_behaviour_tests.rs index c990ad348..4666c3028 100644 --- a/crates/engine/src/vector_behaviour_tests.rs +++ b/crates/engine/src/vector_behaviour_tests.rs @@ -326,6 +326,27 @@ fn ex_to_vector(doc: &mut figcraft_doc::Document, id: NodeId) { doc.get_mut(id).unwrap().kind = NodeKind::Vector { network }; } +/// Simplify path keeps nearly collinear points near where they were: kurbo's fit, which Simplify +/// path and the Pencil share, ran a handle hundreds of units on along the line (#1741). +#[test] +fn simplify_keeps_nearly_collinear_points_near_them() { + let mut s = Session::new(); + let id = id_of(&ex(&mut s, "vector.create", json!({"path": "M0 0 L10 10"}))["id"]).unwrap(); + // The points exactly as sampled, at the page origin (`vector.create` would move them). + let d = "M209.5986907940155 -204.90932811973988 L211.27791426387097 -207.1909740207534 L214.24650682872084 -211.22882759062324"; + let before = BezPath::from_svg(d).unwrap(); + { + let n = s.doc_mut().unwrap().get_mut(id).unwrap(); + n.transform = figcraft_geom::Affine::IDENTITY; + n.kind = NodeKind::Vector { network: VectorNetwork::from_path(&before) }; + } + assert_eq!(net(&s, id).stroke_path().elements(), before.elements(), "the samples as they were"); + ex(&mut s, "vector.simplify", json!({"ids": [id], "tolerance": 0.75})); + let after = s.doc().unwrap().world_transform(id) * net(&s, id).stroke_path(); + let (b0, b1) = (before.bounding_box(), after.bounding_box()); + assert!(b0.inflate(1.5, 1.5).contains_rect(b1), "{b1:?} past {b0:?}: {}", after.to_svg()); +} + fn ex(s: &mut Session, cmd: &str, p: Value) -> Value { s.execute(cmd, &p).unwrap_or_else(|e| panic!("{cmd}: {e}")) } diff --git a/crates/geom/src/lib.rs b/crates/geom/src/lib.rs index a775a4170..191b30419 100644 --- a/crates/geom/src/lib.rs +++ b/crates/geom/src/lib.rs @@ -12,7 +12,9 @@ use kurbo::ParamCurve; use std::f64::consts::{FRAC_PI_2, PI, TAU}; pub mod measure; +mod simplify; mod transform; +pub use simplify::simplify_path; pub use transform::*; /// Corner radii in clockwise order from the top-left: `[tl, tr, br, bl]`. diff --git a/crates/geom/src/simplify.rs b/crates/geom/src/simplify.rs new file mode 100644 index 000000000..e768f303a --- /dev/null +++ b/crates/geom/src/simplify.rs @@ -0,0 +1,140 @@ +//! Path simplification that keeps to its input where kurbo's fit would shoot past it. + +use kurbo::{BezPath, ParamCurve, ParamCurveNearest, PathEl, PathSeg, Point, Vec2}; + +/// How far, as a multiple of the accuracy asked for, a fitted run may stray from the run it +/// replaces before the run is kept as it was. kurbo's own fits stay within about the accuracy; its +/// failures stray by tens to hundreds of units, so twice the accuracy tells them apart without +/// undoing fits that are merely a little over. +const STRAY: f64 = 2.0; + +/// `path` simplified to within `accuracy` by kurbo's [`simplify_bezpath`], kept from straying +/// far from `path` where kurbo's fit does. +/// +/// Two inputs made kurbo's fit shoot far past the path it simplified (#1741, a Pencil stroke with +/// a spike off it), and both are common in pointer samples: +/// - A join where the path turns straight back (samples going down and back up the same line): +/// kurbo keeps two segments in one smooth fit when their tangents are parallel whichever way +/// they point (`|cross| <= |dot| * angle_thresh`), so it fits a smooth curve through the cusp. +/// The path is cut where it turns back by more than a right angle, each run between the cuts is +/// simplified on its own, and the runs are joined again, so the turn stays a sharp corner. Any +/// other join that isn't straight within kurbo's threshold is a corner to kurbo already, so the +/// cut changes nothing there. +/// - A run of nearly collinear segments: kurbo measures its error across the path, not along it, so +/// a fitted cubic whose handle runs hundreds of units on along the line passes its check. Each +/// fitted run is measured against the run it replaces, and one that strays more than +/// twice `accuracy` from it is kept as it was instead. +/// +/// Subpaths and closes are kept, and a closing segment stays implicit, as kurbo leaves it. +/// +/// [`simplify_bezpath`]: kurbo::simplify::simplify_bezpath +pub fn simplify_path(path: &BezPath, accuracy: f64) -> BezPath { + let mut out = BezPath::new(); + let mut run = BezPath::new(); + // Where the current subpath started, where the pen is, and the last segment's end tangent. + let mut start = Point::ZERO; + let mut at = Point::ZERO; + let mut last_tan: Option = None; + // Whether the next run that draws anything has to start the subpath with its move. + let mut fresh = true; + for el in path.elements() { + let seg = match *el { + PathEl::MoveTo(p) => { + flush(&mut out, &mut run, accuracy, &mut fresh); + (start, at, last_tan, fresh) = (p, p, None, true); + run.move_to(p); + continue; + } + PathEl::ClosePath => { + flush(&mut out, &mut run, accuracy, &mut fresh); + if !fresh { + out.close_path(); + } + // A segment after a close starts a new subpath at the closed one's start. + (at, last_tan, fresh) = (start, None, true); + run.move_to(start); + continue; + } + PathEl::LineTo(p) => PathSeg::Line(kurbo::Line::new(at, p)), + PathEl::QuadTo(p1, p2) => PathSeg::Quad(kurbo::QuadBez::new(at, p1, p2)), + PathEl::CurveTo(p1, p2, p3) => PathSeg::Cubic(kurbo::CubicBez::new(at, p1, p2, p3)), + }; + if run.elements().is_empty() { + run.move_to(at); + } + let Some((t0, t1)) = tangents(seg) else { continue }; + if last_tan.is_some_and(|last| last.dot(t0) < 0.0) { + flush(&mut out, &mut run, accuracy, &mut fresh); + run.move_to(at); + } + run.push(*el); + at = seg.end(); + last_tan = Some(t1); + } + flush(&mut out, &mut run, accuracy, &mut fresh); + out +} + +/// Simplify `run` (one move and the segments after it) with kurbo and append it to `out`; the +/// run's move is kept only when it starts a subpath (`fresh`), else the run carries on from the +/// last point drawn. `run` is left empty. +fn flush(out: &mut BezPath, run: &mut BezPath, accuracy: f64, fresh: &mut bool) { + if run.elements().len() > 1 { + let fitted = kurbo::simplify::simplify_bezpath(run.iter(), accuracy, &Default::default()); + let fitted = if keeps_to(&fitted, run, STRAY * accuracy) { fitted } else { std::mem::take(run) }; + for el in fitted.elements() { + match el { + PathEl::MoveTo(_) if !*fresh => {} + _ => { + out.push(*el); + *fresh = false; + } + } + } + } + *run = BezPath::new(); +} + +/// Whether every point of `fitted` lies within `tol` of `source`: one subpath each, from the same +/// start to the same end, `fitted` being kurbo's simplification of `source`. +/// +/// kurbo ends each fitted segment on the source, so the two are walked together: for each fitted +/// segment, the source segments from where it starts to the first one its end lies on are the only +/// ones its sample points are measured against. The work is linear in the two lengths. A fitted end +/// found on no source segment counts as straying. +fn keeps_to(fitted: &BezPath, source: &BezPath, tol: f64) -> bool { + /// Parts each fitted segment is cut into: the points between them are the ones measured. + const SAMPLES: u32 = 16; + let src: Vec = source.segments().collect(); + // kurbo puts each end on the source by evaluating it: off by rounding at most. + let on2 = (tol * 1e-3).powi(2); + let (tol2, mut cur) = (tol * tol, 0); + for seg in fitted.segments() { + let Some(last) = (cur..src.len()).find(|&i| src.get(i).is_some_and(|s| s.nearest(seg.end(), 1e-9).distance_sq <= on2)) else { + return false; + }; + let near = src.get(cur..=last).unwrap_or_default(); + for i in 1..SAMPLES { + let p = seg.eval(f64::from(i) / f64::from(SAMPLES)); + if !near.iter().any(|s| s.nearest(p, 1e-6).distance_sq <= tol2) { + return false; + } + } + cur = last; + } + true +} + +/// The directions `seg` leaves its start and reaches its end, skipping control points that sit on +/// an end; `None` for a segment of no length, which kurbo skips too. +fn tangents(seg: PathSeg) -> Option<(Vec2, Vec2)> { + let pts: Vec = match seg { + PathSeg::Line(l) => vec![l.p0, l.p1], + PathSeg::Quad(q) => vec![q.p0, q.p1, q.p2], + PathSeg::Cubic(c) => vec![c.p0, c.p1, c.p2, c.p3], + }; + let (first, last) = (*pts.first()?, *pts.last()?); + let t0 = pts.iter().map(|p| *p - first).find(|d| d.hypot2() > 0.0)?; + let t1 = pts.iter().rev().map(|p| last - *p).find(|d| d.hypot2() > 0.0)?; + Some((t0, t1)) +} diff --git a/crates/geom/src/tests.rs b/crates/geom/src/tests.rs index 459b2b101..10e09318c 100644 --- a/crates/geom/src/tests.rs +++ b/crates/geom/src/tests.rs @@ -366,3 +366,120 @@ fn svg_path_refuses_numbers_past_the_limit_before_parsing() { assert!(number_past("M0 0L-2.5.5 1e-3-4e3z", 1e3)); assert!(number_past("M.5.5e10", 1e3)); } + +/// A path through `pts` with straight lines (pencil samples). +fn polyline(pts: &[(f64, f64)]) -> BezPath { + let mut p = BezPath::new(); + for (k, (x, y)) in pts.iter().enumerate() { + if k == 0 { p.move_to((*x, *y)) } else { p.line_to((*x, *y)) } + } + p +} + +/// How far `out` strays from `input`: the largest distance from a point sampled along `out` to the +/// nearest segment of `input` (closing segments included). +fn deviation(out: &BezPath, input: &BezPath) -> f64 { + use kurbo::{ParamCurve, ParamCurveNearest}; + let segs: Vec = input.segments().collect(); + out.segments() + .flat_map(|seg| (0..=32).map(move |i| seg.eval(f64::from(i) / 32.0))) + .map(|p| segs.iter().map(|s| s.nearest(p, 1e-6).distance_sq).fold(f64::INFINITY, f64::min).sqrt()) + .fold(0.0, f64::max) +} + +/// Pencil strokes kurbo's fit shot far past keep to their samples (#1741): a stroke that goes out +/// and back to the very point it left, nearly collinear samples, and strokes that turn back along +/// their own line. The first two are from fuzzing pencil-like strokes, where kurbo's curve went +/// about 390 and 160 units off; at whole-pixel coordinates the same shapes happened to fit well. +#[test] +fn simplifying_keeps_to_strokes_kurbo_shot_past() { + use kurbo::ParamCurve; + let cases: [(&str, &[(f64, f64)]); 5] = [ + ( + "out and back to the same point", + &[ + (86.043_565_719_086_97, -173.744_402_349_100_94), + (87.851_850_739_335_35, -179.202_846_445_954_52), + (86.043_565_719_086_97, -173.744_402_349_100_94), + ], + ), + ( + "nearly collinear", + &[ + (209.598_690_794_015_5, -204.909_328_119_739_88), + (211.277_914_263_870_97, -207.190_974_020_753_4), + (214.246_506_828_720_84, -211.228_827_590_623_24), + ], + ), + ( + "a dip straight down and back up", + &[(0.0, 0.0), (10.0, 0.0), (20.0, 2.0), (30.0, 6.0), (30.0, 12.0), (30.0, 6.0), (40.0, 2.0), (50.0, 0.0)], + ), + ("a slip back at the end", &[(0.0, 0.0), (10.0, 3.0), (20.0, 8.0), (30.0, 15.0), (30.0, 25.0), (30.0, 22.0)]), + ( + "a near reversal in a curve", + &[(0.0, 0.0), (8.0, 2.0), (16.0, 6.0), (24.0, 12.0), (32.0, 20.0), (24.0, 12.000_01), (16.0, 6.0), (8.0, 2.0)], + ), + ]; + for (what, pts) in cases { + let input = polyline(pts); + let out = simplify_path(&input, 0.75); + let d = deviation(&out, &input); + assert!(d <= 1.5, "{what}: strays {d} from the samples: {}", out.to_svg()); + let (inb, outb) = (input.bounding_box(), out.bounding_box()); + assert!(inb.inflate(1.5, 1.5).contains_rect(outb), "{what}: {outb:?} past {inb:?}"); + // One subpath, starting and ending where the stroke does. + let moves = out.elements().iter().filter(|e| matches!(e, kurbo::PathEl::MoveTo(_))).count(); + assert_eq!(moves, 1, "{what}: {}", out.to_svg()); + let (first, last) = (pts[0], pts[pts.len() - 1]); + assert_eq!(out.segments().next().map(|s| s.start()), Some(Point::new(first.0, first.1)), "{what}"); + assert_eq!(out.segments().last().map(|s| s.end()), Some(Point::new(last.0, last.1)), "{what}"); + } +} + +/// Where a path never turns back and kurbo's fit holds, the result is kurbo's own, element for +/// element: smooth runs, corners sharper than a right angle, closed subpaths and several subpaths. +#[test] +fn simplifying_is_kurbos_where_its_fit_holds() { + let wave: Vec<(f64, f64)> = (0..=60).map(|i| (f64::from(i) * 4.0, (f64::from(i) / 6.0).sin() * 30.0)).collect(); + let zigzag: Vec<(f64, f64)> = (0..=8).map(|i| (f64::from(i) * 10.0, if i % 2 == 0 { 0.0 } else { 40.0 })).collect(); + let mut closed = polyline(&wave[..20]); + closed.close_path(); + let mut several = polyline(&wave); + several.extend(polyline(&zigzag).elements().iter().map(|e| match *e { + kurbo::PathEl::MoveTo(p) => kurbo::PathEl::MoveTo(p + Vec2::new(0.0, 100.0)), + kurbo::PathEl::LineTo(p) => kurbo::PathEl::LineTo(p + Vec2::new(0.0, 100.0)), + e => e, + })); + let curves = BezPath::from_svg("M0 0 C10 -20 30 -20 40 0 C50 20 70 20 80 0 Q100 -30 120 0 L140 10 Z M200 0 L240 0").unwrap(); + for (what, input) in + [("a wave", polyline(&wave)), ("a zigzag", polyline(&zigzag)), ("closed", closed), ("two subpaths", several), ("curves", curves)] + { + let ours = simplify_path(&input, 0.75); + let theirs = kurbo::simplify::simplify_bezpath(input.iter(), 0.75, &Default::default()); + assert_eq!(ours.elements(), theirs.elements(), "{what}"); + } +} + +/// A closed path with a reversal in it stays one closed subpath, and each subpath of several keeps +/// its own start. +#[test] +fn simplifying_keeps_closes_and_subpaths_across_a_reversal() { + let mut input = polyline(&[(0.0, 0.0), (40.0, 0.0), (40.0, 30.0), (40.0, 20.0), (0.0, 30.0)]); + input.close_path(); + input.extend(polyline(&[(100.0, 0.0), (100.0, 20.0), (100.0, 10.0)]).elements().iter().copied()); + let out = simplify_path(&input, 0.75); + let els = out.elements(); + let moves: Vec = els.iter().filter_map(|e| if let kurbo::PathEl::MoveTo(p) = e { Some(*p) } else { None }).collect(); + assert_eq!(moves, [Point::new(0.0, 0.0), Point::new(100.0, 0.0)], "{}", out.to_svg()); + assert_eq!(els.iter().filter(|e| matches!(e, kurbo::PathEl::ClosePath)).count(), 1, "{}", out.to_svg()); + let close = els.iter().position(|e| matches!(e, kurbo::PathEl::ClosePath)).unwrap(); + assert!(matches!(els[close + 1], kurbo::PathEl::MoveTo(_)), "the first subpath closes before the second starts"); + assert!(deviation(&out, &input) <= 1.5, "{}", out.to_svg()); + // Nothing to draw: nothing out, not a stray move or close. + let mut empty = BezPath::new(); + empty.move_to((5.0, 5.0)); + empty.line_to((5.0, 5.0)); + empty.close_path(); + assert!(simplify_path(&empty, 0.75).elements().is_empty()); +} From 5d529269ceaeeb8c5f7cc13a063508fab66ee8e5 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 00:33:53 -0500 Subject: [PATCH 060/239] M8: Zoom to selection in a short canvas keeps the selection above the toolbar (#2139 review) The inset was clamped to leave 100 points and the fit kept at least 50, so in a canvas 130 points high the selection ended behind the toolbar. The real inset is kept and the margin shrinks to a quarter of the area when 40 points a side does not fit. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/engine/src/view_behaviour_tests.rs | 16 ++++++++++++++++ crates/engine/src/view_state.rs | 13 ++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/view_behaviour_tests.rs b/crates/engine/src/view_behaviour_tests.rs index 974c9f44f..9c77314e0 100644 --- a/crates/engine/src/view_behaviour_tests.rs +++ b/crates/engine/src/view_behaviour_tests.rs @@ -808,6 +808,22 @@ fn zoom_to_selection_without_a_toolbar_inset_uses_the_whole_height() { assert!((v.zoom - (903.0 - 80.0) / 100.0).abs() < 1e-6, "{}", v.zoom); } +#[test] +fn zoom_to_selection_in_a_short_canvas_still_ends_above_the_toolbar() { + // A canvas 130 points high with the 60-point toolbar strip leaves 70 above it: too short for + // 40 points a side, so the margin shrinks and the selection stays clear of the toolbar. + let mut s = Session::new(); + let r = rect(&mut s, 0.0, 0.0, 100.0, 100.0, None); + ex(&mut s, "view.set", json!({"vw": 1389, "vh": 130, "bottomInset": 60})); + ex(&mut s, "select.set", json!({"ids": [r]})); + ex(&mut s, "view.zoomSelection", json!({})); + let v = view(&s); + let (_, top) = v.page_to_screen(0.0, 0.0); + let (_, bottom) = v.page_to_screen(100.0, 100.0); + assert!(top >= 0.0 && bottom <= 70.0 + 1e-6, "top {top}, bottom {bottom}"); + assert!((top - (70.0 - bottom)).abs() < 1e-6, "centred above the toolbar: top {top}, bottom {bottom}"); +} + #[test] fn zoom_to_fit_is_unchanged() { // Left alone on purpose: its 64-point margin is not measured against Figma yet. diff --git a/crates/engine/src/view_state.rs b/crates/engine/src/view_state.rs index bfbb36f66..212bb93b4 100644 --- a/crates/engine/src/view_state.rs +++ b/crates/engine/src/view_state.rs @@ -118,11 +118,14 @@ impl ViewState { self.cy = r.center().y; return; } - let margin = 40.0; - let inset = if self.bottom_inset.is_finite() { self.bottom_inset.clamp(0.0, (self.vh - 100.0).max(0.0)) } else { 0.0 }; - let area_h = self.vh - inset; - let zx = (self.vw - margin * 2.0).max(50.0) / r.width().max(1e-6); - let zy = (area_h - margin * 2.0).max(50.0) / r.height().max(1e-6); + let inset = if self.bottom_inset.is_finite() { self.bottom_inset.clamp(0.0, (self.vh - 1.0).max(0.0)) } else { 0.0 }; + let area_h = (self.vh - inset).max(1.0); + // 40 points as measured; a canvas too small for that keeps a quarter of its size on each + // side instead, so the selection still ends above the toolbar. + let mx = (self.vw / 4.0).clamp(0.0, 40.0); + let my = (area_h / 4.0).clamp(0.0, 40.0); + let zx = (self.vw - mx * 2.0).max(1.0) / r.width().max(1e-6); + let zy = (area_h - my * 2.0).max(1.0) / r.height().max(1e-6); self.zoom = zx.min(zy).clamp(Self::MIN_ZOOM, max_zoom); // The rect's centre lands at screen y = area_h / 2, the page centre `(vh - area_h) / 2` below it. self.cx = r.center().x; From cf567c3f63993b0ec0aabe122b2fac73b900e6e0 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 00:51:03 -0500 Subject: [PATCH 061/239] M2: a child dragged in auto layout passes a sibling when its leading edge reaches the sibling's middle Within its own row or column, a dragged child's slot follows the box it would fill under the pointer (start bounds plus the unsnapped drag), by the edge facing the drag, not the pointer. Measured in Figma's web app, 2026-11-09. Dragging in from outside, wrapping layouts and grids keep their rules. Several moving layers use their combined box. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 measured and wrote at medium --- crates/engine/src/al_drag_tests.rs | 53 ++++++++++++++++++++++++++ crates/engine/src/canvas/drop.rs | 40 ++++++++++++++++--- crates/engine/src/canvas/tools/drag.rs | 16 +++++++- docs/auto-layout-parity.md | 5 ++- 4 files changed, 105 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/al_drag_tests.rs b/crates/engine/src/al_drag_tests.rs index 528fdd9d7..23f416481 100644 --- a/crates/engine/src/al_drag_tests.rs +++ b/crates/engine/src/al_drag_tests.rs @@ -69,3 +69,56 @@ fn grid_drag_takes_the_cell_under_the_pointer() { let cl = s.doc().unwrap().node(kids[0]).unwrap().child_layout.clone(); assert_eq!((cl.grid_column, cl.grid_row), (None, None), "one undo step"); } + +/// Three 60 x 60 rectangles in a row (or column), gap 20, at 0, 80 and 160 along the flow. +fn three(s: &mut Session, mode: &str) -> (NodeId, [NodeId; 3]) { + let f = id(s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 300, "height": 300})).unwrap()); + let kids: Vec = + (0..3).map(|_| id(s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 60, "height": 60, "parent": f})).unwrap())).collect(); + s.execute("layout.add", &json!({"ids": [f]})).unwrap(); + s.execute("node.set", &json!({"id": f, "props": {"layoutMode": mode, "gap": 20, "padding": 0, "sizingH": "fixed", "sizingV": "fixed"}})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + (f, [kids[0], kids[1], kids[2]]) +} + +/// The order after dragging kid `which` by `by` along the flow, grabbed `grab` from its start edge. +fn dragged_order(mode: &str, which: usize, grab: f64, by: f64) -> Vec { + let mut s = Session::new(); + let (f, kids) = three(&mut s, mode); + let vertical = mode == "vertical"; + let b = s.doc().unwrap().world_bounds(kids[which]).unwrap(); + let from = if vertical { (b.center().x, b.y0 + grab) } else { (b.x0 + grab, b.center().y) }; + let to = if vertical { (from.0, from.1 + by) } else { (from.0 + by, from.1) }; + drag(&mut s, from, to); + let order = s.doc().unwrap().node(f).unwrap().children.clone(); + order.iter().map(|c| kids.iter().position(|k| k == c).unwrap()).collect() +} + +#[test] +fn a_child_dragged_right_passes_a_sibling_when_its_leading_edge_reaches_the_siblings_middle() { + assert_eq!(dragged_order("horizontal", 0, 30.0, 49.0), vec![0, 1, 2]); + assert_eq!(dragged_order("horizontal", 0, 30.0, 50.0), vec![1, 0, 2]); + assert_eq!(dragged_order("horizontal", 0, 30.0, 129.0), vec![1, 0, 2]); + assert_eq!(dragged_order("horizontal", 0, 30.0, 130.0), vec![1, 2, 0]); +} + +#[test] +fn where_the_child_is_grabbed_does_not_change_its_slot() { + assert_eq!(dragged_order("horizontal", 0, 10.0, 49.0), vec![0, 1, 2]); + assert_eq!(dragged_order("horizontal", 0, 10.0, 50.0), vec![1, 0, 2]); + assert_eq!(dragged_order("horizontal", 0, 10.0, 129.0), vec![1, 0, 2]); + assert_eq!(dragged_order("horizontal", 0, 10.0, 130.0), vec![1, 2, 0]); +} + +#[test] +fn a_child_dragged_left_passes_a_sibling_by_its_left_edge() { + assert_eq!(dragged_order("horizontal", 2, 30.0, -49.0), vec![0, 1, 2]); + assert_eq!(dragged_order("horizontal", 2, 30.0, -50.0), vec![0, 2, 1]); + assert_eq!(dragged_order("horizontal", 2, 30.0, -130.0), vec![2, 0, 1]); +} + +#[test] +fn a_column_reorders_by_the_bottom_edge() { + assert_eq!(dragged_order("vertical", 0, 30.0, 50.0), vec![1, 0, 2]); + assert_eq!(dragged_order("vertical", 0, 30.0, 130.0), vec![1, 2, 0]); +} diff --git a/crates/engine/src/canvas/drop.rs b/crates/engine/src/canvas/drop.rs index e46734ac9..7bad66ac3 100644 --- a/crates/engine/src/canvas/drop.rs +++ b/crates/engine/src/canvas/drop.rs @@ -20,6 +20,31 @@ pub struct DropSlot { /// placed child whose centre is past the pointer, and the line to draw there. Hidden children and /// those ignoring auto layout don't take part. pub fn auto_layout_slot(doc: &Document, parent: NodeId, p: Point, exclude: &[NodeId]) -> Option<(usize, Option<[f64; 4]>)> { + slot_in(doc, parent, p, exclude, None) +} + +/// [`auto_layout_slot`] for layers dragged within their own frame (measured in Figma's web app, +/// 2026-11-09): the slot follows the leading edge of `moved`, the box the layers would fill under +/// the pointer, in the direction of `delta` (the drag along the page). Wrapping layouts keep the +/// pointer rule. +pub fn auto_layout_slot_within( + doc: &Document, + parent: NodeId, + p: Point, + exclude: &[NodeId], + moved: figcraft_geom::Rect, + delta: Point, +) -> Option<(usize, Option<[f64; 4]>)> { + slot_in(doc, parent, p, exclude, Some((moved, delta))) +} + +fn slot_in( + doc: &Document, + parent: NodeId, + p: Point, + exclude: &[NodeId], + dragged: Option<(figcraft_geom::Rect, Point)>, +) -> Option<(usize, Option<[f64; 4]>)> { let pn = doc.node(parent)?; let layout = pn.layout.as_ref()?; let vertical = layout.mode == LayoutMode::Vertical; @@ -34,11 +59,16 @@ pub fn auto_layout_slot(doc: &Document, parent: NodeId, p: Point, exclude: &[Nod let (k, line) = wrap_slot(doc, &flow_ids, p, vertical); return Some((index(k), line)); } - let pos = if vertical { p.y } else { p.x }; - let k = flow_ids - .iter() - .position(|c| doc.world_bounds(*c).is_some_and(|b| pos < if vertical { b.center().y } else { b.center().x })) - .unwrap_or(flow_ids.len()); + let mid = |c: &NodeId| doc.world_bounds(*c).map(|b| if vertical { b.center().y } else { b.center().x }); + let k = if let Some((r, d)) = dragged { + let (lo, hi, dd) = if vertical { (r.y0, r.y1, d.y) } else { (r.x0, r.x1, d.x) }; + // Forward: past every sibling whose middle the trailing edge has reached; backward: past + // every one whose middle lies before the leading (low) edge. + flow_ids.iter().position(|c| mid(c).is_some_and(|m| if dd > 0.0 { m > hi } else { m >= lo })).unwrap_or(flow_ids.len()) + } else { + let pos = if vertical { p.y } else { p.x }; + flow_ids.iter().position(|c| mid(c).is_some_and(|m| pos < m)).unwrap_or(flow_ids.len()) + }; let line = flow_ids.get(k).and_then(|c| doc.world_bounds(*c)).map(|b| line_before(b, vertical, 2.0)).or_else(|| { flow_ids .last() diff --git a/crates/engine/src/canvas/tools/drag.rs b/crates/engine/src/canvas/tools/drag.rs index 64d48bc86..94f0e654e 100644 --- a/crates/engine/src/canvas/tools/drag.rs +++ b/crates/engine/src/canvas/tools/drag.rs @@ -216,6 +216,8 @@ impl Session { } } // Cmd/Ctrl (and Control on macOS) held while dragging suspends snapping. + // The pointer's own drag, before snapping: a reorder in auto layout follows it. + let raw = d; let snap_on = self.ds().map(|ds| ds.view.snap_objects).unwrap_or(true) && !ev.cmd && !ev.ctrl; let mut guides = Vec::new(); if self.ds().map(|ds| ds.view.snap_pixel).unwrap_or(true) { @@ -268,8 +270,18 @@ impl Session { // cell) under the pointer, as the frame shows it now. A frame other than the // one they come from is outlined too. let cell = if mode == LayoutMode::Grid { crate::drop::grid_cell_at(doc, target, p) } else { None }; - let idx = - if mode == LayoutMode::Grid { 0 } else { crate::drop::auto_layout_slot(doc, target, p, &moving).map_or(0, |(i, _)| i) }; + // Within the frame they came from, the slot follows the leading edge of the + // box they would fill (their combined start bounds moved by the drag), not + // the pointer. The preview starts from the document as the drag began. + let within = moving.iter().all(|m| doc.node(*m).is_some_and(|n| n.parent == Some(target))); + let idx = if mode == LayoutMode::Grid { + 0 + } else if let (true, Some(b)) = (within, doc.bounds_of(&moving)) { + let moved = Rect::new(b.x0 + raw.x, b.y0 + raw.y, b.x1 + raw.x, b.y1 + raw.y); + crate::drop::auto_layout_slot_within(doc, target, p, &moving, moved, Point::new(raw.x, raw.y)).map_or(0, |(i, _)| i) + } else { + crate::drop::auto_layout_slot(doc, target, p, &moving).map_or(0, |(i, _)| i) + }; for m in &moving { if doc.get(*m)?.parent != Some(target) { doc.reparent(*m, target, None)?; diff --git a/docs/auto-layout-parity.md b/docs/auto-layout-parity.md index f60cd4350..16776ca5e 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-03 · **Change:** patch (a Cmd/Ctrl-click on a padding field sets all four sides with the value typed, as the Guide to auto layout's shortcut guide says; Suggest auto layout is its own command, as the help center says: it adds as many auto layout frames as needed, splitting a frame's layers into rows or columns by the gaps between them, and keeps the placement of the design where the gaps are even (#1823); baseline alignment puts a layer without text with its bottom on the line, as the help center's figure shows an icon next to text (#1825); 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) +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-11-09 · **Change:** patch (a child dragged within its own auto layout row or column passes a sibling when its leading edge reaches the sibling's middle, as measured in Figma's web app, wherever it is grabbed; a Cmd/Ctrl-click on a padding field sets all four sides with the value typed, as the Guide to auto layout's shortcut guide says; Suggest auto layout is its own command, as the help center says: it adds as many auto layout frames as needed, splitting a frame's layers into rows or columns by the gaps between them, and keeps the placement of the design where the gaps are even (#1823); baseline alignment puts a layer without text with its bottom on the line, as the help center's figure shows an icon next to text (#1825); 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%, @@ -88,7 +88,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Absolute position (ignore auto layout) with constraints | done | | | Strokes included in layout (inside strokes), canvas stacking | done | | | On-canvas padding and gap handles, incl. wrap row/column gap and grid gaps | done | an automatic gap's handle shows the distance it has; dragging it fixes the gap from there (silent in the documentation) | -| Drag to reorder (wrap-aware, by row or column), into grid cells, across nested frames | done | `al_drag_tests.rs` | +| Drag to reorder (wrap-aware, by row or column), into grid cells, across nested frames | done | `al_drag_tests.rs`. A child dragged within its own row or column takes its slot by the dragged box's leading edge, not the pointer: it passes a sibling when the edge facing the drag reaches the sibling's middle (right or bottom edge going forward, left or top edge going back), wherever it was grabbed. Measured in Figma's web app, 2026-11-09 (three 60 x 60 rectangles, gap 20: after B at 50, after C at 130; the mirror for a leftward drag; the same along y). Layers dragged in from outside and wrapping layouts keep the pointer rule (unmeasured). Tests: `a_child_dragged_right_passes_a_sibling_when_its_leading_edge_reaches_the_siblings_middle`, `where_the_child_is_grabbed_does_not_change_its_slot`, `a_child_dragged_left_passes_a_sibling_by_its_left_edge`, `a_column_reorders_by_the_bottom_edge` | | Arrow keys move children one place (flows, rows, columns, grid cells, into neighbours) | done | `al_keys_tests.rs` | | Constraints: left, right, left and right, centre, scale; top/bottom likewise | done | | | Layout grids: columns, rows, grid; stretch/left/centre/right; variables bound | done | | @@ -104,6 +104,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | 2026-11-05 | patch | M2, #1823: Suggest auto layout is no longer Add auto layout under another name: `layout.suggest` splits a frame's layers into rows (Vertical) or else columns (Horizontal) by the gaps between their boxes, wraps each band of several layers in a new frame without fill or clipping that hugs it, and repeats inside it (16 levels, 1,000 layers per frame at most). The frame keeps its size; gap and padding come from the bands, so layers keep their boxes where the gaps are even and the bands start at the same offset; instances and layers inside them are refused; uneven gaps (smallest used), bands that start at different offsets across the flow (lined up at the smallest) and layers that overlap along both axes come back as `warnings`. A band frame hugs only when its own split succeeds: a band whose layers overlap along both axes gets no auto layout and stays Fixed, so it cannot reflow those children. `direction` sets the top level only; one undo step; `layout.add` is unchanged. Tests in `layout_suggest_tests.rs` | | 2026-11-02 | patch | M2: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. The modifier was ignored before. Test: `padding_individual_tests` | | 2026-11-03 | patch | M2, #1825: baseline alignment of a layer without text (an icon next to a text) puts its bottom on the line's baseline, as the help center's figure shows ("the bottoms of the icon and the word home are aligned on the red line"); it kept to the top of the line. A layer reaching below the text's baseline moves the text down, and a line with no text lines the layers' bottoms up (the documentation is silent; CSS baseline alignment does the same). Tests: `alignment_rules` (three cases), engine `baseline_alignment_puts_an_icons_bottom_on_the_text_baseline`. Numbers unchanged. | +| 2026-11-09 | patch | M2: a child dragged within its own auto layout row or column takes its slot by the dragged box's leading edge instead of the pointer, as measured in Figma's web app on 2026-11-09: it passes a sibling when the edge facing the drag reaches the sibling's middle, so the result no longer depends on where the child was grabbed. Several moving layers use their combined box. Dragging in from outside, wrapping layouts and grids are unchanged. Tests in `al_drag_tests.rs` | | 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` | From 2839497d629a359dc0d81d3ce42b75f230aa1719 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 01:21:43 -0500 Subject: [PATCH 062/239] M8: Shift+T picks the Annotation tool, which opens a layer's note in the Inspect tab (#1840) Adds ToolId::Annotation and tool.annotation {id?}. With a layer selected (or an id) it asks the UI for that layer's note at once; in the tool a press on a layer selects it and asks, a press on empty canvas does nothing, and the engine never writes the note. annotation.new shows the Inspect tab (not a toggle) and focuses the layer's new-note field once. The tool passes Developer Mode's gates and stays selected until V or Escape (inferred; Figma's placement, cursor and stay-in-tool behaviour are unmeasured). Docs, shortcut counts (137 documented, 136 bound) and tests updated. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/canvas/tools.rs | 6 ++- crates/engine/src/canvas/tools/pointer.rs | 15 +++++- crates/engine/src/catalog.rs | 1 + crates/engine/src/cmd/view.rs | 15 +++++- crates/engine/src/cursor_tests.rs | 1 + crates/engine/src/dev/devinspect.rs | 2 +- crates/engine/src/devmode_behaviour_tests.rs | 51 ++++++++++++++++++++ crates/engine/src/keymap.rs | 1 + crates/engine/src/keymap_tests.rs | 2 + crates/engine/src/shortcut_parity_tests.rs | 3 +- crates/ui-egui/locales/en.toml | 1 + crates/ui-egui/src/app/commands.rs | 8 +++ crates/ui-egui/src/dev_mode_tests.rs | 16 ++++++ crates/ui-egui/src/panels/dev_mode.rs | 8 +++ crates/ui-egui/src/toolbar.rs | 2 +- docs/dev-mode-parity.md | 5 +- docs/ui-parity.md | 10 ++-- 17 files changed, 135 insertions(+), 12 deletions(-) diff --git a/crates/engine/src/canvas/tools.rs b/crates/engine/src/canvas/tools.rs index a3284cd52..75e3fe972 100644 --- a/crates/engine/src/canvas/tools.rs +++ b/crates/engine/src/canvas/tools.rs @@ -58,6 +58,7 @@ pub enum ToolId { Text, TextOnPath, Comment, + Annotation, Eyedropper, ShapeBuilder, // Board tools. @@ -71,7 +72,7 @@ pub enum ToolId { } impl ToolId { - pub const ALL: [ToolId; 26] = [ + pub const ALL: [ToolId; 27] = [ ToolId::Move, ToolId::Scale, ToolId::Hand, @@ -89,6 +90,7 @@ impl ToolId { ToolId::Text, ToolId::TextOnPath, ToolId::Comment, + ToolId::Annotation, ToolId::Eyedropper, ToolId::ShapeBuilder, ToolId::Sticky, @@ -118,6 +120,7 @@ impl ToolId { ToolId::Text => "text", ToolId::TextOnPath => "textOnPath", ToolId::Comment => "comment", + ToolId::Annotation => "annotation", ToolId::Eyedropper => "eyedropper", ToolId::ShapeBuilder => "shapeBuilder", ToolId::Sticky => "sticky", @@ -151,6 +154,7 @@ impl ToolId { ToolId::Text => "Text", ToolId::TextOnPath => "Text on a path", ToolId::Comment => "Comment", + ToolId::Annotation => "Annotation", ToolId::Eyedropper => "Pick color", ToolId::ShapeBuilder => "Shape builder", ToolId::Sticky => "Sticky note", diff --git a/crates/engine/src/canvas/tools/pointer.rs b/crates/engine/src/canvas/tools/pointer.rs index fb802353e..356ded1dd 100644 --- a/crates/engine/src/canvas/tools/pointer.rs +++ b/crates/engine/src/canvas/tools/pointer.rs @@ -103,7 +103,7 @@ impl Session { /// The tool pointer events go to: in Dev Mode every tool but the hand and comments selects. fn acting_tool(&self) -> ToolId { match self.tool.tool { - t if self.tool.dev_mode && !matches!(t, ToolId::Hand | ToolId::Comment) => ToolId::Move, + t if self.tool.dev_mode && !matches!(t, ToolId::Hand | ToolId::Comment | ToolId::Annotation) => ToolId::Move, t => t, } } @@ -169,6 +169,7 @@ impl Session { self.request_ui("comment.new", json!({"x": ev.x, "y": ev.y})); Ok(()) } + ToolId::Annotation => self.annotation_down(ev), ToolId::Eyedropper => self.eyedrop(ev), t if t.on_boards() => self.board_down(ev), t if t.draws_shape() => self.draw_down(ev), @@ -199,6 +200,18 @@ impl Session { Ok(true) } + /// The Annotation tool's press: the layer under the pointer is selected and the UI is asked + /// for its note (the engine writes nothing; the note is typed in the Inspect tab). A press on + /// empty canvas does nothing. + fn annotation_down(&mut self, ev: &PointerEvent) -> Result<()> { + let ds = self.ds()?; + let (doc, page) = (ds.doc.clone(), ds.page); + let Some(id) = self.hit(&doc, page, ev.p(), ev.tol() * 2.0) else { return Ok(()) }; + self.set_selection(vec![id]); + self.request_ui("annotation.new", json!({"id": id})); + Ok(()) + } + pub(super) fn hover(&mut self, ev: &PointerEvent) -> Result<()> { let tool = self.acting_tool(); let ds = self.ds()?; diff --git a/crates/engine/src/catalog.rs b/crates/engine/src/catalog.rs index 576e42cb6..4236d3fad 100644 --- a/crates/engine/src/catalog.rs +++ b/crates/engine/src/catalog.rs @@ -291,6 +291,7 @@ pub static MENU: &[MenuItem] = &[ m!("Tools", "Pencil", "tool.pencil"), m!("Tools", "Text", "tool.text"), m!("Tools", "Comment", "tool.comment"), + m!("Tools", "Annotation", "tool.annotation"), m!("Tools", "Shape builder", "tool.shapeBuilder"), m!("Tools", "Actions", "app.actions"), ]; diff --git a/crates/engine/src/cmd/view.rs b/crates/engine/src/cmd/view.rs index 46ca701ff..3f13169de 100644 --- a/crates/engine/src/cmd/view.rs +++ b/crates/engine/src/cmd/view.rs @@ -528,7 +528,7 @@ pub fn specs() -> Vec { spec!( "tool.set", "Choose tool", - "{tool: move|scale|hand|frame|section|slice|rectangle|line|arrow|ellipse|polygon|star|pen|pencil|text|comment|shapeBuilder | on boards: sticky|shape|connector|marker|highlighter|eraser|stamp}", + "{tool: move|scale|hand|frame|section|slice|rectangle|line|arrow|ellipse|polygon|star|pen|pencil|text|comment|annotation|shapeBuilder | on boards: sticky|shape|connector|marker|highlighter|eraser|stamp}", false, |s, p| { let t = req_string("tool.set", p, "tool")?; @@ -638,6 +638,19 @@ pub fn specs() -> Vec { tool(s, ToolId::TextOnPath) }), spec!("tool.comment", "Comment", "{}", false, |s, _| tool(s, ToolId::Comment)), + // Shift+T: with a layer selected (or an `id`) the UI is asked for its note at once; in the + // tool, a press on a layer selects it and asks (the engine never writes the note). + spec!("tool.annotation", "Annotation", "{id?}", false, |s, p| { + let r = tool(s, ToolId::Annotation)?; + let first = crate::params::targets(s, p).into_iter().find(|i| s.doc().is_ok_and(|d| d.node(*i).is_some_and(|n| !n.is_page()))); + if let Some(id) = first { + if p.get("id").is_some() { + crate::cmd::edit::select_and_page(s, vec![id])?; + } + s.request_ui("annotation.new", json!({"id": id})); + } + Ok(r) + }), spec!("tool.shapeBuilder", "Shape builder", "{}", false, |s, _| tool(s, ToolId::ShapeBuilder)), // `apply: false` is for the UI colour picker: the eyedropper only samples (into // `ToolState::picked`) and the picker writes the colour to the paint it edits. diff --git a/crates/engine/src/cursor_tests.rs b/crates/engine/src/cursor_tests.rs index 86122c533..7c88e3f09 100644 --- a/crates/engine/src/cursor_tests.rs +++ b/crates/engine/src/cursor_tests.rs @@ -107,6 +107,7 @@ fn each_tool_has_its_cursor_by_modifier_and_what_is_under_the_pointer() { (ToolId::TextOnPath, NONE, ON_SQUARE_EDGE, Text, "the I-beam over a shape's path: a click puts text on it"), (ToolId::Pen, NONE, EMPTY, Pen(PenCursor::New), "the pen: a new point"), (ToolId::Comment, NONE, EMPTY, Comment, "the comment pin"), + (ToolId::Annotation, NONE, ON_SQUARE, Crosshair, "the annotation tool marks the layer it is pressed on"), (ToolId::Eyedropper, NONE, ON_SQUARE, Eyedropper, "the eyedropper"), ]; for (tool, m, at, want, why) in rows { diff --git a/crates/engine/src/dev/devinspect.rs b/crates/engine/src/dev/devinspect.rs index 3daf7d1b0..80b123bbb 100644 --- a/crates/engine/src/dev/devinspect.rs +++ b/crates/engine/src/dev/devinspect.rs @@ -230,7 +230,7 @@ pub fn dev_mode_allows(id: &str) -> bool { // Edits recorded as one grouped undo step, so their spec says no history of its own. const GROUPED: [&str; 1] = ["data.fill"]; match id.strip_prefix("tool.") { - Some(t) => matches!(t, "move" | "hand" | "comment"), + Some(t) => matches!(t, "move" | "hand" | "comment" | "annotation"), None if id == "file.revert" || GROUPED.contains(&id) => false, None => OWN.iter().any(|p| id.starts_with(p)) || crate::cmd::find_command(id).is_none_or(|c| !c.history), } diff --git a/crates/engine/src/devmode_behaviour_tests.rs b/crates/engine/src/devmode_behaviour_tests.rs index 47c33aa29..7f08179df 100644 --- a/crates/engine/src/devmode_behaviour_tests.rs +++ b/crates/engine/src/devmode_behaviour_tests.rs @@ -99,6 +99,56 @@ fn the_dev_mode_canvas_selects_and_pans_but_never_edits() { assert!(s.doc().unwrap().node(r).is_some_and(|n| n.transform.as_coeffs()[4] > 100.0), "moved"); } +/// The `annotation.new` requests queued so far, as the layer ids they name. +fn note_requests(s: &Session) -> Vec { + s.ui_requests.iter().filter(|r| r.kind == "annotation.new").filter_map(|r| crate::params::id_of(&r.data["id"])).collect() +} + +fn click(s: &mut Session, x: f64, y: f64) { + s.pointer(&ev(PointerKind::Down, x, y)).unwrap(); + s.pointer(&ev(PointerKind::Up, x, y)).unwrap(); +} + +#[test] +fn the_annotation_tool_picks_a_layer_and_asks_for_its_note() { + for dev_mode in [true, false] { + let mut s = Session::new(); + let f = frame(&mut s, 0.0, "Screen"); + let r = rect(&mut s, f, 20.0); + s.tool.dev_mode = dev_mode; + ex(&mut s, "select.set", json!({"ids": []})); + ex(&mut s, "tool.annotation", json!({})); + assert_eq!(s.tool.tool, ToolId::Annotation); + assert!(note_requests(&s).is_empty(), "nothing selected: no note is asked for yet"); + let (doc_before, undo_before) = (s.doc().unwrap().clone(), s.undo_labels(1000).len()); + // A press on empty canvas does nothing. + click(&mut s, 1000.0, 1000.0); + assert!(note_requests(&s).is_empty(), "empty canvas asks for nothing (dev_mode {dev_mode})"); + // A press on the rectangle selects it and asks for its note. + click(&mut s, 40.0, 40.0); + assert_eq!(s.selection(), vec![r], "dev_mode {dev_mode}"); + assert_eq!(note_requests(&s), vec![r], "dev_mode {dev_mode}"); + assert_eq!(s.tool.tool, ToolId::Annotation, "the tool stays until V or Escape"); + // The tool writes nothing. + assert_eq!(*s.doc().unwrap(), doc_before); + assert_eq!(s.undo_labels(1000).len(), undo_before); + } + // The keyboard flow: with a layer selected, choosing the tool asks at once. + let mut s = Session::new(); + let f = frame(&mut s, 0.0, "Screen"); + let r = rect(&mut s, f, 20.0); + ex(&mut s, "select.set", json!({"ids": [r]})); + ex(&mut s, "tool.annotation", json!({})); + assert_eq!(note_requests(&s), vec![r]); + // And with an `id`. + let mut s = Session::new(); + let f = frame(&mut s, 0.0, "Screen"); + let r = rect(&mut s, f, 20.0); + ex(&mut s, "tool.annotation", json!({"id": r})); + assert_eq!(note_requests(&s), vec![r]); + assert_eq!(s.selection(), vec![r]); +} + #[test] fn dev_mode_runs_its_own_edits_and_refuses_design_edits_from_menus_and_shortcuts() { for id in [ @@ -121,6 +171,7 @@ fn dev_mode_runs_its_own_edits_and_refuses_design_edits_from_menus_and_shortcuts "tool.move", "tool.hand", "tool.comment", + "tool.annotation", "inspect.code", ] { assert!(dev_mode_allows(id), "{id} runs in Dev Mode"); diff --git a/crates/engine/src/keymap.rs b/crates/engine/src/keymap.rs index e45ced8d4..11e7e316a 100644 --- a/crates/engine/src/keymap.rs +++ b/crates/engine/src/keymap.rs @@ -192,6 +192,7 @@ pub static KEYS: &[Binding] = &[ k(Tools, "tool.pencil", &["Shift+P"]), k(Tools, "tool.text", &["T"]), k(Tools, "tool.comment", &["C"]), + k(Tools, "tool.annotation", &["Shift+T"]), k(Tools, "tool.shapeBuilder", &["Shift+M"]), // Board tools (on boards only), on keys nothing else uses. k(Tools, "tool.sticky", &["Q"]), diff --git a/crates/engine/src/keymap_tests.rs b/crates/engine/src/keymap_tests.rs index 67c5bf258..59206c5ff 100644 --- a/crates/engine/src/keymap_tests.rs +++ b/crates/engine/src/keymap_tests.rs @@ -206,6 +206,8 @@ fn tool_keys_come_from_the_keymap() { assert_eq!(ToolId::Eyedropper.shortcut(), "I"); assert_eq!(ToolId::Polygon.shortcut(), ""); assert_eq!(crate::catalog::shortcut("tool.text"), Some("T")); + assert_eq!(ToolId::Annotation.shortcut(), "Shift+T"); + assert_eq!(crate::catalog::shortcut("tool.annotation"), Some("Shift+T")); } #[test] diff --git a/crates/engine/src/shortcut_parity_tests.rs b/crates/engine/src/shortcut_parity_tests.rs index ae73b022d..e15a164b8 100644 --- a/crates/engine/src/shortcut_parity_tests.rs +++ b/crates/engine/src/shortcut_parity_tests.rs @@ -110,6 +110,7 @@ static ROWS: &[Row] = &[ doc(Tools, "Pencil tool", &["Shift+P"], &[], Bound("tool.pencil"), ""), doc(Tools, "Text tool", &["T"], &[], Bound("tool.text"), ""), doc(Tools, "Comment mode", &["C"], &[], Bound("tool.comment"), ""), + doc(Tools, "Annotation tool", &["Shift+T"], &[], Bound("tool.annotation"), "Accessibility at Figma, Add an annotation; Developer Mode"), doc(Tools, "Hand tool while held", &["Space"], &[], Gesture("Pan the canvas"), "held, not pressed"), doc(Tools, "Pan with the arrows when nothing is selected (Shift: farther)", &["ArrowRight"], &[], Gesture("Pan with nothing selected (Shift: farther)"), "view.pan; nudges move the selection when there is one"), @@ -416,7 +417,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), (136, 135, 1, 0, 2, 57)); + assert_eq!((documented.len(), bound, moved, missing, reserved, pinned), (137, 136, 1, 0, 2, 57)); } #[test] diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index 625ee3bd8..dcfdb6ca1 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -122,6 +122,7 @@ name = "English" "Android Vector Drawable" = "Android Vector Drawable" "Angular" = "Angular" "Animation" = "Animation" +"Annotation" = "Annotation" "Annotations" = "Annotations" "Annotations shown on the canvas" = "Annotations shown on the canvas" "Another server, or one that needs its key. The usual server is set in Preferences." = "Another server, or one that needs its key. The usual server is set in Preferences." diff --git a/crates/ui-egui/src/app/commands.rs b/crates/ui-egui/src/app/commands.rs index abca326e5..e0481f3fc 100644 --- a/crates/ui-egui/src/app/commands.rs +++ b/crates/ui-egui/src/app/commands.rs @@ -266,6 +266,14 @@ impl FigApp { self.ui.comments.show(id); } } + "annotation.new" => { + // The Annotation tool: show the Inspect tab (never toggle it away) and put the + // caret in the layer's new-note field. + if let Some(id) = r.data.get("id").and_then(figcraft_engine::params::id_of) { + self.ui.right_tab = RightTab::Inspect; + self.ui.dev.focus_new_note = Some(id); + } + } "comment.new" => { let x = r.data.get("x").and_then(|v| v.as_f64()).unwrap_or(0.0); let y = r.data.get("y").and_then(|v| v.as_f64()).unwrap_or(0.0); diff --git a/crates/ui-egui/src/dev_mode_tests.rs b/crates/ui-egui/src/dev_mode_tests.rs index 4d497585e..844fe1bfe 100644 --- a/crates/ui-egui/src/dev_mode_tests.rs +++ b/crates/ui-egui/src/dev_mode_tests.rs @@ -196,3 +196,19 @@ fn the_playground_swaps_an_instance_in_the_preview_only() { let props = u.app.session.execute("component.properties", &json!({"id": inst})).unwrap(); assert_eq!(props["properties"][0]["value"], json!(heart.0), "{star:?}"); } + +#[test] +fn the_annotation_tool_opens_the_inspect_tab_with_the_note_field_focused() { + let (mut u, _, r) = setup(); + u.app.ui.right_tab = crate::RightTab::Design; + u.frames(2, Vec::new); + u.run("tool.annotation", json!({"id": r})); + u.frames(2, Vec::new); + assert_eq!(u.app.ui.right_tab, crate::RightTab::Inspect, "the request shows the Inspect tab"); + let field = egui::Id::unique(("annot_new", r)).with("te"); + assert!(u.ctx.memory(|m| m.has_focus(field)), "the layer's new-note field has the caret"); + assert_eq!(u.app.ui.dev.focus_new_note, None, "the focus request is spent"); + // Asking again while already on the Inspect tab does not toggle it away. + u.run("tool.annotation", json!({"id": r})); + assert_eq!(u.app.ui.right_tab, crate::RightTab::Inspect); +} diff --git a/crates/ui-egui/src/panels/dev_mode.rs b/crates/ui-egui/src/panels/dev_mode.rs index bcb97edbb..09c3b9732 100644 --- a/crates/ui-egui/src/panels/dev_mode.rs +++ b/crates/ui-egui/src/panels/dev_mode.rs @@ -92,6 +92,9 @@ impl CategoryFilter { /// revision), the page or the choice change. #[derive(Default)] pub struct DevUi { + /// The layer whose new-note field takes the keyboard focus once its section draws (the + /// Annotation tool asked for that layer's note). + pub focus_new_note: Option, pub filter: usize, pub categories: CategoryFilter, pub compare: Option, @@ -618,6 +621,11 @@ pub fn annotations_section(app: &mut FigApp, ui: &mut Ui, doc: &Document, id: No } ui.add_space(6.0); } + // The Annotation tool asked for this layer's note: put the caret in the new-note field, once. + if app.ui.dev.focus_new_note == Some(id) { + app.ui.dev.focus_new_note = None; + ui.memory_mut(|m| m.request_focus(Id::unique(("annot_new", id)).with("te"))); + } // A new annotation starts as a note; properties are pinned to it afterwards. if n.annotations.len() < annotations::MAX_PER_LAYER && let Some(label) = widgets::multiline_field(ui, Id::unique(("annot_new", id)), "", tr("Add an annotation for developers"), 1) diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs index 7aff24993..cbe065c22 100644 --- a/crates/ui-egui/src/toolbar.rs +++ b/crates/ui-egui/src/toolbar.rs @@ -627,7 +627,7 @@ fn flyout(app: &mut FigApp, ui: &mut Ui, g: &Group, bottom_left: egui::Pos2) { /// Choose `tool` from the toolbar. Dev Mode only inspects: a tool that edits leaves it for the /// design. fn choose(app: &mut FigApp, tool: ToolId) { - if app.ui.right_tab == crate::RightTab::Inspect && !matches!(tool, ToolId::Move | ToolId::Hand | ToolId::Comment) { + if app.ui.right_tab == crate::RightTab::Inspect && !matches!(tool, ToolId::Move | ToolId::Hand | ToolId::Comment | ToolId::Annotation) { app.ui.right_tab = crate::RightTab::Design; } app.run("tool.set", json!({"tool": tool.id()})); diff --git a/docs/dev-mode-parity.md b/docs/dev-mode-parity.md index 87dc3739f..66ef3a0ae 100644 --- a/docs/dev-mode-parity.md +++ b/docs/dev-mode-parity.md @@ -1,6 +1,6 @@ # Dev Mode parity -> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-07 · **Change:** patch (the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; class names transliterate non-ASCII layer names (#1235); measurements kept on the canvas; a read-only layers panel in Dev Mode; earlier: import lines in generated layer trees; compare with any saved version; Dev Mode behaviour suite: an inspect-only canvas, Changed in the ready list, statuses only on frames and sections; plugin panels from the Inspect tab) · **Target:** Figma Design Dev Mode (desktop app 126.10.7) +> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-09 · **Change:** patch (the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the Inspect tab then opens (never toggles away) with the caret in that layer's new-note field, and the engine never writes the note itself (#1840); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; class names transliterate non-ASCII layer names (#1235); measurements kept on the canvas; a read-only layers panel in Dev Mode; earlier: import lines in generated layer trees; compare with any saved version; Dev Mode behaviour suite: an inspect-only canvas, Changed in the ready list, statuses only on frames and sections; plugin panels from the Inspect tab) · **Target:** Figma Design Dev Mode (desktop app 126.10.7) **Breadth ~98%, ready ~78% (estimated).** The inspect surface is broad, components connect to the code components of a repository (with their imports, also inside generated layer trees), @@ -15,7 +15,7 @@ repository, third-party integrations. Remaining: 1–2 h. | Properties with their styles and variables; redlines on hover | done | positions from the frame around the layer (groups aren't frames), rotation, radius (CSS corner order), opacity, blend; colours in hex, RGB, CSS, HSL or HSB (`inspect.properties {colorFormat}`, the Inspect tab's Color format) | | Code: CSS, iOS (SwiftUI), Android (Compose), Flutter | done | plus HTML, React, Vue and Leptos (ours; Leptos: `#[component]` functions with `#[prop]` defaults, variant enums and `view!` markup; Flutter is ours too: a `StatelessWidget` for a component, a widget tree for a layer); components take properties as parameters, instances are calls; CSS in px or rem (`inspect.code {unit, rootFontSize}`), with rotation, blend modes, gradient directions and kinds (linear, radial, conic), text alignment, case and decoration; class names from layer names transliterate non-ASCII scripts into readable ASCII (로그인 화면 → `rogeuin-hwamyeon`, кнопка → `knopka`, über → `uber`; symbols-only names take the node's kind, `.text`), and the 40-character cut lands on a word boundary (#1235) | | Assets list with export | done | layers with export settings, icons (small, vector shapes only: SVG) and images (PNG); the icon rule is ours | -| Annotations: pinned properties, categories, coloured callouts, filter | done | | +| Annotations: pinned properties, categories, coloured callouts, filter | done | the Annotation tool (Shift+T, `tool.annotation`) picks a layer by a click or from the selection and opens its note field in the Inspect tab. Figma's placement, cursor and whether the tool stays selected are unmeasured (Developer Mode is paywalled in the web app); staying selected until V or Escape, like the Comment tool, is inferred, and there is no toolbar button or icon yet | | Ready for dev list, statuses, "Changed" after edits | done | the list filters Ready for dev, Changed, Completed or any, and badges changed ones (`inspect.readyForDev {status: changed}`, `changed` per item); only sections and frames at the top of a page or section take a status (others are refused) | | Focus view (one frame, previous / next) | done | | | Compare changes (before/after side by side or overlaid, property diffs) | done | against the snapshot taken when a frame was first changed after it was marked ready, or any saved version (`dev.compare {version}`; the view's Compare with menu); a frame that isn't ready for dev compares with versions | @@ -29,6 +29,7 @@ repository, third-party integrations. Remaining: 1–2 h. | Date | Change | Summary | |---|---|---| +| 2026-11-09 | patch | The Annotation tool (Shift+T, `tool.annotation {id?}`): selects the layer pressed on (or the selection, or `id`) and asks the UI for its note, which the Inspect tab takes in its new-note field; the engine writes nothing itself, and Developer Mode lets the tool through its gates (#1840). Figma's placement, cursor and whether the tool stays selected are unmeasured (Developer Mode is paywalled in the web app); staying selected until V or Escape, like the Comment tool, is inferred, and there is no toolbar button or icon yet | | 2026-10-30 | minor | Gap 16: `figcraft-cli connect publish [--mappings figcraft.connect.json] [--dry-run]` publishes a code repository's mappings to a design file (as the incumbent's Code Connect CLI publishes a repository's mappings): it links each entry's component or set by name, warns about and skips links that don't fit, saves the file in place through the engine's save (or not, with `--dry-run`) and fails when nothing links. Dev Mode breadth (~98%) and ready (~78%) unchanged at this rounding; hours unchanged | | 2026-10-26 | minor | Class names from layer names transliterate non-ASCII scripts (#1235): `class_name` runs names through `deunicode` (new dependency: pure Rust tables, zero deps, BSD-3-Clause), so Korean, Cyrillic, Latin-diacritic and CJK names become readable ASCII classes in HTML/CSS/React/Leptos output, component roots and `data-*` variant attributes (`rogeuin-hwamyeon`, `knopka`, `uber`, `an-niu`; before, every one of them came out `layer-`); symbols-only names take the node's kind (`.text`, `.frame`) instead of `layer-`, and the 40-character cut lands on a word boundary. ASCII-only names are unchanged. `html_codegen_tests` updated (its diacritics expectation improves from `layer-1-n-code-name` to `layer-1-unicode-name`) and extended. Percentages and hours unchanged | | 2026-10-24 | minor | Dev Mode refuses design edits from files dropped on the canvas (a dropped document still opens as a file of its own, and the drop overlay shows the Dev Mode note for other files), from the Pages list's add, rename, reorder, duplicate and delete, and from the Assets panel's place, drag, Alt-drop swap, style, Hide when publishing, Update, and adding, removing and swapping libraries. Percentages and hours unchanged | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..dce471ca9 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** minor (the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the Inspect tab then opens (never toggles away) with the caret in that layer's new-note field, and the engine never writes the note itself (#1840); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -101,6 +101,7 @@ interaction feel not yet compared. | 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 | +| Annotation tool (Shift+T) | done | picks the layer under the pointer, or the selection (or an `id`) with `tool.annotation`, and opens its note in the Inspect tab with the new-note field focused; it works in Developer Mode and in Design mode, and stays selected until V or Escape (inferred). Figma's placement, cursor and whether the tool stays selected are unmeasured (Developer Mode is paywalled in the web app); staying selected until V or Escape, like the Comment tool, is inferred, and there is no toolbar button or icon yet | | 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 | | Stretch and scatter brushes (Figma Draw) | done | eight presets drawn in code; the Pencil's brush is set by `tool.pencilBrush`, not from the toolbar | | Image crop handles; Crop image | done | Object ▸ Crop image, the right-click menu and the crop button on an image fill row (`image.crop`) switch the image to Crop where it already shows and enter crop mode: the whole image shows, dimmed outside the layer; the layer's box carries L-shaped corner brackets and edge bars in the selection colour (in place of the square handles), and its edges and corners crop it with the picture held still (as Cmd/Ctrl-resizing does anywhere), the image drags to move and its corners scale it (Shift: freely); Enter, Escape or a click outside finishes (`image_crop_tests`, `crop_image_tests`). Not compared side by side | @@ -137,9 +138,9 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | | Count | Notes | |---|---|---| -| Documented shortcuts (rows) | 136 | each with macOS and Windows/Linux keys | -| Bound as documented | 135 (110 before this suite) | 112 keymap bindings, 15 held keys, gestures and presentation keys, 6 vector edit tool keys | -| Bound as documented | 135 (110 before this suite) | 112 keymap bindings, 16 held keys, gestures and presentation keys, 6 vector edit tool keys | +| Documented shortcuts (rows) | 137 | each with macOS and Windows/Linux keys | +| Bound as documented | 136 (110 before this suite) | 113 keymap bindings, 15 held keys, gestures and presentation keys, 6 vector edit tool keys | +| Bound as documented | 136 (110 before this suite) | 113 keymap bindings, 16 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 | @@ -187,6 +188,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-09 | minor | Shortcuts: Shift+T picks the new Annotation tool (`tool.annotation {id?}`, Accessibility at Figma, Add an annotation): with a layer selected, or an `id`, it asks the UI for that layer's note at once; in the tool a press on a layer selects it and asks, a press on empty canvas does nothing; the Inspect tab opens with the caret in the new-note field and the engine writes nothing itself; documented shortcuts 137, bound 136 (#1840). Figma's placement, cursor and whether the tool stays selected are unmeasured (Developer Mode is paywalled in the web app); staying selected until V or Escape, like the Comment tool, is inferred, and there is no toolbar button or icon yet | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 8b15c00f8487d53694f8db94fed604a8ac2d80cd Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 01:22:52 -0500 Subject: [PATCH 063/239] M8: the MCP pointer tool lists the Annotation tool (#1840) Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/mcp/src/tools.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/mcp/src/tools.rs b/crates/mcp/src/tools.rs index 9e901f5bb..079789caa 100644 --- a/crates/mcp/src/tools.rs +++ b/crates/mcp/src/tools.rs @@ -336,7 +336,7 @@ fn tools() -> Vec { "y": num("Page y"), "to": {"type": "array", "items": {"type": "number"}, "minItems": 2, "maxItems": 2, "description": "Drag end [x, y] (page)"}, "steps": int("Intermediate move events for drag (default 8)"), - "tool": {"type": "string", "description": "Tool to choose first: move|scale|hand|frame|section|slice|rectangle|line|arrow|ellipse|polygon|star|pen|pencil|text|comment"}, + "tool": {"type": "string", "description": "Tool to choose first: move|scale|hand|frame|section|slice|rectangle|line|arrow|ellipse|polygon|star|pen|pencil|text|comment|annotation"}, "shift": boolean("Shift held"), "alt": boolean("Alt/Option held"), "cmd": boolean("Cmd (macOS) / Ctrl held"), From 7e2752d577543b8424bee8cd4dc44b5d79f1b6fa Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 01:34:38 -0500 Subject: [PATCH 064/239] M4: a text style made from a whole layer counts a trailing empty paragraph's wrap style (#2094 review) `paragraph_style` compared the paragraphs `para_span` gives for the whole text, which leaves out an empty paragraph after a final newline, so Balance paragraphs over an Auto trailing one made a Balance style. It now compares every paragraph by index, as the list style does. The parity row says the wrap styles are lost through a .fig round trip. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/doc/src/text.rs | 16 +++++++++++++++- docs/ui-parity.md | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/doc/src/text.rs b/crates/doc/src/text.rs index 48f690b8a..5ee10f5df 100644 --- a/crates/doc/src/text.rs +++ b/crates/doc/src/text.rs @@ -945,7 +945,9 @@ impl TextData { Some(first) if self.paragraphs.iter().all(|p| p.list == first.list) => first.list, _ => self.list, }; - let wrap_style = self.common_wrap_style(0, self.char_count()).unwrap_or(self.wrap_style); + // Every paragraph by index: `para_span` leaves out an empty one after a final newline. + let first = self.para_wrap_style(0); + let wrap_style = if (1..self.paragraph_count()).all(|p| self.para_wrap_style(p) == first) { first } else { self.wrap_style }; ParagraphStyle { paragraph_spacing: self.paragraph_spacing, paragraph_indent: self.paragraph_indent, @@ -1259,4 +1261,16 @@ mod whole_text_paragraph_style_tests { plain.take_paragraph_style(&ps); assert_eq!((plain.list, plain.paragraphs.len()), (t.list, t.paragraphs.len())); } + + #[test] + fn a_style_made_from_the_whole_layer_counts_a_trailing_empty_paragraphs_wrap_style() { + // The first two paragraphs are Balance, the empty one after the final newline keeps the + // layer's Auto: they differ, so the style takes the layer's wrap style, not Balance. + let mut t = TextData::new("a\nb\n"); + t.set_para_wrap_styles(0, 3, WrapStyle::Balance); + assert_eq!((t.para_wrap_style(0), t.para_wrap_style(1), t.para_wrap_style(2)), (WrapStyle::Balance, WrapStyle::Balance, WrapStyle::Auto)); + assert_eq!(t.paragraph_style().wrap_style, WrapStyle::Auto); + t.set_para_wrap_styles(4, 4, WrapStyle::Balance); + assert_eq!(t.paragraph_style().wrap_style, WrapStyle::Balance, "all three Balance"); + } } diff --git a/docs/ui-parity.md b/docs/ui-parity.md index ff51a7fcf..fb203d4dd 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -96,7 +96,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); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | | 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: wrap style (Auto, Balance, Pretty) | done | per text layer (`wrapStyle` on `node.set`, `text.wrapStyle`, the Type settings control under Vertical trim, inspect, CSS `text-wrap: balance` or `pretty`): Auto breaks greedily; Balance narrows each paragraph as far as it goes without another line, so its lines come out close to the same length (what browsers do for `text-wrap: balance`); Pretty keeps lines full and, when the last line is one word, narrows one of the last four lines just enough to give a word to the lines after it (Explore text properties: "Auto: Figma fits as many words as possible on each line before wrapping to the next", "Balance: Figma distributes text as evenly as possible across every line, so each line is close to the same length", "Pretty: Figma keeps each line full, but adjusts the last four lines to avoid an orphan"). Saved line breaks from a file still win. At three levels, as "You can apply a wrap style at three levels: Text layer, Paragraph, Text style" says: the paragraph level is the caret's or the selection's paragraphs while editing (`text.wrapStyle`; the control follows them), or `start`/`end` on `node.set wrapStyle` (a paragraph's own style beats the layer's; setting the layer sets every paragraph again; Enter carries it to the new paragraph; inspect reports `lineWrapStyles` when paragraphs differ and CSS `text-wrap` only when they agree); the text-style level is a style's `wrapStyle` (shown read-only in the style editor, applied with the style, moved by `style.update`, unlinking when edited). The `.fig` import/export mapping stays open (#1827). Test: `text_behaviour_tests::wrap_style_per_paragraph_overrides_the_layers`, `styles_behaviour_tests::text_styles_carry_the_wrap_style`, `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented` | +| Text: wrap style (Auto, Balance, Pretty) | done | per text layer (`wrapStyle` on `node.set`, `text.wrapStyle`, the Type settings control under Vertical trim, inspect, CSS `text-wrap: balance` or `pretty`): Auto breaks greedily; Balance narrows each paragraph as far as it goes without another line, so its lines come out close to the same length (what browsers do for `text-wrap: balance`); Pretty keeps lines full and, when the last line is one word, narrows one of the last four lines just enough to give a word to the lines after it (Explore text properties: "Auto: Figma fits as many words as possible on each line before wrapping to the next", "Balance: Figma distributes text as evenly as possible across every line, so each line is close to the same length", "Pretty: Figma keeps each line full, but adjusts the last four lines to avoid an orphan"). Saved line breaks from a file still win. At three levels, as "You can apply a wrap style at three levels: Text layer, Paragraph, Text style" says: the paragraph level is the caret's or the selection's paragraphs while editing (`text.wrapStyle`; the control follows them), or `start`/`end` on `node.set wrapStyle` (a paragraph's own style beats the layer's; setting the layer sets every paragraph again; Enter carries it to the new paragraph; inspect reports `lineWrapStyles` when paragraphs differ and CSS `text-wrap` only when they agree); the text-style level is a style's `wrapStyle` (shown read-only in the style editor, applied with the style, moved by `style.update`, unlinking when edited). The `.fig` import/export mapping stays open (#1827): a `.fig` export leaves the wrap styles out and a `.fig` import reads every text as Auto, so the wrap styles are lost through a `.fig` round trip. Test: `text_behaviour_tests::wrap_style_per_paragraph_overrides_the_layers`, `styles_behaviour_tests::text_styles_carry_the_wrap_style`, `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented` | | Text: direction override (Text ▸ Text direction) | done | per paragraph (`ParaList::direction`: auto, ltr, rtl): Text ▸ Text direction ▸ Auto / Left to right / Right to left and `text.direction {direction, ids?}` set the edited paragraphs while editing, else every paragraph of the selected texts; `node.set textDirection` the layer's (or the chars `start`/`end` name); the Type settings control appears once a right-to-left script is in the text or a direction is forced; inspect reports `textDirection` when the paragraphs agree and `lineDirections` otherwise; Developer Mode's CSS writes `direction: ltr` or `rtl` when every paragraph is forced the same way (with `text-align: left` beside `rtl`, as Left is absolute on the canvas); `.fig` import and export carry each line's `sourceDirectionality`, read up to the paragraph count. Layout gives the paragraph its base level, so a forced right-to-left paragraph of Latin letters starts at the right, mirrors its list gutter and indent and orders its runs right to left, and a forced left-to-right paragraph of Hebrew the other way ("By default, Figma automatically handles text direction based on language detection. However, controls are available to override text direction per paragraph", "Go to Text > Text direction. Select Left to right or Right to left", Add right-to-left text). Not included: a direction in text styles (the article names none). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests` | | 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`) | From 6fce958ae68a6d04fdf8ab05a3822b97173dbf6f Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 02:53:44 -0500 Subject: [PATCH 065/239] M8: Preferences > Invert zoom direction reverses wheel zoom (#2145) Adds the invert_zoom preference and the pref.invertZoom command, a checkbox in the Preferences window after Scroll wheel zoom. With it on, Cmd/Ctrl+wheel and a plain mouse wheel (with Scroll wheel zoom on) zoom the other way by the same factor; a pinch and panning are unchanged. Documented in docs/ui-parity.md. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 measured and wrote at medium --- crates/engine/src/a11y_keys_tests.rs | 16 ++++++ crates/engine/src/cmd/view.rs | 7 +++ crates/engine/src/prefs.rs | 4 ++ crates/ui-egui/locales/en.toml | 1 + crates/ui-egui/src/canvas/input.rs | 12 ++++- crates/ui-egui/src/canvas/wheel_zoom_tests.rs | 50 ++++++++++++++++++- crates/ui-egui/src/dialogs.rs | 1 + docs/ui-parity.md | 5 +- 8 files changed, 91 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/a11y_keys_tests.rs b/crates/engine/src/a11y_keys_tests.rs index e4892bcae..5dd604670 100644 --- a/crates/engine/src/a11y_keys_tests.rs +++ b/crates/engine/src/a11y_keys_tests.rs @@ -103,3 +103,19 @@ fn a_settings_file_without_or_with_a_wrong_interface_size_reads_as_the_systems_s let p: crate::Prefs = serde_json::from_value(json!({"ui_scale": 99, "theme": "dark"})).unwrap(); assert_eq!((p.ui_scale, p.theme.as_str()), (crate::UI_SCALE_MAX, "dark")); } + +#[test] +fn the_invert_zoom_preference_toggles_and_is_saved() { + let mut s = Session::new(); + assert!(!s.prefs.invert_zoom, "off by default"); + assert_eq!(s.execute("pref.invertZoom", &json!({})).unwrap()["on"], true); + assert!(s.prefs.invert_zoom); + let saved = serde_json::to_value(&s.prefs).unwrap(); + assert_eq!(saved["invert_zoom"], true); + let loaded: crate::Prefs = serde_json::from_value(saved).unwrap(); + assert!(loaded.invert_zoom); + assert_eq!(s.execute("pref.invertZoom", &json!({"on": false})).unwrap()["on"], false); + // Preferences saved before the setting existed read it as off. + let old: crate::Prefs = serde_json::from_value(json!({"theme": "dark"})).unwrap(); + assert!(!old.invert_zoom); +} diff --git a/crates/engine/src/cmd/view.rs b/crates/engine/src/cmd/view.rs index 46ca701ff..2f2ec3e1f 100644 --- a/crates/engine/src/cmd/view.rs +++ b/crates/engine/src/cmd/view.rs @@ -410,6 +410,13 @@ pub fn specs() -> Vec { false, |s, p| pref(s, p, |x| &mut x.scroll_wheel_zoom) ), + spec!( + "pref.invertZoom", + "Invert zoom direction", + "{on?} reverses wheel zoom: Cmd/Ctrl+wheel, and a plain mouse wheel with Scroll wheel zoom on, zoom out where they would zoom in (a trackpad pinch and panning are unchanged) → {on}", + false, + |s, p| pref(s, p, |x| &mut x.invert_zoom) + ), spec!("pref.reduceMotion", "Reduce motion", "{on?}", false, |s, p| pref(s, p, |x| &mut x.reduce_motion)), spec!( "pref.uiScale", diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs index 48d68a901..4225963f5 100644 --- a/crates/engine/src/prefs.rs +++ b/crates/engine/src/prefs.rs @@ -36,6 +36,9 @@ pub struct Prefs { /// A mouse wheel zooms the canvas about the pointer, and Cmd/Ctrl+wheel scrolls it (off: the /// other way round). Trackpads are unchanged. pub scroll_wheel_zoom: bool, + /// Wheel zoom goes the other way: Cmd/Ctrl+wheel (and a plain mouse wheel with Scroll wheel + /// zoom on) zooms out where it would zoom in. A trackpad pinch is unchanged. + pub invert_zoom: bool, /// "system" by default; an explicit "light" or "dark" choice stays saved. pub theme: String, /// The widths of the main window's left and right panels (the interface keeps them within its @@ -136,6 +139,7 @@ impl Default for Prefs { number_keys_opacity: true, show_dimensions: true, scroll_wheel_zoom: false, + invert_zoom: false, theme: "system".into(), panel_widths: (240.0, 240.0), pages_height: None, diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index 625ee3bd8..f3ce19403 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -882,6 +882,7 @@ name = "English" "Pasted design layers; the clipboard didn't carry the images of: {layers}" = "Pasted design layers; the clipboard didn't carry the images of: {layers}" "Remove these results from the file" = "Remove these results from the file" "Scroll wheel zoom" = "Scroll wheel zoom" +"Invert zoom direction" = "Invert zoom direction" "Shared by your team on {server}" = "Shared by your team on {server}" "Slot name" = "Slot name" "Mar" = "Mar" diff --git a/crates/ui-egui/src/canvas/input.rs b/crates/ui-egui/src/canvas/input.rs index 5187fe866..b4cff10aa 100644 --- a/crates/ui-egui/src/canvas/input.rs +++ b/crates/ui-egui/src/canvas/input.rs @@ -81,10 +81,18 @@ fn wheel_zoom(app: &mut FigApp, ctx: &egui::Context, zoom: f32, shift: bool) -> if let Some(mouse) = latest { app.canvas.wheel_is_mouse = mouse; } + let invert = app.session.prefs.invert_zoom && !pinch; if !app.session.prefs.scroll_wheel_zoom || !app.canvas.wheel_is_mouse || pinch { - return (wheel, zoom); + return (wheel, if invert { invert_zoom_factor(zoom) } else { zoom }); } - swap_wheel(wheel, zoom, shift, speed) + let (scroll, zoom) = swap_wheel(wheel, zoom, shift, speed); + (scroll, if invert { invert_zoom_factor(zoom) } else { zoom }) +} + +/// The zoom factor for the opposite direction (Preferences ▸ Invert zoom direction): its +/// reciprocal. A factor that is zero, negative or not finite is left as it is. +pub(crate) fn invert_zoom_factor(zoom: f32) -> f32 { + if zoom.is_finite() && zoom > 0.0 { 1.0 / zoom } else { zoom } } /// Whether a scroll event came from a mouse wheel. Only macOS says which device scrolled; elsewhere diff --git a/crates/ui-egui/src/canvas/wheel_zoom_tests.rs b/crates/ui-egui/src/canvas/wheel_zoom_tests.rs index 5b196a4d4..7574e96a4 100644 --- a/crates/ui-egui/src/canvas/wheel_zoom_tests.rs +++ b/crates/ui-egui/src/canvas/wheel_zoom_tests.rs @@ -6,7 +6,7 @@ use egui::{Event, Modifiers, MouseWheelSource, MouseWheelUnit, Pos2, RawInput, R use figcraft_engine::Session; use serde_json::json; -use super::input::{is_mouse_wheel, swap_wheel}; +use super::input::{invert_zoom_factor, is_mouse_wheel, swap_wheel}; use crate::{FigApp, NoServices}; /// The view's zoom, cx and cy. @@ -25,8 +25,13 @@ fn wheel(unit: MouseWheelUnit, dy: f32, modifiers: Modifiers) -> Event { impl Canvas { fn new(scroll_wheel_zoom: bool) -> Self { + Self::with_invert(scroll_wheel_zoom, false) + } + + fn with_invert(scroll_wheel_zoom: bool, invert_zoom: bool) -> Self { let mut c = Self { ctx: egui::Context::default(), app: FigApp::new(Session::new(), Box::new(NoServices)), time: 0.0 }; c.app.run("pref.scrollWheelZoom", json!({"on": scroll_wheel_zoom})); + c.app.run("pref.invertZoom", json!({"on": invert_zoom})); for _ in 0..3 { c.frame(vec![], Modifiers::NONE); } @@ -126,3 +131,46 @@ fn the_swap_keeps_egui_rates() { assert_eq!(swap_wheel(vec2(40.0, 0.0), 1.0, true, speed), (vec2(40.0, 0.0), 1.0)); assert_eq!(swap_wheel(Vec2::ZERO, 1.0, false, speed), (Vec2::ZERO, 1.0)); } + +#[test] +fn invert_zoom_reverses_cmd_or_ctrl_wheel_by_the_same_factor() { + let (mut off, mut on) = (Canvas::with_invert(false, false), Canvas::with_invert(false, true)); + let (a, b, _) = off.gesture(wheel(MouseWheelUnit::Line, 3.0, Modifiers::COMMAND), Modifiers::COMMAND); + let (c, d, _) = on.gesture(wheel(MouseWheelUnit::Line, 3.0, Modifiers::COMMAND), Modifiers::COMMAND); + assert!(b.0 > a.0 * 1.05, "off zooms in: {a:?} -> {b:?}"); + assert!(d.0 < c.0 / 1.05, "on zooms out: {c:?} -> {d:?}"); + assert!(((b.0 / a.0) * (d.0 / c.0) - 1.0).abs() < 1e-3, "by the same factor"); +} + +#[test] +fn invert_zoom_reverses_a_plain_mouse_wheel_with_scroll_wheel_zoom_on() { + let (mut off, mut on) = (Canvas::with_invert(true, false), Canvas::with_invert(true, true)); + let (a, b, _) = off.gesture(wheel(MouseWheelUnit::Line, 3.0, Modifiers::NONE), Modifiers::NONE); + let (c, d, _) = on.gesture(wheel(MouseWheelUnit::Line, 3.0, Modifiers::NONE), Modifiers::NONE); + assert!(b.0 > a.0 * 1.05, "off zooms in: {a:?} -> {b:?}"); + assert!(d.0 < c.0 / 1.05, "on zooms out: {c:?} -> {d:?}"); + assert!(((b.0 / a.0) * (d.0 / c.0) - 1.0).abs() < 1e-3, "by the same factor"); + // Without Scroll wheel zoom a plain wheel still scrolls, inverted or not. + let mut plain = Canvas::with_invert(false, true); + let (a, b, _) = plain.gesture(wheel(MouseWheelUnit::Line, -3.0, Modifiers::NONE), Modifiers::NONE); + assert!((b.0 - a.0).abs() < 1e-9 && b.2 > a.2 + 1.0, "scrolls: {a:?} -> {b:?}"); +} + +#[test] +fn a_pinch_zooms_the_same_with_invert_zoom_on_and_off() { + for invert in [false, true] { + let mut c = Canvas::with_invert(false, invert); + let (a, b, _) = c.gesture(Event::Zoom(1.5), Modifiers::NONE); + assert!((b.0 / a.0 - 1.5).abs() < 1e-3, "invert {invert}: {a:?} -> {b:?}"); + } +} + +#[test] +fn the_inverted_factor_is_the_reciprocal_and_guards_bad_values() { + assert!((invert_zoom_factor(2.0) - 0.5).abs() < 1e-6); + assert_eq!(invert_zoom_factor(1.0), 1.0); + for bad in [0.0, -1.0, f32::NAN, f32::INFINITY] { + let r = invert_zoom_factor(bad); + assert!(r == bad || (r.is_nan() && bad.is_nan()), "{bad} left alone"); + } +} diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 52170af44..e60928fd1 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -246,6 +246,7 @@ pub fn show(app: &mut FigApp, ctx: &Context) { (tr("Show dimensions on objects"), prefs.show_dimensions, "pref.showDimensions"), (tr("Use number keys for opacity"), prefs.number_keys_opacity, "pref.numberKeysOpacity"), (tr("Scroll wheel zoom"), prefs.scroll_wheel_zoom, "pref.scrollWheelZoom"), + (tr("Invert zoom direction"), prefs.invert_zoom, "pref.invertZoom"), (tr("Reduce motion"), prefs.reduce_motion, "pref.reduceMotion"), ] { if crate::widgets::checkbox(ui, val, label) { diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..6984cf8b0 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** patch (Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -109,7 +109,7 @@ interaction feel not yet compared. | Item | Status | Notes | |---|---|---| -| Pan/zoom: wheel, pinch, Space-drag, Shift+0/1/2, Cmd+0, `+`/`-` | done | Shift-wheel pans sideways, pinch and the zoom tool keep the point under the pointer; Preferences ▸ Scroll wheel zoom makes a mouse wheel zoom about the pointer and Cmd/Ctrl+wheel scroll (a wheel told from a trackpad by the device macOS reports, elsewhere by line versus pixel steps; #1390); zoom steps, limits (2%–25,600%) and frame order pinned where the documentation is silent (`view_behaviour_tests`) | +| Pan/zoom: wheel, pinch, Space-drag, Shift+0/1/2, Cmd+0, `+`/`-` | done | Shift-wheel pans sideways, pinch and the zoom tool keep the point under the pointer; Preferences ▸ Scroll wheel zoom makes a mouse wheel zoom about the pointer and Cmd/Ctrl+wheel scroll (a wheel told from a trackpad by the device macOS reports, elsewhere by line versus pixel steps; #1390); Preferences ▸ Invert zoom direction (Figma's Preferences menu has it, checked 2026-11-09; #2145) reverses wheel zoom: Cmd/Ctrl+wheel, and a plain mouse wheel with Scroll wheel zoom on, zoom out where they would zoom in, by the same factor, while a trackpad pinch and panning are unchanged (only the setting's existence was measured, so the pinch is left alone); zoom steps, limits (2%–25,600%) and frame order pinned where the documentation is silent (`view_behaviour_tests`) | | Rulers and guides (drag out, move, remove; rotated frames; frame guides) | done | guides belong to the page or a top-level frame (a frame moved into another keeps its guides but they stop applying); a click selects one for Delete, the arrows or the context menu's Remove guide; Alt-drag drops a copy; Alt while dragging measures to the layers in the frame it crosses; ruler numbering checked by eye only | | Frame labels (rotated, right-to-left), size badge | done | | | Outline mode | done | Outlines, outlines for the selection, mask outlines, frame outlines; shapes are clicked on their outlines, reaching layers behind; View ▸ Outlines ▸ Include hidden layers (`view.outlinesHiddenLayers`) outlines hidden layers too and Include object bounds (`view.outlinesObjectBounds`) draws the box of every layer whose outline isn't its box (groups, text, ellipses, vectors); what either draws can be clicked there (a hidden layer on its outline, a group on its box) and nothing else can; both are view settings like the other outline flags (per file, off in a new one, checked in the menu); the lines are light on a dark page (`outline_options_tests`). The main menu now shows a check mark beside every View toggle that is on | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-09 | patch | Preferences ▸ Invert zoom direction (#2145): Cmd/Ctrl+wheel, and a plain mouse wheel with Scroll wheel zoom on, zoom the other way; pinch and panning unchanged. Numbers unchanged. | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 92145e6f8da614aae4ea48f4fade36086accb7f5 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 02:59:53 -0500 Subject: [PATCH 066/239] M8: K focuses the Scale field, so K, 2, Enter scales by two (#2146) The Scale tool now opens its factor field focused with its text selected (once per activation), the origin starts at the centre, and Enter or Escape in the field returns the tool to Move with the selection kept. Measured in Figma web, 2026-11-09. Docs: ui-parity Scale tool row and revision. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 measured and wrote at medium --- crates/ui-egui/src/field_tests.rs | 63 ++++++++++++++++++++++++ crates/ui-egui/src/panels/right.rs | 2 + crates/ui-egui/src/panels/scale_panel.rs | 33 +++++++++++-- crates/ui-egui/src/widgets.rs | 9 +++- docs/ui-parity.md | 5 +- 5 files changed, 106 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index e3bdad1dd..a0f5f24d6 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -737,6 +737,69 @@ fn scrubbing_the_scale_panel_width_scales_live_in_one_undo_step() { assert_eq!((w, h, undo_steps(&u)), (60.0, 45.0, steps + 1), "40×30 scaled to a width of 60"); } +/// A 100 x 100 rectangle at the origin, selected, in a Ui with the Move tool. +fn scale_setup() -> (Ui, NodeId) { + let mut s = Session::new(); + let r = id(s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 100, "height": 100})).unwrap()); + s.execute("select.set", &json!({"ids": [r]})).unwrap(); + let mut u = Ui::new(s); + u.frame(vec![]); + u.frame(vec![]); + (u, r) +} + +fn scale_field_focused(u: &Ui) -> bool { + u.ctx.memory(|m| m.has_focus(Id::unique("scale_k").with("te"))) +} + +/// Measured in Figma's web app (2026-11-09): K opens the Scale section with its input focused. +#[test] +fn pressing_k_focuses_the_scale_field_with_its_text_selected() { + let (mut u, _) = scale_setup(); + assert!(!scale_field_focused(&u)); + key(&mut u, Key::K, Modifiers::NONE); + u.frame(vec![]); + assert_eq!(u.app.session.tool.tool, figcraft_engine::ToolId::Scale); + assert!(scale_field_focused(&u), "the scale field has the keyboard"); + let state = egui::TextEdit::load_state(&u.ctx, Id::unique("scale_k").with("te")).expect("the editor exists"); + let range = state.cursor.char_range().expect("a selection"); + assert_ne!(range.primary.index, range.secondary.index, "its text is selected"); +} + +/// K, 2, Enter: 100 x 100 becomes 200 x 200 about the centre, the tool is Move, one undo step. +#[test] +fn k_two_enter_scales_the_selection_by_two_about_its_centre() { + let (mut u, r) = scale_setup(); + let steps = undo_steps(&u); + key(&mut u, Key::K, Modifiers::NONE); + u.frame(vec![]); + u.frame(vec![Event::Text("2".to_string())]); + key(&mut u, Key::Enter, Modifiers::NONE); + u.frame(vec![]); + assert_eq!(geom(&u, r), (-50.0, -50.0, 200.0, 200.0)); + assert_eq!(u.app.session.tool.tool, figcraft_engine::ToolId::Move); + assert_eq!(u.app.session.ds().unwrap().selection, vec![r]); + assert_eq!(undo_steps(&u), steps + 1); + u.app.run("edit.undo", json!({})); + assert_eq!(geom(&u, r), (0.0, 0.0, 100.0, 100.0)); +} + +/// Escape in the scale field closes it and changes nothing. +#[test] +fn escape_in_the_scale_field_closes_it_and_changes_nothing() { + let (mut u, r) = scale_setup(); + let steps = undo_steps(&u); + key(&mut u, Key::K, Modifiers::NONE); + u.frame(vec![]); + u.frame(vec![Event::Text("3".to_string())]); + key(&mut u, Key::Escape, Modifiers::NONE); + u.frame(vec![]); + assert_eq!(geom(&u, r), (0.0, 0.0, 100.0, 100.0)); + assert_eq!(u.app.session.tool.tool, figcraft_engine::ToolId::Move); + assert_eq!(u.app.session.ds().unwrap().selection, vec![r]); + assert_eq!(undo_steps(&u), steps); +} + /// The texts painted in the last frame: what they say, whether they end in an ellipsis, and where /// they show (within their clip). fn painted_texts(shapes: &[egui::epaint::ClippedShape]) -> Vec<(String, bool, egui::Rect)> { diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index bba57c778..5c190576f 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -281,6 +281,8 @@ fn design(app: &mut FigApp, ui: &mut Ui) { if app.session.tool.tool == figcraft_engine::ToolId::Scale { crate::scale_panel::section(app, ui, &shown, &sel); widgets::separator(ui); + } else { + crate::scale_panel::closed(ui.ctx()); } position(app, ui, &doc, &shown, &sel); } diff --git a/crates/ui-egui/src/panels/scale_panel.rs b/crates/ui-egui/src/panels/scale_panel.rs index fd3a100e8..d86355c25 100644 --- a/crates/ui-egui/src/panels/scale_panel.rs +++ b/crates/ui-egui/src/panels/scale_panel.rs @@ -17,6 +17,27 @@ use crate::widgets::{self, FieldEdit, Lead}; pub fn section(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { let Some(b) = doc.bounds_of(sel) else { return }; widgets::section_header(ui, tr("Scale"), &[], false); + // The origin starts at the centre, as Figma's grid does: set once per app, so a point the + // user picked later stays. + let anchor_init = Id::unique("scale_anchor_init"); + if !ui.data(|d| d.get_temp::(anchor_init)).unwrap_or(false) { + ui.data_mut(|d| d.insert_temp(anchor_init, true)); + app.run("tool.scaleAnchor", json!({"anchor": "c"})); + } + // The factor field takes the keyboard once, with its text selected, when the tool opens. + let k_id = Id::unique("scale_k"); + let opened = Id::unique("scale_opened"); + if !ui.data(|d| d.get_temp::(opened)).unwrap_or(false) { + ui.data_mut(|d| d.insert_temp(opened, true)); + widgets::request_edit(ui, k_id); + } + // Enter or Escape in the factor field ends the tool (back to Move, the selection kept). + // (Focus as it was last frame: the shortcut layer may already have let go of it this frame.) + let in_k_id = Id::unique("scale_in_k"); + let in_k = ui.data(|d| d.get_temp::(in_k_id)).unwrap_or(false); + let focused_now = ui.memory(|m| m.has_focus(k_id.with("te"))); + ui.data_mut(|d| d.insert_temp(in_k_id, focused_now)); + let (enter, esc) = ui.input(|i| (i.key_pressed(egui::Key::Enter), i.key_pressed(egui::Key::Escape))); let col = widgets::col_width(ui.available_width()); // Anchor: column and row (0 start, 1 middle, 2 end) of the point that stays put. let anchor = app.session.tool.scale_anchor; @@ -41,9 +62,7 @@ pub fn section(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { widgets::sublabels(ui, tr("Scale"), Some(tr("Anchor"))); crate::right::block(ui, 52.0, 2.0, |ui| { // Relative to the layers as they are: a scrub applies once, when let go. - if let Some(FieldEdit::Set(k) | FieldEdit::Scrub(k, true)) = - widgets::number_field(ui, Id::unique("scale_k"), Lead::None, Some(1.0), "x", col, 0.1) - { + if let Some(FieldEdit::Set(k) | FieldEdit::Scrub(k, true)) = widgets::number_field(ui, k_id, Lead::None, Some(1.0), "x", col, 0.1) { factor = Some(k); } ui.add_space(8.0); @@ -70,6 +89,14 @@ pub fn section(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { } } } + if in_k && (enter || esc) { + app.run("tool.set", json!({"tool": "move"})); + } +} + +/// Forget that the section opened, so the next time the Scale tool opens it takes the keyboard. +pub fn closed(ctx: &egui::Context) { + ctx.data_mut(|d| d.remove::(Id::unique("scale_opened"))); } /// The factor (clamped to 0.01–100) and pivot for scaling `b` by `k` around `anchor`; None when diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index eae46fd81..b25ed54b9 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -223,6 +223,12 @@ pub fn number_field(ui: &mut Ui, id: Id, lead: Lead, value: Option, suffix: number_field_mixed(ui, id, lead, value, suffix, width, step)?.settled() } +/// Ask number field `id` to open for typing on its next frame, its text selected (a tool that +/// opens with its field focused, such as Scale). +pub fn request_edit(ui: &Ui, id: Id) { + ui.data_mut(|d| d.insert_temp(id.with("beginedit"), true)); +} + /// Whether the edit of number field `id` began with a Cmd/Ctrl-click. A padding field edited /// that way sets every side (Guide to auto layout, Keyboard shortcut guide). pub fn edit_began_with_command(ui: &Ui, id: Id) -> bool { @@ -400,7 +406,8 @@ fn number_field_impl( } // Typing on a field the keyboard reached (Tab) edits it: the editor takes the typed text. let typed_now = editing.is_none() && on_field && ui.input(|i| i.events.iter().any(|e| matches!(e, egui::Event::Text(_)))); - let started = editing.is_none() && ((field_resp.clicked() && !alt_now) || typed_now); + let requested = ui.data_mut(|d| d.remove_temp::(id.with("beginedit"))).unwrap_or(false); + let started = editing.is_none() && ((field_resp.clicked() && !alt_now) || typed_now || requested); // The text the field would commit to no effect: what it showed when the edit began, or the // value the arrows last stepped it to. let kept_id = id.with("kept"); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..9eedb74db 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** minor (M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the origin grid's centre (the default) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two_about_its_centre`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -67,7 +67,7 @@ interaction feel not yet compared. | Enter with a shape or frame tool chosen | done | places what a click makes (100×100, lines 100 long, sections 400×300) in the middle of the view, selected (`tool.place`); from the toolbar, Enter on the chosen tool. With nothing selected, the arrows first show a crosshair in the middle of the view and then move it by the nudge amounts (`tool.crosshair`; Shift the large one), and Enter places there; Escape or a tool change takes it away ("Use the arrow keys to activate the crosshair cursor. It will appear in the middle of the viewport indicating where the new object will be placed", Accessibility at Figma; #1839) | | Alt-drag duplicate | done | the copy snaps to the layer it came from too (edges, centres, equal spacing); Duplicate (Cmd+D) then repeats the copy's offset, also after a Duplicate whose copy was moved, as long as the copies stay selected (the documentation doesn't say; pinned from community answers) | | Drag threshold; double-click into groups and text | done | a press moves or resizes only once the pointer has travelled 3 px on screen, so a click or double-click made with an unsteady hand drags nothing; a double-click goes one level into a group and the next one edits the text under it, wherever on the text it lands, with all of it selected (a double-click in the text being edited selects the word) (`double_click_tests`); Enter on a selected text does the same (all of it selected, typing replaces it) and Escape leaves editing with the layer still selected (`text_enter_tests`) | -| Scale tool (K): handles about an anchor, live factor, panel | done | | +| Scale tool (K): handles about an anchor, live factor, panel | done | Pressing K opens the Scale section with its factor field focused and its text selected; typing 2 (or 2x, 1.5) then Enter scales the selection by it about the origin grid's centre (the default), as one undo step, then closes the section and returns to Move with the selection kept; Escape in the field closes it, back to Move, nothing changed. Measured in Figma's web app, 2026-11-09. Tests: `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two_about_its_centre`, `escape_in_the_scale_field_closes_it_and_changes_nothing`. | | Nudge 1 / Shift 10 (preference), Cmd+arrows resize | done | arrows reorder auto layout children | | Smart guides: edges, centres, equal spacing (between two layers or continuing a row's gap, labelled), spacing labels, parent, layout grid, ruler guides | done | red, `snap.rs`; a guide dragged out of a ruler or moved snaps to layer edges and centres too (Snap to Objects; Cmd/Ctrl suspends), on its own axis only; page guides see the page's top-level layers, frame guides the frame's box, layout grids and every layer in it, along a rotated frame's own axes; thresholds not yet compared with Figma's (`guide_snap_tests`) | | Ctrl to suspend snapping while dragging (macOS) | done | Control on macOS (Cmd keeps working), Ctrl elsewhere; moving, resizing and drawing | @@ -271,4 +271,5 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | 2026-10-11 | minor | Canvas fixes: boolean groups clicked where their result is, a layer dragged inside a group stays in it, View ▸ Frame outlines and View ▸ Slices draw | | 2026-10-11 | minor | Outline mode done: outlines for the selection (the selected layers draw as outlines, the rest normally) and mask outlines | | 2026-10-11 | minor | Design panel arc fields, live boolean editing (operands on the canvas, live results, per-operand operations), shape builder on strokes and open paths, one-sided widths (Alt-drag a width handle) | +| 2026-11-09 | patch | M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the origin grid's centre (the default) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two_about_its_centre`, `escape_in_the_scale_field_closes_it_and_changes_nothing`) | | 2026-10-10 | major | Created from the ROADMAP's look-and-feel and interaction items, the keymap and the canvas code | From 6856437479dfa29d8e224359eda3db13b3b91320 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 03:03:26 -0500 Subject: [PATCH 067/239] M8: the Scale panel keeps FigCraft's origin; the centre default is a follow-up (#2146) The panel set the origin to the centre once per app. The origin is the Scale tool's drag pivot too (scale_factor), so that also changed handle drags, unmeasured against Figma, while the engine and its tests keep top-left. This PR keeps to the focus and the Enter and Escape endings the issue asks for. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/ui-egui/src/field_tests.rs | 5 +++-- crates/ui-egui/src/panels/scale_panel.rs | 7 ------- docs/ui-parity.md | 6 +++--- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index a0f5f24d6..dfa097db0 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -768,7 +768,7 @@ fn pressing_k_focuses_the_scale_field_with_its_text_selected() { /// K, 2, Enter: 100 x 100 becomes 200 x 200 about the centre, the tool is Move, one undo step. #[test] -fn k_two_enter_scales_the_selection_by_two_about_its_centre() { +fn k_two_enter_scales_the_selection_by_two() { let (mut u, r) = scale_setup(); let steps = undo_steps(&u); key(&mut u, Key::K, Modifiers::NONE); @@ -776,7 +776,8 @@ fn k_two_enter_scales_the_selection_by_two_about_its_centre() { u.frame(vec![Event::Text("2".to_string())]); key(&mut u, Key::Enter, Modifiers::NONE); u.frame(vec![]); - assert_eq!(geom(&u, r), (-50.0, -50.0, 200.0, 200.0)); + // About the panel's origin, FigCraft's top-left default (Figma's grid starts at the centre). + assert_eq!(geom(&u, r), (0.0, 0.0, 200.0, 200.0)); assert_eq!(u.app.session.tool.tool, figcraft_engine::ToolId::Move); assert_eq!(u.app.session.ds().unwrap().selection, vec![r]); assert_eq!(undo_steps(&u), steps + 1); diff --git a/crates/ui-egui/src/panels/scale_panel.rs b/crates/ui-egui/src/panels/scale_panel.rs index d86355c25..7ba0618c8 100644 --- a/crates/ui-egui/src/panels/scale_panel.rs +++ b/crates/ui-egui/src/panels/scale_panel.rs @@ -17,13 +17,6 @@ use crate::widgets::{self, FieldEdit, Lead}; pub fn section(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { let Some(b) = doc.bounds_of(sel) else { return }; widgets::section_header(ui, tr("Scale"), &[], false); - // The origin starts at the centre, as Figma's grid does: set once per app, so a point the - // user picked later stays. - let anchor_init = Id::unique("scale_anchor_init"); - if !ui.data(|d| d.get_temp::(anchor_init)).unwrap_or(false) { - ui.data_mut(|d| d.insert_temp(anchor_init, true)); - app.run("tool.scaleAnchor", json!({"anchor": "c"})); - } // The factor field takes the keyboard once, with its text selected, when the tool opens. let k_id = Id::unique("scale_k"); let opened = Id::unique("scale_opened"); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 9eedb74db..5a6614d2e 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-09 · **Change:** minor (M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the origin grid's centre (the default) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two_about_its_centre`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** minor (M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -67,7 +67,7 @@ interaction feel not yet compared. | Enter with a shape or frame tool chosen | done | places what a click makes (100×100, lines 100 long, sections 400×300) in the middle of the view, selected (`tool.place`); from the toolbar, Enter on the chosen tool. With nothing selected, the arrows first show a crosshair in the middle of the view and then move it by the nudge amounts (`tool.crosshair`; Shift the large one), and Enter places there; Escape or a tool change takes it away ("Use the arrow keys to activate the crosshair cursor. It will appear in the middle of the viewport indicating where the new object will be placed", Accessibility at Figma; #1839) | | Alt-drag duplicate | done | the copy snaps to the layer it came from too (edges, centres, equal spacing); Duplicate (Cmd+D) then repeats the copy's offset, also after a Duplicate whose copy was moved, as long as the copies stay selected (the documentation doesn't say; pinned from community answers) | | Drag threshold; double-click into groups and text | done | a press moves or resizes only once the pointer has travelled 3 px on screen, so a click or double-click made with an unsteady hand drags nothing; a double-click goes one level into a group and the next one edits the text under it, wherever on the text it lands, with all of it selected (a double-click in the text being edited selects the word) (`double_click_tests`); Enter on a selected text does the same (all of it selected, typing replaces it) and Escape leaves editing with the layer still selected (`text_enter_tests`) | -| Scale tool (K): handles about an anchor, live factor, panel | done | Pressing K opens the Scale section with its factor field focused and its text selected; typing 2 (or 2x, 1.5) then Enter scales the selection by it about the origin grid's centre (the default), as one undo step, then closes the section and returns to Move with the selection kept; Escape in the field closes it, back to Move, nothing changed. Measured in Figma's web app, 2026-11-09. Tests: `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two_about_its_centre`, `escape_in_the_scale_field_closes_it_and_changes_nothing`. | +| Scale tool (K): handles about an anchor, live factor, panel | done | Pressing K opens the Scale section with its factor field focused and its text selected; typing 2 (or 2x, 1.5) then Enter scales the selection by it about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured), as one undo step, then closes the section and returns to Move with the selection kept; Escape in the field closes it, back to Move, nothing changed. Measured in Figma's web app, 2026-11-09. Tests: `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`. | | Nudge 1 / Shift 10 (preference), Cmd+arrows resize | done | arrows reorder auto layout children | | Smart guides: edges, centres, equal spacing (between two layers or continuing a row's gap, labelled), spacing labels, parent, layout grid, ruler guides | done | red, `snap.rs`; a guide dragged out of a ruler or moved snaps to layer edges and centres too (Snap to Objects; Cmd/Ctrl suspends), on its own axis only; page guides see the page's top-level layers, frame guides the frame's box, layout grids and every layer in it, along a rotated frame's own axes; thresholds not yet compared with Figma's (`guide_snap_tests`) | | Ctrl to suspend snapping while dragging (macOS) | done | Control on macOS (Cmd keeps working), Ctrl elsewhere; moving, resizing and drawing | @@ -271,5 +271,5 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | 2026-10-11 | minor | Canvas fixes: boolean groups clicked where their result is, a layer dragged inside a group stays in it, View ▸ Frame outlines and View ▸ Slices draw | | 2026-10-11 | minor | Outline mode done: outlines for the selection (the selected layers draw as outlines, the rest normally) and mask outlines | | 2026-10-11 | minor | Design panel arc fields, live boolean editing (operands on the canvas, live results, per-operand operations), shape builder on strokes and open paths, one-sided widths (Alt-drag a width handle) | -| 2026-11-09 | patch | M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the origin grid's centre (the default) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two_about_its_centre`, `escape_in_the_scale_field_closes_it_and_changes_nothing`) | +| 2026-11-09 | patch | M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`) | | 2026-10-10 | major | Created from the ROADMAP's look-and-feel and interaction items, the keymap and the canvas code | From 197a390a8406150a3c9beae0ad4c7855f370985e Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 03:40:27 -0500 Subject: [PATCH 068/239] M8: the Scale field refocuses after another tab, and Enter elsewhere keeps the tool (#2148 review) The focus request was reset only while the Design panel drew, so choosing the tool again on the Prototype tab left the field without the keyboard; it now follows the frame the section last showed in. Whether the factor field had the keyboard was read before the widgets ran, so an Enter right after a click into W or H could end the tool; it is read after them now. A number field's leftover edit from when it was last shown no longer swallows the focus request. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/ui-egui/src/field_tests.rs | 39 +++++++++++++++++++++++- crates/ui-egui/src/panels/right.rs | 2 -- crates/ui-egui/src/panels/scale_panel.rs | 27 ++++++++-------- crates/ui-egui/src/widgets.rs | 8 +++-- 4 files changed, 58 insertions(+), 18 deletions(-) diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index dfa097db0..06b78823c 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -766,7 +766,44 @@ fn pressing_k_focuses_the_scale_field_with_its_text_selected() { assert_ne!(range.primary.index, range.secondary.index, "its text is selected"); } -/// K, 2, Enter: 100 x 100 becomes 200 x 200 about the centre, the tool is Move, one undo step. +/// The Scale tool chosen again while the Design tab was away (Prototype tab, Move, then K): the +/// field takes the keyboard again when the Design tab comes back. +#[test] +fn the_scale_field_takes_the_keyboard_again_after_another_tab() { + let (mut u, _) = scale_setup(); + key(&mut u, Key::K, Modifiers::NONE); + u.frame(vec![]); + assert!(scale_field_focused(&u)); + u.app.ui.right_tab = crate::state::RightTab::Prototype; + u.frame(vec![]); + u.app.run("tool.set", json!({"tool": "move"})); + u.frame(vec![]); + u.app.run("tool.set", json!({"tool": "scale"})); + u.frame(vec![]); + u.app.ui.right_tab = crate::state::RightTab::Design; + u.frame(vec![]); + u.frame(vec![]); + assert!(scale_field_focused(&u), "the field has the keyboard again"); +} + +/// Tab moves the keyboard from the factor field to the next one; an Enter there leaves the +/// Scale tool on. +#[test] +fn enter_in_another_field_after_tab_keeps_the_scale_tool() { + let (mut u, _) = scale_setup(); + key(&mut u, Key::K, Modifiers::NONE); + u.frame(vec![]); + assert!(scale_field_focused(&u)); + // Tab, then Enter on the very next frame (as a quick Tab, Enter or a click and Enter would). + let ev = |key, pressed| Event::Key { key, physical_key: None, pressed, repeat: false, modifiers: Modifiers::NONE }; + u.frame(vec![ev(Key::Tab, true), ev(Key::Tab, false)]); + assert!(!scale_field_focused(&u), "Tab moved the keyboard on"); + u.frame(vec![ev(Key::Enter, true), ev(Key::Enter, false)]); + u.frame(vec![]); + assert_eq!(u.app.session.tool.tool, figcraft_engine::ToolId::Scale); +} + +/// K, 2, Enter: 100 x 100 becomes 200 x 200 about the panel's origin, the tool is Move, one undo step. #[test] fn k_two_enter_scales_the_selection_by_two() { let (mut u, r) = scale_setup(); diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index 5c190576f..bba57c778 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -281,8 +281,6 @@ fn design(app: &mut FigApp, ui: &mut Ui) { if app.session.tool.tool == figcraft_engine::ToolId::Scale { crate::scale_panel::section(app, ui, &shown, &sel); widgets::separator(ui); - } else { - crate::scale_panel::closed(ui.ctx()); } position(app, ui, &doc, &shown, &sel); } diff --git a/crates/ui-egui/src/panels/scale_panel.rs b/crates/ui-egui/src/panels/scale_panel.rs index 7ba0618c8..9b6dd98a1 100644 --- a/crates/ui-egui/src/panels/scale_panel.rs +++ b/crates/ui-egui/src/panels/scale_panel.rs @@ -17,19 +17,23 @@ use crate::widgets::{self, FieldEdit, Lead}; pub fn section(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { let Some(b) = doc.bounds_of(sel) else { return }; widgets::section_header(ui, tr("Scale"), &[], false); - // The factor field takes the keyboard once, with its text selected, when the tool opens. + // The factor field takes the keyboard, with its text selected, whenever the section shows + // after a frame without it: the tool was chosen, or the panel came back from another tab or a + // hidden UI. let k_id = Id::unique("scale_k"); - let opened = Id::unique("scale_opened"); - if !ui.data(|d| d.get_temp::(opened)).unwrap_or(false) { - ui.data_mut(|d| d.insert_temp(opened, true)); + let shown_id = Id::unique("scale_shown_frame"); + let frame = ui.ctx().cumulative_frame_nr(); + let last = ui.data(|d| d.get_temp::(shown_id)); + ui.data_mut(|d| d.insert_temp(shown_id, frame)); + if last.is_none_or(|l| l.saturating_add(1) < frame) { widgets::request_edit(ui, k_id); } - // Enter or Escape in the factor field ends the tool (back to Move, the selection kept). - // (Focus as it was last frame: the shortcut layer may already have let go of it this frame.) + // Enter or Escape in the factor field ends the tool (back to Move, the selection kept). Whether + // the field had the keyboard is read as it was when the last frame's widgets were done: the + // shortcut layer may let go of it before this frame's panel runs, and a click or Tab that moved + // it to another field during the last frame counts. let in_k_id = Id::unique("scale_in_k"); let in_k = ui.data(|d| d.get_temp::(in_k_id)).unwrap_or(false); - let focused_now = ui.memory(|m| m.has_focus(k_id.with("te"))); - ui.data_mut(|d| d.insert_temp(in_k_id, focused_now)); let (enter, esc) = ui.input(|i| (i.key_pressed(egui::Key::Enter), i.key_pressed(egui::Key::Escape))); let col = widgets::col_width(ui.available_width()); // Anchor: column and row (0 start, 1 middle, 2 end) of the point that stays put. @@ -82,16 +86,13 @@ pub fn section(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { } } } + let focused_now = ui.memory(|m| m.has_focus(k_id.with("te"))); + ui.data_mut(|d| d.insert_temp(in_k_id, focused_now)); if in_k && (enter || esc) { app.run("tool.set", json!({"tool": "move"})); } } -/// Forget that the section opened, so the next time the Scale tool opens it takes the keyboard. -pub fn closed(ctx: &egui::Context) { - ctx.data_mut(|d| d.remove::(Id::unique("scale_opened"))); -} - /// The factor (clamped to 0.01–100) and pivot for scaling `b` by `k` around `anchor`; None when /// nothing would change or `k` isn't a usable number. fn scale_about(b: figcraft_geom::Rect, anchor: (u8, u8), k: f64) -> Option<(f64, f64, f64)> { diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index b25ed54b9..252ae65af 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -224,9 +224,13 @@ pub fn number_field(ui: &mut Ui, id: Id, lead: Lead, value: Option, suffix: } /// Ask number field `id` to open for typing on its next frame, its text selected (a tool that -/// opens with its field focused, such as Scale). +/// opens with its field focused, such as Scale). An edit left over from when the field was last +/// shown (it went away with the keyboard on it) is dropped first, or the request would be ignored. pub fn request_edit(ui: &Ui, id: Id) { - ui.data_mut(|d| d.insert_temp(id.with("beginedit"), true)); + ui.data_mut(|d| { + d.remove::(id.with("editing")); + d.insert_temp(id.with("beginedit"), true); + }); } /// Whether the edit of number field `id` began with a Cmd/Ctrl-click. A padding field edited From a45d932a341db55d025789046c639377ecb601fc Mon Sep 17 00:00:00 2001 From: Carbocode Date: Mon, 9 Nov 2026 11:08:30 +0100 Subject: [PATCH 069/239] M1: reuse the sidebar paint field for page backgrounds --- ROADMAP.md | 5 ++++- crates/ui-egui/src/field_tests.rs | 17 +++++++++++++++++ crates/ui-egui/src/panels/right.rs | 25 +++++++++++++------------ crates/ui-egui/src/widgets.rs | 2 +- docs/ui-parity.md | 22 +++++++++++++++++++++- 5 files changed, 56 insertions(+), 15 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 651f3ab2e..dbeec5f14 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~26 points and ~162–292 h away (one Opus 5.5 agent; ~33–67 h wall-clock with 5 agents) -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** patch (the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** patch (the Page background uses the shared sidebar paint control, with fractional opacity, alpha-aware HEX edits and picker toggling; the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) FigCraft is a clean-room, open-source, pure-Rust reimplementation of the Figma design workflow, native on macOS, Windows, Linux and FreeBSD and in the browser, fully drivable by agents through @@ -134,6 +134,8 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md). ## Progress log +- **2026-11-09** · M1: the Page background reuses the Fill/Stroke/Selection colors paint field, including its responsive width, inline HEX, accessible swatch and fractional opacity. HEX retains the page alpha unless explicitly supplied; opacity scrubs remain one undo step. Regression coverage in `field_tests`. Sidebar audit: effect colours, layout-grid colours and prototype overlay backgrounds still have separate colour/opacity fields; prototype backgrounds, variable-action colours and selected-text Fill have colour-only custom controls. Numbers unchanged. + - **2026-11-05** · M2, #1823: Suggest auto layout is its own command. `layout.suggest` used to run `layout.add` and made one row of everything. It now splits a frame's layers into rows or columns by the gaps between them, wraps each band of several layers in a hugging frame without fill and repeats inside it, so the design gets as many auto layout frames as it needs and keeps its placement where the gaps are even (the frame keeps its size). Uneven gaps, bands that start at different offsets across the flow (lined up at the smallest) and layers that overlap along both axes are reported as `warnings`, and instances and layers inside them are refused. `layout.add` is unchanged. Tests in `layout_suggest_tests.rs`. Numbers unchanged. - **2026-11-05** · M3, #2002: the Local variables window selects several variables with a click, Shift+click (range) and Cmd/Ctrl+click (toggle), cleared by Escape or a click on the empty space; delete, move to a group and scope act on the selected local variables as one undo step (`command.batch`); inherited variables can be selected but are left out, since they change in their own collection, and the bulk menu needs two or more local variables selected (otherwise the row shows its own menu). Rename and value edits stay single-row. - **2026-11-05** · M10, #2014: the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic (`bidi::script_fallbacks`: one sample letter per script, the system's families for each; Bengali and Thai keep `crate::cjk`'s choice), so a layer name or a String variable's Amharic value draws in the panels instead of boxes. Test: `bidi::tests::other_scripts_take_an_installed_system_face`. @@ -365,6 +367,7 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md). | Date | Change | Summary | |---|---|---| +| 2026-11-09 | patch | M1: shared Page background paint control; fractional opacity and picker-toggle regression coverage. Remaining sidebar colour controls audited in docs/ui-parity.md. Numbers unchanged | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`, 繁體中文(台灣)) draft catalog: every UI string (1,975), command label (641) and menu wording (31), translated clean-room from the English source; `zh-TW`, `zh-HK`, `zh-MO` and `zh-Hant` read it while an explicit Hans stays Simplified; the desktop UI prefers an installed Noto Sans CJK TC, then Microsoft JhengHei, PingFang TC and Heiti TC; no font is bundled; native review pending. Numbers unchanged | | 2026-11-06 | patch | M1, #2028: Edit ▸ Set default properties gives new rectangles, ellipses, polygons and stars drawn with the tools (and, set from a text layer, new text) the selected layer's properties; it only copied them for Paste properties. Tests: `default_props_tests` (3). Numbers unchanged | | 2026-11-06 | patch | M5, #2027: `proto.settings` refuses an unknown device name with the list of devices (it saved any string, and the presenter showed no device), takes known names in any case, and answers the page's prototype settings, so `proto.settings {}` reads them back over MCP. Test: `proto_present_tests::unknown_devices_are_refused_and_settings_read_back`. Numbers unchanged | diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index e3bdad1dd..5d2288be5 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -1292,6 +1292,23 @@ fn sidebar_field_text_stays_in_place_on_focus() { } } +/// The shared paint control shows the same precision as Fill and keeps the picker toggle. +#[test] +fn page_background_shows_fractional_opacity_like_fill_and_keeps_it_when_opening_the_picker() { + let mut u = Ui::new(Session::new()); + u.ctx.enable_accesskit(); + u.app.run("page.setBackground", json!({"color": "#FF000080"})); + u.frame(vec![]); + assert_eq!(field(&mut u, "Opacity").1, "50.2%"); + let steps = undo_steps(&u); + let swatch = u.ctx.read_response(Id::unique("pagebg_swatch")).expect("shared page swatch").rect.center(); + click(&mut u, swatch); + assert!(matches!(u.app.ui.picker, Some(crate::colorpicker::PickerTarget::PageBackground))); + assert_eq!(undo_steps(&u), steps, "opening the picker does not edit the colour"); + click(&mut u, swatch); + assert!(u.app.ui.picker.is_none(), "the swatch toggles the picker closed"); +} + /// The Page section's opacity field edits the page background's alpha (#1748; it was a label), /// one undo step per commit, and the hex field keeps that opacity unless the typed colour /// carries its own. diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index bba57c778..92204adaa 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -329,21 +329,22 @@ fn page_section(app: &mut FigApp, ui: &mut Ui, doc: &Document) { let mut new_color: Option<(figcraft_color::Color, Option)> = None; row(ui, 32.0, |ui| { let p = Paint::solid(bg); - let sw = widgets::swatch(ui, &p, 16.0); + let (sw, opacity) = + widgets::paint_field(ui, Id::unique("pagebg_swatch"), Id::unique("pagebg_a"), &p, ui.available_width(), |child, text_r| { + // A typed colour keeps the page's opacity unless it carries one: 4 or 8 hex digits + // (`FF000080`; `FF0000FF` asks for opaque). + if let Some(h) = widgets::text_field_inline(child, Id::unique("pagebg"), &bg.to_hex(), text_r.shrink2(vec2(0.0, 4.0)), regular(11.0)) + && let Some(c) = figcraft_color::Color::from_hex_or_name(&h) + { + let digits = h.trim().trim_start_matches('#'); + let carries_alpha = matches!(digits.len(), 4 | 8) && digits.chars().all(|ch| ch.is_ascii_hexdigit()); + new_color = Some((if carries_alpha { c } else { c.with_alpha(bg.a) }, None)); + } + }); app.picker_control(crate::colorpicker::PickerTarget::PageBackground, &sw); - // A typed colour keeps the page's opacity unless it carries one: 4 or 8 hex digits - // (`FF000080`; `FF0000FF` asks for opaque). - if let Some(h) = widgets::text_field(ui, Id::unique("pagebg"), &bg.to_hex(), 96.0, "") - && let Some(c) = figcraft_color::Color::from_hex_or_name(&h) - { - let digits = h.trim().trim_start_matches('#'); - let carries_alpha = matches!(digits.len(), 4 | 8) && digits.chars().all(|ch| ch.is_ascii_hexdigit()); - new_color = Some((if carries_alpha { c } else { c.with_alpha(bg.a) }, None)); - } // The opacity: a field like every other opacity field, not a label (#1748). let alpha = |v: f64| bg.with_alpha((v / 100.0).clamp(0.0, 1.0) as f32); - let shown = Some(f64::from((bg.a * 100.0).round())); - match widgets::number_field(ui, Id::unique("pagebg_a"), Lead::Named(tr("Opacity")), shown, "%", 56.0, 1.0) { + match opacity { Some(FieldEdit::Set(v)) => new_color = Some((alpha(v), None)), Some(FieldEdit::Scrub(v, done)) => new_color = Some((alpha(v), Some(done))), None => {} diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index eae46fd81..585c31670 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -1130,7 +1130,7 @@ pub fn checker(painter: &egui::Painter, rect: Rect, cell: f32) { } } -/// Shared Fill/Stroke/Selection colors control: one background, a 16 pt swatch, +/// Shared sidebar paint control: one background, a 16 pt swatch, /// caller-provided colour content, and a separated, scrubbable opacity field. /// The caller owns picker routing and commands; this widget only draws and reports edits. pub fn paint_field( diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..d02105984 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** patch (the Page background uses the shared Fill/Stroke/Selection colors field; remaining sidebar colour controls audited; the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -31,6 +31,7 @@ interaction feel not yet compared. | Multiplayer avatars, Share button | missing | waits for multiplayer | | Colour names in hex fields | done | every hex field (fills, strokes, text ranges, effects, layout grids, colour variables, page and prototype backgrounds, the colour picker's Hex) takes a CSS colour name as well: `red` becomes `FF0000`; case, spaces and hyphens are ignored (`Light Blue`); names are opaque and keep the colour's opacity; hex wins where both could match. The picker's CSS field takes every CSS name too (`Color::from_hex_or_name`, `color::named`) | | Fields select their text on focus | done | Number and text values keep their vertical position when their editor gains focus (including typography spacing; `sidebar_field_text_stays_in_place_on_focus`). a click or Tab into a one-line field selects all of its text, so typing replaces the value: hex and colour fields, number fields, inline fields (a fill's hex, variable values, renames), names, search boxes and dialog fields; a drag from the press selects only what it covers; multi-line fields (descriptions, comments) keep the caret where clicked. The first click into an inline field (a fill's hex) now takes the keyboard; it took a second click. A rename (double-click, F2, File ▸ Rename, a page) selects the whole name before its field first draws, so a key typed in that same frame replaces the name; it was appended (`widgets::select_all_on_focus`, `select_all_tests`, `layers_rename_tests`) | +| Page background colour control | done | Uses `widgets::paint_field`, as Fill, Stroke and Selection colors do: one background, inline HEX, accessible swatch toggling the picker and fractional opacity. Typed colours preserve alpha unless 4/8 HEX digits explicitly supply it; opacity scrubs remain live and undo as one step. Tests: `field_tests::the_page_background_opacity_field_sets_the_page_colour_alpha`, `field_tests::page_background_shows_fractional_opacity_like_fill_and_keeps_it_when_opening_the_picker`. | | Colour picker models | done | Hex, RGB, HSL, HSB, LCH, OKLCH and CSS; LCH and OKLCH keep lightness and hue when a colour leaves sRGB (chroma comes down); the values typed stay while the colour is theirs (a hue typed on a grey, a chroma sRGB can't hold); CSS reads `lch()` and `oklch()` with any hue unit and `none` (`figcraft_color::{Lch, Oklch}`). Values are the stored channels read as sRGB | | Colour picker placement and dismissal | done | Opens 8 pt beside the sidebar at the opening control, lifted to fit the screen; outside presses (including the sidebar), Escape and X close it. Reopening resets a dragged position; eyedropper sampling keeps it open, and so does a drag of the open gradient's handles or stops on the canvas (#1852). | | Colour picker image well | partial | the Image tab shows a checkered placeholder and Upload from computer until there is a file (no dialog at once); an image paint shows its asset preview; a file dropped on the open picker replaces the image, keeping the fill mode, crop, position and adjustments (`image.replace`). Layers' fills and strokes only (text ranges, styles and selection colours keep Upload). The Fill and Stroke swatches take no drop: a dragged file's position isn't known, so a drop with none goes to the open picker | @@ -183,10 +184,29 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | WCAG AA contrast of secondary and accent text | done | disabled and dim text at least 3:1 against panels, fields and selected rows, selected text at least 3:1 on its highlight, in both themes (`theme::tests`, #890) | | Tested with VoiceOver, NVDA, Narrator, Orca | missing | human QA | +## Sidebar colour control audit (2026-11-09) + +The Page background, Fill, Stroke and Selection colors reuse `widgets::paint_field`. +The remaining custom controls are: + +| Control | Implementation | Remaining difference | +|---|---|---| +| Effects: drop/inner shadow and noise colours | `panels/right/effects.rs`, `fx_color` | Separate swatch, HEX and rounded opacity; colour-variable binding wraps the control. | +| Layout-grid colour | `panels/right/effects.rs`, `grid_settings` | Separate painted swatch, HEX and rounded opacity; the swatch is not interactive. | +| Prototype overlay background | `panels/proto_panel.rs`, `action_fields` | Separate swatch, HEX and rounded opacity; opacity scrubs apply only on release. | +| Prototype device background | `panels/proto_panel.rs`, `settings` | Swatch and HEX only; no opacity field or picker routing. | +| Prototype Set variable colour value | `panels/proto_editor.rs`, `literal_field` | Swatch and HEX only; no opacity field or picker routing. | +| Selected-text Fill | `panels/right/paints.rs`, `range_fill` | Custom combined swatch/HEX row, with picker routing but no sidebar opacity field. | + +Device-colour presets and Developer Mode inspection swatches are display controls, so they +are not colour/opacity editors. Variable cells and style editing live in separate windows. +This audit records candidates for subsequent fixes; their behaviour is unchanged here. + ## Revision history | Date | Change | Summary | |---|---|---| +| 2026-11-09 | patch | M1: the Page background reuses the shared sidebar paint control; fractional opacity and picker toggling covered alongside alpha-aware HEX and scrub undo. Audited remaining custom sidebar colour controls. Numbers unchanged | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 481b6831ccb9d5da7c97f158813a20ce2065677f Mon Sep 17 00:00:00 2001 From: Carbocode Date: Mon, 9 Nov 2026 11:21:38 +0100 Subject: [PATCH 070/239] M1: composite translucent pages over a themed checkerboard --- ROADMAP.md | 5 +- crates/ui-egui/src/canvas.rs | 12 +- crates/ui-egui/src/canvas/background.rs | 140 ++++++++++++++++++++++++ crates/ui-egui/src/field_tests.rs | 24 ++++ docs/ui-parity.md | 8 +- 5 files changed, 182 insertions(+), 7 deletions(-) create mode 100644 crates/ui-egui/src/canvas/background.rs diff --git a/ROADMAP.md b/ROADMAP.md index dbeec5f14..5b3226ab2 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~26 points and ~162–292 h away (one Opus 5.5 agent; ~33–67 h wall-clock with 5 agents) -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** patch (the Page background uses the shared sidebar paint control, with fractional opacity, alpha-aware HEX edits and picker toggling; the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** patch (transparent pages show a canvas checkerboard that follows the light/dark theme and apply their background opacity once; the Page background uses the shared sidebar paint control, with fractional opacity, alpha-aware HEX edits and picker toggling; the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) FigCraft is a clean-room, open-source, pure-Rust reimplementation of the Figma design workflow, native on macOS, Windows, Linux and FreeBSD and in the browser, fully drivable by agents through @@ -134,6 +134,8 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md). ## Progress log +- **2026-11-09** · M1: page background alpha is composited once over the transparency checkerboard on the canvas. Its colours come from the theme’s panel and canvas tokens and update on a light/dark switch. Rendered pixels already contain the page colour; only areas outside a stale or partial render receive the fallback colour, avoiding a second alpha application. A repeated four-pixel texture keeps the checkerboard independent of zoom without generating a shape per square. Tests cover transparent, translucent and opaque pages, partial and missing renders, light/dark changes, canvas integration and the Page field at both sidebar width limits. Numbers unchanged. + - **2026-11-09** · M1: the Page background reuses the Fill/Stroke/Selection colors paint field, including its responsive width, inline HEX, accessible swatch and fractional opacity. HEX retains the page alpha unless explicitly supplied; opacity scrubs remain one undo step. Regression coverage in `field_tests`. Sidebar audit: effect colours, layout-grid colours and prototype overlay backgrounds still have separate colour/opacity fields; prototype backgrounds, variable-action colours and selected-text Fill have colour-only custom controls. Numbers unchanged. - **2026-11-05** · M2, #1823: Suggest auto layout is its own command. `layout.suggest` used to run `layout.add` and made one row of everything. It now splits a frame's layers into rows or columns by the gaps between them, wraps each band of several layers in a hugging frame without fill and repeats inside it, so the design gets as many auto layout frames as it needs and keeps its placement where the gaps are even (the frame keeps its size). Uneven gaps, bands that start at different offsets across the flow (lined up at the smallest) and layers that overlap along both axes are reported as `warnings`, and instances and layers inside them are refused. `layout.add` is unchanged. Tests in `layout_suggest_tests.rs`. Numbers unchanged. @@ -367,6 +369,7 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md). | Date | Change | Summary | |---|---|---| +| 2026-11-09 | patch | M1: canvas transparency checkerboard and single application of the page background alpha, including partial renders; regression coverage for page colour controls at both sidebar width limits. Numbers unchanged | | 2026-11-09 | patch | M1: shared Page background paint control; fractional opacity and picker-toggle regression coverage. Remaining sidebar colour controls audited in docs/ui-parity.md. Numbers unchanged | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`, 繁體中文(台灣)) draft catalog: every UI string (1,975), command label (641) and menu wording (31), translated clean-room from the English source; `zh-TW`, `zh-HK`, `zh-MO` and `zh-Hant` read it while an explicit Hans stays Simplified; the desktop UI prefers an installed Noto Sans CJK TC, then Microsoft JhengHei, PingFang TC and Heiti TC; no font is bundled; native review pending. Numbers unchanged | | 2026-11-06 | patch | M1, #2028: Edit ▸ Set default properties gives new rectangles, ellipses, polygons and stars drawn with the tools (and, set from a text layer, new text) the selected layer's properties; it only copied them for Paste properties. Tests: `default_props_tests` (3). Numbers unchanged | diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 251ff25e6..e1507cb1d 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -14,6 +14,7 @@ use crate::i18n::{tr, trf, trn}; use crate::render_worker::{Done, Job, Worker}; use crate::theme::{COMPONENT, Tokens, doc_c32, regular, semibold}; +mod background; mod builder; mod input; mod outline; @@ -293,15 +294,20 @@ pub fn show(app: &mut FigApp, ui: &mut Ui, worker: &mut Worker) { app.canvas.tex_seq = done.seq; } let painter = ui.painter_at(rect); - painter.rect_filled(rect, CornerRadius::ZERO, bg); crate::theme::set_canvas_page(&ctx, bg); - if let (Some(tex), Some(v), true) = (&app.canvas.texture, &app.canvas.tex_view, shown.is_some() && app.canvas.tex_of == shown) { + let image = if let (Some(tex), Some(v), true) = (&app.canvas.texture, &app.canvas.tex_view, shown.is_some() && app.canvas.tex_of == shown) { // Re-project the last render onto the current view. let tl = app.to_screen(v.origin.0, v.origin.1); let zoom = app.session.ds().map(|d| d.view.zoom).unwrap_or(1.0); let pixel_preview = app.session.ds().ok().and_then(|ds| ds.view.pixel_preview_scale()) == Some(v.scale); let image_rect = presented_image_rect(tl, v, zoom, ppp, pixel_preview); - painter.image(tex.id(), image_rect, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE); + Some((tex.id(), image_rect)) + } else { + None + }; + background::paint(&painter, rect, bg, image.map(|(_, r)| r)); + if let Some((texture, image_rect)) = image { + painter.image(texture, image_rect, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE); } crate::dev_mode::refresh_measurements(app); app.session.tool.labels = overlays(app, &painter, &t); diff --git a/crates/ui-egui/src/canvas/background.rs b/crates/ui-egui/src/canvas/background.rs new file mode 100644 index 000000000..8fe948802 --- /dev/null +++ b/crates/ui-egui/src/canvas/background.rs @@ -0,0 +1,140 @@ +//! The transparency grid behind the page; rendered pixels already contain the page colour. + +use egui::{Color32, CornerRadius, Id, Painter, Rect, TextureHandle, pos2}; + +fn grid_texture(ctx: &egui::Context) -> TextureHandle { + let id = Id::unique("canvas_transparency_grid"); + let tokens = crate::theme::Tokens::get(ctx); + let colors = [tokens.panel, tokens.canvas]; + let cached = ctx.data(|data| data.get_temp::<(TextureHandle, [Color32; 2])>(id)); + if let Some((texture, old_colors)) = &cached + && *old_colors == colors + { + return texture.clone(); + } + let image = egui::ColorImage::new([2, 2], vec![colors[0], colors[1], colors[1], colors[0]]); + let texture = match cached { + Some((mut texture, _)) => { + texture.set(image, egui::TextureOptions::NEAREST_REPEAT); + texture + } + None => ctx.load_texture("canvas-transparency", image, egui::TextureOptions::NEAREST_REPEAT), + }; + ctx.data_mut(|data| data.insert_temp(id, (texture.clone(), colors))); + texture +} + +pub(super) fn paint(painter: &Painter, rect: Rect, background: Color32, rendered: Option) { + if background.a() < 255 { + // Repeat four pixels instead of allocating one shape per square on a large canvas. + let texture = grid_texture(painter.ctx()); + let uv = Rect::from_min_size(egui::Pos2::ZERO, rect.size() / 16.0); + painter.image(texture.id(), rect, uv, Color32::WHITE); + } + // The render contains the page colour and its alpha. Painting that colour beneath it + // applies alpha twice (50% becomes 75%). Only uncovered areas need the fallback colour. + let covered = rendered.map(|r| r.intersect(rect)).filter(|r| r.is_positive()); + let areas = match covered { + Some(r) => [ + Rect::from_min_max(rect.min, pos2(rect.right(), r.top())), + Rect::from_min_max(pos2(rect.left(), r.bottom()), rect.max), + Rect::from_min_max(pos2(rect.left(), r.top()), r.left_bottom()), + Rect::from_min_max(r.right_top(), pos2(rect.right(), r.bottom())), + ], + None => [rect, Rect::NOTHING, Rect::NOTHING, Rect::NOTHING], + }; + for area in areas.into_iter().filter(|r| r.is_positive()) { + painter.rect_filled(area, CornerRadius::ZERO, background); + } +} + +#[cfg(test)] +mod tests { + use super::*; + use egui::vec2; + + fn shapes(alpha: u8, rendered: Option) -> egui::FullOutput { + let ctx = egui::Context::default(); + let mut out = ctx.run_ui(Default::default(), |ui| { + paint( + ui.painter(), + Rect::from_min_size(egui::Pos2::ZERO, vec2(100.0, 100.0)), + Color32::from_rgba_unmultiplied(255, 0, 0, alpha), + rendered, + ); + }); + out.textures_delta.clear(); + out + } + + #[test] + fn the_canvas_draws_the_transparency_grid_for_a_transparent_page() { + let mut ui = crate::layers_drag_tests::Ui::new(figcraft_engine::Session::new()); + ui.app.run("page.setBackground", serde_json::json!({"color": "#FF000000"})); + let out = ui.frame_output(vec![]); + let (tile, _) = + ui.ctx.data(|d| d.get_temp::<(TextureHandle, [Color32; 2])>(Id::unique("canvas_transparency_grid"))).expect("the canvas checkerboard"); + assert!(out.shapes.iter().any(|s| matches!(&s.shape, egui::Shape::Mesh(m) if m.texture_id == tile.id()))); + } + + #[test] + fn the_grid_updates_its_colours_when_the_theme_changes() { + let ctx = egui::Context::default(); + let mut previous_id = None; + for tokens in [crate::theme::Tokens::light(), crate::theme::Tokens::dark(), crate::theme::Tokens::light()] { + crate::theme::apply(&ctx, tokens); + let mut tile = None; + let mut out = ctx.run_ui(Default::default(), |_ui| tile = Some(grid_texture(&ctx))); + let tile = tile.unwrap(); + if let Some(previous_id) = previous_id { + assert_eq!(tile.id(), previous_id, "changing theme updates the same texture"); + } + let delta = out.textures_delta.set.get(&tile.id()).and_then(|d| d.first()).expect("updated checkerboard pixels"); + let egui::ImageData::Color(image) = &delta.image; + assert_eq!(image.pixels, [tokens.panel, tokens.canvas, tokens.canvas, tokens.panel]); + previous_id = Some(tile.id()); + out.textures_delta.clear(); + } + } + + #[test] + fn translucent_pages_show_the_grid_without_applying_page_alpha_twice() { + let rendered = Rect::from_min_max(pos2(20.0, 20.0), pos2(80.0, 80.0)); + for alpha in [0, 128, 255] { + let out = shapes(alpha, Some(rendered)); + let fills: Vec<_> = out + .shapes + .iter() + .filter_map(|s| match &s.shape { + egui::Shape::Rect(r) => Some(r.rect), + _ => None, + }) + .collect(); + assert_eq!(fills.len(), 4); + assert!(fills.iter().all(|r| !r.intersect(rendered).is_positive()), "the render's alpha has no page colour beneath it"); + for point in [pos2(10.0, 10.0), pos2(90.0, 90.0), pos2(10.0, 50.0), pos2(90.0, 50.0)] { + assert_eq!(fills.iter().filter(|r| r.contains(point)).count(), 1, "uncovered pixels get the page colour once"); + } + let images = out.shapes.iter().filter(|s| matches!(&s.shape, egui::Shape::Mesh(_))).count(); + assert_eq!(images, usize::from(alpha < 255), "only transparent pages need the checkerboard"); + } + } + + #[test] + fn absent_or_offscreen_renders_fill_the_page_once() { + for rendered in [None, Some(Rect::from_min_size(pos2(200.0, 200.0), vec2(10.0, 10.0)))] { + let out = shapes(128, rendered); + let fills: Vec<_> = out + .shapes + .iter() + .filter_map(|s| match &s.shape { + egui::Shape::Rect(r) => Some(r), + _ => None, + }) + .collect(); + assert_eq!(fills.len(), 1); + assert_eq!(fills[0].rect, Rect::from_min_size(egui::Pos2::ZERO, vec2(100.0, 100.0))); + assert_eq!(fills[0].fill.a(), 128); + } + } +} diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index 5d2288be5..939258ae5 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -1309,6 +1309,30 @@ fn page_background_shows_fractional_opacity_like_fill_and_keeps_it_when_opening_ assert!(u.app.ui.picker.is_none(), "the swatch toggles the picker closed"); } +/// The shared page colour row uses the sidebar's width without hiding either field. +#[test] +fn page_background_colour_and_opacity_fit_a_resized_sidebar() { + let mut u = Ui::new(Session::new()); + let mut previous_widths: Option<(f32, f32)> = None; + for width in [240.0, 500.0] { + u.app.ui.right_width = width; + for _ in 0..3 { + u.frame(vec![]); + } + let hex = u.ctx.read_response(Id::unique("pagebg").with("click")).unwrap().rect; + let alpha = u.ctx.read_response(Id::unique("pagebg_a").with("field")).unwrap().rect; + let panel = u.app.ui.right_panel_rect.unwrap(); + assert!(hex.left() >= u.app.canvas.rect.right(), "the colour stays in the sidebar"); + assert!(hex.right() < alpha.left(), "the colour and opacity never overlap"); + assert!(alpha.right() <= u.screen.x, "the opacity stays visible"); + // The colour uses the extra room while opacity keeps its place at the right edge. + if let Some((previous_hex, previous_panel)) = previous_widths { + assert!((hex.width() - previous_hex - (panel.width() - previous_panel)).abs() < 1.0, "the shared control grows with the panel"); + } + previous_widths = Some((hex.width(), panel.width())); + } +} + /// The Page section's opacity field edits the page background's alpha (#1748; it was a label), /// one undo step per commit, and the hex field keeps that opacity unless the typed colour /// carries its own. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index d02105984..b6a134811 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-09 · **Change:** patch (the Page background uses the shared Fill/Stroke/Selection colors field; remaining sidebar colour controls audited; the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** patch (transparent pages show a checkerboard and apply their opacity once; the Page background uses the shared Fill/Stroke/Selection colors field; remaining sidebar colour controls audited; the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -31,7 +31,8 @@ interaction feel not yet compared. | Multiplayer avatars, Share button | missing | waits for multiplayer | | Colour names in hex fields | done | every hex field (fills, strokes, text ranges, effects, layout grids, colour variables, page and prototype backgrounds, the colour picker's Hex) takes a CSS colour name as well: `red` becomes `FF0000`; case, spaces and hyphens are ignored (`Light Blue`); names are opaque and keep the colour's opacity; hex wins where both could match. The picker's CSS field takes every CSS name too (`Color::from_hex_or_name`, `color::named`) | | Fields select their text on focus | done | Number and text values keep their vertical position when their editor gains focus (including typography spacing; `sidebar_field_text_stays_in_place_on_focus`). a click or Tab into a one-line field selects all of its text, so typing replaces the value: hex and colour fields, number fields, inline fields (a fill's hex, variable values, renames), names, search boxes and dialog fields; a drag from the press selects only what it covers; multi-line fields (descriptions, comments) keep the caret where clicked. The first click into an inline field (a fill's hex) now takes the keyboard; it took a second click. A rename (double-click, F2, File ▸ Rename, a page) selects the whole name before its field first draws, so a key typed in that same frame replaces the name; it was appended (`widgets::select_all_on_focus`, `select_all_tests`, `layers_rename_tests`) | -| Page background colour control | done | Uses `widgets::paint_field`, as Fill, Stroke and Selection colors do: one background, inline HEX, accessible swatch toggling the picker and fractional opacity. Typed colours preserve alpha unless 4/8 HEX digits explicitly supply it; opacity scrubs remain live and undo as one step. Tests: `field_tests::the_page_background_opacity_field_sets_the_page_colour_alpha`, `field_tests::page_background_shows_fractional_opacity_like_fill_and_keeps_it_when_opening_the_picker`. | +| Canvas page transparency | done | Transparent or translucent page backgrounds show a checkerboard using the theme’s panel and canvas colours, updated immediately when switching between light and dark. The page background alpha is applied once: a rendered image already contains the page colour, so only uncovered areas receive the fallback colour during zoom and pan. An opaque page hides the checkerboard. Theme changes update the same cached texture. The grid is a repeated four-pixel texture at a fixed screen size, separate from document exports. Tests: `canvas::background::tests`. | +| Page background colour control | done | Uses `widgets::paint_field`, as Fill, Stroke and Selection colors do: one background, inline HEX, accessible swatch toggling the picker and fractional opacity. Typed colours preserve alpha unless 4/8 HEX digits explicitly supply it; opacity scrubs remain live and undo as one step. Tests: `field_tests::the_page_background_opacity_field_sets_the_page_colour_alpha`, `field_tests::page_background_shows_fractional_opacity_like_fill_and_keeps_it_when_opening_the_picker` and `field_tests::page_background_colour_and_opacity_fit_a_resized_sidebar` (240 and 500 pt). | | Colour picker models | done | Hex, RGB, HSL, HSB, LCH, OKLCH and CSS; LCH and OKLCH keep lightness and hue when a colour leaves sRGB (chroma comes down); the values typed stay while the colour is theirs (a hue typed on a grey, a chroma sRGB can't hold); CSS reads `lch()` and `oklch()` with any hue unit and `none` (`figcraft_color::{Lch, Oklch}`). Values are the stored channels read as sRGB | | Colour picker placement and dismissal | done | Opens 8 pt beside the sidebar at the opening control, lifted to fit the screen; outside presses (including the sidebar), Escape and X close it. Reopening resets a dragged position; eyedropper sampling keeps it open, and so does a drag of the open gradient's handles or stops on the canvas (#1852). | | Colour picker image well | partial | the Image tab shows a checkered placeholder and Upload from computer until there is a file (no dialog at once); an image paint shows its asset preview; a file dropped on the open picker replaces the image, keeping the fill mode, crop, position and adjustments (`image.replace`). Layers' fills and strokes only (text ranges, styles and selection colours keep Upload). The Fill and Stroke swatches take no drop: a dragged file's position isn't known, so a drop with none goes to the open picker | @@ -191,7 +192,7 @@ The remaining custom controls are: | Control | Implementation | Remaining difference | |---|---|---| -| Effects: drop/inner shadow and noise colours | `panels/right/effects.rs`, `fx_color` | Separate swatch, HEX and rounded opacity; colour-variable binding wraps the control. | +| Effects: drop/inner shadow and noise colours | `panels/right/effects.rs`, `fx_color` | Separate swatch, HEX and rounded opacity; shadow colour also supports variable binding. | | Layout-grid colour | `panels/right/effects.rs`, `grid_settings` | Separate painted swatch, HEX and rounded opacity; the swatch is not interactive. | | Prototype overlay background | `panels/proto_panel.rs`, `action_fields` | Separate swatch, HEX and rounded opacity; opacity scrubs apply only on release. | | Prototype device background | `panels/proto_panel.rs`, `settings` | Swatch and HEX only; no opacity field or picker routing. | @@ -206,6 +207,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| +| 2026-11-09 | patch | M1: canvas page transparency uses a checkerboard that follows light/dark themes and applies background alpha once, including partial or missing renders. The page control also fits both sidebar width limits. Tests: `canvas::background::tests`, `field_tests::page_background_colour_and_opacity_fit_a_resized_sidebar`. Numbers unchanged | | 2026-11-09 | patch | M1: the Page background reuses the shared sidebar paint control; fractional opacity and picker toggling covered alongside alpha-aware HEX and scrub undo. Audited remaining custom sidebar colour controls. Numbers unchanged | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | From d9f52aab1a7238fbc1eba51b3fd9fae67be9f430 Mon Sep 17 00:00:00 2001 From: Carbocode Date: Mon, 9 Nov 2026 11:43:49 +0100 Subject: [PATCH 071/239] M1: remove page background notes from the roadmap --- ROADMAP.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 5b3226ab2..651f3ab2e 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~26 points and ~162–292 h away (one Opus 5.5 agent; ~33–67 h wall-clock with 5 agents) -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** patch (transparent pages show a canvas checkerboard that follows the light/dark theme and apply their background opacity once; the Page background uses the shared sidebar paint control, with fractional opacity, alpha-aware HEX edits and picker toggling; the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** patch (the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) FigCraft is a clean-room, open-source, pure-Rust reimplementation of the Figma design workflow, native on macOS, Windows, Linux and FreeBSD and in the browser, fully drivable by agents through @@ -134,10 +134,6 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md). ## Progress log -- **2026-11-09** · M1: page background alpha is composited once over the transparency checkerboard on the canvas. Its colours come from the theme’s panel and canvas tokens and update on a light/dark switch. Rendered pixels already contain the page colour; only areas outside a stale or partial render receive the fallback colour, avoiding a second alpha application. A repeated four-pixel texture keeps the checkerboard independent of zoom without generating a shape per square. Tests cover transparent, translucent and opaque pages, partial and missing renders, light/dark changes, canvas integration and the Page field at both sidebar width limits. Numbers unchanged. - -- **2026-11-09** · M1: the Page background reuses the Fill/Stroke/Selection colors paint field, including its responsive width, inline HEX, accessible swatch and fractional opacity. HEX retains the page alpha unless explicitly supplied; opacity scrubs remain one undo step. Regression coverage in `field_tests`. Sidebar audit: effect colours, layout-grid colours and prototype overlay backgrounds still have separate colour/opacity fields; prototype backgrounds, variable-action colours and selected-text Fill have colour-only custom controls. Numbers unchanged. - - **2026-11-05** · M2, #1823: Suggest auto layout is its own command. `layout.suggest` used to run `layout.add` and made one row of everything. It now splits a frame's layers into rows or columns by the gaps between them, wraps each band of several layers in a hugging frame without fill and repeats inside it, so the design gets as many auto layout frames as it needs and keeps its placement where the gaps are even (the frame keeps its size). Uneven gaps, bands that start at different offsets across the flow (lined up at the smallest) and layers that overlap along both axes are reported as `warnings`, and instances and layers inside them are refused. `layout.add` is unchanged. Tests in `layout_suggest_tests.rs`. Numbers unchanged. - **2026-11-05** · M3, #2002: the Local variables window selects several variables with a click, Shift+click (range) and Cmd/Ctrl+click (toggle), cleared by Escape or a click on the empty space; delete, move to a group and scope act on the selected local variables as one undo step (`command.batch`); inherited variables can be selected but are left out, since they change in their own collection, and the bulk menu needs two or more local variables selected (otherwise the row shows its own menu). Rename and value edits stay single-row. - **2026-11-05** · M10, #2014: the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic (`bidi::script_fallbacks`: one sample letter per script, the system's families for each; Bengali and Thai keep `crate::cjk`'s choice), so a layer name or a String variable's Amharic value draws in the panels instead of boxes. Test: `bidi::tests::other_scripts_take_an_installed_system_face`. @@ -369,8 +365,6 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md). | Date | Change | Summary | |---|---|---| -| 2026-11-09 | patch | M1: canvas transparency checkerboard and single application of the page background alpha, including partial renders; regression coverage for page colour controls at both sidebar width limits. Numbers unchanged | -| 2026-11-09 | patch | M1: shared Page background paint control; fractional opacity and picker-toggle regression coverage. Remaining sidebar colour controls audited in docs/ui-parity.md. Numbers unchanged | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`, 繁體中文(台灣)) draft catalog: every UI string (1,975), command label (641) and menu wording (31), translated clean-room from the English source; `zh-TW`, `zh-HK`, `zh-MO` and `zh-Hant` read it while an explicit Hans stays Simplified; the desktop UI prefers an installed Noto Sans CJK TC, then Microsoft JhengHei, PingFang TC and Heiti TC; no font is bundled; native review pending. Numbers unchanged | | 2026-11-06 | patch | M1, #2028: Edit ▸ Set default properties gives new rectangles, ellipses, polygons and stars drawn with the tools (and, set from a text layer, new text) the selected layer's properties; it only copied them for Paste properties. Tests: `default_props_tests` (3). Numbers unchanged | | 2026-11-06 | patch | M5, #2027: `proto.settings` refuses an unknown device name with the list of devices (it saved any string, and the presenter showed no device), takes known names in any case, and answers the page's prototype settings, so `proto.settings {}` reads them back over MCP. Test: `proto_present_tests::unknown_devices_are_refused_and_settings_read_back`. Numbers unchanged | From 984270fbecdaace2353d8247f04b94626f10390f Mon Sep 17 00:00:00 2001 From: ljkx <177671075+ljkx@users.noreply.github.com> Date: Mon, 9 Nov 2026 12:38:29 +0100 Subject: [PATCH 072/239] M8: automation roots refuse a path on another computer before resolving it (#1094) On Windows, Roots::check resolved every path (canonicalize opens it) before comparing it with the roots, so `\server\share\x` contacted the server, and could send it the user's credentials, before it was refused. Now the path as given and made absolute is classified by its spelling with craft_docpath first: another computer that no root's share is on, a device path, or a DOS device name anywhere in it is refused, and so is a link on the way that leads to one (followed by its target's spelling, up to 40 links). Fixes #1094 --- crates/engine/src/automation/file_access.rs | 189 ++++++++++++++++-- .../src/automation/file_access/tests.rs | 177 ++++++++++++++++ 2 files changed, 344 insertions(+), 22 deletions(-) diff --git a/crates/engine/src/automation/file_access.rs b/crates/engine/src/automation/file_access.rs index 5ce06b122..97c6cd2f5 100644 --- a/crates/engine/src/automation/file_access.rs +++ b/crates/engine/src/automation/file_access.rs @@ -12,6 +12,11 @@ //! existing folder is resolved and the rest must be plain names. The comparison is by whole //! components (`/work2` is not inside `/work`), and the I/O uses the resolved path, so what was //! checked is what is opened. +//! +//! On Windows, resolving a path opens it, and opening a path on another computer contacts that +//! computer and may send it the signed-in user's credentials. So before anything is resolved, a +//! path on another computer that no root is on, a device path, or one reached through a link that +//! leads to them is refused by how it is spelled (#1094). #![allow(clippy::disallowed_methods)] use std::cell::RefCell; @@ -19,6 +24,8 @@ use std::ffi::{OsStr, OsString}; use std::path::{Component, Path, PathBuf}; use std::sync::Arc; +use craft_docpath::Refused; + use crate::{EngineError, Result}; /// What a command does with a file. @@ -58,6 +65,19 @@ impl Roots { Access::Read => ([self.read.as_slice(), self.write.as_slice()].concat(), "read"), Access::Write => (self.write.clone(), "written"), }; + if cfg!(windows) { + match refused_unresolved(path, &roots) { + Some(Unresolved::Spelled(Refused::Network)) => { + return Err(format!( + "automation path rejected: {asked} is on another computer, and no folder that may be {what} is on its share" + )); + } + Some(Unresolved::Spelled(_)) => return Err(format!("automation path rejected: {asked} names a device, not a file")), + // Where a link leads is only told by the usual message: it would say what is there. + Some(Unresolved::Linked) => return Err(outside(asked, &roots, what)), + None => {} + } + } match resolve(path) { Ok(resolved) if roots.iter().any(|r| resolved.starts_with(r)) => return Ok(resolved), Ok(_) => {} @@ -65,11 +85,7 @@ impl Roots { Err(why) if inside_as_far_as_it_exists(path, &roots) => return Err(format!("automation path rejected: {asked}: {why}")), Err(_) => {} } - if roots.is_empty() { - return Err(format!("automation path rejected: no folder may be {what} (no root for it was given): {asked}")); - } - let shown: Vec = roots.iter().map(|r| shown(r)).collect(); - Err(format!("automation path rejected: {asked} is outside the folders that may be {what}: {}", shown.join(", "))) + Err(outside(asked, &roots, what)) } /// The folders as JSON, resolved: `{read: [every folder that may be read], write: [the write roots]}`. @@ -79,23 +95,146 @@ impl Roots { } } +/// Why `asked` is refused: it is outside every one of `roots`, the folders that may be `what`. +fn outside(asked: std::path::Display<'_>, roots: &[PathBuf], what: &str) -> String { + if roots.is_empty() { + return format!("automation path rejected: no folder may be {what} (no root for it was given): {asked}"); + } + let shown: Vec = roots.iter().map(|r| shown(r)).collect(); + format!("automation path rejected: {asked} is outside the folders that may be {what}: {}", shown.join(", ")) +} + +/// Why a path is refused before it is resolved (#1094). +#[derive(Debug, PartialEq, Eq)] +enum Unresolved { + /// Its spelling leads to another computer ([`Refused::Network`]) or a device ([`Refused::Device`]). + Spelled(Refused), + /// A link on the way leads there. + Linked, +} + +/// How many links are followed on the way to a path before it is given up on, as on Linux. +const MAX_LINKS: u8 = 40; + +/// Why `path` is refused before anything on the way to it is opened, if it is: resolving it would +/// open a path on another computer, which on Windows contacts that computer and may send it the +/// signed-in user's credentials, or open a device (#1094). That is the case when the path as +/// given or made absolute is (see [`refused_spelling`]), or when a link on the way, or on the way +/// on from where one leads, leads to such a path ([`link_refused`]). A path on the share of one of +/// `roots` goes on to the usual check. +fn refused_unresolved(path: &Path, roots: &[PathBuf]) -> Option { + // Made absolute without looking at the disk (on Windows `GetFullPathNameW`, which also turns a + // bare device name such as `NUL` into `\\.\NUL`, as opening it would). + let abs = std::path::absolute(path).ok()?; + if let Some(why) = [path, abs.as_path()].into_iter().find_map(|p| refused_spelling(&p.to_string_lossy(), roots)) { + return Some(Unresolved::Spelled(why)); + } + link_refused(&abs, roots, MAX_LINKS, &on_disk).then_some(Unresolved::Linked) +} + +/// What is at a path, looked at without following a link there. +#[derive(Debug, Clone, PartialEq, Eq)] +enum Entry { + /// Nothing, or what can't be looked at: resolving the path meets the same there and goes no + /// further. + Missing, + /// A file or a folder. + Plain, + /// A link, with where it leads (`None` when that can't be read). + Link(Option), +} + +/// What is at `p` on disk (see [`Entry`]). +fn on_disk(p: &Path) -> Entry { + match std::fs::symlink_metadata(p) { + Ok(m) if m.is_symlink() => Entry::Link(std::fs::read_link(p).ok()), + Ok(_) => Entry::Plain, + Err(_) => Entry::Missing, + } +} + +/// Why path `p` is refused by its spelling alone, if it is (see [`craft_docpath::resolve`], which +/// reads both `/` and `\` as separators and compares names ignoring case): +/// - on another computer (`\\server\share`, `//server/share`, `\\?\UNC\…`, `\\.\UNC\…`, or a +/// server without a share) and on no root's share; +/// - a device path (`\\.\pipe\…`, `\\?\GLOBALROOT\…`, `\\.\C:\…`), other than a local volume's +/// `\\?\Volume{…}\`, which a folder can be mounted as; +/// - or with a device name (`CON`, `NUL`, `COM1.png`, `lpt1 `…) as any of its names: each folder on +/// the way is opened in turn while the path is resolved, and the device behind a name such as +/// `LPT1` can be a printer on another computer. +fn refused_spelling(p: &str, roots: &[PathBuf]) -> Option { + match craft_docpath::resolve(p, None) { + // With a root as the document, a path on its share is allowed. + Err(Refused::Network) if !roots.iter().any(|r| craft_docpath::resolve(p, Some(r)) != Err(Refused::Network)) => { + return Some(Refused::Network); + } + Err(Refused::Device) if !is_volume(p) => return Some(Refused::Device), + _ => {} + } + // `craft_docpath` stops at the first name it refuses, which may not be the device's. + p.split(['\\', '/']).any(device_name).then_some(Refused::Device) +} + +/// Whether `p` is in a local volume by its `\\?\Volume{…}` (or `\\.\Volume{…}`) name. +fn is_volume(p: &str) -> bool { + let mut names = p.split(['\\', '/']); + let (Some(""), Some(""), Some("?" | "."), Some(volume)) = (names.next(), names.next(), names.next(), names.next()) else { + return false; + }; + volume.get(..7).is_some_and(|v| v.eq_ignore_ascii_case("Volume{")) && volume.ends_with('}') +} + +/// Whether a link on the way to `abs` (an absolute path) leads to a path [`refused_spelling`] +/// refuses, following at most `links` links: one that leads to another, or on through further +/// links, is followed too, as resolving the path would. A link that can't be read, or more links +/// than that, are refused as well. Each name on the way is looked at with `look` ([`on_disk`]), +/// which doesn't follow a link: where a link leads is looked at only once its spelling is known +/// not to be refused. +fn link_refused(abs: &Path, roots: &[PathBuf], links: u8, look: &dyn Fn(&Path) -> Entry) -> bool { + let mut at = PathBuf::new(); + let mut rest = abs.components(); + while let Some(c) = rest.next() { + at.push(c); + if !matches!(c, Component::Normal(_)) { + continue; + } + let target = match look(&at) { + Entry::Plain => continue, + // Nothing is below what isn't there, so no link either. + Entry::Missing => return false, + Entry::Link(target) => target, + }; + let (Some(links), Some(target)) = (links.checked_sub(1), target) else { return true }; + // A relative target is relative to the link's folder; an absolute one replaces it. + let next = lexical(&at.parent().unwrap_or(&at).join(target).join(rest.as_path())); + return refused_spelling(&next.to_string_lossy(), roots).is_some() || link_refused(&next, roots, links, look); + } + false +} + +/// `p` with its `.` and `..` taken by name, as Windows takes them. +fn lexical(p: &Path) -> PathBuf { + let mut out = PathBuf::new(); + for c in p.components() { + match c { + Component::ParentDir => { + out.pop(); + } + Component::CurDir => {} + c => out.push(c), + } + } + out +} + /// Whether `path` lies in one of `roots` once made absolute with its `.` and `..` taken by name and /// its longest leading part that exists resolved, so links on the way are followed as the roots' /// were (`/tmp/work/x` is inside root `/private/tmp/work`, a link out of a root leads out of it). fn inside_as_far_as_it_exists(path: &Path, roots: &[PathBuf]) -> bool { let Ok(abs) = std::path::absolute(path) else { return false }; - let mut lexical = PathBuf::new(); - for c in abs.components() { - match c { - Component::ParentDir => { - lexical.pop(); - } - Component::CurDir => {} - c => lexical.push(c), - } - } + let folded = lexical(&abs); let mut rest: Vec<&OsStr> = Vec::new(); - let mut at = lexical.as_path(); + let mut at = folded.as_path(); let resolved = loop { if let Ok(mut base) = std::fs::canonicalize(at) { base.extend(rest.iter().rev()); @@ -169,18 +308,24 @@ fn resolve(path: &Path) -> std::result::Result { fn plain_name(name: &OsStr) -> std::result::Result<(), String> { if cfg!(windows) { let n = name.to_string_lossy(); - let stem = n.split('.').next().unwrap_or_default().trim_end().to_ascii_uppercase(); - let device = matches!(stem.as_str(), "CON" | "PRN" | "AUX" | "NUL" | "CONIN$" | "CONOUT$") - || ((stem.starts_with("COM") || stem.starts_with("LPT")) - && stem.chars().count() == 4 - && stem.chars().last().is_some_and(|c| c.is_ascii_digit() || matches!(c, '¹' | '²' | '³'))); - if device || n.contains(':') { + if device_name(&n) || n.contains(':') { return Err(format!("`{n}` is a device or stream name, not a file")); } } Ok(()) } +/// Whether Windows opens a device for file or folder name `n`: `CON`, `PRN`, `AUX`, `NUL`, +/// `CONIN$`, `CONOUT$`, `COM1`…`COM9` and `LPT1`…`LPT9` (also with `¹`, `²` or `³`), in any case, +/// and with anything after a dot or a colon or trailing spaces (`nul.txt`, `COM1 .png`, `con:x`). +fn device_name(n: &str) -> bool { + let stem = n.split(['.', ':']).next().unwrap_or_default().trim_end().to_ascii_uppercase(); + matches!(stem.as_str(), "CON" | "PRN" | "AUX" | "NUL" | "CONIN$" | "CONOUT$") + || ((stem.starts_with("COM") || stem.starts_with("LPT")) + && stem.chars().count() == 4 + && stem.chars().last().is_some_and(|c| c.is_ascii_digit() || matches!(c, '¹' | '²' | '³'))) +} + thread_local! { static ROOTS: RefCell>> = const { RefCell::new(None) }; } diff --git a/crates/engine/src/automation/file_access/tests.rs b/crates/engine/src/automation/file_access/tests.rs index 72f471f94..5f9c1ad5d 100644 --- a/crates/engine/src/automation/file_access/tests.rs +++ b/crates/engine/src/automation/file_access/tests.rs @@ -191,6 +191,183 @@ fn windows_case_devices_and_streams() { assert!(!e.contains(r"\\?\"), "{e}"); } +/// How each spelling of a path on another computer or of a device is told apart from a local path +/// (#1094), on every system: only Windows checks them, but they are spelled the same everywhere. +#[test] +fn spellings_of_other_computers_and_devices_are_refused() { + use super::refused_spelling; + use craft_docpath::Refused::{Device, Network}; + let local = [PathBuf::from(r"C:\work")]; + let network = [ + r"\\192.0.2.1\share\x.png", + "//192.0.2.1/share/x.png", + r"\/192.0.2.1/share\x.png", + r"\\?\UNC\192.0.2.1\share\x.png", + r"\\?\unc\192.0.2.1\share\x.png", + "//?/UNC/192.0.2.1/share/x.png", + r"\\.\UNC\192.0.2.1\share\x.png", + // A server without a share is contacted too. + r"\\192.0.2.1", + r"\\192.0.2.1\", + r"\\SERVER.\share \x.png", + ]; + let device = [ + r"\\.\pipe\figcraft", + r"\\?\GLOBALROOT\Device\Mup\192.0.2.1\share\x.png", + r"\\.\C:\work\x.png", + r"\\.\COM1", + r"\??\UNC\192.0.2.1\share\x.png", + // A device name anywhere: each folder on the way is opened as the path is resolved. + r"C:\work\COM1", + r"C:\work\nul.txt", + r"C:\work\Com1 .png", + r"C:\work\lpt1.\x.png", + r"C:\work\LPT³\x.png", + r"C:\work\conout$", + r"C:\work\aux:stream", + // After a name `craft_docpath` refuses for another reason. + r"C:\work\a:b\prn.png", + ]; + let fine = [ + r"C:\work\x.png", + r"\\?\C:\work\x.png", + r"C:\work\console.png", + r"C:\work\com10.png", + r"C:\work\lpt.png", + r"C:\work\nul-ish.txt", + r"\\?\Volume{0b3b1c63-0000-0000-0000-100000000000}\x.png", + "/home/u/work/x.png", + "x.png", + r"..\x.png", + ]; + for (paths, want) in [(&network[..], Some(Network)), (&device[..], Some(Device)), (&fine[..], None)] { + for p in paths { + assert_eq!(refused_spelling(p, &[]), want, "{p}"); + assert_eq!(refused_spelling(p, &local), want, "{p} with a local root"); + } + } + // A root on a share lets the paths on that share through, in any case and spelling, and only them. + let shared = [PathBuf::from(r"\\?\UNC\Server\Share\work")]; + for p in [r"\\server\SHARE\work\x.png", r"\\?\UNC\SERVER\share\elsewhere\x.png", "//Server/Share/work/x.png"] { + assert_eq!(refused_spelling(p, &shared), None, "{p}"); + } + for p in [r"\\server\other\x.png", r"\\other\share\x.png", r"\\server", r"\\server.\share\x.png"] { + assert_eq!(refused_spelling(p, &shared), Some(Network), "{p}"); + } + assert_eq!(refused_spelling(r"\\server\share\work\COM1", &shared), Some(Device)); +} + +/// The links on the way to a path are followed by their spelling before anything they lead to is +/// opened (#1094). The links are made up here, so this runs where tests may not make links. +#[test] +fn links_on_the_way_are_followed_by_their_spelling_first() { + use super::{Entry, MAX_LINKS, link_refused}; + use std::cell::RefCell; + use std::collections::HashMap; + let base = std::env::temp_dir().join("figcraft-links"); + let at = |rel: &str| base.join(rel); + let mut links: HashMap> = HashMap::from([ + // Relative to the link's folder, to a device name. + (at("root/dev"), Some(PathBuf::from("../outside/nul"))), + // To another link. + (at("root/hop"), Some(at("root/dev"))), + // Within the root. + (at("root/alias"), Some(PathBuf::from("sub"))), + (at("root/loop"), Some(at("root/loop"))), + (at("root/unreadable"), None), + // Below a name that isn't there: never looked at. + (at("missing/dev"), Some(PathBuf::from("nul"))), + ]); + if cfg!(windows) { + links.insert(at("root/remote"), Some(PathBuf::from(r"\\192.0.2.1\share"))); + links.insert(at("root/far"), Some(at("root/remote/work"))); + } + let plain = [at("root"), at("root/sub"), at("outside")]; + let looked = RefCell::new(Vec::new()); + let look = |p: &Path| { + looked.borrow_mut().push(p.to_path_buf()); + match links.get(p) { + Some(target) => Entry::Link(target.clone()), + None if base.starts_with(p) || plain.iter().any(|q| q == p) => Entry::Plain, + None => Entry::Missing, + } + }; + let refused = |rel: &str, roots: &[PathBuf]| link_refused(&at(rel), roots, MAX_LINKS, &look); + for rel in ["root/dev/x.png", "root/hop/x.png", "root/loop/x.png", "root/unreadable/x.png"] { + assert!(refused(rel, &[]), "{rel}"); + } + for rel in ["root/alias/x.png", "root/sub/x.png", "root/x.png", "missing/dev/x.png"] { + assert!(!refused(rel, &[]), "{rel}"); + } + // A refused target isn't looked at, nor is anything below what isn't there. + let looked = looked.take(); + assert!(!looked.contains(&at("outside/nul")) && !looked.contains(&at("missing/dev")), "{looked:?}"); + if cfg!(windows) { + for rel in ["root/remote/x.png", "root/far/x.png"] { + assert!(refused(rel, &[]), "{rel}"); + // Unless a root is on that share. + assert!(!refused(rel, &[PathBuf::from(r"\\?\UNC\192.0.2.1\share")]), "{rel}"); + } + } +} + +/// A path on another computer, a device path, and a link to them are refused before anything is +/// opened: resolving them made Windows contact the server, which may send it the signed-in user's +/// credentials (#1094). Nothing answers on 192.0.2.1 (an address for documentation), so a path +/// there that is opened takes Windows seconds to give up on; one refused first, none. +#[cfg(windows)] +#[test] +fn other_computers_and_devices_are_refused_before_anything_is_opened() { + use std::time::{Duration, Instant}; + let f = Fixture::new("network"); + let r = f.rw(); + let read_only = Roots::new(&[f.p("root")], &[]).unwrap(); + let refused = |roots: &Roots, p: &str, access: Access| { + let t = Instant::now(); + let e = roots.check(Path::new(p), access).expect_err(p); + assert!(t.elapsed() < Duration::from_secs(3), "{p}: took {:?}, so it was opened", t.elapsed()); + e + }; + for p in + [r"\\192.0.2.1\share\x.png", "//192.0.2.1/share/x.png", r"\\?\UNC\192.0.2.1\share\x.png", r"\\.\UNC\192.0.2.1\share\x.png", r"\\192.0.2.1"] + { + for access in [Access::Read, Access::Write] { + let e = refused(&r, p, access); + assert!(e.contains("is on another computer, and no folder that may be"), "{p}: {e}"); + } + let e = refused(&read_only, p, Access::Write); + assert!(e.ends_with("is on another computer, and no folder that may be written is on its share"), "{p}: {e}"); + } + for p in [r"\\.\pipe\figcraft-roots", r"\\?\GLOBALROOT\Device\Mup\192.0.2.1\share\x.png", &f.p(r"root\COM1\x.png"), "nul"] { + let e = refused(&r, p, Access::Read); + assert!(e.ends_with("names a device, not a file"), "{p}: {e}"); + } + // Local paths, in either spelling, are checked as before. + let inside = std::fs::canonicalize(f.p("root")).unwrap().join("in.txt"); + assert!(r.check(&inside, Access::Read).is_ok()); + assert!(r.check(Path::new(&f.p(r"root\in.txt")), Access::Read).is_ok()); + + // A link in a root to another computer is refused before it is followed, also through another + // link, and with the message any path outside gets: it doesn't tell where the link leads. + if !symlink_dir(Path::new(r"\\192.0.2.1\share"), &f.0.join("root/remote")) || !symlink_dir(&f.0.join("root/remote/work"), &f.0.join("root/hop")) { + eprintln!("skipped links: this system doesn't let tests make symbolic links"); + return; + } + // Relative to the link's folder. + assert!(symlink_dir(Path::new(r"..\remote"), &f.0.join("root/sub/up"))); + assert!(symlink_file(Path::new(r"\\.\pipe\figcraft-roots"), &f.0.join("root/pipe"))); + let standard = |p: &str| format!("automation path rejected: {p} is outside the folders that may be"); + for p in [f.p("root/remote/x.png"), f.p("root/hop/x.png"), f.p("root/sub/up/x.png"), f.p("root/pipe")] { + for access in [Access::Read, Access::Write] { + let e = refused(&r, &p, access); + assert!(e.starts_with(&standard(&p)), "{p}: {e}"); + } + } + // A link to a folder in the root still leads there. + assert!(symlink_dir(&f.0.join("root/sub"), &f.0.join("root/alias"))); + assert!(r.check(Path::new(&f.p("root/alias/x.png")), Access::Write).is_ok()); +} + #[test] fn a_scope_confines_the_thread_and_ends_with_it() { let f = Fixture::new("scope"); From 8330ffb32a9cfe5ab0d035ae21f063f4f41f32cc Mon Sep 17 00:00:00 2001 From: ljkx <177671075+ljkx@users.noreply.github.com> Date: Mon, 9 Nov 2026 12:44:21 +0100 Subject: [PATCH 073/239] M1: Crop chosen in the colour picker enters crop mode (#2150) Choosing Crop from the image fill's mode dropdown only set scale_mode: crop mode never started, the first press on a handle closed the picker and went to the tool, and the picture lost its place (no placement crop). For one layer's image fill it now runs image.crop, as Object > Crop image and the Fill row's button do; other targets only set the mode, as before. Fixes #2150 --- crates/ui-egui/src/crop_image_tests.rs | 53 +++++++++++++++++++++++ crates/ui-egui/src/widgets/colorpicker.rs | 31 +++++++++++-- 2 files changed, 81 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/crop_image_tests.rs b/crates/ui-egui/src/crop_image_tests.rs index 7883e9fe8..00a55f7dc 100644 --- a/crates/ui-egui/src/crop_image_tests.rs +++ b/crates/ui-egui/src/crop_image_tests.rs @@ -128,3 +128,56 @@ fn in_crop_mode_the_layers_edges_crop_without_moving_the_picture() { key(&mut u, Key::Escape); assert!(ghost(&mut u).is_none(), "gone with crop mode"); } + +/// Choose `item` from the image mode dropdown of the open colour picker, which reads `shown`. +fn choose_mode(u: &mut Ui, shown: &str, item: &str) { + for text in [shown, item] { + // The picker is drawn over the Design panel, so its text comes last. + let shapes = flat(&u.frame_output(vec![]).shapes); + let (_, p, size) = crate::live_tests::texts(&shapes).into_iter().rfind(|(t, _, _)| t == text).unwrap_or_else(|| panic!("no {text:?}")); + u.button(p + size / 2.0, true); + u.button(p + size / 2.0, false); + } + u.frame(vec![]); +} + +/// Crop chosen as the image fill's mode in the colour picker enters crop mode, as Crop image does +/// (#2150): the picker closes, the picture keeps its place, and a corner handle then crops it +/// with the layer still selected. The other modes only set the mode. +#[test] +fn crop_chosen_in_the_colour_picker_enters_crop_mode() { + let (mut u, layer, _) = setup(); + u.app.ui.picker = Some(crate::colorpicker::PickerTarget::Paint { fills: true, index: 0, ids: vec![layer] }); + for _ in 0..4 { + u.frame(vec![]); + } + choose_mode(&mut u, "Fill", "Fit"); + assert_eq!(mode(&u, layer), (ImageScaleMode::Fit, None)); + assert!(u.app.ui.picker.is_some() && u.app.ui.crop.is_none(), "Fit is only a mode"); + choose_mode(&mut u, "Fit", "Crop"); + assert_eq!(u.app.ui.crop, Some((layer, 0)), "crop mode on the image fill"); + assert!(u.app.ui.picker.is_none(), "crop mode takes the canvas from the picker"); + // The picture keeps its place: the crop is the one Crop image makes of the fitted image. + let (m, Some(before)) = mode(&u, layer) else { panic!("a crop where the picture was") }; + assert_eq!(m, ImageScaleMode::Crop); + let (mut menu, other, _) = setup(); + let mut fit = menu.app.session.doc().unwrap().node(other).unwrap().fills[0].clone(); + if let PaintKind::Image(img) = &mut fit.kind { + img.scale_mode = ImageScaleMode::Fit; + } + menu.app.run("fill.set", json!({"ids": [other], "index": 0, "paint": fit})); + assert_eq!(mode(&menu, other), (ImageScaleMode::Fit, None)); + menu.app.run("image.crop", json!({})); + assert_eq!(mode(&menu, other), (ImageScaleMode::Crop, Some(before))); + // The bottom right corner, dragged in, crops the picture to the top left 3/4 of the layer. + let (from, to) = (u.app.to_screen(200.0, 100.0), u.app.to_screen(150.0, 75.0)); + u.drag_to(from, to); + u.button(to, false); + assert_eq!(u.app.session.selection(), vec![layer], "the layer stays selected"); + assert_eq!(u.app.ui.crop, Some((layer, 0)), "still cropping"); + let n = u.app.session.doc().unwrap().node(layer).unwrap().clone(); + assert!((n.width - 150.0).abs() < 1e-6 && (n.height - 75.0).abs() < 1e-6, "{} x {}", n.width, n.height); + let (_, Some(after)) = mode(&u, layer) else { panic!("a crop") }; + assert!((after[0] - before[0] * 0.75).abs() < 1e-9 && (after[3] - before[3] * 0.75).abs() < 1e-9, "{before:?} -> {after:?}"); + assert!((after[4] - before[4]).abs() < 1e-9 && (after[5] - before[5]).abs() < 1e-9, "the top left stays: {before:?} -> {after:?}"); +} diff --git a/crates/ui-egui/src/widgets/colorpicker.rs b/crates/ui-egui/src/widgets/colorpicker.rs index 1e6f9d347..848a0c8d3 100644 --- a/crates/ui-egui/src/widgets/colorpicker.rs +++ b/crates/ui-egui/src/widgets/colorpicker.rs @@ -760,6 +760,21 @@ fn blend_row(ui: &mut Ui, app: &mut FigApp, target: &PickerTarget, paint: &mut P }); } +/// The layer and fill index to crop on the canvas (`image.crop`) when Crop is chosen for `target`: +/// one layer's image fill as the Fill section shows it (a text's characters' shared fills +/// included). Strokes, several layers at once and the regions selected in vector edit mode have +/// no crop mode, so for them Crop only sets the paint's mode. +fn crop_on_canvas(app: &FigApp, target: &PickerTarget) -> Option<(NodeId, usize)> { + let PickerTarget::Paint { fills: true, index, ids } = target else { return None }; + let [id] = ids[..] else { return None }; + if figcraft_engine::vectoredit::selected_region_fills(&app.session, id).is_some() { + return None; + } + let doc = app.session.doc().ok()?; + let shown = figcraft_engine::cmd::lists::character_fills(doc.node(id)?)?; + matches!(shown.get(*index)?.kind, PaintKind::Image(_)).then_some((id, *index)) +} + /// The image paint's scale mode, rotation, colour profile, presets and filter sliders. fn image_controls(app: &mut FigApp, ui: &mut Ui, target: &PickerTarget, paint: &mut Paint, mut img: ImagePaint, t: &Tokens) { ui.horizontal(|ui| { @@ -773,9 +788,19 @@ fn image_controls(app: &mut FigApp, ui: &mut Ui, target: &PickerTarget, paint: & (tr("Tile"), ImageScaleMode::Tile), ] { if crate::right::menu_item(ui, l, "") { - img.scale_mode = m; - paint.kind = PaintKind::Image(img.clone()); - write(app, target, paint, false); + match crop_on_canvas(app, target).filter(|_| m == ImageScaleMode::Crop) { + // Crop for a layer's own image fill is Crop image (#2150): the picture keeps + // its place and crop mode takes the canvas, closing the picker, so its + // handles crop it as they do when crop mode comes from the menu. + Some((id, index)) => { + app.run("image.crop", json!({"ids": [id], "index": index})); + } + None => { + img.scale_mode = m; + paint.kind = PaintKind::Image(img.clone()); + write(app, target, paint, false); + } + } ui.close(); } } From 91a76c72c4a40ff1fe245521459cd3caf59604c4 Mon Sep 17 00:00:00 2001 From: ljkx <177671075+ljkx@users.noreply.github.com> Date: Mon, 9 Nov 2026 12:53:10 +0100 Subject: [PATCH 074/239] M1: the picker-Crop test drags the picture's corner outside the layer too (#2150) --- crates/ui-egui/src/crop_image_tests.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/ui-egui/src/crop_image_tests.rs b/crates/ui-egui/src/crop_image_tests.rs index 00a55f7dc..9f802aee2 100644 --- a/crates/ui-egui/src/crop_image_tests.rs +++ b/crates/ui-egui/src/crop_image_tests.rs @@ -180,4 +180,16 @@ fn crop_chosen_in_the_colour_picker_enters_crop_mode() { let (_, Some(after)) = mode(&u, layer) else { panic!("a crop") }; assert!((after[0] - before[0] * 0.75).abs() < 1e-9 && (after[3] - before[3] * 0.75).abs() < 1e-9, "{before:?} -> {after:?}"); assert!((after[4] - before[4]).abs() < 1e-9 && (after[5] - before[5]).abs() < 1e-9, "the top left stays: {before:?} -> {after:?}"); + // The picture's own corner, now outside the layer at (200, 100), scales the picture inside the + // layer, which keeps its size and its selection. + let (from, to) = (u.app.to_screen(200.0, 100.0), u.app.to_screen(240.0, 120.0)); + u.drag_to(from, to); + u.button(to, false); + assert_eq!(u.app.session.selection(), vec![layer], "the layer stays selected"); + assert_eq!(u.app.ui.crop, Some((layer, 0)), "still cropping"); + let n = u.app.session.doc().unwrap().node(layer).unwrap().clone(); + assert!((n.width - 150.0).abs() < 1e-6 && (n.height - 75.0).abs() < 1e-6, "the layer keeps its size: {} x {}", n.width, n.height); + let (_, Some(scaled)) = mode(&u, layer) else { panic!("a crop") }; + // The picture grew from 200 x 100 to 240 x 120: the layer shows 5/6 of what it showed. + assert!((scaled[0] - after[0] * 5.0 / 6.0).abs() < 1e-6 && (scaled[3] - after[3] * 5.0 / 6.0).abs() < 1e-6, "{after:?} -> {scaled:?}"); } From 50a76d091421d629a50dbb2b4e1fddf6ae21fcd3 Mon Sep 17 00:00:00 2001 From: Ragulsundaram <41433645+Ragulsundaram@users.noreply.github.com> Date: Mon, 9 Nov 2026 18:45:27 +0530 Subject: [PATCH 075/239] i18n: Tamil (ta) interface catalog (#2159) Adds ta.toml with every UI string, command label and menu wording, marked draft. Desktop draws Tamil with an installed face (#2018); the web picker leaves Tamil out until craft-fonts has Noto Sans Tamil, like Georgian and Arabic, with a test. docs/translating.md gains Tamil's entry, typography notes and a Tamil draft section. --- crates/ui-egui/locales/ta.toml | 2685 ++++++++++++++++++++++++++++++++ crates/ui-egui/src/cjk.rs | 13 + docs/translating.md | 19 +- 3 files changed, 2716 insertions(+), 1 deletion(-) create mode 100644 crates/ui-egui/locales/ta.toml diff --git a/crates/ui-egui/locales/ta.toml b/crates/ui-egui/locales/ta.toml new file mode 100644 index 000000000..15b12d854 --- /dev/null +++ b/crates/ui-egui/locales/ta.toml @@ -0,0 +1,2685 @@ +# FigCraft interface strings: Tamil (தமிழ்), translated from the English catalog. +# See docs/translating.md. + +[meta] +name = "தமிழ்" +status = "draft — needs native review" + +[ui] +"% of all commits" = "அனைத்து கமிட்களில் %" +"(no longer published)" = "(இனி வெளியிடப்படவில்லை)" +"({n} warnings: some entries were skipped)" = { one = "({n} எச்சரிக்கை: சில உள்ளீடுகள் தவிர்க்கப்பட்டன)", other = "({n} எச்சரிக்கைகள்: சில உள்ளீடுகள் தவிர்க்கப்பட்டன)" } +"+ Create variable" = "+ வேரியபிள் உருவாக்கு" +".fig (experimental)" = ".fig (சோதனை நிலை)" +"1 year" = "1 ஆண்டு" +"1…9, 0" = "1…9, 0" +"30 days" = "30 நாட்கள்" +"90 days" = "90 நாட்கள்" +"@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{bin_added} / −{bin_deleted} binary assets, {first} – {last}" = "@{login}: {prs} PRகள், {commits} கமிட்கள், +{added} / −{deleted} வரிகள் (Δ {delta}), +{bin_added} / −{bin_deleted} பைனரி அசெட்கள், {first} – {last}" +"A .figcraft file with this name already exists. Choose its full name to confirm replacement." = "இந்தப் பெயரில் ஒரு .figcraft கோப்பு ஏற்கனவே உள்ளது. மாற்றியமைப்பை உறுதிப்படுத்த அதன் முழுப் பெயரைத் தேர்ந்தெடுக்கவும்." +"A collection of this file with these modes and variables: override their values per mode and add variables of its own" = "இந்தக் கோப்பின் இந்த மோட்கள் மற்றும் வேரியபிள்களுடன் கூடிய தொகுப்பு: ஒவ்வொரு மோடுக்கும் அவற்றின் மதிப்புகளை மாற்றலாம், சொந்த வேரியபிள்களையும் சேர்க்கலாம்" +"A later vote" = "பிந்தைய வாக்கு" +"A layer on its own aligns to its frame: select more layers, or one in a frame" = "தனி லேயர் அதன் ஃப்ரேமுடன் சீரமையும்: கூடுதல் லேயர்களை அல்லது ஃப்ரேமில் உள்ள ஒன்றைத் தேர்ந்தெடுக்கவும்" +"A responsive product page: hero, features, figures, a quote and a footer" = "பதிலளிக்கும் தயாரிப்புப் பக்கம்: ஹீரோ, அம்சங்கள், எண்ணிக்கைகள், மேற்கோள் மற்றும் அடிக்குறிப்பு" +"A spring plays until it settles: its mass, stiffness and damping set how long" = "ஸ்பிரிங் நிலைபெறும் வரை இயங்கும்: அதன் நிறை, விறைப்பு, தணிப்பு ஆகியவை கால அளவைத் தீர்மானிக்கின்றன" +"A table takes at most {rows} rows and {columns} columns: the rest wasn't pasted" = "ஒரு அட்டவணையில் அதிகபட்சம் {rows} வரிசைகளும் {columns} நெடுவரிசைகளும் இருக்கலாம்: மீதி ஒட்டப்படவில்லை" +"A title, an agenda, a big figure, a chart and a closing slide" = "தலைப்பு, நிகழ்ச்சி நிரல், பெரிய எண், விளக்கப்படம் மற்றும் நிறைவு ஸ்லைடு" +"A to Z" = "A முதல் Z வரை" +"About" = "பற்றி" +"About FigCraft" = "FigCraft பற்றி" +"About this server" = "இந்த சர்வர் பற்றி" +"Action" = "செயல்" +"Actions" = "செயல்கள்" +"Actions for {name}" = "{name} க்கான செயல்கள்" +"Actions…" = "செயல்கள்…" +"Active" = "செயலில்" +"Actual size (100%)" = "உண்மையான அளவு (100%)" +"Add a category" = "வகையைச் சேர்" +"Add a comment" = "கருத்தைச் சேர்" +"Add a connected shape" = "இணைந்த வடிவத்தைச் சேர்" +"Add a description" = "விளக்கத்தைச் சேர்" +"Add a frame (F) or a shape (R) to get started" = "தொடங்க ஒரு ஃப்ரேம் (F) அல்லது வடிவத்தை (R) சேர்க்கவும்" +"Add a layer or component to tile first" = "முதலில் டைல் செய்ய ஒரு லேயர் அல்லது காம்போனென்டைச் சேர்க்கவும்" +"Add a minute" = "ஒரு நிமிடம் சேர்" +"Add a note for developers" = "டெவலப்பர்களுக்கான குறிப்பைச் சேர்" +"Add action" = "செயலைச் சேர்" +"Add actions for when no condition holds" = "எந்த நிபந்தனையும் பொருந்தாதபோது செயல்களைச் சேர்" +"Add an annotation for developers" = "டெவலப்பர்களுக்கான குறிப்புரையைச் சேர்" +"Add another condition" = "மற்றொரு நிபந்தனையைச் சேர்" +"Add auto layout" = "ஆட்டோ லேஅவுட் சேர்" +"Add background behind overlay" = "ஓவர்லேவின் பின்னால் பின்னணி சேர்" +"Add column" = "நெடுவரிசை சேர்" +"Add content to this slot" = "இந்த ஸ்லாட்டில் உள்ளடக்கம் சேர்" +"Add dev resource" = "டெவ் ஆதாரத்தைச் சேர்" +"Add effect" = "எஃபெக்ட் சேர்" +"Add export setting" = "ஏற்றுமதி அமைப்பைச் சேர்" +"Add fill" = "ஃபில் சேர்" +"Add interaction" = "இன்டராக்ஷனைச் சேர்" +"Add layout grid" = "லேஅவுட் கட்டம் சேர்" +"Add library" = "லைப்ரரி சேர்" +"Add library file…" = "லைப்ரரி கோப்பைச் சேர்…" +"Add max height" = "அதிகபட்ச உயரம் சேர்" +"Add max width" = "அதிகபட்ச அகலம் சேர்" +"Add measurement" = "அளவீடு சேர்" +"Add min height" = "குறைந்தபட்ச உயரம் சேர்" +"Add min width" = "குறைந்தபட்ச அகலம் சேர்" +"Add mode" = "மோட் சேர்" +"Add new page" = "புதிய பக்கம் சேர்" +"Add or update collections from a variables JSON" = "வேரியபிள்கள் JSON இலிருந்து தொகுப்புகளைச் சேர் அல்லது புதுப்பி" +"Add properties to make instances configurable" = "இன்ஸ்டன்ஸ்களை உள்ளமைக்க பண்புகளைச் சேர்க்கவும்" +"Add reaction" = "எதிர்வினை சேர்" +"Add row" = "வரிசை சேர்" +"Add starting point" = "தொடக்கப் புள்ளி சேர்" +"Add stroke" = "ஸ்ட்ரோக் சேர்" +"Add variant" = "வேரியன்ட் சேர்" +"Add variant with a new value" = "புதிய மதிப்புடன் வேரியன்ட் சேர்" +"Added" = "சேர்க்கப்பட்டது" +"Added the library \"{name}\"" = "\"{name}\" லைப்ரரி சேர்க்கப்பட்டது" +"Adding to {name}" = "{name} இல் சேர்க்கிறது" +"Adjust" = "சரிசெய்" +"Adjustment presets" = "சரிசெய்தல் முன்னமைவுகள்" +"Advanced" = "மேம்பட்டவை" +"Advanced stroke" = "மேம்பட்ட ஸ்ட்ரோக்" +"After delay" = "தாமதத்திற்குப் பின்" +"After delay {ms}ms" = "{ms}ms தாமதத்திற்குப் பின்" +"Agent" = "ஏஜென்ட்" +"Align" = "சீரமை" +"Align bottom" = "கீழே சீரமை" +"Align center" = "மையத்தில் சீரமை" +"Align horizontal centers" = "கிடைமட்ட மையங்களைச் சீரமை" +"Align left" = "இடதுபுறம் சீரமை" +"Align middle" = "நடுவில் சீரமை" +"Align right" = "வலதுபுறம் சீரமை" +"Align text baselines" = "உரை அடிக்கோடுகளைச் சீரமை" +"Align top" = "மேலே சீரமை" +"Align vertical centers" = "செங்குத்து மையங்களைச் சீரமை" +"Alignment" = "சீரமைப்பு" +"All" = "அனைத்தும்" +"All categories" = "அனைத்து வகைகள்" +"All comments" = "அனைத்து கருத்துகள்" +"All components" = "அனைத்து காம்போனென்ட்கள்" +"All fonts" = "அனைத்து எழுத்துருக்கள்" +"All objects" = "அனைத்து பொருள்கள்" +"All supported properties" = "ஆதரிக்கப்படும் அனைத்து பண்புகள்" +"All the fonts this file uses are installed" = "இந்தக் கோப்பு பயன்படுத்தும் அனைத்து எழுத்துருக்களும் நிறுவப்பட்டுள்ளன" +"All variables" = "அனைத்து வேரியபிள்கள்" +"Allow and download" = "அனுமதித்து பதிவிறக்கு" +"Allow downloading fonts?" = "எழுத்துருக்களைப் பதிவிறக்க அனுமதிக்கவா?" +"Along the bottom" = "கீழே நெடுகிலும்" +"Along the left" = "இடதுபுறம் நெடுகிலும்" +"Along the right" = "வலதுபுறம் நெடுகிலும்" +"Along the top" = "மேலே நெடுகிலும்" +"Alpha" = "ஆல்ஃபா" +"Alphabetical" = "அகர வரிசை" +"Alt+double-click an edge of an auto layout child" = "ஆட்டோ லேஅவுட் சைல்டின் ஓரத்தை Alt+இருமுறை கிளிக் செய்யவும்" +"Alt+drag" = "Alt+இழு" +"An analytics screen on a grid: figures, charts drawn from vectors and a table" = "வெக்டர்களால் வரையப்பட்ட விளக்கப்படங்கள், எண்ணிக்கைகள் மற்றும் அட்டவணையுடன் கட்டத்தில் ஒரு பகுப்பாய்வுத் திரை" +"An earlier vote" = "முந்தைய வாக்கு" +"An invite link that opens FigCraft and joins" = "FigCraft ஐத் திறந்து இணையும் அழைப்பு இணைப்பு" +"Anchor" = "நங்கூரம்" +"Android" = "Android" +"Android Vector Drawable" = "Android Vector Drawable" +"Angular" = "கோண" +"Animation" = "அனிமேஷன்" +"Annotations" = "குறிப்புரைகள்" +"Annotations shown on the canvas" = "கேன்வாஸில் காட்டப்படும் குறிப்புரைகள்" +"Another server, or one that needs its key. The usual server is set in Preferences." = "மற்றொரு சர்வர், அல்லது சாவி தேவைப்படும் ஒன்று. வழக்கமான சர்வர் விருப்பங்களில் அமைக்கப்பட்டுள்ளது." +"Any status" = "எந்த நிலையும்" +"Anyone on your network with this code can edit the file, while this app stays open." = "இந்த ஆப் திறந்திருக்கும் வரை, இந்தக் குறியீடு உள்ள உங்கள் நெட்வொர்க்கில் உள்ள எவரும் கோப்பைத் திருத்தலாம்." +"Anyone on your network with this code can look at the file, not change it, while this app stays open." = "இந்த ஆப் திறந்திருக்கும் வரை, இந்தக் குறியீடு உள்ள உங்கள் நெட்வொர்க்கில் உள்ள எவரும் கோப்பைப் பார்க்கலாம், மாற்ற முடியாது." +"Anyone with the edit link can change the file; the view link only lets people look. The links carry their secrets: share them like passwords. `figcraft-server links` makes more and revokes them." = "திருத்தும் இணைப்பு உள்ள எவரும் கோப்பை மாற்றலாம்; பார்க்கும் இணைப்பு பார்க்க மட்டுமே அனுமதிக்கும். இணைப்புகளில் அவற்றின் ரகசியங்கள் உள்ளன: கடவுச்சொற்களைப் போலப் பகிரவும். `figcraft-server links` மேலும் இணைப்புகளை உருவாக்கி அவற்றைத் திரும்பப் பெறும்." +"Anyone with this code can edit the file." = "இந்தக் குறியீடு உள்ள எவரும் கோப்பைத் திருத்தலாம்." +"Anyone with this code can look at the file and comment on it, not change it." = "இந்தக் குறியீடு உள்ள எவரும் கோப்பைப் பார்த்துக் கருத்து தெரிவிக்கலாம், மாற்ற முடியாது." +"Anyone with this code can look at the file, not change it." = "இந்தக் குறியீடு உள்ள எவரும் கோப்பைப் பார்க்கலாம், மாற்ற முடியாது." +"Appearance" = "தோற்றம்" +"Apply a component property" = "காம்போனென்ட் பண்பைப் பயன்படுத்து" +"Apply variable" = "வேரியபிளைப் பயன்படுத்து" +"Apply variable to text" = "உரைக்கு வேரியபிளைப் பயன்படுத்து" +"Apply variable to visibility" = "தெரிவுநிலைக்கு வேரியபிளைப் பயன்படுத்து" +"Apps" = "ஆப்கள்" +"Apr" = "ஏப்" +"Arc" = "வில்" +"Arc ratio" = "வில் விகிதம்" +"Arc start" = "வில் தொடக்கம்" +"Arc sweep" = "வில் பரப்பு" +"Archive" = "காப்பகப்படுத்து" +"Archived" = "காப்பகப்படுத்தப்பட்டது" +"Arrange" = "ஒழுங்குபடுத்து" +"Arrow" = "அம்பு" +"Arrow left" = "இடது அம்பு" +"Arrow right" = "வலது அம்பு" +"As typed" = "தட்டச்சு செய்தபடி" +"Asking the server…" = "சர்வரிடம் கேட்கிறது…" +"Assets" = "அசெட்கள்" +"Aug" = "ஆக" +"Auto" = "ஆட்டோ" +"Auto (space around)" = "ஆட்டோ (சுற்றி இடைவெளி)" +"Auto (space between)" = "ஆட்டோ (இடையில் இடைவெளி)" +"Auto (space evenly)" = "ஆட்டோ (சம இடைவெளி)" +"Auto ({mode})" = "ஆட்டோ ({mode})" +"Auto columns" = "ஆட்டோ நெடுவரிசைகள்" +"Auto gap" = "ஆட்டோ இடைவெளி" +"Auto height" = "ஆட்டோ உயரம்" +"Auto layout" = "ஆட்டோ லேஅவுட்" +"Auto rows" = "ஆட்டோ வரிசைகள்" +"Auto width" = "ஆட்டோ அகலம்" +"Auto: as many words as fit on each line" = "ஆட்டோ: ஒவ்வொரு வரியிலும் பொருந்தும் அளவு சொற்கள்" +"Auto: by the first letter with a direction" = "ஆட்டோ: திசையுள்ள முதல் எழுத்தின்படி" +"Back" = "பின்" +"Back to Ready for dev" = "டெவ்-க்குத் தயார் நிலைக்குத் திரும்பு" +"Back to Ready for dev: the next change compares with how it is now" = "டெவ்-க்குத் தயார் நிலைக்குத் திரும்பு: அடுத்த மாற்றம் தற்போதைய நிலையுடன் ஒப்பிடப்படும்" +"Back to assets" = "அசெட்களுக்குத் திரும்பு" +"Back to current" = "தற்போதையதற்குத் திரும்பு" +"Back to styles" = "ஸ்டைல்களுக்குத் திரும்பு" +"Back to the FigCraft server" = "FigCraft சர்வருக்குத் திரும்பு" +"Back to the canvas from a focused region" = "கவனப் பகுதியிலிருந்து கேன்வாஸுக்குத் திரும்பு" +"Back to the current version" = "தற்போதைய பதிப்புக்குத் திரும்பு" +"Back to the font's value" = "எழுத்துருவின் மதிப்புக்குத் திரும்பு" +"Back to the values the font style implies" = "எழுத்துரு ஸ்டைல் குறிக்கும் மதிப்புகளுக்குத் திரும்பு" +"Background" = "பின்னணி" +"Background blur" = "பின்னணி மங்கல்" +"Balance" = "சமநிலை" +"Balance: every line close to the same length" = "சமநிலை: ஒவ்வொரு வரியும் ஏறக்குறைய ஒரே நீளம்" +"Basics" = "அடிப்படைகள்" +"Before" = "முன்" +"Bend" = "வளை" +"Best effort" = "இயன்றவரை" +"Between the selected layers" = "தேர்ந்தெடுத்த லேயர்களுக்கு இடையில்" +"Bevel" = "சாய்விளிம்பு" +"Binary assets added" = "சேர்க்கப்பட்ட பைனரி அசெட்கள்" +"Binary assets removed" = "நீக்கப்பட்ட பைனரி அசெட்கள்" +"Black & white" = "கருப்பு வெள்ளை" +"Bleed" = "ப்ளீட்" +"Bleed marks" = "ப்ளீட் குறிகள்" +"Bleed marks need a bleed" = "ப்ளீட் குறிகளுக்கு ப்ளீட் தேவை" +"Blend" = "கலப்பு" +"Blend mode" = "கலப்பு முறை" +"Blue" = "நீலம்" +"Blur" = "மங்கல்" +"Board grid" = "போர்டு கட்டம்" +"Boolean" = "பூலியன்" +"Boolean groups" = "பூலியன் குழுக்கள்" +"Both directions" = "இரு திசைகளிலும்" +"Bottom" = "கீழ்" +"Bottom left radius" = "கீழ் இடது ஆரம்" +"Bottom padding" = "கீழ் பேடிங்" +"Bottom right radius" = "கீழ் வலது ஆரம்" +"Bound to {name}. Click to detach the variable." = "{name} உடன் இணைக்கப்பட்டுள்ளது. வேரியபிளைப் பிரிக்கக் கிளிக் செய்யவும்." +"Brainstorm" = "கருத்துதிர்ப்பு" +"Branch" = "கிளை" +"Branch archived" = "கிளை காப்பகப்படுத்தப்பட்டது" +"Branch merged" = "கிளை இணைக்கப்பட்டது" +"Branch name" = "கிளையின் பெயர்" +"Branch of {file}" = "{file} இன் கிளை" +"Branch of {file} · merged or archived" = "{file} இன் கிளை · இணைக்கப்பட்டது அல்லது காப்பகப்படுத்தப்பட்டது" +"Branch updated from main" = "main இலிருந்து கிளை புதுப்பிக்கப்பட்டது" +"Branch {name}" = "கிளை {name}" +"Branches" = "கிளைகள்" +"Bring forward" = "முன்னே கொண்டு வா" +"Bring the main file's changes into the branch" = "முதன்மைக் கோப்பின் மாற்றங்களைக் கிளைக்குள் கொண்டு வா" +"Bring to front" = "முன்பக்கம் கொண்டு வா" +"Bristle" = "முட்கள்" +"Browse" = "உலாவு" +"Brush" = "தூரிகை" +"Brush rotation jitter" = "தூரிகைச் சுழற்சி மாறுபாடு" +"Brush scatter" = "தூரிகைச் சிதறல்" +"Brush size jitter" = "தூரிகை அளவு மாறுபாடு" +"Brush spacing" = "தூரிகை இடைவெளி" +"Bulleted list" = "புள்ளிப் பட்டியல்" +"C or Shift+C" = "C அல்லது Shift+C" +"C or ⇧C" = "C அல்லது ⇧C" +"CMYK colour" = "CMYK நிறம்" +"CSS custom properties…" = "CSS தனிப்பயன் பண்புகள்…" +"Calculated from other variables; it follows them" = "மற்ற வேரியபிள்களிலிருந்து கணக்கிடப்படுகிறது; அவற்றைப் பின்பற்றும்" +"Can comment" = "கருத்து தெரிவிக்கலாம்" +"Can comment: you see every change as it happens and can comment, but can't edit. Leave to keep a copy you can edit." = "கருத்து தெரிவிக்கலாம்: ஒவ்வொரு மாற்றத்தையும் நடக்கும்போதே பார்த்துக் கருத்து தெரிவிக்கலாம், ஆனால் திருத்த முடியாது. திருத்தக்கூடிய நகலை வைத்திருக்க வெளியேறவும்." +"Can edit" = "திருத்தலாம்" +"Can view" = "பார்க்கலாம்" +"Can't read this library: {e}" = "இந்த லைப்ரரியைப் படிக்க முடியவில்லை: {e}" +"Cancel" = "ரத்துசெய்" +"Canvas" = "கேன்வாஸ்" +"Canvas stacking" = "கேன்வாஸ் அடுக்கு வரிசை" +"Cap height to baseline" = "கேப் உயரம் முதல் அடிக்கோடு வரை" +"Case" = "எழுத்துவகை" +"Case-sensitive forms" = "பெரிய எழுத்துக்கு ஏற்ற வடிவங்கள்" +"Categories" = "வகைகள்" +"Center" = "மையம்" +"Change alias" = "மாற்றுப்பெயரை மாற்று" +"Change resolved" = "மாற்றம் தீர்க்கப்பட்டது" +"Change style" = "ஸ்டைலை மாற்று" +"Change to" = "இதற்கு மாற்று" +"Change to needs a layer inside a variant" = "\"இதற்கு மாற்று\" க்கு வேரியன்டுக்குள் ஒரு லேயர் தேவை" +"Changed" = "மாற்றப்பட்டது" +"Changed on both sides: keep one" = "இரு பக்கங்களிலும் மாற்றப்பட்டது: ஒன்றை வைத்திருக்கவும்" +"Changed {date}" = "{date} அன்று மாற்றப்பட்டது" +"Changes on main" = "main இல் மாற்றங்கள்" +"Changes on the branch" = "கிளையில் மாற்றங்கள்" +"Changes unknown" = "மாற்றங்கள் தெரியவில்லை" +"Check" = "சரிபார்" +"Check for Updates" = "புதுப்பிப்புகளைச் சரிபார்" +"Check for updates" = "புதுப்பிப்புகளைச் சரிபார்" +"Check for updates…" = "புதுப்பிப்புகளைச் சரிபார்…" +"Checking the fonts installed on this computer…" = "இந்தக் கணினியில் நிறுவப்பட்ட எழுத்துருக்களைச் சரிபார்க்கிறது…" +"Checking the server…" = "சர்வரைச் சரிபார்க்கிறது…" +"Chevron" = "செவ்ரான்" +"Choose React, Leptos, Vue, SwiftUI, Compose, ArkUI or Flutter above to connect this component to its code." = "இந்தக் காம்போனென்டை அதன் குறியீட்டுடன் இணைக்க மேலே React, Leptos, Vue, SwiftUI, Compose, ArkUI அல்லது Flutter ஐத் தேர்ந்தெடுக்கவும்." +"Choose another profile to change it." = "அதை மாற்ற வேறொரு சுயவிவரத்தைத் தேர்ந்தெடுக்கவும்." +"Choose collection" = "தொகுப்பைத் தேர்ந்தெடு" +"Choose image" = "படத்தைத் தேர்ந்தெடு" +"Choose mode" = "மோடைத் தேர்ந்தெடு" +"Choose variable" = "வேரியபிளைத் தேர்ந்தெடு" +"Circle" = "வட்டம்" +"Clear from this list" = "இந்தப் பட்டியலிலிருந்து அழி" +"Clear recent" = "சமீபத்தியவற்றை அழி" +"Clear results" = "முடிவுகளை அழி" +"Click + to replace mixed content" = "கலப்பு உள்ளடக்கத்தை மாற்ற + ஐக் கிளிக் செய்யவும்" +"Click anywhere on the canvas to leave one." = "ஒன்றை இட கேன்வாஸில் எங்காவது கிளிக் செய்யவும்." +"Click objects to vote; click your badge to take a vote back" = "வாக்களிக்கப் பொருள்களைக் கிளிக் செய்யவும்; வாக்கைத் திரும்பப் பெற உங்கள் பேட்ஜைக் கிளிக் செய்யவும்" +"Click or drag to merge · {alt} removes" = "இணைக்கக் கிளிக் செய்யவும் அல்லது இழுக்கவும் · {alt} நீக்கும்" +"Click or drag to remove · {alt} merges" = "நீக்கக் கிளிக் செய்யவும் அல்லது இழுக்கவும் · {alt} இணைக்கும்" +"Click to record a key" = "விசையைப் பதிவுசெய்யக் கிளிக் செய்யவும்" +"Clip content" = "உள்ளடக்கத்தை வெட்டு" +"Clip to shape" = "வடிவத்திற்கு வெட்டு" +"Close" = "மூடு" +"Close overlay" = "ஓவர்லேவை மூடு" +"Close preview" = "முன்னோட்டத்தை மூடு" +"Close tab" = "தாவலை மூடு" +"Close version history" = "பதிப்பு வரலாற்றை மூடு" +"Close when clicking outside" = "வெளியே கிளிக் செய்யும்போது மூடு" +"Code" = "குறியீடு" +"Code or invite link" = "குறியீடு அல்லது அழைப்பு இணைப்பு" +"Code syntax" = "குறியீட்டு தொடரியல்" +"Collapse" = "சுருக்கு" +"Collection" = "தொகுப்பு" +"Collections" = "தொகுப்புகள்" +"Color" = "நிறம்" +"Color burn" = "நிற எரிப்பு" +"Color dodge" = "நிற ஒளிர்வு" +"Color format" = "நிற வடிவம்" +"Color profile" = "நிறச் சுயவிவரம்" +"Color profile: {name}" = "நிறச் சுயவிவரம்: {name}" +"Color styles" = "நிற ஸ்டைல்கள்" +"Color values in this file are in this color space." = "இந்தக் கோப்பின் நிற மதிப்புகள் இந்த நிற வெளியில் உள்ளன." +"Color variables" = "நிற வேரியபிள்கள்" +"Colour" = "நிறம்" +"Colour and text styles, Light and Dark variables, buttons, inputs and cards" = "நிற மற்றும் உரை ஸ்டைல்கள், Light மற்றும் Dark வேரியபிள்கள், பொத்தான்கள், உள்ளீடுகள் மற்றும் கார்டுகள்" +"Column" = "நெடுவரிசை" +"Column gap" = "நெடுவரிசை இடைவெளி" +"Column sizes" = "நெடுவரிசை அளவுகள்" +"Column span" = "நெடுவரிசை பரவல்" +"Columns" = "நெடுவரிசைகள்" +"Columns {count}" = "நெடுவரிசைகள் {count}" +"Comment" = "கருத்து" +"Comments" = "கருத்துகள்" +"Commits" = "கமிட்கள்" +"Company" = "நிறுவனம்" +"Compare changes" = "மாற்றங்களை ஒப்பிடு" +"Compare with" = "இதனுடன் ஒப்பிடு" +"Compatibility" = "இணக்கத்தன்மை" +"Compatibility notes" = "இணக்கத்தன்மைக் குறிப்புகள்" +"Completed" = "முடிந்தது" +"Component" = "காம்போனென்ட்" +"Component name" = "காம்போனென்ட் பெயர்" +"Component property" = "காம்போனென்ட் பண்பு" +"Component set" = "காம்போனென்ட் தொகுப்பு" +"Component sets" = "காம்போனென்ட் தொகுப்புகள்" +"Components" = "காம்போனென்ட்கள்" +"Conditional" = "நிபந்தனை" +"Confetti" = "வண்ணக் காகிதத் துகள்" +"Conflicts" = "முரண்பாடுகள்" +"Connect to code" = "குறியீட்டுடன் இணை" +"Connected" = "இணைக்கப்பட்டது" +"Connected to code: {from}" = "குறியீட்டுடன் இணைக்கப்பட்டது: {from}" +"Connection lost, reconnecting (attempt {attempt})…" = "இணைப்பு துண்டிக்கப்பட்டது, மீண்டும் இணைக்கிறது (முயற்சி {attempt})…" +"Connector" = "கனெக்டர்" +"Constrain proportions" = "விகிதங்களைக் கட்டுப்படுத்து" +"Constraints" = "கட்டுப்பாடுகள்" +"Content" = "உள்ளடக்கம்" +"Contents hidden" = "உள்ளடக்கம் மறைக்கப்பட்டது" +"Contextual alternates" = "சூழல் மாற்றுருக்கள்" +"Contrast" = "மாறுபாடு" +"Contributors" = "பங்களிப்பாளர்கள்" +"Contributors: {people} · Commits: {commits}" = "பங்களிப்பாளர்கள்: {people} · கமிட்கள்: {commits}" +"Controller" = "கட்டுப்படுத்தி" +"Convert to frame" = "ஃப்ரேமாக மாற்று" +"Convert to section" = "செக்ஷனாக மாற்று" +"Cool" = "குளிர்" +"Copied as CSS" = "CSS ஆக நகலெடுக்கப்பட்டது" +"Copied as PNG" = "PNG ஆக நகலெடுக்கப்பட்டது" +"Copied as SVG" = "SVG ஆக நகலெடுக்கப்பட்டது" +"Copied as text" = "உரையாக நகலெடுக்கப்பட்டது" +"Copied comments for AI" = "AI க்காகக் கருத்துகள் நகலெடுக்கப்பட்டன" +"Copied {value}" = "{value} நகலெடுக்கப்பட்டது" +"Copy" = "நகலெடு" +"Copy as" = "இவ்வாறு நகலெடு" +"Copy as CSS" = "CSS ஆக நகலெடு" +"Copy as PNG" = "PNG ஆக நகலெடு" +"Copy as SVG" = "SVG ஆக நகலெடு" +"Copy browser link" = "உலாவி இணைப்பை நகலெடு" +"Copy code" = "குறியீட்டை நகலெடு" +"Copy effect" = "எஃபெக்டை நகலெடு" +"Copy fill" = "ஃபில்லை நகலெடு" +"Copy for AI" = "AI க்காக நகலெடு" +"Copy link" = "இணைப்பை நகலெடு" +"Copy stroke" = "ஸ்ட்ரோக்கை நகலெடு" +"Copy the {label}" = "{label} ஐ நகலெடு" +"Copy {value}" = "{value} ஐ நகலெடு" +"Corner radius" = "மூலை ஆரம்" +"Corner smoothing" = "மூலை மென்மையாக்கல்" +"Couldn't download the variables" = "வேரியபிள்களைப் பதிவிறக்க முடியவில்லை" +"Couldn't download {name}" = "{name} ஐப் பதிவிறக்க முடியவில்லை" +"Couldn't reach {server} for its team list." = "அணிப் பட்டியலுக்காக {server} ஐ அணுக முடியவில்லை." +"Couldn't reach {server}: showing what this computer remembers." = "{server} ஐ அணுக முடியவில்லை: இந்தக் கணினி நினைவில் வைத்திருப்பதைக் காட்டுகிறது." +"Couldn't read {name}." = "{name} ஐப் படிக்க முடியவில்லை." +"Couldn't save automatically: {error}" = "தானாகச் சேமிக்க முடியவில்லை: {error}" +"Couldn't save the file" = "கோப்பைச் சேமிக்க முடியவில்லை" +"Count" = "எண்ணிக்கை" +"Create" = "உருவாக்கு" +"Create a variable collection first" = "முதலில் ஒரு வேரியபிள் தொகுப்பை உருவாக்கவும்" +"Create a variable first" = "முதலில் ஒரு வேரியபிளை உருவாக்கவும்" +"Create alias" = "மாற்றுப்பெயர் உருவாக்கு" +"Create branch" = "கிளை உருவாக்கு" +"Create collection" = "தொகுப்பு உருவாக்கு" +"Create component" = "காம்போனென்ட் உருவாக்கு" +"Create component property" = "காம்போனென்ட் பண்பு உருவாக்கு" +"Create components, styles or variables to publish them as a library." = "லைப்ரரியாக வெளியிட காம்போனென்ட்கள், ஸ்டைல்கள் அல்லது வேரியபிள்களை உருவாக்கவும்." +"Create from color" = "நிறத்திலிருந்து உருவாக்கு" +"Create property…" = "பண்பு உருவாக்கு…" +"Create style" = "ஸ்டைல் உருவாக்கு" +"Create style from the selected text" = "தேர்ந்தெடுத்த உரையிலிருந்து ஸ்டைல் உருவாக்கு" +"Created" = "உருவாக்கப்பட்டது" +"Crop" = "செதுக்கு" +"Crop image" = "படத்தைச் செதுக்கு" +"Crop marks" = "செதுக்கல் குறிகள்" +"Ctrl+Alt+← ↑ → ↓" = "Ctrl+Alt+← ↑ → ↓" +"Ctrl+arrows" = "Ctrl+அம்புகள்" +"Ctrl+click" = "Ctrl+கிளிக்" +"Ctrl+click a padding field" = "ஒரு பேடிங் புலத்தை Ctrl+கிளிக் செய்யவும்" +"Ctrl+scroll" = "Ctrl+ஸ்க்ரோல்" +"Current name" = "தற்போதைய பெயர்" +"Current version" = "தற்போதைய பதிப்பு" +"Cursor chat" = "கர்சர் அரட்டை" +"Curved" = "வளைவு" +"Custom" = "தனிப்பயன்" +"Custom size" = "தனிப்பயன் அளவு" +"Cut" = "வெட்டு" +"Dark" = "இருண்ட" +"Darken" = "கருமையாக்கு" +"Dart constants for Flutter…" = "Flutter க்கான Dart மாறிலிகள்…" +"Dash" = "கோடு" +"Dash cap" = "கோட்டு முனை" +"Dashboard" = "டாஷ்போர்டு" +"Dashes" = "கோடுகள்" +"Dashes take numbers separated by commas" = "கோடுகளுக்கு காற்புள்ளியால் பிரிக்கப்பட்ட எண்கள் தேவை" +"Database" = "தரவுத்தளம்" +"Date created" = "உருவாக்கிய தேதி" +"Dec" = "டிச" +"Decoration" = "அலங்காரம்" +"Decoration style" = "அலங்கார ஸ்டைல்" +"Deep select" = "ஆழமான தேர்வு" +"Default" = "இயல்புநிலை" +"Default content" = "இயல்புநிலை உள்ளடக்கம்" +"Default value (the top-left variant)" = "இயல்புநிலை மதிப்பு (மேல்-இடது வேரியன்ட்)" +"Delay" = "தாமதம்" +"Delete" = "நீக்கு" +"Delete category (its annotations stay)" = "வகையை நீக்கு (அதன் குறிப்புரைகள் இருக்கும்)" +"Delete collection" = "தொகுப்பை நீக்கு" +"Delete group" = "குழுவை நீக்கு" +"Delete mode" = "மோடை நீக்கு" +"Delete page" = "பக்கத்தை நீக்கு" +"Delete preset" = "முன்னமைவை நீக்கு" +"Delete property" = "பண்பை நீக்கு" +"Delete results" = "முடிவுகளை நீக்கு" +"Delete the style (layers keep their values)" = "ஸ்டைலை நீக்கு (லேயர்கள் அவற்றின் மதிப்புகளை வைத்திருக்கும்)" +"Delete thread" = "இழையை நீக்கு" +"Delete variable" = "வேரியபிளை நீக்கு" +"Delete {n} variables" = { one = "{n} வேரியபிளை நீக்கு", other = "{n} வேரியபிள்களை நீக்கு" } +"Delete “{name}”? This can't be undone." = "“{name}” ஐ நீக்கவா? இதைச் செயல்தவிர்க்க முடியாது." +"Density" = "அடர்த்தி" +"Depth" = "ஆழம்" +"Describe how and when to use this component" = "இந்த காம்போனென்ட்டை எப்படி, எப்போது பயன்படுத்துவது என்று விவரிக்கவும்" +"Describe what changed" = "என்ன மாறியது என்று விவரிக்கவும்" +"Description" = "விளக்கம்" +"Description (optional)" = "விளக்கம் (விருப்பத்தேர்வு)" +"Design" = "டிசைன்" +"Design panel" = "டிசைன் பேனல்" +"Design system starter" = "வடிவமைப்பு அமைப்புத் தொடக்கம்" +"Desktop" = "டெஸ்க்டாப்" +"Destination" = "சேருமிடம்" +"Detach alias" = "மாற்றுப்பெயரைப் பிரி" +"Detach calculation" = "கணக்கீட்டைப் பிரி" +"Detach instance" = "இன்ஸ்டன்ஸைப் பிரி" +"Detach property" = "பண்பைப் பிரி" +"Detach style" = "ஸ்டைலைப் பிரி" +"Detach styles" = "ஸ்டைல்களைப் பிரி" +"Detach variable" = "வேரியபிளைப் பிரி" +"Details" = "விவரங்கள்" +"Dev resources" = "டெவ் ஆதாரங்கள்" +"Developer Mode" = "டெவலப்பர் மோட்" +"Developer Mode only inspects: switch to Design (Shift+D) to edit" = "டெவலப்பர் மோட் ஆய்வு மட்டுமே செய்யும்: திருத்த வடிவமைப்புக்கு மாறவும் (Shift+D)" +"Development" = "மேம்பாடு" +"Device" = "சாதனம்" +"Device at 100%" = "சாதனம் 100% அளவில்" +"Diamond" = "வைரம்" +"Difference" = "வேறுபாடு" +"Dimensions" = "பரிமாணங்கள்" +"Direction" = "திசை" +"Disconnect from code" = "குறியீட்டிலிருந்து துண்டி" +"Disconnected. Reconnecting…" = "இணைப்பு துண்டிக்கப்பட்டது. மீண்டும் இணைக்கிறது…" +"Disconnected. Your edits stay here and sync when the connection returns. Reconnecting…" = "இணைப்பு துண்டிக்கப்பட்டது. உங்கள் திருத்தங்கள் இங்கேயே இருக்கும், இணைப்பு திரும்பியதும் ஒத்திசைக்கப்படும். மீண்டும் இணைக்கிறது…" +"Dismiss" = "நிராகரி" +"Dispersion" = "சிதறல்" +"Display name" = "காட்சிப் பெயர்" +"Dissolve" = "கரை" +"Distribute and tidy" = "பகிர்ந்து ஒழுங்குபடுத்து" +"Distribute horizontal spacing" = "கிடைமட்ட இடைவெளியைப் பகிர்" +"Distribute vertical spacing" = "செங்குத்து இடைவெளியைப் பகிர்" +"Divider" = "பிரிகோடு" +"Document" = "ஆவணம்" +"Don't Save" = "சேமிக்க வேண்டாம்" +"Don't show this again" = "இதை மீண்டும் காட்ட வேண்டாம்" +"Don't truncate" = "சுருக்க வேண்டாம்" +"Done" = "முடிந்தது" +"Done editing" = "திருத்தி முடி" +"Dots" = "புள்ளிகள்" +"Dotted" = "புள்ளிக்கோடு" +"Double-click an edge of an auto layout frame" = "ஆட்டோ லேஅவுட் ஃப்ரேமின் ஓரத்தை இருமுறை கிளிக் செய்யவும்" +"Down" = "கீழே" +"Download" = "பதிவிறக்கு" +"Downloading… {percent}%" = "பதிவிறக்குகிறது… {percent}%" +"Drafts" = "வரைவுகள்" +"Drag the stroke to add a width point" = "அகலப் புள்ளியைச் சேர்க்க ஸ்ட்ரோக்கை இழுக்கவும்" +"Draw" = "வரை" +"Draw a frame" = "ஃப்ரேம் வரை" +"Drawing tools" = "வரைதல் கருவிகள்" +"Drop a .figcraft, .fig, .jam, .sketch, .json, .svg or image file." = ".figcraft, .fig, .jam, .sketch, .json, .svg அல்லது படக் கோப்பை இங்கே விடவும்." +"Drop shadow" = "டிராப் ஷேடோ" +"Drop to import" = "இறக்குமதி செய்ய விடவும்" +"Drop to open" = "திறக்க விடவும்" +"Drop to use this image" = "இந்தப் படத்தைப் பயன்படுத்த விடவும்" +"Dual-licensed MIT OR Apache-2.0. Made by the ArtCraft team and community." = "MIT அல்லது Apache-2.0 இரட்டை உரிமம். ArtCraft குழுவும் சமூகமும் உருவாக்கியது." +"Duo" = "இரட்டை" +"Duplicate" = "நகல்செய்" +"Duplicate by dragging" = "இழுத்து நகலெடு" +"Duplicate mode" = "நகல் மோட்" +"Duplicate page" = "பக்கத்தை நகல்செய்" +"Edit" = "திருத்து" +"Edit as an expression" = "எக்ஸ்பிரஷனாகத் திருத்து" +"Edit colour" = "நிறத்தைத் திருத்து" +"Edit comment" = "கருத்தைத் திருத்து" +"Edit dev resource" = "டெவ் ஆதாரத்தைத் திருத்து" +"Edit link" = "திருத்த இணைப்பு" +"Edit link copied" = "திருத்த இணைப்பு நகலெடுக்கப்பட்டது" +"Edit padding on all sides" = "எல்லாப் பக்கங்களிலும் பேடிங்கைத் திருத்து" +"Edit style" = "ஸ்டைலைத் திருத்து" +"Edit variable" = "வேரியபிளைத் திருத்து" +"Edit with the builder" = "பில்டரில் திருத்து" +"Edited {when}" = "{when} திருத்தப்பட்டது" +"Effect settings" = "எஃபெக்ட் அமைப்புகள்" +"Effect styles" = "எஃபெக்ட் ஸ்டைல்கள்" +"Effects" = "எஃபெக்ட்கள்" +"Elbow" = "செங்கோணம்" +"Ellipse" = "நீள்வட்டம்" +"Ellipses" = "நீள்வட்டங்கள்" +"Else" = "இல்லையெனில்" +"Else if" = "இல்லையெனில் என்றால்" +"Embedded profile" = "உட்பொதிந்த சுயவிவரம்" +"Empty" = "காலி" +"End" = "முடிவு" +"End point" = "முடிவுப் புள்ளி" +"End vote" = "வாக்கெடுப்பை முடி" +"Ends the session; everyone keeps their copy" = "அமர்வை முடிக்கும்; ஒவ்வொருவரும் தங்கள் நகலை வைத்திருப்பார்கள்" +"Enter" = "Enter" +"Enter / Shift+Enter" = "Enter / Shift+Enter" +"Enter the address of a figcraft-server and press Browse to see the plugins it offers." = "figcraft-server முகவரியை உள்ளிட்டு, அது வழங்கும் ப்ளகின்களைக் காண உலாவவும்." +"Enter to save · Esc to cancel" = "சேமிக்க Enter · ரத்துசெய்ய Esc" +"Eraser" = "அழிப்பான்" +"Esc" = "Esc" +"Essential" = "அத்தியாவசியம்" +"Every conflict has a choice." = "ஒவ்வொரு முரண்பாட்டுக்கும் ஒரு தேர்வு உள்ளது." +"Every top-level frame already starts a flow" = "ஒவ்வொரு மேல்நிலை ஃப்ரேமும் ஏற்கனவே ஒரு ஃப்ளோவைத் தொடங்குகிறது" +"Everyone who reaches this server can open these files while they are shared." = "இந்தச் சர்வரை அணுகும் எவரும் இந்தக் கோப்புகள் பகிரப்பட்டிருக்கும்வரை அவற்றைத் திறக்கலாம்." +"Exact only" = "சரியானவை மட்டும்" +"Exact opacity (4 then 5: 45%)" = "சரியான ஒளிபுகாமை (4 பிறகு 5: 45%)" +"Exclude" = "விலக்கு" +"Excluded" = "விலக்கப்பட்டது" +"Excluded from layout" = "லேஅவுட்டிலிருந்து விலக்கப்பட்டது" +"Excludes" = "விலக்குகிறது" +"Exclusion" = "விலக்கல்" +"Exit focus view (Esc)" = "ஃபோகஸ் காட்சியிலிருந்து வெளியேறு (Esc)" +"Expand" = "விரி" +"Expand the interface" = "இடைமுகத்தை விரி" +"Export" = "ஏற்றுமதி" +"Export all" = "அனைத்தையும் ஏற்றுமதி செய்" +"Export frames and layers as PNG, JPG, SVG or PDF" = "ஃப்ரேம்களையும் லேயர்களையும் PNG, JPG, SVG அல்லது PDF ஆக ஏற்றுமதி செய்" +"Export page as PNG" = "பக்கத்தை PNG ஆக ஏற்றுமதி செய்" +"Export settings" = "ஏற்றுமதி அமைப்புகள்" +"Export variables" = "வேரியபிள்களை ஏற்றுமதி செய்" +"Export {name}" = "{name} ஐ ஏற்றுமதி செய்" +"Export {n} layers" = { one = "{n} லேயரை ஏற்றுமதி செய்", other = "{n} லேயர்களை ஏற்றுமதி செய்" } +"Exported {file}" = "{file} ஏற்றுமதி செய்யப்பட்டது" +"Exported {name}" = "{name} ஏற்றுமதி செய்யப்பட்டது" +"Exported {name}; {n} kinds of content were changed or left out" = { one = "{name} ஏற்றுமதி செய்யப்பட்டது; {n} வகை உள்ளடக்கம் மாற்றப்பட்டது அல்லது விடுபட்டது", other = "{name} ஏற்றுமதி செய்யப்பட்டது; {n} வகை உள்ளடக்கங்கள் மாற்றப்பட்டன அல்லது விடுபட்டன" } +"Exported {name}; {n} kinds of content were left out" = { one = "{name} ஏற்றுமதி செய்யப்பட்டது; {n} வகை உள்ளடக்கம் விடுபட்டது", other = "{name} ஏற்றுமதி செய்யப்பட்டது; {n} வகை உள்ளடக்கங்கள் விடுபட்டன" } +"Exported {n} files" = { one = "{n} கோப்பு ஏற்றுமதி செய்யப்பட்டது", other = "{n} கோப்புகள் ஏற்றுமதி செய்யப்பட்டன" } +"Exported {n} files; some content was changed or left out" = { one = "{n} கோப்பு ஏற்றுமதி செய்யப்பட்டது; சில உள்ளடக்கம் மாற்றப்பட்டது அல்லது விடுபட்டது", other = "{n} கோப்புகள் ஏற்றுமதி செய்யப்பட்டன; சில உள்ளடக்கம் மாற்றப்பட்டது அல்லது விடுபட்டது" } +"Export…" = "ஏற்றுமதி…" +"Expose properties to instances" = "பண்புகளை இன்ஸ்டன்ஸ்களுக்குக் காட்டு" +"Exposure" = "எக்ஸ்போஷர்" +"Expression" = "எக்ஸ்பிரஷன்" +"Extend collection" = "தொகுப்பை நீட்டு" +"Extends \"{name}\": overridden values are marked" = "\"{name}\" ஐ நீட்டிக்கிறது: மாற்றியமைத்த மதிப்புகள் குறிக்கப்பட்டுள்ளன" +"Eye" = "கண்" +"F" = "F" +"Fade" = "மங்கல்" +"False" = "தவறு" +"Feb" = "பிப்" +"Fetching from the server…" = "சர்வரிலிருந்து பெறுகிறது…" +"FigCraft couldn't open its window: {error}" = "FigCraft அதன் சாளரத்தைத் திறக்க முடியவில்லை: {error}" +"FigCraft doesn't support every feature of these files yet. The notes list what was left out or changed in the imported copy; the original file is unchanged." = "இந்தக் கோப்புகளின் எல்லா அம்சங்களையும் FigCraft இன்னும் ஆதரிக்கவில்லை. இறக்குமதி செய்த நகலில் விடுபட்டவை அல்லது மாற்றப்பட்டவை குறிப்புகளில் உள்ளன; அசல் கோப்பு மாறவில்லை." +"FigCraft stopped because of an internal error." = "உள் பிழை காரணமாக FigCraft நின்றுவிட்டது." +"FigCraft tried {apis}, then again with lower requirements on the power-saving GPU. Updating the graphics driver often helps." = "FigCraft {apis} ஐ முயன்றது, பின்னர் மின்சேமிப்பு GPU இல் குறைந்த தேவைகளுடன் மீண்டும் முயன்றது. கிராஃபிக்ஸ் டிரைவரைப் புதுப்பிப்பது பெரும்பாலும் உதவும்." +"File" = "கோப்பு" +"File name" = "கோப்புப் பெயர்" +"File not found" = "கோப்பு கிடைக்கவில்லை" +"File published" = "கோப்பு வெளியிடப்பட்டது" +"Files aren't end-to-end encrypted: the server's operator can read them." = "கோப்புகள் முழுமையாக மறையாக்கம் செய்யப்படவில்லை: சர்வர் இயக்குநர் அவற்றைப் படிக்க முடியும்." +"Files nobody opens for {n} days are deleted." = { one = "{n} நாள் யாரும் திறக்காத கோப்புகள் நீக்கப்படும்.", other = "{n} நாட்கள் யாரும் திறக்காத கோப்புகள் நீக்கப்படும்." } +"Fill" = "ஃபில்" +"Fill (fr)" = "ஃபில் (fr)" +"Fill container" = "கண்டெய்னரை நிரப்பு" +"Fill window" = "சாளரத்தை நிரப்பு" +"Fills" = "ஃபில்கள்" +"Fill|sizing" = "நிரப்பு" +"Filter and sort" = "வடிகட்டி வரிசைப்படுத்து" +"Find" = "தேடு" +"Find and replace" = "தேடி மாற்று" +"Find layers" = "லேயர்களைத் தேடு" +"First" = "முதல்" +"First commit" = "முதல் கமிட்" +"First on top" = "முதலாவது மேலே" +"Fit" = "பொருத்து" +"Fit device to window" = "சாதனத்தைச் சாளரத்துக்குப் பொருத்து" +"Fit to contents" = "உள்ளடக்கத்துக்குப் பொருத்து" +"Fit to window" = "சாளரத்துக்குப் பொருத்து" +"Fit width" = "அகலத்துக்குப் பொருத்து" +"Fixed" = "நிலையானது" +"Fixed gap" = "நிலையான இடைவெளி" +"Fixed size" = "நிலையான அளவு" +"Flatten" = "தட்டையாக்கு" +"Flip" = "புரட்டு" +"Flip horizontal" = "கிடைமட்டமாகப் புரட்டு" +"Flip text to the other side" = "உரையை மறுபக்கத்துக்குப் புரட்டு" +"Flip vertical" = "செங்குத்தாகப் புரட்டு" +"Flip width profile" = "அகல சுயவிவரத்தைப் புரட்டு" +"Flow chart" = "ஃப்ளோ சார்ட்" +"Flow starting point" = "ஃப்ளோ தொடக்கப் புள்ளி" +"Flow starting points" = "ஃப்ளோ தொடக்கப் புள்ளிகள்" +"Flows" = "ஃப்ளோக்கள்" +"Focus view" = "ஃபோகஸ் காட்சி" +"Fold autosaves" = "தானியங்கு சேமிப்புகளைச் சுருக்கு" +"Folder: click to collapse" = "கோப்புறை: சுருக்க கிளிக் செய்யவும்" +"Folder: click to expand" = "கோப்புறை: விரிக்க கிளிக் செய்யவும்" +"Follow" = "பின்தொடர்" +"Follow {name}" = "{name} ஐப் பின்தொடர்" +"Following" = "பின்தொடர்கிறீர்கள்" +"Following {name} · {key} to stop" = "{name} ஐப் பின்தொடர்கிறீர்கள் · நிறுத்த {key}" +"Font" = "எழுத்துரு" +"Font not installed" = "எழுத்துரு நிறுவப்படவில்லை" +"Font size" = "எழுத்துரு அளவு" +"Font style" = "எழுத்துரு ஸ்டைல்" +"Forget on this computer" = "இந்தக் கணினியில் மறந்துவிடு" +"Format" = "வடிவம்" +"Four screens of a trail app with components and a prototype flow" = "காம்போனென்ட்களும் ப்ரோட்டோடைப் ஃப்ளோவும் கொண்ட மலையேற்ற ஆப்பின் நான்கு திரைகள்" +"Fractions" = "பின்னங்கள்" +"Frame" = "ஃப்ரேம்" +"Frame selection" = "தேர்வை ஃப்ரேம் செய்" +"Frame tools" = "ஃப்ரேம் கருவிகள்" +"Frames" = "ஃப்ரேம்கள்" +"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." = "இலவச எழுத்துருக்கள் Google Fonts, Noto ஆகியவற்றிலிருந்து jsDelivr, GitHub வழியாக வருகின்றன. Craft ஆப்கள் பகிரும் எழுத்துருக் கோப்புறையில் நிறுவும் முன் ஒவ்வொரு கோப்பும் எழுத்துரு அட்டவணையுடன் சரிபார்க்கப்படும். நீங்கள் அனுமதிக்கும்வரை எதுவும் பதிவிறக்கப்படாது." +"From the library \"{name}\": read-only" = "\"{name}\" லைப்ரரியிலிருந்து: படிக்க மட்டும்" +"From {name}" = "{name} இலிருந்து" +"From {server}" = "{server} இலிருந்து" +"Frost" = "பனிமூட்டம்" +"Gap" = "இடைவெளி" +"Gap between columns" = "நெடுவரிசைகளுக்கு இடையிலான இடைவெளி" +"Gap between items" = "உருப்படிகளுக்கு இடையிலான இடைவெளி" +"Gap between rows" = "வரிசைகளுக்கு இடையிலான இடைவெளி" +"Getting started" = "தொடங்குதல்" +"Give the address of a server open to the public, or a server's address with its key (`figcraft-server key` prints it)." = "பொதுமக்களுக்குத் திறந்த சர்வரின் முகவரியை, அல்லது சர்வரின் முகவரியை அதன் கீயுடன் தரவும் (`figcraft-server key` அதை அச்சிடும்)." +"Glass" = "கண்ணாடி" +"Go to main component" = "முதன்மை காம்போனென்ட்டுக்குச் செல்" +"Go to {name}" = "{name} க்குச் செல்" +"Grab bag" = "கலவைப் பை" +"Gradient" = "கிரேடியன்ட்" +"Graph paper" = "வரைபடத் தாள்" +"Gray" = "சாம்பல்" +"Green" = "பச்சை" +"Greyscale components and two example screens to sketch a flow with" = "ஃப்ளோவை வரைய சாம்பல்நிற காம்போனென்ட்களும் இரண்டு மாதிரித் திரைகளும்" +"Grid" = "கட்டம்" +"Grid ({size})" = "கட்டம் ({size})" +"Grid styles" = "கட்ட ஸ்டைல்கள்" +"Grid {size}" = "கட்டம் {size}" +"Group" = "குழு" +"Group selection" = "தேர்வைக் குழுவாக்கு" +"Groups" = "குழுக்கள்" +"Gutter" = "கட்டர்" +"Hand tool" = "கைக் கருவி" +"Hanging list" = "தொங்கும் பட்டியல்" +"Hanging punctuation" = "தொங்கும் நிறுத்தக்குறிகள்" +"Hard light" = "கடின ஒளி" +"Heart" = "இதயம்" +"Height" = "உயரம்" +"Help" = "உதவி" +"Help and resources" = "உதவியும் ஆதாரங்களும்" +"Help page" = "உதவிப் பக்கம்" +"Here: {names}" = "இங்கே: {names}" +"Hexagon" = "அறுகோணம்" +"Hidden" = "மறைக்கப்பட்டது" +"Hide UI" = "UI ஐ மறை" +"Hide contents" = "உள்ளடக்கத்தை மறை" +"Hide from publishing" = "வெளியீட்டிலிருந்து மறை" +"Hide section contents" = "செக்ஷன் உள்ளடக்கத்தை மறை" +"Hide these tips (Getting started in the Help menu shows them again)" = "இந்தக் குறிப்புகளை மறை (உதவி மெனுவில் உள்ள தொடங்குதல் அவற்றை மீண்டும் காட்டும்)" +"Hide when publishing" = "வெளியிடும்போது மறை" +"Highlight layers on hover" = "ஹோவர் செய்யும்போது லேயர்களை முன்னிலைப்படுத்து" +"Highlighter" = "ஹைலைட்டர்" +"Highlights" = "ஒளிப்பகுதிகள்" +"Hold Alt" = "Alt ஐ அழுத்திப் பிடிக்கவும்" +"Hold Alt+Z" = "Alt+Z ஐ அழுத்திப் பிடிக்கவும்" +"Hold Ctrl" = "Ctrl ஐ அழுத்திப் பிடிக்கவும்" +"Hold Z" = "Z ஐ அழுத்திப் பிடிக்கவும்" +"Hold ⌃ or ⌘" = "⌃ அல்லது ⌘ ஐ அழுத்திப் பிடிக்கவும்" +"Hold ⌥" = "⌥ ஐ அழுத்திப் பிடிக்கவும்" +"Hold ⌥Z" = "⌥Z ஐ அழுத்திப் பிடிக்கவும்" +"Home" = "முகப்பு" +"Horizontal" = "கிடைமட்டம்" +"Horizontal align" = "கிடைமட்ட சீரமைப்பு" +"Horizontal hex" = "கிடைமட்ட அறுகோணம்" +"Horizontal padding" = "கிடைமட்ட பேடிங்" +"Horizontal spacing" = "கிடைமட்ட இடைவெளி" +"Hosted by {operator}" = "{operator} வழங்குகிறது" +"Hover a layer to see its properties" = "பண்புகளைக் காண ஒரு லேயர் மீது ஹோவர் செய்யவும்" +"Hover other layers to measure the distance" = "தூரத்தை அளக்க மற்ற லேயர்கள் மீது ஹோவர் செய்யவும்" +"Hue" = "சாயல்" +"Hug" = "ஹக்" +"Hug contents" = "உள்ளடக்கத்தை ஹக் செய்" +"Icon components on a 24 px grid with keylines and a size preview" = "கீலைன்களும் அளவு முன்னோட்டமும் கொண்ட 24 px கட்டத்தில் ஐகான் காம்போனென்ட்கள்" +"Icon set starter" = "ஐகான் தொகுப்புத் தொடக்கம்" +"If" = "என்றால்" +"If it keeps happening, please report it at {link} with this message." = "இது தொடர்ந்து நடந்தால், இந்தச் செய்தியுடன் {link} இல் புகாரளிக்கவும்." +"If {condition}" = "{condition} என்றால்" +"Ignore auto layout (absolute position)" = "ஆட்டோ லேஅவுட்டைப் புறக்கணி (முழுமையான நிலை)" +"Ignore overlapping layers" = "மேற்பொருந்தும் லேயர்களைப் புறக்கணி" +"Ignore unsupported" = "ஆதரிக்கப்படாதவற்றைப் புறக்கணி" +"Image" = "படம்" +"Images" = "படங்கள்" +"Import" = "இறக்குமதி" +"Import path" = "இறக்குமதிப் பாதை" +"Import plugin from manifest" = "மேனிஃபெஸ்டிலிருந்து ப்ளகினை இறக்குமதி செய்" +"Import plugin from manifest…" = "மேனிஃபெஸ்டிலிருந்து ப்ளகினை இறக்குமதி செய்…" +"Import report" = "இறக்குமதி அறிக்கை" +"Import variables" = "வேரியபிள்களை இறக்குமதி செய்" +"Imported document" = "இறக்குமதி செய்த ஆவணம்" +"Imported {name}" = "{name} இறக்குமதி செய்யப்பட்டது" +"Imported {n} new variables, updated {updated}" = { one = "{n} புதிய வேரியபிள் இறக்குமதி செய்யப்பட்டது, {updated} புதுப்பிக்கப்பட்டது", other = "{n} புதிய வேரியபிள்கள் இறக்குமதி செய்யப்பட்டன, {updated} புதுப்பிக்கப்பட்டன" } +"Import…" = "இறக்குமதி…" +"In an instance, this comes from the main component" = "இன்ஸ்டன்ஸில், இது முதன்மை காம்போனென்ட்டிலிருந்து வருகிறது" +"In the browser you can join sessions the desktop app hosts and files on a FigCraft server. A page opened over https reaches other computers only through wss:// links (a server behind TLS)." = "உலாவியில், டெஸ்க்டாப் ஆப் நடத்தும் அமர்வுகளிலும் FigCraft சர்வரில் உள்ள கோப்புகளிலும் சேரலாம். https வழியாகத் திறந்த பக்கம் wss:// இணைப்புகள் (TLS பின்னால் உள்ள சர்வர்) மூலம் மட்டுமே பிற கணினிகளை அடையும்." +"Include bounding box" = "எல்லைப் பெட்டியைச் சேர்" +"Include id attribute" = "id பண்புக்கூறைச் சேர்" +"Included" = "சேர்க்கப்பட்டது" +"Included in layout" = "லேஅவுட்டில் சேர்க்கப்பட்டது" +"Individual corners" = "தனித்தனி மூலைகள்" +"Individual padding" = "தனித்தனி பேடிங்" +"Individual strokes" = "தனித்தனி ஸ்ட்ரோக்குகள்" +"Ink" = "மை" +"Inner shadow" = "உள் நிழல்" +"Inside" = "உள்ளே" +"Inspect" = "ஆய்வு செய்" +"Inspect the layer under the pointer: size, colours, typography" = "சுட்டியின் கீழ் உள்ள லேயரை ஆய்வு செய்: அளவு, நிறங்கள், அச்சுக்கலை" +"Install" = "நிறுவு" +"Install plugin" = "ப்ளகினை நிறுவு" +"Installed" = "நிறுவப்பட்டது" +"Installed {name}" = "{name} நிறுவப்பட்டது" +"Installing…" = "நிறுவுகிறது…" +"Instance" = "இன்ஸ்டன்ஸ்" +"Instance properties" = "இன்ஸ்டன்ஸ் பண்புகள்" +"Instance swap" = "இன்ஸ்டன்ஸ் மாற்று" +"Instance swap (no other component)" = "இன்ஸ்டன்ஸ் மாற்று (வேறு காம்போனென்ட் இல்லை)" +"Instances" = "இன்ஸ்டன்ஸ்கள்" +"Instant" = "உடனடி" +"Intensity" = "தீவிரம்" +"Interaction" = "இன்டராக்ஷன்" +"Interactions" = "இன்டராக்ஷன்கள்" +"Interface design and prototyping. A free, open-source, clean-room design tool written from scratch in Rust, part of the ArtCraft Crafting Apps." = "இடைமுக வடிவமைப்பும் ப்ரோட்டோடைப்பிங்கும். Rust இல் புதிதாக எழுதப்பட்ட, இலவச, திறந்த மூல, கிளீன்-ரூம் வடிவமைப்புக் கருவி; ArtCraft Crafting Apps இன் ஒரு பகுதி." +"Interface size" = "இடைமுக அளவு" +"Internal storage" = "உள் சேமிப்பகம்" +"Intersect" = "குறுக்கிடு" +"Intersects" = "குறுக்கிடுகிறது" +"Invalid color" = "தவறான நிறம்" +"Invite link" = "அழைப்பு இணைப்பு" +"Invite link copied" = "அழைப்பு இணைப்பு நகலெடுக்கப்பட்டது" +"It asks permission to:" = "இது இவற்றுக்கு அனுமதி கேட்கிறது:" +"Jan" = "ஜன" +"Join" = "சேர்" +"Join code copied" = "சேரும் குறியீடு நகலெடுக்கப்பட்டது" +"Join code or invite link" = "சேரும் குறியீடு அல்லது அழைப்பு இணைப்பு" +"Join live session" = "நேரலை அமர்வில் சேர்" +"Join us on Discord" = "Discord இல் எங்களுடன் சேரவும்" +"Join with a code" = "குறியீட்டுடன் சேர்" +"Joined" = "சேர்ந்தது" +"Joined {file}" = "{file} இல் சேர்ந்தது" +"Joining live session…" = "நேரலை அமர்வில் சேர்கிறது…" +"Joining…" = "சேர்கிறது…" +"Join|stroke" = "இணைப்பு" +"Jul" = "ஜூலை" +"Jun" = "ஜூன்" +"Just now" = "இப்போதுதான்" +"Justify" = "இருபுறச் சீரமை" +"Kanban board" = "கான்பன் பலகை" +"Keep a measurement on the canvas for developers" = "டெவலப்பர்களுக்காக அளவீட்டைக் கேன்வாஸில் வை" +"Keep appearance" = "தோற்றத்தை வை" +"Keep appearance converts every color value to {profile} so colors look the same. Keep values leaves the numbers as they are, so colors shift." = "தோற்றத்தை வை என்பது நிறங்கள் ஒரே மாதிரி தெரிய ஒவ்வொரு நிற மதிப்பையும் {profile} ஆக மாற்றும். மதிப்புகளை வை என்பது எண்களை அப்படியே விடும், அதனால் நிறங்கள் மாறும்." +"Keep tool selected after use" = "பயன்படுத்திய பின் கருவியைத் தேர்விலேயே வை" +"Keep values" = "மதிப்புகளை வை" +"Key/Gamepad" = "விசை/கேம்பேட்" +"Key/Gamepad {key}" = "விசை/கேம்பேட் {key}" +"Keyboard shortcuts" = "விசைப்பலகை குறுக்குவழிகள்" +"Kits" = "கிட்கள்" +"Landing page" = "லேண்டிங் பக்கம்" +"Language" = "மொழி" +"Lasso" = "லாசோ" +"Last" = "கடைசி" +"Last change: {note}" = "கடைசி மாற்றம்: {note}" +"Last commit" = "கடைசி கமிட்" +"Last modified" = "கடைசியாக மாற்றியது" +"Last on top" = "கடைசியானது மேலே" +"Layer blur" = "லேயர் மங்கல்" +"Layer name" = "லேயர் பெயர்" +"Layers" = "லேயர்கள்" +"Layers in an instance take their position from the main component" = "இன்ஸ்டன்ஸில் உள்ள லேயர்கள் முதன்மை காம்போனென்ட்டிலிருந்து நிலையைப் பெறுகின்றன" +"Layout" = "லேஅவுட்" +"Layout grid" = "லேஅவுட் கட்டம்" +"Layout grid settings" = "லேஅவுட் கட்ட அமைப்புகள்" +"Layout grids" = "லேஅவுட் கட்டங்கள்" +"Leave session" = "அமர்விலிருந்து வெளியேறு" +"Leaves" = "இலைகள்" +"Leaving the prototype" = "ப்ரோட்டோடைப்பிலிருந்து வெளியேறுகிறது" +"Left" = "இடது" +"Left & right" = "இடது & வலது" +"Left padding" = "இடது பேடிங்" +"Left side" = "இடது பக்கம்" +"Left side width" = "இடது பக்க அகலம்" +"Left to right" = "இடமிருந்து வலம்" +"Letter case" = "எழுத்து வடிவு" +"Letter spacing" = "எழுத்து இடைவெளி" +"Libraries" = "லைப்ரரிகள்" +"Libraries in this file" = "இந்தக் கோப்பில் உள்ள லைப்ரரிகள்" +"Library updates available" = "லைப்ரரி புதுப்பிப்புகள் உள்ளன" +"Library: click to collapse" = "லைப்ரரி: சுருக்க கிளிக் செய்யவும்" +"Library: click to expand" = "லைப்ரரி: விரிக்க கிளிக் செய்யவும்" +"Library: its variables are read-only here; edit them in the library file and publish it" = "லைப்ரரி: இதன் வேரியபிள்களை இங்கே படிக்க மட்டுமே முடியும்; லைப்ரரி கோப்பில் திருத்தி வெளியிடவும்" +"Light" = "ஒளிர்வான" +"Lighten" = "ஒளிரச்செய்" +"Light|glass" = "ஒளி" +"Line" = "கோடு" +"Line arrow" = "கோட்டு அம்பு" +"Line delta" = "வரி மாற்றம்" +"Line height" = "வரி உயரம்" +"Linear" = "நேரியல்" +"Lines" = "வரிகள்" +"Lines +/−" = "வரிகள் +/−" +"Lines added" = "சேர்த்த வரிகள்" +"Lines deleted" = "நீக்கிய வரிகள்" +"Link" = "இணைப்பு" +"Link copied" = "இணைப்பு நகலெடுக்கப்பட்டது" +"Link copied: it opens the file in FigCraft" = "இணைப்பு நகலெடுக்கப்பட்டது: இது கோப்பை FigCraft இல் திறக்கும்" +"Link copied: it opens the file in the browser" = "இணைப்பு நகலெடுக்கப்பட்டது: இது கோப்பை உலாவியில் திறக்கும்" +"Link docs, code or tickets for developers." = "டெவலப்பர்களுக்காக ஆவணங்கள், குறியீடு அல்லது டிக்கெட்டுகளை இணைக்கவும்." +"Link frames on the Prototype tab, then present the flow" = "ப்ரோட்டோடைப் தாவலில் ஃப்ரேம்களை இணைத்து, பின் ஃப்ளோவை வழங்கவும்" +"Link this component to its code component: instances then show your real snippet with their values." = "இந்த காம்போனென்ட்டை அதன் குறியீட்டு காம்போனென்ட்டுடன் இணைக்கவும்: பின் இன்ஸ்டன்ஸ்கள் உங்கள் உண்மையான ஸ்னிப்பெட்டை அவற்றின் மதிப்புகளுடன் காட்டும்." +"List spacing" = "பட்டியல் இடைவெளி" +"List style" = "பட்டியல் ஸ்டைல்" +"Live session" = "நேரலை அமர்வு" +"Live · {people}" = "நேரலை · {people}" +"Local components" = "லோக்கல் காம்போனென்ட்கள்" +"Local network" = "லோக்கல் நெட்வொர்க்" +"Local styles" = "லோக்கல் ஸ்டைல்கள்" +"Local variables" = "லோக்கல் வேரியபிள்கள்" +"Lock/Unlock" = "பூட்டு/திற" +"Locked" = "பூட்டப்பட்டது" +"Lowercase" = "சிற்றெழுத்து" +"Luminance" = "ஒளிர்வு" +"Luminosity" = "ஒளிர்மை" +"Main" = "முதன்மை" +"Main component deleted" = "முதன்மை காம்போனென்ட் நீக்கப்பட்டது" +"Main menu" = "முதன்மை மெனு" +"Make a component" = "காம்போனென்ட் உருவாக்கு" +"Make slot" = "ஸ்லாட் உருவாக்கு" +"Manual input" = "கைமுறை உள்ளீடு" +"Mar" = "மார்" +"Margin" = "ஓரம்" +"Mark all as read" = "அனைத்தையும் படித்ததாகக் குறி" +"Mark as resolved" = "தீர்க்கப்பட்டதாகக் குறி" +"Mark as unread" = "படிக்காததாகக் குறி" +"Mark as unresolved" = "தீர்க்கப்படாததாகக் குறி" +"Marker" = "மார்க்கர்" +"Mask" = "மாஸ்க்" +"Mass · Stiffness · Damping" = "நிறை · விறைப்பு · தணிப்பு" +"Match (empty: the whole name)" = "பொருத்து (காலி: முழுப் பெயர்)" +"Max H" = "அதி. உ" +"Max W" = "அதி. அ" +"Max lines" = "அதிகபட்ச வரிகள்" +"Maximize" = "அதிகபட்சமாக்கு" +"May" = "மே" +"Measure to the selection" = "தேர்வு வரை அளவிடு" +"Measurements" = "அளவீடுகள்" +"Merge into main" = "முதன்மையில் இணை" +"Merge regions" = "பகுதிகளை இணை" +"Merge the branch into the main file (one undo step) and archive it" = "கிளையை முதன்மைக் கோப்பில் இணைத்து (ஒரே செயல்தவிர்ப் படி) அதைக் காப்பகப்படுத்து" +"Merged" = "இணைக்கப்பட்டது" +"Merged PRs" = "இணைக்கப்பட்ட PRகள்" +"Min H" = "குறை. உ" +"Min W" = "குறைந்தபட்ச அகலம்" +"Minimize" = "சிறிதாக்கு" +"Minutes" = "நிமிடங்கள்" +"Mirror angle" = "கோணத்தைப் பிரதிபலி" +"Mirror angle and length" = "கோணம் மற்றும் நீளத்தைப் பிரதிபலி" +"Mirroring" = "பிரதிபலிப்பு" +"Missing" = "காணவில்லை" +"Missing fonts" = "காணாத எழுத்துருக்கள்" +"Missing layer" = "காணாத லேயர்" +"Missing style" = "காணாத ஸ்டைல்" +"Missing variable" = "காணாத வேரியபிள்" +"Miter" = "மைட்டர்" +"Miter angle" = "மைட்டர் கோணம்" +"Mixed" = "கலப்பு" +"Mixed fonts" = "கலப்பு எழுத்துருக்கள்" +"Mixed interactions: click + to replace them" = "கலப்பு இன்டராக்ஷன்கள்: மாற்ற + ஐக் கிளிக் செய்யவும்" +"Mobile app" = "மொபைல் ஆப்" +"Mode" = "மோட்" +"Model" = "மாடல்" +"Models" = "மாடல்கள்" +"Mono" = "மோனோ" +"More" = "மேலும்" +"More instance actions" = "மேலும் இன்ஸ்டன்ஸ் செயல்கள்" +"Mouse down" = "மவுஸ் அழுத்தம்" +"Mouse enter" = "மவுஸ் நுழைவு" +"Mouse leave" = "மவுஸ் வெளியேற்றம்" +"Mouse up" = "மவுஸ் விடுவிப்பு" +"Move" = "நகர்த்து" +"Move along the toolbar or the layer rows" = "கருவிப்பட்டி அல்லது லேயர் வரிசைகளில் நகரவும்" +"Move column left" = "நெடுவரிசையை இடப்புறம் நகர்த்து" +"Move column right" = "நெடுவரிசையை வலப்புறம் நகர்த்து" +"Move down" = "கீழே நகர்த்து" +"Move in" = "உள்ளே நகர்த்து" +"Move out" = "வெளியே நகர்த்து" +"Move out of any group" = "எந்தக் குழுவிலிருந்தும் வெளியே நகர்த்து" +"Move to group {group}" = "{group} குழுவுக்கு நகர்த்து" +"Move tools" = "நகர்த்தும் கருவிகள்" +"Move up" = "மேலே நகர்த்து" +"Move up or down while dragging its label" = "அதன் லேபிளை இழுக்கும்போது மேலே அல்லது கீழே நகர்த்தவும்" +"Moved to {name}" = "{name} க்கு நகர்த்தப்பட்டது" +"Multi" = "பல" +"Multiply" = "பெருக்கல்" +"Muted" = "ஒலியடக்கப்பட்டது" +"Name" = "பெயர்" +"Name (A–Z)" = "பெயர் (A–Z)" +"Named instance" = "பெயரிடப்பட்ட இன்ஸ்டன்ஸ்" +"Navigate to" = "இதற்குச் செல்" +"Nested instance" = "உள்ளமைந்த இன்ஸ்டன்ஸ்" +"New board" = "புதிய போர்டு" +"New collection" = "புதிய தொகுப்பு" +"New design file" = "புதிய வடிவமைப்புக் கோப்பு" +"Newest first" = "புதியவை முதலில்" +"Next frame" = "அடுத்த ஃப்ரேம்" +"Next or previous control in the focused region" = "கவனத்திலுள்ள பகுதியில் அடுத்த அல்லது முந்தைய கட்டுப்பாடு" +"Next ready for dev" = "அடுத்த டெவ்-க்குத் தயார்" +"Next size option" = "அடுத்த அளவு விருப்பம்" +"No assets: no export settings, icons or images. Add export settings in the Design tab." = "அசெட்கள் இல்லை: ஏற்றுமதி அமைப்புகள், ஐகான்கள் அல்லது படங்கள் இல்லை. டிசைன் தாவலில் ஏற்றுமதி அமைப்புகளைச் சேர்க்கவும்." +"No boolean variables fit here." = "இங்கு பொருந்தும் பூலியன் வேரியபிள்கள் இல்லை." +"No boolean variables yet. Create them in Local variables." = "இன்னும் பூலியன் வேரியபிள்கள் இல்லை. லோக்கல் வேரியபிள்களில் அவற்றை உருவாக்கவும்." +"No branches. A branch is a copy of the file to try changes in, then review and merge." = "கிளைகள் இல்லை. கிளை என்பது மாற்றங்களை முயன்று, பின் மதிப்பாய்வு செய்து இணைப்பதற்கான கோப்பின் நகல்." +"No category" = "வகை இல்லை" +"No changes" = "மாற்றங்கள் இல்லை" +"No color styles" = "நிற ஸ்டைல்கள் இல்லை" +"No colour variables fit here." = "இங்கு பொருந்தும் நிற வேரியபிள்கள் இல்லை." +"No colour variables yet. Create them in Local variables." = "இன்னும் நிற வேரியபிள்கள் இல்லை. லோக்கல் வேரியபிள்களில் அவற்றை உருவாக்கவும்." +"No comments to copy" = "நகலெடுக்கக் கருத்துகள் இல்லை" +"No comments yet" = "இன்னும் கருத்துகள் இல்லை" +"No compatibility warnings reported" = "பொருந்தக்கூடிய எச்சரிக்கைகள் எதுவும் இல்லை" +"No components yet. Select layers and press {keys}." = "இன்னும் காம்போனென்ட்கள் இல்லை. லேயர்களைத் தேர்ந்தெடுத்து {keys} அழுத்தவும்." +"No conflicts." = "முரண்பாடுகள் இல்லை." +"No contributor data was built into this copy." = "இந்த நகலில் பங்களிப்பாளர் தரவு சேர்க்கப்படவில்லை." +"No device" = "சாதனம் இல்லை" +"No files or templates match your search" = "உங்கள் தேடலுக்குப் பொருந்தும் கோப்புகளோ டெம்ப்ளேட்களோ இல்லை" +"No fonts match" = "பொருந்தும் எழுத்துருக்கள் இல்லை" +"No join code here (the server is older than join codes, or this address can't be put in one): share the link instead." = "இங்கு சேர் குறியீடு இல்லை (சர்வர் சேர் குறியீடுகளை விடப் பழையது, அல்லது இந்த முகவரியைக் குறியீட்டில் வைக்க முடியாது): அதற்குப் பதிலாக இணைப்பைப் பகிரவும்." +"No layer changes to show." = "காட்ட லேயர் மாற்றங்கள் இல்லை." +"No libraries yet. Add a .figcraft file that was published as a library, or paste a team library's link." = "இன்னும் லைப்ரரிகள் இல்லை. லைப்ரரியாக வெளியிடப்பட்ட .figcraft கோப்பைச் சேர்க்கவும், அல்லது குழு லைப்ரரியின் இணைப்பை ஒட்டவும்." +"No list" = "பட்டியல் இல்லை" +"No matching comments" = "பொருந்தும் கருத்துகள் இல்லை" +"No matching components" = "பொருந்தும் காம்போனென்ட்கள் இல்லை" +"No matching layers" = "பொருந்தும் லேயர்கள் இல்லை" +"No matching styles" = "பொருந்தும் ஸ்டைல்கள் இல்லை" +"No matching variables" = "பொருந்தும் வேரியபிள்கள் இல்லை" +"No mirroring" = "பிரதிபலிப்பு இல்லை" +"No model credits were built into this copy." = "இந்த நகலில் மாடல் கிரெடிட்கள் சேர்க்கப்படவில்லை." +"No number variables fit here." = "இங்கு பொருந்தும் எண் வேரியபிள்கள் இல்லை." +"No number variables yet. Create them in Local variables." = "இன்னும் எண் வேரியபிள்கள் இல்லை. லோக்கல் வேரியபிள்களில் அவற்றை உருவாக்கவும்." +"No other pages" = "வேறு பக்கங்கள் இல்லை" +"No paints" = "பெயிண்ட்கள் இல்லை" +"No plugins on {server}." = "{server} இல் ப்ளகின்கள் இல்லை." +"No plugins yet. Import a development plugin from its figcraft-plugin.json." = "இன்னும் ப்ளகின்கள் இல்லை. டெவலப்மென்ட் ப்ளகினை அதன் figcraft-plugin.json இலிருந்து இறக்குமதி செய்யவும்." +"No preferred components" = "விருப்பமான காம்போனென்ட்கள் இல்லை" +"No preset" = "முன்னமைவு இல்லை" +"No saved versions yet. Save a version to mark a point in your work you can come back to." = "இன்னும் சேமித்த பதிப்புகள் இல்லை. பின்னர் திரும்பி வரக்கூடிய ஒரு நிலையைக் குறிக்க ஒரு பதிப்பைச் சேமிக்கவும்." +"No scrolling" = "ஸ்க்ரோலிங் இல்லை" +"No shortcuts match" = "பொருந்தும் குறுக்குவழிகள் இல்லை" +"No status" = "நிலை இல்லை" +"No string variables fit here." = "இங்கு பொருந்தும் ஸ்ட்ரிங் வேரியபிள்கள் இல்லை." +"No string variables yet. Create them in Local variables." = "இன்னும் ஸ்ட்ரிங் வேரியபிள்கள் இல்லை. லோக்கல் வேரியபிள்களில் அவற்றை உருவாக்கவும்." +"No styles yet." = "இன்னும் ஸ்டைல்கள் இல்லை." +"No styles yet. Click + to create one from the selection." = "இன்னும் ஸ்டைல்கள் இல்லை. தேர்விலிருந்து ஒன்றை உருவாக்க + ஐக் கிளிக் செய்யவும்." +"No templates match your search" = "உங்கள் தேடலுக்குப் பொருந்தும் டெம்ப்ளேட்கள் இல்லை" +"No text styles yet. Click + to create one from the selected text." = "இன்னும் உரை ஸ்டைல்கள் இல்லை. தேர்ந்தெடுத்த உரையிலிருந்து ஒன்றை உருவாக்க + ஐக் கிளிக் செய்யவும்." +"No variables fit here." = "இங்கு பொருந்தும் வேரியபிள்கள் இல்லை." +"No variables yet. Create them in Local variables." = "இன்னும் வேரியபிள்கள் இல்லை. லோக்கல் வேரியபிள்களில் அவற்றை உருவாக்கவும்." +"No votes yet" = "இன்னும் வாக்குகள் இல்லை" +"Nobody else is here yet" = "இங்கு இன்னும் வேறு யாரும் இல்லை" +"Nobody shares a file there now." = "இப்போது அங்கு யாரும் கோப்பைப் பகிரவில்லை." +"Noise" = "இரைச்சல்" +"None" = "இல்லை" +"None." = "எதுவுமில்லை." +"Normal" = "இயல்பு" +"Not bound" = "இணைக்கப்படவில்லை" +"Not checked yet" = "இன்னும் சரிபார்க்கப்படவில்லை" +"Not connected: {reason}. Your work is still in this tab." = "இணைக்கப்படவில்லை: {reason}. உங்கள் வேலை இன்னும் இந்தத் தாவலில் உள்ளது." +"Not in a live session" = "நேரலை அமர்வில் இல்லை" +"Not in this font" = "இந்த எழுத்துருவில் இல்லை" +"Not now" = "இப்போது வேண்டாம்" +"Not properties, kept as written: {names}" = "பண்புகள் அல்ல, எழுதியபடியே வைக்கப்பட்டன: {names}" +"Not read yet" = "இன்னும் படிக்கப்படவில்லை" +"Not shared" = "பகிரப்படவில்லை" +"Note {n}" = "குறிப்பு {n}" +"Nothing changed since this version." = "இந்தப் பதிப்பிலிருந்து எதுவும் மாறவில்லை." +"Nothing changed since this was marked ready for dev." = "டெவ்-க்குத் தயார் எனக் குறித்ததிலிருந்து எதுவும் மாறவில்லை." +"Nothing counted yet" = "இன்னும் எதுவும் கணக்கிடப்படவில்லை" +"Nothing here yet. Set a frame's status to list it." = "இங்கு இன்னும் எதுவும் இல்லை. பட்டியலிட ஒரு ஃப்ரேமின் நிலையை அமைக்கவும்." +"Nothing online yet. Use Share on a file to put it online and it is listed here." = "இன்னும் எதுவும் ஆன்லைனில் இல்லை. ஒரு கோப்பை ஆன்லைனில் வைக்கப் பகிர் என்பதைப் பயன்படுத்தவும், அது இங்கே பட்டியலிடப்படும்." +"Nothing to export" = "ஏற்றுமதி செய்ய எதுவும் இல்லை" +"Nothing to pick: the page is empty" = "தேர்வு செய்ய எதுவும் இல்லை: பக்கம் காலியாக உள்ளது" +"Nov" = "நவ." +"Now" = "இப்போது" +"Nudge (Shift: big nudge)" = "சிறு நகர்வு (Shift: பெரிய நகர்வு)" +"Nudge amount" = "சிறு நகர்வு அளவு" +"Number" = "எண்" +"Number ↑" = "எண் ↑" +"Number ↓" = "எண் ↓" +"Numbered list" = "எண்ணிட்ட பட்டியல்" +"Object" = "பொருள்" +"Oct" = "அக்." +"Octagon" = "எண்கோணம்" +"Off" = "முடக்கு" +"Offered first when filling the slot (any content is allowed)" = "ஸ்லாட்டை நிரப்பும்போது முதலில் வழங்கப்படும் (எந்த உள்ளடக்கமும் அனுமதிக்கப்படும்)" +"Offered first when swapping the instance (any component is allowed)" = "இன்ஸ்டன்ஸை மாற்றும்போது முதலில் வழங்கப்படும் (எந்த காம்போனென்டும் அனுமதிக்கப்படும்)" +"Offset" = "ஆஃப்செட்" +"Oldest first" = "பழையவை முதலில்" +"On click" = "கிளிக் செய்யும்போது" +"On drag" = "இழுக்கும்போது" +"On this page" = "இந்தப் பக்கத்தில்" +"One announcement in five common sizes: square, portrait, story, link and banner" = "ஐந்து பொதுவான அளவுகளில் ஒரு அறிவிப்பு: சதுரம், போர்ட்ரெய்ட், ஸ்டோரி, இணைப்பு மற்றும் பேனர்" +"Online" = "ஆன்லைன்" +"Online files" = "ஆன்லைன் கோப்புகள்" +"Online sharing is off: files are shared on the local network only." = "ஆன்லைன் பகிர்வு முடக்கத்தில் உள்ளது: கோப்புகள் உள்ளூர் நெட்வொர்க்கில் மட்டுமே பகிரப்படும்." +"Online sharing is off: no server is set in Preferences. Here you can join a shared file." = "ஆன்லைன் பகிர்வு முடக்கத்தில் உள்ளது: விருப்பங்களில் சர்வர் அமைக்கப்படவில்லை. இங்கே பகிரப்பட்ட கோப்பில் சேரலாம்." +"Only the first changed layers are listed." = "மாற்றப்பட்ட முதல் லேயர்கள் மட்டுமே பட்டியலிடப்பட்டுள்ளன." +"Only the first {n} changed layers are listed." = "மாற்றப்பட்ட முதல் {n} லேயர்கள் மட்டுமே பட்டியலிடப்பட்டுள்ளன." +"Only your threads" = "உங்கள் த்ரெட்கள் மட்டும்" +"Opacity" = "ஒளிபுகாமை" +"Opacity & blend" = "ஒளிபுகாமை & கலப்பு" +"Opacity 10%…90%, 0: 100%" = "ஒளிபுகாமை 10%…90%, 0: 100%" +"Open" = "திற" +"Open .figcraft, .svg or images" = ".figcraft, .svg அல்லது படங்களைத் திற" +"Open branch" = "கிளையைத் திற" +"Open file" = "கோப்பைத் திற" +"Open files" = "கோப்புகளைத் திற" +"Open in focus view" = "ஃபோகஸ் காட்சியில் திற" +"Open in new tab" = "புதிய தாவலில் திற" +"Open in new window" = "புதிய சாளரத்தில் திற" +"Open invite links in FigCraft" = "அழைப்பு இணைப்புகளை FigCraft இல் திற" +"Open link" = "இணைப்பைத் திற" +"Open link {url}" = "{url} இணைப்பைத் திற" +"Open overlay" = "ஓவர்லேவைத் திற" +"Open presentations" = "விளக்கக்காட்சிகளைத் திற" +"Open prototype preview" = "ப்ரோட்டோடைப் முன்னோட்டத்தைத் திற" +"Open variables ({count})" = "வேரியபிள்களைத் திற ({count})" +"Opened as a new document" = "புதிய ஆவணமாகத் திறக்கப்பட்டது" +"Opened “{name}” in a new tab" = "“{name}” புதிய தாவலில் திறக்கப்பட்டது" +"Opening the file…" = "கோப்பு திறக்கப்படுகிறது…" +"Opening {n} files as new files" = { one = "புதிய கோப்பாகத் திறக்கப்படுகிறது", other = "{n} கோப்புகள் புதிய கோப்புகளாகத் திறக்கப்படுகின்றன" } +"Open|comments" = "திறந்தவை" +"Options" = "விருப்பங்கள்" +"Orange" = "ஆரஞ்சு" +"Order" = "வரிசை" +"Other" = "பிற" +"Other apps may not open every .fig file exported here." = "இங்கே ஏற்றுமதி செய்யப்படும் ஒவ்வொரு .fig கோப்பையும் பிற ஆப்கள் திறக்காமல் போகலாம்." +"Others lose access and keep their copy; the file stays on the server for you" = "மற்றவர்கள் அணுகலை இழப்பார்கள், அவர்களின் நகல் அவர்களிடம் இருக்கும்; கோப்பு உங்களுக்காக சர்வரில் இருக்கும்" +"Others type this under Share ▸ Join with a code" = "மற்றவர்கள் இதை பகிர் ▸ குறியீட்டுடன் சேர் என்பதன் கீழ் உள்ளிடுவார்கள்" +"Outline stroke" = "ஸ்ட்ரோக்கை அவுட்லைன் ஆக்கு" +"Outline text" = "உரையை அவுட்லைன் ஆக்கு" +"Outlines" = "அவுட்லைன்கள்" +"Outside" = "வெளியே" +"Overflow" = "ஓவர்ஃப்ளோ" +"Overlay" = "ஓவர்லே" +"Overlay position" = "ஓவர்லே நிலை" +"Overridden here (the collection it extends has another value)" = "இங்கே ஓவர்ரைடு செய்யப்பட்டது (இது நீட்டிக்கும் தொகுப்பில் வேறு மதிப்பு உள்ளது)" +"Overrides" = "ஓவர்ரைடுகள்" +"Owner token" = "உரிமையாளர் டோக்கன்" +"Owner token copied" = "உரிமையாளர் டோக்கன் நகலெடுக்கப்பட்டது" +"PDF print options" = "PDF அச்சு விருப்பங்கள்" +"PDF print settings" = "PDF அச்சு அமைப்புகள்" +"Padding" = "பேடிங்" +"Page" = "பக்கம்" +"Page deleted" = "பக்கம் நீக்கப்பட்டது" +"Pages" = "பக்கங்கள்" +"Pages added to the document" = "ஆவணத்தில் பக்கங்கள் சேர்க்கப்பட்டன" +"Pages: {pages}" = "பக்கங்கள்: {pages}" +"Paint bucket" = "பெயிண்ட் பக்கெட்" +"Pan the canvas" = "கேன்வாஸை நகர்த்து" +"Pan with nothing selected (Shift: farther)" = "எதுவும் தேர்ந்தெடுக்காதபோது நகர்த்து (Shift: அதிக தூரம்)" +"Panels" = "பேனல்கள்" +"Paper" = "காகிதம்" +"Paragraph indent" = "பத்தி உள்தள்ளல்" +"Paragraph indent applies to left-aligned text" = "பத்தி உள்தள்ளல் இடப்புறம் சீரமைத்த உரைக்கு மட்டும் பொருந்தும்" +"Paragraph spacing" = "பத்தி இடைவெளி" +"Parallelogram left" = "இடது இணைகரம்" +"Parallelogram right" = "வலது இணைகரம்" +"Pass through" = "பாஸ் த்ரூ" +"Past 30 days" = "கடந்த 30 நாட்கள்" +"Past 90 days" = "கடந்த 90 நாட்கள்" +"Past year" = "கடந்த ஆண்டு" +"Paste a link (https://…)" = "இணைப்பை ஒட்டவும் (https://…)" +"Paste a team library link (a view link)" = "குழு லைப்ரரி இணைப்பை ஒட்டவும் (பார்வை இணைப்பு)" +"Paste effect" = "எஃபெக்ட்டை ஒட்டு" +"Paste fill" = "ஃபில்லை ஒட்டு" +"Paste here" = "இங்கே ஒட்டு" +"Paste stroke" = "ஸ்ட்ரோக்கை ஒட்டு" +"Paste to replace" = "மாற்றீடாக ஒட்டு" +"Pasted design layers" = "ஒட்டிய வடிவமைப்பு லேயர்கள்" +"Pasted design layers; the clipboard didn't carry the images of: {layers}" = "வடிவமைப்பு லேயர்கள் ஒட்டப்பட்டன; இவற்றின் படங்களை கிளிப்போர்டு கொண்டுவரவில்லை: {layers}" +"Pasted design layers; {n} kinds of content were left out" = { one = "வடிவமைப்பு லேயர்கள் ஒட்டப்பட்டன; {n} வகை உள்ளடக்கம் விடுபட்டது", other = "வடிவமைப்பு லேயர்கள் ஒட்டப்பட்டன; {n} வகை உள்ளடக்கங்கள் விடுபட்டன" } +"Pattern" = "பேட்டர்ன்" +"Pattern alignment" = "பேட்டர்ன் சீரமைவு" +"Pattern scale" = "பேட்டர்ன் அளவு" +"Pattern source" = "பேட்டர்ன் மூலம்" +"Pause" = "இடைநிறுத்து" +"Pen" = "பேனா" +"Pencil" = "பென்சில்" +"Pentagon" = "ஐங்கோணம்" +"People in this file" = "இந்தக் கோப்பில் உள்ளவர்கள்" +"People join from anywhere with a code. The file is kept on {server} while you share it." = "குறியீட்டுடன் எங்கிருந்தும் சேரலாம். நீங்கள் பகிரும் வரை கோப்பு {server} இல் வைக்கப்படும்." +"People on your network join with a code. Nothing goes through a server." = "உங்கள் நெட்வொர்க்கில் உள்ளவர்கள் குறியீட்டுடன் சேரலாம். எதுவும் சர்வர் வழியாகச் செல்லாது." +"Phone" = "ஃபோன்" +"Pick color" = "நிறத்தைத் தேர்ந்தெடு" +"Pick color (I)" = "நிறத்தைத் தேர்ந்தெடு (I)" +"Pick one font family first" = "முதலில் ஒரு எழுத்துருக் குடும்பத்தைத் தேர்ந்தெடுக்கவும்" +"Pick select: Tab and Shift+Tab move between layers, Enter goes into one, Shift+Enter out, Space selects, Escape cancels" = "பிக் தேர்வு: Tab, Shift+Tab லேயர்களுக்கு இடையே நகர்த்தும், Enter உள்ளே செல்லும், Shift+Enter வெளியே, Space தேர்ந்தெடுக்கும், Escape ரத்துசெய்யும்" +"Pick select: into a layer, out to its parent" = "பிக் தேர்வு: லேயருக்குள், அதன் பேரன்ட் லேயருக்கு வெளியே" +"Pick select: next or previous layer" = "பிக் தேர்வு: அடுத்த அல்லது முந்தைய லேயர்" +"Pick select: select the picked layer" = "பிக் தேர்வு: தேர்ந்த லேயரைத் தேர்ந்தெடு" +"Pick the Frame tool, then drag on the canvas or choose a device size" = "ஃப்ரேம் கருவியைத் தேர்ந்தெடுத்து, கேன்வாஸில் இழுக்கவும் அல்லது சாதன அளவைத் தேர்வுசெய்யவும்" +"Pin a property" = "ஒரு பண்பைப் பின் செய்" +"Pinch" = "பிஞ்ச்" +"Pink" = "இளஞ்சிவப்பு" +"Pixel grid" = "பிக்சல் கட்டம்" +"Pixel preview 1x" = "பிக்சல் முன்னோட்டம் 1x" +"Pixel preview 2x" = "பிக்சல் முன்னோட்டம் 2x" +"Place a shape or frame (its tool chosen)" = "வடிவம் அல்லது ஃப்ரேமை வை (அதன் கருவி தேர்ந்தெடுக்கப்பட்டிருக்கும்போது)" +"Place automatically" = "தானாக வை" +"Place image" = "படத்தை வை" +"Placed on the current page" = "தற்போதைய பக்கத்தில் வைக்கப்பட்டது" +"Playground" = "பயிற்சிக் களம்" +"Plugin" = "ப்ளகின்" +"Plugins" = "ப்ளகின்கள்" +"Plugins & widgets" = "ப்ளகின்கள் & விட்ஜெட்கள்" +"Plugins run in FigCraft's sandbox, without files, network or clock. Install only plugins you trust." = "ப்ளகின்கள் FigCraft இன் சாண்ட்பாக்ஸில் கோப்புகள், நெட்வொர்க் அல்லது கடிகாரம் இல்லாமல் இயங்கும். நீங்கள் நம்பும் ப்ளகின்களை மட்டும் நிறுவவும்." +"Plus" = "கூட்டல்" +"Plus darker" = "பிளஸ் டார்க்கர்" +"Plus lighter" = "பிளஸ் லைட்டர்" +"Plus one" = "பிளஸ் ஒன்" +"Point" = "புள்ளி" +"Points" = "புள்ளிகள்" +"Polygon" = "பலகோணம்" +"Polygons" = "பலகோணங்கள்" +"Port" = "போர்ட்" +"Position" = "இடம்" +"Post" = "பதிவிடு" +"Predefined process" = "முன்வரையறுத்த செயல்முறை" +"Preferences" = "விருப்பங்கள்" +"Preferred" = "விருப்பமானவை" +"Present" = "வழங்கு" +"Present or preview" = "வழங்கு அல்லது முன்னோட்டம்" +"Present this flow" = "இந்த ஃப்ளோவை வழங்கு" +"Presentation" = "விளக்கக்காட்சி" +"Presentation slides" = "விளக்கக்காட்சி ஸ்லைடுகள்" +"Presenting: comments" = "வழங்குதல்: கருத்துகள்" +"Presenting: cycle the size options" = "வழங்குதல்: அளவு விருப்பங்களை மாற்று" +"Presenting: full screen" = "வழங்குதல்: முழுத் திரை" +"Presenting: next frame" = "வழங்குதல்: அடுத்த ஃப்ரேம்" +"Presenting: previous frame" = "வழங்குதல்: முந்தைய ஃப்ரேம்" +"Presenting: restart" = "வழங்குதல்: மீண்டும் தொடங்கு" +"Preserve scroll position" = "ஸ்க்ரோல் நிலையைத் தக்கவை" +"Presets" = "முன்னமைவுகள்" +"Press a key…" = "ஒரு விசையை அழுத்தவும்…" +"Pretty" = "அழகான" +"Pretty: full lines, no one word alone on the last" = "அழகான: முழு வரிகள், கடைசி வரியில் தனிச் சொல் இல்லை" +"Preview" = "முன்னோட்டம்" +"Preview this flow" = "இந்த ஃப்ளோவை முன்னோட்டமிடு" +"Preview this frame" = "இந்த ஃப்ரேமை முன்னோட்டமிடு" +"Previous frame" = "முந்தைய ஃப்ரேம்" +"Previous ready for dev" = "முந்தைய டெவ்-க்குத் தயார்" +"Progressive" = "படிப்படியான" +"Properties" = "பண்புகள்" +"Properties copied" = "பண்புகள் நகலெடுக்கப்பட்டன" +"Prototype" = "ப்ரோட்டோடைப்" +"Prototype preview" = "ப்ரோட்டோடைப் முன்னோட்டம்" +"Prototype settings" = "ப்ரோட்டோடைப் அமைப்புகள்" +"Publish" = "வெளியிடு" +"Publish changes" = "மாற்றங்களை வெளியிடு" +"Publish to another server…" = "வேறு சர்வரில் வெளியிடு…" +"Publish to server" = "சர்வரில் வெளியிடு" +"Published version {v}" = "பதிப்பு {v} வெளியிடப்பட்டது" +"Published version {v} to the server" = "பதிப்பு {v} சர்வரில் வெளியிடப்பட்டது" +"Published version {v}: save the file so other files can use it" = "பதிப்பு {v} வெளியிடப்பட்டது: பிற கோப்புகள் பயன்படுத்த இந்தக் கோப்பைச் சேமிக்கவும்" +"Published · {people}" = "வெளியிடப்பட்டது · {people}" +"Publishing with the server's key." = "சர்வரின் விசையுடன் வெளியிடப்படுகிறது." +"Publishing…" = "வெளியிடப்படுகிறது…" +"Push" = "புஷ்" +"Push changes to main component" = "மாற்றங்களை முதன்மை காம்போனென்ட்டுக்கு புஷ் செய்" +"Put text on path" = "உரையைப் பாதையில் வை" +"Question" = "கேள்வி" +"R" = "R" +"Radial" = "ரேடியல்" +"Radius" = "ஆரம்" +"Ratio" = "விகிதம்" +"Reading the library…" = "லைப்ரரி படிக்கப்படுகிறது…" +"Ready for dev" = "டெவ்-க்குத் தயார்" +"Real name" = "உண்மைப் பெயர்" +"Recent" = "சமீபத்தியவை" +"Recent files" = "சமீபத்திய கோப்புகள்" +"Recents" = "சமீபத்தியவை" +"Recovered {n} unsaved files after the app quit unexpectedly: save them to keep them" = { one = "ஆப் எதிர்பாராமல் மூடியதால் சேமிக்காத ஒரு கோப்பு மீட்கப்பட்டது: அதை வைத்திருக்கச் சேமிக்கவும்", other = "ஆப் எதிர்பாராமல் மூடியதால் சேமிக்காத {n} கோப்புகள் மீட்கப்பட்டன: அவற்றை வைத்திருக்கச் சேமிக்கவும்" } +"Rectangle" = "செவ்வகம்" +"Rectangles" = "செவ்வகங்கள்" +"Red" = "சிவப்பு" +"Reduce motion" = "இயக்கத்தைக் குறை" +"Refraction" = "ஒளிவிலகல்" +"Regular expression" = "ரெகுலர் எக்ஸ்பிரஷன்" +"Relative to" = "இதைப் பொறுத்து" +"Relative to your system's display scaling (100% is the system's own size). Document zoom is separate." = "உங்கள் கணினியின் காட்சி அளவிடலைப் பொறுத்து (100% என்பது கணினியின் சொந்த அளவு). ஆவண ஜூம் தனியானது." +"Reload the page to get back the unsaved files the browser had room for." = "உலாவியில் இடம் இருந்த சேமிக்காத கோப்புகளைத் திரும்பப் பெறப் பக்கத்தை மீண்டும் ஏற்றவும்." +"Reload the page to get your unsaved files back." = "சேமிக்காத கோப்புகளைத் திரும்பப் பெறப் பக்கத்தை மீண்டும் ஏற்றவும்." +"Reload the page to start again." = "மீண்டும் தொடங்கப் பக்கத்தை மீண்டும் ஏற்றவும்." +"Remove" = "அகற்று" +"Remove all" = "அனைத்தையும் அகற்று" +"Remove all auto layout" = "எல்லா ஆட்டோ லேஅவுட்டையும் அகற்று" +"Remove annotation" = "குறிப்புரையை அகற்று" +"Remove auto layout" = "ஆட்டோ லேஅவுட்டை அகற்று" +"Remove column" = "நெடுவரிசையை அகற்று" +"Remove dev resource" = "டெவ் ஆதாரத்தை அகற்று" +"Remove export setting" = "ஏற்றுமதி அமைப்பை அகற்று" +"Remove from recents" = "சமீபத்தியவற்றிலிருந்து அகற்று" +"Remove from server" = "சர்வரிலிருந்து அகற்று" +"Remove from server…" = "சர்வரிலிருந்து அகற்று…" +"Remove guide" = "வழிகாட்டியை அகற்று" +"Remove interaction" = "இன்டராக்ஷனை அகற்று" +"Remove library from this file" = "இந்தக் கோப்பிலிருந்து லைப்ரரியை அகற்று" +"Remove measurement" = "அளவீட்டை அகற்று" +"Remove min and max" = "குறைந்தபட்ச, அதிகபட்சத்தை அகற்று" +"Remove min and max height" = "குறைந்தபட்ச, அதிகபட்ச உயரத்தை அகற்று" +"Remove min and max width" = "குறைந்தபட்ச, அதிகபட்ச அகலத்தை அகற்று" +"Remove regions" = "பகுதிகளை அகற்று" +"Remove row" = "வரிசையை அகற்று" +"Remove slot" = "ஸ்லாட்டை அகற்று" +"Remove starting point" = "தொடக்கப் புள்ளியை அகற்று" +"Remove stop" = "நிறுத்தத்தை அகற்று" +"Remove text from path" = "பாதையிலிருந்து உரையை அகற்று" +"Remove the else and its actions" = "else மற்றும் அதன் செயல்களை அகற்று" +"Remove these results from the file" = "இந்த முடிவுகளைக் கோப்பிலிருந்து நீக்கு" +"Remove this condition and its actions" = "இந்த நிபந்தனையையும் அதன் செயல்களையும் அகற்று" +"Remove this file from the server? It can't be shared or opened from there again. Your copy stays open here." = "இந்தக் கோப்பைச் சர்வரிலிருந்து அகற்றவா? அங்கிருந்து அதை மீண்டும் பகிரவோ திறக்கவோ முடியாது. உங்கள் நகல் இங்கே திறந்தே இருக்கும்." +"Remove {name} from session" = "{name} ஐ அமர்விலிருந்து அகற்று" +"Remove {name} from {server}?" = "{name} ஐ {server} இலிருந்து அகற்றவா?" +"Removed" = "அகற்றப்பட்டது" +"Removed from the server" = "சர்வரிலிருந்து அகற்றப்பட்டது" +"Removed since it was marked" = "குறித்ததிலிருந்து அகற்றப்பட்டது" +"Removed since this version" = "இந்தப் பதிப்பிலிருந்து அகற்றப்பட்டது" +"Rename" = "மறுபெயரிடு" +"Rename duplicated layers" = "நகலெடுத்த லேயர்களை மறுபெயரிடு" +"Rename folder" = "கோப்புறையை மறுபெயரிடு" +"Rename group" = "குழுவை மறுபெயரிடு" +"Rename layers" = "லேயர்களை மறுபெயரிடு" +"Rename mode" = "மோடை மறுபெயரிடு" +"Rename on the server" = "சர்வரில் மறுபெயரிடு" +"Rename on the server…" = "சர்வரில் மறுபெயரிடு…" +"Rename page" = "பக்கத்தை மறுபெயரிடு" +"Rename to" = "இவ்வாறு மறுபெயரிடு" +"Reorder selection" = "தேர்வை மறுவரிசைப்படுத்து" +"Replace all" = "அனைத்தையும் மாற்று" +"Replace mixed export settings" = "கலப்பு ஏற்றுமதி அமைப்புகளை மாற்று" +"Replace with" = "இதனால் மாற்று" +"Replace with a new interaction" = "புதிய இன்டராக்ஷனால் மாற்று" +"Reply" = "பதிலளி" +"Report" = "புகாரளி" +"Report this file…" = "இந்தக் கோப்பைப் புகாரளி…" +"Reset" = "மீட்டமை" +"Reset adjustments" = "சரிசெய்தல்களை மீட்டமை" +"Reset all changes" = "எல்லா மாற்றங்களையும் மீட்டமை" +"Reset all overrides on this layer" = "இந்த லேயரின் எல்லா ஓவர்ரைடுகளையும் மீட்டமை" +"Reset grid" = "கட்டத்தை மீட்டமை" +"Reset overrides" = "ஓவர்ரைடுகளை மீட்டமை" +"Reset slot" = "ஸ்லாட்டை மீட்டமை" +"Reset this override" = "இந்த ஓவர்ரைடை மீட்டமை" +"Reset to style" = "ஸ்டைலுக்கு மீட்டமை" +"Reset to the inherited value" = "மரபுரிமை மதிப்புக்கு மீட்டமை" +"Resize by the nudge amount" = "சிறு நகர்வு அளவால் அளவு மாற்று" +"Resize frames to the device's screen (or the window without a device): their constraints and auto layout respond" = "ஃப்ரேம்களைச் சாதனத்தின் திரைக்கு (சாதனம் இல்லையெனில் சாளரத்திற்கு) அளவு மாற்று: அவற்றின் கட்டுப்பாடுகளும் ஆட்டோ லேஅவுட்டும் பதிலளிக்கும்" +"Resize to fit" = "பொருந்தும்படி அளவு மாற்று" +"Resizing" = "அளவு மாற்றம்" +"Resolve" = "தீர்த்துவை" +"Resolve change" = "மாற்றத்தைத் தீர்த்துவை" +"Resolved" = "தீர்க்கப்பட்டது" +"Responsive" = "ரெஸ்பான்சிவ்" +"Restart" = "மீண்டும் தொடங்கு" +"Restore" = "மீட்டெடு" +"Restore main component" = "முதன்மை காம்போனென்ட்டை மீட்டெடு" +"Restore this version" = "இந்தப் பதிப்பை மீட்டெடு" +"Restored “{name}”" = "“{name}” மீட்டெடுக்கப்பட்டது" +"Results" = "முடிவுகள்" +"Resume" = "தொடர்" +"Retrospective" = "பின்னோக்கு" +"Retry now" = "இப்போது மீண்டும் முயல்" +"Reverse the order" = "வரிசையைத் தலைகீழாக்கு" +"Reversed triangle" = "தலைகீழ் முக்கோணம்" +"Review and merge" = "மதிப்பாய்வு செய்து இணை" +"Ribbon" = "ரிப்பன்" +"Right" = "வலது" +"Right padding" = "வலது பேடிங்" +"Right side" = "வலது பக்கம்" +"Right side width" = "வலது பக்க அகலம்" +"Right to left" = "வலமிருந்து இடம்" +"Rotate 90°" = "90° சுழற்று" +"Rotate 90° right" = "வலப்புறம் 90° சுழற்று" +"Rotate a degree (Shift: 15)" = "ஒரு டிகிரி சுழற்று (Shift: 15)" +"Rotate to landscape" = "லேண்ட்ஸ்கேப்பாகச் சுழற்று" +"Rotate to portrait" = "போர்ட்ரெய்ட்டாகச் சுழற்று" +"Rotation" = "சுழற்சி" +"Rotation jitter" = "சுழற்சி நடுக்கம்" +"Round" = "வட்டமான" +"Rounded" = "வளைந்த" +"Rounded rectangle" = "வளைந்த மூலைச் செவ்வகம்" +"Row" = "வரிசை" +"Row gap" = "வரிசை இடைவெளி" +"Row sizes" = "வரிசை அளவுகள்" +"Row span" = "வரிசை நீட்டிப்பு" +"Rows" = "வரிசைகள்" +"Rows {count}" = "வரிசைகள் {count}" +"Rulers" = "அளவுகோல்கள்" +"Run" = "இயக்கு" +"Run {label}" = "{label} ஐ இயக்கு" +"SHA-256: {sha}…" = "SHA-256: {sha}…" +"Same as file ({profile})" = "கோப்பைப் போலவே ({profile})" +"Same as layer" = "லேயரைப் போலவே" +"Saturation" = "செறிவு" +"Save" = "சேமி" +"Save a copy…" = "நகலைச் சேமி…" +"Save as" = "இவ்வாறு சேமி" +"Save as preset…" = "முன்னமைவாகச் சேமி…" +"Save file" = "கோப்பைச் சேமி" +"Save files automatically" = "கோப்புகளைத் தானாகச் சேமி" +"Save version {key}" = "பதிப்பைச் சேமி {key}" +"Saved" = "சேமிக்கப்பட்டது" +"Saved {name}" = "{name} சேமிக்கப்பட்டது" +"Say something" = "ஏதாவது சொல்லுங்கள்" +"Scale" = "அளவு" +"Scatter" = "சிதறல்" +"Scope: all supported properties" = "வரம்பு: ஆதரிக்கப்படும் அனைத்து பண்புகள்" +"Scope: hidden from pickers" = "வரம்பு: தேர்வுப் பட்டியல்களில் மறைக்கப்பட்டது" +"Scope: only {scope}" = "வரம்பு: {scope} மட்டும்" +"Scoping: where pickers offer it" = "வரம்பு: தேர்வுக்கருவிகள் இதை வழங்கும் இடம்" +"Screen" = "ஸ்கிரீன்" +"Scroll behavior" = "ஸ்க்ரோல் நடத்தை" +"Scroll to" = "இதற்கு ஸ்க்ரோல் செய்" +"Scroll to layer" = "லேயருக்கு ஸ்க்ரோல் செய்" +"Scroll wheel zoom" = "ஸ்க்ரோல் வீல் ஜூம்" +"Scroll with parent" = "பேரன்ட்டுடன் ஸ்க்ரோல் செய்" +"Scrub a field faster (2x) or slower (1/2, 1/4)" = "புலத்தை வேகமாக (2x) அல்லது மெதுவாக (1/2, 1/4) இழுத்து மாற்றவும்" +"Scrubbing at 1/2" = "1/2 வேகத்தில் இழுக்கிறது" +"Scrubbing at 1/4" = "1/4 வேகத்தில் இழுக்கிறது" +"Scrubbing at 1x" = "1x வேகத்தில் இழுக்கிறது" +"Scrubbing at 2x" = "2x வேகத்தில் இழுக்கிறது" +"Search" = "தேடு" +"Search actions, layers and tools" = "செயல்கள், லேயர்கள் மற்றும் கருவிகளைத் தேடு" +"Search assets" = "அசெட்களைத் தேடு" +"Search comments" = "கருத்துகளைத் தேடு" +"Search files and templates" = "கோப்புகளையும் டெம்ப்ளேட்களையும் தேடு" +"Search fonts" = "எழுத்துருக்களைத் தேடு" +"Search layers" = "லேயர்களைத் தேடு" +"Search pages" = "பக்கங்களைத் தேடு" +"Search plugins" = "ப்ளகின்களைத் தேடு" +"Search results" = "தேடல் முடிவுகள்" +"Search shortcuts" = "குறுக்குவழிகளைத் தேடு" +"Search templates" = "டெம்ப்ளேட்களைத் தேடு" +"Section" = "செக்ஷன்" +"Section color" = "செக்ஷன் நிறம்" +"Sections" = "செக்ஷன்கள்" +"See all templates" = "எல்லா டெம்ப்ளேட்களையும் காண்க" +"Select a frame and add a starting point to present it as a flow." = "ஃப்ளோவாகக் காட்ட, ஒரு ஃப்ரேமைத் தேர்ந்தெடுத்து தொடக்கப் புள்ளியைச் சேர்க்கவும்." +"Select a frame to preview it" = "முன்னோட்டம் பார்க்க ஒரு ஃப்ரேமைத் தேர்ந்தெடுக்கவும்" +"Select a layer to see its properties and code" = "பண்புகளையும் குறியீட்டையும் பார்க்க ஒரு லேயரைத் தேர்ந்தெடுக்கவும்" +"Select all" = "அனைத்தையும் தேர்ந்தெடு" +"Select all with same" = "ஒரே மாதிரியானவற்றைத் தேர்ந்தெடு" +"Select layer" = "லேயரைத் தேர்ந்தெடு" +"Select layers and they space themselves as their content changes" = "லேயர்களைத் தேர்ந்தெடுக்கவும், அவற்றின் உள்ளடக்கம் மாறும்போது அவை தாமாக இடைவெளி அமைத்துக்கொள்ளும்" +"Select layers to apply the style to" = "ஸ்டைலைப் பயன்படுத்த லேயர்களைத் தேர்ந்தெடுக்கவும்" +"Select layers with this color" = "இந்த நிறம் உள்ள லேயர்களைத் தேர்ந்தெடு" +"Select overlapping shapes" = "ஒன்றின்மேல் ஒன்றான வடிவங்களைத் தேர்ந்தெடு" +"Select points to edit their position, radius and mirroring" = "நிலை, ஆரம், மிரரிங் ஆகியவற்றைத் திருத்தப் புள்ளிகளைத் தேர்ந்தெடுக்கவும்" +"Select slot" = "ஸ்லாட்டைத் தேர்ந்தெடு" +"Selection" = "தேர்வு" +"Selection box, {w} by {h} at {x}, {y}: arrows move it, Shift+arrows or {cmd}+arrows size it, Enter selects, Escape cancels" = "தேர்வுப் பெட்டி, {w} × {h}, இடம் {x}, {y}: அம்புகள் நகர்த்தும், Shift+அம்புகள் அல்லது {cmd}+அம்புகள் அளவை மாற்றும், Enter தேர்ந்தெடுக்கும், Escape ரத்துசெய்யும்" +"Selection box: arrows move it, Shift+arrows or {cmd}+arrows size it, Enter selects, Escape cancels" = "தேர்வுப் பெட்டி: அம்புகள் நகர்த்தும், Shift+அம்புகள் அல்லது {cmd}+அம்புகள் அளவை மாற்றும், Enter தேர்ந்தெடுக்கும், Escape ரத்துசெய்யும்" +"Selection box: switch to pick select" = "தேர்வுப் பெட்டி: பிக் தேர்வுக்கு மாறு" +"Selection colors" = "தேர்வின் நிறங்கள்" +"Send backward" = "பின்னால் அனுப்பு" +"Send report" = "அறிக்கையை அனுப்பு" +"Send to back" = "மிகப் பின்னால் அனுப்பு" +"Sep" = "செப்" +"Server address" = "சர்வர் முகவரி" +"Server address (ws://host:47900/)" = "சர்வர் முகவரி (ws://host:47900/)" +"Server for online sharing" = "ஆன்லைன் பகிர்வுக்கான சர்வர்" +"Server key" = "சர்வர் கீ" +"Set as default" = "இயல்பாக அமை" +"Set corner smoothing to 60%" = "மூலை மென்மையை 60% ஆக அமை" +"Set fill container" = "கண்டெய்னரை நிரப்பு என அமை" +"Set hug contents" = "உள்ளடக்கத்தை ஹக் செய் என அமை" +"Set variable" = "வேரியபிளை அமை" +"Set variable mode" = "வேரியபிள் மோடை அமை" +"Set variable {name}" = "{name} வேரியபிளை அமை" +"Set {name} to {value}" = "{name} ஐ {value} ஆக அமை" +"Shadows" = "நிழல்கள்" +"Shape" = "வடிவம்" +"Shape builder" = "வடிவ உருவாக்கி" +"Shape tools" = "வடிவக் கருவிகள்" +"Shapes" = "வடிவங்கள்" +"Share" = "பகிர்" +"Share this file" = "இந்தக் கோப்பைப் பகிர்" +"Share with a code" = "குறியீடு மூலம் பகிர்" +"Share: live session, export" = "பகிர்: நேரலை அமர்வு, ஏற்றுமதி" +"Shared" = "பகிரப்பட்டது" +"Shared by your team on {server}" = "{server} இல் உங்கள் குழு பகிர்ந்தது" +"Shared: copy its code from the file's menu" = "பகிரப்பட்டது: கோப்பு மெனுவிலிருந்து அதன் குறியீட்டை நகலெடுக்கவும்" +"Sharing on the local network (online sharing is off: no server is set in Preferences)." = "உள்ளூர் நெட்வொர்க்கில் பகிர்கிறது (ஆன்லைன் பகிர்வு முடக்கத்தில் உள்ளது: விருப்பங்களில் சர்வர் அமைக்கப்படவில்லை)." +"Sharing on your network · {people}" = "உங்கள் நெட்வொர்க்கில் பகிர்கிறது · {people}" +"Sharing online · {people}" = "ஆன்லைனில் பகிர்கிறது · {people}" +"Sharing stopped: the file stays on the server, open only to you" = "பகிர்வு நிறுத்தப்பட்டது: கோப்பு சர்வரில் இருக்கும், உங்களுக்கு மட்டுமே திறந்திருக்கும்" +"Show" = "காட்டு" +"Show all templates" = "எல்லா டெம்ப்ளேட்களையும் காட்டு" +"Show and move the placement crosshair (its tool chosen, nothing selected)" = "வைப்புக் குறுக்குக்குறியைக் காட்டி நகர்த்து (அதன் கருவி தேர்ந்தெடுக்கப்பட்டு, எதுவும் தேர்ந்தெடுக்கப்படாதபோது)" +"Show as grid" = "கட்டமாகக் காட்டு" +"Show as list" = "பட்டியலாகக் காட்டு" +"Show autosaves" = "தானியங்கு சேமிப்புகளைக் காட்டு" +"Show behind transparent areas" = "ஒளிபுகும் பகுதிகளுக்குப் பின்னால் காட்டு" +"Show comments (Shift+C)" = "கருத்துகளைக் காட்டு (Shift+C)" +"Show device frame" = "சாதன ஃப்ரேமைக் காட்டு" +"Show dimensions on objects" = "பொருள்களில் அளவுகளைக் காட்டு" +"Show hotspot hints" = "ஹாட்ஸ்பாட் குறிப்புகளைக் காட்டு" +"Show in Explorer" = "Explorer இல் காட்டு" +"Show in Finder" = "Finder இல் காட்டு" +"Show in folder" = "கோப்புறையில் காட்டு" +"Show only this on the canvas" = "இதை மட்டும் கேன்வாஸில் காட்டு" +"Show open" = "திறந்தவற்றைக் காட்டு" +"Show section contents" = "செக்ஷன் உள்ளடக்கத்தைக் காட்டு" +"Show this layer" = "இந்த லேயரைக் காட்டு" +"Show usage" = "பயன்பாட்டைக் காட்டு" +"Show/Hide" = "காட்டு/மறை" +"Show/Hide UI" = "UI ஐக் காட்டு/மறை" +"Side by side" = "பக்கவாட்டில்" +"Sidebar" = "பக்கப்பட்டி" +"Simplify stroke" = "ஸ்ட்ரோக்கை எளிதாக்கு" +"Size" = "அளவு" +"Size jitter" = "அளவு மாறுபாடு" +"Skip ink" = "மையைத் தவிர்" +"Slashed zero" = "குறுக்குக்கோட்டுப் பூஜ்ஜியம்" +"Slice" = "ஸ்லைஸ்" +"Slices" = "ஸ்லைஸ்கள்" +"Slide in" = "உள்ளே நழுவு" +"Slide out" = "வெளியே நழுவு" +"Slot" = "ஸ்லாட்" +"Slot content" = "ஸ்லாட் உள்ளடக்கம்" +"Slot name" = "ஸ்லாட் பெயர்" +"Small capitals" = "சிறிய பெரிய எழுத்துகள்" +"Small caps" = "சிறிய கேப்ஸ்" +"Smart animate" = "ஸ்மார்ட் அனிமேட்" +"Snap to pixel grid" = "பிக்சல் கட்டத்துடன் ஒட்டு" +"Social and slides" = "சமூக ஊடகம் மற்றும் ஸ்லைடுகள்" +"Social media" = "சமூக ஊடகம்" +"Social post sizes" = "சமூக இடுகை அளவுகள்" +"Soft light" = "மென் ஒளி" +"Solid" = "திடம்" +"Some variants have the same property values: give each one a unique combination" = "சில வேரியன்ட்களுக்கு ஒரே பண்பு மதிப்புகள் உள்ளன: ஒவ்வொன்றுக்கும் தனித்துவமான சேர்க்கையைக் கொடுக்கவும்" +"Someone who left" = "வெளியேறிய ஒருவர்" +"Sort" = "வரிசைப்படுத்து" +"Sort by" = "இதன்படி வரிசைப்படுத்து" +"Sort by date" = "தேதிப்படி வரிசைப்படுத்து" +"Sort by page" = "பக்கப்படி வரிசைப்படுத்து" +"Sort by {column}" = "{column} படி வரிசைப்படுத்து" +"Space" = "Space" +"Space around" = "சுற்றிலும் இடைவெளி" +"Space between" = "இடையே இடைவெளி" +"Space drag" = "Space இழுத்தல்" +"Space evenly" = "சம இடைவெளி" +"Space+drag" = "Space+இழு" +"Spacing" = "இடைவெளி" +"Spam, stolen work, abuse…" = "ஸ்பேம், திருடிய படைப்பு, துஷ்பிரயோகம்…" +"Speech bubble" = "பேச்சுக் குமிழி" +"Splay" = "விரிப்பு" +"Spotlight me" = "என்னை ஸ்பாட்லைட் செய்" +"Spread" = "பரவல்" +"Square" = "சதுரம்" +"Stamp" = "ஸ்டாம்ப்" +"Stamps" = "ஸ்டாம்ப்கள்" +"Standard" = "நிலையானது" +"Standard ligatures" = "நிலையான லிகேச்சர்கள்" +"Star" = "நட்சத்திரம்" +"Stars" = "நட்சத்திரங்கள்" +"Start" = "தொடங்கு" +"Start ascending from / stop descending at" = "ஏறுமுகம் தொடங்குமிடம் / இறங்குமுகம் நிற்குமிடம்" +"Start from a blank canvas" = "வெற்று கேன்வாஸிலிருந்து தொடங்கு" +"Start from a template" = "டெம்ப்ளேட்டிலிருந்து தொடங்கு" +"Start on path" = "பாதையில் தொடங்கு" +"Start on the Home screen" = "முகப்புத் திரையில் தொடங்கு" +"Start point" = "தொடக்கப் புள்ளி" +"Start sharing" = "பகிரத் தொடங்கு" +"Start sharing with the Share button, then pass on the code it gives" = "பகிர் பொத்தானில் பகிரத் தொடங்கி, அது தரும் குறியீட்டை அனுப்பவும்" +"Start vote" = "வாக்கெடுப்பைத் தொடங்கு" +"Starting to share…" = "பகிரத் தொடங்குகிறது…" +"Status" = "நிலை" +"Sticky" = "ஸ்டிக்கி" +"Sticky note" = "ஸ்டிக்கி நோட்" +"Sticky note colors" = "ஸ்டிக்கி நோட் நிறங்கள்" +"Sticky notes" = "ஸ்டிக்கி நோட்கள்" +"Sticky notes, shapes and connectors" = "ஸ்டிக்கி நோட்கள், வடிவங்கள், கனெக்டர்கள்" +"Stop" = "நிறுத்து" +"Stop following {name}" = "{name} ஐப் பின்தொடர்வதை நிறுத்து" +"Stop session" = "அமர்வை நிறுத்து" +"Stop sharing" = "பகிர்வதை நிறுத்து" +"Stop spotlighting" = "ஸ்பாட்லைட்டை நிறுத்து" +"Stop timer" = "டைமரை நிறுத்து" +"Stop {n} {hex}" = "நிறுத்தம் {n} {hex}" +"Straight" = "நேர்" +"Stretch" = "நீட்டு" +"Strikethrough" = "அடித்தல்" +"String" = "சரம்" +"Stroke" = "ஸ்ட்ரோக்" +"Stroke style" = "ஸ்ட்ரோக் ஸ்டைல்" +"Stroke weight" = "ஸ்ட்ரோக் தடிமன்" +"Strokes" = "ஸ்ட்ரோக்குகள்" +"Strong line every" = "தடித்த கோடு ஒவ்வொரு" +"Style" = "ஸ்டைல்" +"Styles" = "ஸ்டைல்கள்" +"Stylistic set 1" = "ஸ்டைலிஸ்டிக் தொகுப்பு 1" +"Stylistic set 2" = "ஸ்டைலிஸ்டிக் தொகுப்பு 2" +"Stylistic set 3" = "ஸ்டைலிஸ்டிக் தொகுப்பு 3" +"Stylistic set 4" = "ஸ்டைலிஸ்டிக் தொகுப்பு 4" +"Stylistic set 5" = "ஸ்டைலிஸ்டிக் தொகுப்பு 5" +"Subtract" = "கழி" +"Subtracts" = "கழிப்புகள்" +"Suffix" = "பின்னொட்டு" +"Suspend snapping while dragging" = "இழுக்கும்போது ஸ்னாப்பிங்கை நிறுத்திவை" +"Swap instance" = "இன்ஸ்டன்ஸை மாற்று" +"Swap library: use another library's assets of the same names" = "லைப்ரரியை மாற்று: அதே பெயருள்ள மற்றொரு லைப்ரரியின் அசெட்களைப் பயன்படுத்து" +"Swap orientation" = "திசையமைவை மாற்று" +"Swap overlay" = "ஓவர்லேயை மாற்று" +"Swap to {name}" = "{name} க்கு மாற்று" +"Swap width and height" = "அகலத்தையும் உயரத்தையும் இடமாற்று" +"Swapped instance" = "மாற்றிய இன்ஸ்டன்ஸ்" +"Swapped {n} assets" = { one = "{n} அசெட் மாற்றப்பட்டது", other = "{n} அசெட்கள் மாற்றப்பட்டன" } +"Swapped {n} assets; {missed} had no match and still use the old library" = { one = "{n} அசெட் மாற்றப்பட்டது; {missed} பொருந்தவில்லை, இன்னும் பழைய லைப்ரரியைப் பயன்படுத்துகின்றன", other = "{n} அசெட்கள் மாற்றப்பட்டன; {missed} பொருந்தவில்லை, இன்னும் பழைய லைப்ரரியைப் பயன்படுத்துகின்றன" } +"Sweep" = "சுழல்" +"System" = "சிஸ்டம்" +"Tab / Shift+Tab" = "Tab / Shift+Tab" +"Tab or Ctrl+Space again" = "Tab அல்லது Ctrl+Space மீண்டும்" +"Table" = "அட்டவணை" +"Tablet" = "டேப்லெட்" +"Tabular numbers" = "அட்டவணை எண்கள்" +"Take the results off the board; they stay in the file" = "முடிவுகளை போர்டிலிருந்து அகற்று; அவை கோப்பில் இருக்கும்" +"Take the values from the first selected layer" = "முதலில் தேர்ந்தெடுத்த லேயரிலிருந்து மதிப்புகளை எடு" +"Taper" = "குறுக்கம்" +"Taper both ends" = "இரு முனைகளையும் குறுக்கு" +"Tell the server's operator what is wrong with it" = "இதில் என்ன தவறு என்று சர்வர் இயக்குநருக்குத் தெரிவிக்கவும்" +"Temperature" = "வெப்பநிலை" +"Template" = "டெம்ப்ளேட்" +"Templates" = "டெம்ப்ளேட்கள்" +"Terms" = "விதிமுறைகள்" +"Text" = "உரை" +"Text align" = "உரை சீரமைப்பு" +"Text content" = "உரை உள்ளடக்கம்" +"Text direction" = "உரைத் திசை" +"Text on a path" = "பாதையில் உரை" +"Text size" = "உரை அளவு" +"Text style" = "உரை ஸ்டைல்" +"Text styles" = "உரை ஸ்டைல்கள்" +"Texts" = "உரைகள்" +"Texture" = "அமைப்பு" +"The bars are hidden. {shortcut} shows them again" = "பட்டைகள் மறைக்கப்பட்டுள்ளன. {shortcut} அவற்றை மீண்டும் காட்டும்" +"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "கேன்வாஸ் நிறங்களை sRGB இல் காட்டுகிறது; ஏற்றுமதி செய்த PNG, JPG, WebP கோப்புகள் Display P3 எனக் குறிக்கப்படும்." +"The destination document is unavailable. Nothing was imported." = "இலக்கு ஆவணம் கிடைக்கவில்லை. எதுவும் இறக்குமதி செய்யப்படவில்லை." +"The destination document was closed. Nothing was imported." = "இலக்கு ஆவணம் மூடப்பட்டது. எதுவும் இறக்குமதி செய்யப்படவில்லை." +"The destination page was removed. Nothing was imported." = "இலக்குப் பக்கம் அகற்றப்பட்டது. எதுவும் இறக்குமதி செய்யப்படவில்லை." +"The file is deleted from the server: nobody can open or join it from there again, and this can't be undone. Copies that are open stay with whoever has them." = "கோப்பு சர்வரிலிருந்து நீக்கப்படும்: இனி யாரும் அங்கிருந்து அதைத் திறக்கவோ சேரவோ முடியாது, இதைச் செயல்தவிர்க்க முடியாது. திறந்திருக்கும் நகல்கள் அவற்றை வைத்திருப்பவர்களிடமே இருக்கும்." +"The file now holds another library" = "கோப்பில் இப்போது வேறொரு லைப்ரரி உள்ளது" +"The file now holds another library (\"{name}\")" = "கோப்பில் இப்போது வேறொரு லைப்ரரி உள்ளது (\"{name}\")" +"The files you shared or published online from this computer. They stay on their server until you remove them." = "இந்தக் கணினியிலிருந்து நீங்கள் ஆன்லைனில் பகிர்ந்த அல்லது வெளியிட்ட கோப்புகள். நீங்கள் அகற்றும் வரை அவை அவற்றின் சர்வரில் இருக்கும்." +"The link carries the session's secret: share it only with people you invite." = "இணைப்பில் அமர்வின் ரகசியம் உள்ளது: நீங்கள் அழைக்கும் நபர்களுடன் மட்டும் பகிரவும்." +"The name in your online files and on the server. The document inside keeps its own name." = "உங்கள் ஆன்லைன் கோப்புகளிலும் சர்வரிலும் காட்டப்படும் பெயர். உள்ளே உள்ள ஆவணம் தன் பெயரையே வைத்திருக்கும்." +"The selection uses several text styles: click to apply one" = "தேர்வில் பல உரை ஸ்டைல்கள் உள்ளன: ஒன்றைப் பயன்படுத்தக் கிளிக் செய்யவும்" +"The server deletes this file if nobody opens it before {date}." = "{date} க்குள் யாரும் திறக்காவிட்டால் சர்வர் இந்தக் கோப்பை நீக்கும்." +"The whole file" = "முழுக் கோப்பு" +"The window is too small for {size}%, so the interface is drawn at {drawn}%. Make the window larger to use {size}%." = "{size}% க்குச் சாளரம் மிகச் சிறியது, எனவே இடைமுகம் {drawn}% இல் வரையப்படுகிறது. {size}% ஐப் பயன்படுத்தச் சாளரத்தைப் பெரிதாக்கவும்." +"Theme" = "தீம்" +"There's no destination for that action" = "அந்தச் செயலுக்கு இலக்கு இல்லை" +"Thickness" = "தடிமன்" +"This branch can't be reviewed: {e}" = "இந்தக் கிளையை மதிப்பாய்வு செய்ய முடியாது: {e}" +"This branch was merged or archived." = "இந்தக் கிளை இணைக்கப்பட்டது அல்லது காப்பகப்படுத்தப்பட்டது." +"This computer only" = "இந்தக் கணினி மட்டும்" +"This computer remembers the owner token, so the file can be managed from the home screen's Online list. Copy it to manage the file from somewhere else: it is a password for this file and won't be shown again." = "இந்தக் கணினி உரிமையாளர் டோக்கனை நினைவில் வைத்திருப்பதால், முகப்புத் திரையின் ஆன்லைன் பட்டியலிலிருந்து கோப்பை நிர்வகிக்கலாம். வேறு இடத்திலிருந்து நிர்வகிக்க அதை நகலெடுக்கவும்: இது இந்தக் கோப்பின் கடவுச்சொல், மீண்டும் காட்டப்படாது." +"This condition is edited as an expression" = "இந்த நிபந்தனை எக்ஸ்பிரஷனாகத் திருத்தப்படுகிறது" +"This file" = "இந்தக் கோப்பு" +"This file is on {server}, open only to you. Share it to let others in with a new code." = "இந்தக் கோப்பு {server} இல் உள்ளது, உங்களுக்கு மட்டுமே திறந்திருக்கும். புதிய குறியீட்டுடன் மற்றவர்களை அனுமதிக்க அதைப் பகிரவும்." +"This file is too large to join here (up to {mb} MB)" = "இங்கே சேர இந்தக் கோப்பு மிகப் பெரியது (அதிகபட்சம் {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." = "இந்தக் கணினியில் நிறுவப்படாத எழுத்துருக்களை இந்தக் கோப்பு பயன்படுத்துகிறது. அவற்றை நிறுவும் வரை உரை மாற்று எழுத்துருவில் வரையப்படும்." +"This file uses team libraries on servers you haven't used here. They aren't contacted until you check them." = "இங்கே நீங்கள் பயன்படுத்தாத சர்வர்களில் உள்ள டீம் லைப்ரரிகளை இந்தக் கோப்பு பயன்படுத்துகிறது. நீங்கள் சரிபார்க்கும் வரை அவை தொடர்புகொள்ளப்படாது." +"This frame is new on the branch." = "இந்த ஃப்ரேம் கிளையில் புதியது." +"This frame isn't on the branch." = "இந்த ஃப்ரேம் கிளையில் இல்லை." +"This link opens a website outside the prototype:" = "இந்த இணைப்பு ப்ரோட்டோடைப்புக்கு வெளியே ஒரு இணையதளத்தைத் திறக்கும்:" +"This link opens your mail app to write a message:" = "இந்த இணைப்பு செய்தி எழுத உங்கள் மின்னஞ்சல் ஆப்பைத் திறக்கும்:" +"This page keeps the owner token only while it is open. Copy it to manage the file later: it is a password for this file and won't be shown again." = "இந்தப் பக்கம் திறந்திருக்கும் வரை மட்டுமே உரிமையாளர் டோக்கனை வைத்திருக்கும். பின்னர் கோப்பை நிர்வகிக்க அதை நகலெடுக்கவும்: இது இந்தக் கோப்பின் கடவுச்சொல், மீண்டும் காட்டப்படாது." +"This server doesn't count detached instances" = "இந்த சர்வர் பிரிக்கப்பட்ட இன்ஸ்டன்ஸ்களைக் கணக்கிடாது" +"This server doesn't count insertions" = "இந்த சர்வர் செருகல்களைக் கணக்கிடாது" +"This server doesn't count styles and variables" = "இந்த சர்வர் ஸ்டைல்களையும் வேரியபிள்களையும் கணக்கிடாது" +"This server is open to the public: no key needed." = "இந்த சர்வர் பொதுமக்களுக்குத் திறந்துள்ளது: கீ தேவையில்லை." +"This server needs its key: add ?key=… to the address (`figcraft-server key` prints it on the server's machine)." = "இந்த சர்வருக்கு அதன் கீ தேவை: முகவரியில் ?key=… ஐச் சேர்க்கவும் (`figcraft-server key` சர்வரின் கணினியில் அதைக் காட்டும்)." +"This server takes files only with its key: see Advanced." = "இந்த சர்வர் அதன் கீ இருந்தால் மட்டுமே கோப்புகளை ஏற்கும்: மேம்பட்டவை பார்க்கவும்." +"This version can't be read." = "இந்தப் பதிப்பைப் படிக்க முடியாது." +"This version doesn't have it: all of it is new." = "இந்தப் பதிப்பில் இது இல்லை: முழுவதும் புதியது." +"Thumbs up" = "கட்டைவிரல் உயர்த்து" +"Tidy up" = "ஒழுங்குபடுத்து" +"Tile" = "டைல்" +"Tile type" = "டைல் வகை" +"Timer" = "டைமர்" +"Tint" = "சாயல்" +"Title" = "தலைப்பு" +"Title case" = "தலைப்பு எழுத்துவடிவம்" +"To share this library with your team, publish the file to a server (Share ▸ Publish to server…), then publish the library there." = "இந்த லைப்ரரியை உங்கள் டீமுடன் பகிர, கோப்பை ஒரு சர்வரில் வெளியிட்டு (பகிர் ▸ சர்வரில் வெளியிடு…), பின்னர் லைப்ரரியை அங்கே வெளியிடவும்." +"To the layer around it" = "சுற்றியுள்ள லேயருக்கு" +"Toggle" = "மாற்று" +"Toggle light/dark theme" = "ஒளிர்வான/இருண்ட தீமை மாற்று" +"Toggle visibility" = "தெரிவுநிலையை மாற்று" +"Tools" = "கருவிகள்" +"Top" = "மேல்" +"Top & bottom" = "மேலும் கீழும்" +"Top left radius" = "மேல் இடது ஆரம்" +"Top padding" = "மேல் பேடிங்" +"Top right radius" = "மேல் வலது ஆரம்" +"Transform" = "உருமாற்றம்" +"Trapezoid" = "சரிவகம்" +"Triangle" = "முக்கோணம்" +"Triangle arrow" = "முக்கோண அம்பு" +"Triangle down" = "கீழ்நோக்கு முக்கோணம்" +"Trigger" = "தூண்டல்" +"Trigger layer" = "தூண்டல் லேயர்" +"True" = "சரி" +"Truncate text" = "உரையைச் சுருக்கு" +"Truncate with an ellipsis" = "நீள்புள்ளியுடன் சுருக்கு" +"Try again" = "மீண்டும் முயல்" +"Try another search or filter." = "வேறு தேடல் அல்லது வடிகட்டியை முயலவும்." +"Try another search, or browse templates." = "வேறு தேடலை முயலவும், அல்லது டெம்ப்ளேட்களைப் பார்க்கவும்." +"Try another word, or look at every kind." = "வேறு சொல்லை முயலவும், அல்லது எல்லா வகைகளையும் பார்க்கவும்." +"Turn a layer into a component, reuse it, and change every copy at once" = "லேயரை காம்போனென்டாக மாற்றி, மீண்டும் பயன்படுத்தி, எல்லா நகல்களையும் ஒரே நேரத்தில் மாற்றவும்" +"Two digits" = "இரு இலக்கங்கள்" +"Type" = "வகை" +"Type settings" = "எழுத்து அமைப்புகள்" +"Type the join code you were given, or paste an invite link." = "உங்களுக்குக் கொடுத்த சேரும் குறியீட்டைத் தட்டச்சு செய்யவும், அல்லது அழைப்பு இணைப்பை ஒட்டவும்." +"Typography" = "எழுத்துக்கலை" +"Underline" = "அடிக்கோடு" +"Undo takes back only your own changes; what others changed since stays." = "செயல்தவிர் உங்கள் மாற்றங்களை மட்டுமே திரும்பப் பெறும்; இடையில் மற்றவர்கள் செய்தவை அப்படியே இருக்கும்." +"Ungroup" = "குழுவைப் பிரி" +"Uniform" = "சீரான" +"Union" = "ஒன்றிணை" +"Unions" = "இணைப்புகள்" +"Unknown — treated as sRGB" = "தெரியவில்லை — sRGB ஆகக் கருதப்படுகிறது" +"Unread" = "படிக்காதவை" +"Unresolve" = "தீர்வை நீக்கு" +"Unsaved changes" = "சேமிக்காத மாற்றங்கள்" +"Unsaved changes in {names}. Save them before closing?" = "{names} இல் சேமிக்காத மாற்றங்கள் உள்ளன. மூடும் முன் சேமிக்கவா?" +"Up" = "மேலே" +"Update" = "புதுப்பி" +"Update check is not supported in the web browser." = "இணைய உலாவியில் புதுப்பிப்புச் சரிபார்ப்பு ஆதரிக்கப்படவில்லை." +"Update from main" = "main இலிருந்து புதுப்பி" +"Update from selection" = "தேர்விலிருந்து புதுப்பி" +"Update plugin" = "ப்ளகினைப் புதுப்பி" +"Updated {components} and {styles}" = "{components}, {styles} புதுப்பிக்கப்பட்டன" +"Updated {name}" = "{name} புதுப்பிக்கப்பட்டது" +"Updating the graphics driver often helps. To use OpenGL only, start FigCraft from a Command Prompt with:" = "கிராஃபிக்ஸ் டிரைவரைப் புதுப்பிப்பது பெரும்பாலும் உதவும். OpenGL மட்டும் பயன்படுத்த, Command Prompt இலிருந்து FigCraft ஐ இவ்வாறு தொடங்கவும்:" +"Updating the graphics driver often helps. WGPU_BACKEND (vulkan, gl, metal) names another graphics API to try." = "கிராஃபிக்ஸ் டிரைவரைப் புதுப்பிப்பது பெரும்பாலும் உதவும். WGPU_BACKEND (vulkan, gl, metal) முயல வேண்டிய வேறொரு கிராஃபிக்ஸ் API ஐக் குறிப்பிடும்." +"Upload from computer" = "கணினியிலிருந்து பதிவேற்று" +"Uploads this file to a FigCraft server and keeps this tab in sync with it. You get a link to edit and a link to view." = "இந்தக் கோப்பை FigCraft சர்வரில் பதிவேற்றி, இந்தத் தாவலை அதனுடன் ஒத்திசைவில் வைக்கும். திருத்த ஒரு இணைப்பும் பார்க்க ஒரு இணைப்பும் கிடைக்கும்." +"Uppercase" = "பெரிய எழுத்து" +"Use a fixed value" = "நிலையான மதிப்பைப் பயன்படுத்து" +"Use an expression, e.g. count + 1" = "எக்ஸ்பிரஷனைப் பயன்படுத்து, எ.கா. count + 1" +"Use as mask" = "மாஸ்க்காகப் பயன்படுத்து" +"Use auto layout" = "ஆட்டோ லேஅவுட்டைப் பயன்படுத்து" +"Use fonts installed on this computer…" = "இந்தக் கணினியில் நிறுவிய எழுத்துருக்களைப் பயன்படுத்து…" +"Use number keys for opacity" = "ஒளிபுகாமைக்கு எண் விசைகளைப் பயன்படுத்து" +"Use the .figcraft or .fig extension." = ".figcraft அல்லது .fig நீட்டிப்பைப் பயன்படுத்தவும்." +"Use the layer's fill" = "லேயரின் ஃபில்லைப் பயன்படுத்து" +"Use your browser's zoom to change the interface size." = "இடைமுக அளவை மாற்ற உங்கள் உலாவியின் ஜூமைப் பயன்படுத்தவும்." +"Used in {files} · {instances}" = "{files} இல் பயன்படுகிறது · {instances}" +"Username" = "பயனர்பெயர்" +"Uses variables: each layer shows them in its own mode" = "வேரியபிள்களைப் பயன்படுத்துகிறது: ஒவ்வொரு லேயரும் தன் சொந்த மோடில் அவற்றைக் காட்டும்" +"Value" = "மதிப்பு" +"Variable" = "வேரியபிள்" +"Variable collections" = "வேரியபிள் தொகுப்புகள்" +"Variable modes" = "வேரியபிள் மோட்கள்" +"Variable width" = "மாறும் அகலம்" +"Variables" = "வேரியபிள்கள்" +"Variables JSON…" = "வேரியபிள்கள் JSON…" +"Variables store reusable values (colours, numbers, strings, booleans) with modes such as Light and Dark." = "வேரியபிள்கள் மீண்டும் பயன்படுத்தக்கூடிய மதிப்புகளை (நிறங்கள், எண்கள், சரங்கள், பூலியன்கள்) ஒளிர்வான, இருண்ட போன்ற மோட்களுடன் சேமிக்கும்." +"Variant" = "வேரியன்ட்" +"Vector" = "வெக்டர்" +"Vectors" = "வெக்டர்கள்" +"Version" = "பதிப்பு" +"Version history" = "பதிப்பு வரலாறு" +"Version {version}" = "பதிப்பு {version}" +"Version {v} · {components} · {styles} · {variables}" = "பதிப்பு {v} · {components} · {styles} · {variables}" +"Vertical" = "செங்குத்து" +"Vertical align" = "செங்குத்து சீரமைப்பு" +"Vertical hex" = "செங்குத்து அறுகோணம்" +"Vertical padding" = "செங்குத்து பேடிங்" +"Vertical spacing" = "செங்குத்து இடைவெளி" +"Vertical trim" = "செங்குத்து ட்ரிம்" +"View" = "பார்" +"View link" = "பார்வை இணைப்பு" +"View link copied" = "பார்வை இணைப்பு நகலெடுக்கப்பட்டது" +"View only" = "பார்வை மட்டும்" +"View only: you see every change as it happens but can't edit. Leave to keep a copy you can edit." = "பார்வை மட்டும்: ஒவ்வொரு மாற்றத்தையும் நடக்கும்போதே பார்க்கலாம், ஆனால் திருத்த முடியாது. திருத்தக்கூடிய நகலை வைத்திருக்க வெளியேறவும்." +"Viewing “{name}”" = "“{name}” ஐப் பார்க்கிறீர்கள்" +"Violet" = "ஊதா" +"Visibility" = "தெரிவுநிலை" +"Visible" = "தெரியும்" +"Vivid" = "அடர்" +"Votes per person" = "ஒருவருக்கான வாக்குகள்" +"Voting session" = "வாக்கெடுப்பு அமர்வு" +"WGPU_BACKEND is set and names the graphics API to use; unsetting it lets FigCraft choose." = "WGPU_BACKEND அமைக்கப்பட்டு, பயன்படுத்த வேண்டிய கிராஃபிக்ஸ் API ஐக் குறிப்பிடுகிறது; அதை நீக்கினால் FigCraft தானே தேர்ந்தெடுக்கும்." +"Warm" = "வெதுவெதுப்பு" +"Watch" = "கவனி" +"Wavy" = "அலை" +"Web" = "இணையம்" +"WebSocket URL" = "WebSocket URL" +"WebSocket URL copied" = "WebSocket URL நகலெடுக்கப்பட்டது" +"Websites" = "இணையதளங்கள்" +"Wedge" = "ஆப்பு" +"Weekly planner" = "வாராந்திரத் திட்டமிடல்" +"Weight" = "தடிமன்" +"What changed since a saved version" = "சேமித்த பதிப்பிலிருந்து என்ன மாறியது" +"What changed since it was marked ready for dev" = "டெவ்-க்குத் தயார் எனக் குறித்ததிலிருந்து என்ன மாறியது" +"What is wrong with this file? The server's operator gets your report." = "இந்தக் கோப்பில் என்ன தவறு? உங்கள் அறிக்கை சர்வர் இயக்குநருக்குச் செல்லும்." +"What it's for" = "இது எதற்காக" +"What this changed from isn't known: it changed before FigCraft kept a copy of ready-for-dev frames. Resolve the change (or mark it ready again) to compare from now on." = "இது எதிலிருந்து மாறியது எனத் தெரியவில்லை: டெவ்-க்குத் தயாரான ஃப்ரேம்களின் நகலை FigCraft வைக்கத் தொடங்கும் முன்பே இது மாறியது. இனிமேல் ஒப்பிட, மாற்றத்தைத் தீர்க்கவும் (அல்லது மீண்டும் தயார் எனக் குறிக்கவும்)." +"What you try here changes this preview and the code below, not the file" = "இங்கே முயல்வது இந்த முன்னோட்டத்தையும் கீழே உள்ள குறியீட்டையும் மாற்றும், கோப்பை அல்ல" +"When marked ready" = "தயார் எனக் குறித்தபோது" +"While hovering" = "ஹோவர் செய்யும்போது" +"While pressing" = "அழுத்தும்போது" +"White" = "வெள்ளை" +"Who runs it, its terms and how long it keeps files" = "யார் இயக்குகிறார்கள், விதிமுறைகள், கோப்புகளை எவ்வளவு காலம் வைத்திருக்கும்" +"Whole screen" = "முழுத் திரை" +"Why it changed" = "இது ஏன் மாறியது" +"Widget" = "விட்ஜெட்" +"Widgets" = "விட்ஜெட்கள்" +"Width" = "அகலம்" +"Width point" = "அகலப் புள்ளி" +"Width profile" = "அகல சுயவிவரம்" +"Wireframe kit" = "வயர்ஃப்ரேம் கிட்" +"With the layers' export settings" = "லேயர்களின் ஏற்றுமதி அமைப்புகளுடன்" +"Wrap" = "மடி" +"Wrap in new section" = "புதிய செக்ஷனில் வை" +"Wrap style" = "மடிப்பு ஸ்டைல்" +"Yellow" = "மஞ்சள்" +"Yesterday" = "நேற்று" +"You" = "நீங்கள்" +"You'll get the shared file as a new tab and edit it together." = "பகிரப்பட்ட கோப்பு புதிய தாவலாகக் கிடைக்கும், சேர்ந்து திருத்தலாம்." +"You're spotlighting: everyone follows your view" = "நீங்கள் ஸ்பாட்லைட் செய்கிறீர்கள்: அனைவரும் உங்கள் பார்வையைப் பின்தொடர்கிறார்கள்" +"Your copy of the file stays open" = "உங்கள் கோப்பு நகல் திறந்தே இருக்கும்" +"Your copy stays open; the file stays on the server" = "உங்கள் நகல் திறந்தே இருக்கும்; கோப்பு சர்வரில் இருக்கும்" +"Your name" = "உங்கள் பெயர்" +"Your system asks for reduced motion: animations stay off." = "உங்கள் சிஸ்டம் குறைந்த அசைவைக் கேட்கிறது: அனிமேஷன்கள் முடக்கத்தில் இருக்கும்." +"Your unsaved files were too large for the browser to keep." = "சேமிக்காத உங்கள் கோப்புகள் உலாவி வைத்திருக்க முடியாத அளவுக்குப் பெரியவை." +"Z" = "Z" +"Z to A" = "Z முதல் A வரை" +"Zoom" = "ஜூம்" +"Zoom around the pointer" = "பாயிண்டரைச் சுற்றி ஜூம் செய்" +"Zoom device to fill window" = "சாளரத்தை நிரப்ப சாதனத்தை ஜூம் செய்" +"Zoom in" = "பெரிதாக்கு" +"Zoom out" = "சிறிதாக்கு" +"Zoom to 100%" = "100% க்கு ஜூம் செய்" +"Zoom to 200%" = "200% க்கு ஜூம் செய்" +"Zoom to 50%" = "50% க்கு ஜூம் செய்" +"Zoom to fit" = "பொருந்தும்படி ஜூம் செய்" +"Zoom to selection" = "தேர்வுக்கு ஜூம் செய்" +"Zoom tool: click to zoom in, drag an area" = "ஜூம் கருவி: பெரிதாக்கக் கிளிக் செய்யவும், ஒரு பகுதியை இழுக்கவும்" +"Zoom tool: zoom out" = "ஜூம் கருவி: சிறிதாக்கு" +"and {n} more" = { one = "மேலும் {n}", other = "மேலும் {n}" } +"bleed marks" = "ப்ளீட் குறிகள்" +"by {author}" = "{author} உருவாக்கியது" +"call any command its access allows" = "அணுகல் அனுமதிக்கும் எந்தக் கட்டளையையும் அழைக்கலாம்" +"call only: {commands}" = "இவற்றை மட்டும் அழைக்கலாம்: {commands}" +"can edit the document" = "ஆவணத்தைத் திருத்தலாம்" +"can save files" = "கோப்புகளைச் சேமிக்கலாம்" +"conditional prototype actions nested too deeply were skipped" = "மிக ஆழமாக உள்ளமைந்த நிபந்தனை ப்ரோட்டோடைப் செயல்கள் தவிர்க்கப்பட்டன" +"conditional prototype actions with conditions that can't be evaluated were skipped" = "மதிப்பிட முடியாத நிபந்தனைகளுடன் உள்ள நிபந்தனை ப்ரோட்டோடைப் செயல்கள் தவிர்க்கப்பட்டன" +"connector label background was skipped: style data is missing" = "கனெக்டர் லேபிள் பின்னணி தவிர்க்கப்பட்டது: ஸ்டைல் தரவு இல்லை" +"connector label was skipped: background bounds are invalid" = "கனெக்டர் லேபிள் தவிர்க்கப்பட்டது: பின்னணி எல்லைகள் தவறானவை" +"connector label was skipped: background transform is invalid" = "கனெக்டர் லேபிள் தவிர்க்கப்பட்டது: பின்னணி உருமாற்றம் தவறானது" +"connector label was skipped: composed text transform is invalid" = "கனெக்டர் லேபிள் தவிர்க்கப்பட்டது: இணைந்த உரை உருமாற்றம் தவறானது" +"connector label was skipped: derived background bounds are missing" = "கனெக்டர் லேபிள் தவிர்க்கப்பட்டது: பெறப்பட்ட பின்னணி எல்லைகள் இல்லை" +"connector label was skipped: derived text bounds are missing" = "கனெக்டர் லேபிள் தவிர்க்கப்பட்டது: பெறப்பட்ட உரை எல்லைகள் இல்லை" +"connector label was skipped: text bounds are invalid" = "கனெக்டர் லேபிள் தவிர்க்கப்பட்டது: உரை எல்லைகள் தவறானவை" +"connector label was skipped: text style data is missing" = "கனெக்டர் லேபிள் தவிர்க்கப்பட்டது: உரை ஸ்டைல் தரவு இல்லை" +"connector label was skipped: text transform is invalid" = "கனெக்டர் லேபிள் தவிர்க்கப்பட்டது: உரை உருமாற்றம் தவறானது" +"connector labels were skipped" = "கனெக்டர் லேபிள்கள் தவிர்க்கப்பட்டன" +"connector labels without a saved snapshot are centred on the line, without their background" = "சேமித்த ஸ்னாப்ஷாட் இல்லாத கனெக்டர் லேபிள்கள் பின்னணி இல்லாமல் கோட்டின் மையத்தில் வைக்கப்படும்" +"connector layers import as static frame/vector snapshots with labels when present; live endpoint bindings are not retained" = "கனெக்டர் லேயர்கள் நிலையான ஃப்ரேம்/வெக்டர் ஸ்னாப்ஷாட்களாக, லேபிள்கள் இருந்தால் அவற்றுடன், இறக்குமதியாகும்; நேரடி முனை இணைப்புகள் தக்கவைக்கப்படாது" +"connector snapshot vector data is missing; connector was left empty" = "கனெக்டர் ஸ்னாப்ஷாட் வெக்டர் தரவு இல்லை; கனெக்டர் காலியாக விடப்பட்டது" +"connectors whose ends can't be placed are empty" = "முனைகளை வைக்க முடியாத கனெக்டர்கள் காலியாக இருக்கும்" +"crop marks" = "வெட்டுக் குறிகள்" +"damaged vector geometry was skipped" = "சேதமடைந்த வெக்டர் வடிவியல் தவிர்க்கப்பட்டது" +"damaged vector networks import as outlines" = "சேதமடைந்த வெக்டர் நெட்வொர்க்குகள் அவுட்லைன்களாக இறக்குமதியாகும்" +"development: {path}" = "டெவலப்மென்ட்: {path}" +"document children other than pages were skipped" = "பக்கங்கள் அல்லாத ஆவணச் சைல்ட் உறுப்புகள் தவிர்க்கப்பட்டன" +"duplicate grid track sizing entries use equal tracks" = "நகல் கட்ட டிராக் அளவு உள்ளீடுகள் சம டிராக்குகளைப் பயன்படுத்தும்" +"e.g. count + 1" = "எ.கா. count + 1" +"e.g. count >= 3 and not done" = "எ.கா. count >= 3 and not done" +"elbowed and curved connectors without a saved path follow FigCraft's own routing" = "சேமித்த பாதை இல்லாத வளைந்த மற்றும் மடிந்த கனெக்டர்கள் FigCraft-இன் சொந்த வழித்தடத்தைப் பின்பற்றும்" +"entries without a node type were skipped" = "நோட் வகை இல்லாத உள்ளீடுகள் தவிர்க்கப்பட்டன" +"figcraft:// links from a browser, chat or email open this app and join the session." = "உலாவி, அரட்டை அல்லது மின்னஞ்சலில் உள்ள figcraft:// இணைப்புகள் இந்த ஆப்ஸைத் திறந்து அமர்வில் சேர்க்கும்." +"from {server}" = "{server} இலிருந்து" +"gamepad triggers without exactly one known controller button were skipped" = "சரியாக ஒரு அறியப்பட்ட கன்ட்ரோலர் பொத்தான் இல்லாத கேம்பேட் ட்ரிகர்கள் தவிர்க்கப்பட்டன" +"grid track list exceeds 1000 entries; the tracks use the default equal sizing" = "கட்டத் தடப் பட்டியல் 1000 உள்ளீடுகளைத் தாண்டுகிறது; தடங்கள் இயல்புநிலை சம அளவைப் பயன்படுத்துகின்றன" +"grid track sizing is unsupported or malformed; affected tracks use equal sizing" = "கட்டத் தட அளவு ஆதரிக்கப்படவில்லை அல்லது தவறாக உள்ளது; பாதிக்கப்பட்ட தடங்கள் சம அளவைப் பயன்படுத்துகின்றன" +"grid track sizing list exceeds 1000 entries; the tracks use the default equal sizing" = "கட்டத் தட அளவுப் பட்டியல் 1000 உள்ளீடுகளைத் தாண்டுகிறது; தடங்கள் இயல்புநிலை சம அளவைப் பயன்படுத்துகின்றன" +"hidden" = "மறைக்கப்பட்டது" +"iOS" = "iOS" +"image fills whose image isn't in the file show a missing-image placeholder and keep its name" = "கோப்பில் இல்லாத படங்களைக் கொண்ட பட ஃபில்கள், விடுபட்ட-படக் குறியிடத்தைக் காட்டி அதன் பெயரை வைத்திருக்கும்" +"image filters are ambiguous because both filter containers are present; filter conversion was skipped" = "இரண்டு ஃபில்டர் கொள்கலன்களும் இருப்பதால் பட ஃபில்டர்கள் தெளிவற்றவை; ஃபில்டர் மாற்றம் தவிர்க்கப்பட்டது" +"image filters use FigCraft's approximate renderer" = "பட ஃபில்டர்கள் FigCraft-இன் தோராயமான ரெண்டரரைப் பயன்படுத்துகின்றன" +"instance swap properties whose default component isn't in the file were skipped" = "இயல்புநிலை காம்போனென்ட் கோப்பில் இல்லாத இன்ஸ்டன்ஸ் மாற்றுப் பண்புகள் தவிர்க்கப்பட்டன" +"instance swap properties whose default component was past the layer limit were skipped" = "இயல்புநிலை காம்போனென்ட் லேயர் வரம்பைத் தாண்டிய இன்ஸ்டன்ஸ் மாற்றுப் பண்புகள் தவிர்க்கப்பட்டன" +"instances inside their own main component were imported as frames" = "தங்கள் சொந்த முதன்மை காம்போனென்ட்டுக்குள் உள்ள இன்ஸ்டன்ஸ்கள் ஃப்ரேம்களாக இறக்குமதி செய்யப்பட்டன" +"instances of components that aren't in the file show no layers" = "கோப்பில் இல்லாத காம்போனென்ட்களின் இன்ஸ்டன்ஸ்கள் எந்த லேயரையும் காட்டாது" +"instances of components that aren't in the file were imported as frames" = "கோப்பில் இல்லாத காம்போனென்ட்களின் இன்ஸ்டன்ஸ்கள் ஃப்ரேம்களாக இறக்குமதி செய்யப்பட்டன" +"instances that would nest a component inside itself were imported as frames" = "ஒரு காம்போனென்ட்டை அதற்குள்ளேயே அடுக்கும் இன்ஸ்டன்ஸ்கள் ஃப்ரேம்களாக இறக்குமதி செய்யப்பட்டன" +"instances whose component was past the layer limit were imported as frames" = "காம்போனென்ட் லேயர் வரம்பைத் தாண்டிய இன்ஸ்டன்ஸ்கள் ஃப்ரேம்களாக இறக்குமதி செய்யப்பட்டன" +"instances without a main component were imported as empty frames" = "முதன்மை காம்போனென்ட் இல்லாத இன்ஸ்டன்ஸ்கள் வெற்று ஃப்ரேம்களாக இறக்குமதி செய்யப்பட்டன" +"invalid internal .fig text path data was ignored" = "தவறான உள் .fig உரைப் பாதைத் தரவு புறக்கணிக்கப்பட்டது" +"invalid or oversized vector networks import as outlines" = "தவறான அல்லது மிகப் பெரிய வெக்டர் நெட்வொர்க்குகள் அவுட்லைன்களாக இறக்குமதியாகும்" +"invalid or oversized vector path data was skipped" = "தவறான அல்லது மிகப் பெரிய வெக்டர் பாதைத் தரவு தவிர்க்கப்பட்டது" +"invalid vector region fill paint list; layer fill used" = "தவறான வெக்டர் பகுதி ஃபில் பெயிண்ட் பட்டியல்; லேயர் ஃபில் பயன்படுத்தப்பட்டது" +"invalid vector region paints were skipped" = "தவறான வெக்டர் பகுதி பெயிண்ட்கள் தவிர்க்கப்பட்டன" +"just now" = "இப்போதுதான்" +"key triggers without a supported key were skipped" = "ஆதரிக்கப்படும் விசை இல்லாத விசை ட்ரிகர்கள் தவிர்க்கப்பட்டன" +"key up triggers import as key presses" = "விசை விடுவிப்பு ட்ரிகர்கள் விசை அழுத்தங்களாக இறக்குமதியாகும்" +"layers without a position were placed at their parent's origin" = "நிலை இல்லாத லேயர்கள் அவற்றின் பேரன்ட் லேயரின் தொடக்கப் புள்ளியில் வைக்கப்பட்டன" +"layers without a type were skipped" = "வகை இல்லாத லேயர்கள் தவிர்க்கப்பட்டன" +"legacy image filter container is unsupported; filter conversion was skipped" = "பழைய பட ஃபில்டர் கொள்கலன் ஆதரிக்கப்படவில்லை; ஃபில்டர் மாற்றம் தவிர்க்கப்பட்டது" +"linked vector region fill styles keep resolved appearance; live style links were left out" = "இணைக்கப்பட்ட வெக்டர் பகுதி ஃபில் ஸ்டைல்கள் தீர்க்கப்பட்ட தோற்றத்தை வைத்திருக்கும்; நேரலை ஸ்டைல் இணைப்புகள் விடுபட்டன" +"links to shared styles that aren't in the file kept the layers' own values" = "கோப்பில் இல்லாத பகிர்ந்த ஸ்டைல்களுக்கான இணைப்புகள், லேயர்களின் சொந்த மதிப்புகளை வைத்திருந்தன" +"locked" = "பூட்டப்பட்டது" +"malformed image filters container was skipped" = "தவறான வடிவிலான பட ஃபில்டர் கொள்கலன் தவிர்க்கப்பட்டது" +"malformed image paintFilter container was skipped" = "தவறான வடிவிலான பட paintFilter கொள்கலன் தவிர்க்கப்பட்டது" +"malformed slot content assignment was skipped" = "தவறான வடிவிலான ஸ்லாட் உள்ளடக்க ஒதுக்கீடு தவிர்க்கப்பட்டது" +"no bleed" = "ப்ளீட் இல்லை" +"nobody else here yet" = "இங்கே இன்னும் வேறு யாரும் இல்லை" +"non-default slot settings are not represented and were skipped" = "இயல்புநிலை அல்லாத ஸ்லாட் அமைப்புகள் குறிப்பிடப்படவில்லை, அவை தவிர்க்கப்பட்டன" +"note or shape generated child has invalid bounds; child skipped" = "குறிப்பு அல்லது வடிவம் உருவாக்கிய துணை உறுப்பின் எல்லைகள் தவறானவை; துணை உறுப்பு தவிர்க்கப்பட்டது" +"note or shape generated child is missing its style or bounds; child skipped" = "குறிப்பு அல்லது வடிவம் உருவாக்கிய துணை உறுப்பில் ஸ்டைல் அல்லது எல்லைகள் இல்லை; துணை உறுப்பு தவிர்க்கப்பட்டது" +"note or shape generated children exceed the layer or nesting limit; remaining children skipped" = "குறிப்பு அல்லது வடிவம் உருவாக்கிய துணை உறுப்புகள் லேயர் அல்லது அடுக்கு வரம்பைத் தாண்டுகின்றன; மீதமுள்ளவை தவிர்க்கப்பட்டன" +"note or shape generated layout is missing or unsupported; using its outer frame" = "குறிப்பு அல்லது வடிவம் உருவாக்கிய லேஅவுட் இல்லை அல்லது ஆதரிக்கப்படவில்லை; வெளிப்புற ஃப்ரேம் பயன்படுத்தப்படுகிறது" +"now" = "இப்போது" +"offer files to save if it asks to (you choose where each one goes)" = "அது கேட்டால் சேமிக்கக் கோப்புகளை வழங்கும் (ஒவ்வொன்றும் எங்கே செல்லும் என்பதை நீங்கள் தேர்வுசெய்யலாம்)" +"only in a text style or variable" = "உரை ஸ்டைல் அல்லது வேரியபிளில் மட்டும்" +"or" = "அல்லது" +"point stroke joins were preserved; dashed or variable-width strokes render with the layer join" = "புள்ளி ஸ்ட்ரோக் இணைப்புகள் தக்கவைக்கப்பட்டன; கோடிட்ட அல்லது மாறும்-அகல ஸ்ட்ரோக்குகள் லேயர் இணைப்புடன் ரெண்டர் ஆகும்" +"preferred slot component keys cannot be resolved to file nodes and were skipped" = "விருப்ப ஸ்லாட் காம்போனென்ட் விசைகளைக் கோப்பு நோட்களுடன் பொருத்த முடியவில்லை, அவை தவிர்க்கப்பட்டன" +"prototype actions of unknown types were skipped" = "அறியப்படாத வகை ப்ரோட்டோடைப் செயல்கள் தவிர்க்கப்பட்டன" +"prototype actions without a destination in the file were skipped" = "கோப்பில் இலக்கு இல்லாத ப்ரோட்டோடைப் செயல்கள் தவிர்க்கப்பட்டன" +"prototype expressions on variables that aren't in the variables JSON were skipped" = "variables JSON-இல் இல்லாத வேரியபிள்கள் மீதான ப்ரோட்டோடைப் எக்ஸ்பிரஷன்கள் தவிர்க்கப்பட்டன" +"prototype expressions with unsupported functions were skipped" = "ஆதரிக்கப்படாத செயல்பாடுகளைக் கொண்ட ப்ரோட்டோடைப் எக்ஸ்பிரஷன்கள் தவிர்க்கப்பட்டன" +"prototype interactions without supported actions were skipped" = "ஆதரிக்கப்படும் செயல்கள் இல்லாத ப்ரோட்டோடைப் இன்டராக்ஷன்கள் தவிர்க்கப்பட்டன" +"prototype navigations of unknown types were skipped" = "அறியப்படாத வகை ப்ரோட்டோடைப் வழிசெலுத்தல்கள் தவிர்க்கப்பட்டன" +"prototype transitions of unknown types play instantly" = "அறியப்படாத வகை ப்ரோட்டோடைப் மாற்றங்கள் உடனடியாக இயங்கும்" +"prototype triggers of unknown types were skipped" = "அறியப்படாத வகை ப்ரோட்டோடைப் ட்ரிகர்கள் தவிர்க்கப்பட்டன" +"put a widget on the canvas" = "கேன்வாஸில் ஒரு விட்ஜெட்டை வைக்கும்" +"read and edit the document" = "ஆவணத்தைப் படித்துத் திருத்தும்" +"read the document" = "ஆவணத்தைப் படிக்கும்" +"reads the document" = "ஆவணத்தைப் படிக்கிறது" +"set-variable actions on variables that aren't in the variables JSON were skipped" = "variables JSON-இல் இல்லாத வேரியபிள்கள் மீதான வேரியபிள்-அமை செயல்கள் தவிர்க்கப்பட்டன" +"set-variable actions with values that can't be evaluated were skipped" = "மதிப்பிட முடியாத மதிப்புகளைக் கொண்ட வேரியபிள்-அமை செயல்கள் தவிர்க்கப்பட்டன" +"set-variable actions with values that don't fit the variable were skipped" = "வேரியபிளுக்குப் பொருந்தாத மதிப்புகளைக் கொண்ட வேரியபிள்-அமை செயல்கள் தவிர்க்கப்பட்டன" +"set-variable actions without a value were skipped" = "மதிப்பு இல்லாத வேரியபிள்-அமை செயல்கள் தவிர்க்கப்பட்டன" +"set-variable-mode actions on collections or modes that aren't in the variables JSON were skipped" = "variables JSON-இல் இல்லாத தொகுப்புகள் அல்லது மோட்கள் மீதான வேரியபிள்-மோட்-அமை செயல்கள் தவிர்க்கப்பட்டன" +"shape generated outline is missing or damaged; using its rectangle" = "வடிவம் உருவாக்கிய அவுட்லைன் இல்லை அல்லது சேதமடைந்துள்ளது; அதன் செவ்வகம் பயன்படுத்தப்படுகிறது" +"slot content assignment target is missing or is not slot content" = "ஸ்லாட் உள்ளடக்க ஒதுக்கீட்டு இலக்கு இல்லை அல்லது அது ஸ்லாட் உள்ளடக்கம் அல்ல" +"slot content assignment uses the empty GUID sentinel and was skipped" = "ஸ்லாட் உள்ளடக்க ஒதுக்கீடு வெற்று GUID குறியைப் பயன்படுத்துவதால் தவிர்க்கப்பட்டது" +"slot layers without a matching slot property were imported as frames" = "பொருந்தும் ஸ்லாட் பண்பு இல்லாத ஸ்லாட் லேயர்கள் ஃப்ரேம்களாக இறக்குமதி செய்யப்பட்டன" +"some vector points refer to point settings missing from the file; they use the layer's joins and plain corners" = "சில வெக்டர் புள்ளிகள் கோப்பில் இல்லாத புள்ளி அமைப்புகளைக் குறிக்கின்றன; அவை லேயரின் இணைப்புகளையும் சாதாரண மூலைகளையும் பயன்படுத்துகின்றன" +"some vector segments refer to style settings missing from the file; they use the layer's stroke" = "சில வெக்டர் பிரிவுகள் கோப்பில் இல்லாத ஸ்டைல் அமைப்புகளைக் குறிக்கின்றன; அவை லேயரின் ஸ்ட்ரோக்கைப் பயன்படுத்துகின்றன" +"stale or invalid grid track sizing entries were ignored" = "பழைய அல்லது தவறான கட்டத் தட அளவு உள்ளீடுகள் புறக்கணிக்கப்பட்டன" +"stars and polygons without point counts or geometry use the default point count" = "புள்ளி எண்ணிக்கை அல்லது வடிவியல் இல்லாத நட்சத்திரங்களும் பலகோணங்களும் இயல்புநிலை புள்ளி எண்ணிக்கையைப் பயன்படுத்துகின்றன" +"style settings of some vector segments aren't supported; those segments use the layer's stroke" = "சில வெக்டர் பிரிவுகளின் ஸ்டைல் அமைப்புகள் ஆதரிக்கப்படவில்லை; அந்தப் பிரிவுகள் லேயரின் ஸ்ட்ரோக்கைப் பயன்படுத்துகின்றன" +"text path underline or strikethrough decoration is not rendered" = "உரைப் பாதையின் அடிக்கோடு அல்லது குறுக்குக்கோடு அலங்காரம் ரெண்டர் செய்யப்படவில்லை" +"text style overrides refer to missing table entries" = "உரை ஸ்டைல் ஓவர்ரைடுகள் இல்லாத அட்டவணை உள்ளீடுகளைக் குறிக்கின்றன" +"the file has no pages" = "கோப்பில் பக்கங்கள் இல்லை" +"the plugin" = "ப்ளகின்" +"the variables JSON has no `variableCollections` (expected the local variables response) and was ignored" = "variables JSON-இல் `variableCollections` இல்லை (லோக்கல் வேரியபிள்கள் பதில் எதிர்பார்க்கப்பட்டது), எனவே புறக்கணிக்கப்பட்டது" +"this session only" = "இந்த அமர்வுக்கு மட்டும்" +"unknown component property types were skipped" = "அறியப்படாத காம்போனென்ட் பண்பு வகைகள் தவிர்க்கப்பட்டன" +"variable aliases to variables that aren't in the variables JSON (or of another type) were skipped" = "variables JSON-இல் இல்லாத (அல்லது வேறு வகையான) வேரியபிள்களுக்கான வேரியபிள் மாற்றுப்பெயர்கள் தவிர்க்கப்பட்டன" +"variable bindings to properties the layer doesn't have were skipped" = "லேயரில் இல்லாத பண்புகளுக்கான வேரியபிள் இணைப்புகள் தவிர்க்கப்பட்டன" +"variable bindings to variables that aren't in the variables JSON (library variables) were skipped" = "variables JSON-இல் இல்லாத வேரியபிள்களுக்கான (லைப்ரரி வேரியபிள்கள்) வேரியபிள் இணைப்புகள் தவிர்க்கப்பட்டன" +"variable bindings were skipped: the file JSON has no variable definitions (pass the local variables JSON as `variables`, or embed its `meta` next to the file JSON)" = "வேரியபிள் இணைப்புகள் தவிர்க்கப்பட்டன: கோப்பு JSON-இல் வேரியபிள் வரையறைகள் இல்லை (லோக்கல் variables JSON-ஐ `variables` ஆக வழங்கவும், அல்லது அதன் `meta`-வைக் கோப்பு JSON-உடன் சேர்க்கவும்)" +"variable bindings whose variable type doesn't fit the property were skipped" = "வேரியபிள் வகை பண்புக்குப் பொருந்தாத வேரியபிள் இணைப்புகள் தவிர்க்கப்பட்டன" +"variable collections without modes were skipped" = "மோட்கள் இல்லாத வேரியபிள் தொகுப்புகள் தவிர்க்கப்பட்டன" +"variable mode lookups in prototype expressions that aren't a variable and one of its modes were skipped" = "ப்ரோட்டோடைப் எக்ஸ்பிரஷன்களில் ஒரு வேரியபிளும் அதன் ஒரு மோடும் அல்லாத வேரியபிள் மோட் தேடல்கள் தவிர்க்கப்பட்டன" +"variable modes of collections that aren't in the file were skipped" = "கோப்பில் இல்லாத தொகுப்புகளின் வேரியபிள் மோட்கள் தவிர்க்கப்பட்டன" +"variable modes of collections that aren't in the variables JSON were skipped" = "variables JSON-இல் இல்லாத தொகுப்புகளின் வேரியபிள் மோட்கள் தவிர்க்கப்பட்டன" +"variable values that don't match their type (or composed colours) were skipped" = "வகைக்குப் பொருந்தாத வேரியபிள் மதிப்புகள் (அல்லது கலப்பு நிறங்கள்) தவிர்க்கப்பட்டன" +"variable-bound vector region paints keep resolved appearance; live bindings were left out" = "வேரியபிள் இணைந்த வெக்டர் பகுதி பெயிண்ட்கள் தீர்க்கப்பட்ட தோற்றத்தை வைத்திருக்கும்; நேரலை இணைப்புகள் விடுபட்டன" +"variables of unknown types were skipped" = "அறியப்படாத வகை வேரியபிள்கள் தவிர்க்கப்பட்டன" +"variables whose collection isn't in the variables JSON were skipped" = "தொகுப்பு variables JSON-இல் இல்லாத வேரியபிள்கள் தவிர்க்கப்பட்டன" +"variables without readable values were skipped" = "படிக்கக்கூடிய மதிப்புகள் இல்லாத வேரியபிள்கள் தவிர்க்கப்பட்டன" +"vector points with unknown stroke joins use the layer join" = "அறியப்படாத ஸ்ட்ரோக் இணைப்புகள் கொண்ட வெக்டர் புள்ளிகள் லேயர் இணைப்பைப் பயன்படுத்துகின்றன" +"vector region paint data exceeded import limits and was skipped" = "வெக்டர் பகுதி பெயிண்ட் தரவு இறக்குமதி வரம்புகளைத் தாண்டியதால் தவிர்க்கப்பட்டது" +"vector region references a missing fill style; layer fill used" = "வெக்டர் பகுதி இல்லாத ஃபில் ஸ்டைலைக் குறிக்கிறது; லேயர் ஃபில் பயன்படுத்தப்பட்டது" +"vectors without geometry are empty" = "வடிவியல் இல்லாத வெக்டர்கள் காலியாக உள்ளன" +"vectors without geometry are empty (export the file JSON with geometry=paths)" = "வடிவியல் இல்லாத வெக்டர்கள் காலியாக உள்ளன (கோப்பு JSON-ஐ geometry=paths உடன் ஏற்றுமதி செய்யவும்)" +"very long text was cut to 1,048,576 characters" = "மிக நீண்ட உரை 1,048,576 எழுத்துகளாகக் குறைக்கப்பட்டது" +"very long vector paths were skipped" = "மிக நீண்ட வெக்டர் பாதைகள் தவிர்க்கப்பட்டன" +"video actions are not supported and were skipped" = "வீடியோ செயல்கள் ஆதரிக்கப்படாததால் தவிர்க்கப்பட்டன" +"video triggers are not supported and were skipped" = "வீடியோ ட்ரிகர்கள் ஆதரிக்கப்படாததால் தவிர்க்கப்பட்டன" +"yesterday" = "நேற்று" +"{count} in it now · Changed {date}" = "இப்போது இதில் {count} · {date} அன்று மாற்றப்பட்டது" +"{insertions} · {detachments}" = "{insertions} · {detachments}" +"{instances} in {files}" = "{files} இல் {instances}" +"{language}: draft translation, waiting for a native speaker's review." = "{language}: வரைவு மொழிபெயர்ப்பு, தாய்மொழியாளர் மதிப்பாய்வுக்குக் காத்திருக்கிறது." +"{length} bleed" = "{length} ப்ளீட்" +"{month} {day}, {year}" = "{month} {day}, {year}" +"{name}\nClick to apply to the selection" = "{name}\nதேர்வுக்குப் பயன்படுத்தக் கிளிக் செய்யவும்" +"{name}\nDrag onto the canvas, or click to place in the middle of the view.\nHold Alt (Option) while dropping onto an instance to swap it." = "{name}\nகேன்வாஸுக்கு இழுக்கவும், அல்லது காட்சியின் நடுவில் வைக்கக் கிளிக் செய்யவும்.\nஒரு இன்ஸ்டன்ஸை மாற்ற, அதன் மீது விடும்போது Alt (Option) ஐ அழுத்திப் பிடிக்கவும்." +"{name} (from {library})" = "{name} ({library} இலிருந்து)" +"{name} (you)" = "{name} (நீங்கள்)" +"{name} ({layers} layers)" = "{name} ({layers} லேயர்கள்)" +"{name} ({tag}): {min} – {max}, default {default}. Double-click the slider to go back to the style's value; Escape while dragging cancels." = "{name} ({tag}): {min} – {max}, இயல்புநிலை {default}. ஸ்டைலின் மதிப்புக்குத் திரும்ப ஸ்லைடரை இருமுறை கிளிக் செய்யவும்; இழுக்கும்போது Escape அழுத்தினால் ரத்தாகும்." +"{name} cleared from the list" = "{name} பட்டியலிலிருந்து நீக்கப்பட்டது" +"{name} from {path}" = "{path} இலிருந்து {name}" +"{name} is forgotten on this computer; the file stays on {server}" = "{name} இந்தக் கணினியில் மறக்கப்பட்டது; கோப்பு {server} இல் இருக்கும்" +"{name} is on the server." = "{name} சர்வரில் உள்ளது." +"{name} is spotlighting" = "{name} ஸ்பாட்லைட் செய்கிறார்" +"{name} is too large to open in the browser (over 512 MB)." = "{name} உலாவியில் திறக்க மிகப் பெரியது (512 MB-க்கு மேல்)." +"{name} was removed from the server" = "{name} சர்வரிலிருந்து அகற்றப்பட்டது" +"{name} · deleted on main" = "{name} · main இல் நீக்கப்பட்டது" +"{name} · deleted on the branch" = "{name} · கிளையில் நீக்கப்பட்டது" +"{name} · not published" = "{name} · வெளியிடப்படவில்லை" +"{name} · on a server" = "{name} · சர்வரில்" +"{name} · published version {v}" = "{name} · வெளியிட்ட பதிப்பு {v}" +"{name} · version {v} on the server" = "{name} · சர்வரில் பதிப்பு {v}" +"{name} ×{n}" = "{name} ×{n}" +"{name}, disconnected from its live session" = "{name}, அதன் நேரலை அமர்விலிருந்து துண்டிக்கப்பட்டது" +"{name}, in a live session" = "{name}, நேரலை அமர்வில்" +"{name}, online, open only to you" = "{name}, ஆன்லைனில், உங்களுக்கு மட்டும் திறந்துள்ளது" +"{name}, {kind}, {w} by {h}, selected" = "{name}, {kind}, {w} × {h}, தேர்ந்தெடுக்கப்பட்டது" +"{n} added" = { one = "{n} சேர்க்கப்பட்டது", other = "{n} சேர்க்கப்பட்டன" } +"{n} autosave versions" = { one = "{n} தானியங்கு சேமிப்புப் பதிப்பு", other = "{n} தானியங்கு சேமிப்புப் பதிப்புகள்" } +"{n} changed" = { one = "{n} மாற்றப்பட்டது", other = "{n} மாற்றப்பட்டன" } +"{n} columns" = { one = "{n} நெடுவரிசை", other = "{n} நெடுவரிசைகள்" } +"{n} components" = { one = "{n} காம்போனென்ட்", other = "{n} காம்போனென்ட்கள்" } +"{n} components and styles have newer versions" = { one = "{n} காம்போனென்ட் அல்லது ஸ்டைலுக்குப் புதிய பதிப்பு உள்ளது", other = "{n} காம்போனென்ட்கள் மற்றும் ஸ்டைல்களுக்குப் புதிய பதிப்புகள் உள்ளன" } +"{n} conflicts to resolve" = { one = "தீர்க்க வேண்டிய {n} முரண்பாடு", other = "தீர்க்க வேண்டிய {n} முரண்பாடுகள்" } +"{n} days ago" = { one = "{n} நாள் முன்பு", other = "{n} நாட்கள் முன்பு" } +"{n} detached" = { one = "{n} பிரிக்கப்பட்டது", other = "{n} பிரிக்கப்பட்டன" } +"{n} files" = { one = "{n} கோப்பு", other = "{n} கோப்புகள்" } +"{n} hours ago" = { one = "{n} மணிநேரத்திற்கு முன்பு", other = "{n} மணிநேரத்திற்கு முன்பு" } +"{n} inserted" = { one = "{n} செருகப்பட்டது", other = "{n} செருகப்பட்டன" } +"{n} instances" = { one = "{n} இன்ஸ்டன்ஸ்", other = "{n} இன்ஸ்டன்ஸ்கள்" } +"{n} layers" = { one = "{n} லேயர்", other = "{n} லேயர்கள்" } +"{n} layers as one file" = { one = "ஒரே கோப்பாக {n} லேயர்", other = "ஒரே கோப்பாக {n} லேயர்கள்" } +"{n} layers selected" = { one = "{n} லேயர் தேர்ந்தெடுக்கப்பட்டது", other = "{n} லேயர்கள் தேர்ந்தெடுக்கப்பட்டன" } +"{n} layers · {parts}" = { one = "{n} லேயர் · {parts}", other = "{n} லேயர்கள் · {parts}" } +"{n} matches" = { one = "{n} பொருத்தம்", other = "{n} பொருத்தங்கள்" } +"{n} min" = "{n} நிமி" +"{n} minutes ago" = { one = "{n} நிமிடம் முன்பு", other = "{n} நிமிடங்கள் முன்பு" } +"{n} months ago" = { one = "{n} மாதம் முன்பு", other = "{n} மாதங்கள் முன்பு" } +"{n} more notes omitted from this report" = { one = "மேலும் {n} குறிப்பு இந்த அறிக்கையில் விடுபட்டது", other = "மேலும் {n} குறிப்புகள் இந்த அறிக்கையில் விடுபட்டன" } +"{n} of {total}" = "{total} இல் {n}" +"{n} people joined" = { one = "{n} நபர் சேர்ந்தார்", other = "{n} நபர்கள் சேர்ந்தனர்" } +"{n} preferred components" = { one = "{n} விருப்ப காம்போனென்ட்", other = "{n} விருப்ப காம்போனென்ட்கள்" } +"{n} ready" = { one = "{n} தயார்", other = "{n} தயார்" } +"{n} removed" = { one = "{n} அகற்றப்பட்டது", other = "{n} அகற்றப்பட்டன" } +"{n} replies" = { one = "{n} பதில்", other = "{n} பதில்கள்" } +"{n} rows" = { one = "{n} வரிசை", other = "{n} வரிசைகள்" } +"{n} styles" = { one = "{n} ஸ்டைல்", other = "{n} ஸ்டைல்கள்" } +"{n} text layers" = { one = "{n} உரை லேயர்", other = "{n} உரை லேயர்கள்" } +"{n} variables" = { one = "{n} வேரியபிள்", other = "{n} வேரியபிள்கள்" } +"{n} votes" = { one = "{n} வாக்கு", other = "{n} வாக்குகள்" } +"{n} votes left" = { one = "{n} வாக்கு மீதமுள்ளது", other = "{n} வாக்குகள் மீதமுள்ளன" } +"{n} weeks ago" = { one = "{n} வாரம் முன்பு", other = "{n} வாரங்கள் முன்பு" } +"{n} years ago" = { one = "{n} ஆண்டு முன்பு", other = "{n} ஆண்டுகள் முன்பு" } +"{n}d" = "{n}நா" +"{n}h" = "{n}மணி" +"{n}m" = "{n}நிமி" +"{n}w" = "{n}வா" +"{page}, nothing selected" = "{page}, எதுவும் தேர்ந்தெடுக்கப்படவில்லை" +"{percent}%" = "{percent}%" +"{period}: {counts}" = "{period}: {counts}" +"{profile} (current)" = "{profile} (தற்போதையது)" +"{property} is its value; {property ? \"a\" : \"b\"} picks a string. Other {…} stays as written." = "{property} அதன் மதிப்பு; {property ? \"a\" : \"b\"} ஒரு சரத்தைத் தேர்ந்தெடுக்கும். மற்ற {…} எழுதியபடியே இருக்கும்." +"{server} can't say what became of your files (it is older than this app)." = "உங்கள் கோப்புகளுக்கு என்ன ஆனது என்று {server} ஆல் சொல்ல முடியாது (அது இந்த ஆப்ஸை விடப் பழையது)." +"{server} · No longer on the server" = "{server} · இனி சர்வரில் இல்லை" +"{server} · {shared} · Opened {date}" = "{server} · {shared} · {date} அன்று திறக்கப்பட்டது" +"{tool} hold {key}" = "{tool} {key} ஐ அழுத்திப் பிடி" +"{used} · {detached}" = "{used} · {detached}" +"{used} · {inserted}" = "{used} · {inserted}" +"{value} isn't a colour" = "{value} ஒரு நிறம் அல்ல" +"{when} · edited" = "{when} · திருத்தப்பட்டது" +"←" = "←" +"← ↑ → ↓" = "← ↑ → ↓" +"← → ↑ ↓" = "← → ↑ ↓" +"→, Space or N" = "→, Space அல்லது N" +"↵" = "↵" +"↵ / ⇧↵" = "↵ / ⇧↵" +"⇥ / ⇧⇥" = "⇥ / ⇧⇥" +"⇥ or ⌥ Space again" = "⇥ அல்லது ⌥ Space மீண்டும்" +"⌘ arrows" = "⌘ அம்புகள்" +"⌘ click" = "⌘ கிளிக்" +"⌘ click a padding field" = "ஒரு பேடிங் புலத்தை ⌘ கிளிக் செய்யவும்" +"⌘ scroll" = "⌘ ஸ்க்ரோல்" +"⌥ double-click an edge of an auto layout child" = "ஆட்டோ லேஅவுட் சைல்டின் ஓரத்தை ⌥ இருமுறை கிளிக் செய்யவும்" +"⌥ drag" = "⌥ இழு" +"⌥⌘ ← ↑ → ↓" = "⌥⌘ ← ↑ → ↓" + +[commands] +"align.bottom" = "கீழே சீரமை" +"align.hcenter" = "கிடைமட்ட மையத்தில் சீரமை" +"align.left" = "இடதுபுறம் சீரமை" +"align.right" = "வலதுபுறம் சீரமை" +"align.top" = "மேலே சீரமை" +"align.vcenter" = "செங்குத்து மையத்தில் சீரமை" +"annotation.add" = "குறிப்புரை சேர்" +"annotation.addCategory" = "குறிப்புரை வகை சேர்" +"annotation.categories" = "குறிப்புரை வகைகள்" +"annotation.edit" = "குறிப்புரையைத் திருத்து" +"annotation.editCategory" = "குறிப்புரை வகையைத் திருத்து" +"annotation.list" = "குறிப்புரைகளைப் பட்டியலிடு" +"annotation.remove" = "குறிப்புரையை அகற்று" +"annotation.removeCategory" = "குறிப்புரை வகையை நீக்கு" +"app.actions" = "செயல்கள்" +"app.preferences" = "விருப்பங்கள்" +"arrange.back" = "பின்னுக்கு அனுப்பு" +"arrange.backward" = "ஒரு படி பின்னுக்கு அனுப்பு" +"arrange.forward" = "ஒரு படி முன்னுக்குக் கொண்டுவா" +"arrange.front" = "முன்னுக்குக் கொண்டுவா" +"arrange.packH" = "கிடைமட்டமாக அடுக்கு" +"arrange.packV" = "செங்குத்தாக அடுக்கு" +"arrange.reorder" = "தேர்வை மறுவரிசைப்படுத்து" +"arrange.roundToPixels" = "பிக்சல்களுக்கு முழுமையாக்கு" +"arrange.spacing" = "இடைவெளி" +"arrange.tidy" = "ஒழுங்குபடுத்து" +"board.addConnected" = "இணைந்த வடிவம் சேர்" +"board.connector" = "கனெக்டர்" +"board.ink" = "மார்க்கர் ஸ்ட்ரோக்" +"board.label" = "கனெக்டர் லேபிள்" +"board.nextSticky" = "அடுத்த ஸ்டிக்கி நோட்" +"board.reattach" = "கனெக்டரை மீண்டும் இணை" +"board.setColor" = "போர்டு நிறம்" +"board.setStyle" = "போர்டு ஸ்டைல்" +"board.shape" = "உரையுடன் வடிவம்" +"board.stamp" = "ஸ்டாம்ப்" +"board.sticky" = "ஸ்டிக்கி நோட்" +"board.table" = "அட்டவணை" +"board.tableEdit" = "அட்டவணையைத் திருத்து" +"board.template" = "போர்டு டெம்ப்ளேட்" +"board.templates" = "போர்டு டெம்ப்ளேட்களைப் பட்டியலிடு" +"board.timer" = "டைமர்" +"board.timerState" = "டைமர் நிலை" +"board.vote" = "வாக்கெடுப்பு அமர்வு" +"board.voteResults" = "வாக்கெடுப்பு முடிவுகள்" +"bool.exclude" = "தேர்வை விலக்கு" +"bool.flatten" = "பூலியனைத் தட்டையாக்கு" +"bool.intersect" = "தேர்வைக் குறுக்கிடு" +"bool.subtract" = "தேர்வைக் கழி" +"bool.union" = "தேர்வை ஒன்றிணை" +"branch.archive" = "கிளையைக் காப்பகப்படுத்து" +"branch.create" = "கிளையை உருவாக்கு" +"branch.list" = "கிளைகளைப் பட்டியலிடு" +"branch.merge" = "கிளையை இணை" +"branch.open" = "கிளையைத் திற" +"branch.review" = "கிளையை மதிப்பாய்வு செய்" +"branch.updateFromMain" = "main இலிருந்து புதுப்பி" +"codeConnect.export" = "குறியீட்டு இணைப்புகளை ஏற்றுமதி செய்" +"codeConnect.import" = "குறியீட்டு இணைப்புகளை இறக்குமதி செய்" +"codeConnect.remove" = "குறியீட்டிலிருந்து துண்டி" +"codeConnect.set" = "குறியீட்டுடன் இணை" +"collab.cursor" = "கர்சரை இங்கே காட்டு" +"collab.cursorChat" = "கர்சர் அரட்டை" +"collab.diff" = "ஒத்திசைவு மாற்றங்களைக் காட்டு" +"collab.files" = "உங்கள் ஆன்லைன் கோப்புகள்" +"collab.follow" = "பின்தொடர்" +"collab.forgetFile" = "ஆன்லைன் கோப்பை மற" +"collab.host" = "நேரலை அமர்வைத் தொடங்கு" +"collab.join" = "நேரலை அமர்வில் சேர்" +"collab.leave" = "நேரலை அமர்விலிருந்து வெளியேறு" +"collab.manageFile" = "வெளியிட்ட கோப்பை நிர்வகி" +"collab.openFile" = "ஆன்லைன் கோப்பைத் திற" +"collab.peers" = "இந்தக் கோப்பில் உள்ளவர்கள்" +"collab.publish" = "சர்வரில் வெளியிடு" +"collab.reconnect" = "நேரலை அமர்வை மீண்டும் இணை" +"collab.recoverFile" = "ஆன்லைன் கோப்பை மீட்டெடு" +"collab.registerLinks" = "அழைப்பு இணைப்புகளை FigCraft-இல் திற" +"collab.removePerson" = "அமர்விலிருந்து அகற்று" +"collab.report" = "கோப்பை சர்வர் இயக்குநரிடம் புகாரளி" +"collab.serverInfo" = "சர்வர் தகவல்" +"collab.share" = "சேர்வுக் குறியீட்டுடன் பகிர்" +"collab.spotlight" = "என்னை ஸ்பாட்லைட் செய்" +"collab.stop" = "நேரலை அமர்வை நிறுத்து" +"command.batch" = "பல கட்டளைகளை இயக்கு" +"comment.add" = "கருத்து சேர்" +"comment.delete" = "கருத்தை நீக்கு" +"comment.edit" = "கருத்தைத் திருத்து" +"comment.link" = "கருத்துக்கான இணைப்பை நகலெடு" +"comment.list" = "கருத்துகளைப் பட்டியலிடு" +"comment.markRead" = "கருத்தைப் படித்ததாகக் குறி" +"comment.move" = "கருத்தை நகர்த்து" +"comment.next" = "அடுத்த கருத்து" +"comment.open" = "கருத்தைத் திற" +"comment.people" = "கருத்துகளில் உள்ளவர்கள்" +"comment.prompt" = "AI-க்காகக் கருத்துகளை நகலெடு" +"comment.react" = "கருத்துக்கு எதிர்வினையாற்று" +"comment.reply" = "கருத்துக்குப் பதிலளி" +"comment.resolve" = "கருத்தைத் தீர்த்துவை" +"comment.zoom" = "கருத்துகளுக்கு ஜூம் செய்" +"component.addProperty" = "காம்போனென்ட் பண்பு சேர்" +"component.addVariant" = "வேரியன்ட் சேர்" +"component.bindProperty" = "லேயரைப் பண்புடன் இணை" +"component.combineVariants" = "வேரியன்ட்களாக இணை" +"component.create" = "காம்போனென்ட் உருவாக்கு" +"component.createMultiple" = "பல காம்போனென்ட்களை உருவாக்கு" +"component.deleteProperty" = "காம்போனென்ட் பண்பை நீக்கு" +"component.detach" = "இன்ஸ்டன்ஸைப் பிரி" +"component.editProperty" = "காம்போனென்ட் பண்பைத் திருத்து" +"component.exposeInstance" = "உள்ளமைந்த இன்ஸ்டன்ஸை வெளிப்படுத்து" +"component.goToMain" = "முதன்மை காம்போனென்ட்டுக்குச் செல்" +"component.hideWhenPublishing" = "வெளியிடும்போது மறை" +"component.list" = "காம்போனென்ட்களைப் பட்டியலிடு" +"component.makeSlot" = "ஸ்லாட் ஆக்கு" +"component.playground" = "காம்போனென்ட் சோதனைக்களம்" +"component.properties" = "காம்போனென்ட் பண்புகள்" +"component.pushChanges" = "மாற்றங்களை முதன்மை காம்போனென்ட்டுக்கு அனுப்பு" +"component.removeSlot" = "ஸ்லாட்டை அகற்று" +"component.resetInstance" = "எல்லா மாற்றங்களையும் மீட்டமை" +"component.resetOverride" = "ஓவர்ரைடை மீட்டமை" +"component.restoreMain" = "முதன்மை காம்போனென்ட்டை மீட்டெடு" +"data.fill" = "நகல்களைத் தரவால் நிரப்பு" +"dev.compare" = "மாற்றங்களை ஒப்பிடு" +"dev.focus" = "கவனக் காட்சி" +"dev.resolveChange" = "மாற்றத்தைத் தீர்த்துவை" +"dev.unfocus" = "கவனக் காட்சியிலிருந்து வெளியேறு" +"devMode.addMeasurement" = "அளவீடு சேர்" +"devMode.measurements" = "அளவீடுகளைப் பட்டியலிடு" +"devMode.removeMeasurement" = "அளவீட்டை அகற்று" +"devResource.add" = "டெவ் ஆதாரம் சேர்" +"devResource.edit" = "டெவ் ஆதாரத்தைத் திருத்து" +"devResource.list" = "டெவ் ஆதாரங்களைப் பட்டியலிடு" +"devResource.remove" = "டெவ் ஆதாரத்தை அகற்று" +"distribute.horizontal" = "கிடைமட்ட இடைவெளியைப் பகிர்ந்தளி" +"distribute.vertical" = "செங்குத்து இடைவெளியைப் பகிர்ந்தளி" +"doc.home" = "முகப்பு" +"doc.list" = "ஆவணங்களைப் பட்டியலிடு" +"doc.nextTab" = "அடுத்த தாவல்" +"doc.previousTab" = "முந்தைய தாவல்" +"doc.switch" = "ஆவணத்தை மாற்று" +"edit.copy" = "நகலெடு" +"edit.copyAsCss" = "CSS ஆக நகலெடு" +"edit.copyAsPng" = "PNG ஆக நகலெடு" +"edit.copyAsSvg" = "SVG ஆக நகலெடு" +"edit.copyAsText" = "உரையாக நகலெடு" +"edit.copyLink" = "தேர்வுக்கான இணைப்பை நகலெடு" +"edit.copyProperties" = "பண்புகளை நகலெடு" +"edit.cut" = "வெட்டு" +"edit.delete" = "நீக்கு" +"edit.duplicate" = "நகல்செய்" +"edit.findReplace" = "கண்டுபிடித்து மாற்று" +"edit.paste" = "ஒட்டு" +"edit.pasteDesignLayers" = "டிசைன் லேயர்களை ஒட்டு" +"edit.pasteOver" = "தேர்வின் மேல் ஒட்டு" +"edit.pasteProperties" = "பண்புகளை ஒட்டு" +"edit.pasteReplace" = "மாற்றாக ஒட்டு" +"edit.pickColor" = "நிறத்தைத் தேர்ந்தெடு" +"edit.redo" = "மீண்டும்செய்" +"edit.repeat" = "கடைசி கட்டளையை மீண்டும் இயக்கு" +"edit.setDefaultProperties" = "இயல்புநிலை பண்புகளை அமை" +"edit.undo" = "செயல்தவிர்" +"effect.add" = "எஃபெக்ட் சேர்" +"effect.copy" = "எஃபெக்ட்டை நகலெடு" +"effect.move" = "எஃபெக்ட்டை நகர்த்து" +"effect.paste" = "எஃபெக்ட்டை ஒட்டு" +"effect.remove" = "எஃபெக்ட்டை அகற்று" +"effect.set" = "எஃபெக்ட்டை அமை" +"export.add" = "ஏற்றுமதி அமைப்பு சேர்" +"export.remove" = "ஏற்றுமதி அமைப்பை அகற்று" +"export.update" = "ஏற்றுமதி அமைப்பைத் திருத்து" +"file.close" = "தாவலை மூடு" +"file.colorProfile" = "நிறச் சுயவிவரம்" +"file.duplicate" = "கோப்பை நகல்செய்" +"file.export" = "ஏற்றுமதி செய்" +"file.exportFramesPdf" = "ஃப்ரேம்களை PDF ஆக ஏற்றுமதி செய்" +"file.exportLayers" = "லேயர்களை ஏற்றுமதி செய்" +"file.exportSvg" = "தேர்வை SVG ஆக ஏற்றுமதி செய்" +"file.fontReport" = "ஆவண எழுத்துருக்களை ஆய்வு செய்" +"file.import" = "இறக்குமதி செய்" +"file.markSaved" = "சேமித்ததாகக் குறி" +"file.moveTab" = "தாவலை நகர்த்து" +"file.new" = "புதிய டிசைன் கோப்பு" +"file.newBoard" = "புதிய போர்டு" +"file.newFromTemplate" = "டெம்ப்ளேட்டிலிருந்து புதியது" +"file.open" = "திற" +"file.openRecent" = "சமீபத்தியதைத் திற" +"file.placeImage" = "படத்தை வை" +"file.recover" = "கோப்பை மீட்டெடு" +"file.rename" = "கோப்பின் பெயரை மாற்று" +"file.revert" = "சேமித்ததற்குத் திரும்பு" +"file.save" = "சேமி" +"file.saveAs" = "இவ்வாறு சேமி" +"file.saveVersion" = "பதிப்பு வரலாற்றில் சேமி" +"file.versionHistory" = "பதிப்பு வரலாற்றைக் காட்டு" +"fill.add" = "ஃபில் சேர்" +"fill.copy" = "ஃபில்லை நகலெடு" +"fill.move" = "ஃபில்லை நகர்த்து" +"fill.paste" = "ஃபில்லை ஒட்டு" +"fill.pattern" = "பேட்டர்ன் ஃபில்" +"fill.remove" = "ஃபில்லை அகற்று" +"fill.set" = "ஃபில்லை அமை" +"frame.create" = "ஃப்ரேம் உருவாக்கு" +"frame.presets" = "ஃப்ரேம் முன்னமைவுகளைப் பட்டியலிடு" +"frame.swapOrientation" = "திசையமைவை மாற்று" +"grid.add" = "லேஅவுட் கட்டம் சேர்" +"grid.move" = "லேஅவுட் கட்டத்தை நகர்த்து" +"grid.remove" = "லேஅவுட் கட்டத்தை அகற்று" +"guide.add" = "வழிகாட்டி சேர்" +"guide.clear" = "எல்லா வழிகாட்டிகளையும் அகற்று" +"guide.move" = "வழிகாட்டியை நகர்த்து" +"guide.remove" = "வழிகாட்டியை அகற்று" +"guide.select" = "வழிகாட்டியைத் தேர்ந்தெடு" +"help.about" = "FigCraft பற்றி" +"help.gettingStarted" = "தொடங்குதல்" +"help.page" = "உதவிப் பக்கம்" +"help.shortcuts" = "விசைப்பலகை குறுக்குவழிகள்" +"image.adjust" = "படத்தைச் சரிசெய்" +"image.deletePreset" = "பட முன்னமைவை நீக்கு" +"image.place" = "படத்தை வை" +"image.presets" = "பட முன்னமைவுகள்" +"image.savePreset" = "பட முன்னமைவைச் சேமி" +"inspect.assets" = "அசெட்களை ஆய்வுசெய்" +"inspect.code" = "லேயருக்கான குறியீடு" +"inspect.componentCode" = "காம்போனென்ட் குறியீடு" +"inspect.properties" = "பண்புகளை ஆய்வுசெய்" +"inspect.readyForDev" = "டெவ்-க்குத் தயார்" +"instance.create" = "இன்ஸ்டன்ஸை உருவாக்கு" +"instance.exposed" = "வெளிப்படுத்திய உள்ளமை இன்ஸ்டன்ஸ்கள்" +"instance.place" = "இன்ஸ்டன்ஸை வை" +"instance.resetSlot" = "ஸ்லாட்டை மீட்டமை" +"instance.setProperties" = "இன்ஸ்டன்ஸ் பண்புகளை அமை" +"instance.slotInsert" = "ஸ்லாட்டில் செருகு" +"instance.swap" = "இன்ஸ்டன்ஸை மாற்று" +"instance.swapAt" = "புள்ளியில் இன்ஸ்டன்ஸை மாற்று" +"layers.collapseAll" = "லேயர்களைச் சுருக்கு" +"layout.add" = "ஆட்டோ லேஅவுட் சேர்" +"layout.remove" = "ஆட்டோ லேஅவுட்டை அகற்று" +"layout.setTrack" = "கட்ட வரிசை அளவை அமை" +"layout.suggest" = "ஆட்டோ லேஅவுட்டைப் பரிந்துரை" +"libraries.open" = "லைப்ரரிகள்" +"libraries.publish" = "லைப்ரரியை வெளியிடு…" +"library.acceptUpdates" = "லைப்ரரி புதுப்பிப்புகளை ஏற்றுக்கொள்" +"library.add" = "லைப்ரரியைச் சேர்" +"library.aliasVariable" = "லைப்ரரி வேரியபிளுக்கு மாற்றுப்பெயரிடு" +"library.applyStyle" = "லைப்ரரி ஸ்டைலைப் பயன்படுத்து" +"library.bindVariable" = "லைப்ரரி வேரியபிளை இணை" +"library.extendCollection" = "லைப்ரரி தொகுப்பை நீட்டி" +"library.import" = "லைப்ரரி காம்போனென்டை இறக்குமதிசெய்" +"library.importVariable" = "லைப்ரரி வேரியபிளை இறக்குமதிசெய்" +"library.list" = "லைப்ரரிகளைப் பட்டியலிடு" +"library.place" = "லைப்ரரி காம்போனென்டை வை" +"library.publish" = "லைப்ரரியை வெளியிடு" +"library.publishToServer" = "லைப்ரரியைச் சர்வரில் வெளியிடு" +"library.remove" = "லைப்ரரியை அகற்று" +"library.setVariableMode" = "லைப்ரரி வேரியபிள் மோடை அமை" +"library.swap" = "லைப்ரரியை மாற்று" +"library.swapAt" = "இன்ஸ்டன்ஸை லைப்ரரி காம்போனென்டாக மாற்று" +"library.updates" = "லைப்ரரி புதுப்பிப்புகள்" +"library.usage" = "லைப்ரரி பயன்பாடு" +"measure.distances" = "இடைவெளிகளை அளவிடு" +"measure.padding" = "ஆட்டோ லேஅவுட் பேடிங்கை அளவிடு" +"node.create" = "லேயரை உருவாக்கு" +"node.find" = "லேயர்களைக் கண்டறி" +"node.get" = "லேயரைப் பெறு" +"node.reorder" = "லேயர் வரிசையை மாற்று" +"node.reparent" = "லேயரை உள்ளே நகர்த்து" +"node.set" = "பண்புகளை அமை" +"object.batchRename" = "மொத்தமாக மறுபெயரிடு" +"object.convertToFrame" = "ஃப்ரேமாக மாற்று" +"object.convertToGroup" = "குழுவாக மாற்று" +"object.convertToSection" = "செக்ஷனாக மாற்று" +"object.flipH" = "கிடைமட்டமாகப் புரட்டு" +"object.flipV" = "செங்குத்தாகப் புரட்டு" +"object.frameSelection" = "தேர்வை ஃப்ரேமில் வை" +"object.group" = "தேர்வைக் குழுவாக்கு" +"object.hideOthers" = "பிற லேயர்களை மறை" +"object.mask" = "மாஸ்க்காகப் பயன்படுத்து" +"object.moveToPage" = "பக்கத்துக்கு நகர்த்து" +"object.opacityKeys" = "எண் விசைகளால் ஒளிபுகாமை" +"object.rasterize" = "தேர்வை ராஸ்டராக்கு" +"object.releaseMask" = "மாஸ்க்கை விடுவி" +"object.removeFill" = "ஃபில்லை அகற்று" +"object.removeFrame" = "ஃப்ரேமை அகற்று" +"object.removeStroke" = "ஸ்ட்ரோக்கை அகற்று" +"object.rename" = "மறுபெயரிடு" +"object.resizeToFit" = "பொருந்தும்படி அளவுமாற்று" +"object.rotate180" = "180° சுழற்று" +"object.rotateLeft" = "90° இடப்புறம் சுழற்று" +"object.rotateRight" = "90° வலப்புறம் சுழற்று" +"object.setThumbnail" = "சிறுபடமாக அமை" +"object.swapFillStroke" = "ஃபில், ஸ்ட்ரோக்கை இடமாற்று" +"object.toggleLock" = "தேர்வைப் பூட்டு/திற" +"object.toggleVisible" = "தேர்வைக் காட்டு/மறை" +"object.ungroup" = "தேர்வின் குழுவைப் பிரி" +"object.wrapInSection" = "புதிய செக்ஷனில் வை" +"page.add" = "பக்கத்தைச் சேர்" +"page.delete" = "பக்கத்தை நீக்கு" +"page.duplicate" = "பக்கத்தை நகல்செய்" +"page.list" = "பக்கங்களைப் பட்டியலிடு" +"page.move" = "பக்கத்தை நகர்த்து" +"page.rename" = "பக்கத்தை மறுபெயரிடு" +"page.select" = "பக்கத்துக்குச் செல்" +"page.setBackground" = "பக்கப் பின்னணி" +"paint.documentColors" = "ஆவண நிறங்கள்" +"plugin.close" = "ப்ளகின் பேனலை மூடு" +"plugin.directory.install" = "கோப்பகத்திலிருந்து ப்ளகினை நிறுவு" +"plugin.directory.list" = "ப்ளகின் கோப்பகத்தை உலாவு" +"plugin.directory.publish" = "ப்ளகினைக் கோப்பகத்தில் வெளியிடு" +"plugin.directory.unpublish" = "ப்ளகினைக் கோப்பகத்திலிருந்து நீக்கு" +"plugin.event" = "ப்ளகின் பேனல் கட்டுப்பாட்டைப் பயன்படுத்து" +"plugin.import" = "மேனிஃபெஸ்டிலிருந்து ப்ளகினை இறக்குமதிசெய்…" +"plugin.list" = "ப்ளகின்களைப் பட்டியலிடு" +"plugin.remove" = "ப்ளகினை அகற்று" +"plugin.run" = "ப்ளகினை இயக்கு" +"plugin.ui" = "ப்ளகின் பேனல்" +"plugins.manage" = "ப்ளகின்களை நிர்வகி…" +"plugins.runLast" = "கடைசி ப்ளகினை இயக்கு" +"pref.autoSave" = "கோப்புகளைத் தானாகச் சேமி" +"pref.highlightHover" = "மேலே செல்லும்போது லேயர்களை முன்னிலைப்படுத்து" +"pref.keepTool" = "பயன்படுத்திய பின் கருவியைத் தேர்விலேயே வை" +"pref.language" = "இடைமுக மொழி" +"pref.nudge" = "நகர்த்தும் அளவு" +"pref.numberKeysOpacity" = "ஒளிபுகாமைக்கு எண் விசைகளைப் பயன்படுத்து" +"pref.publishServer" = "ஆன்லைன் பகிர்வுக்கான சர்வர்" +"pref.reduceMotion" = "அசைவைக் குறை" +"pref.renameDuplicates" = "நகலெடுத்த லேயர்களை மறுபெயரிடு" +"pref.scrollWheelZoom" = "ஸ்க்ரோல் வீல் ஜூம்" +"pref.showDimensions" = "பொருள்களில் அளவுகளைக் காட்டு" +"pref.startOnHome" = "முகப்புத் திரையில் தொடங்கு" +"pref.uiScale" = "இடைமுக அளவு" +"pref.userName" = "உங்கள் பெயர்" +"proto.action.add" = "ப்ரோட்டோடைப் செயலைச் சேர்" +"proto.action.move" = "ப்ரோட்டோடைப் செயலின் வரிசையை மாற்று" +"proto.action.remove" = "ப்ரோட்டோடைப் செயலை அகற்று" +"proto.action.set" = "ப்ரோட்டோடைப் செயலைத் திருத்து" +"proto.closePreview" = "ப்ரோட்டோடைப் முன்னோட்டத்தை மூடு" +"proto.conditional.addBlock" = "else if / else சேர்" +"proto.conditional.removeBlock" = "if / else if / else ஐ அகற்று" +"proto.conditional.setCondition" = "நிபந்தனையைத் திருத்து" +"proto.evaluate" = "ப்ரோட்டோடைப் எக்ஸ்பிரஷனை மதிப்பிடு" +"proto.flow.add" = "ஃப்ளோ தொடக்கப் புள்ளியைச் சேர்" +"proto.flow.remove" = "ஃப்ளோவை அகற்று" +"proto.flow.rename" = "ஃப்ளோவை மறுபெயரிடு" +"proto.interaction.add" = "இன்டராக்ஷனைச் சேர்" +"proto.interaction.clear" = "எல்லா இன்டராக்ஷன்களையும் அகற்று" +"proto.interaction.remove" = "இன்டராக்ஷனை அகற்று" +"proto.interaction.set" = "இன்டராக்ஷனைத் திருத்து" +"proto.present" = "வழங்கு" +"proto.presentOptions" = "விளக்கக்காட்சி விருப்பங்கள்" +"proto.preview" = "ப்ரோட்டோடைப் முன்னோட்டத்தைத் திற" +"proto.settings" = "ப்ரோட்டோடைப் அமைப்புகள்" +"section.toggleContents" = "செக்ஷன் உள்ளடக்கத்தை மறை/காட்டு" +"select.add" = "தேர்வில் சேர்" +"select.all" = "அனைத்தையும் தேர்ந்தெடு" +"select.area" = "பகுதியைத் தேர்ந்தெடு" +"select.byName" = "பெயரால் லேயர்களைத் தேர்ந்தெடு" +"select.children" = "சைல்ட் லேயர்களைத் தேர்ந்தெடு" +"select.inverse" = "தேர்வைத் தலைகீழாக்கு" +"select.layersAt" = "ஒரு புள்ளியிலுள்ள லேயர்கள்" +"select.matching" = "பொருந்தும் லேயர்களைத் தேர்ந்தெடு" +"select.next" = "அடுத்த லேயரைத் தேர்ந்தெடு" +"select.none" = "எதையும் தேர்ந்தெடுக்க வேண்டாம்" +"select.parent" = "பேரன்ட் லேயரைத் தேர்ந்தெடு" +"select.previous" = "முந்தைய லேயரைத் தேர்ந்தெடு" +"select.remove" = "தேர்விலிருந்து அகற்று" +"select.sameEffect" = "ஒரே எஃபெக்ட்டைத் தேர்ந்தெடு" +"select.sameFill" = "ஒரே ஃபில்லைத் தேர்ந்தெடு" +"select.sameFont" = "ஒரே எழுத்துருவைத் தேர்ந்தெடு" +"select.sameInstance" = "ஒரே இன்ஸ்டன்ஸைத் தேர்ந்தெடு" +"select.sameProperties" = "ஒரே பண்புகளைத் தேர்ந்தெடு" +"select.sameStroke" = "ஒரே ஸ்ட்ரோக்கைத் தேர்ந்தெடு" +"select.sameText" = "ஒரே உரைப் பண்புகளைத் தேர்ந்தெடு" +"select.set" = "தேர்ந்தெடு" +"selection.applyColorStyle" = "தேர்வின் நிற ஸ்டைலைப் பயன்படுத்து" +"selection.bindColorVariable" = "தேர்வின் நிற வேரியபிளைப் பயன்படுத்து" +"selection.colors" = "தேர்வின் நிறங்கள்" +"selection.createColorStyle" = "தேர்வின் நிற ஸ்டைலை உருவாக்கு" +"selection.detachColor" = "தேர்வின் நிறத்தைப் பிரி" +"selection.selectColor" = "இந்த நிறமுள்ள லேயர்களைத் தேர்ந்தெடு" +"selection.setPaint" = "தேர்வின் நிறத்தை மாற்று" +"shape.arrow" = "அம்புக்குறி" +"shape.ellipse" = "நீள்வட்டம்" +"shape.line" = "கோடு" +"shape.polygon" = "பலகோணம்" +"shape.rectangle" = "செவ்வகம்" +"shape.star" = "நட்சத்திரம்" +"shapeBuilder.merge" = "பகுதிகளை இணை" +"shapeBuilder.mode" = "வடிவ பில்டர் மோட்" +"shapeBuilder.regions" = "வடிவ பில்டர் பகுதிகள்" +"shapeBuilder.remove" = "பகுதிகளை அகற்று" +"stroke.add" = "ஸ்ட்ரோக் சேர்" +"stroke.brush" = "தூரிகை" +"stroke.copy" = "ஸ்ட்ரோக்கை நகலெடு" +"stroke.move" = "ஸ்ட்ரோக்கை நகர்த்து" +"stroke.paste" = "ஸ்ட்ரோக்கை ஒட்டு" +"stroke.remove" = "ஸ்ட்ரோக்கை அகற்று" +"stroke.set" = "ஸ்ட்ரோக்கை அமை" +"stroke.widthProfile" = "அகல சுயவிவரம்" +"style.apply" = "ஸ்டைலைப் பயன்படுத்து" +"style.bind" = "ஸ்டைலில் வேரியபிளை இணை" +"style.create" = "ஸ்டைலை உருவாக்கு" +"style.delete" = "ஸ்டைலை நீக்கு" +"style.detach" = "ஸ்டைலைப் பிரி" +"style.duplicate" = "ஸ்டைலை நகல்செய்" +"style.list" = "ஸ்டைல்களைப் பட்டியலிடு" +"style.move" = "ஸ்டைல்களை நகர்த்து" +"style.renameFolder" = "ஸ்டைல் கோப்புறையை மறுபெயரிடு" +"style.update" = "ஸ்டைலைத் திருத்து" +"template.list" = "டெம்ப்ளேட்களைப் பட்டியலிடு" +"text.alignCenter" = "நடுவில் சீரமை" +"text.alignJustify" = "இருபுறமும் சீரமை" +"text.alignLeft" = "இடப்புறம் சீரமை" +"text.alignRight" = "வலப்புறம் சீரமை" +"text.bold" = "தடிமன்" +"text.bulletList" = "புள்ளிப் பட்டியல்" +"text.case" = "எழுத்து வடிவம்" +"text.caseLower" = "சிற்றெழுத்து" +"text.caseOriginal" = "அசல் வடிவம்" +"text.caseSmallCaps" = "சிறிய பேரெழுத்து" +"text.caseTitle" = "தலைப்பு வடிவம்" +"text.caseUpper" = "பேரெழுத்து" +"text.create" = "உரை" +"text.decoration" = "அலங்காரம்" +"text.direction" = "உரைத் திசை" +"text.directionAuto" = "உரைத் திசை: தானியங்கு" +"text.directionLtr" = "உரைத் திசை: இடமிருந்து வலம்" +"text.directionRtl" = "உரைத் திசை: வலமிருந்து இடம்" +"text.edit.begin" = "உரையைத் திருத்து" +"text.edit.caret" = "கர்சரை அமை" +"text.edit.end" = "உரைத் திருத்தத்தை நிறுத்து" +"text.edit.insert" = "உரையைத் தட்டச்சுசெய்" +"text.edit.key" = "உரை விசை" +"text.edit.preedit" = "உரையை உருவாக்கு (IME)" +"text.edit.selectLine" = "வரியைத் தேர்ந்தெடு" +"text.edit.selectWord" = "சொல்லைத் தேர்ந்தெடு" +"text.edit.selection" = "உரைத் தேர்வு" +"text.endPreview" = "உரை முன்னோட்டத்தை முடி" +"text.fit" = "உரையைப் பெட்டிக்குள் பொருத்து" +"text.fonts" = "எழுத்துருக்களைப் பட்டியலிடு" +"text.italic" = "சாய்வு" +"text.lineHeightDown" = "வரி உயரத்தைக் குறை" +"text.lineHeightUp" = "வரி உயரத்தைக் கூட்டு" +"text.link" = "இணைப்பை உருவாக்கு" +"text.listIndent" = "பட்டியலை உள்தள்ளு" +"text.listOutdent" = "பட்டியலை வெளித்தள்ளு" +"text.listStyle" = "பட்டியல் ஸ்டைல்" +"text.loadFont" = "எழுத்துருக் கோப்பை ஏற்று" +"text.maxLines" = "அதிகபட்ச வரிகள்" +"text.missingFonts" = "விடுபட்ட எழுத்துருக்கள்" +"text.numberList" = "எண் பட்டியல்" +"text.onPath" = "பாதையில் உரை" +"text.paragraphIndent" = "பத்தி உள்தள்ளல்" +"text.paragraphSpacing" = "பத்தி இடைவெளி" +"text.pathOptions" = "உரைப் பாதை விருப்பங்கள்" +"text.preview" = "மாற்றத்தை முன்னோட்டமிடு" +"text.refit" = "எழுத்துருக்களுக்கு ஏற்ப உரையைப் பொருத்து" +"text.removeFromPath" = "பாதையிலிருந்து உரையை அகற்று" +"text.rescanFonts" = "நிறுவிய எழுத்துருக்களை மீண்டும் ஸ்கேன்செய்" +"text.set" = "உரையை அமை" +"text.setFeatures" = "OpenType அம்சங்கள்" +"text.setVariations" = "வேரியபிள் எழுத்துரு அச்சுகள்" +"text.sizeDown" = "எழுத்துரு அளவைக் குறை" +"text.sizeUp" = "எழுத்துரு அளவைக் கூட்டு" +"text.strikethrough" = "அடித்தல்" +"text.style" = "உரைப் பகுதிக்கு ஸ்டைல் அமை" +"text.trackingDown" = "எழுத்து இடைவெளியைக் குறை" +"text.trackingUp" = "எழுத்து இடைவெளியைக் கூட்டு" +"text.underline" = "அடிக்கோடு" +"text.weightDown" = "எழுத்துரு தடிமனைக் குறை" +"text.weightUp" = "எழுத்துரு தடிமனைக் கூட்டு" +"tool.arrow" = "அம்புக்குறி" +"tool.comment" = "கருத்து" +"tool.connector" = "கனெக்டர்" +"tool.crosshair" = "இடக்குறி குறுக்குக்கோட்டை நகர்த்து" +"tool.ellipse" = "நீள்வட்டம்" +"tool.eraser" = "அழிப்பான்" +"tool.frame" = "ஃப்ரேம்" +"tool.hand" = "கை" +"tool.highlighter" = "ஹைலைட்டர்" +"tool.line" = "கோடு" +"tool.marker" = "மார்க்கர்" +"tool.move" = "நகர்த்து" +"tool.pen" = "பேனா" +"tool.pencil" = "பென்சில்" +"tool.pencilBrush" = "பென்சில் தூரிகை" +"tool.place" = "கருவியால் வை" +"tool.polygon" = "பலகோணம்" +"tool.rectangle" = "செவ்வகம்" +"tool.scale" = "அளவிடு" +"tool.scaleAnchor" = "அளவிடும் நங்கூரம்" +"tool.section" = "செக்ஷன்" +"tool.set" = "கருவியைத் தேர்ந்தெடு" +"tool.shape" = "வடிவங்கள்" +"tool.shapeBuilder" = "வடிவ பில்டர்" +"tool.slice" = "ஸ்லைஸ்" +"tool.stamp" = "ஸ்டாம்ப்" +"tool.star" = "நட்சத்திரம்" +"tool.sticky" = "ஸ்டிக்கி நோட்" +"tool.text" = "உரை" +"transform.move" = "நகர்த்து" +"transform.moveTo" = "இதற்கு நகர்த்து" +"transform.nudge" = "சிறிது நகர்த்து" +"transform.nudgeSize" = "சிறிது நகர்த்தி அளவுமாற்று" +"transform.resize" = "அளவுமாற்று" +"transform.rotate" = "சுழற்று" +"transform.rotationOrigin" = "சுழற்சி மையத்தை நகர்த்து" +"transform.scale" = "அளவிடு" +"transform.setRotationOrigin" = "சுழற்சி மையத்தை அமை" +"variable.addMode" = "மோட் சேர்" +"variable.bind" = "வேரியபிளை இணை" +"variable.create" = "வேரியபிளை உருவாக்கு" +"variable.createCollection" = "வேரியபிள் தொகுப்பை உருவாக்கு" +"variable.delete" = "வேரியபிளை நீக்கு" +"variable.deleteCollection" = "தொகுப்பை நீக்கு" +"variable.duplicate" = "வேரியபிளை நகல்செய்" +"variable.export" = "வேரியபிள்களை ஏற்றுமதிசெய்" +"variable.import" = "வேரியபிள்களை இறக்குமதிசெய்" +"variable.list" = "வேரியபிள்களைப் பட்டியலிடு" +"variable.moveMode" = "மோடை நகர்த்து" +"variable.removeMode" = "மோடை நீக்கு" +"variable.renameCollection" = "தொகுப்பை மறுபெயரிடு" +"variable.renameMode" = "மோடை மறுபெயரிடு" +"variable.resetOverride" = "வேரியபிள் ஓவர்ரைடை மீட்டமை" +"variable.set" = "வேரியபிள் மதிப்பை அமை" +"variable.setMode" = "வேரியபிள் மோடை அமை" +"variable.update" = "வேரியபிளைத் திருத்து" +"vector.create" = "வெக்டர்" +"vector.deleteHeal" = "தேர்வை நீக்கிச் சீர்செய்" +"vector.edit.addVertex" = "புள்ளியைச் சேர்" +"vector.edit.begin" = "வெக்டரைத் திருத்து" +"vector.edit.bend" = "பகுதியை வளை" +"vector.edit.bounds" = "தேர்ந்த புள்ளிகளின் எல்லைகள்" +"vector.edit.connect" = "புள்ளிகளை இணை" +"vector.edit.cornerRadius" = "புள்ளியின் மூலை ஆரம்" +"vector.edit.cut" = "பாதையை வெட்டு" +"vector.edit.delete" = "புள்ளிகளை நீக்கு" +"vector.edit.end" = "திருத்தி முடி" +"vector.edit.erase" = "அழி" +"vector.edit.lasso" = "லாஸோ தேர்வு" +"vector.edit.mirroring" = "ஹேண்டில் பிரதிபலிப்பு" +"vector.edit.moveHandles" = "ஹேண்டில்களை நகர்த்து" +"vector.edit.moveVertices" = "புள்ளிகளை நகர்த்து" +"vector.edit.nudge" = "புள்ளிகளைச் சிறிது நகர்த்து" +"vector.edit.paint" = "பெயின்ட் பக்கெட்" +"vector.edit.pen" = "பேனா புள்ளி" +"vector.edit.penEnd" = "பேனா பாதையை முடி" +"vector.edit.position" = "புள்ளியின் நிலை" +"vector.edit.resize" = "புள்ளிகளை அளவுமாற்று" +"vector.edit.rotate" = "புள்ளிகளைச் சுழற்று" +"vector.edit.select" = "புள்ளிகளைத் தேர்ந்தெடு" +"vector.edit.selectAll" = "எல்லாப் புள்ளிகளையும் தேர்ந்தெடு" +"vector.edit.setHandle" = "ஹேண்டிலை அமை" +"vector.edit.smooth" = "புள்ளிகளை மென்மையாக்கு அல்லது கூராக்கு" +"vector.edit.state" = "வெக்டர் திருத்த நிலை" +"vector.edit.strokeCap" = "புள்ளியின் ஸ்ட்ரோக் முனை" +"vector.edit.strokeJoin" = "புள்ளியின் ஸ்ட்ரோக் இணைப்பு" +"vector.edit.tool" = "வெக்டர் திருத்தக் கருவி" +"vector.edit.transform" = "புள்ளிகளை உருமாற்று" +"vector.edit.widthPoint" = "அகலப் புள்ளி" +"vector.fillRule" = "ஃபில் விதியை அமை" +"vector.flatten" = "தட்டையாக்கு" +"vector.join" = "தேர்வை இணை" +"vector.offset" = "பாதையை ஆஃப்செட் செய்" +"vector.outlineStroke" = "ஸ்ட்ரோக்கை அவுட்லைனாக்கு" +"vector.reverse" = "பாதையின் திசையைத் திருப்பு" +"vector.reverseLoop" = "லூப்பைத் திருப்பு" +"vector.simplify" = "வெக்டரை எளிதாக்கு" +"vector.smoothJoin" = "தேர்வை மென்மையாக இணை" +"version.autosave" = "பதிப்பைத் தானாகச் சேமி" +"version.delete" = "பதிப்பை நீக்கு" +"version.duplicate" = "பதிப்பை நகல்செய்" +"version.exitPreview" = "தற்போதைய பதிப்புக்குத் திரும்பு" +"version.list" = "பதிப்புகளைப் பட்டியலிடு" +"version.preview" = "பதிப்பைக் காண்" +"version.rename" = "பதிப்பை மறுபெயரிடு" +"version.restore" = "பதிப்பை மீட்டெடு" +"view.assets" = "அசெட்கள் பேனல்" +"view.comments" = "கருத்துகள்" +"view.contextMenu" = "சூழல் மெனுவைக் காட்டு" +"view.design" = "டிசைன் பேனல்" +"view.designPrototype" = "டிசைன், ப்ரோட்டோடைப் இடையே மாறு" +"view.devMode" = "டெவலப்பர் மோட்" +"view.frameOutlines" = "ஃப்ரேம் அவுட்லைன்கள்" +"view.fullscreen" = "முழுத்திரை" +"view.get" = "காட்சியைப் பெறு" +"view.layers" = "லேயர்கள் பேனல்" +"view.layoutGrids" = "லேஅவுட் கட்டங்கள்" +"view.leftSidebar" = "இடப் பக்கப்பட்டியைக் காட்டு/மறை" +"view.maskOutlines" = "மாஸ்க் அவுட்லைன்கள்" +"view.multiplayerCursors" = "பலர் கர்சர்கள்" +"view.nextFrame" = "அடுத்த ஃப்ரேமுக்கு ஜூம்செய்" +"view.nextPage" = "அடுத்த பக்கம்" +"view.nextRegion" = "அடுத்த பகுதியில் கவனம் செலுத்து" +"view.outlines" = "அவுட்லைன்கள்" +"view.outlinesHiddenLayers" = "அவுட்லைன்களில் மறைந்த லேயர்களைச் சேர்" +"view.outlinesObjectBounds" = "அவுட்லைன்களில் பொருள் எல்லைகளைச் சேர்" +"view.outlinesSelection" = "தேர்வுக்கான அவுட்லைன்கள்" +"view.pan" = "காட்சியை நகர்த்து" +"view.panelWidths" = "பேனல் அகலங்களை மீட்டமை" +"view.pixelGrid" = "பிக்சல் கட்டம்" +"view.pixelPreview" = "பிக்சல் முன்னோட்டம்" +"view.prevFrame" = "முந்தைய ஃப்ரேமுக்கு ஜூம்செய்" +"view.prevPage" = "முந்தைய பக்கம்" +"view.previousRegion" = "முந்தைய பகுதியில் கவனம் செலுத்து" +"view.proofSrgb" = "sRGB சாஃப்ட்-ப்ரூஃப்" +"view.prototype" = "ப்ரோட்டோடைப் பேனல்" +"view.rulers" = "அளவுகோல்கள்" +"view.set" = "காட்சியை அமை" +"view.slices" = "ஸ்லைஸ்கள்" +"view.snapGeometry" = "வடிவியலுடன் ஒட்டு" +"view.snapObjects" = "பொருள்களுடன் ஒட்டு" +"view.snapPixel" = "பிக்சல் கட்டத்துடன் ஒட்டு" +"view.themeDark" = "இருண்ட தீம்" +"view.themeLight" = "வெளிர் தீம்" +"view.themeSystem" = "சிஸ்டம் தீமைப் பின்பற்று" +"view.toggleUi" = "UI-ஐக் காட்டு/மறை" +"view.zoom100" = "100%க்கு ஜூம்செய்" +"view.zoom200" = "200%க்கு ஜூம்செய்" +"view.zoom50" = "50%க்கு ஜூம்செய்" +"view.zoomAt" = "ஜூம் கருவி" +"view.zoomFit" = "பொருந்தும்படி ஜூம்செய்" +"view.zoomIn" = "பெரிதாக்கு" +"view.zoomOut" = "சிறிதாக்கு" +"view.zoomSelection" = "தேர்வுக்கு ஜூம்செய்" +"widget.click" = "விட்ஜெட்டைக் கிளிக்செய்" +"widget.insert" = "விட்ஜெட்டைச் செருகு" +"widget.list" = "விட்ஜெட்களைப் பட்டியலிடு" +"widget.menu" = "விட்ஜெட் மெனு" +"widget.setText" = "விட்ஜெட் புலத்தைத் திருத்து" +"window.focus" = "சாளரத்தை முன்னே கொண்டுவா" +"window.new" = "புதிய சாளரம்" + +[menu] +"bool.exclude" = "விலக்கு" +"bool.flatten" = "தட்டையாக்கு" +"bool.intersect" = "குறுக்கிடு" +"bool.subtract" = "கழி" +"bool.union" = "ஒன்றிணை" +"file.duplicate" = "நகல்செய்" +"file.import" = "கோப்பிலிருந்து இறக்குமதிசெய்…" +"file.rename" = "மறுபெயரிடு" +"libraries.open" = "லைப்ரரிகளைத் திற" +"select.sameEffect" = "எஃபெக்ட்" +"select.sameFill" = "ஃபில்" +"select.sameFont" = "எழுத்துரு" +"select.sameInstance" = "இன்ஸ்டன்ஸ்" +"select.sameProperties" = "பண்புகள்" +"select.sameStroke" = "ஸ்ட்ரோக்" +"select.sameText" = "உரைப் பண்புகள்" +"text.alignCenter" = "உரையை நடுவில் சீரமை" +"text.alignJustify" = "உரையை இருபுறமும் சீரமை" +"text.alignLeft" = "உரையை இடப்புறம் சீரமை" +"text.alignRight" = "உரையை வலப்புறம் சீரமை" +"view.assets" = "அசெட்கள்" +"view.design" = "டிசைன்" +"view.layers" = "லேயர்கள்" +"view.outlines" = "அவுட்லைன்களைக் காட்டு" +"view.outlinesHiddenLayers" = "மறைந்த லேயர்களைச் சேர்" +"view.outlinesObjectBounds" = "பொருள் எல்லைகளைச் சேர்" +"view.outlinesSelection" = "தேர்வுக்கு அவுட்லைன்களைக் காட்டு" +"view.prototype" = "ப்ரோட்டோடைப்" +"view.themeDark" = "இருண்ட" +"view.themeLight" = "ஒளிர்வான" +"view.themeSystem" = "சிஸ்டத்தைப் பின்பற்று" diff --git a/crates/ui-egui/src/cjk.rs b/crates/ui-egui/src/cjk.rs index 18616671a..361873aee 100644 --- a/crates/ui-egui/src/cjk.rs +++ b/crates/ui-egui/src/cjk.rs @@ -131,6 +131,11 @@ fn shows(code: &str, web: bool) -> bool { // Arabic; keep the catalog out until an embedded Arabic fallback is supplied. return figcraft_text::face_with_char('ع', &["Noto Sans Arabic"]).is_some(); } + if code.split('-').next() == Some("ta") { + // Desktop draws Tamil with a system face (#2018); the web has none until craft-fonts + // carries Noto Sans Tamil. + return figcraft_text::face_with_char('த', &["Noto Sans Tamil"]).is_some(); + } let need = language(code); need == 0 || samples(need, 0, traditional(code)).iter().all(|(c, families)| figcraft_text::face_with_char(*c, families).is_some()) } @@ -228,6 +233,14 @@ mod tests { assert_eq!(shows("ar-SA", true), face); } + #[test] + fn the_web_offers_tamil_only_with_its_face() { + assert!(shows("ta", false), "desktop always lists Tamil"); + let face = figcraft_text::face_with_char('த', &["Noto Sans Tamil"]).is_some(); + assert_eq!(shows("ta", true), face); + assert_eq!(shows("ta-IN", true), face); + } + /// The UI language's script leads the fallback order; the others follow. #[test] fn the_ui_language_script_comes_first() { diff --git a/docs/translating.md b/docs/translating.md index 5f647816b..8bad40f0f 100644 --- a/docs/translating.md +++ b/docs/translating.md @@ -24,6 +24,8 @@ assistance and reviewed by a native speaker, and stays a draft until a maintaine Russian (`ru`, Русский) was reviewed and approved by VanTan; its catalog keeps Frame and Smart animate as familiar tool names and uses « » quotes. Turkish (`tr`) was machine-drafted and reviewed by a native speaker, and Swedish (`sv`) translates every UI string, command label and menu wording. +Tamil (`ta`, தமிழ்) was machine-drafted and reviewed by a native speaker, and stays a draft until a +maintainer changes its status. ## The catalogs @@ -76,7 +78,11 @@ written in Latin script with ijekavian forms and Bosnian words (historija, hilja sedmica), uses bare imperatives for buttons and menu items (Sačuvaj, Izbriši) and the formal Vi for instructions (Odaberite, Kliknite), „ “ quotes, and consistent design terms (okvir, sloj, komponenta, instanca, varijanta, automatski raspored, ograničenja, ispuna, obrub, efekat, varijabla, -stil, način for a variable mode, dodatak for a plugin). +stil, način for a variable mode, dodatak for a plugin). Tamil uses modern written Tamil, bare +imperatives for buttons and menu items (சேமி, நீக்கு), the polite -கவும் for instructions +(தேர்ந்தெடுக்கவும்), Western digits, and design terms in Tamil script as Tamil designers say them +(ஃப்ரேம், லேயர், காம்போனென்ட், இன்ஸ்டன்ஸ், ஆட்டோ லேஅவுட்) while everyday words are translated +(கோப்பு, பக்கம், நிறம், ஏற்றுமதி). A case ending follows a placeholder after a space (`{name} கோப்பை`). CJK and Thai text need their own fonts, which egui and Inter lack: the desktop app adds an installed one when something on screen needs it, so layer and page names in those scripts show whatever the @@ -117,6 +123,17 @@ that face out, so Arabic is not offered on the web yet. No font is added to this repository. The interface's panels are not mirrored; this catalog does not claim a complete right-to-left interface. Native review and representative in-app checks remain required. +## Tamil draft + +`ta.toml` adds தமிழ் as a draft: 2,012 UI entries, 630 command labels and 31 menu wordings +(2,673 entries, measured 2026-11-09), covering every English key. Drafted with AI assistance against a +fixed style guide and glossary, then reviewed by a native speaker (#2159). + +The desktop UI draws Tamil in an installed face (Tamil Sangam MN, Nirmala UI or Noto Sans Tamil, +#2018); no font is added to this repository. The web picker leaves Tamil out until craft-fonts has +Noto Sans Tamil. Tamil runs longer than English: the left rail's Variables label and the frame type +dropdown cut it off. + ## Traditional Chinese (Taiwan) draft `zh-Hant.toml` adds 繁體中文(台灣) as a draft: 1,975 UI entries, 641 command labels and 31 menu From 5c50025270fac9ec187db56416f965eaa8fdc5ea Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 08:37:11 -0500 Subject: [PATCH 076/239] M7: a connection dropped on a sibling variant creates Change to (#2158) A connection dragged from a variant (or a layer in it) onto a sibling variant of its set now creates Change to that variant (On click, Instant) and outlines the sibling while dragging, as measured in Figma. The set background and the variant itself add nothing; a frame outside the set still gets Navigate to. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 measured in Figma and wrote at medium --- crates/ui-egui/src/canvas/proto_canvas.rs | 56 +++++++- crates/ui-egui/src/lib.rs | 2 + .../src/proto_variant_connect_tests.rs | 126 ++++++++++++++++++ docs/prototyping-parity.md | 4 +- 4 files changed, 180 insertions(+), 8 deletions(-) create mode 100644 crates/ui-egui/src/proto_variant_connect_tests.rs diff --git a/crates/ui-egui/src/canvas/proto_canvas.rs b/crates/ui-egui/src/canvas/proto_canvas.rs index 1178ed6b2..b6955e956 100644 --- a/crates/ui-egui/src/canvas/proto_canvas.rs +++ b/crates/ui-egui/src/canvas/proto_canvas.rs @@ -119,7 +119,7 @@ fn segment_distance(a: Pos2, b: Pos2, q: Pos2) -> f32 { } /// Handle centres of the selected layers (right edge, vertically centred). -fn handles(app: &FigApp, doc: &Document, sel: &[NodeId]) -> Vec<(NodeId, Pos2)> { +pub(crate) fn handles(app: &FigApp, doc: &Document, sel: &[NodeId]) -> Vec<(NodeId, Pos2)> { sel.iter() .take(32) .filter(|i| doc.node(**i).is_some_and(|n| !n.is_page())) @@ -135,6 +135,46 @@ fn frame_at(app: &FigApp, doc: &Document, page: NodeId, p: Pos2) -> Option NodeId { + match self { + Target::Navigate(n) | Target::ChangeTo(n) => n, + } + } +} + +/// The variant (a child of a component set) the layer is, or sits inside. +fn variant_of(doc: &Document, source: NodeId) -> Option { + let is_set = |i: NodeId| doc.node(i).is_some_and(|n| matches!(n.kind, figcraft_doc::NodeKind::ComponentSet { .. })); + std::iter::once(source).chain(doc.ancestors(source)).find(|v| doc.node(*v).and_then(|n| n.parent).is_some_and(is_set)) +} + +/// What a connection dragged from `source` and released at screen point `p` targets: a sibling +/// variant of the source's own variant (Change to), else a frame other than the source's own +/// (Navigate to). +fn target_at(app: &FigApp, doc: &Document, page: NodeId, source: NodeId, p: Pos2) -> Option { + if let Some(v) = variant_of(doc, source) + && let Some(set) = doc.node(v).and_then(|n| n.parent) + && doc.node(set).is_some_and(|n| matches!(n.kind, figcraft_doc::NodeKind::ComponentSet { .. })) + { + let pt = app.to_page(p); + let siblings = doc.node(set).map(|n| n.children.clone()).unwrap_or_default(); + if let Some(w) = siblings.into_iter().rev().find(|w| doc.world_bounds(*w).is_some_and(|b| b.contains(pt))) { + return (w != v).then_some(Target::ChangeTo(w)); + } + } + frame_at(app, doc, page, p).filter(|f| doc.top_level_frame(source) != Some(*f)).map(Target::Navigate) +} + fn arrow(painter: &egui::Painter, pts: &[Pos2; 4], col: Color32) { let tip = pts[3]; let dir = (pts[3] - bezier(pts, 0.9)).normalized(); @@ -200,9 +240,8 @@ pub fn draw(app: &FigApp, painter: &egui::Painter) { } match dragging { Some(d) => { - if let Some(f) = frame_at(app, doc, page, d.pos) - && doc.top_level_frame(d.source) != Some(f) - && let Some(r) = screen_rect(app, doc, f) + if let Some(t) = target_at(app, doc, page, d.source, d.pos) + && let Some(r) = screen_rect(app, doc, t.node()) { painter.rect_stroke(r, CornerRadius::ZERO, Stroke::new(2.0, crate::theme::canvas_accent(painter.ctx())), StrokeKind::Outside); } @@ -259,9 +298,12 @@ pub fn input(app: &mut FigApp, ui: &egui::Ui, resp: &egui::Response) -> bool { ctx.request_repaint(); if released || !down { ctx.data_mut(|m| m.remove::(drag_id())); - if let Some(dest) = frame_at(app, &doc, page, d.pos) - && doc.top_level_frame(d.source) != Some(dest) - && let Some(r) = app.run("proto.interaction.add", json!({"ids": [d.source], "dest": dest})) + let params = target_at(app, &doc, page, d.source, d.pos).map(|t| match t { + Target::Navigate(dest) => json!({"ids": [d.source], "dest": dest}), + Target::ChangeTo(dest) => json!({"ids": [d.source], "action": {"type": "changeTo", "dest": dest}}), + }); + if let Some(params) = params + && let Some(r) = app.run("proto.interaction.add", params) { let k = r.get("index").and_then(Value::as_u64).unwrap_or(0) as usize; crate::proto_panel::open_editor(&ctx, Some((d.source, k))); diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 60c68f526..a9e620a7f 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -233,6 +233,8 @@ mod proto_reorder_tests; #[cfg(test)] mod proto_responsive_tests; #[cfg(test)] +mod proto_variant_connect_tests; +#[cfg(test)] mod region_fill_rows_tests; #[cfg(test)] mod resources_tests; diff --git a/crates/ui-egui/src/proto_variant_connect_tests.rs b/crates/ui-egui/src/proto_variant_connect_tests.rs new file mode 100644 index 000000000..b9f6ba812 --- /dev/null +++ b/crates/ui-egui/src/proto_variant_connect_tests.rs @@ -0,0 +1,126 @@ +//! A connection dragged out of a variant (or a layer in it) onto a sibling variant makes a Change +//! to it (On click, Instant), as in Figma (#2158); onto the set's background or its own variant it +//! makes nothing, and onto a frame outside the set it still navigates. + +use egui::{Pos2, pos2}; +use figcraft_doc::NodeId; +use figcraft_doc::proto::{Action, Transition, Trigger}; +use figcraft_engine::Session; +use serde_json::json; + +use crate::FigApp; +use crate::RightTab; +use crate::canvas::proto_canvas::handles; +use crate::present_tests::{Ui, id}; + +fn screen_centre(app: &FigApp, n: NodeId) -> Pos2 { + let b = app.session.doc().unwrap().world_bounds(n).unwrap(); + app.to_screen((b.x0 + b.x1) / 2.0, (b.y0 + b.y1) / 2.0) +} + +struct Setup { + u: Ui, + set: NodeId, + default: NodeId, + hover: NodeId, + layer: NodeId, + outside: NodeId, +} + +fn setup() -> Setup { + let mut s = Session::new(); + let mut variant = |name: &str, x: f64| { + let f = id(&s.execute("frame.create", &json!({"x": x, "y": 0, "width": 100, "height": 80, "name": name})).unwrap()); + id(&s.execute("component.create", &json!({"ids": [f]})).unwrap()) + }; + let default = variant("Property 1=Default", 0.0); + let hover = variant("Property 1=Hover", 300.0); + let layer = id(&s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 30, "height": 20, "parent": default})).unwrap()); + let outside = id(&s.execute("frame.create", &json!({"x": 0, "y": 500, "width": 200, "height": 150, "name": "Outside"})).unwrap()); + let set = id(&s.execute("component.combineVariants", &json!({"ids": [default, hover]})).unwrap()); + let mut u = Ui::new(s); + u.app.ui.right_tab = RightTab::Prototype; + Setup { u, set, default, hover, layer, outside } +} + +/// Select `source`, then drag its connection handle to the centre of `to` (or `at`) and release. +fn drag(t: &mut Setup, source: NodeId, to: Pos2) { + t.u.run("select.set", json!({"ids": [source]})); + t.u.run("view.zoomSelection", json!({})); + t.u.run("view.zoomFit", json!({})); + t.u.frames(2, Vec::new); + let doc = t.u.app.session.doc().unwrap().clone(); + let (_, at) = *handles(&t.u.app, &doc, &[source]).first().unwrap(); + t.u.button(at, true); + t.u.button(pos2((at.x + to.x) / 2.0, (at.y + to.y) / 2.0), true); + t.u.button(to, true); + t.u.button(to, false); + t.u.frames(2, Vec::new); +} + +fn interactions(t: &Setup, n: NodeId) -> Vec { + t.u.app.session.doc().unwrap().node(n).unwrap().interactions.clone() +} + +fn assert_change_to(t: &Setup, source: NodeId, dest: NodeId) { + let its = interactions(t, source); + assert_eq!(its.len(), 1, "{its:?}"); + assert_eq!(its[0].trigger, Trigger::OnClick); + assert_eq!(its[0].transition, Transition::Instant); + assert!(matches!(its[0].actions.as_slice(), [Action::ChangeTo { dest: d }] if *d == dest), "{:?}", its[0].actions); + assert_eq!(crate::proto_panel::editor(&t.u.ctx), Some((source, 0))); +} + +#[test] +fn a_variants_connection_dropped_on_a_sibling_variant_changes_to_it() { + let mut t = setup(); + let to = screen_centre(&t.u.app, t.hover); + let src = t.default; + drag(&mut t, src, to); + assert_change_to(&t, t.default, t.hover); +} + +#[test] +fn the_reverse_connection_changes_back() { + let mut t = setup(); + let to = screen_centre(&t.u.app, t.default); + let src = t.hover; + drag(&mut t, src, to); + assert_change_to(&t, t.hover, t.default); +} + +#[test] +fn a_layer_inside_a_variant_changes_its_set_to_the_sibling() { + let mut t = setup(); + let to = screen_centre(&t.u.app, t.hover); + let src = t.layer; + drag(&mut t, src, to); + assert_change_to(&t, t.layer, t.hover); +} + +#[test] +fn dropped_on_the_sets_background_or_its_own_variant_it_adds_nothing() { + let mut t = setup(); + // Between the two variants (x 100..300) and inside the set's padding. + let (a, b) = (screen_centre(&t.u.app, t.default), screen_centre(&t.u.app, t.hover)); + let gap = pos2((a.x + b.x) / 2.0, a.y); + let src = t.default; + drag(&mut t, src, gap); + assert!(interactions(&t, t.default).is_empty()); + let own = screen_centre(&t.u.app, t.default); + let src = t.default; + drag(&mut t, src, own); + assert!(interactions(&t, t.default).is_empty()); + let _ = t.set; +} + +#[test] +fn a_variant_dropped_on_a_frame_outside_the_set_still_navigates() { + let mut t = setup(); + let to = screen_centre(&t.u.app, t.outside); + let src = t.default; + drag(&mut t, src, to); + let its = interactions(&t, t.default); + assert_eq!(its.len(), 1, "{its:?}"); + assert!(matches!(its[0].actions.as_slice(), [Action::Navigate { dest, .. }] if *dest == t.outside), "{:?}", its[0].actions); +} diff --git a/docs/prototyping-parity.md b/docs/prototyping-parity.md index 7c216bcae..07e3c691d 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-11-06 · **Change:** patch (`proto.settings` refuses an unknown device with the list of devices instead of saving it, takes a known one in any case, and answers the page's settings, so `proto.settings {}` reads them (#2027); 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) +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-11-09 · **Change:** patch (a connection dragged from a variant, or a layer in it, onto a sibling variant makes Change to, On click, Instant, with the sibling outlined (#2158); `proto.settings` refuses an unknown device with the list of devices instead of saving it, takes a known one in any case, and answers the page's settings, so `proto.settings {}` reads them (#2027); 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, @@ -57,6 +57,7 @@ tool; opt-in), **silent** (the documentation doesn't say; the case pins the curr | Open link | pass | a new tab or browser window by default; with "Open in new tab" off, the web build's own tab goes to the link (the desktop app has no tab of its own to replace, so it opens the browser either way) | | Change to: another variant of the instance, in place, with the interaction's animation | pass | `interactive_components_change_in_place` | | Interactive components: every instance plays the interactions of the variant it shows; an interaction on the instance with the same trigger wins | **fixed** | instances played only interactions copied onto them when they were placed: an instance placed before its main got interactions did nothing, and one placed after kept the first variant's interactions after changing (a toggle went on but never off). New instances no longer copy them, and copies in older files give way to the variant shown; `instances_play_their_variants_interactions` | +| Drag a variant's (or a layer in it) connection onto a sibling variant: Change to, On click, Instant; the sibling is outlined | **fixed** | the drop only found top-level frames, and a variant's top-level frame is its set, so nothing happened. Dropped on the set's background or on its own variant it still adds nothing; on a frame outside the set it still navigates. Measured in Figma's web app, 2026-11-09; `a_variants_connection_dropped_on_a_sibling_variant_changes_to_it`, `the_reverse_connection_changes_back`, `a_layer_inside_a_variant_changes_its_set_to_the_sibling`, `dropped_on_the_sets_background_or_its_own_variant_it_adds_nothing`, `a_variant_dropped_on_a_frame_outside_the_set_still_navigates` | | Presentation tabs: one per page of a file, named "file - page" (renames follow). Play on a page that has a tab shows it as it was (from another start frame it starts again). Tabs keep their own copy of the prototype and play on after their file closes; a saved file opened again gets its tabs back. A tab never changes a file that isn't in front. Its X or Escape ends it and goes back to its file, or Home | **fixed** | one "Present" tab: a second presentation replaced the first, Play restarted it, and closing the file ended it; `present_tab_tests` | | Change to on a layer inside a nested instance changes the instance whose variant set holds the destination | **fixed** | the innermost instance (an icon inside a button) was changed instead | | Set variable, set variable mode, conditional | pass | `proto_run_tests`, `proto_conditional_tests`, `present_variables_tests` | @@ -107,6 +108,7 @@ tool; opt-in), **silent** (the documentation doesn't say; the case pins the curr | Date | Change | Summary | |---|---|---| +| 2026-11-09 | patch | M7, #2158: a connection dragged from a variant (or a layer in it) onto a sibling variant of its set did nothing, because the drop looked only for top-level frames and a variant's top-level frame is its set. It now creates Change to the sibling (On click, Instant, as measured in Figma's web app) and outlines the sibling while dragging; the set's background and the variant itself still add nothing, and a frame outside the set still gets Navigate to | | 2026-11-06 | patch | M5, #2027: `proto.settings` took any string as the device (`"Pixel Nonexistent"`, `"iphone 16"`) and saved it in the file; the presenter then drew no device while its picker showed the name as if it were one, and the settings couldn't be read back over MCP (`proto.settings {}` answered `{ok: true}`). An unknown name (or a non-string) is now refused with every name the picker offers (`None`, `Custom size` and the devices), as an unknown colour is refused with the device's colours, and nothing changes; a known name is taken in any case and stored as the picker spells it. Every call answers the page's settings after it: device, background, rotation, the colour shown, the screen as presented, the custom size and responsive. Test: `proto_present_tests::unknown_devices_are_refused_and_settings_read_back` | | 2026-10-31 | minor | Gap 15: the Controller menu names buttons as PlayStation and Switch controllers do; that item leaves the missing list. Estimate unchanged. Test: `present::tail_tests`. | | 2026-10-30 | minor | Opening a link in place: Open link has "Open in new tab", on by default; off, the web build's own tab goes to the link after the notice (or at once with it skipped); the desktop app has no tab of its own and opens the browser either way. Saved in files only when off (`openInNewTab`) and read from REST files. | From 2beec8b3712e46b9420f0d08d5255f8a8f971d22 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 08:38:05 -0500 Subject: [PATCH 077/239] M3: the text caret takes the text's fill colour (#2156) Figma draws the text caret in the text's solid fill colour (measured in the web app, 2026-11-09). The overlay took the character before the caret, its run's fills or the layer's, and drew the topmost visible solid opaque; gradient, image and hidden fills keep the interface colour. Width, height, selection and collaborators' carets are unchanged. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 measured in Figma and wrote at medium --- crates/ui-egui/src/canvas/overlays.rs | 86 ++++++++++++++++++++++++++- docs/ui-parity.md | 5 +- 2 files changed, 88 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/canvas/overlays.rs b/crates/ui-egui/src/canvas/overlays.rs index f4ce8cce0..f0692fbfc 100644 --- a/crates/ui-egui/src/canvas/overlays.rs +++ b/crates/ui-egui/src/canvas/overlays.rs @@ -209,6 +209,26 @@ fn layout_grids(app: &FigApp, painter: &egui::Painter, doc: &Document, c: NodeId } } +/// The solid colour of the fill the next typed character gets (the character before the caret, +/// the first one's at 0, the base style for an empty text): the style's own fills when it has +/// them, else the layer's. `None` when the topmost visible paint isn't a solid (gradient, image, +/// no visible fill), so the caller keeps the interface colour. Opaque on purpose: Figma's caret +/// is one colour, and the fill's and paint's opacity weren't measured, so it must stay visible. +fn caret_fill(n: &figcraft_doc::Node, caret: usize) -> Option { + let t = n.kind.text()?; + let style = t.style_at(caret.saturating_sub(1)); + let paints = style.fills.as_ref().unwrap_or(&n.fills); + paints.iter().rev().find(|p| p.visible).and_then(|p| match &p.kind { + figcraft_color::PaintKind::Solid { color } => Some(color.with_alpha(1.0)), + _ => None, + }) +} + +/// [`caret_fill`] as a screen colour. +fn caret_color(ctx: &egui::Context, n: &figcraft_doc::Node, caret: usize) -> Option { + caret_fill(n, caret).map(|c| doc_c32(ctx, c)) +} + fn text_edit_overlay(app: &FigApp, painter: &egui::Painter, t: &Tokens, doc: &Document, te: &figcraft_engine::TextEdit, zoom: f64) { let preedit = app.preedit_view(); let edoc: &Document = preedit.map(|p| &*p.doc).unwrap_or(doc); @@ -242,7 +262,8 @@ fn text_edit_overlay(app: &FigApp, painter: &egui::Painter, t: &Tokens, doc: &Do let caret = preedit.map(|p| p.cursor).unwrap_or(te.caret); let blink = (painter.ctx().input(|i| i.time) * 2.0) as i64 % 2 == 0; if blink || a != b { - painter.line_segment(text.caret(app, caret, zoom), stroke(t.text, 1.0)); + let col = edoc.node(te.id).and_then(|n| caret_color(painter.ctx(), n, caret)).unwrap_or(t.text); + painter.line_segment(text.caret(app, caret, zoom), stroke(col, 1.0)); } painter.ctx().request_repaint_after(std::time::Duration::from_millis(500)); } @@ -782,3 +803,66 @@ fn pick_outline(app: &FigApp, painter: &egui::Painter, doc: &Document) { draw_outline(app, painter, doc, p, stroke(crate::handles::PINK, 2.0)); } } + +#[cfg(test)] +mod caret_tests { + use super::*; + use figcraft_color::{Color, Paint}; + use figcraft_doc::{Node, NodeId, NodeKind, StyleRun, TextData}; + + fn text(chars: &str, fills: Vec) -> Node { + let mut n = Node::new(NodeId(1), NodeKind::Text(TextData { characters: chars.into(), ..TextData::default() }), "Text", 100.0, 20.0); + n.fills = fills; + n + } + + fn hex(s: &str) -> Color { + Color::from_hex(s).unwrap() + } + + #[test] + fn red_text_has_a_red_caret() { + let n = text("Caret", vec![Paint::solid(hex("#FF0000"))]); + assert_eq!(caret_fill(&n, 2), Some(hex("#FF0000"))); + assert_eq!(caret_color(&egui::Context::default(), &n, 2), Some(Color32::from_rgb(255, 0, 0))); + } + + #[test] + fn light_grey_text_keeps_its_own_colour_whatever_is_behind_it() { + // Inside a #222222 frame: the frame's fill plays no part. + let n = text("Caret", vec![Paint::solid(hex("#DDDDDD"))]); + assert_eq!(caret_fill(&n, 5), Some(hex("#DDDDDD"))); + assert_eq!(caret_color(&egui::Context::default(), &n, 0), Some(Color32::from_rgb(0xDD, 0xDD, 0xDD))); + } + + #[test] + fn the_caret_follows_the_run_of_the_character_before_it() { + let mut n = text("ab cd", vec![Paint::solid(hex("#000000"))]); + if let Some(t) = n.kind.text_mut() { + let mut style = t.style.clone(); + style.fills = Some(vec![Paint::solid(hex("#FF0000"))]); + t.runs.push(StyleRun { start: 3, end: 5, style }); + } + assert_eq!(caret_fill(&n, 2), Some(hex("#000000")), "after a black character"); + assert_eq!(caret_fill(&n, 4), Some(hex("#FF0000")), "after a red character"); + assert_eq!(caret_fill(&n, 0), Some(hex("#000000")), "at the start: the first character's"); + } + + #[test] + fn the_caret_is_opaque_whatever_the_fill_opacity() { + let mut p = Paint::solid(hex("#336699")); + p.opacity = 0.2; + assert_eq!(caret_fill(&text("x", vec![p]), 1).map(|c| c.a), Some(1.0)); + } + + #[test] + fn gradient_or_missing_fills_keep_the_interface_colour() { + let mut g = Paint::solid(hex("#FF0000")); + g.kind = figcraft_color::PaintKind::Gradient(figcraft_color::Gradient::default_for(figcraft_color::GradientKind::Linear, hex("#FF0000"))); + assert_eq!(caret_fill(&text("Caret", vec![g]), 2), None); + assert_eq!(caret_fill(&text("Caret", vec![]), 2), None); + let mut hidden = Paint::solid(hex("#FF0000")); + hidden.visible = false; + assert_eq!(caret_fill(&text("Caret", vec![hidden]), 2), None); + } +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..ab4b6cb8f 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** minor (the text caret takes the text's solid fill colour (#2156); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -95,7 +95,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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). 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); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | -| 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: point, auto height, fixed; caret, words, lines, IME | done | Backspace or Delete at the start of a list item takes its marker and keeps its level, the paragraph starting where the item's text did ("delete the counter, but keep the same level of indentation", Create bulleted and numbered lists; `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests`); max lines on auto-width text keep it auto width, hugging up to that many lines and growing with its longest line ("Text resizing is set to auto height or auto width", Explore text properties; `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines`); Alt+Enter while editing opens the link at the caret, web and mail links only (`text.openLink`; "press ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma; `text_link_tests`); the font picker previews a family on the canvas while hovered (no undo step; Escape restores, #653) and Up/Down step through it (#352); a selection highlight after a line break starts at that line's start and an empty last line shows its mark (#665); carets step over whole emoji and accented letters; colour emoji draw from their colour tables (#300); IME composition replayed in tests as macOS sends it, not yet checked on a Mac (#747); CJK words by script run (no dictionary); vertical trim in Type settings; the caret takes the text's solid fill colour, measured in Figma's web app, 2026-11-09; gradient and image fills keep the interface colour (not measured) (#2156; `caret_tests`); no spell check | | Text: wrap style (Auto, Balance, Pretty) | done | per text layer (`wrapStyle` on `node.set`, `text.wrapStyle`, the Type settings control under Vertical trim, inspect, CSS `text-wrap: balance` or `pretty`): Auto breaks greedily; Balance narrows each paragraph as far as it goes without another line, so its lines come out close to the same length (what browsers do for `text-wrap: balance`); Pretty keeps lines full and, when the last line is one word, narrows one of the last four lines just enough to give a word to the lines after it (Explore text properties: "Auto: Figma fits as many words as possible on each line before wrapping to the next", "Balance: Figma distributes text as evenly as possible across every line, so each line is close to the same length", "Pretty: Figma keeps each line full, but adjusts the last four lines to avoid an orphan"). Saved line breaks from a file still win. Not yet included: per-paragraph settings, text-style support and the `.fig` import/export mapping (#1827). Test: `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented` | | Text: direction override (Text ▸ Text direction) | done | per paragraph (`ParaList::direction`: auto, ltr, rtl): Text ▸ Text direction ▸ Auto / Left to right / Right to left and `text.direction {direction, ids?}` set the edited paragraphs while editing, else every paragraph of the selected texts; `node.set textDirection` the layer's (or the chars `start`/`end` name); the Type settings control appears once a right-to-left script is in the text or a direction is forced; inspect reports `textDirection` when the paragraphs agree and `lineDirections` otherwise; Developer Mode's CSS writes `direction: ltr` or `rtl` when every paragraph is forced the same way (with `text-align: left` beside `rtl`, as Left is absolute on the canvas); `.fig` import and export carry each line's `sourceDirectionality`, read up to the paragraph count. Layout gives the paragraph its base level, so a forced right-to-left paragraph of Latin letters starts at the right, mirrors its list gutter and indent and orders its runs right to left, and a forced left-to-right paragraph of Hebrew the other way ("By default, Figma automatically handles text direction based on language detection. However, controls are available to override text direction per paragraph", "Go to Text > Text direction. Select Left to right or Right to left", Add right-to-left text). Not included: a direction in text styles (the article names none). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests` | | 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` | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start), opaque; gradient, image and hidden fills keep the interface colour (not measured). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 1ee3087bc97fc1476a4026ab53fef32c851cbc05 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 08:46:12 -0500 Subject: [PATCH 078/239] M12: a sticky's text keeps its size and the note grows taller (#2157) FigJam's sticky text is 18 (Small) and never changes as the note fills; the note keeps its width and grows taller (measured in the web app, 2026-11-09). A new sticky's text is STICKY_TEXT_SIZE (18) and the normalize pass no longer resets a sticky's text size by its length, so saved stickies keep the size they have. No size menu yet. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 measured in Figma and wrote at medium --- crates/doc/src/board.rs | 4 +- crates/engine/src/board_tests.rs | 71 ++++++++++++++++++++--- crates/engine/src/boards/board.rs | 2 +- crates/engine/src/boards/board/derived.rs | 19 +----- crates/engine/src/boards/board/items.rs | 17 ++---- docs/boards-parity.md | 5 +- 6 files changed, 76 insertions(+), 42 deletions(-) diff --git a/crates/doc/src/board.rs b/crates/doc/src/board.rs index 89413b2e9..c0fcd7c68 100644 --- a/crates/doc/src/board.rs +++ b/crates/doc/src/board.rs @@ -37,8 +37,8 @@ impl FileKind { #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "camelCase")] pub enum BoardItem { - /// A sticky note: a frame whose first text layer is the note (its size shrinks as the note - /// grows) and, below it, who wrote it. + /// A sticky note: a frame whose first text layer is the note (its size stays fixed, the note + /// grows taller) and, below it, who wrote it. Sticky { #[serde(default, skip_serializing_if = "String::is_empty")] author: String, diff --git a/crates/engine/src/board_tests.rs b/crates/engine/src/board_tests.rs index 9e99bd1c9..1b0ac120c 100644 --- a/crates/engine/src/board_tests.rs +++ b/crates/engine/src/board_tests.rs @@ -7,7 +7,7 @@ use figcraft_doc::{ use figcraft_geom::Point; use serde_json::{Value, json}; -use crate::board::{route, sticky_font_size}; +use crate::board::{STICKY_TEXT_SIZE, route}; use crate::collab_live_tests::Room; use crate::tools::{PointerEvent, PointerKind, ToolId}; use crate::{EngineError, Session}; @@ -77,7 +77,7 @@ fn board_commands_refuse_on_design_files_and_prototyping_refuses_on_boards() { } #[test] -fn a_sticky_is_a_square_frame_whose_note_shrinks_as_it_grows() { +fn a_sticky_is_a_square_frame_whose_note_grows_taller_as_it_fills() { let mut s = board(); s.prefs.user_name = "Ada".into(); let r = s.execute("board.sticky", &json!({"x": 10, "y": 20, "text": "Hi", "color": "blue"})).unwrap(); @@ -88,19 +88,74 @@ fn a_sticky_is_a_square_frame_whose_note_shrinks_as_it_grows() { assert_eq!(n.fills[0].solid_color(), board_color("blue")); assert!(n.layout.is_some() && !n.effects.is_empty()); assert_eq!(n.children.len(), 2, "the note and its author"); - assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 24.0); + assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 18.0); // A click on the note picks the sticky whole. let doc = s.doc().unwrap(); assert_eq!(figcraft_doc::geometry::select_target(doc, note, &[], false), st); - // A long note takes a smaller size; a very long one grows the sticky past its square. + // A long note keeps the size; a very long one grows the sticky past its square. let long = "word ".repeat(120); s.execute("node.set", &json!({"id": note, "props": {"characters": long}})).unwrap(); - assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, sticky_font_size(&long)); - assert!(sticky_font_size(&long) < 16.0); + assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, STICKY_TEXT_SIZE); assert!(node(&s, st).width == 200.0 && node(&s, st).height >= 200.0); - // Undo puts the short note and its size back. + // Undo puts the short note back. s.execute("edit.undo", &json!({})).unwrap(); - assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 24.0); + assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 18.0); +} + +#[test] +fn a_new_sticky_starts_at_18() { + let mut s = board(); + for (cmd, p) in [("board.sticky", json!({"x": 0, "y": 0, "text": "Hi"})), ("board.sticky", json!({"x": 300, "y": 0}))] { + let note = id(&s.execute(cmd, &p).unwrap(), "text"); + assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 18.0); + } + let next = id(&s.execute("board.nextSticky", &json!({})).unwrap(), "text"); + assert_eq!(node(&s, next).kind.text().unwrap().style.font_size, 18.0); + assert_eq!(STICKY_TEXT_SIZE, 18.0); +} + +#[test] +fn a_sticky_keeps_its_text_size_as_text_is_added() { + let mut s = board(); + let r = s.execute("board.sticky", &json!({"x": 0, "y": 0, "text": "one"})).unwrap(); + let (st, note) = (id(&r, "id"), id(&r, "text")); + let (height, text_height) = (node(&s, st).height, node(&s, note).height); + // Typing in the note: each step is a real edit that runs the normalize pass. + crate::board::edit_text(&mut s, st).unwrap(); + for _ in 0..9 { + crate::textedit::key(&mut s, "Enter", false, false, false).unwrap(); + crate::textedit::insert(&mut s, "another line").unwrap(); + } + let ten = node(&s, note).kind.text().unwrap().clone(); + assert_eq!(ten.characters.matches('\n').count(), 9, "ten lines"); + assert_eq!(ten.style.font_size, 18.0); + // Growth needs text measured: a build without the craft-fonts input measures nothing (the same + // reason `a_double_click_types_in_the_cell...` fails there), so it is only checked where it is. + let measured = node(&s, note).height > text_height; + assert!(!measured || node(&s, st).height > height, "ten lines make the note taller"); + assert_eq!(node(&s, st).child_layout.sizing_v, figcraft_doc::Sizing::Hug, "the note hugs its text"); + let (w, h10) = (node(&s, st).width, node(&s, st).height); + crate::textedit::insert(&mut s, &"a long paragraph ".repeat(15)).unwrap(); + crate::textedit::end(&mut s).unwrap(); + let t = node(&s, note).kind.text().unwrap().clone(); + assert!(t.characters.chars().count() >= 250); + assert_eq!(t.style.font_size, 18.0); + assert!(t.runs.iter().all(|r| r.style.font_size == 18.0)); + assert_eq!(node(&s, st).width, w, "the note keeps its width"); + assert!(!measured || node(&s, st).height > h10, "and grows taller"); +} + +#[test] +fn a_sticky_saved_with_another_text_size_keeps_it() { + let mut s = board(); + let r = s.execute("board.sticky", &json!({"x": 0, "y": 0, "text": "old"})).unwrap(); + let (st, note) = (id(&r, "id"), id(&r, "text")); + s.execute("node.set", &json!({"id": note, "props": {"fontSize": 11}})).unwrap(); + assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 11.0); + s.execute("node.set", &json!({"id": note, "props": {"characters": "old and now much longer than it was"}})).unwrap(); + assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 11.0, "an edit"); + s.execute("node.set", &json!({"id": st, "props": {"x": 40}})).unwrap(); + assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 11.0, "a move"); } #[test] diff --git a/crates/engine/src/boards/board.rs b/crates/engine/src/boards/board.rs index 1a66eed22..158e679d4 100644 --- a/crates/engine/src/boards/board.rs +++ b/crates/engine/src/boards/board.rs @@ -68,8 +68,8 @@ pub(crate) use edit::{copied_items, copy_map, rejoin}; use edit::{label_cmd, set_color, set_style}; pub(crate) use items::add_text; pub use items::{CONNECTED_GAP, connected_place}; +pub use items::{STICKY_TEXT_SIZE, edit_text, owner_of_text, text_of}; use items::{add_connected, ink_cmd, next_sticky, shape_cmd, stamp_cmd, sticky_cmd}; -pub use items::{edit_text, owner_of_text, sticky_font_size, text_of}; pub(crate) use reshape::path_handle_at; pub use reshape::selected_connector_handles; diff --git a/crates/engine/src/boards/board/derived.rs b/crates/engine/src/boards/board/derived.rs index 9fae17206..37a2f9ba9 100644 --- a/crates/engine/src/boards/board/derived.rs +++ b/crates/engine/src/boards/board/derived.rs @@ -1,7 +1,6 @@ use figcraft_doc::RouteEnd; -use super::edit::set_font_size; -use super::items::{owner_of_text, shape_padding, sticky_font_size, text_of}; +use super::items::shape_padding; use super::{ Affine, BTreeSet, BezPath, BoardItem, Connector, Document, End, NodeId, NodeKind, PathEl, Point, Rect, Routing, Shape, VectorNetwork, is_board, }; @@ -9,26 +8,14 @@ use super::{ // --------------------------------------------------------------------------------------------- // Derived data (the normalize pass). -/// Before text is measured: a sticky's note takes the size its length calls for, and a resized -/// shape keeps its text inside its outline. +/// Before text is measured: a resized shape keeps its text inside its outline. A sticky's text +/// keeps whatever size it has (FigJam's size is the note's own setting). pub(crate) fn settle_text(doc: &mut Document, before: &Document, touched: &BTreeSet) { if !is_board(doc) { return; } for &id in touched { let Some(n) = doc.node(id) else { continue }; - if let Some(owner) = - owner_of_text(doc, id).or(Some(id)).filter(|o| doc.node(*o).is_some_and(|k| matches!(k.board, Some(BoardItem::Sticky { .. })))) - && let Some(t) = text_of(doc, owner) - && let Some(NodeKind::Text(td)) = doc.node(t).map(|k| &k.kind) - { - let size = sticky_font_size(&td.characters); - let off = td.style.font_size != size || td.runs.iter().any(|r| r.style.font_size != size); - if off && let Some(NodeKind::Text(td)) = doc.node_mut(t).map(|k| &mut k.kind) { - set_font_size(td, size); - } - continue; - } if let Some(BoardItem::Shape { shape }) = n.board && before.node(id).is_none_or(|b| (b.width, b.height) != (n.width, n.height)) { diff --git a/crates/engine/src/boards/board/items.rs b/crates/engine/src/boards/board/items.rs index b409eeb90..115ce6d3b 100644 --- a/crates/engine/src/boards/board/items.rs +++ b/crates/engine/src/boards/board/items.rs @@ -57,18 +57,9 @@ pub(crate) fn add_text(doc: &mut Document, parent: NodeId, text: &str, size: f64 Ok(id) } -/// The text size a sticky's note gets: smaller the more it holds (by characters and lines, so -/// every copy of the file picks the same size whatever fonts it has). -pub fn sticky_font_size(text: &str) -> f64 { - let weight = text.chars().count() + 24 * text.matches('\n').count(); - match weight { - 0..=24 => 24.0, - 25..=64 => 20.0, - 65..=140 => 16.0, - 141..=280 => 13.0, - _ => 11.0, - } -} +/// The text size of a new sticky's note, FigJam's "Small" default (measured in the web app, +/// 2026-11-09): it never changes as the note fills, the note grows taller instead. +pub const STICKY_TEXT_SIZE: f64 = 18.0; /// A sticky note's layers: the frame, the note and (when known) its author. fn make_sticky(doc: &mut Document, parent: NodeId, at: (f64, f64), text: &str, color: Color, author: &str) -> Result<(NodeId, NodeId)> { @@ -89,7 +80,7 @@ fn make_sticky(doc: &mut Document, parent: NodeId, at: (f64, f64), text: &str, c n.board = Some(BoardItem::Sticky { author: author.to_string() }); })?; let inner = STICKY - 2.0 * STICKY_PAD; - let note = add_text(doc, id, text, sticky_font_size(text), INK, TextAlignH::Left, inner)?; + let note = add_text(doc, id, text, STICKY_TEXT_SIZE, INK, TextAlignH::Left, inner)?; if !author.is_empty() { let a = add_text(doc, id, author, 10.0, AUTHOR_INK, TextAlignH::Left, inner)?; if let Some(n) = doc.node_mut(a) { diff --git a/docs/boards-parity.md b/docs/boards-parity.md index 16456492c..2cc099f08 100644 --- a/docs/boards-parity.md +++ b/docs/boards-parity.md @@ -1,6 +1,6 @@ # Boards parity -> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-04 · **Change:** minor (a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) +> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-09 · **Change:** minor (a sticky's text stays 18 and the note grows taller instead of the text shrinking, as measured in FigJam's web app (#2157); a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) **Breadth ~47%, ready ~29% (estimated, erring low).** A board is a FigCraft file of its own kind (`file.newBoard`) with a dot grid on the page, sticky notes, shapes with text, connectors that @@ -30,7 +30,7 @@ all end with the same geometry. | Board toolbar at the bottom | done | Move/Hand, Marker/Highlighter/Eraser, Sticky (colour flyout), Shapes (flyout), Connector, Text, Section, Stamp (flyout), Comment, Actions, then the templates and the Design panel's buttons — on the same 32 pt grid as a design file's (no Resources button, as there) | | Design panel hidden by default; a contextual bar above the selection | done | colour, shape, text size (S/M/L/XL); for connectors straight/elbow/curved, the start and end points (none, round, square, line arrow, triangle arrow, reversed triangle, circle, diamond), solid or dashed, the weight, and any colour in the colour picker beside the board colours (#1596); each control says what it is on hover; the Design panel opens with its button or View ▸ Design panel | | Prototyping and Developer Mode refuse on boards | done | `proto.*`, `dev.*`, `view.prototype`, `view.devMode` say why | -| Sticky notes | done | a square frame (200 wide, growing taller through auto layout), 8 soft colours, a soft shadow, the note's text size shrinking as it grows (24 → 11, by characters and lines), the author's name at the bottom; a click places one and starts typing; Enter or a double-click edits; Shift+Cmd/Ctrl+Enter adds the next one beside it | +| Sticky notes | done | a square frame (200 wide, growing taller through auto layout), 8 soft colours, a soft shadow, the note's text 18 by default and fixed (FigJam's "Small"): the note grows taller as it fills and never shrinks its text, measured in FigJam's web app, 2026-11-09; stickies saved with another size keep it, and there is no size menu yet (#2157), the author's name at the bottom; a click places one and starts typing; Enter or a double-click edits; Shift+Cmd/Ctrl+Enter adds the next one beside it | | Sticky options: hide the author, change size presets, sticky stacks | partial | `board.sticky {author: false}`; no size presets or stacks | | Shapes with text | done | rectangle, rounded rectangle, ellipse, diamond, triangle, speech bubble, chevron; text centred and wrapping inside the outline; shape type and text size from the contextual bar | | Shape auto-fit to its text, more shapes (cylinder, cross, star…), shape libraries | missing | | @@ -72,6 +72,7 @@ all end with the same geometry. | Date | Change | Summary | |---|---|---| +| 2026-11-09 | patch | M12, #2157: a sticky's text is 18 and stays 18 (measured in FigJam's web app: ten lines, then a long paragraph, never changed it; the note kept its width and grew taller). The normalize pass no longer resets a sticky's text to a size by its length (24 down to 11 before), so stickies in saved files keep their size. Size presets (Small to Huge) are still missing. Tests: `a_new_sticky_starts_at_18`, `a_sticky_keeps_its_text_size_as_text_is_added`, `a_sticky_saved_with_another_text_size_keeps_it` | | 2026-11-03 | minor | M12, #1919: as the quick create help says ("Click to select and create the next shape in that direction, or drag the preview to any location on your board"; "A new shape is created with a connector and its text field active"), a "+" beside the selected sticky or shape can be dragged: the preview follows the pointer and, let go on empty board, the next one is made there, centred on the pointer, and joined by a connector leaving by the handle's side and arriving by the side facing it (`board.addConnected` gains `at: [x, y]`, a point of the page placed in the parent's coordinates); let go on another sticky or shape, inside a section or frame too (`board::sticky_or_shape_at`), a connector joins the two instead (`board.connector`), that object outlined while the pointer is over it; let go off the canvas or over the toolbar, nothing, and the bar above the selection stays away meanwhile, as for any drag. The click is as before. A shape picker on drop and choosing the connector type are not done (the help doesn't describe them). Tests: `board_connect_tests` (the drag ones), engine `board_connected_tests::the_next_one_goes_where_it_is_dropped`. Numbers unchanged. | | 2026-11-04 | minor | M12, #1916: a connector end attached to a side starts 4 pt outside the border (`board_route::END_GAP`), as FigJam's do (the issue's screenshots: the line starts a few pixels outside, with a round cap), so the stroke never lies on the fill; elbows leaving one side share their first run along its normal, curves leave tangent to it and straight ones fan out from the same point; the `.jam` importer's routes, re-attached ends, path handles and labels follow the route's points; an end placed by hand with Cmd/Ctrl held keeps its exact point. Tests: `board_route_tests` (three). Numbers unchanged. | | 2026-11-04 | patch | M6, #1910: a `.jam` elbowed connector saved with its path (FigJam's `connectorControlPoints`) keeps it on import: the points become the `ConnectorPath::Runs` a connector reshaped by hand has and the line is walked along them, so a connector drawn around a layer stays around it; one whose points don't make a path from its ends' sides is routed as before. Still a vector, not a native board object. Details in [`file-format-parity.md`](file-format-parity.md). | From 36cd59dada3ca260a5e54e588078d3dbd745cff0 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 09:38:54 -0500 Subject: [PATCH 079/239] M7: a grouped component set's background takes no connection either (#2161 review) A set in a group has no top-level frame, so a drop on its background fell through to frame_at and made a Navigate to the section around it. target_at now returns nothing for any point inside the source's set that misses a sibling variant, as Figma does; red-first UI test with the set in a group in a section. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 checked the finding and wrote --- crates/ui-egui/src/canvas/proto_canvas.rs | 5 ++++ .../src/proto_variant_connect_tests.rs | 26 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/crates/ui-egui/src/canvas/proto_canvas.rs b/crates/ui-egui/src/canvas/proto_canvas.rs index b6955e956..3d7727f2c 100644 --- a/crates/ui-egui/src/canvas/proto_canvas.rs +++ b/crates/ui-egui/src/canvas/proto_canvas.rs @@ -171,6 +171,11 @@ fn target_at(app: &FigApp, doc: &Document, page: NodeId, source: NodeId, p: Pos2 if let Some(w) = siblings.into_iter().rev().find(|w| doc.world_bounds(*w).is_some_and(|b| b.contains(pt))) { return (w != v).then_some(Target::ChangeTo(w)); } + // The set's own background: nothing, as in Figma, whatever holds the set. (A set in a + // group has no top-level frame, so the fallback below would offer a section around it.) + if doc.world_bounds(set).is_some_and(|b| b.contains(pt)) { + return None; + } } frame_at(app, doc, page, p).filter(|f| doc.top_level_frame(source) != Some(*f)).map(Target::Navigate) } diff --git a/crates/ui-egui/src/proto_variant_connect_tests.rs b/crates/ui-egui/src/proto_variant_connect_tests.rs index b9f6ba812..db5f55a9d 100644 --- a/crates/ui-egui/src/proto_variant_connect_tests.rs +++ b/crates/ui-egui/src/proto_variant_connect_tests.rs @@ -28,6 +28,11 @@ struct Setup { } fn setup() -> Setup { + setup_in(false) +} + +/// `grouped`: the set is put in a group, inside a section around everything. +fn setup_in(grouped: bool) -> Setup { let mut s = Session::new(); let mut variant = |name: &str, x: f64| { let f = id(&s.execute("frame.create", &json!({"x": x, "y": 0, "width": 100, "height": 80, "name": name})).unwrap()); @@ -38,6 +43,12 @@ fn setup() -> Setup { let layer = id(&s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 30, "height": 20, "parent": default})).unwrap()); let outside = id(&s.execute("frame.create", &json!({"x": 0, "y": 500, "width": 200, "height": 150, "name": "Outside"})).unwrap()); let set = id(&s.execute("component.combineVariants", &json!({"ids": [default, hover]})).unwrap()); + if grouped { + let group = id(&s.execute("object.group", &json!({"ids": [set]})).unwrap()); + let section = id(&s.execute("node.create", &json!({"type": "section", "x": -200, "y": -200, "width": 1000, "height": 1000})).unwrap()); + s.execute("node.reparent", &json!({"ids": [group], "parent": section})).unwrap(); + assert_eq!(s.doc().unwrap().top_level_frame(default), None, "a set in a group has no top-level frame"); + } let mut u = Ui::new(s); u.app.ui.right_tab = RightTab::Prototype; Setup { u, set, default, hover, layer, outside } @@ -114,6 +125,21 @@ fn dropped_on_the_sets_background_or_its_own_variant_it_adds_nothing() { let _ = t.set; } +/// A set in a group in a section (CodeRabbit, #2161): its background still gives nothing, not a +/// Navigate to the section, and a sibling still gives Change to. +#[test] +fn in_a_grouped_set_the_background_adds_nothing_and_a_sibling_changes_to() { + let mut t = setup_in(true); + let (a, b) = (screen_centre(&t.u.app, t.default), screen_centre(&t.u.app, t.hover)); + let gap = pos2((a.x + b.x) / 2.0, a.y); + let src = t.default; + drag(&mut t, src, gap); + assert!(interactions(&t, t.default).is_empty(), "{:?}", interactions(&t, t.default)); + let to = screen_centre(&t.u.app, t.hover); + drag(&mut t, src, to); + assert_change_to(&t, t.default, t.hover); +} + #[test] fn a_variant_dropped_on_a_frame_outside_the_set_still_navigates() { let mut t = setup(); From ff3e4e6010b905bf7dc09c507a2078426efa9d37 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 09:38:56 -0500 Subject: [PATCH 080/239] M12: sticky growth checked with a measured font; the normalize note drops sticky size (#2164 review) The growth test scans the system fonts, as the other text-measuring engine tests do (#333), and asserts the note grows taller unconditionally instead of only when text happened to measure. docs/boards-parity.md no longer lists a sticky's text size among what the normalize pass derives. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 checked the findings and wrote --- crates/engine/src/board_tests.rs | 11 ++++++----- docs/boards-parity.md | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/board_tests.rs b/crates/engine/src/board_tests.rs index 1b0ac120c..eb00647ac 100644 --- a/crates/engine/src/board_tests.rs +++ b/crates/engine/src/board_tests.rs @@ -116,6 +116,9 @@ fn a_new_sticky_starts_at_18() { #[test] fn a_sticky_keeps_its_text_size_as_text_is_added() { + // The note's growth needs text measured: without craft-fonts that is with a system font, + // scanned here rather than by whichever test happens to run first (#333). + figcraft_text::scan_system_fonts(); let mut s = board(); let r = s.execute("board.sticky", &json!({"x": 0, "y": 0, "text": "one"})).unwrap(); let (st, note) = (id(&r, "id"), id(&r, "text")); @@ -129,10 +132,8 @@ fn a_sticky_keeps_its_text_size_as_text_is_added() { let ten = node(&s, note).kind.text().unwrap().clone(); assert_eq!(ten.characters.matches('\n').count(), 9, "ten lines"); assert_eq!(ten.style.font_size, 18.0); - // Growth needs text measured: a build without the craft-fonts input measures nothing (the same - // reason `a_double_click_types_in_the_cell...` fails there), so it is only checked where it is. - let measured = node(&s, note).height > text_height; - assert!(!measured || node(&s, st).height > height, "ten lines make the note taller"); + assert!(node(&s, note).height > text_height, "ten lines make the text taller"); + assert!(node(&s, st).height > height, "and the note"); assert_eq!(node(&s, st).child_layout.sizing_v, figcraft_doc::Sizing::Hug, "the note hugs its text"); let (w, h10) = (node(&s, st).width, node(&s, st).height); crate::textedit::insert(&mut s, &"a long paragraph ".repeat(15)).unwrap(); @@ -142,7 +143,7 @@ fn a_sticky_keeps_its_text_size_as_text_is_added() { assert_eq!(t.style.font_size, 18.0); assert!(t.runs.iter().all(|r| r.style.font_size == 18.0)); assert_eq!(node(&s, st).width, w, "the note keeps its width"); - assert!(!measured || node(&s, st).height > h10, "and grows taller"); + assert!(node(&s, st).height > h10, "and grows taller"); } #[test] diff --git a/docs/boards-parity.md b/docs/boards-parity.md index 2cc099f08..f874daad5 100644 --- a/docs/boards-parity.md +++ b/docs/boards-parity.md @@ -17,8 +17,8 @@ design product). The work item is gap 24 in [`gaps.md`](gaps.md). Board objects are ordinary layers with a small `board` field on the node (`figcraft_doc::BoardItem`), so rendering, hit testing, undo, saving, SVG/PNG/PDF export, copy and paste and live sessions work on them unchanged. The file kind (`Document.kind`) is saved in `.figcraft` and reaches people who -join a live session in their snapshot. What follows from the metadata (a sticky's text size, a -shape's text room, connector routes and their labels) is recomputed in the engine's normalize pass, +join a live session in their snapshot. What follows from the metadata (a shape's text +room, connector routes and their labels) is recomputed in the engine's normalize pass, deterministically from the document, so local edits, undo and edits from others in a live session all end with the same geometry. From 6108efd4d2559b0cea9213dd3d6b2ff6bc9742d0 Mon Sep 17 00:00:00 2001 From: Ragulsundaram <41433645+Ragulsundaram@users.noreply.github.com> Date: Tue, 10 Nov 2026 00:11:02 +0530 Subject: [PATCH 081/239] i18n(ta): shorten Min W to match the other size labels --- crates/ui-egui/locales/ta.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/locales/ta.toml b/crates/ui-egui/locales/ta.toml index 15b12d854..6ae9473ec 100644 --- a/crates/ui-egui/locales/ta.toml +++ b/crates/ui-egui/locales/ta.toml @@ -881,7 +881,7 @@ status = "draft — needs native review" "Merged" = "இணைக்கப்பட்டது" "Merged PRs" = "இணைக்கப்பட்ட PRகள்" "Min H" = "குறை. உ" -"Min W" = "குறைந்தபட்ச அகலம்" +"Min W" = "குறை. அ" "Minimize" = "சிறிதாக்கு" "Minutes" = "நிமிடங்கள்" "Mirror angle" = "கோணத்தைப் பிரதிபலி" From bb6d1c35ee78c1d470f7896973665d8d57e63fdf Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 14:02:07 -0500 Subject: [PATCH 082/239] M12: a board table's height change goes into its rows (#2172) Resizing a board table by its bottom edge, a corner or a height command left it at a fixed height, so its rows stayed at 40 with blank space below them (or were clipped when shrunk) and typing in a cell no longer grew the table. Measured in FigJam's web app (2026-11-09): a table has no lock-proportions control and never scales proportionally; a bottom edge grows only the last row, a corner drag shares the change equally over every row and column, text keeps its size, and a cell has a minimum size. board_table::settle_resize runs first in the normalize pass (so a drag, node.set, transform.resize, MCP and live-session peers all agree): a table left at a fixed height gets the change in its rows' minimum height (the last row, or every row when both axes changed), is kept at least columns x 40 wide, and hugs its rows again. New cells get a minimum width of 40. FigJam's floor is about 52 and FigCraft's is 40; there are no per-column widths yet. Docs: boards-parity Tables row, revision history and status line; the board_table module doc. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Fable 5.1 (work seat) scoped; Sonnet 5.5 measured in FigJam and wrote at medium --- crates/engine/src/board_tables_tests.rs | 181 ++++++++++++++++++++++ crates/engine/src/boards/board/derived.rs | 1 + crates/engine/src/boards/board_table.rs | 66 ++++++++ docs/boards-parity.md | 5 +- 4 files changed, 251 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/board_tables_tests.rs b/crates/engine/src/board_tables_tests.rs index 2c0d07bbc..7ae3a64ce 100644 --- a/crates/engine/src/board_tables_tests.rs +++ b/crates/engine/src/board_tables_tests.rs @@ -255,3 +255,184 @@ fn template_and_table_commands_survive_junk() { } } } + +// --------------------------------------------------------------------------------------------- +// Resizing a table (#2172): a height change goes into its rows, never into blank space. + +fn drag(s: &mut Session, from: (f64, f64), to: (f64, f64)) { + s.pointer(&PointerEvent::at(PointerKind::Down, from.0, from.1, 1.0)).unwrap(); + s.pointer(&PointerEvent::at(PointerKind::Move, (from.0 + to.0) / 2.0, (from.1 + to.1) / 2.0, 1.0)).unwrap(); + s.pointer(&PointerEvent::at(PointerKind::Move, to.0, to.1, 1.0)).unwrap(); + s.pointer(&PointerEvent::at(PointerKind::Up, to.0, to.1, 1.0)).unwrap(); +} + +/// A selected 3 x 3 table at 0,0 (480 x 122: a line under all but the last row adds 1 to each), with `texts` in the first row. +fn table_3x3(texts: [&str; 3]) -> (Session, NodeId) { + let mut s = board(); + let r = s.execute("board.table", &json!({"x": 0, "y": 0, "cells": [texts, ["", "", ""], ["", "", ""]]})).unwrap(); + (s, id(&r, "id")) +} + +fn rows_of(s: &Session, t: NodeId) -> Vec { + let doc = s.doc().unwrap(); + doc.node(t).unwrap().children.iter().copied().filter(|c| !node(s, *c).child_layout.absolute).collect() +} + +fn row_heights(s: &Session, t: NodeId) -> Vec { + rows_of(s, t).into_iter().map(|r| node(s, r).height).collect() +} + +fn column_widths(s: &Session, t: NodeId) -> Vec { + let r = rows_of(s, t)[0]; + node(s, r).children.iter().map(|c| node(s, *c).width).collect() +} + +fn near(a: f64, b: f64) -> bool { + (a - b).abs() < 0.6 +} + +fn all_near(got: &[f64], want: &[f64]) -> bool { + got.len() == want.len() && got.iter().zip(want).all(|(a, b)| near(*a, *b)) +} + +fn is_hug(s: &Session, t: NodeId) -> bool { + node(s, t).child_layout.sizing_v == figcraft_doc::Sizing::Hug +} + +#[test] +fn a_bottom_drag_grows_only_the_last_row() { + // The programmatic route. + let (mut s, t) = table_3x3(["Alpha", "", ""]); + s.execute("node.set", &json!({"id": t, "props": {"height": 272}})).unwrap(); + assert!(all_near(&row_heights(&s, t), &[41.0, 41.0, 190.0]), "{:?}", row_heights(&s, t)); + let n = node(&s, t); + assert!(near(n.width, 480.0) && near(n.height, 272.0), "{}x{}", n.width, n.height); + assert!(is_hug(&s, t), "still hugging its rows"); + assert!(all_near(&column_widths(&s, t), &[160.0; 3])); + assert!(lines(&s, t).iter().all(|(_, h)| near(*h, 272.0)), "{:?}", lines(&s, t)); + // The pointer route: the bottom edge dragged down by 150. + let (mut s, t) = table_3x3(["Alpha", "", ""]); + drag(&mut s, (240.0, 122.0), (240.0, 272.0)); + assert!(all_near(&row_heights(&s, t), &[41.0, 41.0, 190.0]), "{:?}", row_heights(&s, t)); + assert!(near(node(&s, t).height, 272.0) && near(node(&s, t).width, 480.0)); + assert!(is_hug(&s, t)); + assert!(all_near(&column_widths(&s, t), &[160.0; 3])); + assert!(lines(&s, t).iter().all(|(_, h)| near(*h, 272.0)), "{:?}", lines(&s, t)); + // The text keeps its size. + let row0 = rows_of(&s, t)[0]; + let cell = node(&s, node(&s, row0).children[0]); + let NodeKind::Text(td) = &node(&s, cell.children[0]).kind else { panic!("text") }; + assert_eq!(td.style.font_size, 14.0); +} + +#[test] +fn a_corner_drag_shares_the_change_over_every_row_and_column() { + let (mut s, t) = table_3x3(["", "", ""]); + drag(&mut s, (480.0, 122.0), (570.0, 182.0)); + let n = node(&s, t); + assert!(near(n.width, 570.0) && near(n.height, 182.0), "{}x{}", n.width, n.height); + assert!(all_near(&row_heights(&s, t), &[61.0, 61.0, 60.0]), "{:?}", row_heights(&s, t)); + assert!(all_near(&column_widths(&s, t), &[190.0; 3]), "{:?}", column_widths(&s, t)); + let xs: Vec = lines(&s, t).iter().map(|l| l.0).collect(); + assert!(all_near(&xs, &[189.5, 379.5]), "{xs:?}"); + assert!(is_hug(&s, t)); + // The same through `transform.resize`. + let (mut s, t) = table_3x3(["", "", ""]); + s.execute("transform.resize", &json!({"ids": [t], "width": 570, "height": 182})).unwrap(); + assert!(all_near(&row_heights(&s, t), &[61.0, 61.0, 60.0]), "{:?}", row_heights(&s, t)); + assert!(all_near(&column_widths(&s, t), &[190.0; 3]), "{:?}", column_widths(&s, t)); +} + +#[test] +fn a_side_drag_changes_no_row() { + let (mut s, t) = table_3x3(["", "", ""]); + s.execute("node.set", &json!({"id": t, "props": {"width": 680}})).unwrap(); + assert!(all_near(&row_heights(&s, t), &[41.0, 41.0, 40.0]), "{:?}", row_heights(&s, t)); + assert!(near(node(&s, t).height, 122.0) && near(node(&s, t).width, 680.0)); + assert!(is_hug(&s, t)); + // A pointer drag of the right edge. + let (mut s, t) = table_3x3(["", "", ""]); + drag(&mut s, (480.0, 60.0), (680.0, 60.0)); + assert!(all_near(&row_heights(&s, t), &[41.0, 41.0, 40.0]), "{:?}", row_heights(&s, t)); + assert!(near(node(&s, t).height, 122.0) && near(node(&s, t).width, 680.0)); + assert!(is_hug(&s, t)); +} + +#[test] +fn a_table_never_shrinks_below_its_cells() { + let (mut s, t) = table_3x3(["Alpha", "Bravo longer text", "Charlie"]); + drag(&mut s, (480.0, 122.0), (50.0, 32.0)); + let n = node(&s, t); + assert!(near(n.width, 120.0), "width {}", n.width); + assert!(all_near(&column_widths(&s, t), &[40.0; 3]), "{:?}", column_widths(&s, t)); + let rows = row_heights(&s, t); + assert!(rows[0] > 40.0, "row 1 holds its wrapped text: {rows:?}"); + assert!(near(rows[1], 41.0) && near(rows[2], 40.0), "{rows:?}"); + assert!(near(n.height, rows.iter().sum::()), "{} vs {rows:?}", n.height); + assert!(is_hug(&s, t)); +} + +#[test] +fn a_resized_table_still_grows_with_its_text_and_undoes_in_one_step() { + let (mut s, t) = table_3x3(["", "", ""]); + drag(&mut s, (240.0, 122.0), (240.0, 272.0)); + assert!(near(node(&s, t).height, 272.0)); + // Typing in a last-row cell: the table grows once the text needs more than 190. + s.execute("select.none", &json!({})).unwrap(); + s.pointer(&PointerEvent::at(PointerKind::DoubleClick, 80.0, 200.0, 1.0)).unwrap(); + assert!(s.ds().unwrap().text_edit.is_some(), "typing in the last row's cell"); + let long = (0..12).map(|i| format!("line {i}")).collect::>().join("\n"); + crate::textedit::insert(&mut s, &long).unwrap(); + crate::textedit::end(&mut s).unwrap(); + assert!(node(&s, t).height > 272.0, "grew with its text: {}", node(&s, t).height); + assert!(is_hug(&s, t)); + // Undo: the typing, then the resize, to the table as made. + s.execute("edit.undo", &json!({})).unwrap(); + assert!(near(node(&s, t).height, 272.0), "{}", node(&s, t).height); + s.execute("edit.undo", &json!({})).unwrap(); + let n = node(&s, t); + assert!(near(n.width, 480.0) && near(n.height, 122.0), "{}x{}", n.width, n.height); + assert!(all_near(&row_heights(&s, t), &[41.0, 41.0, 40.0]), "{:?}", row_heights(&s, t)); +} + +#[test] +fn table_resizes_sync_in_live_sessions() { + let s = board(); + let mut room = Room::new(s.doc().unwrap().clone(), 2, 12); + let t = id(&room.s(0).execute("board.table", &json!({"x": 0, "y": 0})).unwrap(), "id"); + room.settle(); + room.check(); + room.s(0).execute("node.set", &json!({"id": t, "props": {"height": 272}})).unwrap(); + room.settle(); + room.check(); + let doc = room.server.document(); + let heights: Vec = + doc.node(t).unwrap().children.iter().map(|c| doc.node(*c).unwrap()).filter(|n| !n.child_layout.absolute).map(|n| n.height).collect(); + assert!(all_near(&heights, &[41.0, 41.0, 190.0]), "{heights:?}"); + assert!(near(doc.node(t).unwrap().height, 272.0)); + assert_eq!(doc.node(t).unwrap().child_layout.sizing_v, figcraft_doc::Sizing::Hug); +} + +#[test] +fn resizing_a_table_survives_junk_and_saves_the_rows() { + for h in [json!(1e308), json!(-5), json!("NaN"), json!(null), json!(0)] { + let (mut s, t) = table_3x3(["", "", ""]); + if let Err(EngineError::Internal { cmd, msg }) = s.execute("node.set", &json!({"id": t, "props": {"height": h}})) { + panic!("{cmd} panicked on {h}: {msg}"); + } + for p in [json!({"ids": [t], "width": h, "height": h}), json!({"ids": [t], "height": h}), json!({"ids": [t], "width": h})] { + if let Err(EngineError::Internal { cmd, msg }) = s.execute("transform.resize", &p) { + panic!("{cmd} panicked on {p}: {msg}"); + } + } + let n = node(&s, t); + assert!(n.width.is_finite() && n.height.is_finite(), "{h}: {}x{}", n.width, n.height); + } + let (mut s, t) = table_3x3(["", "", ""]); + s.execute("node.set", &json!({"id": t, "props": {"height": 272}})).unwrap(); + let doc = s.doc().unwrap(); + let (back, _) = figcraft_format::from_json(&figcraft_format::to_json(doc).unwrap().to_string()).unwrap(); + let heights: Vec = + back.node(t).unwrap().children.iter().map(|c| back.node(*c).unwrap()).filter(|n| !n.child_layout.absolute).map(|n| n.height).collect(); + assert!(all_near(&heights, &[41.0, 41.0, 190.0]), "{heights:?}"); +} diff --git a/crates/engine/src/boards/board/derived.rs b/crates/engine/src/boards/board/derived.rs index 9fae17206..3db4d88de 100644 --- a/crates/engine/src/boards/board/derived.rs +++ b/crates/engine/src/boards/board/derived.rs @@ -15,6 +15,7 @@ pub(crate) fn settle_text(doc: &mut Document, before: &Document, touched: &BTree if !is_board(doc) { return; } + crate::board_table::settle_resize(doc, before, touched); for &id in touched { let Some(n) = doc.node(id) else { continue }; if let Some(owner) = diff --git a/crates/engine/src/boards/board_table.rs b/crates/engine/src/boards/board_table.rs index aef7c8917..b77f343a0 100644 --- a/crates/engine/src/boards/board_table.rs +++ b/crates/engine/src/boards/board_table.rs @@ -3,6 +3,16 @@ //! row's width, so a cell that wraps more text makes its row taller. Each row but the last draws //! a line under itself and the column lines are thin rectangles over the table that stretch with //! it (they are rebuilt after every edit, like the first row's header tint). +//! +//! Resizing (measured in FigJam's web app, 2026-11-09, #2172): a table never scales its text or +//! its rows in proportion. A height change goes into the rows ([`settle_resize`]): the bottom or +//! top edge grows the last row, a corner drag shares the change equally over every row (every +//! cell fills its row, so the width is already shared equally), and the table keeps hugging its +//! rows. A cell is at least [`MIN_CELL`] (40; FigJam's floor is about 52) wide and tall, and a row +//! is never shorter than its wrapped text. There are no per-column widths yet: a side drag of +//! the right edge splits the change equally where FigJam grows only the last column. + +use std::collections::BTreeSet; use figcraft_color::{Color, Paint}; use figcraft_doc::{ @@ -22,6 +32,10 @@ pub const MAX_COLUMNS: usize = 20; /// A new column's width, and a cell's height before its text is measured. const CELL_W: f64 = 160.0; const CELL_H: f64 = 40.0; +/// The least a cell is wide or tall (FigJam's is about 52). +pub(crate) const MIN_CELL: f64 = CELL_H; +/// The most a resize may ask one row to be tall. +const MAX_ROW_H: f64 = 100_000.0; /// Room around a cell's text: [top, right, bottom, left]. const CELL_PAD: [f64; 4] = [10.0, 12.0, 10.0, 12.0]; const TEXT_SIZE: f64 = 14.0; @@ -125,6 +139,7 @@ fn make_cell(doc: &mut Document, row: NodeId, index: Option, width: f64, n.child_layout.sizing_h = Sizing::Fill; n.child_layout.sizing_v = Sizing::Hug; n.child_layout.min_h = Some(CELL_H); + n.child_layout.min_w = Some(MIN_CELL); })?; add_text(doc, cell, text, TEXT_SIZE, INK, TextAlignH::Left, (width - CELL_PAD[1] - CELL_PAD[3]).max(1.0))?; Ok(cell) @@ -259,6 +274,57 @@ fn table_cmd(s: &mut Session, p: &Value) -> Result { Ok(out) } +/// A table resized by its height or a corner (the resize leaves it at a fixed height): the change +/// goes into its rows, as in FigJam, and the table hugs them again. A bottom or top edge (or a +/// height set by command) grows or shrinks the last row; a drag that changed both axes shares the +/// change equally over every row. A row never gets shorter than [`MIN_CELL`] or than its text (the +/// table hugs it), and the table is never narrower than its columns' minimum. A table already +/// hugging (a peer's synced edit, a second pass) is left alone, so the change is made once. +pub(crate) fn settle_resize(doc: &mut Document, before: &Document, touched: &BTreeSet) { + let mut tables = BTreeSet::new(); + for &id in touched { + if let Some(t) = table_of(doc, id) { + tables.insert(t); + } + } + for table in tables { + let (Some(now), Some(was)) = (doc.node(table), before.node(table)) else { continue }; + if now.child_layout.sizing_v != Sizing::Fixed { + continue; + } + let (w, h, bw, bh) = (now.width, now.height, was.width, was.height); + let (rows, _) = parts(doc, table); + let columns = rows.first().map_or(0, |r| cells(doc, *r).len()); + let dh = h - bh; + if dh.is_finite() && dh.abs() > 1e-6 && !rows.is_empty() { + let both = w.is_finite() && bw.is_finite() && (w - bw).abs() > 1e-6; + let targets: Vec = if both { rows.clone() } else { rows.last().copied().into_iter().collect() }; + let share = dh / targets.len() as f64; + for row in targets { + let base = row_content(before, row).or_else(|| row_content(doc, row)).unwrap_or(CELL_H); + let min_h = (base + share).clamp(MIN_CELL, MAX_ROW_H); + for cell in cells(doc, row) { + if let Some(c) = doc.node_mut(cell) { + c.child_layout.min_h = Some(min_h); + } + } + } + } + if let Some(t) = doc.node_mut(table) { + let least = MIN_CELL * columns as f64; + if t.width.is_nan() || t.width < least { + t.width = least; + } + t.child_layout.sizing_v = Sizing::Hug; + } + } +} + +/// How tall a row's cells are: the row's height less the line under it. +fn row_content(doc: &Document, row: NodeId) -> Option { + cells(doc, row).into_iter().filter_map(|c| doc.node(c).map(|n| n.height)).reduce(f64::max) +} + /// The table `id` is or is in. fn table_of(doc: &Document, id: NodeId) -> Option { std::iter::once(id).chain(doc.ancestors(id)).find(|a| doc.node(*a).is_some_and(|n| n.board == Some(BoardItem::Table))) diff --git a/docs/boards-parity.md b/docs/boards-parity.md index 16456492c..a2c88a6eb 100644 --- a/docs/boards-parity.md +++ b/docs/boards-parity.md @@ -1,6 +1,6 @@ # Boards parity -> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-04 · **Change:** minor (a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) +> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-09 · **Change:** minor (resizing a board table by height changes its rows, not blank space below them: a bottom or top edge grows the last row, a corner shares the change over every row, and a table keeps at least 40 per cell, measured in FigJam's web app, 2026-11-09 (#2172); a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) **Breadth ~47%, ready ~29% (estimated, erring low).** A board is a FigCraft file of its own kind (`file.newBoard`) with a dot grid on the page, sticky notes, shapes with text, connectors that @@ -60,7 +60,7 @@ all end with the same geometry. | Voting results: who voted for what, earlier sessions' results | partial | once a vote ends, its results list who voted for each object and how many times (by name in a live session, kept with the results so someone who has left still shows by name), as the reference app shows how each participant voted; each ended vote's results are kept in the file (the last 20), listed newest first in the Results popover with arrows to earlier ones, and deleted one at a time (`board.vote {action: delete, index}`; Clear results only takes them off the board), as the reference app keeps each session's results until deleted; saved, synced in live sessions, and like the vote not undo steps. Anyone who can edit the board ends or clears a vote, as the reference app's help describes. A vote has no prompt (question) of its own | | Board widgets | missing | design-file widgets exist (`crates/engine/src/extensions/widgets.rs`), not wired to boards | | Templates (retrospective, brainstorm, flow chart…) | partial | five built-in templates drawn up for FigCraft (retrospective, brainstorm, weekly planner, flow chart, kanban board), placed from the toolbar's templates picker (each with a picture of itself) or `board.template {name, x?, y?}` as ordinary sections, stickies, shapes, connectors and text in one undo step; `board.templates` lists them. No community templates, no saving your own | -| Tables | partial | `board.table {rows, columns, cells?, x?, y?}` (at most 50 × 20): an auto layout frame of rows of cells with text, a tinted header row and lines between rows and columns; a cell's row grows with its text; a double-click types in the cell under the pointer; add or remove a row or column from the bar over the selection or `board.tableEdit {id, action, index?}`; cells copied from a spreadsheet (tab-separated text, quoted cells kept whole) paste as a table, up to 50 × 20 with a note when there was more; undoable and synced in live sessions. No column resizing by dragging, no cell colours, no Tab between cells; comma-separated text pastes as text | +| Tables | partial | `board.table {rows, columns, cells?, x?, y?}` (at most 50 × 20): an auto layout frame of rows of cells with text, a tinted header row and lines between rows and columns; a cell's row grows with its text; resizing a table by its bottom edge or its height grows the last row and a corner drag shares the change equally over every row and column (a side drag changes no row), the table keeps hugging its rows and a cell keeps at least 40 each way (measured in FigJam's web app, 2026-11-09: its floor is about 52, FigCraft's is 40, and its right edge grows only the last column); a double-click types in the cell under the pointer; add or remove a row or column from the bar over the selection or `board.tableEdit {id, action, index?}`; cells copied from a spreadsheet (tab-separated text, quoted cells kept whole) paste as a table, up to 50 × 20 with a note when there was more; undoable and synced in live sessions. No per-column widths yet (a width change splits equally), no column resizing by dragging, no cell colours, no Tab between cells; comma-separated text pastes as text | | Mind maps | missing | | | Washi tape, code blocks, image cropping on boards | missing | images can be placed as in design files | | Audio and huddles | missing | | @@ -72,6 +72,7 @@ all end with the same geometry. | Date | Change | Summary | |---|---|---| +| 2026-11-09 | minor | M12, #2172: a board table's height change goes into its rows. Measured in FigJam's web app, 2026-11-09 (a table has no lock-proportions control and never scales proportionally): a bottom-edge drag grows only the last row, a corner drag shares the change equally over every row and column, text keeps its size, and a table stops shrinking at about 52 per cell with a row never shorter than its wrapped text. FigCraft already split a width change equally (every cell fills); the bug was height: a bottom or corner resize turned the table from hugging to fixed height, so the rows stayed at 40 with blank space below them (or were clipped when shrunk) and typing no longer grew the table. `board_table::settle_resize`, called first in the normalize pass, finds a table left at a fixed height, puts the change into the rows' minimum height (the last row, or every row when both axes changed), raises a width that is too narrow to `columns x 40`, and returns the table to hugging, so every route (drag, `node.set`, `transform.resize`, MCP, live-session peers) gives the same result, in one undo step. FigCraft's floor is 40 (FigJam's is about 52) and there are no per-column widths yet: a side drag of the right edge still splits equally where FigJam grows only the last column. Numbers unchanged. Tests: `board_tables_tests` (the bottom, corner and side drags, the floor, typing after a resize and undo, live sessions, junk). | | 2026-11-03 | minor | M12, #1919: as the quick create help says ("Click to select and create the next shape in that direction, or drag the preview to any location on your board"; "A new shape is created with a connector and its text field active"), a "+" beside the selected sticky or shape can be dragged: the preview follows the pointer and, let go on empty board, the next one is made there, centred on the pointer, and joined by a connector leaving by the handle's side and arriving by the side facing it (`board.addConnected` gains `at: [x, y]`, a point of the page placed in the parent's coordinates); let go on another sticky or shape, inside a section or frame too (`board::sticky_or_shape_at`), a connector joins the two instead (`board.connector`), that object outlined while the pointer is over it; let go off the canvas or over the toolbar, nothing, and the bar above the selection stays away meanwhile, as for any drag. The click is as before. A shape picker on drop and choosing the connector type are not done (the help doesn't describe them). Tests: `board_connect_tests` (the drag ones), engine `board_connected_tests::the_next_one_goes_where_it_is_dropped`. Numbers unchanged. | | 2026-11-04 | minor | M12, #1916: a connector end attached to a side starts 4 pt outside the border (`board_route::END_GAP`), as FigJam's do (the issue's screenshots: the line starts a few pixels outside, with a round cap), so the stroke never lies on the fill; elbows leaving one side share their first run along its normal, curves leave tangent to it and straight ones fan out from the same point; the `.jam` importer's routes, re-attached ends, path handles and labels follow the route's points; an end placed by hand with Cmd/Ctrl held keeps its exact point. Tests: `board_route_tests` (three). Numbers unchanged. | | 2026-11-04 | patch | M6, #1910: a `.jam` elbowed connector saved with its path (FigJam's `connectorControlPoints`) keeps it on import: the points become the `ConnectorPath::Runs` a connector reshaped by hand has and the line is walked along them, so a connector drawn around a layer stays around it; one whose points don't make a path from its ends' sides is routed as before. Still a vector, not a native board object. Details in [`file-format-parity.md`](file-format-parity.md). | From a54eafc0fc6b9a6d48f4e8751b3f46cd2a12763f Mon Sep 17 00:00:00 2001 From: ljkx <177671075+ljkx@users.noreply.github.com> Date: Mon, 9 Nov 2026 20:08:39 +0100 Subject: [PATCH 083/239] M1: test that picker Crop only sets the mode where Crop image doesn't apply (#2150) Choosing Crop in the colour picker starts crop mode only for one layer's own image fill. The new test chooses Crop for a stroke, for two layers' fills at once, and for a region's fill in vector edit mode (the layer's own fill an image too). In each case it checks that the paint takes the Crop mode, crop mode does not start, and the picker stays open. It also checks that crop_on_canvas gives nothing for a solid fill, an index with no fill, the page background and a style. --- crates/ui-egui/src/crop_image_tests.rs | 79 +++++++++++++++++++++++ crates/ui-egui/src/widgets/colorpicker.rs | 2 +- 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/crop_image_tests.rs b/crates/ui-egui/src/crop_image_tests.rs index 9f802aee2..68ed04a81 100644 --- a/crates/ui-egui/src/crop_image_tests.rs +++ b/crates/ui-egui/src/crop_image_tests.rs @@ -193,3 +193,82 @@ fn crop_chosen_in_the_colour_picker_enters_crop_mode() { // The picture grew from 200 x 100 to 240 x 120: the layer shows 5/6 of what it showed. assert!((scaled[0] - after[0] * 5.0 / 6.0).abs() < 1e-6 && (scaled[3] - after[3] * 5.0 / 6.0).abs() < 1e-6, "{after:?} -> {scaled:?}"); } + +/// The first paint, an image, of `id`'s fills (`fills`) or strokes, or of region `region` of a vector. +fn image_at(u: &Ui, id: NodeId, fills: bool, region: Option) -> figcraft_color::ImagePaint { + let n = u.app.session.doc().unwrap().node(id).unwrap(); + let list = match region { + Some(r) => match &n.kind { + figcraft_doc::NodeKind::Vector { network } => network.regions[r].fills.clone().unwrap(), + _ => panic!("not a vector"), + }, + None if fills => n.fills.clone(), + None => n.strokes.clone(), + }; + match &list[0].kind { + PaintKind::Image(img) => img.clone(), + k => panic!("not an image: {k:?}"), + } +} + +/// Crop chosen in the picker for a paint that has no crop mode on the canvas (#2150) — a stroke, +/// several layers' fills at once, or a region's fill in vector edit mode — only sets the paint's +/// mode: crop mode doesn't start and the picker stays open. Targets that aren't one layer's image +/// fill have nothing for Crop image to crop either. +#[test] +fn crop_in_the_colour_picker_only_sets_the_mode_where_crop_image_does_not_apply() { + use crate::colorpicker::{PickerTarget, crop_on_canvas}; + let picture = |u: &Ui, id: NodeId| u.app.session.doc().unwrap().node(id).unwrap().fills[0].clone(); + // Opens the picker on `target`, chooses Crop and checks crop mode stays off. + let crop_only_sets_the_mode = |u: &mut Ui, target: PickerTarget, what: &str| { + u.app.ui.picker = Some(target.clone()); + for _ in 0..4 { + u.frame(vec![]); + } + choose_mode(u, "Fill", "Crop"); + assert_eq!(u.app.ui.crop, None, "{what}: no crop mode"); + assert_eq!(u.app.ui.picker, Some(target), "{what}: the picker stays open"); + }; + + // The layer's image as its stroke: the stroke's mode is set, the fill is left alone. + let (mut u, layer, _) = setup(); + let paint = picture(&u, layer); + u.app.run("stroke.add", json!({"ids": [layer], "paint": paint})); + crop_only_sets_the_mode(&mut u, PickerTarget::Paint { fills: false, index: 0, ids: vec![layer] }, "a stroke"); + assert_eq!(image_at(&u, layer, false, None).scale_mode, ImageScaleMode::Crop); + assert_eq!(mode(&u, layer), (ImageScaleMode::Fill, None), "the fill is untouched"); + + // Two image layers at once: both take the mode. + let (mut u, layer, rect) = setup(); + let paint = picture(&u, layer); + u.app.run("fill.set", json!({"ids": [rect], "index": 0, "paint": paint})); + u.app.run("select.set", json!({"ids": [layer, rect]})); + crop_only_sets_the_mode(&mut u, PickerTarget::Paint { fills: true, index: 0, ids: vec![layer, rect] }, "two layers"); + assert_eq!(mode(&u, layer).0, ImageScaleMode::Crop); + assert_eq!(mode(&u, rect).0, ImageScaleMode::Crop); + + // A region's own image fill in vector edit mode: the region's mode is set, the layer's image + // fill is untouched. + let (u0, layer, _) = setup(); + let paint = picture(&u0, layer); + let mut s = Session::new(); + let vector = crate::region_fill_rows_tests::two_region_vector(&mut s); + // The layer's own fill is an image too, so cropping it instead would be possible, and wrong. + s.execute("fill.set", &json!({"ids": [vector.0], "index": 0, "paint": paint})).unwrap(); + s.execute("vector.edit.begin", &json!({"id": vector.0})).unwrap(); + s.execute("vector.edit.select", &json!({"regions": [1]})).unwrap(); + s.execute("fill.set", &json!({"ids": [vector.0], "index": 0, "paint": paint})).unwrap(); + let layer_fills = s.doc().unwrap().node(vector).unwrap().fills.clone(); + let mut u = Ui::new(s); + crop_only_sets_the_mode(&mut u, PickerTarget::Paint { fills: true, index: 0, ids: vec![vector] }, "a region"); + assert_eq!(image_at(&u, vector, true, Some(1)).scale_mode, ImageScaleMode::Crop); + assert_eq!(u.app.session.doc().unwrap().node(vector).unwrap().fills, layer_fills, "the layer's fills are untouched"); + + // A fill that isn't an image, and targets that aren't a layer's paint, have no crop on the canvas. + let (u, layer, rect) = setup(); + assert_eq!(crop_on_canvas(&u.app, &PickerTarget::Paint { fills: true, index: 0, ids: vec![layer] }), Some((layer, 0))); + assert_eq!(crop_on_canvas(&u.app, &PickerTarget::Paint { fills: true, index: 0, ids: vec![rect] }), None, "a solid fill"); + assert_eq!(crop_on_canvas(&u.app, &PickerTarget::Paint { fills: true, index: 1, ids: vec![layer] }), None, "no fill there"); + assert_eq!(crop_on_canvas(&u.app, &PickerTarget::PageBackground), None); + assert_eq!(crop_on_canvas(&u.app, &PickerTarget::Style { id: "S:1".into(), index: 0 }), None); +} diff --git a/crates/ui-egui/src/widgets/colorpicker.rs b/crates/ui-egui/src/widgets/colorpicker.rs index 848a0c8d3..6aa0c4915 100644 --- a/crates/ui-egui/src/widgets/colorpicker.rs +++ b/crates/ui-egui/src/widgets/colorpicker.rs @@ -764,7 +764,7 @@ fn blend_row(ui: &mut Ui, app: &mut FigApp, target: &PickerTarget, paint: &mut P /// one layer's image fill as the Fill section shows it (a text's characters' shared fills /// included). Strokes, several layers at once and the regions selected in vector edit mode have /// no crop mode, so for them Crop only sets the paint's mode. -fn crop_on_canvas(app: &FigApp, target: &PickerTarget) -> Option<(NodeId, usize)> { +pub(crate) fn crop_on_canvas(app: &FigApp, target: &PickerTarget) -> Option<(NodeId, usize)> { let PickerTarget::Paint { fills: true, index, ids } = target else { return None }; let [id] = ids[..] else { return None }; if figcraft_engine::vectoredit::selected_region_fills(&app.session, id).is_some() { From 499717d6a0ff284d86c02aa48151b466a158ae2f Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 14:32:49 -0500 Subject: [PATCH 084/239] M7: the variant connection docs name the grouped-set case and target_at's None cases (#2161 review) Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 checked and wrote --- crates/ui-egui/src/canvas/proto_canvas.rs | 3 ++- crates/ui-egui/src/proto_variant_connect_tests.rs | 2 +- docs/prototyping-parity.md | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/canvas/proto_canvas.rs b/crates/ui-egui/src/canvas/proto_canvas.rs index 3d7727f2c..b30fc604b 100644 --- a/crates/ui-egui/src/canvas/proto_canvas.rs +++ b/crates/ui-egui/src/canvas/proto_canvas.rs @@ -160,7 +160,8 @@ fn variant_of(doc: &Document, source: NodeId) -> Option { /// What a connection dragged from `source` and released at screen point `p` targets: a sibling /// variant of the source's own variant (Change to), else a frame other than the source's own -/// (Navigate to). +/// (Navigate to). `None` over the source's own variant, over the rest of its set (its background), +/// and where no frame or section is under the pointer. fn target_at(app: &FigApp, doc: &Document, page: NodeId, source: NodeId, p: Pos2) -> Option { if let Some(v) = variant_of(doc, source) && let Some(set) = doc.node(v).and_then(|n| n.parent) diff --git a/crates/ui-egui/src/proto_variant_connect_tests.rs b/crates/ui-egui/src/proto_variant_connect_tests.rs index db5f55a9d..0ab64ac81 100644 --- a/crates/ui-egui/src/proto_variant_connect_tests.rs +++ b/crates/ui-egui/src/proto_variant_connect_tests.rs @@ -54,7 +54,7 @@ fn setup_in(grouped: bool) -> Setup { Setup { u, set, default, hover, layer, outside } } -/// Select `source`, then drag its connection handle to the centre of `to` (or `at`) and release. +/// Select `source`, then drag its connection handle (found inside) to the screen point `to` and release. fn drag(t: &mut Setup, source: NodeId, to: Pos2) { t.u.run("select.set", json!({"ids": [source]})); t.u.run("view.zoomSelection", json!({})); diff --git a/docs/prototyping-parity.md b/docs/prototyping-parity.md index 07e3c691d..6ca217eec 100644 --- a/docs/prototyping-parity.md +++ b/docs/prototyping-parity.md @@ -57,7 +57,7 @@ tool; opt-in), **silent** (the documentation doesn't say; the case pins the curr | Open link | pass | a new tab or browser window by default; with "Open in new tab" off, the web build's own tab goes to the link (the desktop app has no tab of its own to replace, so it opens the browser either way) | | Change to: another variant of the instance, in place, with the interaction's animation | pass | `interactive_components_change_in_place` | | Interactive components: every instance plays the interactions of the variant it shows; an interaction on the instance with the same trigger wins | **fixed** | instances played only interactions copied onto them when they were placed: an instance placed before its main got interactions did nothing, and one placed after kept the first variant's interactions after changing (a toggle went on but never off). New instances no longer copy them, and copies in older files give way to the variant shown; `instances_play_their_variants_interactions` | -| Drag a variant's (or a layer in it) connection onto a sibling variant: Change to, On click, Instant; the sibling is outlined | **fixed** | the drop only found top-level frames, and a variant's top-level frame is its set, so nothing happened. Dropped on the set's background or on its own variant it still adds nothing; on a frame outside the set it still navigates. Measured in Figma's web app, 2026-11-09; `a_variants_connection_dropped_on_a_sibling_variant_changes_to_it`, `the_reverse_connection_changes_back`, `a_layer_inside_a_variant_changes_its_set_to_the_sibling`, `dropped_on_the_sets_background_or_its_own_variant_it_adds_nothing`, `a_variant_dropped_on_a_frame_outside_the_set_still_navigates` | +| Drag a variant's (or a layer in it) connection onto a sibling variant: Change to, On click, Instant; the sibling is outlined | **fixed** | the drop only found top-level frames, and a variant's top-level frame is its set, so nothing happened. Dropped on the set's background or on its own variant it still adds nothing, also when the set sits in a group inside a section (the background used to give a Navigate to that section); on a frame outside the set it still navigates. Measured in Figma's web app, 2026-11-09; `a_variants_connection_dropped_on_a_sibling_variant_changes_to_it`, `the_reverse_connection_changes_back`, `a_layer_inside_a_variant_changes_its_set_to_the_sibling`, `dropped_on_the_sets_background_or_its_own_variant_it_adds_nothing`, `a_variant_dropped_on_a_frame_outside_the_set_still_navigates`, `in_a_grouped_set_the_background_adds_nothing_and_a_sibling_changes_to` | | Presentation tabs: one per page of a file, named "file - page" (renames follow). Play on a page that has a tab shows it as it was (from another start frame it starts again). Tabs keep their own copy of the prototype and play on after their file closes; a saved file opened again gets its tabs back. A tab never changes a file that isn't in front. Its X or Escape ends it and goes back to its file, or Home | **fixed** | one "Present" tab: a second presentation replaced the first, Play restarted it, and closing the file ended it; `present_tab_tests` | | Change to on a layer inside a nested instance changes the instance whose variant set holds the destination | **fixed** | the innermost instance (an icon inside a button) was changed instead | | Set variable, set variable mode, conditional | pass | `proto_run_tests`, `proto_conditional_tests`, `present_variables_tests` | From 7a8d422dec9dc6a88fb7cc0d91867953aa01bf36 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 14:47:06 -0500 Subject: [PATCH 085/239] M8: the Scale field only takes the keyboard when the tool is chosen or the panel returns, and Ctrl/Alt+Enter keep the tool (#2148 review) A stale "field had the keyboard" flag no longer ends the tool on the first frame back from another tab. A selection appearing after K with nothing selected no longer moves the keyboard from the canvas to the Scale field. Ctrl+Enter and Alt+Enter are not the tool's exit. Tests pin the full text selection, the 2x and 1.5 factors, the field letting go after Enter and Escape, idle frames after Tab, and a leftover edit dropped on return. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 triaged and briefed; Sonnet 5.5 verified and wrote at medium --- crates/ui-egui/src/field_tests.rs | 94 +++++++++++++++++++++++- crates/ui-egui/src/panels/right.rs | 3 + crates/ui-egui/src/panels/scale_panel.rs | 29 +++++++- 3 files changed, 121 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index 06b78823c..718d681f6 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -763,7 +763,55 @@ fn pressing_k_focuses_the_scale_field_with_its_text_selected() { assert!(scale_field_focused(&u), "the scale field has the keyboard"); let state = egui::TextEdit::load_state(&u.ctx, Id::unique("scale_k").with("te")).expect("the editor exists"); let range = state.cursor.char_range().expect("a selection"); - assert_ne!(range.primary.index, range.secondary.index, "its text is selected"); + let shown = u.ctx.data(|d| d.get_temp::(Id::unique("scale_k").with("editing"))).expect("the field is being edited"); + let (lo, hi) = (range.primary.index.min(range.secondary.index), range.primary.index.max(range.secondary.index)); + assert_eq!((lo, hi), (egui::text::CCursor::new(0).index, egui::text::CCursor::new(shown.chars().count()).index), "all of its text is selected"); +} + +/// K with nothing selected, then a selection: the field doesn't take the keyboard from the canvas. +#[test] +fn a_selection_after_k_does_not_move_the_keyboard_to_the_scale_field() { + let (mut u, r) = scale_setup(); + u.app.run("select.set", json!({"ids": []})); + u.frame(vec![]); + key(&mut u, Key::K, Modifiers::NONE); + for _ in 0..3 { + u.frame(vec![]); + } + u.app.run("select.set", json!({"ids": [r]})); + for _ in 0..3 { + u.frame(vec![]); + } + assert_eq!(u.app.session.tool.tool, figcraft_engine::ToolId::Scale); + assert!(!scale_field_focused(&u), "the canvas keeps the keyboard"); +} + +/// Ctrl+Enter in the factor field is not the tool's exit. +#[test] +fn ctrl_enter_in_the_scale_field_keeps_the_scale_tool() { + let (mut u, _) = scale_setup(); + key(&mut u, Key::K, Modifiers::NONE); + u.frame(vec![]); + key(&mut u, Key::Enter, Modifiers::CTRL); + u.frame(vec![]); + assert_eq!(u.app.session.tool.tool, figcraft_engine::ToolId::Scale); +} + +/// An Enter on the first frame the panel is back from another tab (the field not yet focused again) +/// doesn't end the tool on a stale "had the keyboard" flag. +#[test] +fn enter_on_the_first_frame_back_from_another_tab_keeps_the_scale_tool() { + let (mut u, _) = scale_setup(); + key(&mut u, Key::K, Modifiers::NONE); + u.frame(vec![]); + assert!(scale_field_focused(&u)); + u.app.ui.right_tab = crate::state::RightTab::Prototype; + u.frame(vec![]); + u.frame(vec![]); + u.app.ui.right_tab = crate::state::RightTab::Design; + key(&mut u, Key::Enter, Modifiers::NONE); + u.frame(vec![]); + assert_eq!(u.app.session.tool.tool, figcraft_engine::ToolId::Scale); } /// The Scale tool chosen again while the Design tab was away (Prototype tab, Move, then K): the @@ -786,6 +834,30 @@ fn the_scale_field_takes_the_keyboard_again_after_another_tab() { assert!(scale_field_focused(&u), "the field has the keyboard again"); } +/// A value typed and left unsettled when the panel went away is dropped: back again, the field +/// shows the fresh value with all of its text selected, so typing replaces it. +#[test] +fn the_scale_field_comes_back_fresh_with_its_text_selected() { + let (mut u, r) = scale_setup(); + key(&mut u, Key::K, Modifiers::NONE); + u.frame(vec![]); + u.frame(vec![Event::Text("7".to_string())]); + u.app.ui.right_tab = crate::state::RightTab::Prototype; + u.frame(vec![]); + u.frame(vec![]); + u.app.ui.right_tab = crate::state::RightTab::Design; + u.frame(vec![]); + u.frame(vec![]); + assert!(scale_field_focused(&u)); + let shown = u.ctx.data(|d| d.get_temp::(Id::unique("scale_k").with("editing"))).expect("the field is being edited"); + assert_ne!(shown, "7", "the leftover edit is gone"); + let state = egui::TextEdit::load_state(&u.ctx, Id::unique("scale_k").with("te")).expect("the editor exists"); + let range = state.cursor.char_range().expect("a selection"); + let (lo, hi) = (range.primary.index.min(range.secondary.index), range.primary.index.max(range.secondary.index)); + assert_eq!((lo, hi), (egui::text::CCursor::new(0).index, egui::text::CCursor::new(shown.chars().count()).index)); + assert_eq!(geom(&u, r), (0.0, 0.0, 100.0, 100.0)); +} + /// Tab moves the keyboard from the factor field to the next one; an Enter there leaves the /// Scale tool on. #[test] @@ -798,6 +870,10 @@ fn enter_in_another_field_after_tab_keeps_the_scale_tool() { let ev = |key, pressed| Event::Key { key, physical_key: None, pressed, repeat: false, modifiers: Modifiers::NONE }; u.frame(vec![ev(Key::Tab, true), ev(Key::Tab, false)]); assert!(!scale_field_focused(&u), "Tab moved the keyboard on"); + for _ in 0..4 { + u.frame(vec![]); + assert!(!scale_field_focused(&u), "the field doesn't take the keyboard back"); + } u.frame(vec![ev(Key::Enter, true), ev(Key::Enter, false)]); u.frame(vec![]); assert_eq!(u.app.session.tool.tool, figcraft_engine::ToolId::Scale); @@ -815,6 +891,7 @@ fn k_two_enter_scales_the_selection_by_two() { u.frame(vec![]); // About the panel's origin, FigCraft's top-left default (Figma's grid starts at the centre). assert_eq!(geom(&u, r), (0.0, 0.0, 200.0, 200.0)); + assert!(!scale_field_focused(&u), "the field let go of the keyboard"); assert_eq!(u.app.session.tool.tool, figcraft_engine::ToolId::Move); assert_eq!(u.app.session.ds().unwrap().selection, vec![r]); assert_eq!(undo_steps(&u), steps + 1); @@ -822,6 +899,20 @@ fn k_two_enter_scales_the_selection_by_two() { assert_eq!(geom(&u, r), (0.0, 0.0, 100.0, 100.0)); } +/// "2x" and "1.5" are factors too. +#[test] +fn the_scale_field_takes_2x_and_1_5() { + for (text, size) in [("2x", 200.0), ("1.5", 150.0)] { + let (mut u, r) = scale_setup(); + key(&mut u, Key::K, Modifiers::NONE); + u.frame(vec![]); + u.frame(vec![Event::Text(text.to_string())]); + key(&mut u, Key::Enter, Modifiers::NONE); + u.frame(vec![]); + assert_eq!(geom(&u, r), (0.0, 0.0, size, size), "{text}"); + } +} + /// Escape in the scale field closes it and changes nothing. #[test] fn escape_in_the_scale_field_closes_it_and_changes_nothing() { @@ -833,6 +924,7 @@ fn escape_in_the_scale_field_closes_it_and_changes_nothing() { key(&mut u, Key::Escape, Modifiers::NONE); u.frame(vec![]); assert_eq!(geom(&u, r), (0.0, 0.0, 100.0, 100.0)); + assert!(!scale_field_focused(&u), "the field let go of the keyboard"); assert_eq!(u.app.session.tool.tool, figcraft_engine::ToolId::Move); assert_eq!(u.app.session.ds().unwrap().selection, vec![r]); assert_eq!(undo_steps(&u), steps); diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index bba57c778..84572016f 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -264,6 +264,9 @@ fn design(app: &mut FigApp, ui: &mut Ui) { let sel = ds.selection.clone(); let vector_edit = ds.vector_edit.clone(); if sel.is_empty() { + if app.session.tool.tool == figcraft_engine::ToolId::Scale { + crate::scale_panel::note_no_selection(ui); + } page_section(app, ui, &doc); return; } diff --git a/crates/ui-egui/src/panels/scale_panel.rs b/crates/ui-egui/src/panels/scale_panel.rs index 9b6dd98a1..dea30ae05 100644 --- a/crates/ui-egui/src/panels/scale_panel.rs +++ b/crates/ui-egui/src/panels/scale_panel.rs @@ -15,7 +15,10 @@ use crate::widgets::{self, FieldEdit, Lead}; /// The Scale section, shown in place of Position while the Scale tool is active. pub fn section(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { - let Some(b) = doc.bounds_of(sel) else { return }; + let Some(b) = doc.bounds_of(sel) else { + note_no_selection(ui); + return; + }; widgets::section_header(ui, tr("Scale"), &[], false); // The factor field takes the keyboard, with its text selected, whenever the section shows // after a frame without it: the tool was chosen, or the panel came back from another tab or a @@ -25,7 +28,8 @@ pub fn section(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { let frame = ui.ctx().cumulative_frame_nr(); let last = ui.data(|d| d.get_temp::(shown_id)); ui.data_mut(|d| d.insert_temp(shown_id, frame)); - if last.is_none_or(|l| l.saturating_add(1) < frame) { + let reappeared = last.is_none_or(|l| l.saturating_add(1) < frame); + if reappeared { widgets::request_edit(ui, k_id); } // Enter or Escape in the factor field ends the tool (back to Move, the selection kept). Whether @@ -33,8 +37,14 @@ pub fn section(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { // shortcut layer may let go of it before this frame's panel runs, and a click or Tab that moved // it to another field during the last frame counts. let in_k_id = Id::unique("scale_in_k"); - let in_k = ui.data(|d| d.get_temp::(in_k_id)).unwrap_or(false); - let (enter, esc) = ui.input(|i| (i.key_pressed(egui::Key::Enter), i.key_pressed(egui::Key::Escape))); + // A flag left from before a gap (another tab, a hidden panel) is stale: the field didn't have + // the keyboard on the frame before this one. + let in_k = !reappeared && ui.data(|d| d.get_temp::(in_k_id)).unwrap_or(false); + // Plain Enter or Escape only: Ctrl+Enter and Alt+Enter are not the tool's exit. + let (enter, esc) = ui.input(|i| { + let plain = !(i.modifiers.ctrl || i.modifiers.alt || i.modifiers.command); + (plain && i.key_pressed(egui::Key::Enter), plain && i.key_pressed(egui::Key::Escape)) + }); let col = widgets::col_width(ui.available_width()); // Anchor: column and row (0 start, 1 middle, 2 end) of the point that stays put. let anchor = app.session.tool.scale_anchor; @@ -93,6 +103,17 @@ pub fn section(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { } } +/// The Scale tool is on but nothing is selected, so the section isn't shown: the frame still +/// counts as shown (a selection that appears later is not the tool being chosen, and the field must +/// not take the keyboard from the canvas), and the field is not the one with the keyboard. +pub fn note_no_selection(ui: &Ui) { + let frame = ui.ctx().cumulative_frame_nr(); + ui.data_mut(|d| { + d.insert_temp(Id::unique("scale_shown_frame"), frame); + d.insert_temp(Id::unique("scale_in_k"), false); + }); +} + /// The factor (clamped to 0.01–100) and pivot for scaling `b` by `k` around `anchor`; None when /// nothing would change or `k` isn't a usable number. fn scale_about(b: figcraft_geom::Rect, anchor: (u8, u8), k: f64) -> Option<(f64, f64, f64)> { From ff7305266c0400272fb2ab2f3b47dec431537117 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 14:59:32 -0500 Subject: [PATCH 086/239] M8: the Annotation tool checks its target first, tool.set asks for the note too, one Developer Mode tool list (#2143 review) tool.annotation validates a named id or ids before changing the tool: a page or unknown layer is an error, and a named layer is always selected. Choosing the tool with tool.set (the toolbar) asks for the selected layer's note like Shift+T. annotation.new only sets the focus request for a selected, non-page layer, so it cannot wait and take the keyboard later. ToolId::works_in_dev_mode is the single list behind the pointer routing, the command allowlist and the toolbar. The press never picks the page. Tests for the invalid targets, the toolbar path, a drag, the re-focus, and a request for an unselected layer. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 triaged and briefed; Sonnet 5.5 verified and wrote at medium --- crates/engine/src/canvas/tools.rs | 5 +++ crates/engine/src/canvas/tools/pointer.rs | 5 ++- crates/engine/src/cmd/view.rs | 35 ++++++++++----- crates/engine/src/dev/devinspect.rs | 2 +- crates/engine/src/devmode_behaviour_tests.rs | 46 ++++++++++++++++++++ crates/ui-egui/src/app/commands.rs | 6 ++- crates/ui-egui/src/dev_mode_tests.rs | 28 ++++++++++++ crates/ui-egui/src/toolbar.rs | 4 +- 8 files changed, 114 insertions(+), 17 deletions(-) diff --git a/crates/engine/src/canvas/tools.rs b/crates/engine/src/canvas/tools.rs index 75e3fe972..a80e6d41b 100644 --- a/crates/engine/src/canvas/tools.rs +++ b/crates/engine/src/canvas/tools.rs @@ -132,6 +132,11 @@ impl ToolId { ToolId::Stamp => "stamp", } } + /// Whether Developer Mode keeps this tool: it only inspects, so the tools that edit leave it. + /// The one list behind the engine's pointer routing and command allowlist and the toolbar. + pub fn works_in_dev_mode(self) -> bool { + matches!(self, ToolId::Move | ToolId::Hand | ToolId::Comment | ToolId::Annotation) + } pub fn from_id(s: &str) -> Option { ToolId::ALL.into_iter().find(|t| t.id().eq_ignore_ascii_case(s)) } diff --git a/crates/engine/src/canvas/tools/pointer.rs b/crates/engine/src/canvas/tools/pointer.rs index 356ded1dd..d864be264 100644 --- a/crates/engine/src/canvas/tools/pointer.rs +++ b/crates/engine/src/canvas/tools/pointer.rs @@ -103,7 +103,7 @@ impl Session { /// The tool pointer events go to: in Dev Mode every tool but the hand and comments selects. fn acting_tool(&self) -> ToolId { match self.tool.tool { - t if self.tool.dev_mode && !matches!(t, ToolId::Hand | ToolId::Comment | ToolId::Annotation) => ToolId::Move, + t if self.tool.dev_mode && !t.works_in_dev_mode() => ToolId::Move, t => t, } } @@ -206,7 +206,8 @@ impl Session { fn annotation_down(&mut self, ev: &PointerEvent) -> Result<()> { let ds = self.ds()?; let (doc, page) = (ds.doc.clone(), ds.page); - let Some(id) = self.hit(&doc, page, ev.p(), ev.tol() * 2.0) else { return Ok(()) }; + // The same reach as the Move tool's pick (`ev.tol() * 2.0`); never the page itself. + let Some(id) = self.hit(&doc, page, ev.p(), ev.tol() * 2.0).filter(|i| doc.node(*i).is_some_and(|n| !n.is_page())) else { return Ok(()) }; self.set_selection(vec![id]); self.request_ui("annotation.new", json!({"id": id})); Ok(()) diff --git a/crates/engine/src/cmd/view.rs b/crates/engine/src/cmd/view.rs index 3f13169de..fcfd70d44 100644 --- a/crates/engine/src/cmd/view.rs +++ b/crates/engine/src/cmd/view.rs @@ -235,6 +235,26 @@ pub(crate) fn tool(s: &mut Session, t: ToolId) -> Result { Ok(json!({"tool": t.id()})) } +/// Shift+T and choosing the Annotation tool: with a layer selected (or named by `id`/`ids`) the UI +/// is asked for its note at once; in the tool, a press on a layer selects it and asks (the engine +/// never writes the note). A named target is checked first: one that isn't a layer in the document +/// is an error and the tool stays as it was. +fn annotation(s: &mut Session, p: &Value) -> Result { + let named = p.get("id").is_some_and(|v| !v.is_null()) || p.get("ids").is_some_and(|v| !v.is_null()); + let first = crate::params::targets(s, p).into_iter().find(|i| s.doc().is_ok_and(|d| d.node(*i).is_some_and(|n| !n.is_page()))); + if named && first.is_none() { + return Err(bad("tool.annotation", "`id` must name a layer in this document (not a page)".to_string())); + } + let r = tool(s, ToolId::Annotation)?; + if let Some(id) = first { + if named { + crate::cmd::edit::select_and_page(s, vec![id])?; + } + s.request_ui("annotation.new", json!({"id": id})); + } + Ok(r) +} + /// The View menu's commands and their parameters. pub fn specs() -> Vec { vec![ @@ -536,6 +556,9 @@ pub fn specs() -> Vec { if t.on_boards() { crate::board::require(s, &format!("tool.{}", t.id()))?; } + if t == ToolId::Annotation { + return annotation(s, &json!({})); + } tool(s, t) } ), @@ -640,17 +663,7 @@ pub fn specs() -> Vec { spec!("tool.comment", "Comment", "{}", false, |s, _| tool(s, ToolId::Comment)), // Shift+T: with a layer selected (or an `id`) the UI is asked for its note at once; in the // tool, a press on a layer selects it and asks (the engine never writes the note). - spec!("tool.annotation", "Annotation", "{id?}", false, |s, p| { - let r = tool(s, ToolId::Annotation)?; - let first = crate::params::targets(s, p).into_iter().find(|i| s.doc().is_ok_and(|d| d.node(*i).is_some_and(|n| !n.is_page()))); - if let Some(id) = first { - if p.get("id").is_some() { - crate::cmd::edit::select_and_page(s, vec![id])?; - } - s.request_ui("annotation.new", json!({"id": id})); - } - Ok(r) - }), + spec!("tool.annotation", "Annotation", "{id?|ids?}", false, annotation), spec!("tool.shapeBuilder", "Shape builder", "{}", false, |s, _| tool(s, ToolId::ShapeBuilder)), // `apply: false` is for the UI colour picker: the eyedropper only samples (into // `ToolState::picked`) and the picker writes the colour to the paint it edits. diff --git a/crates/engine/src/dev/devinspect.rs b/crates/engine/src/dev/devinspect.rs index 80b123bbb..5ac74b9ee 100644 --- a/crates/engine/src/dev/devinspect.rs +++ b/crates/engine/src/dev/devinspect.rs @@ -230,7 +230,7 @@ pub fn dev_mode_allows(id: &str) -> bool { // Edits recorded as one grouped undo step, so their spec says no history of its own. const GROUPED: [&str; 1] = ["data.fill"]; match id.strip_prefix("tool.") { - Some(t) => matches!(t, "move" | "hand" | "comment" | "annotation"), + Some(t) => crate::tools::ToolId::from_id(t).is_some_and(crate::tools::ToolId::works_in_dev_mode), None if id == "file.revert" || GROUPED.contains(&id) => false, None => OWN.iter().any(|p| id.starts_with(p)) || crate::cmd::find_command(id).is_none_or(|c| !c.history), } diff --git a/crates/engine/src/devmode_behaviour_tests.rs b/crates/engine/src/devmode_behaviour_tests.rs index 7f08179df..7414a297b 100644 --- a/crates/engine/src/devmode_behaviour_tests.rs +++ b/crates/engine/src/devmode_behaviour_tests.rs @@ -149,6 +149,52 @@ fn the_annotation_tool_picks_a_layer_and_asks_for_its_note() { assert_eq!(s.selection(), vec![r]); } +/// A named target that isn't a layer (a page, an unknown id) is an error, and the tool is left as it +/// was; several targets pick the first layer among them and select it. +#[test] +fn the_annotation_tool_checks_the_layer_it_is_named_for_before_changing_anything() { + let mut s = Session::new(); + let f = frame(&mut s, 0.0, "Screen"); + let r = rect(&mut s, f, 20.0); + let page = s.page().unwrap(); + assert!(s.execute("tool.annotation", &json!({"id": page})).is_err(), "a page is not a layer"); + assert!(s.execute("tool.annotation", &json!({"id": "9999:9999"})).is_err(), "no such layer"); + assert!(s.execute("tool.annotation", &json!({"ids": []})).is_err(), "nothing named"); + assert_eq!(s.tool.tool, ToolId::Move, "the tool did not change"); + assert!(note_requests(&s).is_empty()); + // The page first, then the rectangle: the rectangle is the target, and selected. + ex(&mut s, "tool.annotation", json!({"ids": [page, r]})); + assert_eq!((s.tool.tool, s.selection(), note_requests(&s)), (ToolId::Annotation, vec![r], vec![r])); +} + +/// Choosing the tool with `tool.set` (the toolbar) asks for the selected layer's note like Shift+T. +#[test] +fn choosing_the_annotation_tool_from_the_toolbar_asks_for_the_selected_layers_note() { + let mut s = Session::new(); + let f = frame(&mut s, 0.0, "Screen"); + let r = rect(&mut s, f, 20.0); + ex(&mut s, "select.set", json!({"ids": [r]})); + ex(&mut s, "tool.set", json!({"tool": "annotation"})); + assert_eq!((s.tool.tool, note_requests(&s)), (ToolId::Annotation, vec![r])); +} + +/// A drag with the tool never moves the layer it starts on, in Developer Mode or out of it. +#[test] +fn dragging_with_the_annotation_tool_moves_nothing() { + for dev_mode in [true, false] { + let mut s = Session::new(); + let f = frame(&mut s, 0.0, "Screen"); + rect(&mut s, f, 20.0); + s.tool.dev_mode = dev_mode; + ex(&mut s, "select.set", json!({"ids": []})); + ex(&mut s, "tool.annotation", json!({})); + let (doc_before, undo_before) = (s.doc().unwrap().clone(), s.undo_labels(1000).len()); + drag(&mut s, (40.0, 40.0), (140.0, 90.0)); + assert_eq!(*s.doc().unwrap(), doc_before, "dev_mode {dev_mode}"); + assert_eq!(s.undo_labels(1000).len(), undo_before, "dev_mode {dev_mode}"); + } +} + #[test] fn dev_mode_runs_its_own_edits_and_refuses_design_edits_from_menus_and_shortcuts() { for id in [ diff --git a/crates/ui-egui/src/app/commands.rs b/crates/ui-egui/src/app/commands.rs index e0481f3fc..e36471b42 100644 --- a/crates/ui-egui/src/app/commands.rs +++ b/crates/ui-egui/src/app/commands.rs @@ -269,7 +269,11 @@ impl FigApp { "annotation.new" => { // The Annotation tool: show the Inspect tab (never toggle it away) and put the // caret in the layer's new-note field. - if let Some(id) = r.data.get("id").and_then(figcraft_engine::params::id_of) { + // Only a selected layer's field can show; a request for anything else would wait + // and take the keyboard later. + let shown = + |id| self.session.selection().contains(&id) && self.session.doc().is_ok_and(|d| d.node(id).is_some_and(|n| !n.is_page())); + if let Some(id) = r.data.get("id").and_then(figcraft_engine::params::id_of).filter(|id| shown(*id)) { self.ui.right_tab = RightTab::Inspect; self.ui.dev.focus_new_note = Some(id); } diff --git a/crates/ui-egui/src/dev_mode_tests.rs b/crates/ui-egui/src/dev_mode_tests.rs index 844fe1bfe..b7a9f129d 100644 --- a/crates/ui-egui/src/dev_mode_tests.rs +++ b/crates/ui-egui/src/dev_mode_tests.rs @@ -210,5 +210,33 @@ fn the_annotation_tool_opens_the_inspect_tab_with_the_note_field_focused() { assert_eq!(u.app.ui.dev.focus_new_note, None, "the focus request is spent"); // Asking again while already on the Inspect tab does not toggle it away. u.run("tool.annotation", json!({"id": r})); + u.frames(2, Vec::new); assert_eq!(u.app.ui.right_tab, crate::RightTab::Inspect); + assert!(u.ctx.memory(|m| m.has_focus(field)), "the field has the caret again"); + assert_eq!(u.app.ui.dev.focus_new_note, None, "and the request is spent"); +} + +/// A request for a layer that isn't selected (or is gone) does not wait to take the keyboard later. +#[test] +fn a_note_request_for_a_layer_that_is_not_selected_is_dropped() { + let (mut u, _, r) = setup(); + u.app.session.execute("select.set", &json!({"ids": []})).unwrap(); + u.frames(2, Vec::new); + u.app.session.request_ui("annotation.new", json!({"id": r})); + u.frames(2, Vec::new); + assert_eq!(u.app.ui.dev.focus_new_note, None); +} + +/// Choosing the Annotation tool from the toolbar on the Inspect tab keeps the tab (an editing tool +/// would leave it for Design) and asks for the selected layer's note. +#[test] +fn the_toolbar_keeps_the_inspect_tab_for_the_annotation_tool() { + let (mut u, _, r) = setup(); + u.app.session.execute("select.set", &json!({"ids": [r]})).unwrap(); + crate::toolbar::choose(&mut u.app, figcraft_engine::ToolId::Annotation); + u.frames(2, Vec::new); + assert_eq!(u.app.ui.right_tab, crate::RightTab::Inspect); + assert!(u.ctx.memory(|m| m.has_focus(egui::Id::unique(("annot_new", r)).with("te"))), "the note field has the caret"); + crate::toolbar::choose(&mut u.app, figcraft_engine::ToolId::Rectangle); + assert_eq!(u.app.ui.right_tab, crate::RightTab::Design, "a drawing tool leaves it"); } diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs index cbe065c22..d57f2019b 100644 --- a/crates/ui-egui/src/toolbar.rs +++ b/crates/ui-egui/src/toolbar.rs @@ -626,8 +626,8 @@ fn flyout(app: &mut FigApp, ui: &mut Ui, g: &Group, bottom_left: egui::Pos2) { /// Choose `tool` from the toolbar. Dev Mode only inspects: a tool that edits leaves it for the /// design. -fn choose(app: &mut FigApp, tool: ToolId) { - if app.ui.right_tab == crate::RightTab::Inspect && !matches!(tool, ToolId::Move | ToolId::Hand | ToolId::Comment | ToolId::Annotation) { +pub(crate) fn choose(app: &mut FigApp, tool: ToolId) { + if app.ui.right_tab == crate::RightTab::Inspect && !tool.works_in_dev_mode() { app.ui.right_tab = crate::RightTab::Design; } app.run("tool.set", json!({"tool": tool.id()})); From 53bf0a40d9a5bbe6c9b8aef9c19454dfbb201bfa Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 15:09:23 -0500 Subject: [PATCH 087/239] M8: Zoom to selection centres a point above the toolbar and ignores non-finite rectangles; tests pin the margins (#2139 review) fit_selection checks every coordinate is finite (a NaN y or x1 left a NaN centre) and leaves the view as it is for such a rectangle. A point selection is centred in the area above the toolbar at its zoom, not in the whole viewport. Tests pin the exact short-canvas and no-inset positions, the narrow-canvas margins, lines, tiny and huge rectangles, the bottomInset clamp and that it is never saved, the unchanged Zoom to fit centre, the pill strip the app hands the engine (shown and hidden), and the Shift+2 centre without reading the inset back. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 triaged and briefed; Sonnet 5.5 verified and wrote at medium --- crates/engine/src/view_behaviour_tests.rs | 88 ++++++++++++++++++++++- crates/engine/src/view_state.rs | 11 ++- crates/ui-egui/src/shortcuts_tests.rs | 19 ++++- 3 files changed, 113 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/view_behaviour_tests.rs b/crates/engine/src/view_behaviour_tests.rs index 9c77314e0..c470afe18 100644 --- a/crates/engine/src/view_behaviour_tests.rs +++ b/crates/engine/src/view_behaviour_tests.rs @@ -806,6 +806,9 @@ fn zoom_to_selection_on_a_wide_layer_is_limited_by_the_width() { fn zoom_to_selection_without_a_toolbar_inset_uses_the_whole_height() { let (v, _) = zoom_on("view.zoomSelection", 0.0, 100.0, 100.0); assert!((v.zoom - (903.0 - 80.0) / 100.0).abs() < 1e-6, "{}", v.zoom); + let (_, top) = v.page_to_screen(0.0, 0.0); + let (_, bottom) = v.page_to_screen(100.0, 100.0); + assert!((top - 40.0).abs() < 1e-6 && (bottom - 863.0).abs() < 1e-6, "top {top}, bottom {bottom}"); } #[test] @@ -822,6 +825,86 @@ fn zoom_to_selection_in_a_short_canvas_still_ends_above_the_toolbar() { let (_, bottom) = v.page_to_screen(100.0, 100.0); assert!(top >= 0.0 && bottom <= 70.0 + 1e-6, "top {top}, bottom {bottom}"); assert!((top - (70.0 - bottom)).abs() < 1e-6, "centred above the toolbar: top {top}, bottom {bottom}"); + // The margin shrinks to a quarter of the 70 points (17.5) and the zoom is the exact fit, not the floor. + assert!((v.zoom - 0.35).abs() < 1e-9, "{}", v.zoom); + assert!((top - 17.5).abs() < 1e-6 && (bottom - 52.5).abs() < 1e-6, "top {top}, bottom {bottom}"); +} + +/// A canvas narrower than 160 points keeps a quarter of its width on each side. +#[test] +fn zoom_to_selection_in_a_narrow_canvas_shrinks_the_side_margins() { + let mut s = Session::new(); + let r = rect(&mut s, 0.0, 0.0, 100.0, 100.0, None); + ex(&mut s, "view.set", json!({"vw": 100, "vh": 903, "bottomInset": 0})); + ex(&mut s, "select.set", json!({"ids": [r]})); + ex(&mut s, "view.zoomSelection", json!({})); + let v = view(&s); + let (left, _) = v.page_to_screen(0.0, 0.0); + let (right, _) = v.page_to_screen(100.0, 100.0); + assert!((v.zoom - 0.5).abs() < 1e-9, "{}", v.zoom); + assert!((left - 25.0).abs() < 1e-6 && (right - 75.0).abs() < 1e-6, "left {left}, right {right}"); +} + +/// A view 1000 by 800 with a 100-point toolbar strip, for the edge cases of the fit. +fn strip_view() -> ViewState { + ViewState { vw: 1000.0, vh: 800.0, bottom_inset: 100.0, ..ViewState::default() } +} + +#[test] +fn fitting_a_selection_survives_points_lines_extremes_and_junk() { + // A point: the zoom stays, and it lands in the middle of the area above the toolbar (y = 350). + let mut v = strip_view(); + v.zoom = 2.0; + v.fit_selection(Rect::new(10.0, 20.0, 10.0, 20.0), 32.0); + assert_eq!(v.zoom, 2.0); + let (x, y) = v.page_to_screen(10.0, 20.0); + assert!((x - 500.0).abs() < 1e-9 && (y - 350.0).abs() < 1e-9, "{x}, {y}"); + // A zero-width line is limited by its height, a zero-height one by its width. + let mut v = strip_view(); + v.fit_selection(Rect::new(0.0, 0.0, 0.0, 100.0), 32.0); + assert!((v.zoom - (700.0 - 80.0) / 100.0).abs() < 1e-9, "{}", v.zoom); + let mut v = strip_view(); + v.fit_selection(Rect::new(0.0, 0.0, 100.0, 0.0), 32.0); + assert!((v.zoom - (1000.0 - 80.0) / 100.0).abs() < 1e-9, "{}", v.zoom); + // A tiny one stops at the maximum zoom, a huge one at the minimum. + let mut v = strip_view(); + v.fit_selection(Rect::new(0.0, 0.0, 0.001, 0.001), 32.0); + assert_eq!(v.zoom, 32.0); + v.fit_selection(Rect::new(0.0, 0.0, 1e12, 1e12), 32.0); + assert_eq!(v.zoom, ViewState::MIN_ZOOM); + // A rectangle with any coordinate that is not a finite number changes nothing. + for bad in [ + Rect::new(0.0, f64::NAN, 10.0, 10.0), + Rect::new(0.0, 0.0, f64::INFINITY, 10.0), + Rect::new(0.0, 0.0, 10.0, f64::NAN), + Rect::new(f64::NAN, 0.0, 10.0, 10.0), + ] { + let mut v = strip_view(); + let before = (v.zoom, v.cx, v.cy); + v.fit_selection(bad, 32.0); + assert_eq!((v.zoom, v.cx, v.cy), before, "{bad:?}"); + } +} + +#[test] +fn the_bottom_inset_is_clamped_and_never_saved() { + let mut s = Session::new(); + ex(&mut s, "view.set", json!({"bottomInset": -5})); + assert_eq!(view(&s).bottom_inset, 0.0); + ex(&mut s, "view.set", json!({"bottomInset": 1e12})); + assert_eq!(view(&s).bottom_inset, 20000.0); + // Larger than the viewport: the fit still leaves a sliver of canvas and a finite centre. + ex(&mut s, "view.set", json!({"vw": 400, "vh": 300, "bottomInset": 5000})); + let r = rect(&mut s, 0.0, 0.0, 10.0, 10.0, None); + ex(&mut s, "select.set", json!({"ids": [r]})); + ex(&mut s, "view.zoomSelection", json!({})); + let v = view(&s); + assert!(v.zoom.is_finite() && v.cx.is_finite() && v.cy.is_finite(), "{v:?}"); + // It is not part of what the view saves. + let saved = serde_json::to_string(&v).unwrap(); + assert!(!saved.to_lowercase().contains("inset"), "{saved}"); + let back: ViewState = serde_json::from_str(&saved).unwrap(); + assert_eq!(back.bottom_inset, 0.0); } #[test] @@ -831,5 +914,8 @@ fn zoom_to_fit_is_unchanged() { rect(&mut s, 0.0, 0.0, 100.0, 100.0, None); ex(&mut s, "view.set", json!({"vw": 1389, "vh": 903, "bottomInset": 58})); ex(&mut s, "view.zoomFit", json!({})); - assert!((view(&s).zoom - (903.0 - 128.0) / 100.0).abs() < 1e-6); + let v = view(&s); + assert!((v.zoom - (903.0 - 128.0) / 100.0).abs() < 1e-6); + // No toolbar offset: the rectangle's own centre stays in the middle of the whole viewport. + assert_eq!((v.cx, v.cy), (50.0, 50.0)); } diff --git a/crates/engine/src/view_state.rs b/crates/engine/src/view_state.rs index 212bb93b4..8a8cc8a01 100644 --- a/crates/engine/src/view_state.rs +++ b/crates/engine/src/view_state.rs @@ -113,13 +113,18 @@ impl ViewState { /// Fit a page rectangle for Zoom to selection: a 40 point margin on all four sides of the area /// above the bottom toolbar (`vw` by `vh - bottom_inset`), centred in that area. pub fn fit_selection(&mut self, r: figcraft_geom::Rect, max_zoom: f64) { - if !(r.width() > 0.0 || r.height() > 0.0) || !r.x0.is_finite() { - self.cx = r.center().x; - self.cy = r.center().y; + // A rectangle that isn't all finite numbers leaves the view as it is. + if ![r.x0, r.y0, r.x1, r.y1].iter().all(|v| v.is_finite()) { return; } let inset = if self.bottom_inset.is_finite() { self.bottom_inset.clamp(0.0, (self.vh - 1.0).max(0.0)) } else { 0.0 }; let area_h = (self.vh - inset).max(1.0); + // A point (nothing to fit) is centred in the area above the toolbar at the zoom it has. + if !(r.width() > 0.0 || r.height() > 0.0) { + self.cx = r.center().x; + self.cy = r.center().y + (self.vh - area_h) / 2.0 / self.zoom.max(1e-6); + return; + } // 40 points as measured; a canvas too small for that keeps a quarter of its size on each // side instead, so the selection still ends above the toolbar. let mx = (self.vw / 4.0).clamp(0.0, 40.0); diff --git a/crates/ui-egui/src/shortcuts_tests.rs b/crates/ui-egui/src/shortcuts_tests.rs index e9c822c2b..fea6f21cd 100644 --- a/crates/ui-egui/src/shortcuts_tests.rs +++ b/crates/ui-egui/src/shortcuts_tests.rs @@ -91,7 +91,11 @@ fn shift_digits_zoom() { assert!(zoom(&u) > fit, "Shift+2 fits the smaller selection"); let v = &u.app.session.ds().unwrap().view; // Centred in the canvas above the bottom toolbar: the page centre sits half the toolbar's strip lower. - let expect_cy = 40.0 + v.bottom_inset / 2.0 / v.zoom; + // The strip is the canvas's bottom edge less the pill's top, worked out here, not read back. + let strip = f64::from(u.app.canvas.rect.max.y - crate::toolbar::pill_rect(u.app.canvas.rect, 0.0).min.y); + assert!(strip > 20.0 && strip < 200.0, "the pill is a toolbar's height: {strip}"); + assert!((v.bottom_inset - strip).abs() < 1e-3, "the app gives the engine the pill's strip: {} vs {strip}", v.bottom_inset); + let expect_cy = 40.0 + strip / 2.0 / v.zoom; assert_eq!(v.cx, 110.0, "centred on it"); assert!((v.cy - expect_cy).abs() < 1e-9, "centred above the toolbar: {} vs {expect_cy}", v.cy); // `+` and `-` step the zoom. @@ -204,3 +208,16 @@ fn shortcuts_panel_does_not_show_on_the_home_screen() { u.frame(vec![]); assert!(!u.app.ui.shortcuts_panel, "the panel closes on the home screen"); } + +/// The strip the bottom toolbar covers is given to the engine while the toolbar shows and is zero +/// when the interface is hidden. +#[test] +fn the_toolbar_strip_is_zero_when_the_interface_is_hidden() { + let (mut u, _, _) = setup(); + u.frame(vec![]); + u.frame(vec![]); + assert!(u.app.session.ds().unwrap().view.bottom_inset > 0.0, "shown"); + u.app.session.ds_mut().unwrap().view.ui_hidden = true; + u.frame(vec![]); + assert_eq!(u.app.session.ds().unwrap().view.bottom_inset, 0.0, "hidden"); +} From 1ef0c16fdf81b1488d458fc4dc158c20d65ce6d8 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 15:11:14 -0500 Subject: [PATCH 088/239] M8: invert zoom direction tests: Ctrl wheel, panning unchanged, pinch both ways, off persists (#2147 review) Tests only. Ctrl+wheel joins Cmd+wheel; panning (plain wheel, Cmd/Ctrl+wheel and Shift+wheel with Scroll wheel zoom on) is compared between invert on and off; the pinch runs with Scroll wheel zoom on and off and with factors above and below 1; the pref's off value is saved and reloaded. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 triaged and briefed; Sonnet 5.5 verified and wrote at medium --- crates/engine/src/a11y_keys_tests.rs | 5 +++ crates/ui-egui/src/canvas/wheel_zoom_tests.rs | 45 +++++++++++++------ 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/crates/engine/src/a11y_keys_tests.rs b/crates/engine/src/a11y_keys_tests.rs index 5dd604670..6fc5f2396 100644 --- a/crates/engine/src/a11y_keys_tests.rs +++ b/crates/engine/src/a11y_keys_tests.rs @@ -115,6 +115,11 @@ fn the_invert_zoom_preference_toggles_and_is_saved() { let loaded: crate::Prefs = serde_json::from_value(saved).unwrap(); assert!(loaded.invert_zoom); assert_eq!(s.execute("pref.invertZoom", &json!({"on": false})).unwrap()["on"], false); + assert!(!s.prefs.invert_zoom); + let saved = serde_json::to_value(&s.prefs).unwrap(); + assert_eq!(saved["invert_zoom"], false); + let loaded: crate::Prefs = serde_json::from_value(saved).unwrap(); + assert!(!loaded.invert_zoom, "off persists after being on"); // Preferences saved before the setting existed read it as off. let old: crate::Prefs = serde_json::from_value(json!({"theme": "dark"})).unwrap(); assert!(!old.invert_zoom); diff --git a/crates/ui-egui/src/canvas/wheel_zoom_tests.rs b/crates/ui-egui/src/canvas/wheel_zoom_tests.rs index 7574e96a4..b5a36a7de 100644 --- a/crates/ui-egui/src/canvas/wheel_zoom_tests.rs +++ b/crates/ui-egui/src/canvas/wheel_zoom_tests.rs @@ -134,12 +134,14 @@ fn the_swap_keeps_egui_rates() { #[test] fn invert_zoom_reverses_cmd_or_ctrl_wheel_by_the_same_factor() { - let (mut off, mut on) = (Canvas::with_invert(false, false), Canvas::with_invert(false, true)); - let (a, b, _) = off.gesture(wheel(MouseWheelUnit::Line, 3.0, Modifiers::COMMAND), Modifiers::COMMAND); - let (c, d, _) = on.gesture(wheel(MouseWheelUnit::Line, 3.0, Modifiers::COMMAND), Modifiers::COMMAND); - assert!(b.0 > a.0 * 1.05, "off zooms in: {a:?} -> {b:?}"); - assert!(d.0 < c.0 / 1.05, "on zooms out: {c:?} -> {d:?}"); - assert!(((b.0 / a.0) * (d.0 / c.0) - 1.0).abs() < 1e-3, "by the same factor"); + for mods in [Modifiers::COMMAND, Modifiers::CTRL] { + let (mut off, mut on) = (Canvas::with_invert(false, false), Canvas::with_invert(false, true)); + let (a, b, _) = off.gesture(wheel(MouseWheelUnit::Line, 3.0, mods), mods); + let (c, d, _) = on.gesture(wheel(MouseWheelUnit::Line, 3.0, mods), mods); + assert!(b.0 > a.0 * 1.05, "{mods:?} off zooms in: {a:?} -> {b:?}"); + assert!(d.0 < c.0 / 1.05, "{mods:?} on zooms out: {c:?} -> {d:?}"); + assert!(((b.0 / a.0) * (d.0 / c.0) - 1.0).abs() < 1e-3, "{mods:?} by the same factor"); + } } #[test] @@ -150,18 +152,33 @@ fn invert_zoom_reverses_a_plain_mouse_wheel_with_scroll_wheel_zoom_on() { assert!(b.0 > a.0 * 1.05, "off zooms in: {a:?} -> {b:?}"); assert!(d.0 < c.0 / 1.05, "on zooms out: {c:?} -> {d:?}"); assert!(((b.0 / a.0) * (d.0 / c.0) - 1.0).abs() < 1e-3, "by the same factor"); - // Without Scroll wheel zoom a plain wheel still scrolls, inverted or not. - let mut plain = Canvas::with_invert(false, true); - let (a, b, _) = plain.gesture(wheel(MouseWheelUnit::Line, -3.0, Modifiers::NONE), Modifiers::NONE); - assert!((b.0 - a.0).abs() < 1e-9 && b.2 > a.2 + 1.0, "scrolls: {a:?} -> {b:?}"); +} + +/// Panning is never inverted: the scroll vector is the same with the preference on and off. +#[test] +fn invert_zoom_leaves_panning_unchanged() { + // (Scroll wheel zoom, modifiers): a plain wheel without it, Cmd/Ctrl+wheel with it, Shift+wheel. + for (swz, mods) in [(false, Modifiers::NONE), (true, Modifiers::COMMAND), (true, Modifiers::CTRL), (true, Modifiers::SHIFT)] { + let (mut off, mut on) = (Canvas::with_invert(swz, false), Canvas::with_invert(swz, true)); + let (a, b, _) = off.gesture(wheel(MouseWheelUnit::Line, -3.0, mods), mods); + let (c, d, _) = on.gesture(wheel(MouseWheelUnit::Line, -3.0, mods), mods); + assert!((b.0 - a.0).abs() < 1e-9 && (d.0 - c.0).abs() < 1e-9, "{mods:?} no zoom"); + assert!(b.1 != a.1 || b.2 != a.2, "{mods:?} off pans: {a:?} -> {b:?}"); + assert!( + ((b.1 - a.1) - (d.1 - c.1)).abs() < 1e-9 && ((b.2 - a.2) - (d.2 - c.2)).abs() < 1e-9, + "{mods:?} same pan: {a:?} -> {b:?} vs {c:?} -> {d:?}" + ); + } } #[test] fn a_pinch_zooms_the_same_with_invert_zoom_on_and_off() { - for invert in [false, true] { - let mut c = Canvas::with_invert(false, invert); - let (a, b, _) = c.gesture(Event::Zoom(1.5), Modifiers::NONE); - assert!((b.0 / a.0 - 1.5).abs() < 1e-3, "invert {invert}: {a:?} -> {b:?}"); + for (swz, invert, factor) in + [(false, false, 1.5), (false, true, 1.5), (true, false, 1.5), (true, true, 1.5), (true, true, 0.5), (false, true, 0.5)] + { + let mut c = Canvas::with_invert(swz, invert); + let (a, b, _) = c.gesture(Event::Zoom(factor), Modifiers::NONE); + assert!((b.0 / a.0 - f64::from(factor)).abs() < 1e-3, "scroll wheel zoom {swz}, invert {invert}, x{factor}: {a:?} -> {b:?}"); } } From e415a3a0fb46eb32eafd9d807a11a0ae31fd8de2 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 15:16:36 -0500 Subject: [PATCH 089/239] M2: pin the leading-edge drag reorder at its boundaries, zero delta and several layers (#2142 review) Tests for the -129 leftward boundary, the vertical boundaries both ways, a drag with no move along the flow, and several moving layers using their combined box. Doc comments say whose edge is "leading" and what the caller passes; the parity row names the unchanged cases and the web-app measurement source. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 triaged and briefed; Sonnet 5.5 verified and wrote at medium --- crates/engine/src/al_drag_tests.rs | 44 ++++++++++++++++++++++++++++++ crates/engine/src/canvas/drop.rs | 12 ++++---- docs/auto-layout-parity.md | 2 +- 3 files changed, 52 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/al_drag_tests.rs b/crates/engine/src/al_drag_tests.rs index 23f416481..0c5119fc5 100644 --- a/crates/engine/src/al_drag_tests.rs +++ b/crates/engine/src/al_drag_tests.rs @@ -122,3 +122,47 @@ fn a_column_reorders_by_the_bottom_edge() { assert_eq!(dragged_order("vertical", 0, 30.0, 50.0), vec![1, 0, 2]); assert_eq!(dragged_order("vertical", 0, 30.0, 130.0), vec![1, 2, 0]); } + +#[test] +fn a_child_dragged_left_passes_the_second_sibling_one_pixel_later() { + assert_eq!(dragged_order("horizontal", 2, 30.0, -129.0), vec![0, 2, 1]); +} + +#[test] +fn a_column_reorders_at_the_boundaries_both_ways() { + assert_eq!(dragged_order("vertical", 0, 30.0, 49.0), vec![0, 1, 2]); + assert_eq!(dragged_order("vertical", 0, 30.0, 129.0), vec![1, 0, 2]); + assert_eq!(dragged_order("vertical", 2, 30.0, -49.0), vec![0, 1, 2]); + assert_eq!(dragged_order("vertical", 2, 30.0, -50.0), vec![0, 2, 1]); + assert_eq!(dragged_order("vertical", 2, 30.0, -129.0), vec![0, 2, 1]); + assert_eq!(dragged_order("vertical", 2, 30.0, -130.0), vec![2, 0, 1]); +} + +#[test] +fn a_drag_with_no_move_along_the_flow_keeps_the_slot() { + // Back at the start, and a drag across the flow only, with snapping on (the default). + assert_eq!(dragged_order("horizontal", 1, 30.0, 0.0), vec![0, 1, 2]); + assert_eq!(dragged_order("vertical", 1, 30.0, 0.0), vec![0, 1, 2]); + let mut s = Session::new(); + let (f, kids) = three(&mut s, "horizontal"); + let b = s.doc().unwrap().world_bounds(kids[1]).unwrap(); + let from = (b.center().x, b.center().y); + drag(&mut s, from, (from.0, from.1 + 40.0)); + let order = s.doc().unwrap().node(f).unwrap().children.clone(); + assert_eq!(order, kids.to_vec()); +} + +#[test] +fn several_dragged_children_use_their_combined_box() { + // Kids 0 and 1 together span 0..140; moved right by 49 the leading edge is at 189, just short of the middle of kid 2 (190). + for (by, expected) in [(49.0, vec![0, 1, 2]), (50.0, vec![2, 0, 1])] { + let mut s = Session::new(); + let (f, kids) = three(&mut s, "horizontal"); + s.execute("select.set", &json!({"ids": [kids[0], kids[1]]})).unwrap(); + let b = s.doc().unwrap().world_bounds(kids[0]).unwrap(); + let from = (b.center().x, b.center().y); + drag(&mut s, from, (from.0 + by, from.1)); + let order: Vec = s.doc().unwrap().node(f).unwrap().children.iter().map(|c| kids.iter().position(|k| k == c).unwrap()).collect(); + assert_eq!(order, expected, "by {by}"); + } +} diff --git a/crates/engine/src/canvas/drop.rs b/crates/engine/src/canvas/drop.rs index 7bad66ac3..f8c73de3e 100644 --- a/crates/engine/src/canvas/drop.rs +++ b/crates/engine/src/canvas/drop.rs @@ -24,9 +24,10 @@ pub fn auto_layout_slot(doc: &Document, parent: NodeId, p: Point, exclude: &[Nod } /// [`auto_layout_slot`] for layers dragged within their own frame (measured in Figma's web app, -/// 2026-11-09): the slot follows the leading edge of `moved`, the box the layers would fill under -/// the pointer, in the direction of `delta` (the drag along the page). Wrapping layouts keep the -/// pointer rule. +/// 2026-11-09): the slot follows the leading edge of `moved` in the direction of `delta`. The caller +/// passes `moved` as the layers' combined start bounds plus the raw (unsnapped) drag, and `delta` +/// as that same drag on the page; only its sign along the flow axis matters, and a zero delta uses +/// the low edge. Wrapping layouts keep the pointer rule. pub fn auto_layout_slot_within( doc: &Document, parent: NodeId, @@ -62,8 +63,9 @@ fn slot_in( let mid = |c: &NodeId| doc.world_bounds(*c).map(|b| if vertical { b.center().y } else { b.center().x }); let k = if let Some((r, d)) = dragged { let (lo, hi, dd) = if vertical { (r.y0, r.y1, d.y) } else { (r.x0, r.x1, d.x) }; - // Forward: past every sibling whose middle the trailing edge has reached; backward: past - // every one whose middle lies before the leading (low) edge. + // Forward: past every sibling whose middle the leading (high) edge has reached; backward: past + // every one whose middle lies before the leading (low) edge. A zero delta (no move along the + // flow) takes the backward rule, which leaves the layers where they were. flow_ids.iter().position(|c| mid(c).is_some_and(|m| if dd > 0.0 { m > hi } else { m >= lo })).unwrap_or(flow_ids.len()) } else { let pos = if vertical { p.y } else { p.x }; diff --git a/docs/auto-layout-parity.md b/docs/auto-layout-parity.md index 16776ca5e..03b6fd830 100644 --- a/docs/auto-layout-parity.md +++ b/docs/auto-layout-parity.md @@ -88,7 +88,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Absolute position (ignore auto layout) with constraints | done | | | Strokes included in layout (inside strokes), canvas stacking | done | | | On-canvas padding and gap handles, incl. wrap row/column gap and grid gaps | done | an automatic gap's handle shows the distance it has; dragging it fixes the gap from there (silent in the documentation) | -| Drag to reorder (wrap-aware, by row or column), into grid cells, across nested frames | done | `al_drag_tests.rs`. A child dragged within its own row or column takes its slot by the dragged box's leading edge, not the pointer: it passes a sibling when the edge facing the drag reaches the sibling's middle (right or bottom edge going forward, left or top edge going back), wherever it was grabbed. Measured in Figma's web app, 2026-11-09 (three 60 x 60 rectangles, gap 20: after B at 50, after C at 130; the mirror for a leftward drag; the same along y). Layers dragged in from outside and wrapping layouts keep the pointer rule (unmeasured). Tests: `a_child_dragged_right_passes_a_sibling_when_its_leading_edge_reaches_the_siblings_middle`, `where_the_child_is_grabbed_does_not_change_its_slot`, `a_child_dragged_left_passes_a_sibling_by_its_left_edge`, `a_column_reorders_by_the_bottom_edge` | +| Drag to reorder (wrap-aware, by row or column), into grid cells, across nested frames | done | `al_drag_tests.rs`. A child dragged within its own row or column takes its slot by the dragged box's leading edge, not the pointer: it passes a sibling when the edge facing the drag reaches the sibling's middle (right or bottom edge going forward, left or top edge going back), wherever it was grabbed. Measured in Figma's web app, 2026-11-09 (three 60 x 60 rectangles, gap 20: after B at 50, after C at 130; the mirror for a leftward drag; the same along y). Several moving layers use their combined box. Layers dragged in from outside, wrapping layouts, grids and a drag out of the frame keep their earlier rules (unmeasured). The measurement was made in the web app; the desktop target was not re-checked. Tests: `a_child_dragged_right_passes_a_sibling_when_its_leading_edge_reaches_the_siblings_middle`, `where_the_child_is_grabbed_does_not_change_its_slot`, `a_child_dragged_left_passes_a_sibling_by_its_left_edge`, `a_column_reorders_by_the_bottom_edge`, `a_column_reorders_at_the_boundaries_both_ways`, `a_drag_with_no_move_along_the_flow_keeps_the_slot`, `several_dragged_children_use_their_combined_box` | | Arrow keys move children one place (flows, rows, columns, grid cells, into neighbours) | done | `al_keys_tests.rs` | | Constraints: left, right, left and right, centre, scale; top/bottom likewise | done | | | Layout grids: columns, rows, grid; stretch/left/centre/right; variables bound | done | | From 966aa7b263e49ad64d8cd2000d35e0dd3c7c08ae Mon Sep 17 00:00:00 2001 From: ljkx <177671075+ljkx@users.noreply.github.com> Date: Mon, 9 Nov 2026 21:23:20 +0100 Subject: [PATCH 090/239] M8: automation roots refuse a path they can't look at, and review follow-ups (#1094) Review of the fix for #1094: - A path that can't be made absolute is refused instead of going on to be resolved. - A name on the way that can't be looked at for a reason other than nothing being there (no permission, for one) is refused: it may be a link that resolving would follow. Only "not found", "not a directory" and "invalid filename" count as nothing there. - Tests: the link part of the Windows test is its own test, so the spelling and device checks no longer share a test with a part that is skipped where links can't be made; the timing assertion is gone (the messages tell the cases apart); link chains of 39, 40 and 41 links; a root on a share against every network spelling, in both of the root's spellings; devices for read and write; `..` after a link; paths that aren't UTF-8. - Docs brought in line with the code. --- crates/engine/src/automation/file_access.rs | 59 ++++++--- .../src/automation/file_access/tests.rs | 118 +++++++++++++++--- 2 files changed, 137 insertions(+), 40 deletions(-) diff --git a/crates/engine/src/automation/file_access.rs b/crates/engine/src/automation/file_access.rs index 97c6cd2f5..249d3483c 100644 --- a/crates/engine/src/automation/file_access.rs +++ b/crates/engine/src/automation/file_access.rs @@ -14,9 +14,9 @@ //! checked is what is opened. //! //! On Windows, resolving a path opens it, and opening a path on another computer contacts that -//! computer and may send it the signed-in user's credentials. So before anything is resolved, a -//! path on another computer that no root is on, a device path, or one reached through a link that -//! leads to them is refused by how it is spelled (#1094). +//! computer and may send it the signed-in user's credentials. So on Windows, before anything is +//! resolved, a path on another computer whose share no root is on, a device path, or one reached +//! through a link that leads to them is refused by how it is spelled (#1094). #![allow(clippy::disallowed_methods)] use std::cell::RefCell; @@ -95,7 +95,9 @@ impl Roots { } } -/// Why `asked` is refused: it is outside every one of `roots`, the folders that may be `what`. +/// Why `asked` is refused: it is outside every one of `roots`, the folders that may be `what` +/// ("read" or "written"). The message lists those folders, or says that no folder may be `what` +/// when `roots` is empty. fn outside(asked: std::path::Display<'_>, roots: &[PathBuf], what: &str) -> String { if roots.is_empty() { return format!("automation path rejected: no folder may be {what} (no root for it was given): {asked}"); @@ -109,7 +111,8 @@ fn outside(asked: std::path::Display<'_>, roots: &[PathBuf], what: &str) -> Stri enum Unresolved { /// Its spelling leads to another computer ([`Refused::Network`]) or a device ([`Refused::Device`]). Spelled(Refused), - /// A link on the way leads there. + /// A link on the way leads there, or the way there can't be looked at: a link or folder on it + /// can't be read, it has more than [`MAX_LINKS`] links, or the path can't be made absolute. Linked, } @@ -119,13 +122,15 @@ const MAX_LINKS: u8 = 40; /// Why `path` is refused before anything on the way to it is opened, if it is: resolving it would /// open a path on another computer, which on Windows contacts that computer and may send it the /// signed-in user's credentials, or open a device (#1094). That is the case when the path as -/// given or made absolute is (see [`refused_spelling`]), or when a link on the way, or on the way -/// on from where one leads, leads to such a path ([`link_refused`]). A path on the share of one of -/// `roots` goes on to the usual check. +/// given or made absolute is refused by its spelling ([`refused_spelling`]), or when a link on +/// the way, or on the way on from where one leads, leads to such a path ([`link_refused`]). A path +/// on the share of one of `roots` goes on to the usual check. A path that can't be made absolute +/// is refused as well, rather than left to what comes next. fn refused_unresolved(path: &Path, roots: &[PathBuf]) -> Option { // Made absolute without looking at the disk (on Windows `GetFullPathNameW`, which also turns a - // bare device name such as `NUL` into `\\.\NUL`, as opening it would). - let abs = std::path::absolute(path).ok()?; + // bare device name such as `NUL` into `\\.\NUL`, as opening it would). Like opening, it takes + // `..` by name, so `link\..\x` is `x` and never goes through the link. + let Ok(abs) = std::path::absolute(path) else { return Some(Unresolved::Linked) }; if let Some(why) = [path, abs.as_path()].into_iter().find_map(|p| refused_spelling(&p.to_string_lossy(), roots)) { return Some(Unresolved::Spelled(why)); } @@ -135,36 +140,49 @@ fn refused_unresolved(path: &Path, roots: &[PathBuf]) -> Option { /// What is at a path, looked at without following a link there. #[derive(Debug, Clone, PartialEq, Eq)] enum Entry { - /// Nothing, or what can't be looked at: resolving the path meets the same there and goes no - /// further. + /// Nothing ([`nothing_there`]): resolving the path meets the same there and goes no further. Missing, + /// Something that can't be looked at (no permission, for one). It may be a link that resolving + /// the path would still follow, so the path is refused. + Unreadable, /// A file or a folder. Plain, /// A link, with where it leads (`None` when that can't be read). Link(Option), } -/// What is at `p` on disk (see [`Entry`]). +/// What is at `p` on disk (see [`Entry`]), looked at with [`std::fs::symlink_metadata`], which +/// doesn't follow a link there; a link's target is read with [`std::fs::read_link`]. fn on_disk(p: &Path) -> Entry { match std::fs::symlink_metadata(p) { Ok(m) if m.is_symlink() => Entry::Link(std::fs::read_link(p).ok()), Ok(_) => Entry::Plain, - Err(_) => Entry::Missing, + Err(e) if nothing_there(&e) => Entry::Missing, + Err(_) => Entry::Unreadable, } } +/// Whether looking at a path failed with `e` because nothing is there: no such name, a file where +/// a folder was expected, or a name no file can have. Any other failure says nothing about what is +/// there. +fn nothing_there(e: &std::io::Error) -> bool { + use std::io::ErrorKind::{InvalidFilename, NotADirectory, NotFound}; + matches!(e.kind(), NotFound | NotADirectory | InvalidFilename) +} + /// Why path `p` is refused by its spelling alone, if it is (see [`craft_docpath::resolve`], which /// reads both `/` and `\` as separators and compares names ignoring case): /// - on another computer (`\\server\share`, `//server/share`, `\\?\UNC\…`, `\\.\UNC\…`, or a /// server without a share) and on no root's share; /// - a device path (`\\.\pipe\…`, `\\?\GLOBALROOT\…`, `\\.\C:\…`), other than a local volume's -/// `\\?\Volume{…}\`, which a folder can be mounted as; +/// `\\?\Volume{…}\` or `\\.\Volume{…}\`, which a folder can be mounted as; /// - or with a device name (`CON`, `NUL`, `COM1.png`, `lpt1 `…) as any of its names: each folder on /// the way is opened in turn while the path is resolved, and the device behind a name such as /// `LPT1` can be a printer on another computer. fn refused_spelling(p: &str, roots: &[PathBuf]) -> Option { match craft_docpath::resolve(p, None) { - // With a root as the document, a path on its share is allowed. + // With a root passed as the document path (what a link would be relative to), a path on + // that root's share is allowed. Err(Refused::Network) if !roots.iter().any(|r| craft_docpath::resolve(p, Some(r)) != Err(Refused::Network)) => { return Some(Refused::Network); } @@ -186,10 +204,10 @@ fn is_volume(p: &str) -> bool { /// Whether a link on the way to `abs` (an absolute path) leads to a path [`refused_spelling`] /// refuses, following at most `links` links: one that leads to another, or on through further -/// links, is followed too, as resolving the path would. A link that can't be read, or more links -/// than that, are refused as well. Each name on the way is looked at with `look` ([`on_disk`]), -/// which doesn't follow a link: where a link leads is looked at only once its spelling is known -/// not to be refused. +/// links, is followed too, as resolving the path would. A link that can't be read, a name on the +/// way that can't be looked at ([`Entry::Unreadable`]), or more links than that, are refused as +/// well. Each name on the way is looked at with `look` ([`on_disk`]), which doesn't follow a +/// link: where a link leads is looked at only once its spelling is known not to be refused. fn link_refused(abs: &Path, roots: &[PathBuf], links: u8, look: &dyn Fn(&Path) -> Entry) -> bool { let mut at = PathBuf::new(); let mut rest = abs.components(); @@ -202,6 +220,7 @@ fn link_refused(abs: &Path, roots: &[PathBuf], links: u8, look: &dyn Fn(&Path) - Entry::Plain => continue, // Nothing is below what isn't there, so no link either. Entry::Missing => return false, + Entry::Unreadable => return true, Entry::Link(target) => target, }; let (Some(links), Some(target)) = (links.checked_sub(1), target) else { return true }; diff --git a/crates/engine/src/automation/file_access/tests.rs b/crates/engine/src/automation/file_access/tests.rs index 5f9c1ad5d..ebb01cebf 100644 --- a/crates/engine/src/automation/file_access/tests.rs +++ b/crates/engine/src/automation/file_access/tests.rs @@ -198,7 +198,8 @@ fn spellings_of_other_computers_and_devices_are_refused() { use super::refused_spelling; use craft_docpath::Refused::{Device, Network}; let local = [PathBuf::from(r"C:\work")]; - let network = [ + // On `\\192.0.2.1\share`. + let on_the_share = [ r"\\192.0.2.1\share\x.png", "//192.0.2.1/share/x.png", r"\/192.0.2.1/share\x.png", @@ -206,11 +207,14 @@ fn spellings_of_other_computers_and_devices_are_refused() { r"\\?\unc\192.0.2.1\share\x.png", "//?/UNC/192.0.2.1/share/x.png", r"\\.\UNC\192.0.2.1\share\x.png", + ]; + let elsewhere = [ // A server without a share is contacted too. r"\\192.0.2.1", r"\\192.0.2.1\", r"\\SERVER.\share \x.png", ]; + let network = [&on_the_share[..], &elsewhere[..]].concat(); let device = [ r"\\.\pipe\figcraft", r"\\?\GLOBALROOT\Device\Mup\192.0.2.1\share\x.png", @@ -236,6 +240,7 @@ fn spellings_of_other_computers_and_devices_are_refused() { r"C:\work\lpt.png", r"C:\work\nul-ish.txt", r"\\?\Volume{0b3b1c63-0000-0000-0000-100000000000}\x.png", + r"\\.\Volume{0b3b1c63-0000-0000-0000-100000000000}\x.png", "/home/u/work/x.png", "x.png", r"..\x.png", @@ -246,7 +251,18 @@ fn spellings_of_other_computers_and_devices_are_refused() { assert_eq!(refused_spelling(p, &local), want, "{p} with a local root"); } } - // A root on a share lets the paths on that share through, in any case and spelling, and only them. + // A root on a share lets the paths on that share through, in any case and spelling, and only them: + // every spelling above of a path on `\\192.0.2.1\share`, but not the server without a share + // or another server. + for root in [r"\\?\UNC\192.0.2.1\share", r"\\192.0.2.1\share\work"] { + let on_share = [PathBuf::from(root)]; + for p in on_the_share { + assert_eq!(refused_spelling(p, &on_share), None, "{p} with root {root}"); + } + for p in elsewhere { + assert_eq!(refused_spelling(p, &on_share), Some(Network), "{p} with root {root}"); + } + } let shared = [PathBuf::from(r"\\?\UNC\Server\Share\work")]; for p in [r"\\server\SHARE\work\x.png", r"\\?\UNC\SERVER\share\elsewhere\x.png", "//Server/Share/work/x.png"] { assert_eq!(refused_spelling(p, &shared), None, "{p}"); @@ -282,23 +298,37 @@ fn links_on_the_way_are_followed_by_their_spelling_first() { links.insert(at("root/remote"), Some(PathBuf::from(r"\\192.0.2.1\share"))); links.insert(at("root/far"), Some(at("root/remote/work"))); } + // Chains of `n` links, `root/-1` to `root/-2` and so on, the last one to `root/sub`. + for n in [MAX_LINKS - 1, MAX_LINKS, MAX_LINKS + 1] { + for i in 1..=n { + let next = if i == n { at("root/sub") } else { at(&format!("root/{n}-{}", i + 1)) }; + links.insert(at(&format!("root/{n}-{i}")), Some(next)); + } + } let plain = [at("root"), at("root/sub"), at("outside")]; + // What can't be looked at (no permission, say) may be a link, so it isn't taken for nothing. + let unreadable = at("root/locked"); let looked = RefCell::new(Vec::new()); let look = |p: &Path| { looked.borrow_mut().push(p.to_path_buf()); match links.get(p) { Some(target) => Entry::Link(target.clone()), None if base.starts_with(p) || plain.iter().any(|q| q == p) => Entry::Plain, + None if p == unreadable => Entry::Unreadable, None => Entry::Missing, } }; let refused = |rel: &str, roots: &[PathBuf]| link_refused(&at(rel), roots, MAX_LINKS, &look); - for rel in ["root/dev/x.png", "root/hop/x.png", "root/loop/x.png", "root/unreadable/x.png"] { + for rel in ["root/dev/x.png", "root/hop/x.png", "root/loop/x.png", "root/unreadable/x.png", "root/locked/x.png", "root/locked"] { assert!(refused(rel, &[]), "{rel}"); } for rel in ["root/alias/x.png", "root/sub/x.png", "root/x.png", "missing/dev/x.png"] { assert!(!refused(rel, &[]), "{rel}"); } + // As many links as are followed lead on; one more is refused. + assert!(!refused(&format!("root/{}-1/x.png", MAX_LINKS - 1), &[])); + assert!(!refused(&format!("root/{MAX_LINKS}-1/x.png"), &[])); + assert!(refused(&format!("root/{}-1/x.png", MAX_LINKS + 1), &[])); // A refused target isn't looked at, nor is anything below what isn't there. let looked = looked.take(); assert!(!looked.contains(&at("outside/nul")) && !looked.contains(&at("missing/dev")), "{looked:?}"); @@ -311,23 +341,57 @@ fn links_on_the_way_are_followed_by_their_spelling_first() { } } -/// A path on another computer, a device path, and a link to them are refused before anything is -/// opened: resolving them made Windows contact the server, which may send it the signed-in user's -/// credentials (#1094). Nothing answers on 192.0.2.1 (an address for documentation), so a path -/// there that is opened takes Windows seconds to give up on; one refused first, none. +/// A path that can't be looked at is refused rather than taken for one with nothing there (#1094): +/// only a failure that says nothing is there lets the walk stop, and a path that can't even be +/// made absolute isn't left to the checks after it. +#[test] +fn what_cannot_be_looked_at_is_refused() { + use super::{Unresolved, nothing_there, refused_unresolved}; + use std::io::{Error, ErrorKind}; + for kind in [ErrorKind::NotFound, ErrorKind::NotADirectory, ErrorKind::InvalidFilename] { + assert!(nothing_there(&Error::from(kind)), "{kind:?}"); + } + for kind in [ErrorKind::PermissionDenied, ErrorKind::ResourceBusy, ErrorKind::Interrupted, ErrorKind::Other] { + assert!(!nothing_there(&Error::from(kind)), "{kind:?}"); + } + assert_eq!(refused_unresolved(Path::new(""), &[]), Some(Unresolved::Linked)); +} + +/// On Windows a path is classified as Windows opens it (#1094): with `..` taken by name before +/// anything is opened (so a link followed by `..` is never gone through), and with names that +/// aren't Unicode (a lone surrogate) still read for the parts that are spelled in ASCII. +#[cfg(windows)] +#[test] +fn paths_are_classified_as_windows_opens_them() { + use super::{Unresolved, refused_unresolved}; + use craft_docpath::Refused::{Device, Network}; + use std::ffi::OsString; + use std::os::windows::ffi::OsStringExt; + assert_eq!(std::path::absolute(r"C:\work\remote\..\x.png").unwrap(), PathBuf::from(r"C:\work\x.png")); + // `before`, a lone surrogate, then `after`. + let odd = |before: &str, after: &str| { + let wide: Vec = before.encode_utf16().chain([0xD800]).chain(after.encode_utf16()).collect(); + PathBuf::from(OsString::from_wide(&wide)) + }; + assert_eq!(refused_unresolved(&odd(r"\\192.0.2.1\share\", ".png"), &[]), Some(Unresolved::Spelled(Network))); + assert_eq!(refused_unresolved(&odd(r"C:\figcraft-no-such-folder\", r"\nul"), &[]), Some(Unresolved::Spelled(Device))); + assert_eq!(refused_unresolved(&odd(r"C:\figcraft-no-such-folder\", ".png"), &[]), None); + // A NUL can't be passed to Windows at all, so the path can't be made absolute. + assert_eq!(refused_unresolved(Path::new("C:\\work\\a\0b.png"), &[]), Some(Unresolved::Linked)); +} + +/// A path on another computer and a device path are refused before anything is opened: resolving +/// them made Windows contact the server, which may send it the signed-in user's credentials +/// (#1094). Each is refused with a message that only the check before resolving gives: had the +/// path been resolved, 192.0.2.1 (an address for documentation, where nothing answers) would have +/// been contacted and the message would be the one for a path that can't be resolved. #[cfg(windows)] #[test] fn other_computers_and_devices_are_refused_before_anything_is_opened() { - use std::time::{Duration, Instant}; let f = Fixture::new("network"); let r = f.rw(); let read_only = Roots::new(&[f.p("root")], &[]).unwrap(); - let refused = |roots: &Roots, p: &str, access: Access| { - let t = Instant::now(); - let e = roots.check(Path::new(p), access).expect_err(p); - assert!(t.elapsed() < Duration::from_secs(3), "{p}: took {:?}, so it was opened", t.elapsed()); - e - }; + let refused = |roots: &Roots, p: &str, access: Access| roots.check(Path::new(p), access).expect_err(p); for p in [r"\\192.0.2.1\share\x.png", "//192.0.2.1/share/x.png", r"\\?\UNC\192.0.2.1\share\x.png", r"\\.\UNC\192.0.2.1\share\x.png", r"\\192.0.2.1"] { @@ -339,18 +403,30 @@ fn other_computers_and_devices_are_refused_before_anything_is_opened() { assert!(e.ends_with("is on another computer, and no folder that may be written is on its share"), "{p}: {e}"); } for p in [r"\\.\pipe\figcraft-roots", r"\\?\GLOBALROOT\Device\Mup\192.0.2.1\share\x.png", &f.p(r"root\COM1\x.png"), "nul"] { - let e = refused(&r, p, Access::Read); - assert!(e.ends_with("names a device, not a file"), "{p}: {e}"); + for access in [Access::Read, Access::Write] { + let e = refused(&r, p, access); + assert!(e.ends_with("names a device, not a file"), "{p}: {e}"); + } } // Local paths, in either spelling, are checked as before. let inside = std::fs::canonicalize(f.p("root")).unwrap().join("in.txt"); assert!(r.check(&inside, Access::Read).is_ok()); assert!(r.check(Path::new(&f.p(r"root\in.txt")), Access::Read).is_ok()); +} - // A link in a root to another computer is refused before it is followed, also through another - // link, and with the message any path outside gets: it doesn't tell where the link leads. +/// A link in a root to another computer is refused before it is followed (#1094), also through +/// another link, and with the message any path outside gets: it doesn't tell where the link +/// leads. Had the link been followed, the message would be the one for a path that can't be +/// resolved. This needs real links, which Windows lets only some accounts make: elsewhere it +/// says so and checks nothing (`links_on_the_way_are_followed_by_their_spelling_first` covers the +/// same walk with made-up links on every system). +#[cfg(windows)] +#[test] +fn links_to_other_computers_are_refused_before_they_are_followed() { + let f = Fixture::new("network-links"); + let r = f.rw(); if !symlink_dir(Path::new(r"\\192.0.2.1\share"), &f.0.join("root/remote")) || !symlink_dir(&f.0.join("root/remote/work"), &f.0.join("root/hop")) { - eprintln!("skipped links: this system doesn't let tests make symbolic links"); + eprintln!("skipped: this system doesn't let tests make symbolic links"); return; } // Relative to the link's folder. @@ -359,10 +435,12 @@ fn other_computers_and_devices_are_refused_before_anything_is_opened() { let standard = |p: &str| format!("automation path rejected: {p} is outside the folders that may be"); for p in [f.p("root/remote/x.png"), f.p("root/hop/x.png"), f.p("root/sub/up/x.png"), f.p("root/pipe")] { for access in [Access::Read, Access::Write] { - let e = refused(&r, &p, access); + let e = r.check(Path::new(&p), access).expect_err(&p); assert!(e.starts_with(&standard(&p)), "{p}: {e}"); } } + // `..` after the link is taken by name, so the link isn't gone through. + assert!(r.check(Path::new(&f.p(r"root\remote\..\in.txt")), Access::Read).is_ok()); // A link to a folder in the root still leads there. assert!(symlink_dir(&f.0.join("root/sub"), &f.0.join("root/alias"))); assert!(r.check(Path::new(&f.p("root/alias/x.png")), Access::Write).is_ok()); From 938f8b2ad983c17cab75713be42cc9067538c53d Mon Sep 17 00:00:00 2001 From: ljkx <177671075+ljkx@users.noreply.github.com> Date: Mon, 9 Nov 2026 21:29:18 +0100 Subject: [PATCH 091/239] M8: test that `..` after a link is taken by name on Windows (#1094) A junction, which any account can make, leads out of the root; the path through it and back with `..` is the file in the root, to the check and to Windows when it opens it. --- .../src/automation/file_access/tests.rs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/crates/engine/src/automation/file_access/tests.rs b/crates/engine/src/automation/file_access/tests.rs index ebb01cebf..d642befb1 100644 --- a/crates/engine/src/automation/file_access/tests.rs +++ b/crates/engine/src/automation/file_access/tests.rs @@ -380,6 +380,28 @@ fn paths_are_classified_as_windows_opens_them() { assert_eq!(refused_unresolved(Path::new("C:\\work\\a\0b.png"), &[]), Some(Unresolved::Linked)); } +/// `..` after a link is taken by name, by the check and by Windows when it opens the path, so +/// `root\j\..\in.txt` is `root\in.txt` and the link `j` is never gone through (#1094). Shown with +/// a junction, a link any account can make: `j` leads out of the root to `outside`, and beside +/// `outside` is another `in.txt`, which is what `..` would reach through the link. +#[cfg(windows)] +#[test] +fn a_parent_after_a_link_is_taken_by_name() { + use super::{Entry, on_disk}; + let f = Fixture::new("parent"); + let r = f.rw(); + std::fs::write(f.0.join("in.txt"), b"beside").unwrap(); + let made = std::process::Command::new("cmd").args(["/C", "mklink", "/J"]).arg(f.0.join(r"root\j")).arg(f.0.join("outside")).output(); + assert!(made.is_ok_and(|o| o.status.success()), "a junction can be made"); + // The junction is a link to the check, and what is through it is outside. + assert!(matches!(on_disk(&f.0.join(r"root\j")), Entry::Link(Some(_)))); + assert!(r.check(Path::new(&f.p(r"root\j\secret.txt")), Access::Read).is_err()); + let through = f.p(r"root\j\..\in.txt"); + assert_eq!(r.check(Path::new(&through), Access::Read), r.check(Path::new(&f.p(r"root\in.txt")), Access::Read)); + assert!(r.check(Path::new(&through), Access::Read).is_ok()); + assert_eq!(std::fs::read(&through).unwrap(), b"in", "Windows opens the file in the root"); +} + /// A path on another computer and a device path are refused before anything is opened: resolving /// them made Windows contact the server, which may send it the signed-in user's credentials /// (#1094). Each is refused with a message that only the check before resolving gives: had the From 375a7b8abb94d09d174f24fcac77b58f66ad369e Mon Sep 17 00:00:00 2001 From: ljkx <177671075+ljkx@users.noreply.github.com> Date: Mon, 9 Nov 2026 20:30:25 +0000 Subject: [PATCH 092/239] M1: a click on a fill, stroke or effect row highlights it (#1494) Fill, stroke and effect rows in the Design panel couldn't be selected. A click on a row's reorder grip (the strip left of its fields) or on its background between its controls now highlights it in the selected-row colour, one row at a time, as the help center's "Copy and paste properties between layers" describes ("Click to highlight the property on the right sidebar"). - The row is a click target under its controls (`row_target`), and the grip of these lists also takes a click (`ListDrag::row_clicked`). Neither is focusable, so Tab still goes from control to control. - The highlight belongs to the selection, file and Design tab it was made on. Escape lets it go before it deselects; so does a press on the canvas or elsewhere in the Design panel, or a frame its row isn't drawn in (an undo took its paint away). It follows its paint or effect when rows are reordered or removed. Tests: property_rows_tests (7). --- crates/ui-egui/src/app.rs | 2 + crates/ui-egui/src/lib.rs | 6 + crates/ui-egui/src/panels/list_drag.rs | 14 +- crates/ui-egui/src/panels/right/effects.rs | 16 +- crates/ui-egui/src/panels/right/menu.rs | 21 ++- crates/ui-egui/src/panels/right/paints.rs | 35 ++-- crates/ui-egui/src/property_rows.rs | 117 +++++++++++++ crates/ui-egui/src/property_rows_tests.rs | 191 +++++++++++++++++++++ crates/ui-egui/src/shortcuts.rs | 5 + 9 files changed, 390 insertions(+), 17 deletions(-) create mode 100644 crates/ui-egui/src/property_rows.rs create mode 100644 crates/ui-egui/src/property_rows_tests.rs diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index f0513520b..293de1dca 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -296,6 +296,8 @@ impl FigApp { 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 && !right_minimized) || mobile == Some(MobilePanel::Right); + // A highlighted fill, stroke or effect row goes with the panel it's in, before it draws. + crate::property_rows::reconcile(self, &ctx, right_open); // A right-to-left UI language mirrors the window: the "left" rail and panel go on the // right, the "right" (Design) panel on the left. Their ids and widths stay as they are. let mirrored = self.ui.mirrored; diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 60c68f526..9e6f77f0f 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -226,6 +226,9 @@ mod present_tests; mod present_view_tests; #[cfg(test)] mod property_menu_tests; +mod property_rows; +#[cfg(test)] +mod property_rows_tests; #[cfg(test)] mod proto_editor_tests; #[cfg(test)] @@ -589,6 +592,8 @@ pub struct UiState { /// copy changes the engine clipboard without writing the OS clipboard; the generation then /// no longer matches, so the stale mirror is not mistaken for the user's own copy. pub last_copy_generation: u64, + /// The fill, stroke or effect row highlighted in the Design panel. + pub property_row: Option, /// A save shortcut pressed while a panel field had the keyboard: the field lets go (which /// commits what was typed) and the command runs next frame for that document/window. pub after_field: Option, @@ -732,6 +737,7 @@ impl Default for UiState { last_copy: None, last_copy_generation: 0, + property_row: None, after_field: None, held: egui::Modifiers::NONE, next_autosave: 0.0, diff --git a/crates/ui-egui/src/panels/list_drag.rs b/crates/ui-egui/src/panels/list_drag.rs index 08a391aeb..4fa614d4e 100644 --- a/crates/ui-egui/src/panels/list_drag.rs +++ b/crates/ui-egui/src/panels/list_drag.rs @@ -75,8 +75,19 @@ impl ListDrag { /// Item `index` (model order) was laid out with its main row at `header`, covering `extent` /// (the header plus anything open under it). Its grip starts a drag carrying `label`. pub fn row(&mut self, ui: &mut Ui, index: usize, header: Rect, extent: Rect, label: impl FnOnce() -> String) { + self.grip_row(ui, index, header, extent, Sense::drag(), label); + } + + /// [`Self::row`] whose grip also takes a click, the way a click beside the row's fields + /// highlights a fill, stroke or effect row: `true` when it was clicked. The grip senses the + /// click without being focusable, so Tab doesn't stop on it. + pub fn row_clicked(&mut self, ui: &mut Ui, index: usize, header: Rect, extent: Rect, label: impl FnOnce() -> String) -> bool { + self.grip_row(ui, index, header, extent, Sense::DRAG | Sense::CLICK, label) + } + + fn grip_row(&mut self, ui: &mut Ui, index: usize, header: Rect, extent: Rect, sense: Sense, label: impl FnOnce() -> String) -> bool { let grip = Rect::from_min_max(header.min, pos2(header.min.x + PAD, header.max.y)); - let resp = ui.interact(grip, grip_of(self.list, index), Sense::drag()); + let resp = ui.interact(grip, grip_of(self.list, index), sense); // The handle shows while the pointer is over the row (or the row is being dragged). let shown = match self.dragging { Some(d) => d == index, @@ -93,6 +104,7 @@ impl ListDrag { ui.ctx().set_cursor_icon(egui::CursorIcon::Grab); } self.row_by(&resp, index, extent, label); + resp.clicked() } /// Item `index` laid out over `extent`, dragged by the whole row (`resp` senses drags; the diff --git a/crates/ui-egui/src/panels/right/effects.rs b/crates/ui-egui/src/panels/right/effects.rs index b25990db7..642892d18 100644 --- a/crates/ui-egui/src/panels/right/effects.rs +++ b/crates/ui-egui/src/panels/right/effects.rs @@ -1,9 +1,10 @@ -use super::menu::{context_popup, menu_check, menu_item, menu_popup, row, row_context_menu, row_rect}; +use super::menu::{context_popup, menu_check, menu_item, menu_popup, row, row_context_menu, row_rect, row_target}; use super::{ Blur, BlurType, Document, Effect, EffectKind, FieldEdit, FigApp, Glass, GridAlign, GridKind, Icon, Id, LayoutGrid, Lead, ListDrag, MAX_BLUR_RADIUS, NodeId, Noise, NoiseMode, Paint, Sense, Shadow, StyleSlot, Texture, Ui, VariableType, common, icons, json, move_flags, moved_index, remove_flags, removed_index, style_picker, tr, trf, trn, vec2, widgets, }; +use crate::property_rows::PropertyKind; /// Draw the effect list with add/style/type/toggle/remove/reorder, open settings, and keep an /// open picker and settings flags aligned when rows move or are removed. @@ -29,9 +30,12 @@ pub(super) fn effects(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[Node let Some(list) = list else { return }; let mut drag = ListDrag::new(ui, "effects"); let mut removed = None; + let selected_row = crate::theme::Tokens::get(ui.ctx()).selected_row; for (i, e) in list.iter().enumerate().rev() { let mut open = effect_open(ui.ctx(), i); - let header = row_rect(ui, 32.0, |ui| { + // A click on the row's background highlights it (`property_rows`). + let highlight = crate::property_rows::fill(app, PropertyKind::Effect, i, selected_row); + let header = row_target(ui, 32.0, highlight, |ui| { if icons::button(ui, Icon::Effects, 24.0, open, tr("Effect settings")).clicked() { open = !open; ui.data_mut(|d| d.insert_temp(Id::unique((FX_OPEN, i)), open)); @@ -63,6 +67,8 @@ pub(super) fn effects(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[Node removed = Some(i); } }); + crate::property_rows::row(app, &header, PropertyKind::Effect, i, &ids); + let header = header.rect; let can_paste = app.session.clipboard.effect.is_some(); row_context_menu(ui, header, Id::unique(("effect_menu", i))).show(|ui| { if menu_item(ui, tr("Copy effect"), "") { @@ -77,10 +83,13 @@ pub(super) fn effects(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[Node if open { effect_settings(app, ui, &ids, i, e); } - drag.row(ui, i, header, header.with_max_y(ui.cursor().min.y.max(header.max.y)), || tr(e.label()).to_string()); + if drag.row_clicked(ui, i, header, header.with_max_y(ui.cursor().min.y.max(header.max.y)), || tr(e.label()).to_string()) { + crate::property_rows::click(app, PropertyKind::Effect, i, &ids, header); + } } if let Some((from, to)) = drag.finish(ui) { app.run("effect.move", json!({"ids": ids, "from": from, "to": to})); + crate::property_rows::follow(app, PropertyKind::Effect, from, Some(to)); move_flags(ui, FX_OPEN, list.len(), from, to); if let Some(crate::colorpicker::PickerTarget::Effect { index, .. }) = &mut app.ui.picker { *index = moved_index(*index, from, to); @@ -88,6 +97,7 @@ pub(super) fn effects(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[Node } // Open settings and an open colour picker stay with their effects, or go with theirs. if let Some(i) = removed { + crate::property_rows::follow(app, PropertyKind::Effect, i, None); remove_flags(ui, FX_OPEN, list.len(), i); if let Some(crate::colorpicker::PickerTarget::Effect { index, .. }) = &mut app.ui.picker { match removed_index(*index, i) { diff --git a/crates/ui-egui/src/panels/right/menu.rs b/crates/ui-egui/src/panels/right/menu.rs index 9b80ab8d8..40215a8a5 100644 --- a/crates/ui-egui/src/panels/right/menu.rs +++ b/crates/ui-egui/src/panels/right/menu.rs @@ -155,12 +155,31 @@ pub(crate) fn row_rect(ui: &mut Ui, h: f32, add: impl FnOnce(&mut Ui)) -> Rect { pub(crate) fn block(ui: &mut Ui, h: f32, inset_y: f32, add: impl FnOnce(&mut Ui)) -> Rect { let w = ui.available_width(); let (r, _) = ui.allocate_exact_size(vec2(w, h), Sense::hover()); + lay_out(ui, r, inset_y, add); + r +} + +/// A [`row_rect`] that is a pointer target itself: a click on its background (beside and between +/// its controls, which are on top of it) comes back in the response. It senses clicks without +/// being focusable, so Tab and F6 still go from control to control. `fill` is drawn under the +/// controls (a highlighted fill, stroke or effect row). +pub(crate) fn row_target(ui: &mut Ui, h: f32, fill: Option, add: impl FnOnce(&mut Ui)) -> egui::Response { + let w = ui.available_width(); + let (r, resp) = ui.allocate_exact_size(vec2(w, h), Sense::CLICK); + if let Some(fill) = fill { + ui.painter().rect_filled(r, CornerRadius::ZERO, fill); + } + lay_out(ui, r, (h - FIELD_H) / 2.0, add); + resp +} + +/// Add a row's controls in `r`, on the section's grid, inset `inset_y` from its top and bottom. +fn lay_out(ui: &mut Ui, r: Rect, inset_y: f32, add: impl FnOnce(&mut Ui)) { // The section's grid: 16 in from the left, 8 from the right (not 16 on both sides). let inner = Rect::from_min_max(pos2(r.min.x + PAD, r.min.y + inset_y), pos2(r.max.x - crate::widgets::PAD_RIGHT, r.max.y - inset_y)); let mut child = ui.new_child(egui::UiBuilder::new().max_rect(inner).layout(egui::Layout::left_to_right(egui::Align::Center))); child.spacing_mut().item_spacing = vec2(crate::widgets::GUTTER, 0.0); add(&mut child); - r } /// Width of the check column of [`menu_icon_item`] (the mark, or nothing, so labels line up). diff --git a/crates/ui-egui/src/panels/right/paints.rs b/crates/ui-egui/src/panels/right/paints.rs index 967ae266b..dfe82cc8b 100644 --- a/crates/ui-egui/src/panels/right/paints.rs +++ b/crates/ui-egui/src/panels/right/paints.rs @@ -1,10 +1,11 @@ -use super::menu::{blend_menu, context_popup, menu_check, menu_item, menu_popup, preview_blend, row, row_context_menu, row_rect}; +use super::menu::{blend_menu, context_popup, menu_check, menu_item, menu_popup, preview_blend, row, row_context_menu, row_target}; use super::stroke::stroke_settings; use super::{ Align2, BlendMode, CornerRadius, Document, FIELD_H, FieldEdit, FigApp, Icon, Id, Lead, ListDrag, MaskType, Node, NodeId, NodeKind, Paint, PaintKind, Rect, Sense, Stroke, StrokeAlign, StyleSlot, Tip, Tokens, Ui, Value, VariableType, common, icons, json, moved_index, pos2, regular, removed_index, style_picker, tr, trf, vec2, widgets, }; +use crate::property_rows::PropertyKind; /// Draw visibility/blend/mask, opacity, uniform or per-corner radius, corner smoothing and /// the blend-mode row. @@ -341,10 +342,13 @@ pub(super) fn paints(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeI let mut drag = ListDrag::new(ui, if fills { "fills" } else { "strokes" }); for (i, p) in l.iter().enumerate().rev() { let r = paint_row(app, ui, &ids, i, p, fills, region); - drag.row(ui, i, r, r, || paint_label(p)); + if drag.row_clicked(ui, i, r, r, || paint_label(p)) { + crate::property_rows::click(app, if fills { PropertyKind::Fill } else { PropertyKind::Stroke }, i, &ids, r); + } } if let Some((from, to)) = drag.finish(ui) { app.run(if fills { "fill.move" } else { "stroke.move" }, json!({"ids": ids, "from": from, "to": to})); + crate::property_rows::follow(app, if fills { PropertyKind::Fill } else { PropertyKind::Stroke }, from, Some(to)); // An open colour picker keeps editing the paint it was on. if let Some(crate::colorpicker::PickerTarget::Paint { fills: f, index, .. }) = &mut app.ui.picker && *f == fills @@ -451,12 +455,15 @@ pub(super) fn paints(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeI /// Paint `i`'s row (swatch, colour or kind, opacity, visibility, remove); returns its area. /// One paint's row; `region`: a row of the regions selected in vector edit mode (#1875), which -/// leaves out what belongs to the layer (its variable binding, the image crop). +/// leaves out what belongs to the layer (its variable binding, the image crop). A click on its +/// background highlights it ([`crate::property_rows`]). fn paint_row(app: &mut FigApp, ui: &mut Ui, ids: &[NodeId], i: usize, p: &Paint, fills: bool, region: bool) -> Rect { let t = Tokens::get(ui.ctx()); let ids = ids.to_vec(); let cmd = if fills { "fill.set" } else { "stroke.set" }; - let r = row_rect(ui, 32.0, |ui| { + let kind = if fills { PropertyKind::Fill } else { PropertyKind::Stroke }; + let highlight = crate::property_rows::fill(app, kind, i, t.selected_row); + let resp = row_target(ui, 32.0, highlight, |ui| { let w = ui.available_width() - 60.0; let (sresp, e) = widgets::paint_field(ui, Id::unique(("swatch", fills, i)), Id::unique(("pop", fills, i)), p, w, |child, text_r| { let r = child.max_rect(); @@ -537,18 +544,22 @@ fn paint_row(app: &mut FigApp, ui: &mut Ui, ids: &[NodeId], i: usize, p: &Paint, if toggle { app.run(cmd, json!({"ids": ids, "index": i, "visible": !p.visible})); } - if remove - && app.run(if fills { "fill.remove" } else { "stroke.remove" }, json!({"ids": ids, "index": i})).is_some() - && let Some(crate::colorpicker::PickerTarget::Paint { fills: f, index, .. }) = &mut app.ui.picker - && *f == fills - { + if remove && app.run(if fills { "fill.remove" } else { "stroke.remove" }, json!({"ids": ids, "index": i})).is_some() { + // A highlighted row stays on its paint, or goes with it. + crate::property_rows::follow(app, kind, i, None); // An open colour picker keeps editing the paint it was on, or closes with it. - match removed_index(*index, i) { - Some(k) => *index = k, - None => app.ui.picker = None, + if let Some(crate::colorpicker::PickerTarget::Paint { fills: f, index, .. }) = &mut app.ui.picker + && *f == fills + { + match removed_index(*index, i) { + Some(k) => *index = k, + None => app.ui.picker = None, + } } } }); + crate::property_rows::row(app, &resp, kind, i, &ids); + let r = resp.rect; let copy = if fills { tr("Copy fill") } else { tr("Copy stroke") }; let paste = if fills { tr("Paste fill") } else { tr("Paste stroke") }; let can_paste = app.session.clipboard.paint.as_ref().is_some_and(|(f, _)| *f == fills); diff --git a/crates/ui-egui/src/property_rows.rs b/crates/ui-egui/src/property_rows.rs new file mode 100644 index 000000000..1e06debfa --- /dev/null +++ b/crates/ui-egui/src/property_rows.rs @@ -0,0 +1,117 @@ +//! Fill, stroke and effect rows of the Design panel that highlight, the first step of the help +//! center's "Copy and paste properties between layers": click to highlight the property in the +//! right sidebar. +//! +//! A click on a row's background (beside and between its controls, or on its reorder grip) +//! highlights it, one row at a time. The highlight belongs to the selection it was made on, and +//! goes with Escape or a press on the canvas or elsewhere in the Design panel. + +use egui::{Color32, Context, Rect, Response}; +use figcraft_doc::NodeId; + +use crate::{FigApp, RightTab}; + +/// Which list of the Design panel a row belongs to. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum PropertyKind { + Fill, + Stroke, + Effect, +} + +/// The row highlighted in the Design panel. It belongs to the layers selected when it was clicked +/// and goes when they are no longer the selection. +#[derive(Clone, Debug, PartialEq)] +pub struct Highlight { + pub kind: PropertyKind, + /// The paint's or effect's index in its list (model order: the top one is the last). + pub index: usize, + /// The selection the row was highlighted on. + pub ids: Vec, + /// The file it was highlighted in. + pub doc: u64, + /// Where the row was drawn this frame (`None` until it draws): a press elsewhere lets it go, + /// and so does a frame it isn't drawn in. + pub rect: Option, +} + +/// The highlighted row, when it still belongs to the selection in the Design panel. +pub(crate) fn current(app: &FigApp) -> Option<&Highlight> { + let h = app.ui.property_row.as_ref()?; + let ds = app.session.ds().ok()?; + (app.ui.right_tab == RightTab::Design && ds.uid == h.doc && ds.selection == h.ids).then_some(h) +} + +/// Let the highlight go once it no longer belongs to what the Design panel shows (another file or +/// tab, another selection, the panel not `shown`), or when the pointer is pressed on the canvas or +/// elsewhere in the Design panel. A press on its own row keeps it; so does one on a menu, a popup +/// or the toolbar, so a menu command can still act on it. Called each frame before +/// the right panel draws its rows. +pub(crate) fn reconcile(app: &mut FigApp, ctx: &Context, shown: bool) { + if app.ui.property_row.is_none() { + return; + } + let pressed = ctx.input(|i| if i.pointer.any_pressed() { i.pointer.press_origin() } else { None }); + // A menu or popup is a foreground area over whatever is under it. + let lets_go = pressed.filter(|p| ctx.layer_id_at(*p).is_none_or(|l| l.order != egui::Order::Foreground)).is_some_and(|p| { + let on_row = app.ui.property_row.as_ref().and_then(|h| h.rect).is_some_and(|r| r.contains(p)); + let in_panel = app.ui.right_panel_rect.is_some_and(|r| r.contains(p)); + !on_row && (in_panel || app.canvas.rect.contains(p)) + }); + // The row draws itself each frame (`row`): one that wasn't drawn last frame is gone (an undo + // took its paint away, say), and its index may now name another row or none. + let drawn = app.ui.property_row.as_ref().is_some_and(|h| h.rect.is_some()); + if lets_go || !shown || !drawn || current(app).is_none() { + app.ui.property_row = None; + } else if let Some(h) = app.ui.property_row.as_mut() { + h.rect = None; + } +} + +/// Escape with a highlighted row: the highlight goes and the selection stays. `false` when no row +/// is highlighted (Escape does what it does otherwise). +pub(crate) fn escape(app: &mut FigApp) -> bool { + let highlighted = current(app).is_some(); + app.ui.property_row = None; + highlighted +} + +/// Row `index` of the `kind` list, drawn as `resp` (a row target, see [`fill`]) for the selection +/// `ids`: a click on its background highlights it; the highlighted row keeps where it was drawn. +pub(crate) fn row(app: &mut FigApp, resp: &Response, kind: PropertyKind, index: usize, ids: &[NodeId]) { + if resp.clicked() { + click(app, kind, index, ids, resp.rect); + } else if let Some(h) = app.ui.property_row.as_mut() + && h.kind == kind + && h.index == index + { + h.rect = Some(resp.rect); + } +} + +/// A click on row `index` of the `kind` list (drawn at `rect`) for the selection `ids`, on its +/// background or on its reorder grip, the strip left of its fields: it is the highlighted row now. +pub(crate) fn click(app: &mut FigApp, kind: PropertyKind, index: usize, ids: &[NodeId], rect: Rect) { + let Some(doc) = app.session.ds().ok().map(|d| d.uid) else { return }; + app.ui.property_row = Some(Highlight { kind, index, ids: ids.to_vec(), doc, rect: Some(rect) }); +} + +/// The background of row `index` of the `kind` list: the selected-row colour when it is the +/// highlighted one. +pub(crate) fn fill(app: &FigApp, kind: PropertyKind, index: usize, selected: Color32) -> Option { + current(app).is_some_and(|h| h.kind == kind && h.index == index).then_some(selected) +} + +/// The highlight follows its paint or effect when the rows of `kind` are reordered (`from` moved +/// to `to`) or one is removed (`to` is `None`); it goes with a removed one. +pub(crate) fn follow(app: &mut FigApp, kind: PropertyKind, from: usize, to: Option) { + let Some(h) = app.ui.property_row.as_mut().filter(|h| h.kind == kind) else { return }; + let moved = match to { + Some(to) => Some(figcraft_engine::cmd::lists::moved_index(h.index, from, to)), + None => figcraft_engine::cmd::lists::removed_index(h.index, from), + }; + match moved { + Some(i) => h.index = i, + None => app.ui.property_row = None, + } +} diff --git a/crates/ui-egui/src/property_rows_tests.rs b/crates/ui-egui/src/property_rows_tests.rs new file mode 100644 index 000000000..47b61a99c --- /dev/null +++ b/crates/ui-egui/src/property_rows_tests.rs @@ -0,0 +1,191 @@ +//! A fill, stroke or effect row of the Design panel highlights on a click on its background or its +//! grip ("Copy and paste properties between layers": click to highlight the property in the right +//! sidebar). + +use std::cell::RefCell; +use std::rc::Rc; + +use egui::{Event, Modifiers, PointerButton, Pos2, pos2}; +use figcraft_doc::NodeId; +use figcraft_engine::Session; +use serde_json::json; + +use crate::Services; +use crate::layers_drag_tests::Ui; +use crate::live_tests::{flat, text_center}; +use crate::property_rows::{Highlight, PropertyKind}; + +/// The test machine's system clipboard: the text last written, which another app may replace. +struct Clip(Rc>>); + +impl Services for Clip { + fn clipboard_set_text(&mut self, s: &str) { + *self.0.borrow_mut() = Some(s.to_string()); + } + fn clipboard_get_text(&mut self) -> Option { + self.0.borrow().clone() + } +} + +/// A 40 x 40 rectangle filled with `color`; its id. +fn rect(s: &mut Session, x: f64, color: &str) -> NodeId { + let id = NodeId(s.execute("shape.rectangle", &json!({"x": x, "y": 0, "width": 40, "height": 40})).unwrap()["id"].as_u64().unwrap()); + s.execute("fill.set", &json!({"ids": [id], "color": color})).unwrap(); + id +} + +/// Rectangles A (red, a 3 pt blue stroke and a layer blur) and B (green, a drop shadow), A +/// selected, in a window whose system clipboard the test reads and writes. +fn setup() -> (Ui, NodeId, NodeId, Rc>>) { + let mut s = Session::new(); + let a = rect(&mut s, 0.0, "#FF0000"); + let b = rect(&mut s, 100.0, "#00FF00"); + s.execute("stroke.add", &json!({"ids": [a], "paint": {"type": "solid", "color": "#0000FF"}})).unwrap(); + s.execute("node.set", &json!({"ids": [a], "props": {"strokeWeight": 3.0}})).unwrap(); + s.execute("effect.add", &json!({"ids": [a], "type": "layerBlur"})).unwrap(); + s.execute("effect.add", &json!({"ids": [b], "type": "dropShadow"})).unwrap(); + s.execute("select.set", &json!({"ids": [a]})).unwrap(); + let mut u = Ui::new(s); + let clip = Rc::new(RefCell::new(None)); + u.app.services = Box::new(Clip(clip.clone())); + u.frame(vec![]); + (u, a, b, clip) +} + +/// A primary click at `p`, and a few frames after it. +fn click(u: &mut Ui, p: Pos2) { + u.frame(vec![Event::PointerMoved(p)]); + for pressed in [true, false] { + u.frame(vec![Event::PointerButton { pos: p, button: PointerButton::Primary, pressed, modifiers: Modifiers::NONE }]); + } + u.frame(vec![]); +} + +/// Click the background of the Design panel row showing `label`: its left margin, where no +/// control is (the reorder grip shows there on hover). +fn click_row(u: &mut Ui, label: &str) { + let shapes = flat(&u.frame_output(vec![]).shapes); + let y = text_center(&shapes, label).y; + let panel = u.app.ui.right_panel_rect.expect("the Design panel is open"); + click(u, pos2(panel.min.x + 6.0, y)); +} + +/// Select `id` only, and draw the panel for it. +fn select(u: &mut Ui, id: NodeId) { + u.app.run("select.set", json!({"ids": [id]})); + u.frame(vec![]); +} + +#[test] +fn a_press_elsewhere_lets_the_highlight_go() { + let (mut u, a, _, _) = setup(); + click_row(&mut u, "FF0000"); + assert!(u.app.ui.property_row.is_some()); + // A press on the row's own background keeps it. + click_row(&mut u, "FF0000"); + assert!(u.app.ui.property_row.is_some()); + // One anywhere else in the panel lets it go, the selection staying as it is. + let shapes = flat(&u.frame_output(vec![]).shapes); + click(&mut u, text_center(&shapes, "Effects")); + assert_eq!(u.app.session.selection(), [a]); + assert!(u.app.ui.property_row.is_none()); +} + +#[test] +fn the_highlight_follows_its_row_when_rows_move_or_go() { + let (mut u, a, _, _) = setup(); + let doc = u.app.session.ds().unwrap().uid; + let at = |u: &Ui| u.app.ui.property_row.as_ref().map(|h| h.index); + u.app.ui.property_row = Some(Highlight { kind: PropertyKind::Fill, index: 1, ids: vec![a], doc, rect: None }); + crate::property_rows::follow(&mut u.app, PropertyKind::Fill, 1, Some(3)); + assert_eq!(at(&u), Some(3), "moved with its paint"); + crate::property_rows::follow(&mut u.app, PropertyKind::Stroke, 3, None); + assert_eq!(at(&u), Some(3), "another list's change leaves it"); + crate::property_rows::follow(&mut u.app, PropertyKind::Fill, 0, None); + assert_eq!(at(&u), Some(2), "a paint under it went"); + crate::property_rows::follow(&mut u.app, PropertyKind::Fill, 2, None); + assert_eq!(at(&u), None, "its paint went"); +} + +/// A key press with no modifiers, as the desktop shell delivers it. +fn key(u: &mut Ui, key: egui::Key) { + u.frame(vec![Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE }]); + u.frame(vec![Event::Key { key, physical_key: None, pressed: false, repeat: false, modifiers: Modifiers::NONE }]); +} + +#[test] +fn escape_lets_the_highlight_go_and_keeps_the_selection() { + let (mut u, a, _, _) = setup(); + click_row(&mut u, "FF0000"); + assert!(u.app.ui.property_row.is_some()); + key(&mut u, egui::Key::Escape); + assert!(u.app.ui.property_row.is_none(), "Escape let the highlight go"); + assert_eq!(u.app.session.selection(), [a], "and only that: A is still selected"); + // The next Escape deselects, as it does with no row highlighted. + key(&mut u, egui::Key::Escape); + assert!(u.app.session.selection().is_empty()); +} + +#[test] +fn a_click_on_the_canvas_lets_the_highlight_go() { + let (mut u, a, _, _) = setup(); + u.app.run("view.zoomFit", json!({})); + u.frame(vec![]); + click_row(&mut u, "FF0000"); + assert!(u.app.ui.property_row.is_some()); + // A click on A itself: the selection stays as it is, the highlight goes. + let on_a = u.app.to_screen(20.0, 20.0); + assert!(u.app.canvas.rect.contains(on_a), "A is in view"); + click(&mut u, on_a); + assert_eq!(u.app.session.selection(), [a]); + assert!(u.app.ui.property_row.is_none()); +} + +#[test] +fn a_highlighted_row_whose_paint_an_undo_took_away_goes() { + let (mut u, a, _, _) = setup(); + u.app.run("fill.add", json!({"ids": [a], "paint": {"type": "solid", "color": "#123456"}})); + u.frame(vec![]); + click_row(&mut u, "123456"); + assert_eq!(u.app.ui.property_row.as_ref().map(|h| h.index), Some(1)); + u.app.run("edit.undo", json!({})); + u.frame(vec![]); + u.frame(vec![]); + assert!(u.app.ui.property_row.is_none(), "its row isn't drawn any more"); + assert_eq!(u.app.session.selection(), [a]); +} + +#[test] +fn a_click_beside_the_rows_controls_highlights_it_too() { + let (mut u, _, _, _) = setup(); + // The row's grip, left of the swatch, highlights it (`click_row`); so does the gap between its + // colour field and its visibility button (the grid's 8 pt gutter, 60 pt from the row's right). + click_row(&mut u, "FF0000"); + let row = u.app.ui.property_row.as_ref().and_then(|h| h.rect).expect("the highlighted row was drawn"); + key(&mut u, egui::Key::Escape); + assert!(u.app.ui.property_row.is_none()); + click(&mut u, pos2(row.max.x - 64.0, row.center().y)); + assert_eq!(u.app.ui.property_row.as_ref().map(|h| (h.kind, h.index)), Some((PropertyKind::Fill, 0))); +} + +#[test] +fn a_click_on_a_rows_grip_highlights_that_row_for_the_selection() { + let (mut u, a, b, _) = setup(); + for (label, kind) in [("FF0000", PropertyKind::Fill), ("0000FF", PropertyKind::Stroke), ("Layer blur", PropertyKind::Effect)] { + click_row(&mut u, label); + assert_eq!( + u.app.ui.property_row.as_ref().map(|h| (h.kind, h.index, h.ids.clone())), + Some((kind, 0, vec![a])), + "{label}: one row highlighted, for A" + ); + } + // The row is drawn in the selected-row colour. + let t = crate::theme::Tokens::get(&u.ctx); + assert_eq!(crate::property_rows::fill(&u.app, PropertyKind::Effect, 0, t.selected_row), Some(t.selected_row)); + assert_eq!(crate::property_rows::fill(&u.app, PropertyKind::Fill, 0, t.selected_row), None); + // It belonged to A: another selection lets it go, and A selected again doesn't bring it back. + select(&mut u, b); + assert!(u.app.ui.property_row.is_none()); + select(&mut u, a); + assert!(u.app.ui.property_row.is_none()); +} diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index 26bdb60d2..145d9d35a 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -428,6 +428,11 @@ fn key_event(app: &mut FigApp, key: Key, physical: Option, m: Modifiers, re if key == Key::Escape && !egui::Popup::is_any_open(ctx) && crate::colorpicker::close_if_open(app) { return true; } + // A fill, stroke or effect row highlighted in the Design panel: Escape lets it go, before the + // binding deselects the layers. + if key == Key::Escape && m.is_none() && !egui::Popup::is_any_open(ctx) && crate::property_rows::escape(app) { + return true; + } if key_pick(app, key, m) || key_box(app, key, m) { return true; } From 33ac1d14fc0d8d2baaea66aa33a68cdc12a93551 Mon Sep 17 00:00:00 2001 From: ljkx <177671075+ljkx@users.noreply.github.com> Date: Mon, 9 Nov 2026 20:34:32 +0000 Subject: [PATCH 093/239] M1: Cmd/Ctrl+C and Cmd/Ctrl+V copy and paste the highlighted fill, stroke or effect (#1494) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With a fill, stroke or effect row highlighted, Cmd/Ctrl+C (or Edit ▸ Copy) copies that paint or effect instead of the layers, through the same `fill.copy`, `stroke.copy` and `effect.copy` the row's menu runs. Cmd/Ctrl+V then pastes it onto every selected layer with `fill.paste`, `stroke.paste` or `effect.paste`, one undo step: on top of each layer's list, or in place of the highlighted row when it is of the same kind. - A copy keeps its kind. A stroke goes to the strokes and an effect to the effects whatever row is highlighted, and the last row copied is the one pasted. - A solid colour goes to the system clipboard as its hex code, anything else as a marker. A paste takes the property only while the system clipboard still holds that copy and no layers were copied since, so text or an image from another app, or a later layer copy, pastes as before. The row menus' Copy writes the same, so Cmd/Ctrl+V pastes it. - A programmatic copy never writes the system clipboard, and forgets a property mirror it replaced. A mirror whose engine copy is gone pastes nothing rather than the layers copied before it. - The copy is shared by every window, as the layer copy is. Tests: property_rows_tests (15 more, 22 in all); the replace index and the Escape key were each removed once to check the tests fail. --- crates/ui-egui/src/lib.rs | 5 +- crates/ui-egui/src/menus.rs | 4 + crates/ui-egui/src/menus/clipboard.rs | 7 +- crates/ui-egui/src/panels/right/effects.rs | 4 +- crates/ui-egui/src/panels/right/paints.rs | 4 +- crates/ui-egui/src/property_rows.rs | 144 +++++++++++- crates/ui-egui/src/property_rows_tests.rs | 261 ++++++++++++++++++++- crates/ui-egui/src/windows.rs | 2 + docs/ui-parity.md | 4 +- 9 files changed, 420 insertions(+), 15 deletions(-) diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 9e6f77f0f..8d74db2c9 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -592,8 +592,10 @@ pub struct UiState { /// copy changes the engine clipboard without writing the OS clipboard; the generation then /// no longer matches, so the stale mirror is not mistaken for the user's own copy. pub last_copy_generation: u64, - /// The fill, stroke or effect row highlighted in the Design panel. + /// The fill, stroke or effect row highlighted in the Design panel: Cmd/Ctrl+C copies it. pub property_row: Option, + /// A paint or effect copied from its row: Cmd/Ctrl+V pastes it while it's the last copy. + pub property_copy: Option, /// A save shortcut pressed while a panel field had the keyboard: the field lets go (which /// commits what was typed) and the command runs next frame for that document/window. pub after_field: Option, @@ -738,6 +740,7 @@ impl Default for UiState { last_copy: None, last_copy_generation: 0, property_row: None, + property_copy: None, after_field: None, held: egui::Modifiers::NONE, next_autosave: 0.0, diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index a5361778c..a5a05c31c 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -193,6 +193,10 @@ pub fn invoke(app: &mut FigApp, id: &str) { app.toast(tr("Properties copied")); } } + // A fill, stroke or effect row highlighted in the Design panel: that paint or effect. + "edit.copy" if crate::property_rows::current(app).is_some() => { + crate::property_rows::copy_highlighted(app); + } "edit.copy" | "edit.cut" => { let ids = app.session.selection(); // For other apps: text layers' text, other layers as SVG; taken before a cut removes them. diff --git a/crates/ui-egui/src/menus/clipboard.rs b/crates/ui-egui/src/menus/clipboard.rs index bae7aaca9..17d3c9109 100644 --- a/crates/ui-egui/src/menus/clipboard.rs +++ b/crates/ui-egui/src/menus/clipboard.rs @@ -16,7 +16,7 @@ pub fn paste(app: &mut FigApp, event_text: Option<&str>, at: Option<(f64, f64)>) if app.control_synthetic { // Synthetic input is user-like: Dev Mode refuses the paste here too, and only the engine's // own copied layers are pasted (the system clipboard is never read). - if !dev_mode_refuses(app, "edit.paste") { + if !(at.is_none() && crate::property_rows::paste(app)) && !dev_mode_refuses(app, "edit.paste") { app.run("edit.paste", at.map_or(json!({}), |(x, y)| json!({"x": x, "y": y}))); } return; @@ -81,6 +81,11 @@ pub fn paste(app: &mut FigApp, event_text: Option<&str>, at: Option<(f64, f64)>) return paste_text(app, &text, (cx, cy), at.is_none()); } } + // Nothing newer from another app: a fill, stroke or effect copied from its row, when that was + // the last copy, else our copied layers. + if at.is_none() && crate::property_rows::paste(app) { + return; + } if !dev_mode_refuses(app, "edit.paste") { app.run("edit.paste", at.map_or(json!({}), |(x, y)| json!({"x": x, "y": y}))); } diff --git a/crates/ui-egui/src/panels/right/effects.rs b/crates/ui-egui/src/panels/right/effects.rs index 642892d18..5590a5219 100644 --- a/crates/ui-egui/src/panels/right/effects.rs +++ b/crates/ui-egui/src/panels/right/effects.rs @@ -33,7 +33,7 @@ pub(super) fn effects(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[Node let selected_row = crate::theme::Tokens::get(ui.ctx()).selected_row; for (i, e) in list.iter().enumerate().rev() { let mut open = effect_open(ui.ctx(), i); - // A click on the row's background highlights it (`property_rows`). + // A click on the row's background highlights it for Cmd/Ctrl+C (`property_rows`). let highlight = crate::property_rows::fill(app, PropertyKind::Effect, i, selected_row); let header = row_target(ui, 32.0, highlight, |ui| { if icons::button(ui, Icon::Effects, 24.0, open, tr("Effect settings")).clicked() { @@ -72,7 +72,7 @@ pub(super) fn effects(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[Node let can_paste = app.session.clipboard.effect.is_some(); row_context_menu(ui, header, Id::unique(("effect_menu", i))).show(|ui| { if menu_item(ui, tr("Copy effect"), "") { - app.run("effect.copy", json!({"ids": ids, "index": i})); + crate::property_rows::copy(app, PropertyKind::Effect, i, &ids); ui.close(); } if can_paste && menu_item(ui, tr("Paste effect"), "") { diff --git a/crates/ui-egui/src/panels/right/paints.rs b/crates/ui-egui/src/panels/right/paints.rs index dfe82cc8b..4e257061b 100644 --- a/crates/ui-egui/src/panels/right/paints.rs +++ b/crates/ui-egui/src/panels/right/paints.rs @@ -456,7 +456,7 @@ pub(super) fn paints(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeI /// Paint `i`'s row (swatch, colour or kind, opacity, visibility, remove); returns its area. /// One paint's row; `region`: a row of the regions selected in vector edit mode (#1875), which /// leaves out what belongs to the layer (its variable binding, the image crop). A click on its -/// background highlights it ([`crate::property_rows`]). +/// background highlights it for Cmd/Ctrl+C ([`crate::property_rows`]). fn paint_row(app: &mut FigApp, ui: &mut Ui, ids: &[NodeId], i: usize, p: &Paint, fills: bool, region: bool) -> Rect { let t = Tokens::get(ui.ctx()); let ids = ids.to_vec(); @@ -565,7 +565,7 @@ fn paint_row(app: &mut FigApp, ui: &mut Ui, ids: &[NodeId], i: usize, p: &Paint, let can_paste = app.session.clipboard.paint.as_ref().is_some_and(|(f, _)| *f == fills); row_context_menu(ui, r, Id::unique(("paint_menu", fills, i))).show(|ui| { if menu_item(ui, copy, "") { - app.run(if fills { "fill.copy" } else { "stroke.copy" }, json!({"ids": ids, "index": i})); + crate::property_rows::copy(app, kind, i, &ids); ui.close(); } if can_paste && menu_item(ui, paste, "") { diff --git a/crates/ui-egui/src/property_rows.rs b/crates/ui-egui/src/property_rows.rs index 1e06debfa..2267fb347 100644 --- a/crates/ui-egui/src/property_rows.rs +++ b/crates/ui-egui/src/property_rows.rs @@ -1,13 +1,19 @@ -//! Fill, stroke and effect rows of the Design panel that highlight, the first step of the help -//! center's "Copy and paste properties between layers": click to highlight the property in the -//! right sidebar. +//! Fill, stroke and effect rows of the Design panel as things to copy, as the help center's "Copy +//! and paste properties between layers" describes: click to highlight the property in the right +//! sidebar, press Cmd/Ctrl+C, select another layer, press Cmd/Ctrl+V. //! //! A click on a row's background (beside and between its controls, or on its reorder grip) //! highlights it, one row at a time. The highlight belongs to the selection it was made on, and -//! goes with Escape or a press on the canvas or elsewhere in the Design panel. +//! goes with Escape or a press on the canvas or elsewhere in the Design panel. Cmd/Ctrl+C then +//! copies that one paint or effect (`fill.copy`, `stroke.copy`, `effect.copy`, as the row's menu +//! does) instead of the layers, and Cmd/Ctrl+V pastes it onto every selected layer (`fill.paste`, +//! `stroke.paste`, `effect.paste`) while it is still the last thing copied: on top of their list, +//! or in place of their highlighted row when it is of the same kind. A copy keeps its kind: a +//! stroke never lands in the fills, whatever row is highlighted. use egui::{Color32, Context, Rect, Response}; use figcraft_doc::NodeId; +use serde_json::json; use crate::{FigApp, RightTab}; @@ -19,6 +25,46 @@ pub enum PropertyKind { Effect, } +impl PropertyKind { + /// The command that copies row `index` of this list. + fn copy_command(self) -> &'static str { + match self { + PropertyKind::Fill => "fill.copy", + PropertyKind::Stroke => "stroke.copy", + PropertyKind::Effect => "effect.copy", + } + } + + /// The command that pastes the copied paint or effect. + fn paste_command(self) -> &'static str { + match self { + PropertyKind::Fill => "fill.paste", + PropertyKind::Stroke => "stroke.paste", + PropertyKind::Effect => "effect.paste", + } + } + + /// What the system clipboard gets when the copy has no text of its own: the marker that also + /// stands for copied layers, so a paste never makes a text layer of it. + fn marker(self) -> &'static str { + match self { + PropertyKind::Fill => "figcraft://clipboard/fill", + PropertyKind::Stroke => "figcraft://clipboard/stroke", + PropertyKind::Effect => "figcraft://clipboard/effect", + } + } + + /// Whether the engine clipboard still holds a copy of this kind. + fn on_clipboard(self, app: &FigApp) -> bool { + let clip = &app.session.clipboard; + match self { + PropertyKind::Fill => clip.paint.as_ref().is_some_and(|(fills, _)| *fills), + PropertyKind::Stroke => clip.paint.as_ref().is_some_and(|(fills, _)| !*fills), + PropertyKind::Effect => clip.effect.is_some(), + } + } +} + /// The row highlighted in the Design panel. It belongs to the layers selected when it was clicked /// and goes when they are no longer the selection. #[derive(Clone, Debug, PartialEq)] @@ -35,6 +81,18 @@ pub struct Highlight { pub rect: Option, } +/// A paint or effect copied from its row: Cmd/Ctrl+V pastes it rather than the copied layers while +/// it is the last thing copied. +#[derive(Clone, Debug, PartialEq)] +pub struct Copied { + pub kind: PropertyKind, + /// The engine clipboard's layers generation at the copy: a layer copy since moves it on. + pub layers_generation: u64, + /// What the copy put on the system clipboard (`None`: a programmatic copy, which never writes + /// it). A user's paste takes the property only while the system clipboard is still that. + pub mirror: Option, +} + /// The highlighted row, when it still belongs to the selection in the Design panel. pub(crate) fn current(app: &FigApp) -> Option<&Highlight> { let h = app.ui.property_row.as_ref()?; @@ -45,7 +103,7 @@ pub(crate) fn current(app: &FigApp) -> Option<&Highlight> { /// Let the highlight go once it no longer belongs to what the Design panel shows (another file or /// tab, another selection, the panel not `shown`), or when the pointer is pressed on the canvas or /// elsewhere in the Design panel. A press on its own row keeps it; so does one on a menu, a popup -/// or the toolbar, so a menu command can still act on it. Called each frame before +/// or the toolbar, so Edit ▸ Copy still copies the highlighted property. Called each frame before /// the right panel draws its rows. pub(crate) fn reconcile(app: &mut FigApp, ctx: &Context, shown: bool) { if app.ui.property_row.is_none() { @@ -115,3 +173,79 @@ pub(crate) fn follow(app: &mut FigApp, kind: PropertyKind, from: usize, to: Opti None => app.ui.property_row = None, } } + +/// Cmd/Ctrl+C with a highlighted row: copy its paint or effect. `false` when no row is +/// highlighted (the layers are copied as usual). +pub(crate) fn copy_highlighted(app: &mut FigApp) -> bool { + let Some(h) = current(app).cloned() else { return false }; + copy(app, h.kind, h.index, &h.ids); + true +} + +/// Copy paint or effect `index` of the `kind` list of `ids` (a highlighted row, or the row's menu) +/// and remember it as the last thing copied. A solid colour goes to the system clipboard as its +/// hex code, as other apps read colours; anything else as a marker of the copy. +pub(crate) fn copy(app: &mut FigApp, kind: PropertyKind, index: usize, ids: &[NodeId]) { + let Some(copied) = app.run(kind.copy_command(), json!({"ids": ids, "index": index})) else { return }; + let layers_generation = app.session.clipboard.layers_generation; + let mirror = if app.control_synthetic { + // The engine's copy is no longer what the system clipboard mirrors: a user's paste must + // not take that text for this copy (`menus::paste` would paste stale layers). + if app.ui.property_copy.as_ref().is_some_and(|c| c.mirror.is_some() && c.mirror == app.ui.last_copy) { + app.ui.last_copy = None; + } + None + } else { + let text = match kind { + PropertyKind::Effect => None, + PropertyKind::Fill | PropertyKind::Stroke => { + serde_json::from_value::(copied).ok().and_then(|p| p.solid_color()).map(figcraft_color::Color::to_css_hex) + } + } + .unwrap_or_else(|| kind.marker().to_string()); + app.clipboard_set_text(&text); + // The system clipboard holds our copy now: a paste reads it as ours (`menus::paste`). + app.ui.last_copy = Some(text.clone()); + app.ui.last_copy_generation = layers_generation; + Some(text) + }; + app.ui.property_copy = Some(Copied { kind, layers_generation, mirror }); +} + +/// Cmd/Ctrl+V when nothing newer than our own copy is on the system clipboard: when a paint or +/// effect copied from its row is the last thing copied, paste it onto the selected layers (in +/// place of their highlighted row of that kind, else on top) and return `true`; `false` leaves +/// the paste to the copied layers. +pub(crate) fn paste(app: &mut FigApp) -> bool { + let Some(c) = app.ui.property_copy.clone() else { return false }; + let still_last = c.layers_generation == app.session.clipboard.layers_generation + && c.kind.on_clipboard(app) + // A user's paste: the system clipboard must still be what this copy put there. A + // programmatic paste reads only the engine clipboard. + && (app.control_synthetic || (c.mirror.is_some() && app.ui.last_copy == c.mirror)); + if !still_last { + // The system clipboard still holds this copy's mirror, but the engine's copy of it is gone + // (a command copied a paint or effect of another kind since): nothing to paste, rather + // than the layers copied before it. + return !app.control_synthetic + && c.mirror.is_some() + && app.ui.last_copy == c.mirror + && app.ui.last_copy_generation == app.session.clipboard.layers_generation + && c.layers_generation == app.session.clipboard.layers_generation; + } + let ids = app.session.selection(); + if ids.is_empty() { + // Nothing to paste onto: a paste of the layers copied before would be surprising. + return true; + } + let cmd = c.kind.paste_command(); + if crate::menus::dev_mode_refuses(app, cmd) { + return true; + } + let mut params = json!({"ids": ids}); + if let Some(h) = current(app).filter(|h| h.kind == c.kind) { + params["index"] = json!(h.index); + } + app.run(cmd, params); + true +} diff --git a/crates/ui-egui/src/property_rows_tests.rs b/crates/ui-egui/src/property_rows_tests.rs index 47b61a99c..b36ea94bb 100644 --- a/crates/ui-egui/src/property_rows_tests.rs +++ b/crates/ui-egui/src/property_rows_tests.rs @@ -1,6 +1,6 @@ -//! A fill, stroke or effect row of the Design panel highlights on a click on its background or its -//! grip ("Copy and paste properties between layers": click to highlight the property in the right -//! sidebar). +//! A fill, stroke or effect row of the Design panel highlights on a click on its background, and +//! the keyboard copies and pastes it ("Copy and paste properties between layers": click to +//! highlight the property in the right sidebar, Cmd/Ctrl+C, select another layer, Cmd/Ctrl+V). use std::cell::RefCell; use std::rc::Rc; @@ -70,12 +70,144 @@ fn click_row(u: &mut Ui, label: &str) { click(u, pos2(panel.min.x + 6.0, y)); } +/// Cmd/Ctrl+C, as the desktop shell delivers it. +fn copy(u: &mut Ui) { + u.frame(vec![Event::Copy]); +} + +/// Cmd/Ctrl+V with the system clipboard's text, as the desktop shell delivers it. +fn paste(u: &mut Ui, clip: &Rc>>) { + let text = clip.borrow().clone().unwrap_or_default(); + u.frame(vec![Event::Paste(text)]); +} + /// Select `id` only, and draw the panel for it. fn select(u: &mut Ui, id: NodeId) { u.app.run("select.set", json!({"ids": [id]})); u.frame(vec![]); } +/// The hex codes of `id`'s fills, bottom to top. +fn fills(u: &Ui, id: NodeId) -> Vec { + let doc = u.app.session.doc().unwrap(); + doc.node(id).unwrap().fills.iter().map(|p| p.solid_color().unwrap().to_hex()).collect() +} + +#[test] +fn a_click_on_a_fill_rows_background_highlights_it_and_the_keyboard_copies_and_pastes_it() { + let (mut u, a, b, clip) = setup(); + click_row(&mut u, "FF0000"); + assert_eq!( + u.app.ui.property_row.as_ref().map(|h| (h.kind, h.index, h.ids.clone())), + Some((PropertyKind::Fill, 0, vec![a])), + "the row is highlighted for A" + ); + let layers_before = u.app.session.clipboard.layers_generation; + copy(&mut u); + let (fills_flag, paint) = u.app.session.clipboard.paint.clone().expect("the fill is on the clipboard"); + assert!(fills_flag); + assert_eq!(paint, u.app.session.doc().unwrap().node(a).unwrap().fills[0]); + assert_eq!(u.app.session.clipboard.layers_generation, layers_before, "the layers were not copied"); + assert!(u.app.session.clipboard.nodes.is_empty()); + assert_eq!(clip.borrow().as_deref(), Some("#FF0000"), "the colour goes to the system clipboard as its hex code"); + // Another layer selected, the paste puts the fill on top of its own. + select(&mut u, b); + assert!(u.app.ui.property_row.is_none(), "the highlight belonged to A"); + let layers = u.app.session.doc().unwrap().node_count(); + paste(&mut u, &clip); + assert_eq!(fills(&u, b), ["00FF00", "FF0000"]); + assert_eq!(u.app.session.doc().unwrap().node_count(), layers, "no layer was pasted"); + assert_eq!(fills(&u, a), ["FF0000"], "A keeps its fill"); + // One undo step takes it back off. + u.app.run("edit.undo", json!({})); + assert_eq!(fills(&u, b), ["00FF00"]); +} + +#[test] +fn a_paste_replaces_the_highlighted_row_of_the_target() { + let (mut u, _, b, clip) = setup(); + click_row(&mut u, "FF0000"); + copy(&mut u); + select(&mut u, b); + click_row(&mut u, "00FF00"); + assert_eq!(u.app.ui.property_row.as_ref().map(|h| (h.kind, h.index)), Some((PropertyKind::Fill, 0))); + paste(&mut u, &clip); + assert_eq!(fills(&u, b), ["FF0000"], "in place of B's highlighted fill"); +} + +#[test] +fn a_stroke_row_copies_its_paint_and_settings() { + let (mut u, a, b, clip) = setup(); + click_row(&mut u, "0000FF"); + assert_eq!(u.app.ui.property_row.as_ref().map(|h| h.kind), Some(PropertyKind::Stroke)); + copy(&mut u); + select(&mut u, b); + paste(&mut u, &clip); + let doc = u.app.session.doc().unwrap(); + let (na, nb) = (doc.node(a).unwrap(), doc.node(b).unwrap()); + assert_eq!(nb.strokes, na.strokes); + assert_eq!(nb.stroke.weight, 3.0, "the weight comes with the stroke"); + assert_eq!(fills(&u, b), ["00FF00"], "the fills are untouched"); +} + +#[test] +fn an_effect_row_copies_and_pastes_its_effect() { + let (mut u, a, b, clip) = setup(); + click_row(&mut u, "Layer blur"); + assert_eq!(u.app.ui.property_row.as_ref().map(|h| (h.kind, h.index)), Some((PropertyKind::Effect, 0))); + copy(&mut u); + assert_eq!(clip.borrow().as_deref(), Some("figcraft://clipboard/effect"), "an effect has no text: a marker of our copy"); + select(&mut u, b); + paste(&mut u, &clip); + let doc = u.app.session.doc().unwrap(); + let blur = doc.node(a).unwrap().effects[0].clone(); + assert_eq!(doc.node(b).unwrap().effects.len(), 2); + assert_eq!(doc.node(b).unwrap().effects[1], blur, "the blur goes on top of B's shadow"); +} + +#[test] +fn without_a_highlighted_row_the_keyboard_copies_and_pastes_layers() { + let (mut u, _, b, clip) = setup(); + copy(&mut u); + assert!(u.app.session.clipboard.paint.is_none(), "no fill was copied"); + assert_eq!(u.app.session.clipboard.nodes.len(), 1, "A was copied"); + select(&mut u, b); + let layers = u.app.session.doc().unwrap().node_count(); + paste(&mut u, &clip); + assert_eq!(u.app.session.doc().unwrap().node_count(), layers + 1, "a copy of A was pasted"); + assert_eq!(fills(&u, b), ["00FF00"]); +} + +#[test] +fn copying_layers_after_a_fill_pastes_the_layers() { + let (mut u, a, b, clip) = setup(); + click_row(&mut u, "FF0000"); + copy(&mut u); + // Another selection lets the highlight go; the next copy takes the layers. + select(&mut u, b); + select(&mut u, a); + assert!(u.app.ui.property_row.is_none(), "selecting A again doesn't bring the highlight back"); + copy(&mut u); + select(&mut u, b); + let layers = u.app.session.doc().unwrap().node_count(); + paste(&mut u, &clip); + assert_eq!(u.app.session.doc().unwrap().node_count(), layers + 1, "the layers were the last copy"); + assert_eq!(fills(&u, b), ["00FF00"]); +} + +#[test] +fn text_copied_in_another_app_afterwards_pastes_as_text() { + let (mut u, _, b, clip) = setup(); + click_row(&mut u, "FF0000"); + copy(&mut u); + select(&mut u, b); + *clip.borrow_mut() = Some("Hello".into()); + let layers = u.app.session.doc().unwrap().node_count(); + paste(&mut u, &clip); + assert_eq!(fills(&u, b), ["00FF00"], "the fill isn't what the clipboard holds now"); + assert_eq!(u.app.session.doc().unwrap().node_count(), layers + 1, "the text became a text layer"); +} + #[test] fn a_press_elsewhere_lets_the_highlight_go() { let (mut u, a, _, _) = setup(); @@ -89,6 +221,9 @@ fn a_press_elsewhere_lets_the_highlight_go() { click(&mut u, text_center(&shapes, "Effects")); assert_eq!(u.app.session.selection(), [a]); assert!(u.app.ui.property_row.is_none()); + // With nothing highlighted Cmd/Ctrl+C copies the layer again. + copy(&mut u); + assert!(u.app.session.clipboard.paint.is_none()); } #[test] @@ -141,6 +276,126 @@ fn a_click_on_the_canvas_lets_the_highlight_go() { assert!(u.app.ui.property_row.is_none()); } +#[test] +fn edit_copy_from_the_menu_copies_the_highlighted_row() { + let (mut u, _, _, _) = setup(); + click_row(&mut u, "FF0000"); + crate::menus::invoke(&mut u.app, "edit.copy"); + assert!(u.app.session.clipboard.paint.as_ref().is_some_and(|(fills, _)| *fills), "the fill was copied"); + assert!(u.app.session.clipboard.nodes.is_empty(), "not the layer"); +} + +#[test] +fn a_paste_onto_several_layers_adds_the_fill_to_each_in_one_undo_step() { + let (mut u, a, b, clip) = setup(); + let c = rect(&mut u.app.session, 200.0, "#0000FF"); + // A new rectangle is selected: A again. + select(&mut u, a); + click_row(&mut u, "FF0000"); + copy(&mut u); + // B and C have different fills: the panel shows mixed content, no row to highlight. + u.app.run("select.set", json!({"ids": [b, c]})); + u.frame(vec![]); + paste(&mut u, &clip); + assert_eq!(fills(&u, b), ["00FF00", "FF0000"]); + assert_eq!(fills(&u, c), ["0000FF", "FF0000"]); + u.app.run("edit.undo", json!({})); + assert_eq!((fills(&u, b), fills(&u, c)), (vec!["00FF00".to_string()], vec!["0000FF".to_string()])); +} + +#[test] +fn a_paste_replaces_the_highlighted_row_on_every_selected_layer() { + let (mut u, a, b, clip) = setup(); + let c = rect(&mut u.app.session, 200.0, "#00FF00"); + // A new rectangle is selected: A again. + select(&mut u, a); + click_row(&mut u, "FF0000"); + copy(&mut u); + // B and C share their fill: its row shows for both. + u.app.run("select.set", json!({"ids": [b, c]})); + u.frame(vec![]); + click_row(&mut u, "00FF00"); + assert_eq!(u.app.ui.property_row.as_ref().map(|h| h.ids.clone()), Some(vec![b, c])); + paste(&mut u, &clip); + assert_eq!((fills(&u, b), fills(&u, c)), (vec!["FF0000".to_string()], vec!["FF0000".to_string()])); + u.app.run("edit.undo", json!({})); + assert_eq!((fills(&u, b), fills(&u, c)), (vec!["00FF00".to_string()], vec!["00FF00".to_string()])); +} + +#[test] +fn a_copied_stroke_goes_to_the_strokes_with_a_fill_row_highlighted() { + let (mut u, a, b, clip) = setup(); + click_row(&mut u, "0000FF"); + copy(&mut u); + select(&mut u, b); + click_row(&mut u, "00FF00"); + assert_eq!(u.app.ui.property_row.as_ref().map(|h| h.kind), Some(PropertyKind::Fill)); + paste(&mut u, &clip); + let doc = u.app.session.doc().unwrap(); + assert_eq!(doc.node(b).unwrap().strokes, doc.node(a).unwrap().strokes, "the stroke went to the strokes"); + assert_eq!(fills(&u, b), ["00FF00"], "the highlighted fill wasn't replaced"); +} + +#[test] +fn an_effect_copied_after_a_fill_is_what_pastes() { + let (mut u, a, b, clip) = setup(); + click_row(&mut u, "FF0000"); + copy(&mut u); + click_row(&mut u, "Layer blur"); + copy(&mut u); + select(&mut u, b); + paste(&mut u, &clip); + assert_eq!(fills(&u, b), ["00FF00"], "the fill was copied first: not pasted"); + let doc = u.app.session.doc().unwrap(); + assert_eq!(doc.node(b).unwrap().effects.get(1), doc.node(a).unwrap().effects.first(), "the blur went on top of B's shadow"); +} + +#[test] +fn a_row_menu_copy_is_pasted_by_the_keyboard() { + let (mut u, _, b, clip) = setup(); + let shapes = flat(&u.frame_output(vec![]).shapes); + let p = text_center(&shapes, "FF0000"); + for pressed in [true, false] { + u.frame(vec![Event::PointerButton { pos: p, button: PointerButton::Secondary, pressed, modifiers: Modifiers::NONE }]); + } + let menu = flat(&u.frame_output(vec![]).shapes); + click(&mut u, text_center(&menu, crate::i18n::tr("Copy fill"))); + assert_eq!(clip.borrow().as_deref(), Some("#FF0000")); + select(&mut u, b); + paste(&mut u, &clip); + assert_eq!(fills(&u, b), ["00FF00", "FF0000"]); +} + +#[test] +fn programmatic_copy_and_paste_of_a_row_leave_the_system_clipboard_alone() { + let (mut u, a, b, clip) = setup(); + *clip.borrow_mut() = Some("the user's text".into()); + let doc = u.app.session.ds().unwrap().uid; + u.app.ui.property_row = Some(Highlight { kind: PropertyKind::Fill, index: 0, ids: vec![a], doc, rect: None }); + u.app.control_synthetic = true; + crate::menus::invoke(&mut u.app, "edit.copy"); + assert_eq!(clip.borrow().as_deref(), Some("the user's text"), "never written"); + u.app.run("select.set", json!({"ids": [b]})); + crate::menus::paste(&mut u.app, None, None); + assert_eq!(fills(&u, b), ["00FF00", "FF0000"]); +} + +#[test] +fn a_property_copy_whose_engine_copy_is_gone_pastes_no_stale_layers() { + let (mut u, a, b, clip) = setup(); + // A layer copy first, then the fill row's. + copy(&mut u); + click_row(&mut u, "FF0000"); + copy(&mut u); + // A stroke copied without its row (the Actions palette): the fill is no longer on the clipboard. + u.app.run("stroke.copy", json!({"id": a})); + select(&mut u, b); + let layers = u.app.session.doc().unwrap().node_count(); + paste(&mut u, &clip); + assert_eq!(u.app.session.doc().unwrap().node_count(), layers, "the layer copied before wasn't pasted"); + assert_eq!(fills(&u, b), ["00FF00"]); +} + #[test] fn a_highlighted_row_whose_paint_an_undo_took_away_goes() { let (mut u, a, _, _) = setup(); diff --git a/crates/ui-egui/src/windows.rs b/crates/ui-egui/src/windows.rs index 3397e00de..c0e838e4d 100644 --- a/crates/ui-egui/src/windows.rs +++ b/crates/ui-egui/src/windows.rs @@ -236,6 +236,8 @@ fn exchange(app: &mut FigApp, p: &mut Pane) { std::mem::swap(&mut app.ui, &mut p.ui); std::mem::swap(&mut app.ui.last_copy, &mut p.ui.last_copy); std::mem::swap(&mut app.ui.last_copy_generation, &mut p.ui.last_copy_generation); + // A paint or effect copied from its row is on the one clipboard every window pastes from. + std::mem::swap(&mut app.ui.property_copy, &mut p.ui.property_copy); std::mem::swap(&mut app.ui.quit, &mut p.ui.quit); std::mem::swap(&mut app.ui.dark, &mut p.ui.dark); std::mem::swap(&mut app.canvas, &mut p.canvas); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..b1c1e2757 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** minor (a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -36,6 +36,7 @@ interaction feel not yet compared. | Colour picker image well | partial | the Image tab shows a checkered placeholder and Upload from computer until there is a file (no dialog at once); an image paint shows its asset preview; a file dropped on the open picker replaces the image, keeping the fill mode, crop, position and adjustments (`image.replace`). Layers' fills and strokes only (text ranges, styles and selection colours keep Upload). The Fill and Stroke swatches take no drop: a dragged file's position isn't known, so a drop with none goes to the open picker | | Colour picker on a new fill or stroke | done | + opens the picker on the new paint when the selection shares one paint list; on a mixed selection + adds a paint to each layer and no picker opens (#404) | | Fill section on a text with coloured characters | done | a text's Fill section shows what its characters show: characters coloured differently while editing are mixed content ("Click + to replace mixed content", as a mixed selection; the developer documentation's `fills`: "Text nodes can have multiple sets of fills if some characters are colored differently than others"), and characters that all share fills the layer doesn't have show those. Any layer-level fill edit (a row, its picker, +, reordering, `fill.*`, `node.set`) reaches every character, starting from the list they showed; the characters' own fills go in the same undo step; the canvas gradient and crop handles show and edit the paint the row shows, the characters' own, also when their image is already in Crop mode (`text_mixed_fill_tests`, `canvas::handles::character_fill_tests`, engine `text_fill_tests`; #1856). A range selected while editing keeps its own Fill row | +| Fill, stroke and effect rows: click to highlight, Cmd/Ctrl+C, Cmd/Ctrl+V | done | a click on a row's reorder grip (left of its fields) or its background between its controls highlights it in the selected-row colour, one row at a time; Cmd/Ctrl+C (or Edit ▸ Copy) then copies that paint or effect instead of the layers (`fill.copy`, `stroke.copy`, `effect.copy`, as the row's menu does; a stroke takes its weight and settings along) and Cmd/Ctrl+V pastes it onto every selected layer (`fill.paste`, `stroke.paste`, `effect.paste`), one undo step: on top of each layer's list, or in place of the highlighted row when it is of the same kind. A copy keeps its kind: a stroke goes to the strokes and an effect to the effects whatever row is highlighted, and the last row copied is the one pasted. A solid colour also goes to the system clipboard as its hex code; a programmatic copy never writes it. A later layer copy, or text or an image copied in another app, is pasted instead; every window pastes the same copy. Escape, a press on the canvas or elsewhere in the Design panel, another selection, file or tab let the highlight go (#1494). The help center says only "Click to highlight the property on the right sidebar"; adding on top follows the forum's accepted answer for adding one fill without replacing the others, not an observation. Delete and Cmd/Ctrl+X still act on the layers; the keyboard alone can't highlight a row | | Blend mode menus: the layer's (Design panel) and each paint's (colour picker) | done | Pass through and Normal are distinct (Normal isolates a group's or frame's children); paints have no pass-through; plus darker drawn exactly on the canvas | ## Layers and Assets panels @@ -187,6 +188,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-09 | minor | M1, #1494: fill, stroke and effect rows in the Design panel couldn't be selected, so the keyboard couldn't copy one (only the row's menu could). A click on a row's grip or background now highlights it (`property_rows`; the row is a click target under its controls and its grip takes a click, neither focusable, so Tab still goes control to control), Cmd/Ctrl+C copies that paint or effect, and Cmd/Ctrl+V pastes it onto the selected layers, on top or in place of their highlighted row of that kind, while it is still the last copy ("Click to highlight the property on the right sidebar", Copy and paste properties between layers). Escape or a press on the canvas lets the highlight go before the selection. Tests: `property_rows_tests` (22) | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 61389cdd5fc03fe76bea0c80f8bed3d0606c8da1 Mon Sep 17 00:00:00 2001 From: ljkx <177671075+ljkx@users.noreply.github.com> Date: Mon, 9 Nov 2026 21:51:37 +0100 Subject: [PATCH 094/239] M4: test the simplified stroke by how far it strays, at more accuracies and inputs (#1741) Review follow-ups, tests only. - The Pencil test and the `vector.simplify` test measure how far the result strays from the samples (at most 1.5), not only its box. - The Pencil test also draws with the Marker and the Highlighter, each stroke in a fresh session, and takes the layer that stroke made. - The `vector.simplify` test runs on an open stroke, a filled shape, a region with its own fill, and a stroke beside a filled shape. - The geom tests run at accuracies 0.1, 0.75 and 8.0, on quadratic and cubic inputs as well as lines, and check both ways round how far the result and the input are apart. - A path that turns straight back is checked to be kurbo's fit of each side on its own, with a point at the turn. - Empty paths, lone moves and segments after a close are covered. --- crates/engine/src/brush_tests.rs | 72 +++++--- crates/engine/src/vector_behaviour_tests.rs | 63 +++++-- crates/geom/src/tests.rs | 191 ++++++++++++++++++-- 3 files changed, 267 insertions(+), 59 deletions(-) diff --git a/crates/engine/src/brush_tests.rs b/crates/engine/src/brush_tests.rs index 50317496d..065e5eec9 100644 --- a/crates/engine/src/brush_tests.rs +++ b/crates/engine/src/brush_tests.rs @@ -8,6 +8,7 @@ use crate::params::id_of; use crate::tools::{PointerEvent, PointerKind, pressure_profile}; use figcraft_doc::{NodeId, NodeKind}; use figcraft_geom::Point; +use figcraft_geom::kurbo::PathEl; fn id(v: Value) -> NodeId { id_of(&v["id"]).unwrap() @@ -155,10 +156,12 @@ fn the_pencil_draws_white_on_a_dark_background() { /// where samples ran on nearly straight. Pointer pixels become fractional page points, so going /// back to a pixel lands on exactly the same point. Both sample runs are ones kurbo's fit took /// hundreds of units off. +/// +/// Each stroke is drawn in a fresh session, with the Pencil and with the Marker and Highlighter +/// of a board, whose ink comes from the same fit. Every point along the stroke drawn must lie +/// within 1.5 (twice the fit's accuracy) of the polyline through the samples. #[test] fn the_pencil_keeps_its_stroke_where_it_was_drawn() { - let mut s = Session::new(); - s.execute("tool.set", &json!({"tool": "pencil"})).unwrap(); let (p, q) = ((86.043_565_719_086_97, -173.744_402_349_100_94), (87.851_850_739_335_35, -179.202_846_445_954_52)); let back = [(80.0, -160.0), p, q, p, (95.0, -185.0)]; let straight = [ @@ -168,30 +171,47 @@ fn the_pencil_keeps_its_stroke_where_it_was_drawn() { (214.246_506_828_720_84, -211.228_827_590_623_24), (218.0, -214.0), ]; - for (what, samples) in [("out and back", &back[..]), ("nearly straight", &straight[..])] { - let (first, last) = (samples[0], samples[samples.len() - 1]); - s.pointer(&PointerEvent::at(PointerKind::Down, first.0, first.1, 1.0)).unwrap(); - for (x, y) in &samples[1..] { - s.pointer(&PointerEvent::at(PointerKind::Move, *x, *y, 1.0)).unwrap(); + for tool in ["pencil", "marker", "highlighter"] { + for (what, samples) in [("out and back", &back[..]), ("nearly straight", &straight[..])] { + let what = format!("{tool}, {what}"); + let mut s = if tool == "pencil" { Session::new() } else { crate::board_tests::board() }; + s.execute("tool.set", &json!({"tool": tool})).unwrap(); + let before: Vec = s.doc().unwrap().nodes().map(|n| n.id).collect(); + let (first, last) = (samples[0], samples[samples.len() - 1]); + s.pointer(&PointerEvent::at(PointerKind::Down, first.0, first.1, 1.0)).unwrap(); + for (x, y) in &samples[1..] { + s.pointer(&PointerEvent::at(PointerKind::Move, *x, *y, 1.0)).unwrap(); + } + s.pointer(&PointerEvent::at(PointerKind::Up, last.0, last.1, 1.0)).unwrap(); + // The layer the stroke made, and only it. + let doc = s.doc().unwrap(); + let made: Vec<&figcraft_doc::Node> = + doc.nodes().filter(|n| !before.contains(&n.id) && matches!(n.kind, NodeKind::Vector { .. })).collect(); + let [n] = made[..] else { panic!("{what}: {} vectors made", made.len()) }; + let NodeKind::Vector { network } = &n.kind else { panic!("{what}: not a vector") }; + let drawn = doc.world_transform(n.id) * network.stroke_path(); + let polyline = figcraft_geom::BezPath::from_vec( + samples + .iter() + .enumerate() + .map(|(k, (x, y))| if k == 0 { PathEl::MoveTo(Point::new(*x, *y)) } else { PathEl::LineTo(Point::new(*x, *y)) }) + .collect(), + ); + let d = crate::vector_behaviour_tests::strays(&drawn, &polyline); + assert!(d <= 1.5, "{what}: the stroke strays {d} from the samples: {}", drawn.to_svg()); + let samples_box = figcraft_geom::points_bounds(samples.iter().map(|(x, y)| Point::new(*x, *y))).unwrap(); + let node_box = doc.world_bounds(n.id).unwrap(); + if tool == "pencil" { + assert!(samples_box.inflate(1.5, 1.5).contains_rect(node_box), "{what}: the layer {node_box:?}, the samples {samples_box:?}"); + } + // The turn is a point of the stroke, where it was drawn. + if samples == back { + let xf = doc.world_transform(n.id); + assert!( + network.vertices.iter().any(|v| (xf * Point::new(v.x, v.y) - Point::new(q.0, q.1)).hypot() < 1e-6), + "{what}: no point at the turn" + ); + } } - s.pointer(&PointerEvent::at(PointerKind::Up, last.0, last.1, 1.0)).unwrap(); - let doc = s.doc().unwrap(); - let n = doc.nodes().filter(|n| matches!(n.kind, NodeKind::Vector { .. })).max_by_key(|n| n.id).unwrap(); - let NodeKind::Vector { network } = &n.kind else { panic!("{what}: not a vector") }; - let drawn = doc.world_transform(n.id) * network.stroke_path(); - let samples_box = figcraft_geom::points_bounds(samples.iter().map(|(x, y)| Point::new(*x, *y))).unwrap(); - let (path_box, node_box) = (figcraft_geom::Shape::bounding_box(&drawn), doc.world_bounds(n.id).unwrap()); - assert!( - samples_box.inflate(1.5, 1.5).contains_rect(path_box), - "{what}: the stroke {path_box:?} goes past the samples {samples_box:?}: {}", - drawn.to_svg() - ); - assert!(samples_box.inflate(1.5, 1.5).contains_rect(node_box), "{what}: the layer {node_box:?}, the samples {samples_box:?}"); } - // The turn is a point of the stroke, where it was drawn. - let doc = s.doc().unwrap(); - let turned = doc.nodes().find(|n| n.name == "Vector" && doc.world_bounds(n.id).is_some_and(|b| b.y1 < -150.0 && b.x1 < 100.0)).unwrap(); - let NodeKind::Vector { network } = &turned.kind else { panic!("not a vector") }; - let xf = doc.world_transform(turned.id); - assert!(network.vertices.iter().any(|v| (xf * Point::new(v.x, v.y) - Point::new(q.0, q.1)).hypot() < 1e-6), "no point at the turn"); } diff --git a/crates/engine/src/vector_behaviour_tests.rs b/crates/engine/src/vector_behaviour_tests.rs index 4666c3028..d1d6907ee 100644 --- a/crates/engine/src/vector_behaviour_tests.rs +++ b/crates/engine/src/vector_behaviour_tests.rs @@ -326,25 +326,56 @@ fn ex_to_vector(doc: &mut figcraft_doc::Document, id: NodeId) { doc.get_mut(id).unwrap().kind = NodeKind::Vector { network }; } -/// Simplify path keeps nearly collinear points near where they were: kurbo's fit, which Simplify -/// path and the Pencil share, ran a handle hundreds of units on along the line (#1741). +/// How far `path` strays from `from`: the largest distance from a point sampled along `path` to +/// the nearest segment of `from`. +pub(crate) fn strays(path: &BezPath, from: &BezPath) -> f64 { + use figcraft_geom::kurbo::ParamCurveNearest; + let segs: Vec<_> = from.segments().collect(); + path.segments() + .flat_map(|seg| (0..=32).map(move |i| seg.eval(f64::from(i) / 32.0))) + .map(|p| segs.iter().map(|s| s.nearest(p, 1e-6).distance_sq).fold(f64::INFINITY, f64::min).sqrt()) + .fold(0.0, f64::max) +} + +/// Simplify path keeps nearly collinear points, and a stroke that goes out and back, near where +/// they were: kurbo's fit, which Simplify path and the Pencil share, ran a handle hundreds of units +/// on along the line (#1741). That holds for each way the command simplifies a layer: an open +/// stroke, a filled shape, a region with its own fill, and a stroke beside a filled shape. #[test] fn simplify_keeps_nearly_collinear_points_near_them() { - let mut s = Session::new(); - let id = id_of(&ex(&mut s, "vector.create", json!({"path": "M0 0 L10 10"}))["id"]).unwrap(); - // The points exactly as sampled, at the page origin (`vector.create` would move them). - let d = "M209.5986907940155 -204.90932811973988 L211.27791426387097 -207.1909740207534 L214.24650682872084 -211.22882759062324"; - let before = BezPath::from_svg(d).unwrap(); - { - let n = s.doc_mut().unwrap().get_mut(id).unwrap(); - n.transform = figcraft_geom::Affine::IDENTITY; - n.kind = NodeKind::Vector { network: VectorNetwork::from_path(&before) }; + // The points exactly as sampled. + let straight = "M209.5986907940155 -204.90932811973988 L211.27791426387097 -207.1909740207534 L214.24650682872084 -211.22882759062324"; + let back = + "M80 -160 L86.04356571908697 -173.74440234910094 L87.85185073933535 -179.20284644595452 L86.04356571908697 -173.74440234910094 L95 -185"; + let shape = format!("{straight} L260 -150 Z"); + let cases = [ + ("an open stroke", straight.to_string(), false), + ("a filled shape", shape.clone(), false), + ("a region with its own fill", shape.clone(), true), + ("a stroke beside a filled shape", format!("{shape} {back}"), false), + ]; + for (what, d, own_fill) in cases { + let mut s = Session::new(); + let id = id_of(&ex(&mut s, "vector.create", json!({"path": "M0 0 L10 10"}))["id"]).unwrap(); + // At the page origin, as given (`vector.create` would move the points). + let mut network = VectorNetwork::from_path(&BezPath::from_svg(&d).unwrap()); + if own_fill { + network.regions[0].fills = Some(vec![figcraft_color::Paint::solid(figcraft_color::Color::from_hex("#FF0000").unwrap())]); + } + { + let n = s.doc_mut().unwrap().get_mut(id).unwrap(); + n.transform = figcraft_geom::Affine::IDENTITY; + n.kind = NodeKind::Vector { network }; + } + let before = net(&s, id); + ex(&mut s, "vector.simplify", json!({"ids": [id], "tolerance": 0.75})); + let after = s.doc().unwrap().world_transform(id) * net(&s, id).stroke_path(); + let gone = strays(&after, &before.stroke_path()); + assert!(gone <= 1.5, "{what}: strays {gone}: {}", after.to_svg()); + let (b0, b1) = (before.stroke_path().bounding_box(), after.bounding_box()); + assert!(b0.inflate(1.5, 1.5).contains_rect(b1), "{what}: {b1:?} past {b0:?}: {}", after.to_svg()); + assert_eq!(net(&s, id).regions.len(), before.regions.len(), "{what}: the fill is kept"); } - assert_eq!(net(&s, id).stroke_path().elements(), before.elements(), "the samples as they were"); - ex(&mut s, "vector.simplify", json!({"ids": [id], "tolerance": 0.75})); - let after = s.doc().unwrap().world_transform(id) * net(&s, id).stroke_path(); - let (b0, b1) = (before.bounding_box(), after.bounding_box()); - assert!(b0.inflate(1.5, 1.5).contains_rect(b1), "{b1:?} past {b0:?}: {}", after.to_svg()); } fn ex(s: &mut Session, cmd: &str, p: Value) -> Value { diff --git a/crates/geom/src/tests.rs b/crates/geom/src/tests.rs index 10e09318c..786bf1935 100644 --- a/crates/geom/src/tests.rs +++ b/crates/geom/src/tests.rs @@ -393,7 +393,6 @@ fn deviation(out: &BezPath, input: &BezPath) -> f64 { /// about 390 and 160 units off; at whole-pixel coordinates the same shapes happened to fit well. #[test] fn simplifying_keeps_to_strokes_kurbo_shot_past() { - use kurbo::ParamCurve; let cases: [(&str, &[(f64, f64)]); 5] = [ ( "out and back to the same point", @@ -422,23 +421,127 @@ fn simplifying_keeps_to_strokes_kurbo_shot_past() { ), ]; for (what, pts) in cases { - let input = polyline(pts); - let out = simplify_path(&input, 0.75); - let d = deviation(&out, &input); - assert!(d <= 1.5, "{what}: strays {d} from the samples: {}", out.to_svg()); + keeps_to_one_stroke(what, &polyline(pts)); + } +} + +/// Accuracies the simplification is checked at: fine, the Pencil's, and coarse. +const ACCURACIES: [f64; 3] = [0.1, 0.75, 8.0]; + +/// Check that `input` (one open subpath), simplified at each of [`ACCURACIES`], strays no more +/// than twice the accuracy from it and leaves no part of it further off than that, stays in its +/// box grown by as much, and is still one subpath from its start to its end. +fn keeps_to_one_stroke(what: &str, input: &BezPath) { + for accuracy in ACCURACIES { + let out = simplify_path(input, accuracy); + let (svg, limit) = (out.to_svg(), 2.0 * accuracy); + let d = deviation(&out, input); + assert!(d <= limit, "{what} at {accuracy}: strays {d} from the input: {svg}"); + let left = deviation(input, &out); + assert!(left <= limit, "{what} at {accuracy}: leaves the input {left} off: {svg}"); let (inb, outb) = (input.bounding_box(), out.bounding_box()); - assert!(inb.inflate(1.5, 1.5).contains_rect(outb), "{what}: {outb:?} past {inb:?}"); - // One subpath, starting and ending where the stroke does. + assert!(inb.inflate(limit, limit).contains_rect(outb), "{what} at {accuracy}: {outb:?} past {inb:?}"); let moves = out.elements().iter().filter(|e| matches!(e, kurbo::PathEl::MoveTo(_))).count(); - assert_eq!(moves, 1, "{what}: {}", out.to_svg()); - let (first, last) = (pts[0], pts[pts.len() - 1]); - assert_eq!(out.segments().next().map(|s| s.start()), Some(Point::new(first.0, first.1)), "{what}"); - assert_eq!(out.segments().last().map(|s| s.end()), Some(Point::new(last.0, last.1)), "{what}"); + assert_eq!(moves, 1, "{what} at {accuracy}: {svg}"); + // From its start to its end: kurbo evaluates a fitted end on the input, so it is off by + // rounding at most. + let ends = |p: &BezPath| p.segments().next().map(|s| s.start()).zip(p.segments().last().map(|s| s.end())); + let ((start, end), (start_in, end_in)) = (ends(&out).unwrap(), ends(input).unwrap()); + assert!((start - start_in).hypot() < 1e-9 && (end - end_in).hypot() < 1e-9, "{what} at {accuracy}: {svg}"); + } +} + +/// Strokes made of curves keep to them as polylines do (#1741): a quadratic or a cubic that goes +/// out and comes straight back, one whose control points sit on its ends (so its direction is +/// read from the control point after them), and nearly collinear curves. +#[test] +fn simplifying_keeps_to_curves_that_turn_back_or_run_straight() { + let (p, q, r) = ( + (209.598_690_794_015_5, -204.909_328_119_739_88), + (211.277_914_263_870_97, -207.190_974_020_753_4), + (214.246_506_828_720_84, -211.228_827_590_623_24), + ); + // The nearly collinear samples, each line as a cubic with its handles a third of the way along. + let third = |a: (f64, f64), b: (f64, f64), t: f64| (a.0 + (b.0 - a.0) * t, a.1 + (b.1 - a.1) * t); + let mut straight_cubics = BezPath::new(); + straight_cubics.move_to(p); + for (a, b) in [(p, q), (q, r)] { + straight_cubics.curve_to(third(a, b, 1.0 / 3.0), third(a, b, 2.0 / 3.0), b); + } + let mut straight_quads = BezPath::new(); + straight_quads.move_to(p); + straight_quads.quad_to(third(p, q, 0.5), q); + straight_quads.quad_to(third(q, r, 0.5), r); + let cases = [ + ("a quadratic out and back", BezPath::from_svg("M0 0 Q15 10 30 0 Q15 10 0 0 Q-15 10 -30 0").unwrap()), + ("a cubic out and back", BezPath::from_svg("M0 0 C10 8 20 8 30 0 C20 8 10 8 0 0 C-10 8 -20 8 -30 0").unwrap()), + ("handles on the ends", BezPath::from_svg("M0 0 C0 0 30 4 30 4 C30 4 0 0 0 0 L-30 -4").unwrap()), + ("a cubic dip down and back up", BezPath::from_svg("M0 0 L10 0 C15 0 20 5 20 12 C20 5 25 0 30 0 L40 0").unwrap()), + ("nearly collinear cubics", straight_cubics), + ("nearly collinear quadratics", straight_quads), + ]; + for (what, input) in cases { + keeps_to_one_stroke(what, &input); + } +} + +/// `sides` simplified by kurbo one at a time and joined into one subpath. +fn fitted_apart(sides: &[&BezPath], accuracy: f64) -> BezPath { + let mut out = BezPath::new(); + for side in sides { + let fit = kurbo::simplify::simplify_bezpath(side.iter(), accuracy, &Default::default()); + let skip = usize::from(!out.elements().is_empty()); + out.extend(fit.elements().iter().copied().skip(skip)); + } + out +} + +/// `curve` cut into `n` cubics, drawn on from where `path` is: forwards, or back from its end. +fn in_pieces(path: &mut BezPath, curve: kurbo::CubicBez, n: u32, back: bool) { + use kurbo::ParamCurve; + for i in 0..n { + let i = if back { n - 1 - i } else { i }; + let c = curve.subsegment(f64::from(i) / f64::from(n)..f64::from(i + 1) / f64::from(n)); + if back { path.curve_to(c.p2, c.p1, c.p0) } else { path.curve_to(c.p1, c.p2, c.p3) } + } +} + +/// Where a path turns straight back it is cut, so the result is kurbo's fit of each side on its +/// own, with a point of the path at the turn. Fitted as one, kurbo rounds the turn off: its curve +/// passes the stray check, but falls short of the turn or takes more segments. A cubic whose +/// control points sit on its ends turns back as a line does. +#[test] +fn simplifying_fits_each_side_of_a_turn_back_on_its_own() { + use kurbo::ParamCurve; + let svg = |d: &str| BezPath::from_svg(d).unwrap(); + let s = kurbo::CubicBez::new((0.0, 0.0), (40.0, -60.0), (80.0, 60.0), (120.0, 0.0)); + let (mut s_out, mut s_back) = (BezPath::new(), BezPath::new()); + s_out.move_to(s.p0); + in_pieces(&mut s_out, s, 8, false); + s_back.move_to(s.p3); + in_pieces(&mut s_back, s, 8, true); + let cases = [ + ("lines", svg("M0 0 L10 0 L20 0 L30 0"), svg("M30 0 L20 0 L10 0")), + ("handles on the ends", svg("M0 0 L10 0 L20 0 C20 0 30 0 30 0"), svg("M30 0 C30 0 20 0 20 0 L10 0")), + ("a curve in pieces", s_out, s_back), + ]; + for (what, out_side, back_side) in cases { + let turn = out_side.segments().last().map(|seg| seg.end()).unwrap(); + let mut input = out_side.clone(); + input.extend(back_side.elements().iter().copied().skip(1)); + for accuracy in ACCURACIES { + let ours = simplify_path(&input, accuracy); + let apart = fitted_apart(&[&out_side, &back_side], accuracy); + assert_eq!(ours.elements(), apart.elements(), "{what} at {accuracy}"); + assert!(ours.segments().any(|seg| (seg.end() - turn).hypot() < 1e-9), "{what} at {accuracy}: {}", ours.to_svg()); + } } } /// Where a path never turns back and kurbo's fit holds, the result is kurbo's own, element for /// element: smooth runs, corners sharper than a right angle, closed subpaths and several subpaths. +/// A fit counts as holding up to twice the accuracy asked for, whatever that is: the large wave's +/// is further off at the coarse accuracy than the Pencil's limit of 1.5. #[test] fn simplifying_is_kurbos_where_its_fit_holds() { let wave: Vec<(f64, f64)> = (0..=60).map(|i| (f64::from(i) * 4.0, (f64::from(i) / 6.0).sin() * 30.0)).collect(); @@ -452,12 +555,30 @@ fn simplifying_is_kurbos_where_its_fit_holds() { e => e, })); let curves = BezPath::from_svg("M0 0 C10 -20 30 -20 40 0 C50 20 70 20 80 0 Q100 -30 120 0 L140 10 Z M200 0 L240 0").unwrap(); - for (what, input) in - [("a wave", polyline(&wave)), ("a zigzag", polyline(&zigzag)), ("closed", closed), ("two subpaths", several), ("curves", curves)] - { - let ours = simplify_path(&input, 0.75); - let theirs = kurbo::simplify::simplify_bezpath(input.iter(), 0.75, &Default::default()); - assert_eq!(ours.elements(), theirs.elements(), "{what}"); + // A sine 300 high in 40 smooth cubics. + let sine = |x: f64| ((x / 120.0).sin() * 300.0, (x / 120.0).cos() * 2.5); + let mut large = BezPath::new(); + large.move_to((0.0, 0.0)); + for i in 0..40 { + let (x0, x1) = (f64::from(i) * 40.0, f64::from(i + 1) * 40.0); + let ((y0, d0), (y1, d1)) = (sine(x0), sine(x1)); + large.curve_to((x0 + 40.0 / 3.0, y0 + d0 * 40.0 / 3.0), (x1 - 40.0 / 3.0, y1 - d1 * 40.0 / 3.0), (x1, y1)); + } + let coarse = simplify_path(&large, 8.0); + assert!(coarse.elements().len() < 10 && (1.5..=8.0).contains(&deviation(&coarse, &large)), "{}", deviation(&coarse, &large)); + for (what, input) in [ + ("a wave", polyline(&wave)), + ("a zigzag", polyline(&zigzag)), + ("closed", closed), + ("two subpaths", several), + ("curves", curves), + ("a large wave", large), + ] { + for accuracy in ACCURACIES { + let ours = simplify_path(&input, accuracy); + let theirs = kurbo::simplify::simplify_bezpath(input.iter(), accuracy, &Default::default()); + assert_eq!(ours.elements(), theirs.elements(), "{what} at {accuracy}"); + } } } @@ -482,4 +603,40 @@ fn simplifying_keeps_closes_and_subpaths_across_a_reversal() { empty.line_to((5.0, 5.0)); empty.close_path(); assert!(simplify_path(&empty, 0.75).elements().is_empty()); + for d in ["", "M5 5", "M5 5 M6 6", "M5 5 Z"] { + let input = if d.is_empty() { BezPath::new() } else { BezPath::from_svg(d).unwrap() }; + assert!(simplify_path(&input, 0.75).elements().is_empty(), "{d:?}"); + } +} + +/// The subpaths simplified keep their starts: a move with nothing drawn from it between two +/// subpaths leaves no trace, and a segment drawn on from a close starts a subpath where the closed +/// one started, as it does in the path given. +#[test] +fn simplifying_keeps_where_each_subpath_starts() { + let starts = + |p: &BezPath| -> Vec { p.elements().iter().filter_map(|e| if let kurbo::PathEl::MoveTo(p) = e { Some(*p) } else { None }).collect() }; + let between = BezPath::from_svg("M0 0 L10 0 L20 5 M50 50 M100 0 L110 0 L120 5").unwrap(); + let out = simplify_path(&between, 0.75); + assert_eq!(starts(&out), [Point::new(0.0, 0.0), Point::new(100.0, 0.0)], "{}", out.to_svg()); + assert!(deviation(&out, &between) <= 1.5, "{}", out.to_svg()); + // After the close, the pen is back at (0, 0): the next segments start there, also across a + // reversal. + use kurbo::PathEl::{ClosePath, LineTo, MoveTo}; + let on = BezPath::from_vec(vec![ + MoveTo(Point::new(0.0, 0.0)), + LineTo(Point::new(10.0, 0.0)), + LineTo(Point::new(10.0, 10.0)), + ClosePath, + LineTo(Point::new(20.0, 20.0)), + LineTo(Point::new(30.0, 20.0)), + LineTo(Point::new(20.0, 20.0)), + ]); + let out = simplify_path(&on, 0.75); + let els = out.elements(); + let close = els.iter().position(|e| matches!(e, kurbo::PathEl::ClosePath)).unwrap(); + assert_eq!(els.get(close + 1), Some(&kurbo::PathEl::MoveTo(Point::new(0.0, 0.0))), "{}", out.to_svg()); + assert_eq!(starts(&out), [Point::new(0.0, 0.0), Point::new(0.0, 0.0)], "{}", out.to_svg()); + assert_eq!(out.segments().last().map(|s| kurbo::ParamCurve::end(&s)), Some(Point::new(20.0, 20.0))); + assert!(deviation(&out, &on) <= 1.5, "{}", out.to_svg()); } From dadd4dfc6958c3720d97be5fa9a445ea58f618ff Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 16:50:45 -0500 Subject: [PATCH 095/239] M3: Selection colors shows for a layer with children from one colour (#2188) Measured in Figma web app 2026-11-09: a selection holding a layer with children (frame, group, component, instance) shows Selection colors from one distinct colour; layers without children need two. The section now shows when there are two colours, or one colour and a selected layer with children. Tests in selection_colors_tests; ui-parity updated. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 measured in Figma and wrote at medium --- crates/ui-egui/src/lib.rs | 2 + crates/ui-egui/src/panels/selection_colors.rs | 7 +- crates/ui-egui/src/selection_colors_tests.rs | 96 +++++++++++++++++++ docs/ui-parity.md | 7 +- 4 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 crates/ui-egui/src/selection_colors_tests.rs diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 60c68f526..e08d4fb0f 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -243,6 +243,8 @@ mod save_as_tests; #[cfg(test)] mod select_all_tests; #[cfg(test)] +mod selection_colors_tests; +#[cfg(test)] mod shortcut_keys_tests; #[cfg(test)] mod shortcuts_tests; diff --git a/crates/ui-egui/src/panels/selection_colors.rs b/crates/ui-egui/src/panels/selection_colors.rs index dbb6f16e4..09c831400 100644 --- a/crates/ui-egui/src/panels/selection_colors.rs +++ b/crates/ui-egui/src/panels/selection_colors.rs @@ -65,7 +65,7 @@ pub(crate) fn toggle(app: &mut FigApp, targets: Vec, response: Opti } } -/// Draw the selection-colour groups (at least two): swatch opens the picker, hex and opacity +/// Draw the selection-colour groups (two, or one when a selected layer has children): swatch opens the picker, hex and opacity /// edits, style/variable detach/apply/bind, a style from this file or an enabled library, Create /// style, and “select layers with this color”; disabled during an interaction. pub fn section(app: &mut FigApp, ui: &mut Ui, doc: &Arc, ids: &[NodeId]) { @@ -73,7 +73,10 @@ pub fn section(app: &mut FigApp, ui: &mut Ui, doc: &Arc, ids: &[NodeId let interacting = ds.interaction.is_some(); let uid = ds.uid; let colors = colors(ui, uid, doc, ids, interacting); - if colors.len() < 2 { + // Measured in Figma: two distinct colours show the section; one colour does too when a selected + // layer has children (frame, group, component, instance). + let has_children = ids.iter().any(|id| doc.node(*id).is_some_and(|n| !n.children.is_empty())); + if colors.len() < 2 && !(colors.len() == 1 && has_children) { ui.data_mut(|d| d.remove::(create_form_id())); return; } diff --git a/crates/ui-egui/src/selection_colors_tests.rs b/crates/ui-egui/src/selection_colors_tests.rs new file mode 100644 index 000000000..2164d3a6e --- /dev/null +++ b/crates/ui-egui/src/selection_colors_tests.rs @@ -0,0 +1,96 @@ +//! When the Design panel shows Selection colors (#2188): measured in Figma's web app, a layer with +//! children shows the section from one distinct colour, while layers without children need two. +//! Driven through egui headless; each row has a "Select layers with this color" button. + +use egui::accesskit::Role; +use figcraft_doc::NodeId; +use figcraft_engine::Session; +use serde_json::{Value, json}; + +use crate::layers_drag_tests::Ui; + +const ROW_BUTTON: &str = "Select layers with this color"; + +fn id(v: Value) -> NodeId { + NodeId(v["id"].as_u64().unwrap()) +} + +fn rect(s: &mut Session, x: i32, color: &str, parent: Option) -> NodeId { + let mut p = json!({"x": x, "y": 0, "width": 40, "height": 40}); + if let Some(parent) = parent { + p["parent"] = json!(parent); + } + let r = id(s.execute("shape.rectangle", &p).unwrap()); + s.execute("fill.set", &json!({"ids": [r], "color": color})).unwrap(); + r +} + +fn frame(s: &mut Session, fill: Option<&str>) -> NodeId { + let f = id(s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 200, "height": 200})).unwrap()); + match fill { + Some(c) => s.execute("fill.set", &json!({"ids": [f], "color": c})).unwrap(), + None => s.execute("fill.remove", &json!({"ids": [f], "index": 0})).unwrap(), + }; + f +} + +/// How many Selection colors rows the Design panel shows with `ids` selected. +fn rows(mut s: Session, ids: &[NodeId]) -> usize { + s.execute("select.set", &json!({"ids": ids})).unwrap(); + let mut u = Ui::new(s); + 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; + nodes.iter().filter(|(_, n)| n.role() == Role::Button && n.label() == Some(ROW_BUTTON)).count() +} + +#[test] +fn a_frame_holding_one_red_layer_shows_selection_colors_with_one_row() { + let mut s = Session::new(); + let f = frame(&mut s, None); + rect(&mut s, 10, "#FF0000", Some(f)); + assert_eq!(rows(s, &[f]), 1); +} + +#[test] +fn a_group_of_two_red_layers_shows_one_row() { + let mut s = Session::new(); + let a = rect(&mut s, 0, "#FF0000", None); + let b = rect(&mut s, 60, "#FF0000", None); + s.execute("select.set", &json!({"ids": [a, b]})).unwrap(); + let g = id(s.execute("object.group", &json!({"ids": [a, b]})).unwrap()); + assert_eq!(rows(s, &[g]), 1); +} + +#[test] +fn an_instance_whose_child_has_one_fill_shows_selection_colors() { + let mut s = Session::new(); + let f = frame(&mut s, None); + rect(&mut s, 10, "#FF0000", Some(f)); + let c = id(s.execute("component.create", &json!({"ids": [f]})).unwrap()); + let i = id(s.execute("instance.create", &json!({"component": c, "x": 400, "y": 0})).unwrap()); + assert_eq!(rows(s, &[i]), 1); +} + +#[test] +fn one_layer_or_two_of_the_same_colour_without_children_hide_it() { + let mut s = Session::new(); + let a = rect(&mut s, 0, "#FF0000", None); + assert_eq!(rows(s, &[a]), 0, "one red rectangle"); + let mut s = Session::new(); + let a = rect(&mut s, 0, "#FF0000", None); + let b = rect(&mut s, 60, "#FF0000", None); + assert_eq!(rows(s, &[a, b]), 0, "two red rectangles"); + let mut s = Session::new(); + let g = frame(&mut s, Some("#00FF00")); + assert_eq!(rows(s, &[g]), 0, "a childless green frame"); +} + +#[test] +fn two_loose_layers_of_different_colours_show_two_rows() { + let mut s = Session::new(); + let a = rect(&mut s, 0, "#FF0000", None); + let b = rect(&mut s, 60, "#0000FF", None); + assert_eq!(rows(s, &[a, b]), 2); +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..902566a4d 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** minor (Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 (#2188); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -78,9 +78,9 @@ interaction feel not yet compared. | Locked layers | done | selectable from the layers panel; no handles, not dragged with the rest of a selection | | Edit ▸ Set default properties: new layers take the selected layer's properties | done | from a shape (any layer but text): new rectangles, ellipses, polygons and stars drawn or clicked with their tools take its fills, strokes and their settings, effects, opacity, blend and corners; from a text layer: new text from the Text tool takes its fills and font (#2028). Silent in the help center on frames, lines and arrows: they keep their own look, as do layers made by commands; the defaults last for the session | | Smart selection spacing | partial | with layers in a row, a column or an aligned grid selected, the Layout section shows horizontal and vertical spacing ("Mixed" until set; typed, scrubbed, fractional and negative) and pink handles in the gaps on the canvas drag them, one undo step, Escape cancels (`arrange.spacing`; sizes, parents and offsets within each track kept; at most 2,000 layers; flow children, locked layers and layers inside instances left out). A ring at each layer's centre drags it to another place in a regular row, column or complete top-left-aligned grid: the others close up and make room around it with the gaps kept, and with Cmd/Ctrl held the two layers swap places instead, previewed live while dragging (`selection_reorder_tests`; no ring on a layer under 16 px on screen). Not covered: reordering irregular grids, and several marked layers moved together. Checked by its author on macOS and in the app on Windows (#402) | -| Selection colors | partial | for a mixed selection the Design panel lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). No library styles or variables from there, and no new style or variable from a row (#403) | +| Selection colors | partial | the Design panel shows the section from two distinct colours, or from one when a selected layer has children (a frame, group, component or instance), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). No library styles or variables from there, and no new style or variable from a row (#403) | | Keyboard box selection | done | Alt+Space on macOS, Ctrl+Space on Windows and Linux, or F8 (`select.area`): a box around the selection or in the middle of the view; arrows move it, Cmd/Ctrl+arrows or Shift+arrows size it (Shift with Cmd/Ctrl: farther), Enter selects like a marquee (Shift+Enter toggles, Cmd/Ctrl+Enter nested), Escape closes; Tab while the box shows, or the chord again, switches to pick select: a pink outline on the first selected layer (the page's top layer with nothing selected), Tab and Shift+Tab move it between sibling layers in Layers order, Enter into a frame's top child, Shift+Enter out to the parent, Space selects it, Escape or a press on the canvas ends it; `ui.key` takes the same keys (#1836) | -| Selection colors | partial | for a mixed selection the Design panel lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also lists each enabled library's published color styles under the library's name (a library that can't be read offers none), and a linked row's menu switches it to another style; a library style is copied in, linked and read-only, in the same undo step (`selection.applyColorStyle` with `library`). Create style on an ordinary row asks for a name (the next free "Color n" first) and makes a style of the row's whole paint, gradients, opacity, blend mode and variables bound to gradient stops included, linked to every fill and stroke the row stands for in one undo step; a name in use keeps the window open (`selection.createColorStyle`). Text ranges with fills of their own take the style's value, without a link. No library variables from there, and no new variable from a row (#403) | +| Selection colors | partial | the Design panel shows the section from two distinct colours, or from one when a selected layer has children (a frame, group, component or instance; a lone layer without children, or layers of one colour, hide it), counting the selected layers' own fills and strokes and their descendants' (measured in Figma's web app, 2026-11-09, #2188), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also lists each enabled library's published color styles under the library's name (a library that can't be read offers none), and a linked row's menu switches it to another style; a library style is copied in, linked and read-only, in the same undo step (`selection.applyColorStyle` with `library`). Create style on an ordinary row asks for a name (the next free "Color n" first) and makes a style of the row's whole paint, gradients, opacity, blend mode and variables bound to gradient stops included, linked to every fill and stroke the row stands for in one undo step; a name in use keeps the window open (`selection.createColorStyle`). Text ranges with fills of their own take the style's value, without a link. No library variables from there, and no new variable from a row (#403) | | Keyboard box selection | done | Alt+Space on macOS, Ctrl+Space on Windows and Linux, or F8 (`select.area`): a box around the selection or in the middle of the view; arrows move it, Cmd/Ctrl+arrows or Shift+arrows size it (Shift with Cmd/Ctrl: farther), Enter selects like a marquee (Shift+Enter toggles, Cmd/Ctrl+Enter nested), Escape closes | ## Tools @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-09 | patch | M3, #2188: Selection colors shows for a selection holding a layer with children (a frame, group, component or instance) from one distinct colour, and for layers without children only from two, as measured in Figma's web app on 2026-11-09: a frame holding one red rectangle, a group of two red rectangles and a frame with a lone black-stroked rectangle show one row; one red rectangle, two red rectangles and a childless green frame show none; a red and a blue loose rectangle show two. Tests: `selection_colors_tests`. Counts unchanged | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 06d03a543743641403b8a8f9da18f8fbaab02e82 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 17:40:51 -0500 Subject: [PATCH 096/239] M3: a caret without a solid fill contrasts with the page, not the interface (#2190) The fallback for text without a solid fill was the interface's text colour, white in the dark theme, which vanishes on the default light page (#F5F5F5). It is now black on a light page and white on a dark one (Color::is_dark of the page background). Test: without_a_solid_fill_the_caret_contrasts_with_the_page. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 found the cause and wrote --- crates/ui-egui/src/canvas/overlays.rs | 26 +++++++++++++++++++++++--- docs/ui-parity.md | 4 ++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/canvas/overlays.rs b/crates/ui-egui/src/canvas/overlays.rs index f0692fbfc..c2727e9cb 100644 --- a/crates/ui-egui/src/canvas/overlays.rs +++ b/crates/ui-egui/src/canvas/overlays.rs @@ -212,7 +212,7 @@ fn layout_grids(app: &FigApp, painter: &egui::Painter, doc: &Document, c: NodeId /// The solid colour of the fill the next typed character gets (the character before the caret, /// the first one's at 0, the base style for an empty text): the style's own fills when it has /// them, else the layer's. `None` when the topmost visible paint isn't a solid (gradient, image, -/// no visible fill), so the caller keeps the interface colour. Opaque on purpose: Figma's caret +/// no visible fill), so the caller uses [`caret_fallback`]. Opaque on purpose: Figma's caret /// is one colour, and the fill's and paint's opacity weren't measured, so it must stay visible. fn caret_fill(n: &figcraft_doc::Node, caret: usize) -> Option { let t = n.kind.text()?; @@ -229,6 +229,14 @@ fn caret_color(ctx: &egui::Context, n: &figcraft_doc::Node, caret: usize) -> Opt caret_fill(n, caret).map(|c| doc_c32(ctx, c)) } +/// The caret of a text without a solid fill (a gradient, an image, no visible fill): black on a +/// light page, white on a dark one. Not the interface's text colour, which is white in the dark +/// theme and vanishes on the default light page (#2190). +fn caret_fallback(doc: &Document, id: NodeId) -> Color32 { + let dark = doc.page_of(id).and_then(|p| doc.node(p)).is_some_and(|p| matches!(p.kind, NodeKind::Page { background, .. } if background.is_dark())); + if dark { Color32::WHITE } else { Color32::BLACK } +} + fn text_edit_overlay(app: &FigApp, painter: &egui::Painter, t: &Tokens, doc: &Document, te: &figcraft_engine::TextEdit, zoom: f64) { let preedit = app.preedit_view(); let edoc: &Document = preedit.map(|p| &*p.doc).unwrap_or(doc); @@ -262,7 +270,7 @@ fn text_edit_overlay(app: &FigApp, painter: &egui::Painter, t: &Tokens, doc: &Do let caret = preedit.map(|p| p.cursor).unwrap_or(te.caret); let blink = (painter.ctx().input(|i| i.time) * 2.0) as i64 % 2 == 0; if blink || a != b { - let col = edoc.node(te.id).and_then(|n| caret_color(painter.ctx(), n, caret)).unwrap_or(t.text); + let col = edoc.node(te.id).and_then(|n| caret_color(painter.ctx(), n, caret)).unwrap_or_else(|| caret_fallback(edoc, te.id)); painter.line_segment(text.caret(app, caret, zoom), stroke(col, 1.0)); } painter.ctx().request_repaint_after(std::time::Duration::from_millis(500)); @@ -855,8 +863,20 @@ mod caret_tests { assert_eq!(caret_fill(&text("x", vec![p]), 1).map(|c| c.a), Some(1.0)); } + /// #2190: a caret without a solid fill reads on the page: black on the default light page, + /// white on a dark one (the interface's text colour was white in the dark theme). #[test] - fn gradient_or_missing_fills_keep_the_interface_colour() { + fn without_a_solid_fill_the_caret_contrasts_with_the_page() { + let mut s = figcraft_engine::Session::new(); + let r = s.execute("text.create", &serde_json::json!({"text": "Caret", "x": 0, "y": 0})).unwrap(); + let id = figcraft_engine::params::id_of(&r["id"]).unwrap(); + assert_eq!(caret_fallback(s.doc().unwrap(), id), Color32::BLACK, "the default light page"); + s.execute("page.setBackground", &serde_json::json!({"color": "#1E1E1E"})).unwrap(); + assert_eq!(caret_fallback(s.doc().unwrap(), id), Color32::WHITE, "a dark page"); + } + + #[test] + fn gradient_or_missing_fills_have_no_fill_colour() { let mut g = Paint::solid(hex("#FF0000")); g.kind = figcraft_color::PaintKind::Gradient(figcraft_color::Gradient::default_for(figcraft_color::GradientKind::Linear, hex("#FF0000"))); assert_eq!(caret_fill(&text("Caret", vec![g]), 2), None); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index ab4b6cb8f..da127fd04 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -95,7 +95,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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). 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); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | -| Text: point, auto height, fixed; caret, words, lines, IME | done | Backspace or Delete at the start of a list item takes its marker and keeps its level, the paragraph starting where the item's text did ("delete the counter, but keep the same level of indentation", Create bulleted and numbered lists; `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests`); max lines on auto-width text keep it auto width, hugging up to that many lines and growing with its longest line ("Text resizing is set to auto height or auto width", Explore text properties; `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines`); Alt+Enter while editing opens the link at the caret, web and mail links only (`text.openLink`; "press ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma; `text_link_tests`); the font picker previews a family on the canvas while hovered (no undo step; Escape restores, #653) and Up/Down step through it (#352); a selection highlight after a line break starts at that line's start and an empty last line shows its mark (#665); carets step over whole emoji and accented letters; colour emoji draw from their colour tables (#300); IME composition replayed in tests as macOS sends it, not yet checked on a Mac (#747); CJK words by script run (no dictionary); vertical trim in Type settings; the caret takes the text's solid fill colour, measured in Figma's web app, 2026-11-09; gradient and image fills keep the interface colour (not measured) (#2156; `caret_tests`); 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; the caret takes the text's solid fill colour, measured in Figma's web app, 2026-11-09; gradient and image fills (not measured) give a black caret on a light page and a white one on a dark page, not the interface's text colour, which is white in the dark theme and vanished on the default light page (#2190) (#2156; `caret_tests`); no spell check | | Text: wrap style (Auto, Balance, Pretty) | done | per text layer (`wrapStyle` on `node.set`, `text.wrapStyle`, the Type settings control under Vertical trim, inspect, CSS `text-wrap: balance` or `pretty`): Auto breaks greedily; Balance narrows each paragraph as far as it goes without another line, so its lines come out close to the same length (what browsers do for `text-wrap: balance`); Pretty keeps lines full and, when the last line is one word, narrows one of the last four lines just enough to give a word to the lines after it (Explore text properties: "Auto: Figma fits as many words as possible on each line before wrapping to the next", "Balance: Figma distributes text as evenly as possible across every line, so each line is close to the same length", "Pretty: Figma keeps each line full, but adjusts the last four lines to avoid an orphan"). Saved line breaks from a file still win. Not yet included: per-paragraph settings, text-style support and the `.fig` import/export mapping (#1827). Test: `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented` | | Text: direction override (Text ▸ Text direction) | done | per paragraph (`ParaList::direction`: auto, ltr, rtl): Text ▸ Text direction ▸ Auto / Left to right / Right to left and `text.direction {direction, ids?}` set the edited paragraphs while editing, else every paragraph of the selected texts; `node.set textDirection` the layer's (or the chars `start`/`end` name); the Type settings control appears once a right-to-left script is in the text or a direction is forced; inspect reports `textDirection` when the paragraphs agree and `lineDirections` otherwise; Developer Mode's CSS writes `direction: ltr` or `rtl` when every paragraph is forced the same way (with `text-align: left` beside `rtl`, as Left is absolute on the canvas); `.fig` import and export carry each line's `sourceDirectionality`, read up to the paragraph count. Layout gives the paragraph its base level, so a forced right-to-left paragraph of Latin letters starts at the right, mirrors its list gutter and indent and orders its runs right to left, and a forced left-to-right paragraph of Hebrew the other way ("By default, Figma automatically handles text direction based on language detection. However, controls are available to override text direction per paragraph", "Go to Text > Text direction. Select Left to right or Right to left", Add right-to-left text). Not included: a direction in text styles (the article names none). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests` | | 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` | @@ -187,7 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| -| 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start), opaque; gradient, image and hidden fills keep the interface colour (not measured). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | +| 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start), opaque; gradient, image and hidden fills (not measured) give a black caret on a light page and a white one on a dark page, not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 3cdc5f7e32849ff06a5b8e055fa339b74e4bedd5 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 18:37:30 -0500 Subject: [PATCH 097/239] M3: the caret fallback reads the filled layer around the text; caret opacity marked unmeasured (#2163 review) Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 checked the findings and wrote --- crates/ui-egui/src/canvas/overlays.rs | 33 +++++++++++++++++++++++---- docs/ui-parity.md | 4 ++-- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/canvas/overlays.rs b/crates/ui-egui/src/canvas/overlays.rs index c2727e9cb..fd0d8c26e 100644 --- a/crates/ui-egui/src/canvas/overlays.rs +++ b/crates/ui-egui/src/canvas/overlays.rs @@ -230,11 +230,21 @@ fn caret_color(ctx: &egui::Context, n: &figcraft_doc::Node, caret: usize) -> Opt } /// The caret of a text without a solid fill (a gradient, an image, no visible fill): black on a -/// light page, white on a dark one. Not the interface's text colour, which is white in the dark -/// theme and vanishes on the default light page (#2190). +/// light surface, white on a dark one. The surface is the nearest layer around the text with a +/// visible solid fill (a dark frame on a light page counts), else the page. Not the interface's +/// text colour, which is white in the dark theme and vanishes on the default light page (#2190). fn caret_fallback(doc: &Document, id: NodeId) -> Color32 { - let dark = doc.page_of(id).and_then(|p| doc.node(p)).is_some_and(|p| matches!(p.kind, NodeKind::Page { background, .. } if background.is_dark())); - if dark { Color32::WHITE } else { Color32::BLACK } + let under = doc.ancestors(id).into_iter().find_map(|a| { + let n = doc.node(a)?; + match &n.kind { + NodeKind::Page { background, .. } => Some(*background), + _ => n.fills.iter().rev().find(|p| p.visible && p.opacity >= 0.5).and_then(|p| match &p.kind { + figcraft_color::PaintKind::Solid { color } => Some(*color), + _ => None, + }), + } + }); + if under.is_some_and(|c| c.is_dark()) { Color32::WHITE } else { Color32::BLACK } } fn text_edit_overlay(app: &FigApp, painter: &egui::Painter, t: &Tokens, doc: &Document, te: &figcraft_engine::TextEdit, zoom: f64) { @@ -875,6 +885,21 @@ mod caret_tests { assert_eq!(caret_fallback(s.doc().unwrap(), id), Color32::WHITE, "a dark page"); } + /// CodeRabbit on #2163: a dark frame on a light page is the surface under its text. + #[test] + fn without_a_solid_fill_the_caret_contrasts_with_the_frame_around_it() { + let mut s = figcraft_engine::Session::new(); + let ex = |s: &mut figcraft_engine::Session, c: &str, p: serde_json::Value| s.execute(c, &p).unwrap(); + let f = ex(&mut s, "frame.create", serde_json::json!({"x": 0, "y": 0, "width": 300, "height": 200})); + let f = figcraft_engine::params::id_of(&f["id"]).unwrap(); + ex(&mut s, "node.set", serde_json::json!({"id": f, "props": {"fill": "#222222"}})); + let r = ex(&mut s, "text.create", serde_json::json!({"text": "Caret", "x": 20, "y": 20, "parent": f})); + let id = figcraft_engine::params::id_of(&r["id"]).unwrap(); + assert_eq!(caret_fallback(s.doc().unwrap(), id), Color32::WHITE, "inside a dark frame on the light page"); + ex(&mut s, "node.set", serde_json::json!({"id": f, "props": {"fill": "#F0F0F0"}})); + assert_eq!(caret_fallback(s.doc().unwrap(), id), Color32::BLACK, "inside a light frame"); + } + #[test] fn gradient_or_missing_fills_have_no_fill_colour() { let mut g = Paint::solid(hex("#FF0000")); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index da127fd04..a0c464382 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -95,7 +95,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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). 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); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | -| Text: point, auto height, fixed; caret, words, lines, IME | done | Backspace or Delete at the start of a list item takes its marker and keeps its level, the paragraph starting where the item's text did ("delete the counter, but keep the same level of indentation", Create bulleted and numbered lists; `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests`); max lines on auto-width text keep it auto width, hugging up to that many lines and growing with its longest line ("Text resizing is set to auto height or auto width", Explore text properties; `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines`); Alt+Enter while editing opens the link at the caret, web and mail links only (`text.openLink`; "press ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma; `text_link_tests`); the font picker previews a family on the canvas while hovered (no undo step; Escape restores, #653) and Up/Down step through it (#352); a selection highlight after a line break starts at that line's start and an empty last line shows its mark (#665); carets step over whole emoji and accented letters; colour emoji draw from their colour tables (#300); IME composition replayed in tests as macOS sends it, not yet checked on a Mac (#747); CJK words by script run (no dictionary); vertical trim in Type settings; the caret takes the text's solid fill colour, measured in Figma's web app, 2026-11-09; gradient and image fills (not measured) give a black caret on a light page and a white one on a dark page, not the interface's text colour, which is white in the dark theme and vanished on the default light page (#2190) (#2156; `caret_tests`); no spell check | +| Text: point, auto height, fixed; caret, words, lines, IME | done | Backspace or Delete at the start of a list item takes its marker and keeps its level, the paragraph starting where the item's text did ("delete the counter, but keep the same level of indentation", Create bulleted and numbered lists; `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests`); max lines on auto-width text keep it auto width, hugging up to that many lines and growing with its longest line ("Text resizing is set to auto height or auto width", Explore text properties; `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines`); Alt+Enter while editing opens the link at the caret, web and mail links only (`text.openLink`; "press ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma; `text_link_tests`); the font picker previews a family on the canvas while hovered (no undo step; Escape restores, #653) and Up/Down step through it (#352); a selection highlight after a line break starts at that line's start and an empty last line shows its mark (#665); carets step over whole emoji and accented letters; colour emoji draw from their colour tables (#300); IME composition replayed in tests as macOS sends it, not yet checked on a Mac (#747); CJK words by script run (no dictionary); vertical trim in Type settings; the caret takes the text's solid fill colour, measured in Figma's web app, 2026-11-09; gradient and image fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest filled layer around the text, else the page), not the interface's text colour, which is white in the dark theme and vanished on the default light page (#2190) (#2156; `caret_tests`); no spell check | | Text: wrap style (Auto, Balance, Pretty) | done | per text layer (`wrapStyle` on `node.set`, `text.wrapStyle`, the Type settings control under Vertical trim, inspect, CSS `text-wrap: balance` or `pretty`): Auto breaks greedily; Balance narrows each paragraph as far as it goes without another line, so its lines come out close to the same length (what browsers do for `text-wrap: balance`); Pretty keeps lines full and, when the last line is one word, narrows one of the last four lines just enough to give a word to the lines after it (Explore text properties: "Auto: Figma fits as many words as possible on each line before wrapping to the next", "Balance: Figma distributes text as evenly as possible across every line, so each line is close to the same length", "Pretty: Figma keeps each line full, but adjusts the last four lines to avoid an orphan"). Saved line breaks from a file still win. Not yet included: per-paragraph settings, text-style support and the `.fig` import/export mapping (#1827). Test: `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented` | | Text: direction override (Text ▸ Text direction) | done | per paragraph (`ParaList::direction`: auto, ltr, rtl): Text ▸ Text direction ▸ Auto / Left to right / Right to left and `text.direction {direction, ids?}` set the edited paragraphs while editing, else every paragraph of the selected texts; `node.set textDirection` the layer's (or the chars `start`/`end` name); the Type settings control appears once a right-to-left script is in the text or a direction is forced; inspect reports `textDirection` when the paragraphs agree and `lineDirections` otherwise; Developer Mode's CSS writes `direction: ltr` or `rtl` when every paragraph is forced the same way (with `text-align: left` beside `rtl`, as Left is absolute on the canvas); `.fig` import and export carry each line's `sourceDirectionality`, read up to the paragraph count. Layout gives the paragraph its base level, so a forced right-to-left paragraph of Latin letters starts at the right, mirrors its list gutter and indent and orders its runs right to left, and a forced left-to-right paragraph of Hebrew the other way ("By default, Figma automatically handles text direction based on language detection. However, controls are available to override text direction per paragraph", "Go to Text > Text direction. Select Left to right or Right to left", Add right-to-left text). Not included: a direction in text styles (the article names none). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests` | | 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` | @@ -187,7 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| -| 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start), opaque; gradient, image and hidden fills (not measured) give a black caret on a light page and a white one on a dark page, not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | +| 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start); FigCraft draws it opaque (how Figma treats a translucent fill was not measured); gradient, image and hidden fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest filled layer around the text, else the page), not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 21d0594614dec67cd851400fa48464449ce9ee0a Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 18:38:13 -0500 Subject: [PATCH 098/239] M3: the Selection colors rows agree on library styles and qualify the one-colour case (#2191 review) Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 checked the findings and wrote --- docs/ui-parity.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 902566a4d..29d05ff38 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -78,9 +78,9 @@ interaction feel not yet compared. | Locked layers | done | selectable from the layers panel; no handles, not dragged with the rest of a selection | | Edit ▸ Set default properties: new layers take the selected layer's properties | done | from a shape (any layer but text): new rectangles, ellipses, polygons and stars drawn or clicked with their tools take its fills, strokes and their settings, effects, opacity, blend and corners; from a text layer: new text from the Text tool takes its fills and font (#2028). Silent in the help center on frames, lines and arrows: they keep their own look, as do layers made by commands; the defaults last for the session | | Smart selection spacing | partial | with layers in a row, a column or an aligned grid selected, the Layout section shows horizontal and vertical spacing ("Mixed" until set; typed, scrubbed, fractional and negative) and pink handles in the gaps on the canvas drag them, one undo step, Escape cancels (`arrange.spacing`; sizes, parents and offsets within each track kept; at most 2,000 layers; flow children, locked layers and layers inside instances left out). A ring at each layer's centre drags it to another place in a regular row, column or complete top-left-aligned grid: the others close up and make room around it with the gaps kept, and with Cmd/Ctrl held the two layers swap places instead, previewed live while dragging (`selection_reorder_tests`; no ring on a layer under 16 px on screen). Not covered: reordering irregular grids, and several marked layers moved together. Checked by its author on macOS and in the app on Windows (#402) | -| Selection colors | partial | the Design panel shows the section from two distinct colours, or from one when a selected layer has children (a frame, group, component or instance), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). No library styles or variables from there, and no new style or variable from a row (#403) | +| Selection colors | partial | the Design panel shows the section from two distinct colours, or from one when a selected layer has children (a frame, group, component or instance), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also offers enabled libraries' published color styles and Create style (`selection.createColorStyle`); no library variables and no new variable from a row (#403) | | Keyboard box selection | done | Alt+Space on macOS, Ctrl+Space on Windows and Linux, or F8 (`select.area`): a box around the selection or in the middle of the view; arrows move it, Cmd/Ctrl+arrows or Shift+arrows size it (Shift with Cmd/Ctrl: farther), Enter selects like a marquee (Shift+Enter toggles, Cmd/Ctrl+Enter nested), Escape closes; Tab while the box shows, or the chord again, switches to pick select: a pink outline on the first selected layer (the page's top layer with nothing selected), Tab and Shift+Tab move it between sibling layers in Layers order, Enter into a frame's top child, Shift+Enter out to the parent, Space selects it, Escape or a press on the canvas ends it; `ui.key` takes the same keys (#1836) | -| Selection colors | partial | the Design panel shows the section from two distinct colours, or from one when a selected layer has children (a frame, group, component or instance; a lone layer without children, or layers of one colour, hide it), counting the selected layers' own fills and strokes and their descendants' (measured in Figma's web app, 2026-11-09, #2188), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also lists each enabled library's published color styles under the library's name (a library that can't be read offers none), and a linked row's menu switches it to another style; a library style is copied in, linked and read-only, in the same undo step (`selection.applyColorStyle` with `library`). Create style on an ordinary row asks for a name (the next free "Color n" first) and makes a style of the row's whole paint, gradients, opacity, blend mode and variables bound to gradient stops included, linked to every fill and stroke the row stands for in one undo step; a name in use keeps the window open (`selection.createColorStyle`). Text ranges with fills of their own take the style's value, without a link. No library variables from there, and no new variable from a row (#403) | +| Selection colors | partial | the Design panel shows the section from two distinct colours, or from one when a selected layer has children (a frame, group, component or instance; a lone layer without children, or several layers without children in one colour, hide it), counting the selected layers' own fills and strokes and their descendants' (measured in Figma's web app, 2026-11-09, #2188), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also lists each enabled library's published color styles under the library's name (a library that can't be read offers none), and a linked row's menu switches it to another style; a library style is copied in, linked and read-only, in the same undo step (`selection.applyColorStyle` with `library`). Create style on an ordinary row asks for a name (the next free "Color n" first) and makes a style of the row's whole paint, gradients, opacity, blend mode and variables bound to gradient stops included, linked to every fill and stroke the row stands for in one undo step; a name in use keeps the window open (`selection.createColorStyle`). Text ranges with fills of their own take the style's value, without a link. No library variables from there, and no new variable from a row (#403) | | Keyboard box selection | done | Alt+Space on macOS, Ctrl+Space on Windows and Linux, or F8 (`select.area`): a box around the selection or in the middle of the view; arrows move it, Cmd/Ctrl+arrows or Shift+arrows size it (Shift with Cmd/Ctrl: farther), Enter selects like a marquee (Shift+Enter toggles, Cmd/Ctrl+Enter nested), Escape closes | ## Tools From 30767bd2b2c3853098040d4c7f382433e51b6d32 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 18:53:03 -0500 Subject: [PATCH 099/239] M3: the eyedropper picks a magnified image's pixel under the pointer (#2189) The eyedropper rendered its 1x1 sample with default render options, without the canvas's magnified-image pixels, so on an image shown past 2x it took a bicubic blend of a 1 px line and its neighbours: the reporter's #3D444D border beside a darker background came out darker. The sample also began at the pointer instead of being centred on it, half a screen pixel off. It now renders as the canvas does (magnified_image_pixels) and centres the pixel on the pointer. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 found the cause from the reporter's values and wrote; Sonnet 5.5 investigated the flat cases at medium --- crates/engine/src/canvas/tools/click.rs | 9 ++++- crates/engine/src/eyedropper_image_tests.rs | 42 +++++++++++++++++++++ crates/engine/src/lib.rs | 2 + docs/ui-parity.md | 5 ++- 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 crates/engine/src/eyedropper_image_tests.rs diff --git a/crates/engine/src/canvas/tools/click.rs b/crates/engine/src/canvas/tools/click.rs index 35a97a77a..a7c10d574 100644 --- a/crates/engine/src/canvas/tools/click.rs +++ b/crates/engine/src/canvas/tools/click.rs @@ -360,8 +360,13 @@ impl Session { pub(super) fn eyedrop(&mut self, ev: &PointerEvent) -> Result<()> { let ds = self.ds()?; let doc = ds.doc.clone(); - let view = figcraft_render::View { origin: (ev.x, ev.y), scale: ev.zoom.max(0.01), width: 1, height: 1 }; - let Some(pix) = figcraft_render::render_view(&doc, ds.page, &view, &Default::default()) else { return Ok(()) }; + // One screen pixel centred on the pointer (its top left half a pixel up and to the left). + let scale = ev.zoom.max(0.01); + let view = figcraft_render::View { origin: (ev.x - 0.5 / scale, ev.y - 0.5 / scale), scale, width: 1, height: 1 }; + // As the canvas draws it: an image magnified past 2x shows its pixels, so the colour picked + // is the pixel under the pointer, not a blend with its neighbours (#2189). + let opts = figcraft_render::Options { magnified_image_pixels: true, ..Default::default() }; + let Some(pix) = figcraft_render::render_view(&doc, ds.page, &view, &opts) else { return Ok(()) }; let rgba = figcraft_render::to_rgba8(&pix); let c = figcraft_color::Color::from_rgba8( rgba.first().copied().unwrap_or(0), diff --git a/crates/engine/src/eyedropper_image_tests.rs b/crates/engine/src/eyedropper_image_tests.rs new file mode 100644 index 000000000..b5e55cd23 --- /dev/null +++ b/crates/engine/src/eyedropper_image_tests.rs @@ -0,0 +1,42 @@ +//! #2189: the eyedropper picks the colour the canvas shows under the pointer. A magnified image +//! draws its pixels on the canvas (`magnified_image_pixels`), so the picked colour is that pixel's, +//! not a blend with its neighbours. + +use base64::Engine as _; +use serde_json::json; + +use crate::Session; +use crate::tools::{PointerEvent, PointerKind}; + +/// A 9 x 9 image of `back` with a 1 px vertical line of `line` in column 4 (a thin border in a +/// screenshot, as in the report). +fn line_png(back: [u8; 3], line: [u8; 3]) -> Vec { + let mut p = figcraft_render::Pixmap::new(9, 9).unwrap(); + for (i, px) in p.data_mut().chunks_exact_mut(4).enumerate() { + let c = if i % 9 == 4 { line } else { back }; + px.copy_from_slice(&[c[0], c[1], c[2], 255]); + } + figcraft_render::encode_png(&p).unwrap() +} + +/// The colour the eyedropper picks at page point (x, y) at `zoom`. +fn picked(png: &[u8], x: f64, y: f64, zoom: f64) -> String { + let mut s = Session::new(); + let data = base64::engine::general_purpose::STANDARD.encode(png); + s.execute("image.place", &json!({"data": data, "x": 0, "y": 0})).unwrap(); + s.execute("edit.pickColor", &json!({"apply": false})).unwrap(); + s.pointer(&PointerEvent::at(PointerKind::Down, x, y, zoom)).unwrap(); + s.tool.picked.map(|c| c.to_hex()).unwrap_or_default() +} + +#[test] +fn the_eyedropper_picks_a_magnified_images_pixel_not_a_blend_with_its_neighbours() { + // The reporter's colours: a #3D444D border, 1 px wide, beside a darker background. + let png = line_png([0x15, 0x1B, 0x23], [0x3D, 0x44, 0x4D]); + for zoom in [2.0, 8.0, 20.0] { + assert_eq!(picked(&png, 4.5, 4.5, zoom), "3D444D", "on the line at {zoom}x"); + assert_eq!(picked(&png, 2.5, 4.5, zoom), "151B23", "beside it at {zoom}x"); + } + // At 1:1 the canvas pixel is the image's pixel too. + assert_eq!(picked(&png, 4.5, 4.5, 1.0), "3D444D", "on the line at 1x"); +} diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 302e7053e..74614c5e7 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -323,6 +323,8 @@ mod extended_chain_tests; #[cfg(test)] mod eyedropper_create_tests; #[cfg(test)] +mod eyedropper_image_tests; +#[cfg(test)] mod facilitate_tests; #[cfg(test)] mod fig_export_assets_tests; diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..2c2b2018f 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** minor (the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -99,7 +99,7 @@ interaction feel not yet compared. | Text: wrap style (Auto, Balance, Pretty) | done | per text layer (`wrapStyle` on `node.set`, `text.wrapStyle`, the Type settings control under Vertical trim, inspect, CSS `text-wrap: balance` or `pretty`): Auto breaks greedily; Balance narrows each paragraph as far as it goes without another line, so its lines come out close to the same length (what browsers do for `text-wrap: balance`); Pretty keeps lines full and, when the last line is one word, narrows one of the last four lines just enough to give a word to the lines after it (Explore text properties: "Auto: Figma fits as many words as possible on each line before wrapping to the next", "Balance: Figma distributes text as evenly as possible across every line, so each line is close to the same length", "Pretty: Figma keeps each line full, but adjusts the last four lines to avoid an orphan"). Saved line breaks from a file still win. Not yet included: per-paragraph settings, text-style support and the `.fig` import/export mapping (#1827). Test: `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented` | | Text: direction override (Text ▸ Text direction) | done | per paragraph (`ParaList::direction`: auto, ltr, rtl): Text ▸ Text direction ▸ Auto / Left to right / Right to left and `text.direction {direction, ids?}` set the edited paragraphs while editing, else every paragraph of the selected texts; `node.set textDirection` the layer's (or the chars `start`/`end` name); the Type settings control appears once a right-to-left script is in the text or a direction is forced; inspect reports `textDirection` when the paragraphs agree and `lineDirections` otherwise; Developer Mode's CSS writes `direction: ltr` or `rtl` when every paragraph is forced the same way (with `text-align: left` beside `rtl`, as Left is absolute on the canvas); `.fig` import and export carry each line's `sourceDirectionality`, read up to the paragraph count. Layout gives the paragraph its base level, so a forced right-to-left paragraph of Latin letters starts at the right, mirrors its list gutter and indent and orders its runs right to left, and a forced left-to-right paragraph of Hebrew the other way ("By default, Figma automatically handles text direction based on language detection. However, controls are available to override text direction per paragraph", "Go to Text > Text direction. Select Left to right or Right to left", Add right-to-left text). Not included: a direction in text styles (the article names none). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests` | | 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`) | +| 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`): one screen pixel centred on the pointer, sampled as the canvas draws it, so an image magnified past 2x gives the pixel under the pointer, not a blend with its neighbours (#2189, `eyedropper_image_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 | | Stretch and scatter brushes (Figma Draw) | done | eight presets drawn in code; the Pencil's brush is set by `tool.pencilBrush`, not from the toolbar | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-09 | patch | M3, #2189: the eyedropper picks the colour the canvas shows. It sampled a 1x1 render without the canvas's magnified-image pixels, so on an image magnified past 2x it blended a 1 px line with its neighbours (#3D444D picked as #343B44 beside #151B23), and the pixel it sampled began at the pointer instead of being centred on it. Test: `eyedropper_image_tests` | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 6920ea63558e0ad10c9b6e8f9818379c311e6f66 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 19:35:24 -0500 Subject: [PATCH 100/239] M3: the caret fallback counts layer opacity and the docs state which fills count (#2163 review) Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 checked the findings and wrote --- crates/ui-egui/src/canvas/overlays.rs | 34 +++++++++++++++++++++------ docs/ui-parity.md | 4 ++-- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/crates/ui-egui/src/canvas/overlays.rs b/crates/ui-egui/src/canvas/overlays.rs index fd0d8c26e..81f8c0e90 100644 --- a/crates/ui-egui/src/canvas/overlays.rs +++ b/crates/ui-egui/src/canvas/overlays.rs @@ -230,16 +230,33 @@ fn caret_color(ctx: &egui::Context, n: &figcraft_doc::Node, caret: usize) -> Opt } /// The caret of a text without a solid fill (a gradient, an image, no visible fill): black on a -/// light surface, white on a dark one. The surface is the nearest layer around the text with a -/// visible solid fill (a dark frame on a light page counts), else the page. Not the interface's -/// text colour, which is white in the dark theme and vanishes on the default light page (#2190). +/// light surface, white on a dark one. The surface is the nearest layer around the text whose +/// topmost visible fill is a solid at least half opaque as drawn (its paint's opacity times its +/// own and its containers' layer opacity), else the page; a layer whose top fill is a gradient or an +/// image is passed over. Not the interface's text colour, which is white in the dark theme and +/// vanishes on the default light page (#2190). fn caret_fallback(doc: &Document, id: NodeId) -> Color32 { - let under = doc.ancestors(id).into_iter().find_map(|a| { - let n = doc.node(a)?; + let chain = doc.ancestors(id); + // Each layer's opacity as drawn: its own times every container's above it. + let drawn: Vec = { + let mut acc = 1.0f32; + let mut out: Vec = chain + .iter() + .rev() + .map(|a| { + acc *= doc.node(*a).map_or(1.0, |n| if n.opacity.is_finite() { n.opacity.clamp(0.0, 1.0) } else { 1.0 }); + acc + }) + .collect(); + out.reverse(); + out + }; + let under = chain.iter().zip(drawn).find_map(|(a, alpha)| { + let n = doc.node(*a)?; match &n.kind { NodeKind::Page { background, .. } => Some(*background), - _ => n.fills.iter().rev().find(|p| p.visible && p.opacity >= 0.5).and_then(|p| match &p.kind { - figcraft_color::PaintKind::Solid { color } => Some(*color), + _ => n.fills.iter().rev().find(|p| p.visible).and_then(|p| match &p.kind { + figcraft_color::PaintKind::Solid { color } if p.opacity * alpha >= 0.5 => Some(*color), _ => None, }), } @@ -898,6 +915,9 @@ mod caret_tests { assert_eq!(caret_fallback(s.doc().unwrap(), id), Color32::WHITE, "inside a dark frame on the light page"); ex(&mut s, "node.set", serde_json::json!({"id": f, "props": {"fill": "#F0F0F0"}})); assert_eq!(caret_fallback(s.doc().unwrap(), id), Color32::BLACK, "inside a light frame"); + // A dark frame drawn at 20% opacity shows the light page through it. + ex(&mut s, "node.set", serde_json::json!({"id": f, "props": {"fill": "#222222", "opacity": 0.2}})); + assert_eq!(caret_fallback(s.doc().unwrap(), id), Color32::BLACK, "a faint dark frame on the light page"); } #[test] diff --git a/docs/ui-parity.md b/docs/ui-parity.md index a0c464382..6a1469d4d 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -95,7 +95,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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). 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); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | -| Text: point, auto height, fixed; caret, words, lines, IME | done | Backspace or Delete at the start of a list item takes its marker and keeps its level, the paragraph starting where the item's text did ("delete the counter, but keep the same level of indentation", Create bulleted and numbered lists; `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests`); max lines on auto-width text keep it auto width, hugging up to that many lines and growing with its longest line ("Text resizing is set to auto height or auto width", Explore text properties; `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines`); Alt+Enter while editing opens the link at the caret, web and mail links only (`text.openLink`; "press ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma; `text_link_tests`); the font picker previews a family on the canvas while hovered (no undo step; Escape restores, #653) and Up/Down step through it (#352); a selection highlight after a line break starts at that line's start and an empty last line shows its mark (#665); carets step over whole emoji and accented letters; colour emoji draw from their colour tables (#300); IME composition replayed in tests as macOS sends it, not yet checked on a Mac (#747); CJK words by script run (no dictionary); vertical trim in Type settings; the caret takes the text's solid fill colour, measured in Figma's web app, 2026-11-09; gradient and image fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest filled layer around the text, else the page), not the interface's text colour, which is white in the dark theme and vanished on the default light page (#2190) (#2156; `caret_tests`); no spell check | +| Text: point, auto height, fixed; caret, words, lines, IME | done | Backspace or Delete at the start of a list item takes its marker and keeps its level, the paragraph starting where the item's text did ("delete the counter, but keep the same level of indentation", Create bulleted and numbered lists; `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests`); max lines on auto-width text keep it auto width, hugging up to that many lines and growing with its longest line ("Text resizing is set to auto height or auto width", Explore text properties; `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines`); Alt+Enter while editing opens the link at the caret, web and mail links only (`text.openLink`; "press ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma; `text_link_tests`); the font picker previews a family on the canvas while hovered (no undo step; Escape restores, #653) and Up/Down step through it (#352); a selection highlight after a line break starts at that line's start and an empty last line shows its mark (#665); carets step over whole emoji and accented letters; colour emoji draw from their colour tables (#300); IME composition replayed in tests as macOS sends it, not yet checked on a Mac (#747); CJK words by script run (no dictionary); vertical trim in Type settings; the caret takes the text's solid fill colour, measured in Figma's web app, 2026-11-09; gradient and image fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour, which is white in the dark theme and vanished on the default light page (#2190) (#2156; `caret_tests`); no spell check | | Text: wrap style (Auto, Balance, Pretty) | done | per text layer (`wrapStyle` on `node.set`, `text.wrapStyle`, the Type settings control under Vertical trim, inspect, CSS `text-wrap: balance` or `pretty`): Auto breaks greedily; Balance narrows each paragraph as far as it goes without another line, so its lines come out close to the same length (what browsers do for `text-wrap: balance`); Pretty keeps lines full and, when the last line is one word, narrows one of the last four lines just enough to give a word to the lines after it (Explore text properties: "Auto: Figma fits as many words as possible on each line before wrapping to the next", "Balance: Figma distributes text as evenly as possible across every line, so each line is close to the same length", "Pretty: Figma keeps each line full, but adjusts the last four lines to avoid an orphan"). Saved line breaks from a file still win. Not yet included: per-paragraph settings, text-style support and the `.fig` import/export mapping (#1827). Test: `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented` | | Text: direction override (Text ▸ Text direction) | done | per paragraph (`ParaList::direction`: auto, ltr, rtl): Text ▸ Text direction ▸ Auto / Left to right / Right to left and `text.direction {direction, ids?}` set the edited paragraphs while editing, else every paragraph of the selected texts; `node.set textDirection` the layer's (or the chars `start`/`end` name); the Type settings control appears once a right-to-left script is in the text or a direction is forced; inspect reports `textDirection` when the paragraphs agree and `lineDirections` otherwise; Developer Mode's CSS writes `direction: ltr` or `rtl` when every paragraph is forced the same way (with `text-align: left` beside `rtl`, as Left is absolute on the canvas); `.fig` import and export carry each line's `sourceDirectionality`, read up to the paragraph count. Layout gives the paragraph its base level, so a forced right-to-left paragraph of Latin letters starts at the right, mirrors its list gutter and indent and orders its runs right to left, and a forced left-to-right paragraph of Hebrew the other way ("By default, Figma automatically handles text direction based on language detection. However, controls are available to override text direction per paragraph", "Go to Text > Text direction. Select Left to right or Right to left", Add right-to-left text). Not included: a direction in text styles (the article names none). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests` | | 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` | @@ -187,7 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| -| 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start); FigCraft draws it opaque (how Figma treats a translucent fill was not measured); gradient, image and hidden fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest filled layer around the text, else the page), not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | +| 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start); FigCraft draws it opaque (how Figma treats a translucent fill was not measured); gradient, image and hidden fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From e3701d85cce7c0809059345c883bf8fafe63e6e8 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 20:33:36 -0500 Subject: [PATCH 101/239] M3: the caret fallback counts a solid colour's own alpha too (#2163 review) Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 checked the finding and wrote --- crates/ui-egui/src/canvas/overlays.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/canvas/overlays.rs b/crates/ui-egui/src/canvas/overlays.rs index 81f8c0e90..3e15693f9 100644 --- a/crates/ui-egui/src/canvas/overlays.rs +++ b/crates/ui-egui/src/canvas/overlays.rs @@ -231,8 +231,8 @@ fn caret_color(ctx: &egui::Context, n: &figcraft_doc::Node, caret: usize) -> Opt /// The caret of a text without a solid fill (a gradient, an image, no visible fill): black on a /// light surface, white on a dark one. The surface is the nearest layer around the text whose -/// topmost visible fill is a solid at least half opaque as drawn (its paint's opacity times its -/// own and its containers' layer opacity), else the page; a layer whose top fill is a gradient or an +/// topmost visible fill is a solid at least half opaque as drawn (its colour's alpha times its paint's +/// opacity times its own and its containers' layer opacity), else the page; a layer whose top fill is a gradient or an /// image is passed over. Not the interface's text colour, which is white in the dark theme and /// vanishes on the default light page (#2190). fn caret_fallback(doc: &Document, id: NodeId) -> Color32 { @@ -256,7 +256,7 @@ fn caret_fallback(doc: &Document, id: NodeId) -> Color32 { match &n.kind { NodeKind::Page { background, .. } => Some(*background), _ => n.fills.iter().rev().find(|p| p.visible).and_then(|p| match &p.kind { - figcraft_color::PaintKind::Solid { color } if p.opacity * alpha >= 0.5 => Some(*color), + figcraft_color::PaintKind::Solid { color } if color.a * p.opacity * alpha >= 0.5 => Some(*color), _ => None, }), } @@ -918,6 +918,9 @@ mod caret_tests { // A dark frame drawn at 20% opacity shows the light page through it. ex(&mut s, "node.set", serde_json::json!({"id": f, "props": {"fill": "#222222", "opacity": 0.2}})); assert_eq!(caret_fallback(s.doc().unwrap(), id), Color32::BLACK, "a faint dark frame on the light page"); + // The same through the colour's own alpha. + ex(&mut s, "node.set", serde_json::json!({"id": f, "props": {"fill": "#22222233", "opacity": 1.0}})); + assert_eq!(caret_fallback(s.doc().unwrap(), id), Color32::BLACK, "a dark fill at 20% alpha"); } #[test] From 815cbf9fa1918bb274a5ada65372b2b5cead6ed2 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 01:49:05 -0500 Subject: [PATCH 102/239] Variables: variable.duplicate matches an exact id before a name Duplicate group copies each member by id; an earlier variable named like that id was copied instead. Review item on #2087. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote (review fix, no brief) --- crates/engine/src/cmd/variables.rs | 5 ++++- crates/engine/src/variables_editor_tests.rs | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/variables.rs b/crates/engine/src/cmd/variables.rs index 85e1454f3..d8c20e05a 100644 --- a/crates/engine/src/cmd/variables.rs +++ b/crates/engine/src/cmd/variables.rs @@ -184,7 +184,10 @@ fn duplicate(s: &mut Session, p: &Value) -> Result { let cmd = "variable.duplicate"; let v = req_string(cmd, p, "variable")?; let doc = s.doc_mut()?; - let pos = doc.variables.variables.iter().position(|x| x.id == v || x.name == v).ok_or_else(|| bad(cmd, "no such variable"))?; + // An exact id first, then a name: an earlier variable named like another's id must not be the + // one copied. + let vars = &doc.variables.variables; + let pos = vars.iter().position(|x| x.id == v).or_else(|| vars.iter().position(|x| x.name == v)).ok_or_else(|| bad(cmd, "no such variable"))?; let mut copy = doc.variables.variables.get(pos).cloned().ok_or_else(|| bad(cmd, "no such variable"))?; let taken = |n: &str| doc.variables.variables.iter().any(|x| x.collection == copy.collection && x.name == n); let name = (1..1000) diff --git a/crates/engine/src/variables_editor_tests.rs b/crates/engine/src/variables_editor_tests.rs index 806300c70..65cc04763 100644 --- a/crates/engine/src/variables_editor_tests.rs +++ b/crates/engine/src/variables_editor_tests.rs @@ -47,6 +47,18 @@ fn rename_describe_scope_and_duplicate() { assert_eq!(vars.get(&id).unwrap().scopes, brand.scopes); } +#[test] +fn duplicate_by_id_copies_that_variable_even_when_an_earlier_one_is_named_like_its_id() { + let mut s = Session::new(); + tokens(&mut s); + let brand = s.doc().unwrap().variables.get("brand").unwrap().id.clone(); + // The first variable in the list takes the later one's id as its name. + ex(&mut s, "variable.update", json!({"variable": "space/sm", "name": brand.clone()})); + let id = ex(&mut s, "variable.duplicate", json!({"variable": brand.clone()}))["id"].as_str().unwrap().to_string(); + let vars = &s.doc().unwrap().variables; + assert_eq!(vars.get(&id).unwrap().name, "brand copy"); +} + #[test] fn modes_and_collections_rename_and_delete() { let mut s = Session::new(); From da81d55a64460d9d83f2c9052badcf60e47bc6de Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 02:14:17 -0500 Subject: [PATCH 103/239] Transform: Shift-rotating inside a rotated frame lands the page rotation on multiples of 15 Measured in Figma: a layer's rotation field shows its rotation on the page, also inside a rotated frame or group, and Shift snaps that value. A test pins it; the doc comment on shared_rotation_degrees says so. Review item on #2096. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote; Sonnet 5.5 measured in Figma --- crates/engine/src/canvas/tools/handles.rs | 7 ++-- .../engine/src/transform_behaviour_tests.rs | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/canvas/tools/handles.rs b/crates/engine/src/canvas/tools/handles.rs index 75410ec75..ecd29e67a 100644 --- a/crates/engine/src/canvas/tools/handles.rs +++ b/crates/engine/src/canvas/tools/handles.rs @@ -132,9 +132,10 @@ pub fn selection_frame(doc: &Document, sel: &[NodeId]) -> Option<(Affine, f64, f Some((rot * Affine::translate((b.x0, b.y0)), b.width(), b.height())) } -/// The rotation the Design panel shows for `ids` (degrees, counter-clockwise positive) when they -/// all share one, else 0 (the handle box is page-aligned then). Axis-aligned layers give 0, which -/// is the same as 90, 180 and 270 for stepping in 15 degrees. +/// The rotation `ids` share on the page (degrees, counter-clockwise positive), else 0 (the handle +/// box is page-aligned then). Figma's rotation field shows this page rotation, also for a layer +/// inside a rotated frame or group, and Shift lands it on multiples of 15 degrees. Axis-aligned +/// layers give 0, which is the same as 90, 180 and 270 for stepping in 15 degrees. pub fn shared_rotation_degrees(doc: &Document, ids: &[NodeId]) -> f64 { shared_rotation(doc, ids).map_or(0.0, |a| -a.to_degrees()) } diff --git a/crates/engine/src/transform_behaviour_tests.rs b/crates/engine/src/transform_behaviour_tests.rs index 1ad84fff0..fe6709ee4 100644 --- a/crates/engine/src/transform_behaviour_tests.rs +++ b/crates/engine/src/transform_behaviour_tests.rs @@ -403,6 +403,39 @@ fn shift_rotating_lands_on_multiples_of_15_not_steps_from_the_start() { assert!(near(got, 0.0), "-2.27° rounds to 0°: {got}"); } +/// Rotates a 120 × 80 layer inside a frame turned `frame_rot`, the layer at `start` on the page, +/// by `turn` from its corner, and returns its rotation on the page. +fn rotate_drag_in_frame(frame_rot: f64, start: f64, turn: f64, m: Mods) -> f64 { + let mut s = session(); + let f = id(&ex(&mut s, "frame.create", json!({"x": 0, "y": 100, "width": 400, "height": 400}))); + set(&mut s, &[f], json!({"rotation": frame_rot})); + let r = rect(&mut s, 100.0, 100.0, 120.0, 80.0, Some(f)); + set(&mut s, &[r], json!({"rotation": start - frame_rot})); + let page = |s: &Session| rotation_degrees(s.doc().unwrap().world_transform(r)); + assert!(near(page(&s), start), "the layer starts at {start}° on the page: {}", page(&s)); + ex(&mut s, "select.set", json!({"ids": [r]})); + let world = s.doc().unwrap().world_transform(r); + let (c, corner) = (world * Point::new(60.0, 40.0), world * Point::ZERO); + let from = corner + (corner - c) * 0.15; + let a = (from - c).atan2() - turn.to_radians(); + let to = c + figcraft_geom::Vec2::from_angle(a) * 80.0; + drag(&mut s, from, to, m); + page(&s) +} + +#[test] +fn shift_rotating_inside_a_rotated_frame_lands_the_page_rotation_on_multiples_of_15() { + // Measured in Figma (2026-11-10): the rotation field of a layer inside a frame turned 10° shows + // its rotation on the page, and Shift lands that on multiples of 15°: from 7°, turns of 40°, + // 6° and -10° end at 45°, 15° and 0°; without Shift 6° ends at 13°. Groups behave the same. + for (turn, want) in [(40.0, 45.0), (6.0, 15.0), (-10.0, 0.0)] { + let got = rotate_drag_in_frame(10.0, 7.0, turn, SHIFT); + assert!(near(got, want), "7° on the page turned by {turn}° with Shift: {got}, want {want}"); + } + let got = rotate_drag_in_frame(10.0, 7.0, 6.0, NONE); + assert!(near(got, 13.0), "a free turn: {got}"); +} + #[test] fn groups_scale_children_keeping_their_rotation_and_flip() { let mut s = session(); From c82986b26c17d5b326d4ac0dd31b31f2ca58c0c3 Mon Sep 17 00:00:00 2001 From: Denis Gomes <6731020+denisg0mes@users.noreply.github.com> Date: Tue, 10 Nov 2026 02:18:22 -0500 Subject: [PATCH 104/239] M8: zoomed-out images draw from small copies that stay decoded The canvas drew an image shown smaller than its pixels from a 4096 or 8192 px copy, and an image of 4096 px or less from itself, whatever its size on screen. A page of a few hundred photos zoomed out then asks the decoded-image cache (512 MB) for several GB: every render decoded them again, and a zoom out took seconds with the canvas empty around the old frame. The copies now also come at 256, 512, 1024 and 2048 px, the smallest that holds the size shown. Measured on a file with 237 images (median 5.8 MP), canvas options, 2352 x 2090 view, M4 Max: | zoom | before | after, first | after, again | |---|---|---|---| | 10% | 0.25 s | 0.12 s | 6 ms | | 4% | 0.88 s | 0.46 s | 7 ms | | 1% | 3.4 s | 0.9 s | 4 ms | Peak memory over the run went from 3.9 GB to 2.3 GB. Exports and views at 100% and closer still draw from the image itself. Co-Authored-By: Claude Opus 5.5 --- crates/render/src/images.rs | 2 +- crates/render/src/large_image_tests.rs | 13 +++++++------ docs/hardware-parity.md | 5 +++-- docs/roadmap.md | 3 ++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/crates/render/src/images.rs b/crates/render/src/images.rs index 5eea7033d..46453d333 100644 --- a/crates/render/src/images.rs +++ b/crates/render/src/images.rs @@ -33,7 +33,7 @@ const MAX_CACHED_IMAGES: usize = 256; /// The largest sides of the copies the canvas draws larger images from while they show smaller /// (device pixels): two 16 000 × 10 000 images take 640 MB each in full, past the cache's budget /// together, and 42 MB each at 4096 (168 MB at 8192). -pub const DISPLAY_SIDES: [u32; 2] = [4096, 8192]; +pub const DISPLAY_SIDES: [u32; 6] = [256, 512, 1024, 2048, 4096, 8192]; /// Decoded pixmaps by image, filters and profile, holding at most a byte budget of pixels: adding /// one past the budget (or past [`MAX_CACHED_IMAGES`]) drops the least recently used first, so diff --git a/crates/render/src/large_image_tests.rs b/crates/render/src/large_image_tests.rs index be3de57f2..d4467b01f 100644 --- a/crates/render/src/large_image_tests.rs +++ b/crates/render/src/large_image_tests.rs @@ -8,7 +8,7 @@ use figcraft_color::{ImageScaleMode, Paint}; use figcraft_doc::{Document, ImageData, NodeId, NodeKind}; use tiny_skia::Pixmap; -use crate::images::{self, DISPLAY_SIDES, MAX_CACHED_BYTES}; +use crate::images::{self, MAX_CACHED_BYTES}; use crate::{Options, View, render_view}; const W: u32 = 6000; @@ -63,12 +63,11 @@ fn sharp_stripes(p: &Pixmap, y: u32, black_first: bool, each: u32) -> bool { #[test] fn zoomed_out_the_canvas_draws_both_images_from_copies_that_stay_decoded() { let (d, page, keys) = doc("zoomed-out"); - // At 25% each shows 1500 px long: drawn from 4096 px copies, not decoded in full. render_view(&d, page, &view(0.25), &canvas()).unwrap(); let first = keys.each_ref().map(|k| shown(&d, k, 1500.0)); for (k, p) in keys.iter().zip(&first) { - assert_eq!((p.width(), p.height()), (DISPLAY_SIDES[0], 5), "{k}"); - assert_eq!(images::cached_sides(k), vec![DISPLAY_SIDES[0]], "{k}: only its copy is decoded"); + assert_eq!((p.width(), p.height()), (2048, 3), "{k}"); + assert_eq!(images::cached_sides(k), vec![2048], "{k}: only its copy is decoded"); } // Drawn again (a drag, a pan), both are still the copies decoded the first time. render_view(&d, page, &view(0.25), &canvas()).unwrap(); @@ -93,13 +92,15 @@ fn exports_and_close_ups_draw_from_the_image_itself() { #[test] fn the_copy_is_the_smallest_that_holds_what_shows() { let side = |long, shown| images::display_side(long, shown); - assert_eq!(side(6000, 1500.0), 4096); + assert_eq!(side(6000, 1500.0), 2048); assert_eq!(side(16_000, 4096.0), 4096); assert_eq!(side(16_000, 4097.0), 8192); + assert_eq!(side(4096, 100.0), 256); + assert_eq!(side(3000, 20.0), 256); // Shown at more than the largest copy, or an image no larger than the copy: the image itself. assert_eq!(side(16_000, 9000.0), 16_384); assert_eq!(side(6000, 5000.0), 16_384); - assert_eq!(side(4096, 100.0), 16_384); + assert_eq!(side(200, 100.0), 16_384); // An unknown size or a meaningless scale: the image itself. assert_eq!(side(0, 100.0), 16_384); assert_eq!(side(16_000, f64::NAN), 16_384); diff --git a/docs/hardware-parity.md b/docs/hardware-parity.md index 1d64bc411..fdc86d54d 100644 --- a/docs/hardware-parity.md +++ b/docs/hardware-parity.md @@ -1,6 +1,6 @@ # Hardware and platform parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** patch (under Wayland a minimised window answers control and MCP requests in about half a second instead of timing out after 60 s (#1906); images copied in other apps paste in the browser (#492); text reads only the fallback fonts it draws with; `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); a batch keeps one undo snapshot, not one per step (#1099); one depth cap bounds a whole render, pattern sources included, and render threads get 8 MiB stacks (#1082); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); macOS: the Quit menu and ⌘Q ask about unsaved changes (#857); egui/eframe 0.37 dependency migration; hidden-window screenshot deadlines; zoom previews; hidden windows answer control requests; macOS file opening, the Windows start-up message, Linux packaging; copy and paste in the browser; Windows QA pass; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; pen pressure for the Pencil and brushes on Windows and from browser styluses; macOS: quitting ends the process once everything is kept, avoiding the Touch Bar teardown crash (#781); Linux and BSD clipboard: images under Wayland, reads time out; minimised windows under Wayland; window controls on Wayland without server decorations; canvas textures on device pixels) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (zoomed-out images draw from small copies that stay decoded, so a page of photos zooms out without decoding them again; under Wayland a minimised window answers control and MCP requests in about half a second instead of timing out after 60 s (#1906); images copied in other apps paste in the browser (#492); text reads only the fallback fonts it draws with; `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); a batch keeps one undo snapshot, not one per step (#1099); one depth cap bounds a whole render, pattern sources included, and render threads get 8 MiB stacks (#1082); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); macOS: the Quit menu and ⌘Q ask about unsaved changes (#857); egui/eframe 0.37 dependency migration; hidden-window screenshot deadlines; zoom previews; hidden windows answer control requests; macOS file opening, the Windows start-up message, Linux packaging; copy and paste in the browser; Windows QA pass; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; pen pressure for the Pencil and brushes on Windows and from browser styluses; macOS: quitting ends the process once everything is kept, avoiding the Touch Bar teardown crash (#781); Linux and BSD clipboard: images under Wayland, reads time out; minimised windows under Wayland; window controls on Wayland without server decorations; canvas textures on device pixels) · **Target:** Figma Design (desktop app 126.10.7) How FigCraft uses hardware and which platforms it runs on, against Figma. Figma's desktop app is Electron with a GPU helper process; its canvas renders on the GPU (WebGL, with WebGPU rolling out @@ -12,7 +12,7 @@ since 2025). FigCraft renders the canvas on the CPU and presents it through wgpu | Feature | Figma | FigCraft (macOS / Windows / Linux / web) | Hours | |---|---|---|---| -| Canvas rendering | GPU | CPU (tiny-skia), banded across cores, retained (re-renders only what an edit or pan touches), levels of detail below 50% zoom, large images drawn from a copy no larger than they show (#1483); when renders from scratch are slow, a new zoom shows the whole view coarsely first, then refines it (#312); shown through wgpu (WebGPU or WebGL2 in the browser) | 30–60 for a GPU path | +| Canvas rendering | GPU | CPU (tiny-skia), banded across cores, retained (re-renders only what an edit or pan touches), levels of detail below 50% zoom, images drawn from a copy no larger than they show, down to 256 px (#1483); when renders from scratch are slow, a new zoom shows the whole view coarsely first, then refines it (#312); shown through wgpu (WebGPU or WebGL2 in the browser) | 30–60 for a GPU path | | Effects (blurs, glass, noise) | GPU | CPU | in the above | | HiDPI / Retina | yes | yes (all); a canvas image rendered at the screen's density is placed on whole device pixels, so fractional pans, zooms and display scales don't blur it (#359; geometry tests, the snapping not judged by eye) | — | | Wide-gamut display (Display P3) | yes, on capable displays | colours stored and exported in P3; the screen shows sRGB: eframe/egui-wgpu 0.37 configure an 8-bit sRGB surface with no colour space option, although wgpu 30 can present Display P3 or extended sRGB on Metal, DX12, Vulkan and WebGPU (see gaps #18). The colour picker warns about colours outside sRGB and View ▸ Soft-proof sRGB stripes them on the canvas | 2–5 | @@ -50,6 +50,7 @@ Nothing has been timed against Figma on the same document (needs `.fig` import). | Date | Change | Summary | |---|---|---| +| 2026-11-10 | minor | Zoomed-out images: the canvas's copies of an image shown smaller than its pixels now also come at 256, 512, 1024 and 2048 px, the smallest that holds what the screen shows, and images of 4096 px or less get them too (they were drawn from the image itself at any size). On a page of 237 photos, about 4.6 GB decoded against the 512 MB cache, every zoomed-out render decoded them again: 3.4 s a frame at 1% before, 0.9 s the first time and 4 ms after; peak memory 3.9 → 2.3 GB. Exports and views at 100% and closer still draw from the image itself. | | 2026-11-06 | patch | M8, #1906: under Wayland (seen on GNOME and KDE Plasma) a minimised FigCraft window still reports itself visible and the compositor stops asking it to draw, so every control or attached-MCP request waited for a frame and timed out after 60 s ("it was not applied"), though eframe kept running the app's logic. `control::background` now treats a window that drew no frame for `NOT_DRAWING_AFTER` (0.2 s) while a request waited for it as hidden: state-only requests are answered from the logic passes (0.54 s each, measured on GNOME Wayland; they took 13.7 s or timed out before), the wait starts again when the window draws, and screenshots and `ui.input` still wait for a frame. Test: `idle_tests::a_window_that_stopped_drawing_answers_from_its_logic_passes` | | 2026-10-31 | minor | M1, #492: Web row: the browser pastes images copied in other apps, read from the paste event under the same limits as the desktop. Numbers unchanged. | | 2026-10-30 | minor | M8: text reads only the fallback fonts it draws with. Each fallback family reads the face nearest a run's style, not all of them (Noto Sans CJK is seven files of 16–20 MB); families naming the faces of one file share its bytes; and the faces are worked out once per style until fonts change, not for every text laid out. First text laid out on a Linux machine with Noto Sans CJK, DejaVu Sans and Inter: 41 files (265 MiB, kept in memory) and 41 faces parsed → 3 files (20 MiB) and 4 faces; fallback lookups per text laid out ~45 µs → 0.2 µs. Tests: `fontdb_fallback_tests`. Numbers unchanged | diff --git a/docs/roadmap.md b/docs/roadmap.md index f2dd92966..07faecb55 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,6 +1,6 @@ # FigCraft roadmap: milestones and what's next -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** patch (the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); 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); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); 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; compact layer trees with fields and outline (M0.9, part of #996); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a panic in a grouped closure outside any command rolls the group back like a failed group: documents, selection, undo and redo, history limit and journal as before (#1085); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); M8: mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); M2: components can't contain their own instances, directly or through others; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); M0.9: optional batch continue-on-error with per-step outcomes (#1386); Alt pressed during a drag duplicates (#1385); variables in paint props (M3, #1000); finding layers without selecting them (M0.9, part of #996); the attached MCP server reads the app's replies with a 512 MiB bound (#1113); a failed batch keeps the undo steps it undid (#1410); Arabic draft catalog; Android Vector Drawable export; a selected unfilled shape drags over a filled layer below it (#1370); text truncation fills the last line, survives resizing, and auto height takes Max lines (#1375, #1376, #1377); M11 widget fields and property menus; M12 Boards: timer and voting; Installed weights of an embedded font family (#1246); `.sketch` import, best effort; Adobe Fonts found on macOS (#298); M12 Boards; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (zoomed-out images draw from small copies that stay decoded, so a page of photos zooms out without decoding them again; the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); 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); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); 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; compact layer trees with fields and outline (M0.9, part of #996); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a panic in a grouped closure outside any command rolls the group back like a failed group: documents, selection, undo and redo, history limit and journal as before (#1085); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); M8: mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); M2: components can't contain their own instances, directly or through others; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); M0.9: optional batch continue-on-error with per-step outcomes (#1386); Alt pressed during a drag duplicates (#1385); variables in paint props (M3, #1000); finding layers without selecting them (M0.9, part of #996); the attached MCP server reads the app's replies with a 512 MiB bound (#1113); a failed batch keeps the undo steps it undid (#1410); Arabic draft catalog; Android Vector Drawable export; a selected unfilled shape drags over a filled layer below it (#1370); text truncation fills the last line, survives resizing, and auto height takes Max lines (#1375, #1376, #1377); M11 widget fields and property menus; M12 Boards: timer and voting; Installed weights of an embedded font family (#1246); `.sketch` import, best effort; Adobe Fonts found on macOS (#298); M12 Boards; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) Forward-looking plan. Where FigCraft stands today: [`ROADMAP.md`](../ROADMAP.md) and [`target-app-parity.md`](target-app-parity.md); the full ranked list: [`gaps.md`](gaps.md). Hours @@ -76,6 +76,7 @@ blockers. | Date | Change | Summary | |---|---|---| +| 2026-11-10 | minor | Zoomed-out images: the canvas's copies of an image shown smaller than its pixels now also come at 256, 512, 1024 and 2048 px, the smallest that holds what the screen shows, and images of 4096 px or less get them too (they were drawn from the image itself at any size). On a page of 237 photos, about 4.6 GB decoded against the 512 MB cache, every zoomed-out render decoded them again: 3.4 s a frame at 1% before, 0.9 s the first time and 4 ms after; peak memory 3.9 → 2.3 GB. Exports and views at 100% and closer still draw from the image itself. | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`) draft catalog: 1,975 UI strings, 641 command labels and 31 menu wordings, clean-room from the English source; zh-TW, zh-HK, zh-MO and zh-Hant read it, explicit Hans stays Simplified; Noto Sans CJK TC then Taiwan system faces; no bundled font; native review pending. Numbers unchanged | | 2026-11-03 | patch | M4, #1747: a text layer still carrying the name its characters gave it is renamed as they are typed, so the Layers panel no longer shows the word a layer started with while the canvas shows another (`hello` typed into `hello there` read as `hello` in the panel). A name the author typed is kept, and only the editor follows the characters: commands leave the name alone, so the layer names `data.fill`, component property bindings and templates use as field keys stay put. Tests: `text_behaviour_tests::typing_renames_a_text_layer_that_still_carries_the_name_its_characters_gave_it`, `setting_characters_as_a_command_never_renames_the_layer`. Grade unchanged | | 2026-10-31 | minor | M12: as the help describes, holding Cmd/Ctrl while moving a connector's end places it on any part of an object instead of snapping to a side. It keeps that spot as a fraction of the object's box, so it follows the object when it moves or resizes, and without the key an end snaps as before. `board.connector {fromAt, toAt}` and `board.reattach {at}` take it; saved only when set. Numbers unchanged | From 6d128d3377d38022c6afabd0ff35d656d9741158 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 02:48:54 -0500 Subject: [PATCH 105/239] Cursors: the crosshair is drawn dark with a white edge, so it shows on a white frame (#2198) Cursor::Crosshair was the system's crosshair, whose colour follows the pointer style and was white on Windows, lost on the default white frame. It is now Glyph::Crosshair, painted from lines like the pen: a plus with 2 px open at the centre, a 3 px white edge under 1 px dark lines. Prototype connections still set the system crosshair directly. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/ui-egui/src/canvas/cursors.rs | 28 +++++++++++++--- crates/ui-egui/src/cursors_tests.rs | 48 +++++++++++++++++++++++++--- docs/ui-parity.md | 5 +-- 3 files changed, 70 insertions(+), 11 deletions(-) diff --git a/crates/ui-egui/src/canvas/cursors.rs b/crates/ui-egui/src/canvas/cursors.rs index dec2a1b31..d518dde37 100644 --- a/crates/ui-egui/src/canvas/cursors.rs +++ b/crates/ui-egui/src/canvas/cursors.rs @@ -1,7 +1,7 @@ //! The pointer on the canvas: each engine cursor ([`figcraft_engine::tools::Cursor`]) as one of //! the system's cursors, or as a small glyph FigCraft draws at the pointer with the system's //! hidden (a rotate cursor turned to its corner, the pen's states, the eyedropper, the comment -//! pin). The glyphs are original, drawn from lines and the code-drawn icons: no cursor images. +//! pin, the crosshair of the shape and Text tools). The glyphs are original, drawn from lines and the code-drawn icons: no cursor images. use egui::{Color32, CursorIcon, Painter, Pos2, Shape, Stroke, pos2, vec2}; use figcraft_engine::tools::{Cursor, PenCursor}; @@ -17,6 +17,9 @@ pub enum Glyph { Pen(PenCursor), Eyedropper, Comment, + /// A plus open at the centre, for the shape and Text tools (the system's follows the + /// system's pointer colour, and a white one is lost on a white frame). + Crosshair, } /// What the pointer shows. @@ -46,7 +49,7 @@ pub fn of(cursor: Cursor) -> Shown { use Shown::{Drawn, System}; match cursor { Cursor::Default => System(CursorIcon::Default), - Cursor::Crosshair => System(CursorIcon::Crosshair), + Cursor::Crosshair => Drawn(Glyph::Crosshair), Cursor::Move => System(CursorIcon::Move), Cursor::Resize(a) if a.is_finite() => System(resize_icon(a)), Cursor::Resize(_) => System(CursorIcon::Default), @@ -85,7 +88,7 @@ impl Shown { /// A name for it (`ui.inspect`): the CSS cursor names where there is one ("default", /// "nwse-resize", "copy"), and "rotate" (with its angle), "pen", "pen-close", "pen-add", - /// "pen-bend", "eyedropper" and "comment" for the drawn ones. + /// "pen-bend", "eyedropper", "comment" and "crosshair" for the drawn ones. pub fn name(self) -> String { match self { Shown::System(i) => match i { @@ -114,6 +117,7 @@ impl Shown { Shown::Drawn(Glyph::Pen(PenCursor::Bend)) => "pen-bend".into(), Shown::Drawn(Glyph::Eyedropper) => "eyedropper".into(), Shown::Drawn(Glyph::Comment) => "comment".into(), + Shown::Drawn(Glyph::Crosshair) => "crosshair".into(), } } @@ -127,7 +131,7 @@ impl Shown { } /// Dark lines over a light edge: readable on any page and artwork. -const INK: Color32 = Color32::from_rgb(0x1E, 0x1E, 0x1E); +pub(crate) const INK: Color32 = Color32::from_rgb(0x1E, 0x1E, 0x1E); const EDGE: Color32 = Color32::WHITE; /// A line through `pts` with the light edge under it. @@ -167,6 +171,22 @@ pub fn paint(painter: &Painter, at: Pos2, glyph: Glyph) { line(painter, &[tip - t * 4.5 + n * 3.5, tip + t * 1.0, tip - t * 4.5 - n * 3.5]); } } + Glyph::Crosshair => { + // A plus centred on the pointer, open at the centre so its pixel stays visible; the + // light edge goes under both arms of each line first, then the dark line on top. + let arms = [ + (vec2(-8.0, 0.0), vec2(-2.0, 0.0)), + (vec2(2.0, 0.0), vec2(8.0, 0.0)), + (vec2(0.0, -8.0), vec2(0.0, -2.0)), + (vec2(0.0, 2.0), vec2(0.0, 8.0)), + ]; + for (a, b) in arms { + painter.add(Shape::line_segment([at + a, at + b], Stroke::new(3.0, EDGE))); + } + for (a, b) in arms { + painter.add(Shape::line_segment([at + a, at + b], Stroke::new(1.0, INK))); + } + } Glyph::Pen(state) => { // A cross open at the centre (the point it lands on stays visible), and what a click // does at its lower right. diff --git a/crates/ui-egui/src/cursors_tests.rs b/crates/ui-egui/src/cursors_tests.rs index 94109dc22..bb24a2469 100644 --- a/crates/ui-egui/src/cursors_tests.rs +++ b/crates/ui-egui/src/cursors_tests.rs @@ -22,7 +22,7 @@ fn every_engine_cursor_has_a_system_cursor_or_a_glyph() { // (engine cursor, what shows, its name in `ui.inspect`) let rows: Vec<(Cursor, Shown, &str)> = vec![ (Cursor::Default, System(CursorIcon::Default), "default"), - (Cursor::Crosshair, System(CursorIcon::Crosshair), "crosshair"), + (Cursor::Crosshair, Drawn(Glyph::Crosshair), "crosshair"), (Cursor::Move, System(CursorIcon::Move), "move"), (Cursor::Resize(0.0), System(CursorIcon::ResizeHorizontal), "ew-resize"), (Cursor::Resize(90.0), System(CursorIcon::ResizeVertical), "ns-resize"), @@ -59,6 +59,44 @@ fn every_engine_cursor_has_a_system_cursor_or_a_glyph() { assert_eq!(of(Cursor::Rotate(f64::INFINITY)), Drawn(Glyph::Rotate(0.0))); } +#[test] +fn the_crosshair_is_drawn_dark_with_a_white_edge_so_it_shows_on_white() { + use egui::epaint::Shape; + let shown = of(Cursor::Crosshair); + assert_eq!(shown, Shown::Drawn(Glyph::Crosshair)); + // The system's pointer is hidden under it, whatever its colour. + assert_eq!(shown.icon(), CursorIcon::None); + let at = pos2(50.0, 40.0); + let ctx = egui::Context::default(); + let mut out = ctx.run_ui(egui::RawInput::default(), |ui| { + let ctx = ui.ctx().clone(); + let layer = egui::LayerId::new(egui::Order::Tooltip, egui::Id::unique("crosshair_test")); + crate::cursors::paint(&ctx.layer_painter(layer), at, Glyph::Crosshair); + }); + out.textures_delta.clear(); + let mut strokes = Vec::new(); + for clipped in &out.shapes { + if let Shape::LineSegment { points, stroke } = &clipped.shape { + strokes.push((points.to_vec(), stroke.color, stroke.width)); + } + } + let dark: Vec<_> = strokes.iter().filter(|s| s.1 == crate::cursors::INK).collect(); + let white: Vec<_> = strokes.iter().filter(|s| s.1 == egui::Color32::WHITE).collect(); + assert!(!dark.is_empty() && !white.is_empty(), "{strokes:?}"); + // The white edge is wider than the dark line and is painted first. + assert!(white.iter().all(|w| w.2 > dark[0].2), "{strokes:?}"); + assert_eq!(strokes[0].1, egui::Color32::WHITE); + // The arms are centred on the pointer and leave its pixel clear. + for (pts, ..) in &dark { + for p in pts { + let d = (p.x - at.x).abs().max((p.y - at.y).abs()); + assert!((2.0..=8.0).contains(&d), "{p:?}"); + assert!((p.x - at.x).abs() < 0.01 || (p.y - at.y).abs() < 0.01, "{p:?}"); + } + } + assert_eq!(dark.len(), 4); +} + #[test] fn resize_arrows_follow_the_angle_in_eighths() { // (degrees, the two-headed arrow): each covers 45° about its own direction, any turn. @@ -134,10 +172,10 @@ fn the_window_asks_for_the_cursor_of_the_tool_under_the_pointer() { ("move", edge, &[], no, CursorIcon::ResizeHorizontal, "ew-resize"), ("move", on, &[], alt, CursorIcon::Copy, "copy"), ("hand", empty, &[], no, CursorIcon::Grab, "grab"), - ("rectangle", empty, &[], no, CursorIcon::Crosshair, "crosshair"), - ("frame", on, &[], no, CursorIcon::Crosshair, "crosshair"), - ("slice", empty, &[], no, CursorIcon::Crosshair, "crosshair"), - ("text", empty, &[], no, CursorIcon::Crosshair, "crosshair"), + ("rectangle", empty, &[], no, CursorIcon::None, "crosshair"), + ("frame", on, &[], no, CursorIcon::None, "crosshair"), + ("slice", empty, &[], no, CursorIcon::None, "crosshair"), + ("text", empty, &[], no, CursorIcon::None, "crosshair"), ("pen", empty, &[], no, CursorIcon::None, "pen"), ("comment", empty, &[], no, CursorIcon::None, "comment"), ("move", empty, &[Key::Space], no, CursorIcon::Grab, "grab"), diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..b7ef27d8e 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -122,7 +122,7 @@ interaction feel not yet compared. | Gamut warnings for Display P3 files | done | colour picker note; View ▸ Soft-proof sRGB stripes what sRGB can't show (the canvas itself is sRGB) | | Gradient and padding/gap handles on the canvas | done | the gradient's handles and stops show while its picker is open, and dragging one keeps the picker open (#1852) | | Hover outline, selection colours, handle sizes | done | measured from UI3 screenshots; the outline follows the layer's geometry, rounded corners (each radius and the smoothing) included, whatever the stroke alignment (#1506) | -| Cursors per tool and modifier | done | the engine names a cursor for every tool, modifier and hover target (`tool.overlay.cursor`, tabled in `cursor_tests`) and the UI shows the system's or draws its own at the pointer (`cursors.rs`, `cursors_tests`; original glyphs from lines and the code-drawn icons). Arrow for Move and Scale; two-headed arrows on the handles that follow the handle and the box's rotation; outside a corner a curved rotate arrow turned to that corner, turning with the pointer while rotating; crosshair for the frame, section, slice, shape, pencil and Text tools; the I-beam over a text with the Text tool and over the text being edited; the pen as a cross with what a click does beside it (nothing: a new point; a ring: closes, connects to or goes on from a point; a plus: adds a point on a segment, also Alt in vector edit mode; a curve: bends, the Bend tool or Cmd/Ctrl); open and closed hand for the Hand tool, Space and the middle button; zoom in and out (Alt) while Z is held; eyedropper; comment pin; the copy cursor with Alt over a selected layer and while Alt-dragging; not-allowed while a drag resizes, rotates or moves a layer inside an instance (it is undone on release) and over a layers row that takes no drop. Ruler guides and gradient, crop and padding handles keep their own cursors (the tool's used to replace them). `ui.inspect` reports `cursor`. Left: no cursor for removing a point with the pen (the pen doesn't remove points); the drawn cursors follow the pointer a frame behind the system's; not compared with Figma's side by side | +| Cursors per tool and modifier | done | the engine names a cursor for every tool, modifier and hover target (`tool.overlay.cursor`, tabled in `cursor_tests`) and the UI shows the system's or draws its own at the pointer (`cursors.rs`, `cursors_tests`; original glyphs from lines and the code-drawn icons). Arrow for Move and Scale; two-headed arrows on the handles that follow the handle and the box's rotation; outside a corner a curved rotate arrow turned to that corner, turning with the pointer while rotating; crosshair for the frame, section, slice, shape, pencil and Text tools, drawn dark with a white edge so it shows on any canvas colour whatever the system's pointer style (#2198); the I-beam over a text with the Text tool and over the text being edited; the pen as a cross with what a click does beside it (nothing: a new point; a ring: closes, connects to or goes on from a point; a plus: adds a point on a segment, also Alt in vector edit mode; a curve: bends, the Bend tool or Cmd/Ctrl); open and closed hand for the Hand tool, Space and the middle button; zoom in and out (Alt) while Z is held; eyedropper; comment pin; the copy cursor with Alt over a selected layer and while Alt-dragging; not-allowed while a drag resizes, rotates or moves a layer inside an instance (it is undone on release) and over a layers row that takes no drop. Ruler guides and gradient, crop and padding handles keep their own cursors (the tool's used to replace them). `ui.inspect` reports `cursor`. Left: no cursor for removing a point with the pen (the pen doesn't remove points); the drawn cursors follow the pointer a frame behind the system's; not compared with Figma's side by side | | Multiplayer cursors, cursor chat, spotlight | partial | in live sessions: named cursors, chat bubbles that fade, `/` to chat, spotlight from your avatar's menu with a banner; no audio or reactions | ## Keyboard shortcuts @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-10 | patch | M1, #2198: with a shape, frame, slice or Text tool the pointer was the system's crosshair, white under some pointer styles on Windows and lost on the default white frame; it is now drawn at the pointer in dark lines with a white edge, open at the centre (`Glyph::Crosshair`), so it shows on any canvas colour. | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From d0379dc70d571ec57af259336131adab4b659ad7 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 03:02:09 -0500 Subject: [PATCH 106/239] M8: Rotation field shows and sets the rotation on the page (node.set absoluteRotation) The Design panel's Rotation field now reads and writes the layer's rotation on the page (its own angle plus its parents'), as measured in Figma's web app, 2026-11-10. A new additive node.set key, absoluteRotation, does the work (one call for every selected layer, so one undo step and the moved rotation origin still apply); rotation stays the angle to the parent for scripts, inspect, codegen and the formats. Closes #2196. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/cmd/edit/props.rs | 8 +++- crates/engine/src/cmd/props.rs | 25 ++++++++++- crates/engine/src/rotation_origin_tests.rs | 11 +++++ .../engine/src/transform_behaviour_tests.rs | 42 ++++++++++++++++++ crates/mcp/src/tools.rs | 2 +- crates/ui-egui/src/field_tests.rs | 44 +++++++++++++++++++ crates/ui-egui/src/panels/right.rs | 13 +++--- docs/control-protocol.md | 1 + docs/mcp.md | 1 + docs/ui-parity.md | 5 ++- 10 files changed, 139 insertions(+), 13 deletions(-) diff --git a/crates/engine/src/cmd/edit/props.rs b/crates/engine/src/cmd/edit/props.rs index fb8a1c17f..819632a82 100644 --- a/crates/engine/src/cmd/edit/props.rs +++ b/crates/engine/src/cmd/edit/props.rs @@ -113,8 +113,12 @@ pub(super) fn set(s: &mut Session, p: &Value) -> Result { // A new rotation for the selection turns it about its moved rotation origin: each layer's // point under the origin stays put. let ds = s.ds()?; - let pivot = - ds.moved_origin().filter(|_| props.contains_key("rotation") && !props.contains_key("x") && !props.contains_key("y") && ds.selection == ids); + let pivot = ds.moved_origin().filter(|_| { + (props.contains_key("rotation") || props.contains_key("absoluteRotation")) + && !props.contains_key("x") + && !props.contains_key("y") + && ds.selection == ids + }); let pinned: Vec<(NodeId, figcraft_geom::Point)> = match pivot { Some(o) => roots(&ds.doc, &ids) .into_iter() diff --git a/crates/engine/src/cmd/props.rs b/crates/engine/src/cmd/props.rs index 2e5da37bd..4ff4b9bb1 100644 --- a/crates/engine/src/cmd/props.rs +++ b/crates/engine/src/cmd/props.rs @@ -16,7 +16,7 @@ use crate::{Result, bad}; pub const STROKE_SIDES: [&str; 4] = ["strokeTopWeight", "strokeRightWeight", "strokeBottomWeight", "strokeLeftWeight"]; /// Keys `node.set` understands (documented for agents). -pub const KEYS: &str = "name, visible, locked, opacity (0-1 or \"50%\"), blend, x, y (relative to the parent frame; groups don't count), width, height, rotation (degrees), \ +pub const KEYS: &str = "name, visible, locked, opacity (0-1 or \"50%\"), blend, x, y (relative to the parent frame; groups don't count), width, height, rotation (degrees), absoluteRotation (degrees on the page: the layer's angle plus its parents', what the Design panel's field shows; one of the two per call), \ fills (paints or colours; gradients as {type: linearGradient|radialGradient|angularGradient|diamondGradient, stops: [\"#hex\", ...], from?, to?} too), fill (colour, {$var: variable id or name}, or \"none\"/null: no fill), strokes, stroke (colour, {$var: variable id or name}, or \"none\"/null: no stroke), strokeWeight, strokeAlign (inside|center|outside), strokeSides [t,r,b,l], strokeTopWeight / strokeRightWeight / strokeBottomWeight / strokeLeftWeight (one side; turns on individual strokes), \ strokeCap / startCap / endCap, strokeJoin, miterAngle (degrees: sharper joins bevel; or miterLimit as a ratio), dashes [..], dashCap (none|round|square; null: dashes take startCap and endCap), widthProfile (preset uniform|wedge|taper|eye|rounded|pinch, [[t, scale], ...] or null), brush (preset id, {preset, spacing, sizeJitter, rotationJitter, scatter, seed} or null), cornerRadius (n or [tl,tr,br,bl]), cornerSmoothing (0-1), effects, \ clip, isMask, layout (null|horizontal|vertical|grid|{...}), gap, crossGap, padding (n or [t,r,b,l]), paddingTop/Right/Bottom/Left, \ @@ -456,7 +456,7 @@ fn apply_order(k: &str, v: &Value) -> u8 { match k { "path" | "width" | "height" | "w" | "h" => 0, "layout" | "layoutMode" => 1, - "rotation" => 3, + "rotation" | "absoluteRotation" => 3, "x" | "y" => 4, "fillStyle" | "strokeStyle" | "effectStyle" | "textStyle" | "gridStyle" => 5, "boundVariables" => 6, @@ -595,6 +595,27 @@ fn apply_geometry( let n = doc.get_mut(id)?; n.transform = figcraft_geom::set_rotation_about_center(n.transform, n.width, n.height, deg); } + "absoluteRotation" => { + let deg = f64_of(v).ok_or_else(|| bad(cmd, "`absoluteRotation` must be degrees"))?; + if props.contains_key("rotation") { + return Err(bad(cmd, "give one of `rotation` and `absoluteRotation`")); + } + let (w, h) = { + let n = doc.get(id)?; + (n.width, n.height) + }; + let world = figcraft_geom::set_rotation_about_center(doc.world_transform(id), w, h, deg); + let parent = doc.get(id)?.parent; + let pw = parent.map(|p| doc.world_transform(p)).unwrap_or(figcraft_geom::Affine::IDENTITY); + let local = pw.inverse() * world; + if local.as_coeffs().iter().all(|c| c.is_finite()) { + doc.get_mut(id)?.transform = local; + } else { + // A degenerate parent can't be inverted: turn the local angle instead. + let n = doc.get_mut(id)?; + n.transform = figcraft_geom::set_rotation_about_center(n.transform, n.width, n.height, deg); + } + } _ => return Ok(false), } Ok(true) diff --git a/crates/engine/src/rotation_origin_tests.rs b/crates/engine/src/rotation_origin_tests.rs index 38878a0f0..181559a05 100644 --- a/crates/engine/src/rotation_origin_tests.rs +++ b/crates/engine/src/rotation_origin_tests.rs @@ -90,6 +90,17 @@ fn rotation_field_and_rotate_commands_turn_about_a_moved_origin() { assert!(s.execute("transform.setRotationOrigin", &json!({"x": 1})).is_err(), "x without y"); } +#[test] +fn the_absolute_rotation_key_turns_about_a_moved_origin_too() { + let mut s = Session::new(); + let r = rect(&mut s); + s.execute("transform.setRotationOrigin", &json!({"x": 100, "y": 100})).unwrap(); + s.execute("node.set", &json!({"ids": [r], "props": {"absoluteRotation": 30}})).unwrap(); + let doc = s.doc().unwrap(); + assert!(near(doc.world_transform(r) * Point::new(100.0, 100.0), Point::new(100.0, 100.0))); + assert!((figcraft_geom::rotation_degrees(doc.world_transform(r)) - 30.0).abs() < 1e-6); +} + #[test] fn origin_lasts_as_long_as_its_selection() { let mut s = Session::new(); diff --git a/crates/engine/src/transform_behaviour_tests.rs b/crates/engine/src/transform_behaviour_tests.rs index e22eb0418..96b753d6d 100644 --- a/crates/engine/src/transform_behaviour_tests.rs +++ b/crates/engine/src/transform_behaviour_tests.rs @@ -466,6 +466,48 @@ fn design_panel_edits_reach_every_selected_layer() { assert!(near(rotation(&s, a), 30.0) && flipped(&s, a), "{}", rotation(&s, a)); } +#[test] +fn absolute_rotation_sets_the_rotation_on_the_page_keeping_the_centre() { + let mut s = session(); + let page = |s: &Session, i: NodeId| rotation_degrees(s.doc().unwrap().world_transform(i)); + let f = id(&ex(&mut s, "frame.create", json!({"x": 0, "y": 100, "width": 400, "height": 400}))); + set(&mut s, &[f], json!({"rotation": 10})); + let r = rect(&mut s, 100.0, 100.0, 120.0, 80.0, Some(f)); + assert!(near(page(&s, r), 10.0) && near(rotation(&s, r), 0.0)); + let centre = s.doc().unwrap().world_transform(r) * Point::new(60.0, 40.0); + set(&mut s, &[r], json!({"absoluteRotation": 7})); + assert!(near(page(&s, r), 7.0), "{}", page(&s, r)); + assert!(near(rotation(&s, r), -3.0), "{}", rotation(&s, r)); + let c = s.doc().unwrap().world_transform(r) * Point::new(60.0, 40.0); + assert!((c - centre).hypot() < 1e-6, "the centre stays put"); + set(&mut s, &[r], json!({"absoluteRotation": 0})); + assert!(near(page(&s, r), 0.0) && near(rotation(&s, r), -10.0)); + // `node.get` still reports the local angle. + let got = ex(&mut s, "node.get", json!({"id": r})); + let rot = got["rotation"].as_f64().unwrap_or(f64::NAN); + assert!(near(rot, -10.0), "{got}"); + // Groups: a child reads and sets the page angle, its sibling keeps its own. + let a = rect(&mut s, 0.0, 600.0, 50.0, 50.0, None); + let b = rect(&mut s, 100.0, 600.0, 50.0, 50.0, None); + let g = id(&ex(&mut s, "object.group", json!({"ids": [a, b]}))); + set(&mut s, &[g], json!({"rotation": 10})); + assert!(near(page(&s, a), 10.0)); + set(&mut s, &[a], json!({"absoluteRotation": 7})); + assert!(near(page(&s, a), 7.0) && near(page(&s, b), 10.0)); + // Several layers: one value on the page for all, one undo step. + let top = rect(&mut s, 800.0, 0.0, 50.0, 50.0, None); + let steps = undo_steps(&s); + set(&mut s, &[r, top], json!({"absoluteRotation": 45})); + assert!(near(page(&s, r), 45.0) && near(page(&s, top), 45.0)); + assert_eq!(undo_steps(&s), steps + 1); + // A flip is kept. + ex(&mut s, "object.flipH", json!({"ids": [r]})); + set(&mut s, &[r], json!({"absoluteRotation": 30})); + assert!(near(page(&s, r), 30.0) && flipped(&s, r), "{}", page(&s, r)); + // One of the two keys per call. + assert!(s.execute("node.set", &json!({"ids": [r], "props": {"rotation": 1, "absoluteRotation": 2}})).is_err()); +} + #[test] fn constrain_proportions_keeps_the_other_side_in_ratio() { let mut s = session(); diff --git a/crates/mcp/src/tools.rs b/crates/mcp/src/tools.rs index 9e901f5bb..4b4cc7e1d 100644 --- a/crates/mcp/src/tools.rs +++ b/crates/mcp/src/tools.rs @@ -208,7 +208,7 @@ fn tools() -> Vec { tool( "set_properties", "Set properties", - "Set properties on one or more layers as one undo step (engine `node.set`). Keys: name, visible, locked, opacity (0-1), blend, x, y (relative to the parent frame; groups don't count), width, height, rotation (degrees), fill (colour) / fills (array of paints: \"#hex\" or {\"type\":\"solid\",\"color\":\"#hex\"} or {\"type\":\"linearGradient\",\"stops\":[\"#hex\",\"#hex\"]} or stops [{\"position\":0..1,\"color\":\"#hex\"}], optional from/to handles in the unit box; radialGradient too), stroke / strokes, strokeWeight, strokeAlign (inside|center|outside), cornerRadius (n or [tl,tr,br,bl]), effects (array, e.g. {\"type\":\"dropShadow\",\"color\":\"#00000040\",\"offset\":[0,4],\"radius\":8}), clip, layout (null|horizontal|vertical|grid), gap, padding (n or [t,r,b,l]), mainAlign (min|center|max|spaceBetween|spaceAround|spaceEvenly), crossAlign, wrap, contentAlign (auto|spaceBetween: wrapped lines), sizingH / sizingV (fixed|hug|fill), constraints {horizontal, vertical}, characters, fontFamily, fontStyle, fontSize, lineHeight, letterSpacing, textAlign, textAutoResize. Auto layout keys (gap, padding, mainAlign, crossAlign, wrap, …) apply to frames, components and instances only: other layers among the ids are skipped and named in `warnings`, and with none that can take them the call is an error. A fontStyle draws in the family's nearest face; `warnings` says when that face has another weight or slant than the name asks for. Run list_commands with filter \"node.set\" for the full list. Unknown keys are an error. Returns the updated layers.", + "Set properties on one or more layers as one undo step (engine `node.set`). Keys: name, visible, locked, opacity (0-1), blend, x, y (relative to the parent frame; groups don't count), width, height, rotation (degrees), absoluteRotation (degrees on the page), fill (colour) / fills (array of paints: \"#hex\" or {\"type\":\"solid\",\"color\":\"#hex\"} or {\"type\":\"linearGradient\",\"stops\":[\"#hex\",\"#hex\"]} or stops [{\"position\":0..1,\"color\":\"#hex\"}], optional from/to handles in the unit box; radialGradient too), stroke / strokes, strokeWeight, strokeAlign (inside|center|outside), cornerRadius (n or [tl,tr,br,bl]), effects (array, e.g. {\"type\":\"dropShadow\",\"color\":\"#00000040\",\"offset\":[0,4],\"radius\":8}), clip, layout (null|horizontal|vertical|grid), gap, padding (n or [t,r,b,l]), mainAlign (min|center|max|spaceBetween|spaceAround|spaceEvenly), crossAlign, wrap, contentAlign (auto|spaceBetween: wrapped lines), sizingH / sizingV (fixed|hug|fill), constraints {horizontal, vertical}, characters, fontFamily, fontStyle, fontSize, lineHeight, letterSpacing, textAlign, textAutoResize. Auto layout keys (gap, padding, mainAlign, crossAlign, wrap, …) apply to frames, components and instances only: other layers among the ids are skipped and named in `warnings`, and with none that can take them the call is an error. A fontStyle draws in the family's nearest face; `warnings` says when that face has another weight or slant than the name asks for. Run list_commands with filter \"node.set\" for the full list. Unknown keys are an error. Returns the updated layers.", obj( json!({"ids": ids_schema("Layer ids (default: the selection)"), "props": {"type": "object", "description": "Property values to set"}}), &["props"], diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index e3bdad1dd..23570a1fe 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -441,6 +441,50 @@ fn the_arrow_keys_step_by_the_nudge_amounts_and_fractional_fields_by_their_own() assert!((rot.abs() - 11.0).abs() < 1e-6, "rotation {rot}: the steps stay after Escape"); } +#[test] +fn the_rotation_field_shows_and_sets_the_rotation_on_the_page() { + let mut s = Session::new(); + let f = id(s.execute("frame.create", &json!({"x": 0, "y": 100, "width": 400, "height": 400})).unwrap()); + s.execute("node.set", &json!({"ids": [f], "props": {"rotation": 10}})).unwrap(); + let r = id(s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 120, "height": 80, "parent": f})).unwrap()); + s.execute("node.set", &json!({"ids": [r], "props": {"rotation": -10}})).unwrap(); + let b = id(s.execute("shape.rectangle", &json!({"x": 600, "y": 0, "width": 50, "height": 50})).unwrap()); + s.execute("select.set", &json!({"ids": [r]})).unwrap(); + let mut u = Ui::new(s); + u.ctx.enable_accesskit(); + u.frame(vec![]); + let page = |u: &Ui, n: NodeId| figcraft_geom::rotation_degrees(u.app.session.doc().unwrap().world_transform(n)); + let local = |u: &Ui, n: NodeId| figcraft_geom::rotation_degrees(u.app.session.doc().unwrap().node(n).unwrap().transform); + assert_eq!(field(&mut u, "Rotation").1, "0°"); + type_into(&mut u, "Rotation", "7", Key::Enter); + assert!((page(&u, r) - 7.0).abs() < 1e-6 && (local(&u, r) + 3.0).abs() < 1e-6, "{} {}", page(&u, r), local(&u, r)); + assert_eq!(field(&mut u, "Rotation").1, "7°"); + // Arrows step the shown value. + let shift = Modifiers { shift: true, ..Modifiers::NONE }; + let (p, _) = field(&mut u, "Rotation"); + click(&mut u, p); + key(&mut u, Key::ArrowUp, Modifiers::NONE); + key(&mut u, Key::ArrowUp, shift); + key(&mut u, Key::Escape, Modifiers::NONE); + assert!((page(&u, r) - 18.0).abs() < 1e-6, "{}", page(&u, r)); + assert_eq!(field(&mut u, "Rotation").1, "18°"); + // Scrubbing is one undo step. + let steps = undo_steps(&u); + scrub(&mut u, "Rotation", 15.0, Modifiers::NONE); + assert!((page(&u, r) - 33.0).abs() < 1e-6, "{}", page(&u, r)); + assert_eq!(undo_steps(&u), steps + 1); + // Mixed: layers in differently turned parents agree when their page angles do. + u.app.session.execute("node.set", &json!({"ids": [b], "props": {"rotation": 33}})).unwrap(); + u.app.session.execute("select.set", &json!({"ids": [r, b]})).unwrap(); + assert_eq!(field(&mut u, "Rotation").1, "33°"); + u.app.session.execute("node.set", &json!({"ids": [b], "props": {"rotation": 20}})).unwrap(); + assert_eq!(field(&mut u, "Rotation").1, "Mixed"); + let steps = undo_steps(&u); + type_into(&mut u, "Rotation", "+10", Key::Enter); + assert!((page(&u, r) - 43.0).abs() < 1e-6 && (page(&u, b) - 30.0).abs() < 1e-6, "{} {}", page(&u, r), page(&u, b)); + assert_eq!(undo_steps(&u), steps + 1); +} + #[test] fn arithmetic_commits_tab_moves_on_and_escape_restores() { let (mut u, a, _) = setup(); diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index bba57c778..b577f5ae1 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -592,8 +592,9 @@ fn y_of(doc: &Document, n: &Node) -> f64 { (doc.frame_relative(n.id).as_coeffs()[5] * 100.0).round() / 100.0 } -fn rot_of(n: &Node) -> f64 { - (figcraft_geom::rotation_degrees(n.transform) * 100.0).round() / 100.0 +/// The layer's rotation on the page (its own angle plus its parents'), what the field shows. +fn rot_of(doc: &Document, n: &Node) -> f64 { + (figcraft_geom::rotation_degrees(doc.world_transform(n.id)) * 100.0).round() / 100.0 } pub(crate) fn position_values(ctx: &egui::Context, doc: &Arc, sel: &[NodeId]) -> PositionValues { @@ -602,7 +603,7 @@ pub(crate) fn position_values(ctx: &egui::Context, doc: &Arc, sel: &[N can_align: figcraft_engine::cmd::arrange::can_align(doc, sel), x: common(doc, sel, |n| x_of(doc, n)), y: common(doc, sel, |n| y_of(doc, n)), - rot: common(doc, sel, rot_of), + rot: common(doc, sel, |n| rot_of(doc, n)), parent_al: sel.iter().all(|i| doc.node(*i).and_then(parent).is_some_and(|p| p.layout.is_some())), absolute: common(doc, sel, |n| n.child_layout.absolute), // Constraints: children of frames without auto layout, or ignoring it. @@ -620,7 +621,7 @@ fn position_fields(app: &mut FigApp, ui: &mut Ui, doc: &Arc, sel: &[No let col = widgets::col_width(ui.available_width()); align_row(app, ui, sel, pv.can_align, col); position_row(app, ui, doc, sel, &pv, col); - rotation_row(app, ui, sel, pv.rot, col); + rotation_row(app, ui, doc, sel, pv.rot, col); if pv.in_frame { constraints_row(app, ui, sel, pv.constraints, col); } @@ -697,12 +698,12 @@ fn position_row(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId], p } /// Rotation, with the rotate and flip buttons. -fn rotation_row(app: &mut FigApp, ui: &mut Ui, sel: &[NodeId], rot: Option, col: f32) { +fn rotation_row(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId], rot: Option, col: f32) { let ids = sel.to_vec(); widgets::sublabels(ui, tr("Rotation"), None); row(ui, 32.0, |ui| { let e = widgets::number_field_mixed(ui, Id::unique("pos_rot"), Lead::Icon(Icon::Angle, tr("Rotation")), rot, "°", col, 1.0); - app.field_of(&ids, "rotation", e, rot_of, |v| json!(v)); + app.field_of(&ids, "absoluteRotation", e, |n| rot_of(doc, n), |v| json!(v)); let items = [ (Icon::Rotate, tr("Rotate 90° right")), (Icon::FlipH, crate::shortcuts::tip(tr("Flip horizontal"), "object.flipH")), diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 4835bd1e1..b06d79932 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -67,6 +67,7 @@ state are answered without a frame (about half a second each), while `ui.screens Coordinates are page units, y down. `x`/`y` in `node.set`/`node.create` are relative to the parent frame (groups have no coordinate space of their own). +`rotation` in `node.set` is the layer's angle to its parent; `absoluteRotation` sets its rotation on the page (what the Design panel's field shows); a call takes one of the two. **Windows.** The desktop app can show files in several windows (`window.new`). Every method takes an optional `window` (an id from `window.list`; `0` is the main window) and then runs in that diff --git a/docs/mcp.md b/docs/mcp.md index 04b37e1f0..31cd011eb 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -172,6 +172,7 @@ Or in a project's `.mcp.json`: - `create_node` and `set_properties` take `x`/`y` **relative to the parent frame** (the page when there is none, so they are page coordinates then). Groups and boolean groups have no coordinate space of their own: a layer in a group is placed in the frame (or on the page) the group is in. + `rotation` is the layer's angle to its parent (Figma's plugin API `rotation` is the same); `absoluteRotation` sets its rotation on the page, what the Design panel's field shows; a call takes one of the two. `inspect_document` reports `x`/`y` the same way, plus `absoluteBounds` in page coordinates. In `props`, `fill` and `stroke` also accept `"none"` (either case) or `null` as no paint, the same as an empty `fills`/`strokes` list, so an outline-only shape can be made in one call. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..3ebe45278 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -61,7 +61,7 @@ interaction feel not yet compared. | Select layer menu (every layer under the click) | done | | | Enter / Shift+Enter (children / parent), Tab / Shift+Tab (siblings) | done | Tab renames the next layer while renaming | | Resize handles: Shift keeps proportions, Alt from centre, constraints-aware | done | Alt shrinks too; past an edge flips (several layers mirror); groups and mixed rotations scale each layer along its own axes, keeping rotation and flip (no skew: children turned off a right angle are approximate); Cmd/Ctrl ignores a frame's constraints (`transform_behaviour_tests`) | -| Rotate just outside a corner; Shift in 15° steps | done | rotated handle box when layers share a rotation | +| Rotate just outside a corner; Shift in 15° steps | done | rotated handle box when layers share a rotation; the Rotation field shows and sets the rotation on the page (its own angle plus its parents'), in frames and groups alike, measured in Figma's web app 2026-11-10 (#2196): a rectangle drawn inside a turned frame reads 0, typing 7 makes it 7 on the page; the panel sends `node.set absoluteRotation`, while `rotation` stays the angle to the parent for scripts, inspect, codegen and the formats. Pinned, not measured: several layers read one value when their page angles agree (typing sets them all, one undo step); a flipped layer reads in the same form as before (a horizontal flip reads 180 plus the angle) and typing keeps the flip; a flipped parent is handled by the world math. Tests: `absolute_rotation_sets_the_rotation_on_the_page_keeping_the_centre`, `the_absolute_rotation_key_turns_about_a_moved_origin_too`, `the_rotation_field_shows_and_sets_the_rotation_on_the_page` | | Flip, rotate 90° | done | | | Rotation origin (Alt+R) | done | a handle at the selection's centre to drag (snaps to the box's corners, edge middles and centre), double-click puts it back, Escape or Alt+R hides it; the corner handles, the rotation field, Rotate 90°/180° and `transform.rotate` turn about it; it follows the layers and lasts as long as the selection, not saved (the documentation doesn't say; pinned) | | Enter with a shape or frame tool chosen | done | places what a click makes (100×100, lines 100 long, sections 400×300) in the middle of the view, selected (`tool.place`); from the toolbar, Enter on the chosen tool. With nothing selected, the arrows first show a crosshair in the middle of the view and then move it by the nudge amounts (`tool.crosshair`; Shift the large one), and Enter places there; Escape or a tool change takes it away ("Use the arrow keys to activate the crosshair cursor. It will appear in the middle of the viewport indicating where the new object will be placed", Accessibility at Figma; #1839) | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-10 | minor | The Rotation field shows and sets the layer's rotation on the page (its own angle plus its parents'), in frames and groups alike, as measured in Figma's web app (#2196) | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From cc36771713344dbfd91ce7290b274ec4e3b80a77 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 03:06:32 -0500 Subject: [PATCH 107/239] M8: absoluteRotation turns a selected parent before the layers in it (#2196) A page angle depends on the parents', so a frame and a layer inside it set together both land on the typed page angle whatever the order of the ids (the layer went to 80 for 45 when it came first). Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote (review fix, no brief) --- crates/engine/src/cmd/edit/props.rs | 5 +++++ crates/engine/src/transform_behaviour_tests.rs | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/crates/engine/src/cmd/edit/props.rs b/crates/engine/src/cmd/edit/props.rs index 819632a82..b2c9791dc 100644 --- a/crates/engine/src/cmd/edit/props.rs +++ b/crates/engine/src/cmd/edit/props.rs @@ -165,6 +165,11 @@ pub(super) fn set(s: &mut Session, p: &Value) -> Result { } let doc = s.doc_mut()?; let before = crate::cmd::styles::bound_before(doc, &ids); + let mut ids = ids; + if props.contains_key("absoluteRotation") { + // A page angle depends on the parents': turn a selected parent before the layers in it. + ids.sort_by_key(|i| doc.ancestors(*i).len()); + } for i in ids { crate::cmd::props::apply("node.set", doc, i, skipped.get(&i).unwrap_or(&props))?; } diff --git a/crates/engine/src/transform_behaviour_tests.rs b/crates/engine/src/transform_behaviour_tests.rs index 96b753d6d..8d7c44657 100644 --- a/crates/engine/src/transform_behaviour_tests.rs +++ b/crates/engine/src/transform_behaviour_tests.rs @@ -508,6 +508,19 @@ fn absolute_rotation_sets_the_rotation_on_the_page_keeping_the_centre() { assert!(s.execute("node.set", &json!({"ids": [r], "props": {"rotation": 1, "absoluteRotation": 2}})).is_err()); } +#[test] +fn absolute_rotation_on_a_frame_and_a_layer_inside_it_lands_both_on_the_page_angle() { + let mut s = session(); + let page = |s: &Session, i: NodeId| rotation_degrees(s.doc().unwrap().world_transform(i)); + let f = id(&ex(&mut s, "frame.create", json!({"x": 0, "y": 100, "width": 400, "height": 400}))); + set(&mut s, &[f], json!({"rotation": 10})); + let r = rect(&mut s, 100.0, 100.0, 120.0, 80.0, Some(f)); + // The layer inside comes first in the ids: the frame's turn must not carry it past 45. + set(&mut s, &[r, f], json!({"absoluteRotation": 45})); + assert!(near(page(&s, f), 45.0), "{}", page(&s, f)); + assert!(near(page(&s, r), 45.0), "{}", page(&s, r)); +} + #[test] fn constrain_proportions_keeps_the_other_side_in_ratio() { let mut s = session(); From a66946d13e6d22eb8fcfcc9ea0100f2f59db349a Mon Sep 17 00:00:00 2001 From: impulsado <72570835+impulsado@users.noreply.github.com> Date: Tue, 10 Nov 2026 09:34:17 +0100 Subject: [PATCH 108/239] M3: strengthen inherited slot property regression coverage Cover inherited Boolean bindings and independent same-component slot content. Strengthen text, HTML and stored-property assertions, split default and own-content cases, and document ownership-based binding resolution. --- crates/engine/src/assets/components/sync.rs | 6 +- crates/engine/src/slot_tests.rs | 196 +++++++++++++++++--- 2 files changed, 172 insertions(+), 30 deletions(-) diff --git a/crates/engine/src/assets/components/sync.rs b/crates/engine/src/assets/components/sync.rs index 17836b111..513f4f7c8 100644 --- a/crates/engine/src/assets/components/sync.rs +++ b/crates/engine/src/assets/components/sync.rs @@ -165,8 +165,8 @@ fn copy_layers( // No longer a slot in the main: it mirrors the main again. n.overrides.remove(SLOT); } - // Component properties: the main layer's bindings use this instance's values; layers of - // nested instances use the nested instance's values (one level per source hop). + // Bindings use the enclosing instance of their defining component, even when slot + // content has fewer source hops than enclosing instances. let enc = enclosing.get(&parent).cloned().unwrap_or_default(); apply_enclosing_props(doc, &mut n, orig, &enc, &inst_props); if let NodeKind::Instance { component: c, props } = &n.kind { @@ -254,6 +254,8 @@ fn rebuild_nested(doc: &mut Document, nested: Vec, old: &BTreeMap (NodeId, NodeId, NodeId, } fn assert_slot_text(s: &mut Session, instance: NodeId, expected: &str) { - let label = kids(s, instance)[0]; - let characters = node(s, label).kind.text().unwrap().characters.clone(); + let children = kids(s, instance); + assert_eq!(children.len(), 1, "Content {instance} must have exactly one Label"); + let label = children[0]; + assert_eq!(node(s, label).name, "Label"); + let characters = node(s, label).kind.text().expect("Content's only child must be text").characters.clone(); let html = ex(s, "inspect.code", json!({"id": instance, "language": "html"}))["code"].as_str().unwrap().to_string(); assert_eq!(characters, expected, "slot Label characters; HTML: {html}"); + assert_eq!(html.matches("

").count(), 1, "slot Label HTML must contain exactly one paragraph: {html}"); assert!(html.contains(&format!(">{expected}

")), "slot Label HTML: {html}"); } fn assert_local_slot_text(s: &mut Session, instance: NodeId, expected: &str) { - assert!(matches!(&node(s, instance).kind, NodeKind::Instance { props, .. } if props.get("Text") == Some(&json!(expected)))); + assert!( + matches!(&node(s, instance).kind, NodeKind::Instance { props, .. } if props.get("Text") == Some(&json!(expected))), + "instance {instance} must store its own Text value {expected:?}: {:?}", + node(s, instance).kind + ); let properties = props_of(s, instance); - assert_eq!(properties.iter().find(|p| p["name"] == "Text").unwrap()["value"], expected); + let text = properties.iter().find(|p| p["name"] == "Text").unwrap_or_else(|| panic!("instance {instance} has no Text property: {properties:?}")); + assert_eq!(text["value"], expected, "instance {instance} Text property"); +} + +/// Exercise the same ownership contract for default slot content and content supplied by the +/// Composition main; separate tests identify which route regresses. +fn check_slot_text_properties_stay_local(own: bool) { + let mut s = Session::new(); + let (content, label, _base, composition, main_content) = slot_text_composition(&mut s, own); + let a = idv(&ex(&mut s, "instance.create", json!({"component": composition, "x": 400}))); + let b = idv(&ex(&mut s, "instance.create", json!({"component": composition, "x": 800}))); + let ac = copy_of(&s, a, main_content); + let bc = copy_of(&s, b, main_content); + ex(&mut s, "instance.setProperties", json!({"ids": [ac], "properties": {"Text": "Custom"}})); + assert_local_slot_text(&mut s, ac, "Custom"); + assert_slot_text(&mut s, ac, "Custom"); + assert_local_slot_text(&mut s, bc, "Default"); + assert_slot_text(&mut s, bc, "Default"); + assert_local_slot_text(&mut s, main_content, "Default"); + assert_slot_text(&mut s, main_content, "Default"); + assert_eq!(node(&s, label).kind.text().unwrap().characters, "Default"); + // Main property edits propagate without replacing another instance's local value. + ex(&mut s, "instance.setProperties", json!({"ids": [main_content], "properties": {"Text": "Main value"}})); + assert_slot_text(&mut s, ac, "Custom"); + assert_slot_text(&mut s, bc, "Main value"); + assert_slot_text(&mut s, main_content, "Main value"); + ex(&mut s, "component.editProperty", json!({"id": content, "name": "Text", "default": "New default"})); + assert_slot_text(&mut s, ac, "Custom"); + assert_slot_text(&mut s, bc, "Main value"); + assert_local_slot_text(&mut s, main_content, "Main value"); + assert_slot_text(&mut s, main_content, "Main value"); + healthy(&s); } #[test] -fn slot_text_properties_stay_local_in_default_and_own_content() { - for own in [false, true] { - let mut s = Session::new(); - let (content, label, _base, composition, main_content) = slot_text_composition(&mut s, own); - let a = idv(&ex(&mut s, "instance.create", json!({"component": composition, "x": 400}))); - let b = idv(&ex(&mut s, "instance.create", json!({"component": composition, "x": 800}))); - let ac = copy_of(&s, a, main_content); - let bc = copy_of(&s, b, main_content); - ex(&mut s, "instance.setProperties", json!({"ids": [ac], "properties": {"Text": "Custom"}})); - assert_local_slot_text(&mut s, ac, "Custom"); - assert_slot_text(&mut s, ac, "Custom"); - assert_slot_text(&mut s, bc, "Default"); - assert_slot_text(&mut s, main_content, "Default"); - assert_eq!(node(&s, label).kind.text().unwrap().characters, "Default"); - // Main property edits propagate without replacing another instance's local value. - ex(&mut s, "instance.setProperties", json!({"ids": [main_content], "properties": {"Text": "Main value"}})); - assert_slot_text(&mut s, ac, "Custom"); - assert_slot_text(&mut s, bc, "Main value"); - assert_slot_text(&mut s, main_content, "Main value"); - ex(&mut s, "component.editProperty", json!({"id": content, "name": "Text", "default": "New default"})); - assert_slot_text(&mut s, ac, "Custom"); - assert_slot_text(&mut s, bc, "Main value"); - healthy(&s); - } +fn slot_text_properties_stay_local_in_default_content() { + check_slot_text_properties_stay_local(false); +} + +#[test] +fn slot_text_properties_stay_local_in_own_content() { + check_slot_text_properties_stay_local(true); } #[test] @@ -451,11 +474,15 @@ fn slot_text_properties_do_not_read_an_unbound_base_property() { let (_content, _label, base, composition, main_content) = slot_text_composition(&mut s, true); ex(&mut s, "component.addProperty", json!({"id": base, "name": "Text", "type": "text", "default": "Wrong owner"})); let i = idv(&ex(&mut s, "instance.create", json!({"component": composition, "x": 400}))); + let nested_base = kids(&s, i)[0]; + assert_local_slot_text(&mut s, nested_base, "Wrong owner"); let nested = copy_of(&s, i, main_content); + assert_local_slot_text(&mut s, nested, "Default"); assert_slot_text(&mut s, nested, "Default"); ex(&mut s, "instance.setProperties", json!({"ids": [nested], "properties": {"Text": "Custom"}})); assert_local_slot_text(&mut s, nested, "Custom"); assert_slot_text(&mut s, nested, "Custom"); + assert_local_slot_text(&mut s, nested_base, "Wrong owner"); assert_slot_text(&mut s, main_content, "Default"); healthy(&s); } @@ -472,6 +499,9 @@ fn slot_text_properties_survive_inherited_own_content_and_persistence() { let bc = copy_of(&s, b, inherited_content); ex(&mut s, "instance.setProperties", json!({"ids": [ac], "properties": {"Text": "Custom"}})); assert_local_slot_text(&mut s, ac, "Custom"); + assert_local_slot_text(&mut s, bc, "Default"); + assert_local_slot_text(&mut s, inherited_content, "Default"); + assert_local_slot_text(&mut s, main_content, "Default"); let bytes = figcraft_format::save_bytes(s.doc().unwrap(), None).unwrap(); let (back, _) = figcraft_format::load_bytes(&bytes).unwrap(); let mut s = Session::with_document(back); @@ -495,6 +525,116 @@ fn slot_text_properties_survive_inherited_own_content_and_persistence() { healthy(&s); } +/// Check both the stored property and the Label it drives, not just one representation. +fn assert_slot_visibility(s: &mut Session, instance: NodeId, expected: bool) { + assert!( + matches!(&node(s, instance).kind, NodeKind::Instance { props, .. } if props.get("Visible") == Some(&json!(expected))), + "instance {instance} must store Visible={expected}: {:?}", + node(s, instance).kind + ); + let properties = props_of(s, instance); + let visible = + properties.iter().find(|p| p["name"] == "Visible").unwrap_or_else(|| panic!("instance {instance} has no Visible property: {properties:?}")); + assert_eq!(visible["value"], expected, "instance {instance} Visible property"); + let children = kids(s, instance); + assert_eq!(children.len(), 1, "Content {instance} must have exactly one Label"); + assert_eq!(node(s, children[0]).name, "Label"); + assert_eq!(node(s, children[0]).visible, expected, "instance {instance} Label visibility"); +} + +#[test] +fn slot_boolean_properties_stay_local_in_inherited_own_content() { + let mut s = Session::new(); + let (content, label, base, composition, main_content) = slot_text_composition(&mut s, true); + ex(&mut s, "component.addProperty", json!({"id": content, "name": "Visible", "type": "boolean", "default": true, "layer": label})); + ex(&mut s, "component.addProperty", json!({"id": base, "name": "Visible", "type": "boolean", "default": false})); + let (outer, inherited) = slot_text_wrapper(&mut s, composition, "Outer composition"); + let inherited_base = kids(&s, inherited)[0]; + let inherited_content = copy_of(&s, inherited, main_content); + let a = idv(&ex(&mut s, "instance.create", json!({"component": outer, "x": 400}))); + let b = idv(&ex(&mut s, "instance.create", json!({"component": outer, "x": 800}))); + let ac = copy_of(&s, a, inherited_content); + let bc = copy_of(&s, b, inherited_content); + let abase = copy_of(&s, a, inherited_base); + assert!(matches!(&node(&s, abase).kind, NodeKind::Instance { props, .. } if props.get("Visible") == Some(&json!(false)))); + assert_slot_visibility(&mut s, ac, true); + assert_slot_visibility(&mut s, bc, true); + ex(&mut s, "instance.setProperties", json!({"ids": [ac], "properties": {"Visible": false}})); + assert_slot_visibility(&mut s, ac, false); + assert_slot_visibility(&mut s, bc, true); + assert_slot_visibility(&mut s, inherited_content, true); + assert_slot_visibility(&mut s, main_content, true); + // A main update must not replace either instance's local value with the Base's homonym. + ex(&mut s, "instance.setProperties", json!({"ids": [main_content], "properties": {"Visible": false}})); + assert_slot_visibility(&mut s, ac, false); + assert_slot_visibility(&mut s, bc, false); + ex(&mut s, "instance.setProperties", json!({"ids": [bc], "properties": {"Visible": true}})); + ex(&mut s, "node.set", json!({"id": content, "props": {"fill": "#abcdef"}})); + assert_slot_visibility(&mut s, ac, false); + assert_slot_visibility(&mut s, bc, true); + assert_slot_visibility(&mut s, main_content, false); + healthy(&s); + let bytes = figcraft_format::save_bytes(s.doc().unwrap(), None).unwrap(); + let (back, _) = figcraft_format::load_bytes(&bytes).unwrap(); + let mut s = Session::with_document(back); + assert_slot_visibility(&mut s, ac, false); + assert_slot_visibility(&mut s, bc, true); + assert_slot_visibility(&mut s, inherited_content, false); + assert_slot_visibility(&mut s, main_content, false); + ex(&mut s, "instance.setProperties", json!({"ids": [main_content], "properties": {"Visible": true}})); + assert_slot_visibility(&mut s, ac, false); + assert_slot_visibility(&mut s, bc, true); + assert_slot_visibility(&mut s, main_content, true); + healthy(&s); +} + +#[test] +fn same_component_in_own_slot_keeps_independent_text_properties() { + let mut s = Session::new(); + let frame = idv(&ex(&mut s, "frame.create", json!({"width": 200, "height": 100, "name": "Card"}))); + let label = idv(&ex(&mut s, "text.create", json!({"text": "Default", "parent": frame, "props": {"name": "Label"}}))); + let body = idv(&ex(&mut s, "frame.create", json!({"width": 180, "height": 60, "y": 40, "name": "Body", "parent": frame}))); + let card = idv(&ex(&mut s, "component.create", json!({"ids": [frame]}))); + ex(&mut s, "component.addProperty", json!({"id": card, "name": "Text", "type": "text", "default": "Default", "layer": label})); + ex(&mut s, "component.makeSlot", json!({"id": body})); + // Only page instance content holds another Card: the main never contains itself. + let outer = idv(&ex(&mut s, "instance.create", json!({"component": card, "x": 400}))); + let inner = idv(&ex(&mut s, "instance.slotInsert", json!({"id": outer, "slot": "Body", "component": card}))); + let check = |s: &mut Session, outer_text: &str, inner_text: &str| { + assert_local_slot_text(s, outer, outer_text); + assert_local_slot_text(s, inner, inner_text); + assert_eq!(node(s, copy_of(s, outer, label)).kind.text().unwrap().characters, outer_text); + assert_eq!(node(s, copy_of(s, inner, label)).kind.text().unwrap().characters, inner_text); + let outer_body = copy_of(s, outer, body); + assert!(slot_edited(s.doc().unwrap(), outer_body)); + assert_eq!(kids(s, outer_body), vec![inner]); + assert!(kids(s, copy_of(s, inner, body)).is_empty()); + assert!(kids(s, body).is_empty(), "the main's slot must remain empty"); + healthy(s); + }; + ex(&mut s, "instance.setProperties", json!({"ids": [outer], "properties": {"Text": "Outer"}})); + check(&mut s, "Outer", "Default"); + ex(&mut s, "instance.setProperties", json!({"ids": [inner], "properties": {"Text": "Inner"}})); + check(&mut s, "Outer", "Inner"); + ex(&mut s, "text.set", json!({"id": label, "characters": "New default"})); + ex(&mut s, "node.set", json!({"id": card, "props": {"fill": "#abcdef"}})); + check(&mut s, "Outer", "Inner"); + assert_eq!(fill(&s, outer), "ABCDEF"); + assert_eq!(fill(&s, inner), "ABCDEF"); + ex(&mut s, "instance.setProperties", json!({"ids": [outer], "properties": {"Text": "Outer updated"}})); + check(&mut s, "Outer updated", "Inner"); + ex(&mut s, "instance.setProperties", json!({"ids": [inner], "properties": {"Text": "Inner updated"}})); + check(&mut s, "Outer updated", "Inner updated"); + let bytes = figcraft_format::save_bytes(s.doc().unwrap(), None).unwrap(); + let (back, _) = figcraft_format::load_bytes(&bytes).unwrap(); + let mut s = Session::with_document(back); + check(&mut s, "Outer updated", "Inner updated"); + ex(&mut s, "node.set", json!({"id": card, "props": {"fill": "#123456"}})); + check(&mut s, "Outer updated", "Inner updated"); + assert_eq!(fill(&s, outer), "123456"); + assert_eq!(fill(&s, inner), "123456"); +} + /// Random slot edits, main edits and resets keep every instance mirroring its main. #[test] fn random_slot_edits_keep_instances_consistent() { From 67c232eab21be3ed5335aafd1ec4f046b5d5dfe7 Mon Sep 17 00:00:00 2001 From: Carbocode Date: Tue, 10 Nov 2026 12:50:16 +0100 Subject: [PATCH 109/239] M1: strengthen page transparency and sidebar review tests --- crates/ui-egui/src/canvas/background.rs | 170 ++++++++++++++++++------ crates/ui-egui/src/field_tests.rs | 63 ++++++--- docs/ui-parity.md | 5 +- 3 files changed, 181 insertions(+), 57 deletions(-) diff --git a/crates/ui-egui/src/canvas/background.rs b/crates/ui-egui/src/canvas/background.rs index 8fe948802..f7eadd640 100644 --- a/crates/ui-egui/src/canvas/background.rs +++ b/crates/ui-egui/src/canvas/background.rs @@ -2,6 +2,7 @@ use egui::{Color32, CornerRadius, Id, Painter, Rect, TextureHandle, pos2}; +/// Reuse the checkerboard texture, updating its pixels when the active theme changes. fn grid_texture(ctx: &egui::Context) -> TextureHandle { let id = Id::unique("canvas_transparency_grid"); let tokens = crate::theme::Tokens::get(ctx); @@ -24,6 +25,7 @@ fn grid_texture(ctx: &egui::Context) -> TextureHandle { texture } +/// Draw the transparency grid and apply page colour only outside the rendered image. pub(super) fn paint(painter: &Painter, rect: Rect, background: Color32, rendered: Option) { if background.a() < 255 { // Repeat four pixels instead of allocating one shape per square on a large canvas. @@ -51,41 +53,127 @@ pub(super) fn paint(painter: &Painter, rect: Rect, background: Color32, rendered #[cfg(test)] mod tests { use super::*; - use egui::vec2; + use egui::{Mesh, TextureId, vec2}; + /// Paint a small canvas and consume its texture uploads as the UI harness does. fn shapes(alpha: u8, rendered: Option) -> egui::FullOutput { let ctx = egui::Context::default(); let mut out = ctx.run_ui(Default::default(), |ui| { - paint( - ui.painter(), - Rect::from_min_size(egui::Pos2::ZERO, vec2(100.0, 100.0)), - Color32::from_rgba_unmultiplied(255, 0, 0, alpha), - rendered, - ); + paint(ui.painter(), canvas(), Color32::from_rgba_unmultiplied(255, 0, 0, alpha), rendered); }); out.textures_delta.clear(); out } + /// Fixed canvas bounds make clipping and uncovered-area checks independent of UI layout. + fn canvas() -> Rect { + Rect::from_min_size(egui::Pos2::ZERO, vec2(100.0, 100.0)) + } + + /// Check the actual checkerboard quad, including clipping and its screen-sized UV mapping. + fn assert_grid(out: &egui::FullOutput, tile: TextureId, rect: Rect) -> usize { + let meshes: Vec<_> = out + .shapes + .iter() + .enumerate() + .filter_map(|(index, shape)| match &shape.shape { + egui::Shape::Mesh(mesh) if mesh.texture_id == tile => Some((index, shape.clip_rect, mesh)), + _ => None, + }) + .collect(); + assert_eq!(meshes.len(), 1, "one checkerboard covers the canvas"); + let (index, clip, mesh) = meshes[0]; + assert_eq!(mesh.calc_bounds(), rect); + assert!(clip.contains_rect(rect), "the whole checkerboard is visible"); + assert_eq!(mesh.vertices.len(), 4); + for vertex in &mesh.vertices { + let expected = (vertex.pos - rect.min) / 16.0; + assert!((vertex.uv.to_vec2() - expected).length() < 0.001, "UVs keep the squares at a fixed screen size"); + } + index + } + + /// Assert strips have the correct colour and partition exactly the area outside the render. + fn assert_partition(alpha: u8, rendered: Option) { + let out = shapes(alpha, rendered); + let fills: Vec<_> = out + .shapes + .iter() + .enumerate() + .filter_map(|(index, s)| match &s.shape { + egui::Shape::Rect(r) => Some((index, r)), + _ => None, + }) + .collect(); + let covered = rendered.map(|r| r.intersect(canvas())).filter(|r| r.is_positive()); + let background = Color32::from_rgba_unmultiplied(255, 0, 0, alpha); + for (i, (_, strip)) in fills.iter().enumerate() { + assert_eq!(strip.fill.a(), alpha, "each fallback strip applies alpha exactly once"); + assert_eq!(strip.fill, background, "the fallback keeps the page colour too"); + assert!(strip.rect.is_positive() && canvas().contains_rect(strip.rect)); + if let Some(covered) = covered { + assert!(!strip.rect.intersect(covered).is_positive(), "no fallback beneath rendered pixels"); + } + for (_, other) in fills.iter().skip(i + 1) { + assert!(!strip.rect.intersect(other.rect).is_positive(), "fallback strips do not overlap"); + } + } + let area: f32 = fills.iter().map(|(_, strip)| strip.rect.area()).sum(); + assert_eq!(area, canvas().area() - covered.map_or(0.0, |r| r.area()), "no uncovered gaps"); + if covered == Some(canvas()) { + assert!(fills.is_empty(), "full coverage needs no fallback fills"); + } + let meshes: Vec<&Mesh> = out + .shapes + .iter() + .filter_map(|s| match &s.shape { + egui::Shape::Mesh(mesh) => Some(mesh.as_ref()), + _ => None, + }) + .collect(); + if alpha < 255 { + assert_eq!(meshes.len(), 1); + let index = assert_grid(&out, meshes[0].texture_id, canvas()); + assert!(fills.iter().all(|(fill_index, _)| *fill_index > index), "the grid is behind every fallback strip"); + } else { + assert!(meshes.is_empty(), "opaque pages need no checkerboard"); + } + } + + /// Exercise the real canvas with a render present, checking the grid covers it and draws first. #[test] fn the_canvas_draws_the_transparency_grid_for_a_transparent_page() { let mut ui = crate::layers_drag_tests::Ui::new(figcraft_engine::Session::new()); ui.app.run("page.setBackground", serde_json::json!({"color": "#FF000000"})); + let ds = ui.app.session.ds().unwrap(); + let shown = (ds.uid, ds.page); + // Seed an image so this test does not depend on when the asynchronous worker finishes. + ui.app.canvas.texture = + Some(ui.ctx.load_texture("test-page-render", egui::ColorImage::filled([16, 16], Color32::TRANSPARENT), egui::TextureOptions::NEAREST)); + ui.app.canvas.tex_view = Some(figcraft_render::View { origin: (0.0, 0.0), scale: 1.0, width: 16, height: 16 }); + ui.app.canvas.tex_of = Some(shown); let out = ui.frame_output(vec![]); let (tile, _) = ui.ctx.data(|d| d.get_temp::<(TextureHandle, [Color32; 2])>(Id::unique("canvas_transparency_grid"))).expect("the canvas checkerboard"); - assert!(out.shapes.iter().any(|s| matches!(&s.shape, egui::Shape::Mesh(m) if m.texture_id == tile.id()))); + let grid_index = assert_grid(&out, tile.id(), ui.app.canvas.rect); + let rendered = ui.app.canvas.texture.as_ref().unwrap().id(); + let render_index = + out.shapes.iter().position(|s| matches!(&s.shape, egui::Shape::Mesh(m) if m.texture_id == rendered)).expect("the rendered page"); + assert!(grid_index < render_index, "the checkerboard is behind the rendered page"); } + /// Theme changes must reach drawing, update the pixels used by its mesh and reuse the texture. #[test] fn the_grid_updates_its_colours_when_the_theme_changes() { let ctx = egui::Context::default(); let mut previous_id = None; for tokens in [crate::theme::Tokens::light(), crate::theme::Tokens::dark(), crate::theme::Tokens::light()] { crate::theme::apply(&ctx, tokens); - let mut tile = None; - let mut out = ctx.run_ui(Default::default(), |_ui| tile = Some(grid_texture(&ctx))); - let tile = tile.unwrap(); + let mut out = ctx.run_ui(Default::default(), |ui| paint(ui.painter(), canvas(), Color32::TRANSPARENT, None)); + let (tile, _) = + ctx.data(|d| d.get_temp::<(TextureHandle, [Color32; 2])>(Id::unique("canvas_transparency_grid"))).expect("drawn checkerboard"); + let grid_index = assert_grid(&out, tile.id(), canvas()); + assert!(out.shapes.iter().enumerate().all(|(index, s)| !matches!(&s.shape, egui::Shape::Rect(_)) || index > grid_index)); if let Some(previous_id) = previous_id { assert_eq!(tile.id(), previous_id, "changing theme updates the same texture"); } @@ -97,44 +185,46 @@ mod tests { } } + /// Interior, edge-straddling and fully covering renders must all apply the page alpha once. #[test] fn translucent_pages_show_the_grid_without_applying_page_alpha_twice() { - let rendered = Rect::from_min_max(pos2(20.0, 20.0), pos2(80.0, 80.0)); + let renders = [ + Rect::from_min_max(pos2(20.0, 20.0), pos2(80.0, 80.0)), + Rect::from_min_max(pos2(-20.0, 20.0), pos2(80.0, 80.0)), + Rect::from_min_max(pos2(20.0, -20.0), pos2(80.0, 80.0)), + Rect::from_min_max(pos2(20.0, 20.0), pos2(120.0, 80.0)), + Rect::from_min_max(pos2(20.0, 20.0), pos2(80.0, 120.0)), + Rect::from_min_max(pos2(-20.0, -20.0), pos2(80.0, 80.0)), + canvas(), + Rect::from_min_max(pos2(-20.0, -20.0), pos2(120.0, 120.0)), + ]; for alpha in [0, 128, 255] { - let out = shapes(alpha, Some(rendered)); - let fills: Vec<_> = out - .shapes - .iter() - .filter_map(|s| match &s.shape { - egui::Shape::Rect(r) => Some(r.rect), - _ => None, - }) - .collect(); - assert_eq!(fills.len(), 4); - assert!(fills.iter().all(|r| !r.intersect(rendered).is_positive()), "the render's alpha has no page colour beneath it"); - for point in [pos2(10.0, 10.0), pos2(90.0, 90.0), pos2(10.0, 50.0), pos2(90.0, 50.0)] { - assert_eq!(fills.iter().filter(|r| r.contains(point)).count(), 1, "uncovered pixels get the page colour once"); + for rendered in renders { + assert_partition(alpha, Some(rendered)); } - let images = out.shapes.iter().filter(|s| matches!(&s.shape, egui::Shape::Mesh(_))).count(); - assert_eq!(images, usize::from(alpha < 255), "only transparent pages need the checkerboard"); } } + /// Missing, offscreen and merely edge-touching images leave exactly one fallback page fill. #[test] fn absent_or_offscreen_renders_fill_the_page_once() { - for rendered in [None, Some(Rect::from_min_size(pos2(200.0, 200.0), vec2(10.0, 10.0)))] { - let out = shapes(128, rendered); - let fills: Vec<_> = out - .shapes - .iter() - .filter_map(|s| match &s.shape { - egui::Shape::Rect(r) => Some(r), - _ => None, - }) - .collect(); - assert_eq!(fills.len(), 1); - assert_eq!(fills[0].rect, Rect::from_min_size(egui::Pos2::ZERO, vec2(100.0, 100.0))); - assert_eq!(fills[0].fill.a(), 128); + for rendered in + [None, Some(Rect::from_min_size(pos2(200.0, 200.0), vec2(10.0, 10.0))), Some(Rect::from_min_max(pos2(-20.0, 20.0), pos2(0.0, 80.0)))] + { + for alpha in [0, 128, 255] { + assert_partition(alpha, rendered); + let out = shapes(alpha, rendered); + let fills: Vec<_> = out + .shapes + .iter() + .filter_map(|s| match &s.shape { + egui::Shape::Rect(r) => Some(r), + _ => None, + }) + .collect(); + assert_eq!(fills.len(), 1); + assert_eq!(fills[0].rect, canvas()); + } } } } diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index 939258ae5..ed7ad801a 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -1300,37 +1300,70 @@ fn page_background_shows_fractional_opacity_like_fill_and_keeps_it_when_opening_ u.app.run("page.setBackground", json!({"color": "#FF000080"})); u.frame(vec![]); assert_eq!(field(&mut u, "Opacity").1, "50.2%"); + let page = u.app.session.page().unwrap(); + let background = |u: &Ui| match u.app.session.doc().unwrap().node(page).unwrap().kind { + figcraft_doc::NodeKind::Page { background, .. } => background, + _ => panic!("the page"), + }; + let original = background(&u); let steps = undo_steps(&u); let swatch = u.ctx.read_response(Id::unique("pagebg_swatch")).expect("shared page swatch").rect.center(); click(&mut u, swatch); assert!(matches!(u.app.ui.picker, Some(crate::colorpicker::PickerTarget::PageBackground))); assert_eq!(undo_steps(&u), steps, "opening the picker does not edit the colour"); + assert_eq!(background(&u), original, "opening preserves the stored alpha"); + assert_eq!(field(&mut u, "Opacity").1, "50.2%"); click(&mut u, swatch); assert!(u.app.ui.picker.is_none(), "the swatch toggles the picker closed"); + assert_eq!(background(&u), original, "closing preserves the stored alpha"); + assert_eq!(field(&mut u, "Opacity").1, "50.2%"); + assert_eq!(undo_steps(&u), steps, "neither toggle creates an edit"); } /// The shared page colour row uses the sidebar's width without hiding either field. #[test] fn page_background_colour_and_opacity_fit_a_resized_sidebar() { - let mut u = Ui::new(Session::new()); - let mut previous_widths: Option<(f32, f32)> = None; - for width in [240.0, 500.0] { - u.app.ui.right_width = width; - for _ in 0..3 { - u.frame(vec![]); + // Find the whole galley, rather than its already-clipped bounding box. + fn hex_text(shape: &egui::Shape) -> Option<&egui::epaint::TextShape> { + match shape { + egui::Shape::Vec(shapes) => shapes.iter().find_map(hex_text), + egui::Shape::Text(text) if text.galley.text() == "123ABC" => Some(text), + _ => None, } - let hex = u.ctx.read_response(Id::unique("pagebg").with("click")).unwrap().rect; - let alpha = u.ctx.read_response(Id::unique("pagebg_a").with("field")).unwrap().rect; - let panel = u.app.ui.right_panel_rect.unwrap(); + } + let mut widths = Vec::new(); + for width in [240.0, 500.0] { + let mut session = Session::new(); + session.prefs.panel_widths.1 = width; + session.execute("page.setBackground", &json!({"color": "#123ABC80"})).unwrap(); + let mut u = Ui::new(session); + let mut previous = None; + let mut settled = None; + // Stop at stable geometry, with a bound so a layout regression cannot hang the test. + for _ in 0..16 { + let out = u.frame_output(vec![]); + let hex = u.ctx.read_response(Id::unique("pagebg").with("click")).unwrap().rect; + let alpha = u.ctx.read_response(Id::unique("pagebg_a").with("field")).unwrap().rect; + let panel = u.app.ui.right_panel_rect.unwrap(); + if previous == Some((hex, alpha, panel)) { + settled = Some((out, hex, alpha, panel)); + break; + } + previous = Some((hex, alpha, panel)); + } + let (out, hex, alpha, panel) = settled.expect("the page row settles"); assert!(hex.left() >= u.app.canvas.rect.right(), "the colour stays in the sidebar"); assert!(hex.right() < alpha.left(), "the colour and opacity never overlap"); - assert!(alpha.right() <= u.screen.x, "the opacity stays visible"); - // The colour uses the extra room while opacity keeps its place at the right edge. - if let Some((previous_hex, previous_panel)) = previous_widths { - assert!((hex.width() - previous_hex - (panel.width() - previous_panel)).abs() < 1.0, "the shared control grows with the panel"); - } - previous_widths = Some((hex.width(), panel.width())); + // Half a point permits device-pixel rounding, not an arbitrary gap from the panel edge. + assert!((alpha.right() - (panel.right() - crate::widgets::PAD_RIGHT)).abs() <= 0.5, "opacity stays at the right edge"); + assert!((hex.center().y - alpha.center().y).abs() <= 0.5, "both fields stay on the same row"); + let (text, clip) = out.shapes.iter().find_map(|s| hex_text(&s.shape).map(|text| (text, s.clip_rect))).expect("the HEX text"); + assert!(!text.galley.elided, "the whole HEX value fits at {width} pt"); + assert!(hex.expand(0.5).contains_rect(text.visual_bounding_rect()), "the HEX text fits its field"); + assert!(clip.expand(0.5).contains_rect(text.visual_bounding_rect()), "the HEX text is not clipped"); + widths.push(hex.width()); } + assert!(widths[1] > widths[0], "a wider sidebar gives the colour field more room"); } /// The Page section's opacity field edits the page background's alpha (#1748; it was a label), diff --git a/docs/ui-parity.md b/docs/ui-parity.md index b6a134811..90d86f77c 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-09 · **Change:** patch (transparent pages show a checkerboard and apply their opacity once; the Page background uses the shared Fill/Stroke/Selection colors field; remaining sidebar colour controls audited; the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** patch (review tests assert page-alpha strips, edge/full render coverage, checkerboard geometry/order, drawn theme changes and sidebar/picker invariants; transparent pages show a checkerboard and apply their opacity once; the Page background uses the shared Fill/Stroke/Selection colors field; remaining sidebar colour controls audited; the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -31,7 +31,7 @@ interaction feel not yet compared. | Multiplayer avatars, Share button | missing | waits for multiplayer | | Colour names in hex fields | done | every hex field (fills, strokes, text ranges, effects, layout grids, colour variables, page and prototype backgrounds, the colour picker's Hex) takes a CSS colour name as well: `red` becomes `FF0000`; case, spaces and hyphens are ignored (`Light Blue`); names are opaque and keep the colour's opacity; hex wins where both could match. The picker's CSS field takes every CSS name too (`Color::from_hex_or_name`, `color::named`) | | Fields select their text on focus | done | Number and text values keep their vertical position when their editor gains focus (including typography spacing; `sidebar_field_text_stays_in_place_on_focus`). a click or Tab into a one-line field selects all of its text, so typing replaces the value: hex and colour fields, number fields, inline fields (a fill's hex, variable values, renames), names, search boxes and dialog fields; a drag from the press selects only what it covers; multi-line fields (descriptions, comments) keep the caret where clicked. The first click into an inline field (a fill's hex) now takes the keyboard; it took a second click. A rename (double-click, F2, File ▸ Rename, a page) selects the whole name before its field first draws, so a key typed in that same frame replaces the name; it was appended (`widgets::select_all_on_focus`, `select_all_tests`, `layers_rename_tests`) | -| Canvas page transparency | done | Transparent or translucent page backgrounds show a checkerboard using the theme’s panel and canvas colours, updated immediately when switching between light and dark. The page background alpha is applied once: a rendered image already contains the page colour, so only uncovered areas receive the fallback colour during zoom and pan. An opaque page hides the checkerboard. Theme changes update the same cached texture. The grid is a repeated four-pixel texture at a fixed screen size, separate from document exports. Tests: `canvas::background::tests`. | +| Canvas page transparency | done | Transparent or translucent page backgrounds show a checkerboard using the theme’s panel and canvas colours, updated immediately when switching between light and dark. The page background alpha is applied once: a rendered image already contains the page colour, so only uncovered areas receive the fallback colour during zoom and pan. An opaque page hides the checkerboard. Theme changes update the same cached texture. The grid is a repeated four-pixel texture at a fixed screen size, separate from document exports. Tests: `canvas::background::tests` assert strip colour/alpha, gap-free non-overlapping coverage for absent, offscreen, edge-straddling and fully covering renders, checkerboard rect/UV/order, and theme updates through drawing. | | Page background colour control | done | Uses `widgets::paint_field`, as Fill, Stroke and Selection colors do: one background, inline HEX, accessible swatch toggling the picker and fractional opacity. Typed colours preserve alpha unless 4/8 HEX digits explicitly supply it; opacity scrubs remain live and undo as one step. Tests: `field_tests::the_page_background_opacity_field_sets_the_page_colour_alpha`, `field_tests::page_background_shows_fractional_opacity_like_fill_and_keeps_it_when_opening_the_picker` and `field_tests::page_background_colour_and_opacity_fit_a_resized_sidebar` (240 and 500 pt). | | Colour picker models | done | Hex, RGB, HSL, HSB, LCH, OKLCH and CSS; LCH and OKLCH keep lightness and hue when a colour leaves sRGB (chroma comes down); the values typed stay while the colour is theirs (a hue typed on a grey, a chroma sRGB can't hold); CSS reads `lch()` and `oklch()` with any hue unit and `none` (`figcraft_color::{Lch, Oklch}`). Values are the stored channels read as sRGB | | Colour picker placement and dismissal | done | Opens 8 pt beside the sidebar at the opening control, lifted to fit the screen; outside presses (including the sidebar), Escape and X close it. Reopening resets a dragged position; eyedropper sampling keeps it open, and so does a drag of the open gradient's handles or stops on the canvas (#1852). | @@ -207,6 +207,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| +| 2026-11-10 | patch | M1 review follow-up: strengthen canvas alpha, clipping/coverage, grid geometry/order and drawn-theme tests; use settled fresh sidebars at each width, check HEX visibility and opacity alignment, and assert picker toggling preserves page alpha. Production behavior unchanged. | | 2026-11-09 | patch | M1: canvas page transparency uses a checkerboard that follows light/dark themes and applies background alpha once, including partial or missing renders. The page control also fits both sidebar width limits. Tests: `canvas::background::tests`, `field_tests::page_background_colour_and_opacity_fit_a_resized_sidebar`. Numbers unchanged | | 2026-11-09 | patch | M1: the Page background reuses the shared sidebar paint control; fractional opacity and picker toggling covered alongside alpha-aware HEX and scrub undo. Audited remaining custom sidebar colour controls. Numbers unchanged | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | From 4201fed27da01ee1ae141b6572ed664f2c28cdc9 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 09:17:19 -0500 Subject: [PATCH 110/239] M9: .jam import: stickies come in as native board stickies (#1808) On a FigJam whiteboard the mapper builds a sticky with complete generated records as a native board sticky: the saved colour, size, place, opacity and shadows, the note and the author line as text layers, no background vector. It writes a board field on the REST JSON, which the REST importer reads (junk values are ignored with a warning). Damaged stickies and stickies in a .fig keep the generated layers. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 briefed; Sonnet 5.5 wrote at medium --- crates/format/src/fig.rs | 2 +- crates/format/src/fig/board_import_tests.rs | 98 ++++++++++++++++++- crates/format/src/fig/map.rs | 12 +++ crates/format/src/fig/map/board.rs | 88 +++++++++++++++++ crates/format/src/fig/map/layer.rs | 12 ++- crates/format/src/rest.rs | 33 +++++++ .../src/rest/import_regression_tests.rs | 20 ++++ crates/ui-egui/locales/en.toml | 1 + docs/boards-parity.md | 5 +- docs/file-format-parity.md | 5 +- 10 files changed, 268 insertions(+), 8 deletions(-) create mode 100644 crates/format/src/fig/map/board.rs diff --git a/crates/format/src/fig.rs b/crates/format/src/fig.rs index f7547c3d0..24268da3c 100644 --- a/crates/format/src/fig.rs +++ b/crates/format/src/fig.rs @@ -148,7 +148,7 @@ fn import_with_image_limit(bytes: &[u8], name: &str, image_limit: u64) -> Result let max_nodes = layer_budget(packed); drop(message); let file_name = archive.file_name.as_deref().filter(|n| !n.trim().is_empty()).unwrap_or(name); - let (mut json, mut warnings, networks) = map::to_rest(&msg, file_name, max_nodes); + let (mut json, mut warnings, networks) = map::to_rest_for(&msg, file_name, max_nodes, board); // The message goes before the layers are built, so the images it carries are copied out first. let embedded = embedded_copies(&msg); drop(msg); diff --git a/crates/format/src/fig/board_import_tests.rs b/crates/format/src/fig/board_import_tests.rs index dcf52c46c..89c6cba83 100644 --- a/crates/format/src/fig/board_import_tests.rs +++ b/crates/format/src/fig/board_import_tests.rs @@ -446,10 +446,106 @@ fn a_jam_file_imports_like_a_fig() { let (doc, warnings) = import(&bytes, "Synthetic board").unwrap(); assert_eq!(doc.kind, figcraft_doc::FileKind::Board, "a FigJam whiteboard opens as a board"); let note = named(&doc, "Board object"); - assert!(matches!(note.kind, NodeKind::Frame) && note.children.len() == 3, "the sticky with its background, note and author"); + assert!(matches!(note.kind, NodeKind::Frame) && note.children.len() == 2, "the sticky is native: its note and author"); + assert_eq!(note.board, Some(figcraft_doc::BoardItem::Sticky { author: "Test Author".into() })); assert!(matches!(named(&doc, "Synthetic table").kind, NodeKind::Frame)); assert!(doc.nodes().all(|n| n.name != "Unknown object"), "left out"); assert!(warnings.iter().any(|w| w.contains("table layers import as")), "{warnings:?}"); assert!(warnings.iter().any(|w| w.contains("SYNTHETIC_JAM_ONLY")), "a note says what was left out: {warnings:?}"); } } + +/// Import `layer` through the public importer as a FigJam whiteboard (`fig-jam.` header). +fn jam(layer: Kv<'static>) -> (Document, Vec) { + let mut bytes = canvas(&board_schema(), &message(layer)); + bytes.splice(..8, *b"fig-jam."); + import(&bytes, "Synthetic board").unwrap() +} + +/// On a whiteboard a sticky is a native sticky: its colour, size, text and author come along. +#[test] +fn a_jam_sticky_is_a_native_sticky_with_its_colour_text_and_author() { + let (doc, warnings) = jam(board_node("STICKY")); + assert_eq!(doc.kind, figcraft_doc::FileKind::Board); + let frame = named(&doc, "Board object"); + assert_eq!(frame.board, Some(figcraft_doc::BoardItem::Sticky { author: "Test Author".into() })); + assert_eq!(frame.fills[0].solid_color().unwrap().to_rgba8(), [255, 191, 64, 255]); + assert_eq!((frame.width, frame.height), (240.0, 240.0)); + assert_eq!(frame.opacity, 0.5); + let layout = frame.layout.as_ref().expect("sticky auto layout"); + assert_eq!(layout.padding, [20.0; 4]); + assert_eq!(frame.child_layout.min_h, Some(240.0)); + assert_eq!(frame.children.len(), 2, "the note and its author, no background vector"); + let texts: Vec<_> = frame.children.iter().map(|id| doc.node(*id).unwrap()).collect(); + assert!(texts.iter().all(|n| n.kind.text().is_some())); + let note = texts[0].kind.text().unwrap(); + assert_eq!(note.characters, "Olá\nIdea"); + assert_eq!(note.style.font_size, 24.0); + assert!(note.runs.iter().any(|r| r.style.font_size == 18.0), "inline styles survive"); + let author = texts[1].kind.text().unwrap(); + assert_eq!(author.characters, "Test Author"); + assert_eq!(author.style.font_size, 12.0); + assert!(!warnings.iter().any(|w| w.contains("skipped")), "{warnings:?}"); +} + +/// A sticky whose author line is not saved has an empty author and just its note. +#[test] +fn a_jam_sticky_without_an_author_line_has_no_author() { + let mut layer = board_node("STICKY"); + let background = record(0, vec![("fillPaints", arr(vec![solid(1.0, 0.75, 0.25)]))]); + set(&mut layer, "nodeGenerationData", o(vec![("overrides", arr(vec![background, record(1, text("Olá\nIdea", 24.0))]))])); + let (doc, _) = jam(layer); + let frame = named(&doc, "Board object"); + assert_eq!(frame.children.len(), 1); + let Some(figcraft_doc::BoardItem::Sticky { author }) = &frame.board else { panic!("{:?}", frame.board) }; + assert!(author.is_empty()); +} + +/// A sticky record that isn't complete keeps today's generated layers and no board item. +#[test] +fn a_damaged_jam_sticky_keeps_the_generated_layers() { + let gradient = o(vec![("type", e("GRADIENT_LINEAR")), ("visible", Kv::Bool(true))]); + let cases: Vec> = { + let mut v = Vec::new(); + // Layout version 2. + let mut a = board_node("STICKY"); + set(&mut a, "derivedImmutableFrameData", o(vec![("version", u(2))])); + v.push(a); + // Background record missing. + let mut b = board_node("STICKY"); + set(&mut b, "nodeGenerationData", o(vec![("overrides", arr(vec![record(1, text("Olá", 24.0))]))])); + v.push(b); + // A stroke on the background. + let mut c = board_node("STICKY"); + let stroked = record(0, vec![("fillPaints", arr(vec![solid(1.0, 0.75, 0.25)])), ("strokePaints", arr(vec![solid(0.0, 0.0, 0.0)]))]); + set(&mut c, "nodeGenerationData", o(vec![("overrides", arr(vec![stroked, record(1, text("Olá", 24.0))]))])); + v.push(c); + // A gradient on the background. + let mut d = board_node("STICKY"); + let graded = record(0, vec![("fillPaints", arr(vec![gradient]))]); + set(&mut d, "nodeGenerationData", o(vec![("overrides", arr(vec![graded, record(1, text("Olá", 24.0))]))])); + v.push(d); + // Blank note. + let mut f = board_node("STICKY"); + let background = record(0, vec![("fillPaints", arr(vec![solid(1.0, 0.75, 0.25)]))]); + set(&mut f, "nodeGenerationData", o(vec![("overrides", arr(vec![background, record(1, text(" ", 24.0))]))])); + v.push(f); + v + }; + for (i, layer) in cases.into_iter().enumerate() { + let (as_fig, _) = imported(layer.clone()); + let (doc, _) = jam(layer); + let frame = named(&doc, "Board object"); + assert!(frame.board.is_none(), "case {i}"); + assert_eq!(frame.children.len(), named(&as_fig, "Board object").children.len(), "case {i}: the generated layers, as in a .fig"); + } +} + +/// The same sticky in a `.fig` stays the design frame it always was. +#[test] +fn a_fig_sticky_stays_a_design_frame() { + let (doc, _) = imported(board_node("STICKY")); + let frame = named(&doc, "Board object"); + assert!(frame.board.is_none()); + assert_eq!(frame.children.len(), 3); +} diff --git a/crates/format/src/fig/map.rs b/crates/format/src/fig/map.rs index fd1b47575..a236e1fdb 100644 --- a/crates/format/src/fig/map.rs +++ b/crates/format/src/fig/map.rs @@ -17,6 +17,7 @@ use serde_json::{Map, Value, json}; use super::kiwi::Kv; use super::network; +mod board; mod component; mod connector; mod document; @@ -50,8 +51,16 @@ const MAX_ASSET_PART: usize = 256; /// The REST API file JSON for message `msg`, with the warnings about what was skipped and the /// vector networks its layers name by `vectorNetworkRef` (for [`crate::rest::import_with_networks`]). +#[cfg(test)] pub(super) fn to_rest(msg: &Kv, name: &str, max_nodes: usize) -> (Value, Vec, Vec>) { + to_rest_for(msg, name, max_nodes, false) +} + +/// [`to_rest`] for a FigJam whiteboard (`board`) or a design file: a whiteboard's stickies come +/// out as native board items. +pub(super) fn to_rest_for(msg: &Kv, name: &str, max_nodes: usize, board: bool) -> (Value, Vec, Vec>) { let mut m = Mapper::new(msg, max_nodes); + m.board = board; let _canon = VarCanon::install(&m); let doc = m.document(); // Large values are moved in, never passed through `json!`, which serialises its arguments: @@ -361,6 +370,8 @@ struct Mapper<'a> { /// Region paint elements (paints and gradient stops) read so far: one budget for the whole /// file, since layers with region paints don't share their network. region_paint_elements: usize, + /// The file is a FigJam whiteboard: its objects are built as native board items. + board: bool, } impl<'a> Mapper<'a> { @@ -438,6 +449,7 @@ impl<'a> Mapper<'a> { max_nodes, reserved: 0, networks: Vec::new(), + board: false, network_ids: HashMap::new(), region_paint_elements: 0, } diff --git a/crates/format/src/fig/map/board.rs b/crates/format/src/fig/map/board.rs new file mode 100644 index 000000000..7dcf57cfe --- /dev/null +++ b/crates/format/src/fig/map/board.rs @@ -0,0 +1,88 @@ +//! FigJam whiteboard objects as native board items: what a `.jam` import builds in place of the +//! generated frames a `.fig` keeps. The REST JSON carries them as a `board` field +//! ([`crate::rest`] reads it). + +use super::layer::{own_text, valid_size}; +use super::paint::paint; +use super::{Affine, Kv, MAX_DEPTH, Mapper, Obj, Value, View, generated_record, json, num}; + +impl<'a> Mapper<'a> { + /// A sticky as a native board sticky: its frame (size, place, opacity and shadows as saved, + /// the saved colour) holding the note and, when saved, the author line. `None` (nothing + /// changed) unless every generated record is complete: then the caller keeps the generated + /// layers. + pub(super) fn native_sticky(&mut self, o: &mut Obj, v: &View<'a>, rest_id: &str, depth: usize) -> Option> { + if v.get("nodeGenerationData").is_none() || v.get("derivedImmutableFrameData").and_then(|d| num(d, "version")) != Some(1.0) { + return None; + } + let record = |id: u32| { + let (style, bounds) = (generated_record(v, "nodeGenerationData", id)?, generated_record(v, "derivedImmutableFrameData", id)?); + let view = View::of(style).with([(bounds, 1.0)]); + (valid_size(view.get("size")).is_some() && view.transform().is_some()).then_some(view) + }; + let background = record(0)?; + let fills = background.list("fillPaints"); + let solid = matches!(fills, [p] if p.get("type").and_then(Kv::str) == Some("SOLID") && p.get("visible").and_then(Kv::bool) != Some(false)); + if !solid || !background.list("strokePaints").is_empty() { + return None; + } + let note = record(1).filter(|n| own_text(n).is_some())?; + let author = record(2).filter(|a| a.flag("visible") != Some(false) && own_text(a).is_some()); + let wanted = 1 + usize::from(author.is_some()); + if depth >= MAX_DEPTH || self.count.saturating_add(wanted) > self.budget() { + return None; + } + let (w, h) = v.size().or_else(|| o.get("size").and_then(|s| Some((s.get("x")?.as_f64()?, s.get("y")?.as_f64()?))))?; + let at = note.transform().unwrap_or_default().as_coeffs(); + let pad = |x: f64| if x.is_finite() { x.clamp(0.0, (w.min(h) / 2.0).max(0.0)) } else { 0.0 }; + let (pad_x, pad_y) = (pad(at[4]), pad(at[5])); + // Everything is valid: build. + let paints: Vec = fills.iter().filter_map(|p| paint(p, &mut |m| self.warn(m))).collect(); + o.insert("fills".into(), Value::Array(paints)); + o.insert("strokes".into(), json!([])); + o.insert("clipsContent".into(), json!(false)); + match background.len("cornerRadius") { + Some(r) => o.insert("cornerRadius".into(), json!(r)), + None => o.remove("cornerRadius"), + }; + for (k, val) in [ + ("layoutMode", json!("VERTICAL")), + ("primaryAxisAlignItems", json!("SPACE_BETWEEN")), + ("counterAxisAlignItems", json!("MIN")), + ("primaryAxisSizingMode", json!("AUTO")), + ("counterAxisSizingMode", json!("FIXED")), + ("minHeight", json!(h)), + ("itemSpacing", json!(8.0)), + ("paddingTop", json!(pad_y)), + ("paddingBottom", json!(pad_y)), + ("paddingLeft", json!(pad_x)), + ("paddingRight", json!(pad_x)), + ] { + o.insert(k.into(), val); + } + let mut kids = Vec::new(); + let mut written = String::new(); + for (local, view) in [(1, Some(note)), (2, author)] { + let Some(view) = view else { continue }; + let chars = own_text(&view).unwrap_or_default(); + let mut layer = Obj::new(); + layer.insert("id".into(), json!(format!("{rest_id};generated{local}"))); + layer.insert("type".into(), json!("TEXT")); + layer.insert("name".into(), json!(if local == 1 { chars.chars().take(40).collect::() } else { "Author".to_string() })); + self.common(&mut layer, &view, "TEXT", Affine::IDENTITY, None); + self.text(&mut layer, &view); + if let Some(Value::Object(style)) = layer.get_mut("style") { + style.insert("textAutoResize".into(), json!("HEIGHT")); + style.insert("textAlignHorizontal".into(), json!("LEFT")); + } + layer.insert("layoutSizingHorizontal".into(), json!("FILL")); + if local == 2 { + written = chars.trim().to_string(); + } + self.count += 1; + kids.push(Value::Object(layer)); + } + o.insert("board".into(), json!({"type": "sticky", "author": written})); + Some(kids) + } +} diff --git a/crates/format/src/fig/map/layer.rs b/crates/format/src/fig/map/layer.rs index e3de96368..79a786167 100644 --- a/crates/format/src/fig/map/layer.rs +++ b/crates/format/src/fig/map/layer.rs @@ -174,7 +174,9 @@ impl<'a> Mapper<'a> { // A label without a snapshot: the connector becomes a frame holding its line and its label. let connector_label = own == "CONNECTOR" && !connector_snapshot && self.connector_label_fits(&view, depth); let ty = if connector_label { "FRAME" } else { Self::mapped_type(own, &view, connector_snapshot, connector_terminal, stand)? }; - if let Some((_, what)) = stand.filter(|_| own != "TEXT_PATH") { + // A whiteboard's sticky says it imports as a frame only when it can't be a native one. + let native_sticky = self.board && own == "STICKY"; + if let Some((_, what)) = stand.filter(|_| own != "TEXT_PATH" && !native_sticky) { self.warn(format!("{} layers import as {what}", own.to_ascii_lowercase().replace('_', " "))); } if connector_snapshot { @@ -262,12 +264,18 @@ impl<'a> Mapper<'a> { }); kids.splice(0..0, connector_kids); if stand.is_some_and(|s| s.0 == "FRAME") { - if let Some(snapshot) = self.board_snapshot(&mut o, &view, own, &rest_id, depth) { + let native = if native_sticky { self.native_sticky(&mut o, &view, &rest_id, depth) } else { None }; + if let Some(native) = native { + kids.splice(0..0, native); + } else if let Some(snapshot) = self.board_snapshot(&mut o, &view, own, &rest_id, depth) { kids.splice(0..0, snapshot); } else { kids.splice(0..0, self.shape_with_text(&mut o, &view, own, &rest_id)); kids.extend(self.inner_text(&o, &view, &rest_id, own == "STICKY")); } + if native_sticky && !o.contains_key("board") { + self.warn("sticky layers import as frames with their text"); + } } if !kids.is_empty() { o.insert("children".into(), Value::Array(kids)); diff --git a/crates/format/src/rest.rs b/crates/format/src/rest.rs index 99acbab2f..681a0defa 100644 --- a/crates/format/src/rest.rs +++ b/crates/format/src/rest.rs @@ -442,6 +442,8 @@ pub(crate) struct Ctx<'a> { set_defs: BTreeMap>, /// Prototype starting points: (page, name, REST node id). flows: Vec<(NodeId, String, String)>, + /// Board connectors and labels, resolved once every layer is imported (their ends name layers). + pending_boards: Vec<(NodeId, &'a Value)>, /// Layers with prototype interactions, resolved once every layer is imported. protos: Vec<(NodeId, &'a Value)>, /// Layers that carry overlay settings (position, background, outside clicks), by REST id. @@ -478,6 +480,7 @@ impl<'a> Ctx<'a> { swap_defaults: Vec::new(), set_defs: BTreeMap::new(), flows: Vec::new(), + pending_boards: Vec::new(), protos: Vec::new(), overlay_meta: BTreeMap::new(), var_kinds: BTreeMap::new(), @@ -781,6 +784,9 @@ impl<'a> Ctx<'a> { self.overlay_meta.entry(rid).or_insert(j); } self.bindings(n, j); + if let Some(b) = j.get("board") { + self.board_item(n, b); + } let restored = j.get("outlinedStroke").is_some_and(|original| restore_stroke(n, original)); // Styles and bindings were read against the stroke: they follow its paints to the fill. if outlined && !restored { @@ -788,6 +794,32 @@ impl<'a> Ctx<'a> { } } + /// The `board` field (a FigCraft extension): what the object is on a board. A sticky or shape + /// is set at once; anything else, or junk, is ignored with a warning. + fn board_item(&mut self, n: &mut Node, b: &'a Value) { + let item = match text(b, "type") { + Some("sticky") => { + let author = text(b, "author").unwrap_or("").trim(); + Some(figcraft_doc::BoardItem::Sticky { author: author.chars().take(64).collect() }) + } + Some("shape") => text(b, "shape").and_then(figcraft_doc::BoardShape::from_id).map(|shape| figcraft_doc::BoardItem::Shape { shape }), + _ => None, + }; + match item { + Some(item) => n.board = Some(item), + None => self.warn(format!("unknown board item on {} was ignored", n.name)), + } + } + + /// Board items that name other layers (connector ends, a label's connector), once every + /// layer is imported and `ids` can resolve them. + fn resolve_boards(&mut self) { + for (id, _) in std::mem::take(&mut self.pending_boards) { + let name = self.doc.node(id).map(|n| n.name.clone()).unwrap_or_default(); + self.warn(format!("unknown board item on {name} was ignored")); + } + } + /// A vector's network: the editable one when the JSON carries it (`vectorNetwork`, or /// `vectorNetworkRef` naming one built by the `.fig` import: our extensions), else from its /// geometry. A stroke-only vector uses the stroke outline, painted with the stroke paints @@ -1096,6 +1128,7 @@ impl<'a> Ctx<'a> { } } self.resolve_instances(); + self.resolve_boards(); if let Some(sources) = self.fig_sources.take() { let missing = sources.apply(&mut self.doc, &self.ids); if missing > 0 { diff --git a/crates/format/src/rest/import_regression_tests.rs b/crates/format/src/rest/import_regression_tests.rs index 5aeb4548b..90cc4c5c3 100644 --- a/crates/format/src/rest/import_regression_tests.rs +++ b/crates/format/src/rest/import_regression_tests.rs @@ -93,3 +93,23 @@ fn thousands_of_distinct_style_references_import_in_linear_time() { assert!(start.elapsed() < std::time::Duration::from_secs(10), "{:?}", start.elapsed()); assert_eq!(doc.styles.len(), n); } + +#[test] +fn a_board_field_becomes_the_nodes_board_item() { + let frame = json!({"id": "1:1", "name": "Note", "type": "FRAME", "relativeTransform": at(0.0, 0.0), "size": {"x": 200, "y": 200}, + "board": {"type": "sticky", "author": "A"}}); + let (doc, warnings) = import(&file(json!([frame])), &no_images).unwrap(); + assert_eq!(named(&doc, "Note").board, Some(figcraft_doc::BoardItem::Sticky { author: "A".into() })); + assert!(!warnings.iter().any(|w| w.contains("board item")), "{warnings:?}"); +} + +#[test] +fn junk_board_fields_are_ignored_with_a_warning() { + for junk in [json!(5), json!({"type": "nope"}), json!({"type": "shape", "shape": "blob"}), json!({"type": "connector"})] { + let frame = + json!({"id": "1:1", "name": "Junk", "type": "FRAME", "relativeTransform": at(0.0, 0.0), "size": {"x": 20, "y": 20}, "board": junk}); + let (doc, warnings) = import(&file(json!([frame])), &no_images).unwrap(); + assert!(named(&doc, "Junk").board.is_none(), "{junk}"); + assert!(warnings.iter().any(|w| w.contains("unknown board item on Junk was ignored")), "{junk}: {warnings:?}"); + } +} diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index 625ee3bd8..43ffdcc26 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -1885,6 +1885,7 @@ name = "English" "some vector segments refer to style settings missing from the file; they use the layer's stroke" = "some vector segments refer to style settings missing from the file; they use the layer's stroke" "stale or invalid grid track sizing entries were ignored" = "stale or invalid grid track sizing entries were ignored" "stars and polygons without point counts or geometry use the default point count" = "stars and polygons without point counts or geometry use the default point count" +"sticky layers import as frames with their text" = "sticky layers import as frames with their text" "style settings of some vector segments aren't supported; those segments use the layer's stroke" = "style settings of some vector segments aren't supported; those segments use the layer's stroke" "text path underline or strikethrough decoration is not rendered" = "text path underline or strikethrough decoration is not rendered" "text style overrides refer to missing table entries" = "text style overrides refer to missing table entries" diff --git a/docs/boards-parity.md b/docs/boards-parity.md index 16456492c..dbfad16ed 100644 --- a/docs/boards-parity.md +++ b/docs/boards-parity.md @@ -1,6 +1,6 @@ # Boards parity -> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-04 · **Change:** minor (a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) +> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-10 · **Change:** minor (a `.jam` file's stickies come in as native board stickies, with their colour, text and author kept and the size as saved (#1808); a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) **Breadth ~47%, ready ~29% (estimated, erring low).** A board is a FigCraft file of its own kind (`file.newBoard`) with a dot grid on the page, sticky notes, shapes with text, connectors that @@ -66,13 +66,14 @@ all end with the same geometry. | Audio and huddles | missing | | | AI features (summaries, sorting stickies, generating boards) | missing | | | Grid on the page | done | the canvas render draws it after the page colour and before the layers (`figcraft_render::Dots`), so objects cover it. Dots by default, or lines, graph paper (a strong line every 2–12 cells over fainter ones, like Japanese section paper) or none; spacing (4–512), mark size and contrast are settings kept with the preferences (`board.grid`; Preferences ▸ Board grid). Zoomed out it thins out (dots and lines by halves, graph paper down to its strong lines) until the marks are at least 14 points apart (10 for lines), the marks the next step drops fading out first; dots stay about a point and a half across on screen (1 to 3 points), scaled by the size setting. Dark marks on a light page, light ones on a dark page, from the theme's ink; written straight into the image, no allocation per mark, a crossing of two lines blended once; never in exports. FigCraft's own settings: the incumbent's board grid has none | -| `.jam` import and export | **partial**: a `.jam` opens as a board, best effort (#1342): its stickies and shapes with text come in as frames with their generated layers and its connectors as vectors, not as native board objects (an elbowed connector keeps the path it was saved with, #1910); no export | see [`file-format-parity.md`](file-format-parity.md) | +| `.jam` import and export | **partial**: a `.jam` opens as a board, best effort (#1342): its stickies come in as native stickies (their colour, text and author kept; size as saved), its shapes with text as frames with their generated layers and its connectors as vectors, not yet as native board objects (an elbowed connector keeps the path it was saved with, #1910); no export | see [`file-format-parity.md`](file-format-parity.md) | ## Revision history | Date | Change | Summary | |---|---|---| | 2026-11-03 | minor | M12, #1919: as the quick create help says ("Click to select and create the next shape in that direction, or drag the preview to any location on your board"; "A new shape is created with a connector and its text field active"), a "+" beside the selected sticky or shape can be dragged: the preview follows the pointer and, let go on empty board, the next one is made there, centred on the pointer, and joined by a connector leaving by the handle's side and arriving by the side facing it (`board.addConnected` gains `at: [x, y]`, a point of the page placed in the parent's coordinates); let go on another sticky or shape, inside a section or frame too (`board::sticky_or_shape_at`), a connector joins the two instead (`board.connector`), that object outlined while the pointer is over it; let go off the canvas or over the toolbar, nothing, and the bar above the selection stays away meanwhile, as for any drag. The click is as before. A shape picker on drop and choosing the connector type are not done (the help doesn't describe them). Tests: `board_connect_tests` (the drag ones), engine `board_connected_tests::the_next_one_goes_where_it_is_dropped`. Numbers unchanged. | +| 2026-11-10 | minor | M9, #1808: a `.jam` sticky imports as a native board sticky (`BoardItem::Sticky`): its frame keeps the saved size (240 pt, not FigCraft's 200), place, opacity and shadows, the saved colour is kept as it is (not snapped to the board colours), the note and the author line are its text layers, and it lays out like one made here (vertical, space between, hugging the height down to the saved size, the saved inset as padding). The importer reads a `board` field on the REST JSON (a FigCraft extension) for this; a sticky whose generated records are damaged, or the same sticky in a `.fig`, keeps the generated layers as before. Shapes, connectors, stamps and tables are unchanged; the note's text keeps the file's size until it is edited. Tests: `board_import_tests.rs` (native sticky, no author, damaged records, `.fig` unchanged), `import_regression_tests.rs` (the `board` field and junk values). Numbers unchanged. | | 2026-11-04 | minor | M12, #1916: a connector end attached to a side starts 4 pt outside the border (`board_route::END_GAP`), as FigJam's do (the issue's screenshots: the line starts a few pixels outside, with a round cap), so the stroke never lies on the fill; elbows leaving one side share their first run along its normal, curves leave tangent to it and straight ones fan out from the same point; the `.jam` importer's routes, re-attached ends, path handles and labels follow the route's points; an end placed by hand with Cmd/Ctrl held keeps its exact point. Tests: `board_route_tests` (three). Numbers unchanged. | | 2026-11-04 | patch | M6, #1910: a `.jam` elbowed connector saved with its path (FigJam's `connectorControlPoints`) keeps it on import: the points become the `ConnectorPath::Runs` a connector reshaped by hand has and the line is walked along them, so a connector drawn around a layer stays around it; one whose points don't make a path from its ends' sides is routed as before. Still a vector, not a native board object. Details in [`file-format-parity.md`](file-format-parity.md). | | 2026-10-31 | minor | M12: as the help describes, holding Cmd/Ctrl while moving a connector's end places it on any part of an object instead of snapping to a side. It keeps that spot as a fraction of the object's box, so it follows the object when it moves or resizes, and without the key an end snaps as before. `board.connector {fromAt, toAt}` and `board.reattach {at}` take it; saved only when set. Numbers unchanged | diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index dd04fdf75..cd604432d 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-11-08 · **Change:** minor (`.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (`.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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 @@ -20,7 +20,7 @@ and prototype interactions are still unchecked there. | `.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; an instance scaled with the Scale tool, which stores `symbolData.uniformScaleFactor`, draws its layers at the main's lengths times that factor, composed through nested instances: sizes and places, corner radii, stroke weights and dashes, effect radii, spreads and offsets, auto layout gaps and paddings, grid gaps, min and max sizes, layout grids, font sizes, pixel line heights and letter spacings, paragraph spacing and indent, except where an override or derived row gives the value, which is already at the instance's scale; per-point vector corner radii also take their vector-data row's factor; the vector outline paths a layer carries (a network's points follow the layer's size), fixed grid tracks, image tile scales and glass effects are not scaled by the factor, #2091), 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); an elbowed one saved with its path (`connectorControlPoints`: a point and an axis per run between the first and the last) keeps that path when it leaves and arrives by the ends' sides (#1910), and a curved one's saved `connectorBezierControlPoints` are not read; 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 (an elbowed connector keeps the path it was saved with, #1910), 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 | — | +| `.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 stickies as native board stickies (their colour, text and author kept, size as saved, #1808) and generated 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 (an elbowed connector keeps the path it was saved with, #1910), 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 | — | | `.deck` (Slides) | native to other Figma products | no | no | out of scope | — | | REST API file JSON (`GET /v1/files/:key`) + local variables JSON + `images/` folder | the API's output | **yes** (`file.open`, `file.import`, CLI) | no | pages, layer tree, geometry, paints, strokes, effects, text runs, vectors, auto layout (sizing modes left out read as hug, as documented; grid track sizes from `gridColumnsSizing` / `gridRowsSizing`: px, fr, auto, `minmax(0, 1fr)`, `repeat()`), constraints, grids, components, sets, instances with overrides (sizes and resizing included), component properties, slots (`SLOT` layers bound to their slot property; an instance's slot keeps its content as the instance's own unless its property value is the main's default content; slot limits and preferred components are warnings), styles, prototyping (incl. conditionals and variable modes), variables with modes, aliases, scopes and bindings, image adjustments (the same tint sign as `.fig`); the import report after opening; warnings for what's skipped (video triggers and actions, modifier keys). Unit tests in `crates/format/src/rest/*_tests.rs` | — | | `.figcraft` (ours: zip of `document.json` + images, versions inside) | — | yes | yes | streamed JSON, 50k layers save ~0.09 s / load ~0.16 s (`cargo xtask bench`); old files keep opening (`large_tests.rs`); image members are `images/`, and a key that can't be one — path text, a space, over 128 chars — is left out with a complaint instead of loaded (`image_tests`); saves write a unique staging file and rename it into place (#284); optional auto-save of files with a path (`pref.autoSave`, #305); Save and auto-save refuse to write over a file another app (figcraft-cli, say) changed since it was opened or saved here, judged by its size and modification time: Revert to saved loads those changes, Save as keeps both, `file.save {overwrite: true}` replaces them (#1330); `kind: "board"` marks a board (left out for design files, so files from before boards are design files; the home screen reads it for the file's mark); board objects keep their `board` metadata on the layer; Developer Mode measurements are kept on the layer they start from (`measurements: [{to} | {side}]`, left out when there are none, so older files open with none) | — | @@ -201,6 +201,7 @@ scales and empty-style clears; they have not been checked in other software. | 2026-11-07 | minor | `.fig` import, #2091 item 1: an instance scaled with the Scale tool stores `symbolData.uniformScaleFactor`, which the import never read, so the layers of a 128 px instance of a 256 px component came in at 256 px with the main's radii, strokes and spacing. The layers of an instance now take the main's lengths times the factor (composed through nested instances, so 0.5 inside 0.5 is 0.25 for the inner layers), the lengths the Scale tool scales: sizes and places, corner radii, stroke weights and dashes, effect radii, spreads and offsets, auto layout gaps and paddings, grid gaps, min and max sizes, layout grids, font sizes, pixel line heights and letter spacings, paragraph spacing and indent. A value an override or derived row gives is taken as written, already at the instance's scale; the instance's own size is the file's; a missing, non-finite, non-positive or out-of-range factor (outside 0.001 to 1000) changes nothing. Not scaled: vector outline paths (a network's points follow the layer's size), per-point corner radii, fixed grid tracks, image tile scales and glass effects. Tests: `fig::tests::a_scaled_instance_draws_its_layers_at_the_factor` and `fig::scale_factor_tests`. Numbers unchanged | | 2026-11-03 | patch | M6, #1909: `.jam` import: a connector end whose magnet is `AUTO` (FigJam picks the side when it draws) or `CENTER` (the end aims at the layer's middle) left the side its stale `relativePosition` named, the left one in the reporter's file, so the connectors looped behind their shape or crossed it. It now leaves the side facing the other end, as a board connector drawn here does (`Side::Auto`), for straight, elbowed and curved connectors alike; a named magnet (`TOP`, `RIGHT`, `BOTTOM`, `LEFT`) is unchanged, and an end without a magnet still takes the edge its point lies on. The Plugin API lists the magnets (`ConnectorEndpoint.magnet`: "Which side of the node it attaches to"; NONE, AUTO, TOP, LEFT, BOTTOM, RIGHT, CENTER; "Straight connectors may use only CENTER or NONE magnets"). Test: `connectors_with_an_automatic_side_leave_the_side_facing_the_target`. Numbers unchanged. | | 2026-11-04 | minor | JPG export: `quality` (1 to 100, default 90) on `file.export`, `export.add` / `export.update` and MCP `export`, kept in the export setting; an sRGB file's JPGs embed the sRGB ICC profile, as Display P3 files' JPGs already embedded theirs, since an untagged JPG is only assumed to be sRGB (#2004). | +| 2026-11-10 | minor | M9, #1808: `.jam` import: a FigJam sticky comes in as a native board sticky. The mapper knows the canvas header (`fig-jam.`) and, for a whiteboard only, writes a `board` field (`{"type": "sticky", "author": ..}`, a FigCraft extension of the REST JSON) on a sticky whose generated records are complete (layout version 1, one visible solid background paint without strokes, a non-blank note), with the background's colour and corner radius, the file's size, place, opacity and shadows, the note and the author line as text layers and no background vector; the REST importer sets it as the layer's board item and ignores a junk `board` value with a warning. A sticky that isn't complete, or any sticky in a `.fig`, keeps the generated layers and the old note. Shapes with text, connectors, stamps and tables are unchanged. Tests: `fig::tests::board` (four), `rest::import_regression_tests` (two). | | 2026-11-04 | minor | `.fig` and `.jam` import, #1910: an elbowed connector saved with its path keeps it. FigJam stores `connectorControlPoints`, one per run between the first and the last, each a point on its run (in the connector's parent's coordinates) with the run's axis; the first run leaves the start's side and the last arrives at the end's. They become the `ConnectorPath::Runs` a board connector reshaped by hand has (`figcraft_doc::route_along`), so a connector drawn around a layer in FigJam stays around it instead of being routed through it. Points that don't make such a path (off both axes, two runs in a row the same way, a first or last run sideways to its side or going back into its object, more runs than a hand could make) leave the connector to the router as before, and only connectors routed here count in the "follow FigCraft's own routing" note. A curved connector's `connectorBezierControlPoints` are still not read. Tests: `tail_tests::an_elbow_connector_saved_with_its_path_keeps_it`, `tail_tests::an_elbow_whose_saved_path_doesnt_fit_its_sides_is_routed_here`. | | 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 | minor | Export settings: each PNG, JPG and WebP setting has a color profile, Same as file (the default; the document's profile when it exports), sRGB or Display P3, in its advanced settings and as `colorProfile` on `export.add`, `export.update`, `file.export`, `file.exportLayers` and MCP `export`. The pixels convert to the chosen profile (out-of-gamut colors clip) and the file is tagged as before: sRGB PNG with an `sRGB` chunk, Display P3 with the generated ICC profile (and `cICP` in PNG); sRGB JPG and WebP stay untagged. A setting keeps its choice when its format changes; settings saved without one read as Same as file. SVG, PDF and XML show no choice and stay sRGB (PDF has no output intent yet). Numbers unchanged | From a415598e114e67f10569bea75c197158431af419 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 09:43:30 -0500 Subject: [PATCH 111/239] .jam import: board items only on frames, authors without control characters, board items in the dump (#1808) From the pre-ready review: a sticky or shape item on a non-frame layer is ignored with the warning; the author drops control characters as board.sticky does; dump_samples writes a whiteboard's board items; a doc link made plain text. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote; Fable 5.1 reviewed --- crates/format/src/fig/map.rs | 4 ++-- crates/format/src/fig/tests.rs | 3 ++- crates/format/src/rest.rs | 10 +++++++--- crates/format/src/rest/import_regression_tests.rs | 8 +++++++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/crates/format/src/fig/map.rs b/crates/format/src/fig/map.rs index a236e1fdb..dc51f9156 100644 --- a/crates/format/src/fig/map.rs +++ b/crates/format/src/fig/map.rs @@ -56,8 +56,8 @@ pub(super) fn to_rest(msg: &Kv, name: &str, max_nodes: usize) -> (Value, Vec (Value, Vec, Vec>) { let mut m = Mapper::new(msg, max_nodes); m.board = board; diff --git a/crates/format/src/fig/tests.rs b/crates/format/src/fig/tests.rs index a8abf56fe..e024920a7 100644 --- a/crates/format/src/fig/tests.rs +++ b/crates/format/src/fig/tests.rs @@ -1583,7 +1583,8 @@ fn dump_samples() { std::fs::write(format!("{out}/{stem}.schema.txt"), txt).unwrap(); let msg = schema.decode_message(schema.find("Message").unwrap(), &message).unwrap(); std::fs::write(format!("{out}/{stem}.json"), serde_json::to_string_pretty(&debug_json(&msg)).unwrap()).unwrap(); - let (rest, ..) = map::to_rest(&msg, &stem, super::layer_budget(message.len())); + // A whiteboard's dump shows its native board items as the import makes them. + let (rest, ..) = map::to_rest_for(&msg, &stem, super::layer_budget(message.len()), a.canvas.starts_with(super::JAM_HEADER)); std::fs::write(format!("{out}/{stem}.rest.json"), serde_json::to_string_pretty(&rest).unwrap()).unwrap(); } } diff --git a/crates/format/src/rest.rs b/crates/format/src/rest.rs index 681a0defa..8797d9efa 100644 --- a/crates/format/src/rest.rs +++ b/crates/format/src/rest.rs @@ -797,12 +797,16 @@ impl<'a> Ctx<'a> { /// The `board` field (a FigCraft extension): what the object is on a board. A sticky or shape /// is set at once; anything else, or junk, is ignored with a warning. fn board_item(&mut self, n: &mut Node, b: &'a Value) { + // A sticky or shape is a frame holding its layers: on anything else it is ignored. + let frame = n.kind.is_frame_like(); let item = match text(b, "type") { - Some("sticky") => { + Some("sticky") if frame => { let author = text(b, "author").unwrap_or("").trim(); - Some(figcraft_doc::BoardItem::Sticky { author: author.chars().take(64).collect() }) + Some(figcraft_doc::BoardItem::Sticky { author: author.chars().filter(|c| !c.is_control()).take(64).collect() }) + } + Some("shape") if frame => { + text(b, "shape").and_then(figcraft_doc::BoardShape::from_id).map(|shape| figcraft_doc::BoardItem::Shape { shape }) } - Some("shape") => text(b, "shape").and_then(figcraft_doc::BoardShape::from_id).map(|shape| figcraft_doc::BoardItem::Shape { shape }), _ => None, }; match item { diff --git a/crates/format/src/rest/import_regression_tests.rs b/crates/format/src/rest/import_regression_tests.rs index 90cc4c5c3..5d5bfb48e 100644 --- a/crates/format/src/rest/import_regression_tests.rs +++ b/crates/format/src/rest/import_regression_tests.rs @@ -97,7 +97,7 @@ fn thousands_of_distinct_style_references_import_in_linear_time() { #[test] fn a_board_field_becomes_the_nodes_board_item() { let frame = json!({"id": "1:1", "name": "Note", "type": "FRAME", "relativeTransform": at(0.0, 0.0), "size": {"x": 200, "y": 200}, - "board": {"type": "sticky", "author": "A"}}); + "board": {"type": "sticky", "author": "A\u{7}"}}); let (doc, warnings) = import(&file(json!([frame])), &no_images).unwrap(); assert_eq!(named(&doc, "Note").board, Some(figcraft_doc::BoardItem::Sticky { author: "A".into() })); assert!(!warnings.iter().any(|w| w.contains("board item")), "{warnings:?}"); @@ -112,4 +112,10 @@ fn junk_board_fields_are_ignored_with_a_warning() { assert!(named(&doc, "Junk").board.is_none(), "{junk}"); assert!(warnings.iter().any(|w| w.contains("unknown board item on Junk was ignored")), "{junk}: {warnings:?}"); } + // A sticky is a frame holding its layers: on a rectangle the item is ignored. + let rect = json!({"id": "1:2", "name": "Rect", "type": "RECTANGLE", "relativeTransform": at(0.0, 0.0), "size": {"x": 20, "y": 20}, + "board": {"type": "sticky", "author": "A"}}); + let (doc, warnings) = import(&file(json!([rect])), &no_images).unwrap(); + assert!(named(&doc, "Rect").board.is_none()); + assert!(warnings.iter().any(|w| w.contains("unknown board item on Rect was ignored")), "{warnings:?}"); } From 020388cf1f9cde2a2f8ab2361abbc3003ca7106b Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 10:31:10 -0500 Subject: [PATCH 112/239] M10: Export: a background blur or glass exported on its own keeps the content behind it (#2213) An export of a layer draws only that layer, so a background blur or glass in it read an empty backdrop. The export now renders the page's layers below the first exported layer, with the margin the effects reach, as the backdrop (render_area_over), clipped to the export area; only the exported layers are drawn on top. Layers without those effects, and every other export path, are unchanged. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/cmd/file.rs | 9 ++- crates/engine/src/cmd/file/export.rs | 6 ++ crates/engine/src/export_behaviour_tests.rs | 72 +++++++++++++++++++++ crates/render/src/lib.rs | 46 +++++++++++-- docs/target-app-parity.md | 5 +- 5 files changed, 126 insertions(+), 12 deletions(-) diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rs index 0ed12b8d3..c66f1a8a9 100644 --- a/crates/engine/src/cmd/file.rs +++ b/crates/engine/src/cmd/file.rs @@ -26,8 +26,8 @@ pub(crate) use export::FORBIDDEN_FILE_NAME_CHARS; use export::add_member; pub(super) use export::export_setting; pub use export::{ - ExportJob, copy_png, drawn_layers, export_area, export_bytes, export_bytes_with, export_jobs, export_scale, exportable_layers, fig_bytes, - frames_pdf, jobs_for, penpot_bytes, safe_file_name, + ExportJob, backdrop_layers, copy_png, drawn_layers, export_area, export_bytes, export_bytes_with, export_jobs, export_scale, exportable_layers, + fig_bytes, frames_pdf, jobs_for, penpot_bytes, safe_file_name, }; use export::{export, export_frames_pdf, export_layers, pdf_bytes}; use load::font_report; @@ -408,7 +408,10 @@ pub fn export_file(doc: &Document, ids: &[NodeId], setting: &ExportSetting, scal Ok((pdf_bytes(doc, &groups, &setting.print, (!own_area).then_some(area))?, Vec::new())) } _ => { - let mut pix = figcraft_render::render_area(doc, &drawn, area, scale) + // Layers exported on their own still read the page beneath them for a background blur + // or glass (#2213); a "contents only" off export already draws the whole page. + let page = if setting.contents_only { backdrop_layers(doc, ids) } else { Vec::new() }; + let mut pix = figcraft_render::render_area_over(doc, &drawn, &page, area, scale) .ok_or_else(|| EngineError::Other("render failed (empty or too large)".into()))?; // The render is in the document's profile; the setting's profile converts the pixels // (out-of-gamut colors clip) and tags the file. diff --git a/crates/engine/src/cmd/file/export.rs b/crates/engine/src/cmd/file/export.rs index 542ee246c..0f63ea43d 100644 --- a/crates/engine/src/cmd/file/export.rs +++ b/crates/engine/src/cmd/file/export.rs @@ -55,6 +55,12 @@ pub fn drawn_layers(doc: &Document, ids: &[NodeId], setting: &ExportSetting) -> crate::cmd::edit::z_sorted(doc, &crate::cmd::edit::roots(doc, &own)) } +/// The top-level layers of the page of `ids`, bottom to top: what a background blur or glass in an +/// export of `ids` reads from (empty when `ids` are on no page). +pub fn backdrop_layers(doc: &Document, ids: &[NodeId]) -> Vec { + ids.first().and_then(|i| doc.page_of(*i)).and_then(|p| doc.node(p)).map(|p| p.children.clone()).unwrap_or_default() +} + /// The frame or group a slice sits in: None on the page or in a section. fn slice_container(doc: &Document, slice: NodeId) -> Option { let parent = doc.node(slice)?.parent?; diff --git a/crates/engine/src/export_behaviour_tests.rs b/crates/engine/src/export_behaviour_tests.rs index 1cd836784..0f2c8f3de 100644 --- a/crates/engine/src/export_behaviour_tests.rs +++ b/crates/engine/src/export_behaviour_tests.rs @@ -384,3 +384,75 @@ fn copy_as_png_svg_and_code() { let css = crate::codegen::code_for(doc, a, crate::codegen::CodeLang::Css); assert!(css.contains("background: #FF0000;"), "Copy as CSS is the layer's CSS from Inspect"); } + +/// A red square with a fill-less pane over its right part, holding `effect` (#2213). +fn pane_scene(effect: EffectKind) -> (figcraft_doc::Document, NodeId, NodeId) { + use figcraft_doc::{Document, NodeKind}; + let mut d = Document::new("blur-export"); + let page = d.first_page().unwrap(); + let under = d.create(page, NodeKind::Rectangle, "Under", 0.0, 0.0, 120.0, 120.0).unwrap(); + d.get_mut(under).unwrap().fills = vec![figcraft_color::Paint::solid(figcraft_color::Color::from_hex("E03030").unwrap())]; + let pane = d.create(page, NodeKind::Rectangle, "Glass", 60.0, 20.0, 120.0, 80.0).unwrap(); + d.get_mut(pane).unwrap().fills = vec![]; + d.get_mut(pane).unwrap().effects = vec![Effect { kind: effect, visible: true }]; + (d, under, pane) +} + +/// The PNG export of `ids` as the Export command makes it, and what the canvas draws there. +fn export_vs_canvas(d: &figcraft_doc::Document, ids: &[NodeId]) -> (image::RgbaImage, image::RgbaImage) { + let setting = figcraft_doc::ExportSetting::default(); + let page = d.first_page().unwrap(); + let area = crate::cmd::file::export_area(d, ids, &setting).unwrap(); + let canvas = figcraft_render::render_area(d, &d.get(page).unwrap().children.clone(), area, 1.0).unwrap(); + let canvas = image::RgbaImage::from_raw(canvas.width(), canvas.height(), figcraft_render::to_rgba8(&canvas)).unwrap(); + let (bytes, _) = crate::cmd::file::export_file(d, ids, &setting, 1.0).unwrap(); + (pixels(&bytes), canvas) +} + +/// #2213: a layer with a background blur exported on its own shows the same pixels as the canvas +/// shows for that area: the blur reads what lies under it, so the export must draw the layers +/// beneath it as the backdrop (clipped to the layer) rather than blurring nothing. +#[test] +fn exporting_a_background_blur_layer_keeps_the_blurred_backdrop() { + let (d, _, pane) = pane_scene(EffectKind::BackgroundBlur(figcraft_doc::Blur::uniform(12.0))); + let (exported, canvas) = export_vs_canvas(&d, &[pane]); + // The pane's left half sits over the red square, which ends at x = 120 (60 px into the pane). + assert_ne!(canvas.get_pixel(60, 40).0, [0, 0, 0, 0], "the canvas draws the blurred backdrop"); + assert_eq!(exported.get_pixel(60, 40), canvas.get_pixel(60, 40), "export lost the backdrop the blur reads"); + assert_eq!(exported.dimensions(), (120, 80), "the pane's own bounds"); +} + +/// #2213: the same for Glass. +#[test] +fn exporting_a_glass_layer_keeps_the_backdrop_it_bends() { + let (d, _, pane) = pane_scene(EffectKind::Glass(figcraft_doc::Glass::default())); + let (exported, canvas) = export_vs_canvas(&d, &[pane]); + assert_ne!(canvas.get_pixel(30, 40).0, [0, 0, 0, 0]); + assert_eq!(exported.get_pixel(30, 40), canvas.get_pixel(30, 40), "export lost the backdrop the glass reads"); + assert_eq!(exported.get_pixel(60, 40), canvas.get_pixel(60, 40)); +} + +/// Measured in Figma 2026-11-10: inside the pane's bounds the export is opaque where the backdrop +/// is (the blurred red), and the layers over the pane stay out. +#[test] +fn a_blur_export_is_opaque_inside_the_pane_and_leaves_layers_above_out() { + let (mut d, _, pane) = pane_scene(EffectKind::BackgroundBlur(figcraft_doc::Blur::uniform(12.0))); + let page = d.first_page().unwrap(); + let above = d.create(page, figcraft_doc::NodeKind::Rectangle, "Above", 0.0, 0.0, 200.0, 200.0).unwrap(); + d.get_mut(above).unwrap().fills = vec![figcraft_color::Paint::solid(figcraft_color::Color::from_hex("0000FF").unwrap())]; + let (exported, _) = export_vs_canvas(&d, &[pane]); + let left = exported.get_pixel(10, 40).0; + assert_eq!(left[3], 255, "red under the pane: opaque"); + assert!(left[0] > 150 && left[2] < 60, "red, not the blue layer above: {left:?}"); + // The far right of the pane has no square under it: nothing to read, nothing drawn. + assert_eq!(exported.get_pixel(110, 40).0[3], 0); +} + +/// Guard: a layer without backdrop effects over another still exports alone ("contents only"). +#[test] +fn a_layer_without_backdrop_effects_still_leaves_the_layers_below_out() { + let (mut d, _, pane) = pane_scene(EffectKind::BackgroundBlur(figcraft_doc::Blur::uniform(0.0))); + d.get_mut(pane).unwrap().effects.clear(); + let (exported, _) = export_vs_canvas(&d, &[pane]); + assert!(exported.pixels().all(|p| p.0 == [0, 0, 0, 0]), "a fill-less pane alone exports clear"); +} diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs index f138521ae..5bfaaed5c 100644 --- a/crates/render/src/lib.rs +++ b/crates/render/src/lib.rs @@ -266,11 +266,11 @@ fn render_one(doc: &Document, page: NodeId, view: &View, opts: &Options) -> Opti /// Render several nodes (in z-order) into an existing pixmap through `view`. pub fn render_nodes_into(doc: &Document, ids: &[NodeId], view: &View, pix: &mut Pixmap) { - nodes_into(doc, ids, view, pix, 0.0); + nodes_into(doc, ids, view, pix, 0.0, None); } /// [`render_nodes_into`] `time` seconds into animated GIFs. -fn nodes_into(doc: &Document, ids: &[NodeId], view: &View, pix: &mut Pixmap, time: f64) { +fn nodes_into(doc: &Document, ids: &[NodeId], view: &View, pix: &mut Pixmap, time: f64, under: Option<&backdrop::Under>) { let bounds = draw::Bounds::default(); let ctx = draw::Ctx { doc, @@ -282,7 +282,7 @@ fn nodes_into(doc: &Document, ids: &[NodeId], view: &View, pix: &mut Pixmap, tim lod: false, preview: false, magnified_image_pixels: false, - under: None, + under, time, bounds: &bounds, }; @@ -353,16 +353,24 @@ pub fn render_node(doc: &Document, id: NodeId, scale: f64) -> Option { /// [`render_node`] `time` seconds into animated GIFs (the presenter plays them). pub fn render_node_at(doc: &Document, id: NodeId, scale: f64, time: f64) -> Option { - area_at(doc, &[id], export_bounds(doc, id)?, scale, time) + area_at(doc, &[id], None, export_bounds(doc, id)?, scale, time) } /// Rasterise `ids` (bottom to top) over page area `b` at `scale` (export): the image starts at the /// area's top-left and its sides round up to whole pixels. `None` past 16384 pixels a side. pub fn render_area(doc: &Document, ids: &[NodeId], b: Rect, scale: f64) -> Option { - area_at(doc, ids, b, scale, 0.0) + area_at(doc, ids, None, b, scale, 0.0) } -fn area_at(doc: &Document, ids: &[NodeId], b: Rect, scale: f64, time: f64) -> Option { +/// [`render_area`] for an export of layers that sit among `page_layers` (the page's top-level +/// layers, in z-order): a background blur or glass in `ids` reads what lies under the first of +/// them on that page, clipped to the area (#2213). Only `ids` are drawn; the layers above stay +/// out. Without such an effect it is [`render_area`]. +pub fn render_area_over(doc: &Document, ids: &[NodeId], page_layers: &[NodeId], b: Rect, scale: f64) -> Option { + area_at(doc, ids, Some(page_layers), b, scale, 0.0) +} + +fn area_at(doc: &Document, ids: &[NodeId], page_layers: Option<&[NodeId]>, b: Rect, scale: f64, time: f64) -> Option { let scale = if scale.is_finite() && scale > 0.0 { scale.min(64.0) } else { 1.0 }; let w = (b.width() * scale - 1e-6).ceil().max(1.0); let h = (b.height() * scale - 1e-6).ceil().max(1.0); @@ -371,7 +379,31 @@ fn area_at(doc: &Document, ids: &[NodeId], b: Rect, scale: f64, time: f64) -> Op } let view = View { origin: (b.x0, b.y0), scale, width: w as u32, height: h as u32 }; let mut pix = new_pixmap(view.width, view.height)?; - nodes_into(doc, ids, &view, &mut pix, time); + // What the backdrop effects read: the page under the first layer, with the margin they reach. + let reach = page_layers.and_then(|_| { + ids.iter() + .flat_map(|i| doc.subtree(*i)) + .filter_map(|i| doc.node(i)) + .filter(|n| n.visible && backdrop::has_effects(n)) + .map(|n| backdrop::pad(n, scale)) + .max() + }); + let beneath = match (page_layers, ids.first(), reach) { + (Some(layers), Some(first), Some(m)) => { + let m = i32::try_from(m).unwrap_or(0); + let p = f64::from(m) / scale; + let around = View { + origin: (b.x0 - p, b.y0 - p), + scale, + width: view.width.saturating_add(m.unsigned_abs() * 2), + height: view.height.saturating_add(m.unsigned_abs() * 2), + }; + backdrop::render_beneath(doc, layers, *first, &around).map(|back| (back, m)) + } + _ => None, + }; + let under = beneath.as_ref().map(|(back, m)| backdrop::Under::new(back, (*m, *m), None)); + nodes_into(doc, ids, &view, &mut pix, time, under.as_ref()); Some(pix) } diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 031521f51..d2934aa1a 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-06 · **Change:** minor (justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (an exported layer with a background blur or glass keeps the blurred content behind it within its bounds (#2213); justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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 @@ -102,7 +102,7 @@ Breadth: does it exist. Ready: depth, correctness and fidelity for real projects | 4 | Shapes & vector | 8 | 99% | 73% | Corner radius and smoothing on boolean groups that contain rectangles; per-point caps and joins on dashed, variable-width and brush strokes; vector QA with real files (behaviour suites from the documentation, corner radius and star ratio handles, corner smoothing on polygons, stars and closed vectors, rounded vector points drawn, also beside curved segments, a cap and join per point, several handles dragged together, cut and paint bucket drags, delete and heal along the curve, a boolean group's look by operation and the miter angle landed) | 1–3 | | 5 | Paint | 7 | 90% | 71% | Video fills, wide-gamut canvas, HEIC images; plus darker in PDF (behaviour suite from the documentation, pass-through and isolating groups, clipping frames that don't isolate, plus darker, animated GIF fills, TIFF images and embedded image colour profiles landed) | 2–5 | | 6 | Strokes | 3 | 95% | 75% | Stroke QA with real files (colour styles on strokes, stroke weight and per-side weight variables, brush strokes landed, see 20) | 1–2 | -| 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 | +| 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; a background blur or glass exported on its own keeps the content behind it within its bounds, measured 2026-11-10, #2213) | 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 (typing `-`, `*`, `1.` or `1)` and a space starts one), hanging punctuation and lists, decoration style, thickness, offset, skip ink and colour landed) | 3–7 | @@ -656,6 +656,7 @@ Carried over from the ROADMAP's "Shipped so far" (2026-10-10). The test count th | 2026-11-04 | patch | M4, #1970: justified Chinese, Japanese and Korean text, written without spaces between words, aligns its right edge: the room on each line but a paragraph's last goes between its characters, each a word of its own as for line breaking ("Justify aligns the first word in each line of text to the left-most edge, and the last to the right-most edge"), wherever a line could break there, so none opens before a full stop or closing bracket, nor after an opening one. Latin text widens its spaces as before; mixed text widens both. A gap is reordered with the line's runs as a space of no width would be, so one beside a Hebrew word in Chinese text, or beside a Chinese word within that Hebrew, opens beside the word, not inside it. `figcraft_text::breaks::justify_between`, beside `break_between`, says where. Evidence: `tests::justified_ideographs_spread_the_room_between_characters` (fails on main). | | 2026-11-04 | patch | M8, #1951 (#1506 again): a path broken open by deleting a point (Delete, not Shift+Delete) is filled closed by a straight line across the gap, as an open path's fill is; joining its two ends again (the pen onto the other end, Connect, ⌘J) left the loop without the new segment, so once the points were rounded the fill and the selection outline ran straight across while the stroke followed the segment and its arcs. Joining now closes the loop through the new segment ("Click to close the path."; "You can use the Paint tool to add fills to any closed regions of a vector network."): `ops::connect` puts it into the loop whose segments are the chain between the ends, at the gap and in the loop's own order, so a hole keeps its winding whichever end was clicked first; a loop listed out of walking order is left as it was. Evidence: `vectoredit::tests::a_rounded_chamfer_made_other_ways_fills_along_its_arcs` (fails on main: the loop kept 4 of 5 segments), `a_rounded_chamfer_cut_in_the_editor_fills_along_its_arcs` (Shift+Delete, with and without a region fill), `doc::tests::a_chamfered_rectangles_rounded_fill_is_cut_at_every_point` (fill, region path and stroke agree for every loop order and segment direction of a chamfered rectangle). | | 2026-11-06 | patch | M3: glass's docs say which centre `splay` bends away from: the centre of the layer's bounds, as the reference tool's, checked side by side on a ring and an L at Splay 0% and 100% (an inner edge bends towards the hole in both). And where a glass shape gets no core: past 4M px on the desktop and 1M on the web (`MAX_SHAPE_PX`) it bends along its edge normals, so a large glass text or vector can bend differently once zoomed into, in a 2× export, or on the web. Docs only. Grade unchanged. | +| 2026-11-10 | patch | M10, #2213: a layer with a background blur or glass exported on its own includes the blurred content behind it within its bounds, as the reference tool's web app does (measured 2026-11-10: the pane's own bounds, opaque where the backdrop is, nothing outside them; layers above it stay out, "contents only" unchanged for layers without those effects); the export reads the page's layers below the exported one as its backdrop | | 2026-11-02 | minor | M3, #1885: glass bends towards its core, the shape shrunk by `depth` and the bevel, as the reference tool's: round a sharp corner the bend turns smoothly, and a thin part (a capsule, a letter's stroke) bends across itself, checked side by side on a capsule 44 units tall. Rounded rectangles work it out in closed form. A shape too big to keep whole at the zoom bends along its edge normals instead, so no render works out a core over more pixels than a kept shape holds. Tests: `glass::tests::a_sharp_corner_bends_round_towards_the_core`, `glass::tests::a_thin_part_bends_across_itself`, `glass::tests::a_shape_too_big_to_keep_bends_along_its_normals`, `glass_cut_tests::a_cut_through_the_pane_matches_the_whole_render`. Grade unchanged. | | 2026-11-02 | minor | M3, #1885: glass's light is a line on its 1-unit bevel added to the backdrop, as the reference tool's: fully where the edge faces the light, none below 0.35 of facing it, 0.6 as much on the opposite side, with a faint gradient across the curve. `splay` turns the bend from along the edge's normal towards the way away from the layer's centre and no longer widens the light, as in the reference tool. Checked side by side on synthetic files: a splay of 1 bends the backdrop towards the centre in both. Tests: `glass::tests::the_light_lies_on_the_bevel_and_the_gradient_across_the_curve`, `backdrop_tests::splay_turns_the_bend_towards_the_centre`, `glass_cut_tests::the_light_is_a_line_on_the_bevel`. Grade unchanged. | | 2026-11-02 | minor | M3, #1885: glass bends the backdrop with the reference tool's thick-lens profile (most a 1-unit bevel in from the edge, falling off as the 3.5th power of the way out of the curve to nothing `depth` further in) and splits its colours over 8 steps, red and blue 0.16 of the bend apart at 100% dispersion. Measured against the reference tool on synthetic files at 2×: the black band a pane pulls to its edge ends within 3 px of the reference tool's, and red and blue part 2.27 px at 50% dispersion and 4.66 px at 100% (2.38 and 4.69 there). Tests: `glass::tests::the_bend_follows_the_thick_lens_profile`, `glass::tests::dispersion_splits_the_channels_along_the_bend`. Grade unchanged. | From a1de7dcd2683d18f90ecfcd92fc2c31ae4c7afa2 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 11:04:49 -0500 Subject: [PATCH 113/239] M10: Export: test a blurred pane inside a frame (#2213) The reporter's case: the pane sits in a frame over another layer. Exported on its own it keeps the blurred layer beneath it and the frame's fill behind it, opaque, as on the canvas. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/engine/src/export_behaviour_tests.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/crates/engine/src/export_behaviour_tests.rs b/crates/engine/src/export_behaviour_tests.rs index 0f2c8f3de..3297b7ad3 100644 --- a/crates/engine/src/export_behaviour_tests.rs +++ b/crates/engine/src/export_behaviour_tests.rs @@ -422,6 +422,25 @@ fn exporting_a_background_blur_layer_keeps_the_blurred_backdrop() { assert_eq!(exported.dimensions(), (120, 80), "the pane's own bounds"); } +/// #2213, as reported and as measured in Figma (2026-11-10): the pane inside a frame, exported on +/// its own, keeps the frame's fill and the blurred layer beneath it, opaque. +#[test] +fn a_blurred_pane_inside_a_frame_keeps_the_frame_and_the_layer_beneath() { + use figcraft_doc::{Document, NodeKind}; + let mut d = Document::new("blur-export-frame"); + let page = d.first_page().unwrap(); + let art = d.create(page, NodeKind::Frame, "Art", 0.0, 0.0, 300.0, 200.0).unwrap(); + d.get_mut(art).unwrap().fills = vec![figcraft_color::Paint::solid(figcraft_color::Color::from_hex("FFFFFF").unwrap())]; + let under = d.create(art, NodeKind::Rectangle, "Under", 0.0, 0.0, 120.0, 120.0).unwrap(); + d.get_mut(under).unwrap().fills = vec![figcraft_color::Paint::solid(figcraft_color::Color::from_hex("E03030").unwrap())]; + let pane = d.create(art, NodeKind::Rectangle, "Glass", 60.0, 20.0, 120.0, 80.0).unwrap(); + d.get_mut(pane).unwrap().fills = vec![]; + d.get_mut(pane).unwrap().effects = vec![Effect { kind: EffectKind::BackgroundBlur(figcraft_doc::Blur::uniform(12.0)), visible: true }]; + let (exported, canvas) = export_vs_canvas(&d, &[pane]); + assert_eq!(exported.get_pixel(60, 40), canvas.get_pixel(60, 40), "the blurred square under the pane"); + assert_eq!(exported.get_pixel(100, 40).0[3], 255, "the frame's white behind the pane, opaque"); +} + /// #2213: the same for Glass. #[test] fn exporting_a_glass_layer_keeps_the_backdrop_it_bends() { From ccb33e0bbce3a858b7403643eb91ba5bc7de4332 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 12:43:24 -0500 Subject: [PATCH 114/239] M7: Text styles: bind a number variable to the weight (#2174) A text style takes a Number variable on `fontWeight` (`style.bind`): the style gets the face nearest the number and sets the `wght` axis, so static and variable fonts both follow. A bound weight and a bound face name replace each other, and the weight wins in a file carrying both. The style editor's weight menu offers number variables beside string ones, and a variable bound to a weight is Unitless in the CSS export. A number bound to a line height stays pixels, as the reference tool applies it; a test pins that. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 designed; Sonnet 5.5 wrote at medium --- ROADMAP.md | 2 +- crates/engine/src/assets/style_vars.rs | 13 ++- crates/engine/src/assets/token_roles.rs | 7 ++ crates/engine/src/cmd/styles.rs | 7 +- crates/engine/src/style_vars_tests.rs | 99 +++++++++++++++++++ crates/ui-egui/src/panels/variable_ui.rs | 26 ++++- crates/ui-egui/src/widgets/style_picker.rs | 9 +- .../ui-egui/src/widgets/style_picker/tests.rs | 45 +++++++++ docs/components-parity.md | 3 +- docs/mcp.md | 4 +- 10 files changed, 203 insertions(+), 12 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index dc6204b44..cbab3235a 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~26 points and ~162–292 h away (one Opus 5.5 agent; ~33–67 h wall-clock with 5 agents) -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** patch (the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** patch (a text style binds a number variable to its weight (#2174); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) FigCraft is a clean-room, open-source, pure-Rust reimplementation of the Figma design workflow, native on macOS, Windows, Linux and FreeBSD and in the browser, fully drivable by agents through diff --git a/crates/engine/src/assets/style_vars.rs b/crates/engine/src/assets/style_vars.rs index 13b120f7e..fc7307403 100644 --- a/crates/engine/src/assets/style_vars.rs +++ b/crates/engine/src/assets/style_vars.rs @@ -1,7 +1,8 @@ //! Variables bound inside shared styles. A style's `bound` map names fields of its own value in //! the keys a layer's bindings use (`fills//color`, `fills//stops//color`, //! `effects//`, `layoutGrids//`, a text style's `fontSize`, `lineHeight`, -//! `letterSpacing`, `fontFamily`, `fontStyle`). Each layer using the style sees those fields +//! `letterSpacing`, `fontWeight`, `fontFamily`, `fontStyle`; a number weight and a style name set the +//! same property, the weight wins). Each layer using the style sees those fields //! resolved in its own modes; the style itself stores them resolved in the default modes. use std::borrow::Cow; @@ -32,7 +33,7 @@ pub fn field_type(kind: &StyleKind, key: &str) -> Option { (StyleKind::Effect { effects }, Some((BoundList::Effects, i, field))) => effect_field_type(&effects.get(i)?.kind, field), (StyleKind::Grid { grids }, Some((BoundList::Grids, i, "size" | "count" | "gutter" | "offset"))) => grids.get(i).map(|_| Number), (StyleKind::Text { .. }, None) => match key { - "fontSize" | "lineHeight" | "letterSpacing" => Some(Number), + "fontSize" | "lineHeight" | "letterSpacing" | "fontWeight" => Some(Number), "fontFamily" | "fontStyle" => Some(String), _ => None, }, @@ -70,6 +71,7 @@ pub fn field_scopes(kind: &StyleKind, key: &str) -> Option<&'static [&'static st "letterSpacing" => &["LETTER_SPACING"], "fontFamily" => &["FONT_FAMILY"], "fontStyle" => &["FONT_STYLE"], + "fontWeight" => &["FONT_WEIGHT"], _ => return None, }, _ => return None, @@ -135,6 +137,13 @@ fn set_text_field(style: &mut TextStyle, key: &str, val: &VariableValue) { ("letterSpacing", VariableValue::Number(x)) if x.is_finite() => style.letter_spacing = LetterSpacing::Pixels(x.clamp(-10_000.0, 10_000.0)), ("fontFamily", VariableValue::String(f)) if !f.trim().is_empty() => style.font_family = f.clone(), ("fontStyle", VariableValue::String(f)) if !f.trim().is_empty() => style.font_style = f.clone(), + ("fontWeight", VariableValue::Number(x)) if x.is_finite() => { + // The face nearest the number (a static family) and the `wght` axis (a variable font). + let w = x.clamp(1.0, 1000.0); + let italic = style.italic(); + style.set_font_style(crate::cmd::props::styled_name(crate::cmd::props::weight_name(w as u16), italic)); + style.variations.insert("wght".to_string(), w); + } _ => {} } } diff --git a/crates/engine/src/assets/token_roles.rs b/crates/engine/src/assets/token_roles.rs index 3827ecbea..648897fcc 100644 --- a/crates/engine/src/assets/token_roles.rs +++ b/crates/engine/src/assets/token_roles.rs @@ -60,6 +60,13 @@ impl Roles { } } } + for st in &doc.styles { + for (field, id) in &st.bound { + if field == "fontWeight" { + roles.entry(id.clone()).or_insert(NumberRole::Unitless); + } + } + } for v in vars.iter().filter(|v| v.kind == VariableType::Number) { if let Some(r) = v.scopes.as_ref().and_then(|s| s.iter().find_map(|s| role_of_scope(s))) { roles.entry(v.id.clone()).or_insert(r); diff --git a/crates/engine/src/cmd/styles.rs b/crates/engine/src/cmd/styles.rs index 9ba420c43..ca48180ec 100644 --- a/crates/engine/src/cmd/styles.rs +++ b/crates/engine/src/cmd/styles.rs @@ -54,7 +54,7 @@ pub fn specs() -> Vec { spec!( "style.bind", "Bind variable in style", - "{style, field, variable? (id or name; none: unbind)} bind a variable to a field of the style's value: a paint style's `fills//color` (or `fill`: its first paint) and `fills//stops//color`, an effect style's `effects//` (glass: `lightAngle|lightIntensity|refraction|depth|dispersion|radius|splay`), a grid style's `layoutGrids//`, a text style's `fontSize|lineHeight|letterSpacing` (numbers, px) and `fontFamily|fontStyle` (strings). Every layer using the style shows the field resolved in its own modes; the style keeps it resolved in the default modes", + "{style, field, variable? (id or name; none: unbind)} bind a variable to a field of the style's value: a paint style's `fills//color` (or `fill`: its first paint) and `fills//stops//color`, an effect style's `effects//` (glass: `lightAngle|lightIntensity|refraction|depth|dispersion|radius|splay`), a grid style's `layoutGrids//`, a text style's `fontSize|lineHeight|letterSpacing|fontWeight` (numbers; line height and letter spacing in px, as the reference tool applies them; a weight picks the family's face nearest it and the `wght` axis of a variable font) and `fontFamily|fontStyle` (strings; a weight bound as a number replaces a bound style name and the reverse). Every layer using the style shows the field resolved in its own modes; the style keeps it resolved in the default modes", true, bind_style ), @@ -520,6 +520,11 @@ fn bind_style(s: &mut Session, p: &Value) -> Result { { rebind_paint_alpha(paints, &mut [], &key, true); } + match key.as_str() { + "fontWeight" => style.bound.remove("fontStyle"), + "fontStyle" => style.bound.remove("fontWeight"), + _ => None, + }; style.bound.insert(key, id); } None => { diff --git a/crates/engine/src/style_vars_tests.rs b/crates/engine/src/style_vars_tests.rs index 66768daa7..52fed332a 100644 --- a/crates/engine/src/style_vars_tests.rs +++ b/crates/engine/src/style_vars_tests.rs @@ -160,6 +160,7 @@ fn what_a_style_cannot_bind_is_refused() { ("fills/3/color", "bg", "no field"), ("effects/0/radius", "blur", "no field"), ("fontSize", "size", "no field"), + ("fontWeight", "bg", "no field"), ("opacity", "size", "no field"), ("fill", "nope", "no such variable"), ] { @@ -209,6 +210,7 @@ fn style_fields_offer_their_properties_scopes() { (&body, "letterSpacing", Some(&["LETTER_SPACING"][..])), (&body, "fontFamily", Some(&["FONT_FAMILY"][..])), (&body, "fontStyle", Some(&["FONT_STYLE"][..])), + (&body, "fontWeight", Some(&["FONT_WEIGHT"][..])), // Grid fields take any number variable, as on layers; fields a style lacks take none. (&grid, "layoutGrids/0/size", None), (&sid, "fills/3/color", None), @@ -244,3 +246,100 @@ fn rest_and_fig_carry_style_bindings() { assert!(got.bound.is_empty() && got.styles.fill.as_deref() == Some(st.id.as_str()), "{got:?}"); } } + +/// A text style "Body" (made from a layer, or from `value`) used by a layer in the Light frame +/// and one in the Dark one; returns (light layer, dark layer, style id). +fn body_style(s: &mut Session, value: Option) -> (NodeId, NodeId, String) { + let (_, dark, a, _, _) = two_modes(s); + let light = node(s, a).parent.unwrap(); + let text = |s: &mut Session, f: NodeId| id(run(s, "text.create", json!({"text": "Hello", "x": 0, "y": 60, "parent": f}))); + let (t1, t2) = (text(s, light), text(s, dark)); + let from = match &value { + Some(v) => json!({"type": "text", "name": "Body", "value": v}), + None => json!({"type": "text", "name": "Body", "from": t1}), + }; + let body = run(s, "style.create", from)["id"].as_str().unwrap().to_string(); + run(s, "style.apply", json!({"ids": [t1, t2], "style": body})); + (t1, t2, body) +} + +fn text_of(s: &Session, n: NodeId) -> figcraft_doc::TextStyle { + node(s, n).kind.text().unwrap().style.clone() +} + +#[test] +fn a_number_weight_picks_the_face_and_the_wght_axis() { + let mut s = Session::new(); + let (t1, t2, body) = body_style(&mut s, None); + run(&mut s, "variable.create", json!({"collection": "Theme", "name": "weight", "type": "number", "values": {"Light": 700, "Dark": 400}})); + run(&mut s, "style.bind", json!({"style": body, "field": "fontWeight", "variable": "weight"})); + let face = |s: &Session, n: NodeId| { + let t = text_of(s, n); + (t.font_style, t.variations.get("wght").copied()) + }; + assert_eq!(face(&s, t1), ("Bold".to_string(), Some(700.0))); + assert_eq!(face(&s, t2), ("Regular".to_string(), Some(400.0))); + run(&mut s, "variable.set", json!({"variable": "weight", "mode": "Dark", "value": 650})); + assert_eq!(face(&s, t2), ("Bold".to_string(), Some(650.0))); + let e = s.execute("style.bind", &json!({"style": body, "field": "fontWeight", "variable": "bg"})).unwrap_err().to_string(); + assert!(e.contains("takes a number variable"), "{e}"); + // A style name bound afterwards replaces the number binding. + run(&mut s, "variable.createCollection", json!({"name": "Names", "modes": ["Only"]})); + run(&mut s, "variable.create", json!({"collection": "Names", "name": "face", "type": "string", "values": {"Only": "Light"}})); + run(&mut s, "style.bind", json!({"style": body, "field": "fontStyle", "variable": "face"})); + let bound = s.doc().unwrap().style(&body).unwrap().bound.clone(); + assert!(bound.contains_key("fontStyle") && !bound.contains_key("fontWeight"), "{bound:?}"); +} + +#[test] +fn font_weight_wins_over_font_style_when_a_file_carries_both() { + let mut s = Session::new(); + let (t1, _, body) = body_style(&mut s, None); + run(&mut s, "variable.create", json!({"collection": "Theme", "name": "weight", "type": "number", "values": {"Light": 700, "Dark": 400}})); + run(&mut s, "variable.createCollection", json!({"name": "Names", "modes": ["Only"]})); + run(&mut s, "variable.create", json!({"collection": "Names", "name": "face", "type": "string", "values": {"Only": "Light"}})); + let doc = s.doc_mut().unwrap(); + let (w, f) = (doc.variables.get("weight").unwrap().id.clone(), doc.variables.get("face").unwrap().id.clone()); + let st = doc.styles.iter_mut().find(|x| x.id == body).unwrap(); + st.bound.insert("fontStyle".into(), f); + st.bound.insert("fontWeight".into(), w); + crate::style_vars::after_load(doc); + assert_eq!(text_of(&s, t1).font_style, "Bold"); +} + +#[test] +fn a_number_bound_to_a_percent_line_height_applies_as_pixels() { + let mut s = Session::new(); + let (t1, _, body) = body_style(&mut s, Some(json!({"fontSize": 24, "lineHeight": "150%"}))); + run(&mut s, "variable.create", json!({"collection": "Theme", "name": "lh", "type": "number", "values": {"Light": 150, "Dark": 36}})); + run(&mut s, "style.bind", json!({"style": body, "field": "lineHeight", "variable": "lh"})); + let lh = |s: &Session| match &s.doc().unwrap().style(&body).unwrap().kind { + StyleKind::Text { style, .. } => style.line_height, + k => panic!("{k:?}"), + }; + assert_eq!(lh(&s), figcraft_doc::LineHeight::Pixels(150.0)); + assert_eq!(text_of(&s, t1).line_height, figcraft_doc::LineHeight::Pixels(150.0)); + assert_eq!(node(&s, t1).height, 150.0); + run(&mut s, "variable.set", json!({"variable": "lh", "mode": "Light", "value": 36})); + assert_eq!((lh(&s), node(&s, t1).height), (figcraft_doc::LineHeight::Pixels(36.0), 36.0)); +} + +#[test] +fn a_text_style_binding_round_trips_through_fig() { + let mut s = Session::new(); + let (_, _, body) = body_style(&mut s, None); + run(&mut s, "variable.create", json!({"collection": "Theme", "name": "weight", "type": "number", "values": {"Light": 700, "Dark": 400}})); + for (field, var) in [("fontSize", "size"), ("lineHeight", "size"), ("fontWeight", "weight")] { + run(&mut s, "style.bind", json!({"style": body, "field": field, "variable": var})); + } + let doc = s.doc().unwrap().clone(); + let (bytes, warnings) = figcraft_format::fig::export(&doc, None).unwrap(); + let (mut back, _) = figcraft_format::fig::import(&bytes, "x").unwrap(); + crate::style_vars::after_load(&mut back); + let st = back.styles.iter().find(|x| x.name == "Body").unwrap(); + assert!(st.bound.contains_key("fontSize") && st.bound.contains_key("lineHeight"), "{st:?}"); + // The format has no weight field yet: the settled name comes back, not the binding (the file has no `wght` axis field yet). + assert!(warnings.iter().any(|w| w.contains("no field for")), "{warnings:?}"); + let StyleKind::Text { style, .. } = &st.kind else { panic!("{st:?}") }; + assert_eq!(style.font_style, "Bold"); +} diff --git a/crates/ui-egui/src/panels/variable_ui.rs b/crates/ui-egui/src/panels/variable_ui.rs index 53327440f..11345d13f 100644 --- a/crates/ui-egui/src/panels/variable_ui.rs +++ b/crates/ui-egui/src/panels/variable_ui.rs @@ -30,6 +30,9 @@ enum Target { Proto(crate::proto_editor::VarSlot), /// Bind it to `field` of the shared style `style`. Style { style: String, field: String }, + /// Bind it to the weight of the shared text style `style`: a string variable names the face + /// (`fontStyle`), a number one sets the weight (`fontWeight`). + StyleWeight { style: String }, } /// The open variable picker: what it does, the variable type (None: any), where it opens. @@ -197,6 +200,13 @@ pub fn open_style(ui: &Ui, style: &str, field: &str, kind: VariableType, at: Pos ui.data_mut(|d| d.insert_temp(picker_id(), Picker { target, kind: Some(kind), at })); } +/// Open the picker at `at` to bind a string (face name) or number (weight) variable to the weight of +/// the shared text style `style`. +pub fn open_style_weight(ui: &Ui, style: &str, at: Pos2) { + let target = Target::StyleWeight { style: style.to_string() }; + ui.data_mut(|d| d.insert_temp(picker_id(), Picker { target, kind: None, at })); +} + /// Where the open picker is on screen (clicks in it don't close what opened it). pub fn picker_rect(ctx: &egui::Context) -> Option { picker_open(ctx).then(|| ctx.memory(|m| m.area_rect(Id::unique("variable_picker_area")))).flatten() @@ -398,7 +408,7 @@ pub fn picker(app: &mut FigApp, ctx: &egui::Context) { let (scope, own) = match &p.target { Target::Bind { ids, field } => (ids.first().and_then(|id| figcraft_engine::cmd::variables::field_scope(&doc, *id, field)), None), Target::Alias { variable, .. } => (None, doc.variables.get_by_id(variable)), - Target::Proto(_) | Target::Style { .. } => (None, None), + Target::Proto(_) | Target::Style { .. } | Target::StyleWeight { .. } => (None, None), }; // A style's fields offer variables scoped to one of the properties the field sets. let style_scopes = match &p.target { @@ -406,7 +416,8 @@ pub fn picker(app: &mut FigApp, ctx: &egui::Context) { _ => None, }; // Prototypes and styles use this file's variables. - let local_only = matches!(p.target, Target::Proto(_) | Target::Style { .. }); + let local_only = matches!(p.target, Target::Proto(_) | Target::Style { .. } | Target::StyleWeight { .. }); + let weight_target = matches!(p.target, Target::StyleWeight { .. }); let field = match &p.target { Target::Bind { field, .. } => Some(field.as_str()), _ => None, @@ -417,6 +428,12 @@ pub fn picker(app: &mut FigApp, ctx: &egui::Context) { && (q.is_empty() || v.name.to_lowercase().contains(&q)) && scope.is_none_or(|s| v.in_scope(s)) && style_scopes.is_none_or(|list| list.iter().any(|s| v.in_scope(s))) + && (!weight_target + || match v.kind { + VariableType::String => v.in_scope("FONT_STYLE"), + VariableType::Number => v.in_scope("FONT_WEIGHT"), + _ => false, + }) && (lib.is_some() || own.is_none_or(|o| figcraft_engine::cmd::variables::alias_target(&doc.variables, o, &v.id).is_ok())) }; let groups = groups(&doc, &libs, keep); @@ -495,6 +512,11 @@ pub fn picker(app: &mut FigApp, ctx: &egui::Context) { (Target::Style { style, field }, _) => { app.run("style.bind", json!({"style": style, "field": field, "variable": pick.id})); } + (Target::StyleWeight { style }, _) => { + let number = app.session.ds().is_ok_and(|d| d.doc.variables.get_by_id(&pick.id).is_some_and(|v| v.kind == VariableType::Number)); + let field = if number { "fontWeight" } else { "fontStyle" }; + app.run("style.bind", json!({"style": style, "field": field, "variable": pick.id})); + } } close = true; } diff --git a/crates/ui-egui/src/widgets/style_picker.rs b/crates/ui-egui/src/widgets/style_picker.rs index 7c9254151..b1732984a 100644 --- a/crates/ui-egui/src/widgets/style_picker.rs +++ b/crates/ui-egui/src/widgets/style_picker.rs @@ -787,15 +787,16 @@ fn font_style_size_row(ui: &mut Ui, doc: &Document, style: &Style, def: &TextSty let id = style.id.as_str(); let mut style_resp = None; ui.horizontal(|ui| { - match bound_name(doc, style, "fontStyle") { + let weight_field = if style.bound.contains_key("fontWeight") { "fontWeight" } else { "fontStyle" }; + match bound_name(doc, style, weight_field) { Some(name) => { let (r, _) = ui.allocate_exact_size(vec2(half, widgets::FIELD_H), Sense::hover()); text_binding( ui, TextBinding { style: id, - field: "fontStyle", - kind: VariableType::String, + field: weight_field, + kind: if weight_field == "fontWeight" { VariableType::Number } else { VariableType::String }, rect: r, name: &name, lead: widgets::Lead::Named(tr("Font style")), @@ -944,7 +945,7 @@ fn font_family_menu(ui: &Ui, id: &str, def: &TextStyle, family_resp: &Response, fn font_style_menu(id: &str, def: &TextStyle, style_resp: &Response, out: &mut Frame) { crate::right::menu_popup(style_resp).width(200.0).show(|ui| { if crate::right::menu_item(ui, tr("Apply variable"), "") { - crate::variable_ui::open_style(ui, id, "fontStyle", VariableType::String, style_resp.rect.left_bottom()); + crate::variable_ui::open_style_weight(ui, id, style_resp.rect.left_bottom()); ui.close(); return; } diff --git a/crates/ui-egui/src/widgets/style_picker/tests.rs b/crates/ui-egui/src/widgets/style_picker/tests.rs index 9d14ac44a..d9e994fee 100644 --- a/crates/ui-egui/src/widgets/style_picker/tests.rs +++ b/crates/ui-egui/src/widgets/style_picker/tests.rs @@ -362,9 +362,19 @@ fn text_variables_session(bind: bool) -> crate::layers_drag_tests::Ui { ("Body tracking", "number", json!(1)), ("Body font", "string", json!("Inter")), ("Body weight", "string", json!("Bold")), + ("Body weight number", "number", json!(700)), ] { s.execute("variable.create", &json!({"collection": "Type", "name": name, "type": ty, "values": {"Base": value}})).unwrap(); } + for (name, scope) in [ + ("Body size", "FONT_SIZE"), + ("Body leading", "LINE_HEIGHT"), + ("Body tracking", "LETTER_SPACING"), + ("Body font", "FONT_FAMILY"), + ("Body weight number", "FONT_WEIGHT"), + ] { + s.execute("variable.update", &json!({"variable": name, "scopes": [scope]})).unwrap(); + } if bind { for (field, var) in [ ("fontSize", "Body size"), @@ -454,6 +464,41 @@ fn text_style_editor_shows_bound_fields_as_variables_and_detaches_them() { assert!(u.app.ui.last_error.is_none(), "{:?}", u.app.ui.last_error); } +#[test] +fn the_weight_menu_binds_a_number_variable_as_font_weight() { + let mut u = text_variables_session(false); + let left = editor_left(&mut u); + let in_editor = |u: &mut crate::layers_drag_tests::Ui| -> Vec<(String, Pos2)> { + drawn_texts(u).into_iter().filter(|(_, p)| p.x > left && p.x < left + W).collect() + }; + let texts = in_editor(&mut u); + click(&mut u, text_at(&texts, "Regular")); + let texts = drawn_texts(&mut u); + click(&mut u, text_at(&texts, "Apply variable")); + assert!(crate::variable_ui::picker_open(&u.ctx), "the variable picker opens"); + let texts = drawn_texts(&mut u); + assert!(texts.iter().any(|(t, _)| t == "Body weight"), "string variables are offered"); + assert!(!texts.iter().any(|(t, _)| t == "Body font" || t == "Body leading"), "other fields' variables are not"); + click(&mut u, text_at(&texts, "Body weight number")); + assert_eq!(bound_to(&u, "fontWeight").as_deref(), Some("Body weight number")); + assert_eq!(bound_to(&u, "fontStyle"), None); + let font_style = || { + let doc = u.app.session.doc().unwrap(); + let Some(StyleKind::Text { style: def, .. }) = doc.style("Body").map(|s| s.kind.clone()) else { panic!("a text style") }; + def.font_style + }; + assert_eq!(font_style(), "Bold"); + // The chip shows it in the style slot, and its detach button clears the weight binding. + for _ in 0..2 { + u.frame(vec![]); + } + let texts = in_editor(&mut u); + let chip = text_at(&texts, "Body weight number"); + click(&mut u, Pos2::new(left + (W - 8.0) / 2.0 - 11.0, chip.y)); + assert_eq!(bound_to(&u, "fontWeight"), None, "the weight is detached"); + assert!(u.app.ui.last_error.is_none(), "{:?}", u.app.ui.last_error); +} + #[test] fn text_style_editor_binds_variables_from_its_fields() { let mut u = text_variables_session(false); diff --git a/docs/components-parity.md b/docs/components-parity.md index 8fcaea78a..3dc1c2eeb 100644 --- a/docs/components-parity.md +++ b/docs/components-parity.md @@ -63,7 +63,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Paint, text, effect, grid styles; style picker; text styles on character ranges | done | behaviour suite: `styles_behaviour_tests.rs`; a text style carries paragraph spacing and indent, the list style and the OpenType features beside the character properties (`paragraph` next to `style` in `style.list`): applied with it, moved by `style.update`, unlinking when edited, kept by `.fig` files (#1829) | | Editing a style updates its layers; detach and delete keep values; editing a styled property unlinks that style | done | an edited fill/stroke/effect/grid list or text chars unlink; applying a style replaces variables bound to what it sets; text styles on text layers only | | Organising styles: folders by `/` names, order, duplicate, rename folder, Local styles list | done | `style.move` (into a folder renames), `style.duplicate` (right below), `style.renameFolder`; the page's Local styles list by type and folder (drag to reorder, right-click) | -| Variables inside styles (paint, effect, grid and text styles; each user resolves them in its own modes) | done | `style.bind`, `style_vars_tests`; the editor binds paint colours, shadow colours, blur radii, grid sizes and a text style's font, font style, size, line height and letter spacing, the rest through the command | +| Variables inside styles (paint, effect, grid and text styles; each user resolves them in its own modes) | done | `style.bind`, `style_vars_tests`; the editor binds paint colours, shadow colours, blur radii, grid sizes and a text style's font, font style (a face name from a string variable, or a numeric weight from a number variable, which picks the nearest face and a variable font's `wght` axis), size, line height and letter spacing, the rest through the command; a bound line height is applied in pixels, as the reference tool does (measured 2026-11-10) | | Variables: colour, number, string, boolean; collections, modes, aliases, scopes, groups | done | behaviour suite: `variables_behaviour_tests.rs`; aliases same type, no loops (also on create); colour calculations per mode (`{alpha}`: a colour variable with its alpha replaced, `{mix}`: a per-channel blend of two colour variables or literals; they compose, can't loop, and bound layers, modes and undo follow them; REST, CSS, Penpot and `.fig` exports write the colour they show in each of their collection's modes, other collections in their default modes; read-only in the panel, which can swap one for an alias or detach it; `variables_colour_tests.rs`), beyond the incumbent, whose variables only alias; scopes filter pickers only; several variables can be selected in the editor (Shift and Cmd/Ctrl click) and deleted, moved to a group or rescoped at once | | Modes: add, duplicate, rename, delete, set as default / reorder | done | layers on Auto follow a new default; explicit modes stay | | Deleting a bound variable or its collection | done | layers keep their last value and are unbound; aliases to it take its values and colour calculations reading it keep the colour they show | @@ -79,6 +79,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Date | Change | Summary | |---|---|---| +| 2026-11-10 | minor | M7, #2174: a text style binds a number variable to its weight (`style.bind {field: "fontWeight"}`): the style takes the face nearest the number and sets the `wght` axis, so static and variable fonts both follow; a face-name (string) binding and a weight binding replace each other, and the weight wins in a file carrying both. The style editor's weight menu offers number variables beside string ones. A number bound to a line height is applied in pixels, as the reference tool does, which a test now pins. Numbers unchanged. Tests: `style_vars_tests`, `style_picker::tests`. | | 2026-11-05 | minor | M3, #2002: the Local variables window selects several variables, as the Layers panel selects layers. A click selects one row, Shift+click the range from the anchor through the rows shown, Cmd/Ctrl+click toggles a row, Escape or a click on the empty space below the rows clears; selected rows use the sidebar's selected-row colour. Right-clicking a row that is part of a selection of several offers Delete, Move to group and Scope (all supported properties, hidden from pickers, or only one scope) for the selected local variables, each sent as one `command.batch`, so one undo step; no engine command changed. Renaming and value edits stay single-row. Tests: `variables_select_tests` (headless UI). Grade unchanged | | 2026-11-02 | minor | M3, #1829: text styles carry paragraph spacing and indent, the list style and the OpenType features ("Supported in text styles": "Paragraph spacing and indentation", "Lists", "OpenType features", Create and apply text styles) beside the character properties: `style.create` takes them from the layer (or the selected paragraphs' list) or from a `value` (`paragraphSpacing`, `paragraphIndent`, `listStyle`, `features`), `style.apply` sets them (on a range, the list goes to the paragraphs touched; the rest is the layer's, as in Figma), `style.update` moves them on every linked layer, editing one on a styled text unlinks it as editing its font does, the style editor lists them, and a `.fig` file keeps them with the style (its sample layer). Grade unchanged. | | 2026-11-06 | patch | M3: a glass's light angle bound to a number past ±180 turns round to the same direction (270 is -90), as the angle drawn from it does, instead of stopping at 180. Tests: `effects_tests::a_bound_light_angle_turns_round_instead_of_stopping`. Grade unchanged. | diff --git a/docs/mcp.md b/docs/mcp.md index 04b37e1f0..f7cdd4fbf 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -1867,7 +1867,9 @@ properties with their values, its code and, with `path`, a PNG of it. The docume unbinds): `fill` or `fills//color` and `fills//stops//color` on a paint style, `effects//` on an effect style, `layoutGrids//` on a grid style, `fontSize`, `lineHeight`, -`letterSpacing`, `fontFamily`, `fontStyle` on a text style. Each layer using the style shows the +`letterSpacing`, `fontWeight` (numbers; a weight picks the family's face nearest it and sets the +`wght` axis of a variable font), `fontFamily`, `fontStyle` (strings; a bound weight and a bound style +name replace each other) on a text style. Each layer using the style shows the field in its own modes and stays linked; `style.list` gives a style's `bound` map. `effect.add {ids?, type? | effect?}` adds an effect (`dropShadow`, `innerShadow`, `layerBlur`, From 281918e2f275c8461c1d1c12ea1f0b86e737ab3b Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 13:09:35 -0500 Subject: [PATCH 115/239] M7: Text styles: a face name bound after a weight clears the axis; review fixes (#2174) A style's fontStyle binding now goes through set_font_style, so it drops the stale wght axis a weight binding left behind. Also: a test and doc line for the token_roles weight role, the apply-order comment, the weight chip opening the weight picker, junk weight values pinned, fixture assertions fixed, and the ROADMAP and parity status lines. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 reviewed; Sonnet 5.5 wrote at medium --- ROADMAP.md | 2 +- crates/engine/src/assets/style_vars.rs | 4 +++- crates/engine/src/assets/token_roles.rs | 2 +- crates/engine/src/style_vars_tests.rs | 18 +++++++++++++++ crates/engine/src/variables_io_tests.rs | 13 +++++++++++ crates/ui-egui/src/widgets/style_picker.rs | 2 ++ .../ui-egui/src/widgets/style_picker/tests.rs | 23 +++++++++++++++---- docs/components-parity.md | 2 +- 8 files changed, 57 insertions(+), 9 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index cbab3235a..4d64ef3f9 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~26 points and ~162–292 h away (one Opus 5.5 agent; ~33–67 h wall-clock with 5 agents) -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** patch (a text style binds a number variable to its weight (#2174); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (a text style binds a number variable to its weight (#2174); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) FigCraft is a clean-room, open-source, pure-Rust reimplementation of the Figma design workflow, native on macOS, Windows, Linux and FreeBSD and in the browser, fully drivable by agents through diff --git a/crates/engine/src/assets/style_vars.rs b/crates/engine/src/assets/style_vars.rs index fc7307403..0c8103635 100644 --- a/crates/engine/src/assets/style_vars.rs +++ b/crates/engine/src/assets/style_vars.rs @@ -113,6 +113,8 @@ pub fn from_layer(n: &Node, field: &str, kind: &StyleKind) -> BTreeMap StyleKind { let mut kind = st.kind.clone(); + // `bound` is a BTreeMap, so `fontStyle` applies before `fontWeight` and a weight wins when a file carries both + // (pinned by `font_weight_wins_over_font_style_when_a_file_carries_both`). for (key, var) in &st.bound { let Some(val) = vars.resolve(var, modes) else { continue }; match (&mut kind, list_binding(key), &val) { @@ -136,7 +138,7 @@ fn set_text_field(style: &mut TextStyle, key: &str, val: &VariableValue) { ("lineHeight", VariableValue::Number(x)) if x.is_finite() => style.line_height = LineHeight::Pixels(x.clamp(0.0, 100_000.0)), ("letterSpacing", VariableValue::Number(x)) if x.is_finite() => style.letter_spacing = LetterSpacing::Pixels(x.clamp(-10_000.0, 10_000.0)), ("fontFamily", VariableValue::String(f)) if !f.trim().is_empty() => style.font_family = f.clone(), - ("fontStyle", VariableValue::String(f)) if !f.trim().is_empty() => style.font_style = f.clone(), + ("fontStyle", VariableValue::String(f)) if !f.trim().is_empty() => style.set_font_style(f.clone()), ("fontWeight", VariableValue::Number(x)) if x.is_finite() => { // The face nearest the number (a static family) and the `wght` axis (a variable font). let w = x.clamp(1.0, 1000.0); diff --git a/crates/engine/src/assets/token_roles.rs b/crates/engine/src/assets/token_roles.rs index 648897fcc..dca86dfd6 100644 --- a/crates/engine/src/assets/token_roles.rs +++ b/crates/engine/src/assets/token_roles.rs @@ -1,6 +1,6 @@ //! What a file's number variables measure, so exported tokens carry the right unit: a radius, //! font size, spacing or other length is in pixels, opacity and font weight are bare numbers. -//! A number's role comes from the layer fields bound to it, else its scopes, and an alias target +//! A number's role comes from the layer fields bound to it (and a text style's weight), else its scopes, and an alias target //! with no role of its own takes the role of the variables that read it (the target of an opacity //! alias stays unitless). A number nothing tells about is a length: design tokens mostly are. diff --git a/crates/engine/src/style_vars_tests.rs b/crates/engine/src/style_vars_tests.rs index 52fed332a..536b27f6b 100644 --- a/crates/engine/src/style_vars_tests.rs +++ b/crates/engine/src/style_vars_tests.rs @@ -289,6 +289,24 @@ fn a_number_weight_picks_the_face_and_the_wght_axis() { run(&mut s, "style.bind", json!({"style": body, "field": "fontStyle", "variable": "face"})); let bound = s.doc().unwrap().style(&body).unwrap().bound.clone(); assert!(bound.contains_key("fontStyle") && !bound.contains_key("fontWeight"), "{bound:?}"); + // The name replaces the number's weight: no stale `wght` axis keeps drawing 700. + assert_eq!(face(&s, t1), ("Light".to_string(), None)); + assert_eq!(text_of(&s, t1).weight(), 300); +} + +#[test] +fn junk_weight_values_clamp_to_the_lightest_and_heaviest_face() { + let mut s = Session::new(); + let (t1, _, body) = body_style(&mut s, None); + run(&mut s, "variable.create", json!({"collection": "Theme", "name": "weight", "type": "number", "values": {"Light": -50, "Dark": 5000}})); + run(&mut s, "style.bind", json!({"style": body, "field": "fontWeight", "variable": "weight"})); + let face = |s: &Session| { + let t = text_of(s, t1); + (t.font_style, t.variations.get("wght").copied()) + }; + assert_eq!(face(&s), ("Thin".to_string(), Some(1.0))); + run(&mut s, "variable.set", json!({"variable": "weight", "mode": "Light", "value": 5000})); + assert_eq!(face(&s), ("Black".to_string(), Some(1000.0))); } #[test] diff --git a/crates/engine/src/variables_io_tests.rs b/crates/engine/src/variables_io_tests.rs index eba692802..fc032d007 100644 --- a/crates/engine/src/variables_io_tests.rs +++ b/crates/engine/src/variables_io_tests.rs @@ -562,6 +562,19 @@ fn css_export_gives_lengths_a_unit_and_keeps_opacity_bare() { assert!(css.contains("--card: 12px;") && css.contains("--fade: 0.5;") && css.contains("--half: 0.5;"), "{css}"); } +#[test] +fn css_export_keeps_a_style_weight_bare() { + let mut s = Session::new(); + ex(&mut s, "variable.createCollection", json!({"name": "Brand"})); + ex(&mut s, "variable.create", json!({"collection": "Brand", "name": "weight", "type": "number", "value": 700})); + let t = idv(&ex(&mut s, "text.create", json!({"text": "Hi", "x": 0, "y": 0}))); + let st = ex(&mut s, "style.create", json!({"type": "text", "name": "Body", "from": t}))["id"].as_str().unwrap_or_default().to_string(); + ex(&mut s, "style.bind", json!({"style": st, "field": "fontWeight", "variable": "weight"})); + let css = ex(&mut s, "variable.export", json!({"format": "css"}))["text"].as_str().unwrap_or_default().to_string(); + // A weight bound only to a text style is still a bare number, not a length. + assert!(css.contains("--weight: 700;") && !css.contains("700px"), "{css}"); +} + #[test] fn review_a_long_alias_chain_keeps_its_role_to_the_end() { let mut s = Session::new(); diff --git a/crates/ui-egui/src/widgets/style_picker.rs b/crates/ui-egui/src/widgets/style_picker.rs index b1732984a..bf1692dd5 100644 --- a/crates/ui-egui/src/widgets/style_picker.rs +++ b/crates/ui-egui/src/widgets/style_picker.rs @@ -726,6 +726,8 @@ struct TextBinding<'a> { fn text_binding(ui: &mut Ui, binding: TextBinding<'_>, out: &mut Frame) { let TextBinding { style, field, kind, rect, name, lead } = binding; match widgets::bound_field(ui, Id::unique(("ts_bound", style, field)), lead, rect, name) { + // The weight slot takes a face name or a number, so its chip opens the picker that offers both. + Some(widgets::BindEvent::Open(at)) if matches!(field, "fontWeight" | "fontStyle") => crate::variable_ui::open_style_weight(ui, style, at), Some(widgets::BindEvent::Open(at)) => crate::variable_ui::open_style(ui, style, field, kind, at), Some(widgets::BindEvent::Detach) => out.act = Some(Act::Unbind(style.to_string(), field.to_string())), None => {} diff --git a/crates/ui-egui/src/widgets/style_picker/tests.rs b/crates/ui-egui/src/widgets/style_picker/tests.rs index d9e994fee..984f6c8d4 100644 --- a/crates/ui-egui/src/widgets/style_picker/tests.rs +++ b/crates/ui-egui/src/widgets/style_picker/tests.rs @@ -488,14 +488,27 @@ fn the_weight_menu_binds_a_number_variable_as_font_weight() { def.font_style }; assert_eq!(font_style(), "Bold"); - // The chip shows it in the style slot, and its detach button clears the weight binding. + // The chip shows it in the style slot; clicking it lists the string variable too, and picking that + // replaces the number: fontStyle is bound and fontWeight is not. for _ in 0..2 { u.frame(vec![]); } let texts = in_editor(&mut u); - let chip = text_at(&texts, "Body weight number"); + click(&mut u, text_at(&texts, "Body weight number")); + assert!(crate::variable_ui::picker_open(&u.ctx), "the chip opens the weight picker"); + let texts = drawn_texts(&mut u); + assert!(texts.iter().any(|(t, _)| t == "Body weight"), "the string variable is offered beside the number one"); + click(&mut u, text_at(&texts, "Body weight")); + assert_eq!(bound_to(&u, "fontStyle").as_deref(), Some("Body weight")); + assert_eq!(bound_to(&u, "fontWeight"), None, "the name replaced the number"); + // The chip's detach button clears the binding. + for _ in 0..2 { + u.frame(vec![]); + } + let texts = in_editor(&mut u); + let chip = text_at(&texts, "Body weight"); click(&mut u, Pos2::new(left + (W - 8.0) / 2.0 - 11.0, chip.y)); - assert_eq!(bound_to(&u, "fontWeight"), None, "the weight is detached"); + assert_eq!(bound_to(&u, "fontStyle"), None, "the face name is detached"); assert!(u.app.ui.last_error.is_none(), "{:?}", u.app.ui.last_error); } @@ -522,7 +535,7 @@ fn text_style_editor_binds_variables_from_its_fields() { click(&mut u, Pos2::new(x, y)); assert!(crate::variable_ui::picker_open(&u.ctx), "{field}: the variable picker opens"); let texts = drawn_texts(&mut u); - assert!(!texts.iter().any(|(t, _)| t == "Body font"), "{field} offers number variables only"); + assert!(!texts.iter().any(|(t, _)| t == "Body weight"), "{field} offers number variables only"); click(&mut u, text_at(&texts, name)); assert_eq!(bound_to(&u, field).as_deref(), Some(name)); } @@ -536,7 +549,7 @@ fn text_style_editor_binds_variables_from_its_fields() { assert!(crate::variable_ui::picker_open(&u.ctx), "{field}: the variable picker opens"); let texts = drawn_texts(&mut u); // "Body size" shows once, on the size field's chip: the picker doesn't list it. - assert_eq!(texts.iter().filter(|(t, _)| t == "Body size").count(), 1, "{field} offers string variables only"); + assert_eq!(texts.iter().filter(|(t, _)| t == "Body size").count(), 1, "{field} does not offer the size variable"); click(&mut u, text_at(&texts, name)); assert_eq!(bound_to(&u, field).as_deref(), Some(name)); } diff --git a/docs/components-parity.md b/docs/components-parity.md index 3dc1c2eeb..3f5f78d4f 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-11-06 · **Change:** minor (the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (a text style binds a number variable to its weight (#2174); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; 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 From c48d844d2258613a55bd6fe9ef1c8254c1fcfade Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 13:11:56 -0500 Subject: [PATCH 116/239] M4: round the sharp corners of a closed path (pathops, #2222) Add figcraft_pathops::round_corners(path, radius, smoothing): every vertex of a closed subpath that is still sharp rounds with a circular arc, convex and concave alike. The sweep's noise is cleaned first (short pieces welded, straight runs merged), smooth joins are not corners, and a corner shrinks to what the edges beside it can hold (half an edge when both ends round, the whole piece beside a smooth join). Corners between straight edges use smoothed_corner; corners beside a curve cut both sides and join them with one cubic. A subpath with nothing to round comes back unchanged. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 designed; Sonnet 5.5 wrote at medium --- crates/pathops/src/lib.rs | 6 + crates/pathops/src/round.rs | 312 ++++++++++++++++++++++++++++++ crates/pathops/src/round_tests.rs | 238 +++++++++++++++++++++++ 3 files changed, 556 insertions(+) create mode 100644 crates/pathops/src/round.rs create mode 100644 crates/pathops/src/round_tests.rs diff --git a/crates/pathops/src/lib.rs b/crates/pathops/src/lib.rs index c24a22248..86f8764c4 100644 --- a/crates/pathops/src/lib.rs +++ b/crates/pathops/src/lib.rs @@ -4,6 +4,8 @@ //! sweep-line topology from `linesweeper`); results use the even-odd rule. //! - [`stroke_outline`]: a stroke as a fill, with Figma's Inside / Center / Outside alignment, //! dashes, caps, joins, arrowheads, variable width profiles ([`width`]) and brushes ([`brush`]). +//! - [`round_corners`]: a corner radius (and smoothing) on every corner still sharp in a closed path, +//! as a boolean group draws its result. //! //! Every sweep is capped ([`MAX_SEGMENTS`], [`MAX_CROSSINGS`], and [`MAX_FOLD_SEGMENTS`] over a //! fold): past the caps an operation is refused with [`PathOpsError::TooComplex`]. @@ -24,6 +26,9 @@ mod dot_dash_tests; #[cfg(test)] mod ops_tests; mod points; +mod round; +#[cfg(test)] +mod round_tests; #[cfg(test)] mod rounded_side_strokes_tests; #[cfg(test)] @@ -36,6 +41,7 @@ use figcraft_doc::{BoolOp, StrokeAlign, StrokeCap, StrokeJoin, StrokeProps, Vect use figcraft_geom::kurbo::{self, BezPath, Cap, Join, PathEl, PathSeg, Point, Shape, Vec2}; pub use budget::{Complexity, FoldBudget, MAX_CROSSINGS, MAX_FOLD_SEGMENTS, MAX_SEGMENTS, complexity}; +pub use round::round_corners; #[derive(Debug, PartialEq)] pub enum PathOpsError { diff --git a/crates/pathops/src/round.rs b/crates/pathops/src/round.rs new file mode 100644 index 000000000..40ab03759 --- /dev/null +++ b/crates/pathops/src/round.rs @@ -0,0 +1,312 @@ +//! A corner radius on a closed path: every vertex that is still sharp rounds with a circular arc, +//! convex and concave alike, the way a boolean group draws its result. +//! +//! What a sweep hands back is noisy: straight edges split at collinear points, pieces a hair long, +//! one real corner cut into two half turns. So each subpath is cleaned first ([`clean`]), then each +//! vertex is judged by the turn it makes, and a corner that does not fit shrinks to what the edges +//! beside it can hold ([`Ctx::corner`]). + +use figcraft_geom::kurbo::{BezPath, CubicBez, ParamCurve, ParamCurveArclen, ParamCurveDeriv, PathEl, PathSeg, Point, Shape, Vec2}; +use std::f64::consts::PI; + +/// The smallest turn (radians) that counts as a corner. The sweep moves end points by up to its +/// own 1e-6 accuracy, which can tilt a short piece by more than 1e-6 rad. +const SHARP_TURN: f64 = 1e-3; +/// Accuracy of arc length measurements. +const ACC: f64 = 1e-6; + +#[derive(Clone, Copy)] +enum Seg { + Line(Point, Point), + Cubic(CubicBez), +} + +impl Seg { + fn start(&self) -> Point { + match self { + Self::Line(a, _) => *a, + Self::Cubic(c) => c.p0, + } + } + + fn end(&self) -> Point { + match self { + Self::Line(_, b) => *b, + Self::Cubic(c) => c.p3, + } + } + + fn set_start(&mut self, p: Point) { + match self { + Self::Line(a, _) => *a = p, + Self::Cubic(c) => c.p0 = p, + } + } + + fn is_line(&self) -> bool { + matches!(self, Self::Line(..)) + } + + /// As a cubic (a line gets its handles at the thirds). + fn cubic(&self) -> CubicBez { + match self { + Self::Line(a, b) => CubicBez::new(*a, a.lerp(*b, 1.0 / 3.0), a.lerp(*b, 2.0 / 3.0), *b), + Self::Cubic(c) => *c, + } + } + + fn len(&self) -> f64 { + match self { + Self::Line(a, b) => (*b - *a).hypot(), + Self::Cubic(c) => c.arclen(ACC), + } + } + + /// The length of the control polygon: cheap, and zero only for a point. + fn span(&self) -> f64 { + let c = self.cubic(); + (c.p1 - c.p0).hypot() + (c.p2 - c.p1).hypot() + (c.p3 - c.p2).hypot() + } + + /// The cubic leaving the start of the segment, or (`from_start` false) leaving its end. + fn outward(&self, from_start: bool) -> CubicBez { + let c = self.cubic(); + if from_start { c } else { CubicBez::new(c.p3, c.p2, c.p1, c.p0) } + } +} + +/// Unit direction in which `c` leaves its start (skipping coincident handles). +fn start_dir(c: &CubicBez) -> Option { + [c.p1, c.p2, c.p3].into_iter().map(|p| p - c.p0).find(|d| d.hypot() > 1e-9).map(|d| d / d.hypot()) +} + +/// The point `t` along `c` from its start, the unit direction back toward the start there, and the +/// parameter reached. +fn trim(c: &CubicBez, t: f64, line: bool, len: f64) -> Option<(Point, Vec2, f64)> { + if line { + if !len.is_finite() || len <= 0.0 { + return None; + } + let u = (c.p3 - c.p0) / len; + return Some((c.p0 + u * t, -u, t / len)); + } + let k = c.inv_arclen(t, ACC).clamp(0.0, 1.0); + let d = c.deriv().eval(k).to_vec2(); + let back = if d.hypot() > 1e-9 { -d / d.hypot() } else { -start_dir(c)? }; + Some((c.eval(k), back, k)) +} + +/// One rounded corner: the curves from the cut on the incoming segment to the cut on the outgoing +/// one, and where those cuts sit on their segments (each segment's own parameter). +struct Corner { + curves: Vec, + t_in: f64, + t_out: f64, +} + +/// `path` with every corner still sharp rounded by `radius` (and corner `smoothing`, 0..=1, between +/// straight edges). A corner shrinks to what its edges can hold: two corners wanting more than +/// half an edge share it half and half, a corner whose far end is smooth may use all of it. A +/// closed subpath with no sharp corner, an open one, and a path with a bad radius or coordinates +/// come back as they are. +pub fn round_corners(path: &BezPath, radius: f64, smoothing: f64) -> BezPath { + if !(radius.is_finite() && radius > 0.0) || path.elements().is_empty() || !crate::finite(path) { + return path.clone(); + } + let smoothing = if smoothing.is_finite() { smoothing.clamp(0.0, 1.0) } else { 0.0 }; + let bb = path.bounding_box(); + let weld = (bb.width().max(bb.height()) * 1e-6).max(1e-9); + let mut out = BezPath::new(); + for sub in figcraft_geom::split_subpaths(path) { + let closed = matches!(sub.elements().last(), Some(PathEl::ClosePath)); + match closed.then(|| round_subpath(&sub, radius, smoothing, weld)).flatten() { + Some(p) => out.extend(p.elements().iter().copied()), + None => out.extend(sub.elements().iter().copied()), + } + } + out +} + +/// The segments of a closed subpath without the sweep's noise: pieces shorter than `weld` dropped, +/// each segment starting where the one before ends, and straight runs merged into one line. +fn clean(sub: &BezPath, weld: f64) -> Vec { + let mut segs: Vec = sub + .segments() + .map(|s| match s { + PathSeg::Line(l) => Seg::Line(l.p0, l.p1), + other => Seg::Cubic(other.to_cubic()), + }) + .filter(|s| s.span() >= weld) + .collect(); + let n = segs.len(); + for i in 0..n { + let prev_end = segs.get((i + n - 1) % n).map(Seg::end); + if let (Some(p), Some(s)) = (prev_end, segs.get_mut(i)) { + s.set_start(p); + } + } + merge_runs(segs, weld) +} + +/// Two lines A-B and B-C become A-C when B lies within `weld` of that line and between A and C +/// (a distance test, so a long edge with a real slight kink is not straightened). Cyclic. +fn merge_runs(segs: Vec, weld: f64) -> Vec { + let mergeable = |a: &Seg, b: &Seg| match (a, b) { + (Seg::Line(p, q), Seg::Line(_, r)) => { + let (d, e) = (*r - *p, *q - *p); + let l = d.hypot(); + l > 1e-12 && (d.cross(e) / l).abs() <= weld && e.dot(*r - *q) > 0.0 + } + _ => false, + }; + let mut merged: Vec = Vec::with_capacity(segs.len()); + for s in segs { + match merged.last_mut() { + Some(last) if mergeable(last, &s) => *last = Seg::Line(last.start(), s.end()), + _ => merged.push(s), + } + } + while merged.len() > 2 { + let (Some(first), Some(last)) = (merged.first().copied(), merged.last().copied()) else { break }; + if !mergeable(&last, &first) { + break; + } + if let Some(f) = merged.first_mut() { + *f = Seg::Line(last.start(), first.end()); + } + merged.pop(); + } + merged +} + +/// Everything the corner of one vertex needs. Vertex `i` is where segment `i - 1` ends and +/// segment `i` starts. +struct Ctx<'a> { + segs: &'a [Seg], + /// Segment lengths, measured only for segments with a corner at one end. + lens: &'a [Option], + /// Per vertex: the turn between its segments and the length it wants along each of them. + wants: &'a [Option<(f64, f64)>], + radius: f64, + smoothing: f64, + weld: f64, +} + +/// The angle between the segments at each vertex (pi is straight on, 0 folded back) and the +/// length a corner there wants along each; `None` where the vertex is not a corner. +fn wants(segs: &[Seg], radius: f64, smoothing: f64) -> Vec> { + let n = segs.len(); + (0..n) + .map(|i| { + let (a, b) = (segs.get((i + n - 1) % n)?, segs.get(i)?); + let (u1, u2) = (start_dir(&a.outward(false))?, start_dir(&b.outward(true))?); + let angle = u1.dot(u2).clamp(-1.0, 1.0).acos(); + if angle < 1e-6 || PI - angle < SHARP_TURN { + return None; + } + let t = radius / (angle / 2.0).tan(); + let want = if a.is_line() && b.is_line() { (1.0 + smoothing) * t } else { t }; + want.is_finite().then_some((angle, want)) + }) + .collect() +} + +impl Ctx<'_> { + fn want(&self, i: usize) -> f64 { + self.wants.get(i % self.segs.len().max(1)).copied().flatten().map_or(0.0, |(_, w)| w) + } + + /// What a corner may use of a segment of `len`: half of it, or what the corner at its other + /// end leaves, whichever is more. + fn room(len: f64, other: f64) -> f64 { + (len / 2.0).max(len - other) + } + + fn corner(&self, i: usize) -> Option { + let n = self.segs.len(); + let (angle, _) = self.wants.get(i).copied().flatten()?; + let prev = (i + n - 1) % n; + let (a, b) = (self.segs.get(prev)?, self.segs.get(i)?); + let (la, lb) = (self.lens.get(prev).copied().flatten()?, self.lens.get(i).copied().flatten()?); + let room = Self::room(la, self.want(prev)).min(Self::room(lb, self.want(i + 1))); + if !room.is_finite() || room <= self.weld { + return None; + } + let (c1, c2) = (a.outward(false), b.outward(true)); + if a.is_line() && b.is_line() { + self.between_lines(&c1, &c2, room, (la, lb)) + } else { + self.beside_curve((&c1, a.is_line(), la), (&c2, b.is_line(), lb), room, angle) + } + } + + fn between_lines(&self, c1: &CubicBez, c2: &CubicBez, room: f64, (la, lb): (f64, f64)) -> Option { + let (u1, u2) = (start_dir(c1)?, start_dir(c2)?); + let curves = figcraft_geom::smoothed_corner(c1.p0, u1, u2, room, self.radius, self.smoothing)?; + let (first, last) = (curves.first()?, curves.last()?); + let (t_in, t_out) = (1.0 - (first.p0 - c1.p0).hypot() / la, (last.p3 - c1.p0).hypot() / lb); + (t_in.is_finite() && t_out.is_finite() && curves.iter().all(|c| [c.p0, c.p1, c.p2, c.p3].iter().all(|p| p.x.is_finite() && p.y.is_finite()))) + .then_some(Corner { curves, t_in, t_out }) + } + + /// One cubic between the cuts on both sides, its handles along each side's direction at its cut. + fn beside_curve( + &self, + (c1, line1, la): (&CubicBez, bool, f64), + (c2, line2, lb): (&CubicBez, bool, f64), + room: f64, + angle: f64, + ) -> Option { + let t = (self.radius / (angle / 2.0).tan()).min(room); + let ((p, d1, k1), (q, d2, k2)) = (trim(c1, t, line1, la)?, trim(c2, t, line2, lb)?); + let turn = (-d1.dot(d2)).clamp(-1.0, 1.0).acos(); + let chord = (q - p).hypot(); + let k = if turn < 1e-9 { chord / 3.0 } else { 4.0 / 3.0 * (turn / 4.0).tan() * chord / (2.0 * (turn / 2.0).sin()) }; + let ok = k.is_finite() && [p, q].iter().all(|x| x.x.is_finite() && x.y.is_finite()); + ok.then(|| Corner { curves: vec![CubicBez::new(p, p + d1 * k, q + d2 * k, q)], t_in: 1.0 - k1, t_out: k2 }) + } +} + +/// The subpath with its corners rounded, or `None` when no vertex of it is a corner that rounds +/// (the caller keeps the subpath exactly as it came in). +fn round_subpath(sub: &BezPath, radius: f64, smoothing: f64, weld: f64) -> Option { + let segs = clean(sub, weld); + let n = segs.len(); + if n < 2 { + return None; + } + let wants = wants(&segs, radius, smoothing); + let touches = |i: usize| wants.get(i).is_some_and(Option::is_some) || wants.get((i + 1) % n).is_some_and(Option::is_some); + let lens: Vec> = segs.iter().enumerate().map(|(i, s)| touches(i).then(|| s.len())).collect(); + let ctx = Ctx { segs: &segs, lens: &lens, wants: &wants, radius, smoothing, weld }; + let corners: Vec> = (0..n).map(|i| ctx.corner(i)).collect(); + corners.iter().any(Option::is_some).then(|| emit(&segs, &corners))? +} + +/// Walk the segments: what is left of each between the corner at its start and the one at its +/// end, then the next corner's curves. +fn emit(segs: &[Seg], corners: &[Option]) -> Option { + let n = segs.len(); + let mut out = BezPath::new(); + let first = segs.first()?; + out.move_to(corners.first().and_then(Option::as_ref).and_then(|c| c.curves.last()).map_or(first.start(), |c| c.p3)); + for (i, seg) in segs.iter().enumerate() { + let next = corners.get((i + 1) % n).and_then(Option::as_ref); + let t0 = corners.get(i).and_then(Option::as_ref).map_or(0.0, |c| c.t_out); + let t1 = next.map_or(1.0, |c| c.t_in); + if t1 - t0 > 1e-9 { + match seg { + Seg::Line(a, b) => out.line_to(a.lerp(*b, t1)), + Seg::Cubic(c) => { + let q = c.subsegment(t0..t1); + out.curve_to(q.p1, q.p2, q.p3); + } + } + } + for c in next.iter().flat_map(|c| c.curves.iter()) { + out.curve_to(c.p1, c.p2, c.p3); + } + } + out.close_path(); + crate::finite(&out).then_some(out) +} diff --git a/crates/pathops/src/round_tests.rs b/crates/pathops/src/round_tests.rs new file mode 100644 index 000000000..eda74b464 --- /dev/null +++ b/crates/pathops/src/round_tests.rs @@ -0,0 +1,238 @@ +//! `round_corners`: every sharp corner of a closed path, convex or concave, rounds with a circular +//! arc; smooth joins and straight-run leftovers of the sweep do not count; a radius larger than the +//! edges allow shrinks to fit. + +use figcraft_doc::BoolOp; +use figcraft_geom::kurbo::{Affine, BezPath, PathEl, PathSeg, Point, Shape, Vec2}; +use figcraft_geom::{ellipse, rounded_rect, split_subpaths}; + +use crate::{boolean, boolean_step, round_corners}; + +fn rect(x: f64, y: f64, w: f64, h: f64) -> BezPath { + kurbo_rect(x, y, w, h).to_path(0.1) +} + +fn kurbo_rect(x: f64, y: f64, w: f64, h: f64) -> figcraft_geom::Rect { + figcraft_geom::Rect::new(x, y, x + w, y + h) +} + +fn l_shape() -> BezPath { + boolean(&[rect(0.0, 0.0, 200.0, 100.0), rect(150.0, 0.0, 100.0, 200.0)], BoolOp::Union).unwrap() +} + +/// A (200 by 100, radius 10) with a 100 square cut out of its top edge: the notch of the measurement. +fn notch() -> BezPath { + let a = rounded_rect(200.0, 100.0, [10.0; 4], 0.0); + boolean_step(&a, &rect(50.0, -50.0, 100.0, 100.0), BoolOp::Subtract).unwrap() +} + +/// Every `CurveTo` as `[from, c1, c2, to]`. +fn arcs(path: &BezPath) -> Vec<[Point; 4]> { + let mut cur = Point::ZERO; + let mut out = Vec::new(); + for el in path.elements() { + match *el { + PathEl::MoveTo(p) | PathEl::LineTo(p) => cur = p, + PathEl::CurveTo(a, b, c) => { + out.push([cur, a, b, c]); + cur = c; + } + _ => {} + } + } + out +} + +fn near(a: Point, b: Point) -> bool { + (a - b).hypot() < 1e-3 +} + +fn pt(x: f64, y: f64) -> Point { + Point::new(x, y) +} + +/// Some curve runs through exactly these four points, in either direction. +fn has_arc(path: &BezPath, want: [(f64, f64); 4]) -> bool { + let w = want.map(|(x, y)| pt(x, y)); + let rev = [w[3], w[2], w[1], w[0]]; + arcs(path).iter().any(|a| a.iter().zip(w).all(|(p, q)| near(*p, q)) || a.iter().zip(rev).all(|(p, q)| near(*p, q))) +} + +/// Some curve joins these two end points, in either direction. +fn has_arc_between(path: &BezPath, from: (f64, f64), to: (f64, f64)) -> bool { + let (f, t) = (pt(from.0, from.1), pt(to.0, to.1)); + arcs(path).iter().any(|a| (near(a[0], f) && near(a[3], t)) || (near(a[0], t) && near(a[3], f))) +} + +fn passes_through(path: &BezPath, p: Point) -> bool { + path.elements().iter().any(|el| match el { + PathEl::MoveTo(q) | PathEl::LineTo(q) | PathEl::CurveTo(_, _, q) => near(*q, p), + _ => false, + }) +} + +fn unit(v: Vec2) -> Option { + (v.hypot() > 1e-9).then(|| v / v.hypot()) +} + +fn start_dir(s: PathSeg) -> Option { + let c = s.to_cubic(); + [c.p1, c.p2, c.p3].into_iter().find_map(|p| unit(p - c.p0)) +} + +fn end_dir(s: PathSeg) -> Option { + let c = s.to_cubic(); + [c.p2, c.p1, c.p0].into_iter().find_map(|p| unit(c.p3 - p)) +} + +/// The largest direction change at any vertex of a closed subpath, in radians. +fn sharpest_turn(path: &BezPath) -> f64 { + let mut worst: f64 = 0.0; + for sub in split_subpaths(path) { + let segs: Vec = sub.segments().collect(); + for (i, s) in segs.iter().enumerate() { + let next = segs[(i + 1) % segs.len()]; + if let (Some(a), Some(b)) = (end_dir(*s), start_dir(next)) { + worst = worst.max(a.dot(b).clamp(-1.0, 1.0).acos()); + } + } + } + worst +} + +fn area(p: &BezPath) -> f64 { + p.area().abs() +} + +fn all_finite(p: &BezPath) -> bool { + crate::finite(p) +} + +#[test] +fn every_sharp_corner_of_the_result_rounds_convex_and_concave() { + let r = round_corners(&l_shape(), 20.0, 0.0); + assert_eq!(arcs(&r).len(), 6); + assert!(has_arc(&r, [(230.0, 0.0), (241.046, 0.0), (250.0, 8.95431), (250.0, 20.0)])); + assert!(has_arc(&r, [(150.0, 120.0), (150.0, 108.954), (141.046, 100.0), (130.0, 100.0)])); + assert!((area(&r) - (35000.0 - 4.0 * 85.84)).abs() < 0.5, "{}", area(&r)); + assert_eq!(r.winding(pt(1.0, 1.0)), 0); + assert_ne!(r.winding(pt(148.0, 102.0)), 0); + let bb = r.bounding_box(); + assert!((bb.width() - 250.0).abs() < 1e-6 && (bb.height() - 200.0).abs() < 1e-6); +} + +#[test] +fn a_childs_rounded_corners_are_kept_and_do_not_stack() { + let r = round_corners(¬ch(), 20.0, 0.0); + assert_eq!(arcs(&r).len(), 8); + assert!(has_arc(&r, [(30.0, 0.0), (41.0457, 0.0), (50.0, 8.954), (50.0, 20.0)])); + assert!(has_arc(&r, [(50.0, 30.0), (50.0, 41.0457), (58.954, 50.0), (70.0, 50.0)])); + assert!(has_arc_between(&r, (130.0, 50.0), (150.0, 30.0))); + assert!(has_arc_between(&r, (150.0, 20.0), (170.0, 0.0))); + assert!(has_arc(&r, [(0.0, 10.0), (0.0, 4.477), (4.477, 0.0), (10.0, 0.0)])); +} + +#[test] +fn a_radius_larger_than_the_edges_clamps_to_what_they_hold() { + let r = round_corners(¬ch(), 500.0, 0.0); + assert!(has_arc(&r, [(25.0, 0.0), (38.8071, 0.0), (50.0, 11.1929), (50.0, 25.0)])); + assert!(has_arc(&r, [(50.0, 25.0), (50.0, 38.807), (61.193, 50.0), (75.0, 50.0)])); + assert!(has_arc_between(&r, (125.0, 50.0), (150.0, 25.0))); + assert!(has_arc_between(&r, (150.0, 25.0), (175.0, 0.0))); + assert!(has_arc(&r, [(0.0, 10.0), (0.0, 4.477), (4.477, 0.0), (10.0, 0.0)])); + assert!(all_finite(&r)); + let l = round_corners(&l_shape(), 500.0, 0.0); + assert!(has_arc_between(&l, (0.0, 50.0), (50.0, 0.0))); + assert!(has_arc_between(&l, (150.0, 0.0), (250.0, 100.0))); + assert!((area(&round_corners(&l_shape(), 1e300, 0.0)) - area(&l)).abs() < 1e-6); +} + +#[test] +fn nothing_sharp_nothing_changes() { + let round = rounded_rect(100.0, 60.0, [20.0; 4], 0.0); + let oval = ellipse(100.0, 60.0, 0.0, std::f64::consts::TAU, 0.0); + assert_eq!(round_corners(&round, 20.0, 0.0), round); + assert_eq!(round_corners(&oval, 20.0, 0.0), oval); + let l = l_shape(); + for radius in [0.0, -5.0, f64::NAN, f64::INFINITY] { + assert_eq!(round_corners(&l, radius, 0.0), l); + } + let mut open = BezPath::new(); + open.move_to((0.0, 0.0)); + open.line_to((50.0, 0.0)); + open.line_to((50.0, 50.0)); + assert_eq!(round_corners(&open, 10.0, 0.0), open); +} + +#[test] +fn points_the_sweep_leaves_on_an_edge_are_not_corners() { + let mut p = BezPath::new(); + for (i, q) in [(0.0, 0.0), (20.0, 0.0), (100.0, 0.0), (100.0, 0.0), (100.0, 60.0), (100.0 + 1e-11, 60.0), (100.0, 100.0), (0.0, 100.0)] + .into_iter() + .enumerate() + { + if i == 0 { + p.move_to(q); + } else { + p.line_to(q); + } + } + p.close_path(); + let r = round_corners(&p, 500.0, 0.0); + assert_eq!(arcs(&r).len(), 4); + assert!(has_arc_between(&r, (0.0, 50.0), (50.0, 0.0))); +} + +fn two_circles(op: BoolOp) -> BezPath { + let c = ellipse(100.0, 100.0, 0.0, std::f64::consts::TAU, 0.0); + boolean(&[c.clone(), Affine::translate((70.0, 0.0)) * c], op).unwrap() +} + +#[test] +fn corners_beside_curves_round_too() { + for op in [BoolOp::Union, BoolOp::Intersect] { + let sharp = two_circles(op); + assert!(sharpest_turn(&sharp) > 1.0); + let r = round_corners(&sharp, 10.0, 0.0); + assert!(sharpest_turn(&r) < 1e-3, "{}", sharpest_turn(&r)); + assert!(all_finite(&r)); + match op { + BoolOp::Union => assert!(area(&r) > area(&sharp)), + _ => assert!(area(&r) < area(&sharp)), + } + } +} + +#[test] +fn smoothing_draws_the_polygon_profile_between_straight_edges() { + let l = l_shape(); + let plain = round_corners(&l, 20.0, 0.0); + let smooth = round_corners(&l, 20.0, 0.6); + assert!(passes_through(&smooth, pt(0.0, 32.0)) && passes_through(&smooth, pt(32.0, 0.0))); + assert!((area(&smooth) - area(&plain)).abs() > 1.0); + let circles = two_circles(BoolOp::Union); + assert_eq!(round_corners(&circles, 10.0, 0.6), round_corners(&circles, 10.0, 0.0)); +} + +#[test] +fn junk_never_panics() { + let mut bad = BezPath::new(); + bad.move_to((f64::NAN, 0.0)); + bad.line_to((10.0, f64::INFINITY)); + bad.close_path(); + assert_eq!(round_corners(&bad, 5.0, 0.0).elements().len(), 3); + assert!(round_corners(&BezPath::new(), 5.0, 0.0).elements().is_empty()); + let mut one = BezPath::new(); + one.move_to((0.0, 0.0)); + one.line_to((10.0, 0.0)); + one.close_path(); + assert!(all_finite(&round_corners(&one, 5.0, 0.5))); + assert!(all_finite(&round_corners(&rect(0.0, 0.0, 1.0, 0.5), 0.1, 0.0))); + let mut zig = BezPath::new(); + zig.move_to((0.0, 0.0)); + for i in 1..40_000 { + zig.line_to((f64::from(i) * 0.5, f64::from(i % 2))); + } + zig.close_path(); + assert!(all_finite(&round_corners(&zig, 2.0, 0.0))); +} From 529134b850232b1abe92b5b7354f39a30fb04c12 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 13:36:10 -0500 Subject: [PATCH 117/239] M4: a boolean group's corner radius rounds its result (#2222) A boolean group takes a corner radius (and corner smoothing): the Design panel shows the field for it, `node.set cornerRadius` writes it, and the renderer rounds every sharp corner of the group's result after the fold, convex and concave alike. Layers inside keep their own radius and do not stack with it, a radius larger than the edges allow shrinks to fit while the field keeps the typed value, Flatten bakes the arcs, and a mixed selection reads Mixed. Measured in Figma's web app on 2026-11-10. The rounded result is cached apart from the fold (keyed by the folded path, radius and smoothing), so scrubbing the radius never redoes the boolean steps. The .fig and REST importers and the .fig exporter now carry the radius and smoothing of a boolean group, and paste properties and radius variables reach it. Docs: ui-parity, target-app-parity, gaps, file-format-parity, ROADMAP, mcp. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 designed; Sonnet 5.5 wrote at medium --- ROADMAP.md | 3 +- crates/doc/src/node.rs | 12 +- crates/engine/src/boolean_radius_tests.rs | 134 ++++++++++++++++++++ crates/engine/src/booleans_tests.rs | 8 +- crates/engine/src/lib.rs | 2 + crates/engine/src/shapes_behaviour_tests.rs | 2 + crates/format/src/fig/export_tests.rs | 15 +++ crates/format/src/rest/tests.rs | 4 + crates/render/src/boolean.rs | 29 +++++ crates/render/src/boolean_cache_tests.rs | 6 +- crates/render/src/boolean_radius_tests.rs | 60 +++++++++ crates/render/src/draw.rs | 5 +- crates/render/src/lib.rs | 2 + crates/ui-egui/src/field_tests.rs | 19 +++ crates/ui-egui/src/panels/right/paints.rs | 9 +- docs/file-format-parity.md | 5 +- docs/gaps.md | 9 +- docs/mcp.md | 2 +- docs/target-app-parity.md | 5 +- docs/ui-parity.md | 5 +- 20 files changed, 309 insertions(+), 27 deletions(-) create mode 100644 crates/engine/src/boolean_radius_tests.rs create mode 100644 crates/render/src/boolean_radius_tests.rs diff --git a/ROADMAP.md b/ROADMAP.md index dc6204b44..5d53c2ff1 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~26 points and ~162–292 h away (one Opus 5.5 agent; ~33–67 h wall-clock with 5 agents) -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** patch (the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** patch (a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) FigCraft is a clean-room, open-source, pure-Rust reimplementation of the Figma design workflow, native on macOS, Windows, Linux and FreeBSD and in the browser, fully drivable by agents through @@ -365,6 +365,7 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md). | Date | Change | Summary | |---|---|---| +| 2026-11-10 | minor | M4, #2222: a boolean group takes a corner radius that rounds every sharp corner of its result. Numbers unchanged | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`, 繁體中文(台灣)) draft catalog: every UI string (1,975), command label (641) and menu wording (31), translated clean-room from the English source; `zh-TW`, `zh-HK`, `zh-MO` and `zh-Hant` read it while an explicit Hans stays Simplified; the desktop UI prefers an installed Noto Sans CJK TC, then Microsoft JhengHei, PingFang TC and Heiti TC; no font is bundled; native review pending. Numbers unchanged | | 2026-11-06 | patch | M1, #2028: Edit ▸ Set default properties gives new rectangles, ellipses, polygons and stars drawn with the tools (and, set from a text layer, new text) the selected layer's properties; it only copied them for Paste properties. Tests: `default_props_tests` (3). Numbers unchanged | | 2026-11-06 | patch | M5, #2027: `proto.settings` refuses an unknown device name with the list of devices (it saved any string, and the presenter showed no device), takes known names in any case, and answers the page's prototype settings, so `proto.settings {}` reads them back over MCP. Test: `proto_present_tests::unknown_devices_are_refused_and_settings_read_back`. Numbers unchanged | diff --git a/crates/doc/src/node.rs b/crates/doc/src/node.rs index 5b90b3bff..f9601f362 100644 --- a/crates/doc/src/node.rs +++ b/crates/doc/src/node.rs @@ -395,7 +395,8 @@ impl NodeKind { ) } - /// Kinds whose corners can be rounded from the panel. + /// Kinds whose corners can be rounded from the panel. A boolean group has one radius for every + /// sharp corner of its result. pub fn has_corner_radius(&self) -> bool { matches!( self, @@ -408,16 +409,19 @@ impl NodeKind { | NodeKind::Star { .. } | NodeKind::Vector { .. } | NodeKind::Section { .. } + | NodeKind::BooleanOp { .. } ) } - /// Kinds with a radius per corner (the others round every corner alike). + /// Kinds with a radius per corner (the others, boolean groups included, round every corner alike). pub fn has_independent_corners(&self) -> bool { - self.has_corner_radius() && !matches!(self, NodeKind::Polygon { .. } | NodeKind::Star { .. } | NodeKind::Vector { .. }) + self.has_corner_radius() + && !matches!(self, NodeKind::Polygon { .. } | NodeKind::Star { .. } | NodeKind::Vector { .. } | NodeKind::BooleanOp { .. }) } /// Kinds whose rounded corners are drawn with corner smoothing: a vector only when its network - /// has a closed region (an open path's rounded points are drawn without it). + /// has a closed region (an open path's rounded points are drawn without it). A boolean group's + /// smoothing applies to its result's corners between straight edges. pub fn has_corner_smoothing(&self) -> bool { match self { NodeKind::Vector { network } => !network.regions.is_empty(), diff --git a/crates/engine/src/boolean_radius_tests.rs b/crates/engine/src/boolean_radius_tests.rs new file mode 100644 index 000000000..f739b3eaf --- /dev/null +++ b/crates/engine/src/boolean_radius_tests.rs @@ -0,0 +1,134 @@ +//! A boolean group's corner radius through the engine: it rounds the result (and the SVG export +//! of it), children keep their own radius, Flatten bakes the arcs and clicks follow the result. + +use serde_json::json; + +use crate::Session; +use crate::booleans_tests::{area, click, ex}; +use crate::params::id_of; +use figcraft_doc::{NodeId, NodeKind}; +use figcraft_geom::{Point, Shape}; + +const L_AREA: f64 = 34656.6; + +fn rect(s: &mut Session, x: f64, y: f64, w: f64, h: f64) -> NodeId { + id_of(&ex(s, "shape.rectangle", json!({"x": x, "y": y, "width": w, "height": h}))["id"]).unwrap() +} + +fn snapping_off(s: &mut Session) { + ex(s, "select.none", json!({})); + let ds = s.ds_mut().unwrap(); + ds.view.snap_objects = false; + ds.view.snap_pixel = false; +} + +fn set_radius(s: &mut Session, id: NodeId, r: f64) { + ex(s, "node.set", json!({"ids": [id], "props": {"cornerRadius": r}})); +} + +/// The L of two rectangles, united, nothing selected, snapping off. +fn l_group(s: &mut Session) -> NodeId { + let (a, b) = (rect(s, 0.0, 0.0, 200.0, 100.0), rect(s, 150.0, 0.0, 100.0, 200.0)); + let g = id_of(&ex(s, "bool.union", json!({"ids": [a, b]}))["id"]).unwrap(); + snapping_off(s); + g +} + +/// Whether the page point is inside the group's drawn result. +fn covers(s: &Session, g: NodeId, x: f64, y: f64) -> bool { + let doc = s.doc().unwrap(); + let (path, _) = figcraft_render::node_outline(doc, doc.node(g).unwrap()).unwrap(); + let p = doc.world_transform(g).inverse() * Point::new(x, y); + path.winding(p) % 2 != 0 +} + +#[test] +fn a_boolean_group_rounds_every_sharp_corner_of_its_result() { + let mut s = Session::new(); + let g = l_group(&mut s); + assert!(covers(&s, g, 1.0, 1.0)); + set_radius(&mut s, g, 20.0); + assert!(!covers(&s, g, 1.0, 1.0) && covers(&s, g, 148.0, 102.0)); + assert!((area(&s, g) - L_AREA).abs() < 1.0, "{}", area(&s, g)); + let doc = s.doc().unwrap(); + let svg = figcraft_svg::export_svg(doc, &[g], &figcraft_svg::SvgOptions::default()).unwrap(); + let d = svg.split("d=\"").nth(1).and_then(|r| r.split('"').next()).unwrap(); + let exported = figcraft_geom::svg_path(d).unwrap(); + assert!((exported.area().abs() - L_AREA).abs() < 1.0, "{}", exported.area()); + s.undo().unwrap(); + assert_eq!(s.doc().unwrap().node(g).unwrap().corners.radii, [0.0; 4], "one undo step"); + assert!((area(&s, g) - 35000.0).abs() < 1.0); +} + +/// The notch of the measurement: A (200 by 100 at the origin) minus a 100 square on its top edge, +/// whose own radius is `a_radius`, under a group radius of `radius`. +fn notch(s: &mut Session, a: NodeId, radius: f64) -> NodeId { + let b = rect(s, 50.0, -50.0, 100.0, 100.0); + let g = id_of(&ex(s, "bool.subtract", json!({"ids": [a, b]}))["id"]).unwrap(); + snapping_off(s); + set_radius(s, g, radius); + g +} + +/// The asserts of the measurement on a notched group at radius 20 under A's own 10. +fn assert_notch_at_20(s: &Session, g: NodeId) { + assert!(covers(s, g, 4.0, 4.0), "A's 10 was not enlarged to 20"); + assert!(!covers(s, g, 48.0, 2.0), "the cut's top corner rounds"); + assert!(covers(s, g, 52.0, 48.0), "the cut's inner corner fills in"); +} + +#[test] +fn children_keep_their_radius_and_a_subtraction_rounds_its_cut() { + let mut s = Session::new(); + let a = rect(&mut s, 0.0, 0.0, 200.0, 100.0); + set_radius(&mut s, a, 10.0); + let g = notch(&mut s, a, 20.0); + assert_notch_at_20(&s, g); + assert_eq!(s.doc().unwrap().node(a).unwrap().corners.radii, [10.0; 4]); + set_radius(&mut s, g, 500.0); + assert_eq!(s.doc().unwrap().node(g).unwrap().corners.radii[0], 500.0, "the field keeps the value"); + assert!(!covers(&s, g, 40.0, 4.0), "25, not the 20 that half the 40-long edge would give"); + assert!(covers(&s, g, 27.0, 1.0), "and not more than 25"); + assert!(covers(&s, g, 100.0, 51.0) && !covers(&s, g, 100.0, 49.0), "the floor stays straight between 75 and 125"); + assert!(covers(&s, g, 4.0, 4.0)); +} + +#[test] +fn a_nested_group_keeps_its_own_radius() { + let mut s = Session::new(); + let (l, r) = (rect(&mut s, 0.0, 0.0, 120.0, 100.0), rect(&mut s, 80.0, 0.0, 120.0, 100.0)); + let inner = id_of(&ex(&mut s, "bool.union", json!({"ids": [l, r]}))["id"]).unwrap(); + set_radius(&mut s, inner, 10.0); + let g = notch(&mut s, inner, 20.0); + assert_notch_at_20(&s, g); +} + +#[test] +fn flatten_bakes_the_arcs_and_the_vector_has_no_radius() { + let mut s = Session::new(); + let g = l_group(&mut s); + set_radius(&mut s, g, 20.0); + let flat = id_of(&ex(&mut s, "vector.flatten", json!({"ids": [g]}))["id"]).unwrap(); + let doc = s.doc().unwrap(); + let n = doc.node(flat).unwrap(); + let NodeKind::Vector { network } = &n.kind else { panic!("a vector: {:?}", n.kind) }; + assert_eq!(n.corners.radii, [0.0; 4]); + assert!(network.vertices.iter().all(|v| v.radius == 0.0)); + let path = figcraft_doc::geometry::shape_path(n).unwrap(); + assert!((path.area().abs() - L_AREA).abs() < 1.0, "{}", path.area()); + assert!((n.width - 250.0).abs() < 1e-6 && (n.height - 200.0).abs() < 1e-6); +} + +#[test] +fn clicks_follow_the_rounded_result() { + let mut s = Session::new(); + let g = l_group(&mut s); + set_radius(&mut s, g, 20.0); + click(&mut s, 1.0, 1.0, false); + assert!(s.selection().is_empty(), "the cut-off corner reaches what is behind"); + click(&mut s, 148.0, 102.0, false); + assert_eq!(s.selection(), vec![g], "the concave fillet belongs to the group"); + ex(&mut s, "select.none", json!({})); + click(&mut s, 100.0, 50.0, false); + assert_eq!(s.selection(), vec![g]); +} diff --git a/crates/engine/src/booleans_tests.rs b/crates/engine/src/booleans_tests.rs index 068719588..d29c28127 100644 --- a/crates/engine/src/booleans_tests.rs +++ b/crates/engine/src/booleans_tests.rs @@ -11,21 +11,21 @@ use crate::tools::{PointerEvent, PointerKind}; use figcraft_doc::{BoolOp, NodeId, NodeKind}; use figcraft_geom::Shape; -fn ex(s: &mut Session, cmd: &str, p: Value) -> Value { +pub(crate) fn ex(s: &mut Session, cmd: &str, p: Value) -> Value { s.execute(cmd, &p).unwrap_or_else(|e| panic!("{cmd}: {e}")) } -fn ev(kind: PointerKind, x: f64, y: f64, cmd: bool) -> PointerEvent { +pub(crate) fn ev(kind: PointerKind, x: f64, y: f64, cmd: bool) -> PointerEvent { PointerEvent { cmd, ..PointerEvent::at(kind, x, y, 1.0) } } -fn click(s: &mut Session, x: f64, y: f64, cmd: bool) { +pub(crate) fn click(s: &mut Session, x: f64, y: f64, cmd: bool) { s.pointer(&ev(PointerKind::Down, x, y, cmd)).unwrap(); s.pointer(&ev(PointerKind::Up, x, y, cmd)).unwrap(); } /// A layer's filled area (a boolean group's result; none of these have holes). -fn area(s: &Session, id: NodeId) -> f64 { +pub(crate) fn area(s: &Session, id: NodeId) -> f64 { let doc = s.doc().unwrap(); figcraft_render::node_outline(doc, doc.node(id).unwrap()).unwrap().0.area().abs() } diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 302e7053e..e0093ff39 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -225,6 +225,8 @@ mod board_tools_tests; #[cfg(test)] mod boolean_cap_tests; #[cfg(test)] +mod boolean_radius_tests; +#[cfg(test)] mod booleans_tests; #[cfg(test)] mod bound_alpha_tests; diff --git a/crates/engine/src/shapes_behaviour_tests.rs b/crates/engine/src/shapes_behaviour_tests.rs index ca2d16390..39cf2c29b 100644 --- a/crates/engine/src/shapes_behaviour_tests.rs +++ b/crates/engine/src/shapes_behaviour_tests.rs @@ -189,6 +189,7 @@ fn corner_radius_follows_the_documented_rules() { (NodeKind::Polygon { count: 5 }, true, false, "polygons: one radius for every corner"), (NodeKind::Star { count: 5, inner_ratio: 0.4 }, true, false, "stars: one radius for every corner"), (NodeKind::Vector { network: Default::default() }, true, false, "vectors: a radius, and one per point in edit mode"), + (NodeKind::BooleanOp { op: BoolOp::Union }, true, false, "boolean groups: one radius for every sharp corner of the result"), (NodeKind::Line, false, false, "lines and arrows take no radius"), ]; for (kind, radius, independent, why) in doc_rows { @@ -241,6 +242,7 @@ fn corner_smoothing_follows_the_documented_rules() { "vector networks that are closed shapes", ), (NodeKind::Vector { network: Default::default() }, false, "an open vector has no closed shape to smooth"), + (NodeKind::BooleanOp { op: BoolOp::Union }, true, "boolean groups (the plugin API's corner mixin; the look is pinned)"), (NodeKind::Line, false, "lines take no radius, so no smoothing"), ]; for (kind, smoothing, why) in doc_rows { diff --git a/crates/format/src/fig/export_tests.rs b/crates/format/src/fig/export_tests.rs index 9651a1025..f1ae67a4b 100644 --- a/crates/format/src/fig/export_tests.rs +++ b/crates/format/src/fig/export_tests.rs @@ -811,6 +811,21 @@ fn generated_documents_round_trip() { } } +#[test] +fn a_boolean_groups_corner_radius_round_trips() { + let mut doc = Document::new("t"); + let page = doc.first_page().unwrap(); + let g = doc.create(page, NodeKind::BooleanOp { op: BoolOp::Union }, "G", 0.0, 0.0, 0.0, 0.0).unwrap(); + doc.create(g, NodeKind::Rectangle, "A", 0.0, 0.0, 200.0, 100.0).unwrap(); + doc.create(g, NodeKind::Rectangle, "B", 150.0, 0.0, 100.0, 200.0).unwrap(); + doc.fit_to_children(g).unwrap(); + doc.get_mut(g).unwrap().corners = Corners { radii: [20.0; 4], smoothing: 0.6 }; + let (back, _) = round_trip(&doc, "boolean radius"); + let n = back.nodes().find(|n| matches!(n.kind, NodeKind::BooleanOp { .. })).unwrap(); + assert!(n.corners.radii.iter().all(|r| (r - 20.0).abs() < 1e-4), "{:?}", n.corners); + assert!((n.corners.smoothing - 0.6).abs() < 1e-4, "{:?}", n.corners); +} + #[test] fn round_trip_keeps_the_details() { let doc = generate(3); diff --git a/crates/format/src/rest/tests.rs b/crates/format/src/rest/tests.rs index 3ea88fad1..6dc710979 100644 --- a/crates/format/src/rest/tests.rs +++ b/crates/format/src/rest/tests.rs @@ -290,6 +290,8 @@ fn vectors_ellipses_stars_and_booleans() { counted["pointCount"] = json!(6); let mut boolean = base("Bool", "BOOLEAN_OPERATION"); boolean["booleanOperation"] = json!("SUBTRACT"); + boolean["cornerRadius"] = json!(12); + boolean["cornerSmoothing"] = json!(0.6); boolean["children"] = json!([base("A", "RECTANGLE"), {"id": "B", "name": "B", "type": "ELLIPSE", "relativeTransform": at(5.0, 5.0), "size": {"x": 10, "y": 10}}]); let (doc, warnings) = one(json!([tri, wire, empty, arc, star, plain_star, counted, boolean])); @@ -311,6 +313,8 @@ fn vectors_ellipses_stars_and_booleans() { assert!(matches!(b.kind, NodeKind::BooleanOp { op: BoolOp::Subtract })); assert_eq!(b.children.len(), 2); assert!(close(b.width, 15.0), "booleans wrap their children"); + assert_eq!(b.corners.radii, [12.0; 4], "a boolean group keeps its corner radius"); + assert!(close(b.corners.smoothing, 0.6)); } #[test] diff --git a/crates/render/src/boolean.rs b/crates/render/src/boolean.rs index 7fc642082..039a3967b 100644 --- a/crates/render/src/boolean.rs +++ b/crates/render/src/boolean.rs @@ -7,6 +7,11 @@ //! edited one are never recombined, and groups whose operands didn't change aren't recomputed at //! all. The caches drop their least recently used half when full, so a long drag doesn't evict //! every other group's result. +//! +//! The group's own corner radius is applied to the finished fold ([`result_cached`]) and cached in a +//! separate, smaller map keyed by the folded path plus the radius and smoothing: the fold's caches +//! are keyed by the operands alone, so scrubbing the radius never redoes the fold or evicts its +//! prefixes, and a rounded path is never stored where a fold would find it. use std::collections::HashMap; use std::hash::{DefaultHasher, Hash, Hasher}; @@ -109,6 +114,30 @@ pub fn fold_cached(operands: &[(BezPath, BoolOp)]) -> Option { } } +fn rounded() -> &'static Mutex { + static C: OnceLock> = OnceLock::new(); + C.get_or_init(|| Mutex::new(PathCache::new(512))) +} + +/// A boolean group's result as it is drawn: the fold of `operands` ([`fold_cached`]), then the +/// group's corner `radius` and `smoothing` on every corner still sharp. +pub fn result_cached(operands: &[(BezPath, BoolOp)], radius: f64, smoothing: f64) -> Option { + let folded = fold_cached(operands)?; + if !(radius.is_finite() && radius > 0.0) { + return Some(folded); + } + let mut h = DefaultHasher::new(); + hash_path(&folded, &mut h); + (radius.to_bits(), smoothing.to_bits(), 0x52u8).hash(&mut h); + let key = h.finish(); + if let Some(p) = locked(rounded()).get(key) { + return Some((*p).clone()); + } + let out = figcraft_pathops::round_corners(&folded, radius, smoothing); + locked(rounded()).insert(key, Arc::new(out.clone())); + Some(out) +} + /// `keys[i]`: the cache key of the fold of operands `0..=i`. fn fold_keys(operands: &[(BezPath, BoolOp)]) -> Vec { let mut h = DefaultHasher::new(); diff --git a/crates/render/src/boolean_cache_tests.rs b/crates/render/src/boolean_cache_tests.rs index 7a34bf4f2..51e422425 100644 --- a/crates/render/src/boolean_cache_tests.rs +++ b/crates/render/src/boolean_cache_tests.rs @@ -7,12 +7,12 @@ use figcraft_color::{Color, Paint}; use figcraft_doc::{BoolOp, Document, NodeId, NodeKind, WidthPoint, WidthProfile}; use figcraft_geom::kurbo::{BezPath, Shape}; -fn dark(p: &Pixmap, x: u32, y: u32) -> bool { +pub(crate) fn dark(p: &Pixmap, x: u32, y: u32) -> bool { let i = ((y * p.width() + x) * 4) as usize; p.data().get(i).is_some_and(|r| *r < 40) } -fn render(d: &Document, p: NodeId) -> Pixmap { +pub(crate) fn render(d: &Document, p: NodeId) -> Pixmap { render_view(d, p, &View { origin: (0.0, 0.0), scale: 1.0, width: 200, height: 200 }, &Options::default()).unwrap() } @@ -28,7 +28,7 @@ fn row_of_squares(op: BoolOp, n: usize) -> (Document, NodeId, NodeId, Vec BezPath { +pub(crate) fn outline(d: &Document, id: NodeId) -> BezPath { node_outline(d, d.node(id).unwrap()).unwrap().0 } diff --git a/crates/render/src/boolean_radius_tests.rs b/crates/render/src/boolean_radius_tests.rs new file mode 100644 index 000000000..dfe98af03 --- /dev/null +++ b/crates/render/src/boolean_radius_tests.rs @@ -0,0 +1,60 @@ +//! A boolean group's corner radius: it rounds the result the canvas draws, and keys a cache of its +//! own so the fold underneath is not redone. + +use crate::boolean::boolean_steps; +use crate::boolean_cache_tests::{dark, outline, render}; +use figcraft_color::{Color, Paint}; +use figcraft_doc::{BoolOp, Document, NodeId, NodeKind}; +use figcraft_geom::kurbo::Shape; + +/// The L of the measurement: a union of 200 by 100 and 100 by 200 rectangles, on a page of its own. +fn l_group() -> (Document, NodeId, NodeId, NodeId) { + let mut d = Document::new("t"); + let p = d.first_page().unwrap(); + let g = d.create(p, NodeKind::BooleanOp { op: BoolOp::Union }, "G", 0.0, 0.0, 0.0, 0.0).unwrap(); + d.get_mut(g).unwrap().fills = vec![Paint::solid(Color::BLACK)]; + d.create(g, NodeKind::Rectangle, "A", 0.0, 0.0, 200.0, 100.0).unwrap(); + let b = d.create(g, NodeKind::Rectangle, "B", 150.0, 0.0, 100.0, 200.0).unwrap(); + d.fit_to_children(g).unwrap(); + (d, p, g, b) +} + +fn set_radius(d: &mut Document, g: NodeId, r: f64) { + d.get_mut(g).unwrap().corners.radii = [r; 4]; +} + +fn area(d: &Document, g: NodeId) -> f64 { + outline(d, g).area().abs() +} + +#[test] +fn a_boolean_groups_radius_rounds_what_the_canvas_draws() { + let (mut d, p, g, _) = l_group(); + let pix = render(&d, p); + assert!(dark(&pix, 1, 1) && !dark(&pix, 148, 102)); + set_radius(&mut d, g, 20.0); + let pix = render(&d, p); + assert!(!dark(&pix, 1, 1), "the corner is cut off"); + assert!(dark(&pix, 148, 102), "the concave corner is filled in"); + assert!(dark(&pix, 100, 50)); + assert!((area(&d, g) - 34656.6).abs() < 1.0, "{}", area(&d, g)); +} + +#[test] +fn the_radius_keys_the_result_and_the_fold_is_not_redone() { + let (mut d, _, g, b) = l_group(); + let sharp = outline(&d, g); + set_radius(&mut d, g, 20.0); + let _ = outline(&d, g); + let before = boolean_steps(); + set_radius(&mut d, g, 40.0); + // Four net corners of 343.36 each, plus the cubic arcs' own slight excess over a circle. + assert!((area(&d, g) - 33626.6).abs() < 2.0, "{}", area(&d, g)); + assert_eq!(boolean_steps(), before, "a new radius reuses the fold"); + set_radius(&mut d, g, 0.0); + assert_eq!(outline(&d, g), sharp, "radius 0 draws the fold itself"); + set_radius(&mut d, g, 20.0); + let rounded = area(&d, g); + d.get_mut(b).unwrap().transform = figcraft_geom::Affine::translate((10.0, 0.0)) * d.node(b).unwrap().transform; + assert!((area(&d, g) - rounded).abs() > 1.0, "moving an operand does not draw a stale rounded path"); +} diff --git a/crates/render/src/draw.rs b/crates/render/src/draw.rs index ff3a06270..a4e7db670 100644 --- a/crates/render/src/draw.rs +++ b/crates/render/src/draw.rs @@ -326,8 +326,9 @@ fn node_outline_at(doc: &Document, n: &Node, depth: usize) -> Option<(BezPath, F Some((p, c.bool_op.unwrap_or(*op))) }) .collect(); - // Past the path operations' caps the group has no outline: it draws without its result. - crate::boolean::fold_cached(&operands).map(|p| (p, FillRule::EvenOdd)) + // Past the path operations' caps the group has no outline: it draws without its result. The + // group's corner radius rounds what is still sharp in the fold. + crate::boolean::result_cached(&operands, n.corners.radii[0], n.corners.smoothing).map(|p| (p, FillRule::EvenOdd)) } NodeKind::Text(_) => { let (l, dy) = figcraft_text::layout_node(n)?; diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs index f138521ae..9d5b1618a 100644 --- a/crates/render/src/lib.rs +++ b/crates/render/src/lib.rs @@ -518,6 +518,8 @@ mod boolean_budget_tests; #[cfg(test)] mod boolean_cache_tests; #[cfg(test)] +mod boolean_radius_tests; +#[cfg(test)] mod bounds_memo_tests; #[cfg(test)] mod dots_tests; diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index e3bdad1dd..4322c8808 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -1403,3 +1403,22 @@ fn alt_held_over_a_field_scrubs_it() { u.frame(vec![]); assert_eq!(geom(&u, a).0, 65.0, "ten more"); } + +#[test] +fn a_boolean_group_has_one_corner_radius_field_and_a_mixed_selection_reads_mixed() { + let (mut u, a, b) = setup(); + let g = id(u.app.session.execute("bool.union", &json!({"ids": [a, b]})).unwrap()); + let r = id(u.app.session.execute("shape.rectangle", &json!({"x": 400, "y": 0, "width": 50, "height": 50})).unwrap()); + u.app.run("select.set", json!({"ids": [g]})); + assert_eq!(field(&mut u, "Corner radius").1, "0"); + let steps = undo_steps(&u); + type_into(&mut u, "Corner radius", "20", Key::Enter); + let radii = |u: &Ui, n: NodeId| u.app.session.doc().unwrap().node(n).unwrap().corners.radii; + assert_eq!(radii(&u, g), [20.0; 4]); + assert_eq!(undo_steps(&u), steps + 1, "one undo step"); + assert!((0..4).all(|k| u.ctx.read_response(Id::unique(("corner", k)).with("field")).is_none()), "no field per corner"); + u.app.run("select.set", json!({"ids": [g, r]})); + assert_eq!(field(&mut u, "Corner radius").1, "Mixed"); + type_into(&mut u, "Corner radius", "8", Key::Enter); + assert_eq!((radii(&u, g), radii(&u, r)), ([8.0; 4], [8.0; 4])); +} diff --git a/crates/ui-egui/src/panels/right/paints.rs b/crates/ui-egui/src/panels/right/paints.rs index 967ae266b..157c65731 100644 --- a/crates/ui-egui/src/panels/right/paints.rs +++ b/crates/ui-egui/src/panels/right/paints.rs @@ -51,9 +51,11 @@ pub(super) fn appearance(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[N let op_of = |n: &Node| (f64::from(n.opacity) * 100.0).round(); let op = common(doc, sel, op_of); let radius_ok = crate::selection_cache::every(doc, sel, |n| n.kind.has_corner_radius()); - // Only rectangles and frames round each corner on its own. + // Only rectangles and frames round each corner on its own; a boolean group has one radius for + // every sharp corner of its result. let indep_ok = radius_ok && crate::selection_cache::every(doc, sel, |n| n.kind.has_independent_corners()); - // For polygons, stars and closed vectors the same panel holds only the Corner smoothing row. + // For polygons, stars, boolean groups and closed vectors the same panel holds only the Corner + // smoothing row. let smooth_ok = radius_ok && crate::selection_cache::every(doc, sel, |n| n.kind.has_corner_smoothing()); let r = common(doc, sel, |n| n.corners.uniform().map(|r| (r * 100.0).round() / 100.0)); widgets::sublabels(ui, tr("Opacity"), radius_ok.then_some(tr("Corner radius"))); @@ -77,7 +79,8 @@ pub(super) fn appearance(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[N let radius_of = |n: &Node| n.corners.uniform().unwrap_or_else(|| n.corners.radii.iter().copied().fold(0.0, f64::max)); app.field_of(&ids, "cornerRadius", e, radius_of, |v| json!(v.max(0.0))); let open = ui.data(|d| d.get_temp::(Id::unique("indep_corners"))).unwrap_or(false); - // Polygons and stars have no corners of their own: the button opens only Corner smoothing. + // Polygons, stars and boolean groups have no corners of their own: the button opens only + // Corner smoothing. let tip = if indep_ok { tr("Individual corners") } else { tr("Corner smoothing") }; if smooth_ok && icons::button(ui, Icon::IndependentCorners, 24.0, open, tip).clicked() { ui.data_mut(|d| d.insert_temp(Id::unique("indep_corners"), !open)); diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index dd04fdf75..c04d8f7bf 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-11-08 · **Change:** minor (`.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (`.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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; an instance scaled with the Scale tool, which stores `symbolData.uniformScaleFactor`, draws its layers at the main's lengths times that factor, composed through nested instances: sizes and places, corner radii, stroke weights and dashes, effect radii, spreads and offsets, auto layout gaps and paddings, grid gaps, min and max sizes, layout grids, font sizes, pixel line heights and letter spacings, paragraph spacing and indent, except where an override or derived row gives the value, which is already at the instance's scale; per-point vector corner radii also take their vector-data row's factor; the vector outline paths a layer carries (a network's points follow the layer's size), fixed grid tracks, image tile scales and glass effects are not scaled by the factor, #2091), 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); an elbowed one saved with its path (`connectorControlPoints`: a point and an axis per run between the first and the last) keeps that path when it leaves and arrives by the ends' sides (#1910), and a curved one's saved `connectorBezierControlPoints` are not read; 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 | +| `.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 (with their corner radius and smoothing, #2222), 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; an instance scaled with the Scale tool, which stores `symbolData.uniformScaleFactor`, draws its layers at the main's lengths times that factor, composed through nested instances: sizes and places, corner radii, stroke weights and dashes, effect radii, spreads and offsets, auto layout gaps and paddings, grid gaps, min and max sizes, layout grids, font sizes, pixel line heights and letter spacings, paragraph spacing and indent, except where an override or derived row gives the value, which is already at the instance's scale; per-point vector corner radii also take their vector-data row's factor; the vector outline paths a layer carries (a network's points follow the layer's size), fixed grid tracks, image tile scales and glass effects are not scaled by the factor, #2091), 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); an elbowed one saved with its path (`connectorControlPoints`: a point and an axis per run between the first and the last) keeps that path when it leaves and arrives by the ends' sides (#1910), and a curved one's saved `connectorBezierControlPoints` are not read; 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 (an elbowed connector keeps the path it was saved with, #1910), 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 | — | @@ -196,6 +196,7 @@ scales and empty-style clears; they have not been checked in other software. | Date | Change | Summary | |---|---|---| +| 2026-11-10 | minor | M4, #2222: a boolean group's corner radius and smoothing are read and written by the `.fig` importer and exporter, and by the REST importer | | 2026-11-08 | minor | M6, #2097 follow-up: per-point vector corner radii take the scale of the row supplying `vectorData`, including nested instance rows; override and derived rows are not scaled twice. Network caching distinguishes the instance scale even when resizing gives two vectors the same final box. Synthetic tests cover missing/unit factors, half/double scale, derived size alone, overridden and derived vector data, nested scale and equal-size cache separation. Layer-radius fallback remains the separate #2115 change. Numbers unchanged. | | 2026-11-08 | patch | #2097 / #2100: scaled-instance lengths reset to the unscaled main value survive export/import as explicit overrides. Dimensionless values and zero do not gain scale overrides. Exported factors stay within the importer's 0.001–1000 range; larger or smaller ratios use explicit values instead. Effect/grid payload rows above an inherited style link take precedence at their own scale, including nested instances and empty-list clears, without detaching styles. Synthetic regressions cover corners, dashes/shadows, layout/grids and bounds, typography and styled runs, linked text and nested styles. Numbers unchanged. | | 2026-11-07 | minor | `.fig` import, #2091 item 1: an instance scaled with the Scale tool stores `symbolData.uniformScaleFactor`, which the import never read, so the layers of a 128 px instance of a 256 px component came in at 256 px with the main's radii, strokes and spacing. The layers of an instance now take the main's lengths times the factor (composed through nested instances, so 0.5 inside 0.5 is 0.25 for the inner layers), the lengths the Scale tool scales: sizes and places, corner radii, stroke weights and dashes, effect radii, spreads and offsets, auto layout gaps and paddings, grid gaps, min and max sizes, layout grids, font sizes, pixel line heights and letter spacings, paragraph spacing and indent. A value an override or derived row gives is taken as written, already at the instance's scale; the instance's own size is the file's; a missing, non-finite, non-positive or out-of-range factor (outside 0.001 to 1000) changes nothing. Not scaled: vector outline paths (a network's points follow the layer's size), per-point corner radii, fixed grid tracks, image tile scales and glass effects. Tests: `fig::tests::a_scaled_instance_draws_its_layers_at_the_factor` and `fig::scale_factor_tests`. Numbers unchanged | diff --git a/docs/gaps.md b/docs/gaps.md index f42b97e4e..28ec31ca8 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Where FigCraft falls short of Figma -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-31 · **Change:** minor (gap 10: library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; gap 6: widgets draw lines and SVG pictures (plugin API 6); gap 7: text reads only the fallback fonts it draws with; a board connector's path can be reshaped by dragging its path handles (#1710); gap 10: library analytics count insertions and show insertions and detachments over time; gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; gap 14: a collection of this file extends, following its edits at once; colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; gap 6: plugin widgets have hover styles; gap 7: the browser draws a zoom's full render a band at a time; `.fig` import keeps the file's saved line breaks while the text and its box are unedited (#1236); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); Arabic draft catalog; gap 7: the browser refines a zoom's preview once the zoom has paused; gap 17: branches in live sessions, branch history entries, the list-merge rows brought up to date; gap 6: plugin widgets take text input and a property menu (plugin API 4); gap 24: board templates and tables; gap 24: a shared timer and voting sessions; gap 24: the board dot grid, connector ends dragged to re-attach, curved connectors; egui/eframe 0.37 verified for gap 18; known gaps from the #1311 review in gaps 4, 14, 15 and 16; gap 16: measurements kept on the canvas, a read-only layers panel in Dev Mode; gap 24: boards and their tail; Dev Mode tail: import lines in layer trees, compare with versions, an inspect-only canvas; gap 5: reviewed Turkish, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; sharing with a join code; text box sizes measured against documents re-saved by other software; live sessions per document; .fig export checked by opening written files in other software; 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; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; `.fig` import: editable vector networks, more layer kinds, variable prototype actions; `.fig` import, best effort: gap 1 down to its tail; Windows QA pass: everyday workflows on Windows 11, eight fixes incl. unsaved work kept after a crash or a forced quit; 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: gap 14 down to its tail; the 2026-10-17 landings: `.fig` import fidelity, budgets for large files, the import report, a `.fig` copy from Save as and paste from another design app (gap 1); menus, the Actions palette, editor fixes, Selection colors and smart-selection spacing (gap 4); catalog counts re-measured (gap 5); bounded canvas pan overscan) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (gap 13: a boolean group's corner radius (#2222); gap 10: library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; gap 6: widgets draw lines and SVG pictures (plugin API 6); gap 7: text reads only the fallback fonts it draws with; a board connector's path can be reshaped by dragging its path handles (#1710); gap 10: library analytics count insertions and show insertions and detachments over time; gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; gap 14: a collection of this file extends, following its edits at once; colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; gap 6: plugin widgets have hover styles; gap 7: the browser draws a zoom's full render a band at a time; `.fig` import keeps the file's saved line breaks while the text and its box are unedited (#1236); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); Arabic draft catalog; gap 7: the browser refines a zoom's preview once the zoom has paused; gap 17: branches in live sessions, branch history entries, the list-merge rows brought up to date; gap 6: plugin widgets take text input and a property menu (plugin API 4); gap 24: board templates and tables; gap 24: a shared timer and voting sessions; gap 24: the board dot grid, connector ends dragged to re-attach, curved connectors; egui/eframe 0.37 verified for gap 18; known gaps from the #1311 review in gaps 4, 14, 15 and 16; gap 16: measurements kept on the canvas, a read-only layers panel in Dev Mode; gap 24: boards and their tail; Dev Mode tail: import lines in layer trees, compare with versions, an inspect-only canvas; gap 5: reviewed Turkish, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; sharing with a join code; text box sizes measured against documents re-saved by other software; live sessions per document; .fig export checked by opening written files in other software; 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; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; `.fig` import: editable vector networks, more layer kinds, variable prototype actions; `.fig` import, best effort: gap 1 down to its tail; Windows QA pass: everyday workflows on Windows 11, eight fixes incl. unsaved work kept after a crash or a forced quit; 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: gap 14 down to its tail; the 2026-10-17 landings: `.fig` import fidelity, budgets for large files, the import report, a `.fig` copy from Save as and paste from another design app (gap 1); menus, the Actions palette, editor fixes, Selection colors and smart-selection spacing (gap 4); catalog counts re-measured (gap 5); bounded canvas pan overscan) · **Target:** Figma Design (desktop app 126.10.7) Every known shortfall against Figma, one entry each, ranked by how much it stops a Figma user from doing real work in FigCraft. Agents: pick work from the top unless the owner says otherwise. The @@ -383,14 +383,16 @@ No alpha blockers: the alpha gate in [`roadmap.md`](roadmap.md#alpha-gate) passe - **Estimate:** 5–10 h (video playback in the presenter is most of it; it can reuse the GIF clock). ### 13. Vector tail: none left +- **Landed (2026-11-10):** a boolean group takes a corner radius (and smoothing) that rounds every sharp + corner of its result, convex and concave, with the children's own radii kept and a radius larger + than the edges allow shrinking to fit (#2222; `crates/pathops/src/round_tests.rs`). - **Landed (2026-10-22):** the transform box around points selected in several layers at once, in the page's axes: its corners and edges scale them, outside a corner rotates them and inside drags them, each in its own layer and one undo step for all (`transform_tests`). - **Landed (2026-10-12):** several Bezier handles selected with Shift-click and dragged together, sharp points beside curved segments rounded, a stroke cap and join per point (canvas, PNG, SVG, PDF, outline stroke), the Pen outside edit mode connecting to its own points and continuing a - selected open path. Left: corner radius and smoothing on boolean groups that contain - rectangles, per-point caps and joins on dashed, variable-width and brush + selected open path. Left: per-point caps and joins on dashed, variable-width and brush strokes. - **Landed (2026-10-11):** boolean groups are clicked where their result is (a click in a subtracted hole reaches what's behind; with the group or an operand selected its operands are @@ -593,6 +595,7 @@ No alpha blockers: the alpha gate in [`roadmap.md`](roadmap.md#alpha-gate) passe | Date | Change | Summary | |---|---|---| +| 2026-11-10 | minor | Gap 13: a boolean group's corner radius rounds every sharp corner of its result (#2222); the boolean clause leaves the 2026-10-12 "Left" list | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`) draft catalog: 1,975 UI strings, 641 command labels and 31 menu wordings, clean-room from the English source; zh-TW, zh-HK, zh-MO and zh-Hant read it, explicit Hans stays Simplified; Noto Sans CJK TC then Taiwan system faces; no bundled font; native review pending. Numbers unchanged | | 2026-10-31 | minor | Gap 10: library analytics list the layers and files using each style and variable; their insertions, detachments and modes stay on the missing list. | | 2026-10-31 | minor | Gap 15: the Controller menu names buttons as PlayStation and Switch controllers do; that item leaves the missing list. Estimate unchanged. Test: `present::tail_tests`. | diff --git a/docs/mcp.md b/docs/mcp.md index 04b37e1f0..a055abe54 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -742,7 +742,7 @@ page line crosses; parts that come apart move to layers of their own above, list `vector.deleteHeal`, `vector.join` / `vector.smoothJoin` (join the selected points while editing), `vector.edit.cornerRadius` (rounds the selected sharp points, next to straight or curved segments: a curve is cut where the arc meets it and keeps the rest of its shape; drawn and exported; -`node.set {cornerRadius}` on a vector rounds every point), `vector.edit.strokeCap {cap, vertices?}` +`node.set {cornerRadius}` on a vector rounds every point, and on a boolean group every sharp corner of its result, while its layers keep their own radius), `vector.edit.strokeCap {cap, vertices?}` and `vector.edit.strokeJoin {join, vertices?}` (the stroke's cap where it ends at these points and its join where it turns there, `null` for the layer's; drawn, exported and outlined), `vector.edit.moveHandles {dx, dy, handles?}` (moves the selected handles by a page offset), diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 031521f51..493b34844 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-06 · **Change:** minor (justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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 @@ -99,7 +99,7 @@ Breadth: does it exist. Ready: depth, correctness and fidelity for real projects | 1 | Canvas & navigation | 6 | 98% | 74% | Display P3 on screen, QA at extreme zooms (behaviour suite for navigation, rulers, guides, layout grids and outline mode landed: guide selection, Auto grid counts, outline-mode clicks; outline mode's Include hidden layers and Include object bounds landed) | 1–4 | | 2 | Selection & transform | 8 | 97% | 72% | Handles, measuring and snapping checked tool by tool against Figma and real files (snap distance, handle reach, cursors); children turned off a right angle scale without skew, approximately (behaviour suite from the documentation, rotated groups and mixed selections, equal spacing snapping, Cmd/Ctrl to ignore constraints and marquees inside frames landed) | 3–5 | | 3 | Layers panel | 5 | 99% | 85% | QA with long real files (behaviour suite from the documentation, Rename layers dialog, sweeping eyes and padlocks, page dragging and dividers, several layers dropped together, keyboard box selection, F2 rename, Shift+F10 context menu and 10k-layer timings landed) | 1–2 | -| 4 | Shapes & vector | 8 | 99% | 73% | Corner radius and smoothing on boolean groups that contain rectangles; per-point caps and joins on dashed, variable-width and brush strokes; vector QA with real files (behaviour suites from the documentation, corner radius and star ratio handles, corner smoothing on polygons, stars and closed vectors, rounded vector points drawn, also beside curved segments, a cap and join per point, several handles dragged together, cut and paint bucket drags, delete and heal along the curve, a boolean group's look by operation and the miter angle landed) | 1–3 | +| 4 | Shapes & vector | 8 | 99% | 73% | per-point caps and joins on dashed, variable-width and brush strokes; vector QA with real files (behaviour suites from the documentation, corner radius and star ratio handles, corner smoothing on polygons, stars and closed vectors, rounded vector points drawn, also beside curved segments, a cap and join per point, several handles dragged together, cut and paint bucket drags, delete and heal along the curve, a boolean group's look by operation, a boolean group's corner radius and the miter angle landed) | 1–3 | | 5 | Paint | 7 | 90% | 71% | Video fills, wide-gamut canvas, HEIC images; plus darker in PDF (behaviour suite from the documentation, pass-through and isolating groups, clipping frames that don't isolate, plus darker, animated GIF fills, TIFF images and embedded image colour profiles landed) | 2–5 | | 6 | Strokes | 3 | 95% | 75% | Stroke QA with real files (colour styles on strokes, stroke weight and per-side weight variables, brush strokes landed, see 20) | 1–2 | | 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 | @@ -652,6 +652,7 @@ Carried over from the ROADMAP's "Shipped so far" (2026-10-10). The test count th | Date | Change | Summary | |---|---|---| +| 2026-11-10 | minor | M4, #2222: a boolean group's corner radius rounds every sharp corner of its result (row 4). Numbers unchanged | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`) draft catalog: 1,975 UI strings, 641 command labels and 31 menu wordings, clean-room from the English source; zh-TW, zh-HK, zh-MO and zh-Hant read it, explicit Hans stays Simplified; Noto Sans CJK TC then Taiwan system faces; no bundled font; native review pending. Numbers unchanged | | 2026-11-04 | patch | M4, #1970: justified Chinese, Japanese and Korean text, written without spaces between words, aligns its right edge: the room on each line but a paragraph's last goes between its characters, each a word of its own as for line breaking ("Justify aligns the first word in each line of text to the left-most edge, and the last to the right-most edge"), wherever a line could break there, so none opens before a full stop or closing bracket, nor after an opening one. Latin text widens its spaces as before; mixed text widens both. A gap is reordered with the line's runs as a space of no width would be, so one beside a Hebrew word in Chinese text, or beside a Chinese word within that Hebrew, opens beside the word, not inside it. `figcraft_text::breaks::justify_between`, beside `break_between`, says where. Evidence: `tests::justified_ideographs_spread_the_room_between_characters` (fails on main). | | 2026-11-04 | patch | M8, #1951 (#1506 again): a path broken open by deleting a point (Delete, not Shift+Delete) is filled closed by a straight line across the gap, as an open path's fill is; joining its two ends again (the pen onto the other end, Connect, ⌘J) left the loop without the new segment, so once the points were rounded the fill and the selection outline ran straight across while the stroke followed the segment and its arcs. Joining now closes the loop through the new segment ("Click to close the path."; "You can use the Paint tool to add fills to any closed regions of a vector network."): `ops::connect` puts it into the loop whose segments are the chain between the ends, at the gap and in the loop's own order, so a hole keeps its winding whichever end was clicked first; a loop listed out of walking order is left as it was. Evidence: `vectoredit::tests::a_rounded_chamfer_made_other_ways_fills_along_its_arcs` (fails on main: the loop kept 4 of 5 segments), `a_rounded_chamfer_cut_in_the_editor_fills_along_its_arcs` (Shift+Delete, with and without a region fill), `doc::tests::a_chamfered_rectangles_rounded_fill_is_cut_at_every_point` (fill, region path and stroke agree for every loop order and segment direction of a chamfered rectangle). | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..e1be194be 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -94,7 +94,7 @@ interaction feel not yet compared. | Pen: vector networks, branch, close, bend; pencil | done | pen pressure on Windows and from browser styluses only; outside edit mode the Pen closes on its first point, connects to its other points and continues a selected open path from an end point (`vector_multi_behaviour_tests`); Escape ends the path and keeps its layer in edit mode with the pen, so the next path joins the same vector and another Escape leaves edit mode (#760, `pen_end_tests`); Enter or a double-click ends the path (at the double-click's point, added once) and edits the vector with the Move tool, a double-click with the idle pen edits the layer under it, and in edit mode the pen's Enter or double-click takes the Move tool (#1430, `pen_vector_edit_tests`); switching from Design to Prototype or Inspect ends the path and returns to Move (#308) | | Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). 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); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | +| Boolean groups: clicked where the result is, double-click or Cmd/Ctrl-click into operands, live results while dragging or editing points, per-operand operations | done | a group past the path operations' caps (250 000 segments, 2 million possible crossings, 4 million segments swept over a fold) draws without its result, with a warning, and Flatten refuses it (#1104); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003); a boolean group takes a corner radius from the Design panel and from `node.set cornerRadius`: every sharp corner of its result rounds, convex and concave, layers inside keep their own radius and do not stack with it, a radius larger than the edges allow shrinks to fit while the field keeps the value typed, Flatten bakes the arcs and a mixed selection reads Mixed; measured in Figma's web app on 2026-11-10 (#2222; `crates/pathops/src/round_tests.rs`, `crates/render/src/boolean_radius_tests.rs`, `crates/engine/src/boolean_radius_tests.rs`, the boolean group test in `crates/ui-egui/src/field_tests.rs`). Pinned and not yet compared with Figma: corner smoothing on a boolean group draws the polygon profile between straight edges, a corner beside a curve stays within the curve piece next to it, and there is no radius handle on the canvas | | Text: point, auto height, fixed; caret, words, lines, IME | done | Backspace or Delete at the start of a list item takes its marker and keeps its level, the paragraph starting where the item's text did ("delete the counter, but keep the same level of indentation", Create bulleted and numbered lists; `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests`); max lines on auto-width text keep it auto width, hugging up to that many lines and growing with its longest line ("Text resizing is set to auto height or auto width", Explore text properties; `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines`); Alt+Enter while editing opens the link at the caret, web and mail links only (`text.openLink`; "press ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma; `text_link_tests`); the font picker previews a family on the canvas while hovered (no undo step; Escape restores, #653) and Up/Down step through it (#352); a selection highlight after a line break starts at that line's start and an empty last line shows its mark (#665); carets step over whole emoji and accented letters; colour emoji draw from their colour tables (#300); IME composition replayed in tests as macOS sends it, not yet checked on a Mac (#747); CJK words by script run (no dictionary); vertical trim in Type settings; no spell check | | Text: wrap style (Auto, Balance, Pretty) | done | per text layer (`wrapStyle` on `node.set`, `text.wrapStyle`, the Type settings control under Vertical trim, inspect, CSS `text-wrap: balance` or `pretty`): Auto breaks greedily; Balance narrows each paragraph as far as it goes without another line, so its lines come out close to the same length (what browsers do for `text-wrap: balance`); Pretty keeps lines full and, when the last line is one word, narrows one of the last four lines just enough to give a word to the lines after it (Explore text properties: "Auto: Figma fits as many words as possible on each line before wrapping to the next", "Balance: Figma distributes text as evenly as possible across every line, so each line is close to the same length", "Pretty: Figma keeps each line full, but adjusts the last four lines to avoid an orphan"). Saved line breaks from a file still win. Not yet included: per-paragraph settings, text-style support and the `.fig` import/export mapping (#1827). Test: `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented` | | Text: direction override (Text ▸ Text direction) | done | per paragraph (`ParaList::direction`: auto, ltr, rtl): Text ▸ Text direction ▸ Auto / Left to right / Right to left and `text.direction {direction, ids?}` set the edited paragraphs while editing, else every paragraph of the selected texts; `node.set textDirection` the layer's (or the chars `start`/`end` name); the Type settings control appears once a right-to-left script is in the text or a direction is forced; inspect reports `textDirection` when the paragraphs agree and `lineDirections` otherwise; Developer Mode's CSS writes `direction: ltr` or `rtl` when every paragraph is forced the same way (with `text-align: left` beside `rtl`, as Left is absolute on the canvas); `.fig` import and export carry each line's `sourceDirectionality`, read up to the paragraph count. Layout gives the paragraph its base level, so a forced right-to-left paragraph of Latin letters starts at the right, mirrors its list gutter and indent and orders its runs right to left, and a forced left-to-right paragraph of Hebrew the other way ("By default, Figma automatically handles text direction based on language detection. However, controls are available to override text direction per paragraph", "Go to Text > Text direction. Select Left to right or Right to left", Add right-to-left text). Not included: a direction in text styles (the article names none). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests` | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-10 | minor | M4, #2222: a boolean group takes a corner radius that rounds every sharp corner of its result (measured in Figma's web app), Boolean groups row | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From bae366ba519ec28c02720184ccfc335c40892d81 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 13:53:13 -0500 Subject: [PATCH 118/239] M4: Boolean groups: test the one-radius panel through corner smoothing (#2222) The field test's "no field per corner" check passed for any shape, since corner fields are built only while the individual-corners popover is open. A boolean group's button now has its own test beside the polygons' (shared helper): it is named Corner smoothing, opens no corner fields, and sets the smoothing in one undo step. ROADMAP's status line reads minor, as the other docs do. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote; Fable 5.1 reviewed --- ROADMAP.md | 2 +- crates/ui-egui/src/corner_individual_tests.rs | 49 +++++++++++++------ crates/ui-egui/src/field_tests.rs | 1 - 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 5d53c2ff1..c1b55fd17 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~26 points and ~162–292 h away (one Opus 5.5 agent; ~33–67 h wall-clock with 5 agents) -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** patch (a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; 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 Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); 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; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); 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); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); 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; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; 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; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); 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); 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); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); 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); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); 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); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); 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); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); 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); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; 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; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); 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, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) FigCraft is a clean-room, open-source, pure-Rust reimplementation of the Figma design workflow, native on macOS, Windows, Linux and FreeBSD and in the browser, fully drivable by agents through diff --git a/crates/ui-egui/src/corner_individual_tests.rs b/crates/ui-egui/src/corner_individual_tests.rs index 281ab6f2a..117b90db3 100644 --- a/crates/ui-egui/src/corner_individual_tests.rs +++ b/crates/ui-egui/src/corner_individual_tests.rs @@ -166,25 +166,42 @@ fn polygons_and_stars_take_corner_smoothing() { for cmd in ["shape.polygon", "shape.star"] { let mut s = Session::new(); let id = NodeId(s.execute(cmd, &json!({"x": 0, "y": 0, "width": 120, "height": 120})).unwrap()["id"].as_u64().unwrap()); - s.execute("node.set", &json!({"ids": [id], "props": {"cornerRadius": 8}})).unwrap(); - s.execute("select.set", &json!({"ids": [id]})).unwrap(); - let mut u = Ui::new(s); - // With no corners of their own, the button is named for what it opens. - let t = named_button(&mut u, "Corner smoothing"); - click(&mut u, t); - assert!((0..4).all(|k| u.ctx.read_response(Id::unique(("corner", k)).with("field")).is_none()), "{cmd}: one radius, no corner fields"); - let smoothing = u.ctx.read_response(Id::unique("smoothing").with("field")).expect("the smoothing field shows").rect.center(); - let history = u.app.session.undo_depth().0; - click(&mut u, smoothing); - u.frame(vec![Event::Text("60".into())]); - enter(&mut u); - u.frame(vec![]); - let n = u.app.session.doc().unwrap().node(id).unwrap().clone(); - assert!((n.corners.smoothing - 0.6).abs() < 1e-9, "{cmd}: {}", n.corners.smoothing); - assert_eq!(u.app.session.undo_depth().0, history + 1, "{cmd}: one undo step"); + takes_corner_smoothing(s, id, cmd); } } +/// A boolean group has one radius for its whole result (#2222): like a polygon, its button opens +/// corner smoothing, with no field per corner. +#[test] +fn a_boolean_group_opens_corner_smoothing_and_has_no_corner_fields() { + let mut s = Session::new(); + let rect = |s: &mut Session, x: i32| s.execute("shape.rectangle", &json!({"x": x, "y": 0, "width": 100, "height": 100})).unwrap()["id"].clone(); + let (a, b) = (rect(&mut s, 0), rect(&mut s, 60)); + let g = NodeId(s.execute("bool.union", &json!({"ids": [a, b]})).unwrap()["id"].as_u64().unwrap()); + takes_corner_smoothing(s, g, "bool.union"); +} + +/// With `id` rounded at 8 and selected: the panel's button is named Corner smoothing and opens +/// the smoothing field with no field per corner, and typing 60 sets the smoothing in one undo step. +fn takes_corner_smoothing(mut s: Session, id: NodeId, what: &str) { + s.execute("node.set", &json!({"ids": [id], "props": {"cornerRadius": 8}})).unwrap(); + s.execute("select.set", &json!({"ids": [id]})).unwrap(); + let mut u = Ui::new(s); + // With no corners of their own, the button is named for what it opens. + let t = named_button(&mut u, "Corner smoothing"); + click(&mut u, t); + assert!((0..4).all(|k| u.ctx.read_response(Id::unique(("corner", k)).with("field")).is_none()), "{what}: one radius, no corner fields"); + let smoothing = u.ctx.read_response(Id::unique("smoothing").with("field")).expect("the smoothing field shows").rect.center(); + let history = u.app.session.undo_depth().0; + click(&mut u, smoothing); + u.frame(vec![Event::Text("60".into())]); + enter(&mut u); + u.frame(vec![]); + let n = u.app.session.doc().unwrap().node(id).unwrap().clone(); + assert!((n.corners.smoothing - 0.6).abs() < 1e-9, "{what}: {}", n.corners.smoothing); + assert_eq!(u.app.session.undo_depth().0, history + 1, "{what}: one undo step"); +} + /// A closed vector shows the same Corner smoothing control, and its iOS button sets 60% in one /// undo step; an open vector, which has no closed shape to smooth, shows no smoothing control. #[test] diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index 4322c8808..b71979f37 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -1416,7 +1416,6 @@ fn a_boolean_group_has_one_corner_radius_field_and_a_mixed_selection_reads_mixed let radii = |u: &Ui, n: NodeId| u.app.session.doc().unwrap().node(n).unwrap().corners.radii; assert_eq!(radii(&u, g), [20.0; 4]); assert_eq!(undo_steps(&u), steps + 1, "one undo step"); - assert!((0..4).all(|k| u.ctx.read_response(Id::unique(("corner", k)).with("field")).is_none()), "no field per corner"); u.app.run("select.set", json!({"ids": [g, r]})); assert_eq!(field(&mut u, "Corner radius").1, "Mixed"); type_into(&mut u, "Corner radius", "8", Key::Enter); From ec105d0f5609796462e570e7bfff9b5b526acf91 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 14:44:12 -0500 Subject: [PATCH 119/239] M4: The radius field shows what a one-radius layer draws (#2222) A boolean group, polygon, star or vector draws its first radius. Per-corner values a script or a file left behind made its field read Mixed, and a relative edit started from the largest. The field now shows radii[0] for those kinds, and a relative edit starts from it; rectangles and frames are unchanged. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/ui-egui/src/field_tests.rs | 14 ++++++++++++++ crates/ui-egui/src/panels/right/paints.rs | 10 +++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index b71979f37..5af141b7d 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -1421,3 +1421,17 @@ fn a_boolean_group_has_one_corner_radius_field_and_a_mixed_selection_reads_mixed type_into(&mut u, "Corner radius", "8", Key::Enter); assert_eq!((radii(&u, g), radii(&u, r)), ([8.0; 4], [8.0; 4])); } + +/// A boolean group draws its first radius; per-corner values a script or a file left behind don't +/// make its field read Mixed, and a relative edit starts from the radius it draws. +#[test] +fn a_boolean_groups_field_shows_the_radius_it_draws() { + let (mut u, a, b) = setup(); + let g = id(u.app.session.execute("bool.union", &json!({"ids": [a, b]})).unwrap()); + let corners = json!({"topRightRadius": 30, "bottomRightRadius": 30, "bottomLeftRadius": 30}); + u.app.session.execute("node.set", &json!({"ids": [g], "props": corners})).unwrap(); + u.app.run("select.set", json!({"ids": [g]})); + assert_eq!(field(&mut u, "Corner radius").1, "0", "the radius it draws"); + type_into(&mut u, "Corner radius", "+10", Key::Enter); + assert_eq!(u.app.session.doc().unwrap().node(g).unwrap().corners.radii, [10.0; 4], "0 + 10, not 30 + 10"); +} diff --git a/crates/ui-egui/src/panels/right/paints.rs b/crates/ui-egui/src/panels/right/paints.rs index 157c65731..76f9c38c8 100644 --- a/crates/ui-egui/src/panels/right/paints.rs +++ b/crates/ui-egui/src/panels/right/paints.rs @@ -57,7 +57,10 @@ pub(super) fn appearance(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[N // For polygons, stars, boolean groups and closed vectors the same panel holds only the Corner // smoothing row. let smooth_ok = radius_ok && crate::selection_cache::every(doc, sel, |n| n.kind.has_corner_smoothing()); - let r = common(doc, sel, |n| n.corners.uniform().map(|r| (r * 100.0).round() / 100.0)); + // A layer with one radius (polygon, star, boolean group, vector) draws its first one, whatever + // the other three hold; a rectangle or frame shows a value only when its four corners agree. + let shown = |n: &Node| if n.kind.has_independent_corners() { n.corners.uniform() } else { n.corners.radii.first().copied() }; + let r = common(doc, sel, |n| shown(n).map(|r| (r * 100.0).round() / 100.0)); widgets::sublabels(ui, tr("Opacity"), radius_ok.then_some(tr("Corner radius"))); row(ui, 32.0, |ui| { let lead = Lead::Icon(Icon::Opacity, tr("Opacity")); @@ -75,8 +78,9 @@ pub(super) fn appearance(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[N "", col, ); - // A layer with corners of its own starts from its largest. - let radius_of = |n: &Node| n.corners.uniform().unwrap_or_else(|| n.corners.radii.iter().copied().fold(0.0, f64::max)); + // A relative edit starts from the radius shown; a rectangle with differing corners + // starts from its largest. + let radius_of = |n: &Node| shown(n).unwrap_or_else(|| n.corners.radii.iter().copied().fold(0.0, f64::max)); app.field_of(&ids, "cornerRadius", e, radius_of, |v| json!(v.max(0.0))); let open = ui.data(|d| d.get_temp::(Id::unique("indep_corners"))).unwrap_or(false); // Polygons, stars and boolean groups have no corners of their own: the button opens only From 4c91f9084b5d50e9323b77693d33764d661e20cf Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 15:39:09 -0500 Subject: [PATCH 120/239] M4: round_corners: each contour's own size sets its weld tolerance (#2222) The tolerance that drops the sweep's slivers came from the whole path's bounding box, so a contour a million units wide welded away the real half-unit edges of a separate small contour. Each closed subpath now sets its own. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/pathops/src/round.rs | 6 ++++-- crates/pathops/src/round_tests.rs | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/crates/pathops/src/round.rs b/crates/pathops/src/round.rs index 40ab03759..385f1faba 100644 --- a/crates/pathops/src/round.rs +++ b/crates/pathops/src/round.rs @@ -114,10 +114,12 @@ pub fn round_corners(path: &BezPath, radius: f64, smoothing: f64) -> BezPath { return path.clone(); } let smoothing = if smoothing.is_finite() { smoothing.clamp(0.0, 1.0) } else { 0.0 }; - let bb = path.bounding_box(); - let weld = (bb.width().max(bb.height()) * 1e-6).max(1e-9); let mut out = BezPath::new(); for sub in figcraft_geom::split_subpaths(path) { + // Each contour's own size sets its cleanup tolerance, so a large contour can't weld away + // the real short edges of a small island or hole beside it. + let bb = sub.bounding_box(); + let weld = (bb.width().max(bb.height()) * 1e-6).max(1e-9); let closed = matches!(sub.elements().last(), Some(PathEl::ClosePath)); match closed.then(|| round_subpath(&sub, radius, smoothing, weld)).flatten() { Some(p) => out.extend(p.elements().iter().copied()), diff --git a/crates/pathops/src/round_tests.rs b/crates/pathops/src/round_tests.rs index eda74b464..0c22b5363 100644 --- a/crates/pathops/src/round_tests.rs +++ b/crates/pathops/src/round_tests.rs @@ -236,3 +236,21 @@ fn junk_never_panics() { zig.close_path(); assert!(all_finite(&round_corners(&zig, 2.0, 0.0))); } + +/// The cleanup tolerance is each contour's own: a contour a million units wide doesn't weld away +/// the half-unit notch of a separate small contour in the same path. +#[test] +fn a_large_contour_does_not_weld_a_small_ones_short_edges() { + let mut p = rect(0.0, 0.0, 1e6, 1e6); + let x = 2e6; + for (i, (dx, y)) in [(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (5.5, 10.0), (5.5, 9.5), (5.0, 9.5), (5.0, 10.0), (0.0, 10.0)].into_iter().enumerate() + { + if i == 0 { p.move_to((x + dx, y)) } else { p.line_to((x + dx, y)) } + } + p.close_path(); + let out = round_corners(&p, 0.001, 0.0); + let reaches = |q: Point| { + out.elements().iter().any(|el| matches!(el, PathEl::MoveTo(e) | PathEl::LineTo(e) | PathEl::CurveTo(_, _, e) if (*e - q).hypot() < 0.01)) + }; + assert!(reaches(pt(x + 5.0, 9.5)) && reaches(pt(x + 5.5, 9.5)), "the notch's floor is kept"); +} From ebcaa58c4f899c93d8d30d84636725532bf62bf0 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 15:55:41 -0500 Subject: [PATCH 121/239] M10: Design panel: section header icons draw at the panel's icon size (#2227) Section header buttons painted their glyph in a 12 pt box inside the 24 pt button while icon_button_at used 14 pt. Both now use icon_glyph_rect (ICON_BUTTON_INSET 5 pt), as do the 24 pt Close and Swap buttons in the assets and prototype panels. Test compares the painted Eye bounds of a header and an icon button. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/ui-egui/src/header_icon_size_tests.rs | 45 ++++++++++++++++++++ crates/ui-egui/src/lib.rs | 2 + crates/ui-egui/src/panels/assets_panel.rs | 4 +- crates/ui-egui/src/panels/proto_panel.rs | 2 +- crates/ui-egui/src/widgets.rs | 13 +++++- docs/ui-parity.md | 3 +- 6 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 crates/ui-egui/src/header_icon_size_tests.rs diff --git a/crates/ui-egui/src/header_icon_size_tests.rs b/crates/ui-egui/src/header_icon_size_tests.rs new file mode 100644 index 000000000..35db827df --- /dev/null +++ b/crates/ui-egui/src/header_icon_size_tests.rs @@ -0,0 +1,45 @@ +//! A section header's icon buttons (Appearance, Fill, Stroke, Effects...) draw their glyphs at the +//! same size as the panel's other 24 pt icon buttons (#2227). + +use egui::{Context, Rect, pos2, vec2}; + +use crate::icons::Icon; +use crate::widgets::{icon_button_at, icon_glyph_rect, section_header}; + +/// Bounding box of everything painted in one frame of `add`. +fn painted_box(add: impl FnOnce(&mut egui::Ui)) -> Rect { + let ctx = Context::default(); + let mut add = Some(add); + let raw = egui::RawInput { screen_rect: Some(Rect::from_min_size(pos2(0.0, 0.0), vec2(400.0, 200.0))), ..Default::default() }; + let mut out = ctx.run_ui(raw, |ui| { + if let Some(f) = add.take() { + f(ui); + } + }); + out.textures_delta.clear(); + out.shapes + .iter() + .filter(|s| matches!(s.shape, egui::Shape::Path(_) | egui::Shape::Mesh(_) | egui::Shape::LineSegment { .. } | egui::Shape::Circle(_))) + .map(|s| s.shape.visual_bounding_rect()) + .fold(Rect::NOTHING, |a, b| a.union(b)) +} + +#[test] +fn header_eye_draws_as_large_as_an_icon_buttons_eye() { + let header = painted_box(|ui| { + section_header(ui, "Appearance", &[(Icon::Eye, "Hide")], false); + }); + let button = painted_box(|ui| { + let r = Rect::from_min_size(pos2(20.0, 20.0), vec2(24.0, 24.0)); + icon_button_at(ui, ui.scope_id().with("b"), r, Icon::Eye, "Hide"); + }); + assert!(header.is_finite() && button.is_finite(), "{header:?} {button:?}"); + assert!((header.width() - button.width()).abs() < 0.5, "widths {} vs {}", header.width(), button.width()); + assert!((header.height() - button.height()).abs() < 0.5, "heights {} vs {}", header.height(), button.height()); +} + +#[test] +fn glyph_rect_is_the_shared_inset_of_the_button() { + let b = Rect::from_min_size(pos2(0.0, 0.0), vec2(24.0, 24.0)); + assert_eq!(icon_glyph_rect(b).size(), vec2(14.0, 14.0)); +} diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 60c68f526..9216c2fff 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -122,6 +122,8 @@ mod guide_release_tests; #[cfg(test)] mod guide_snap_tests; #[cfg(test)] +mod header_icon_size_tests; +#[cfg(test)] mod home_recents_tests; #[cfg(test)] mod home_tests; diff --git a/crates/ui-egui/src/panels/assets_panel.rs b/crates/ui-egui/src/panels/assets_panel.rs index a63c10c9a..0da5a9bee 100644 --- a/crates/ui-egui/src/panels/assets_panel.rs +++ b/crates/ui-egui/src/panels/assets_panel.rs @@ -1157,7 +1157,7 @@ fn enabled_libraries(app: &mut FigApp, ui: &mut Ui, w: f32, doc: &Document) { if xr.hovered() { ui.painter().rect_filled(x, CornerRadius::same(5), t.hover); } - icons::paint(ui.painter(), x.shrink(6.0), Icon::Close, t.icon); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(x), Icon::Close, t.icon); if xr.clicked() { remove = Some(l.id.clone()); } @@ -1169,7 +1169,7 @@ fn enabled_libraries(app: &mut FigApp, ui: &mut Ui, w: f32, doc: &Document) { if sr.hovered() { ui.painter().rect_filled(sw, CornerRadius::same(5), t.hover); } - icons::paint(ui.painter(), sw.shrink(6.0), Icon::Swap, t.icon); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(sw), Icon::Swap, t.icon); crate::right::menu_popup(&sr).show(|ui| { for other in doc.libraries.enabled.iter().filter(|o| o.id != l.id) { if crate::right::menu_item(ui, &trf("Swap to {name}", &[("name", &other.name)]), "") { diff --git a/crates/ui-egui/src/panels/proto_panel.rs b/crates/ui-egui/src/panels/proto_panel.rs index d7728cbdc..fa9f2585c 100644 --- a/crates/ui-egui/src/panels/proto_panel.rs +++ b/crates/ui-egui/src/panels/proto_panel.rs @@ -684,7 +684,7 @@ fn editor_popover(app: &mut FigApp, ctx: &egui::Context, popover: InteractionPop if xr.hovered() { ui.painter().rect_filled(x, CornerRadius::same(5), t.hover); } - icons::paint(ui.painter(), x.shrink(6.0), Icon::Close, t.icon); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(x), Icon::Close, t.icon); if xr.clicked() { close = true; } diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index eae46fd81..12cc02f14 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -1013,7 +1013,7 @@ pub fn section_header_resp(ui: &mut Ui, title: &str, buttons: &[(Icon, &str)], d if resp.hovered() { ui.painter().rect_filled(r, CornerRadius::same(5), t.hover); } - icons::paint(ui.painter(), r.shrink(6.0), *icon, t.icon); + icons::paint(ui.painter(), icon_glyph_rect(r), *icon, t.icon); if resp.clicked() { out = Some(i); } @@ -1045,6 +1045,15 @@ pub fn tight_end_n(ui: &mut Ui, count: usize, add: impl FnOnce(&mut Ui) -> R) add(&mut child) } +/// Inset of the glyph inside a 24 pt icon button: a 14 pt glyph, the size every icon button in the +/// panels draws at (section header buttons included). +pub const ICON_BUTTON_INSET: f32 = 5.0; + +/// The rect a 24 pt icon button paints its glyph in. +pub fn icon_glyph_rect(button: Rect) -> Rect { + button.shrink(ICON_BUTTON_INSET) +} + /// An icon button at `rect` (hover highlight, tooltip); true when clicked. pub fn icon_button_at(ui: &mut Ui, id: Id, rect: Rect, icon: Icon, tip: &str) -> bool { let t = Tokens::get(ui.ctx()); @@ -1052,7 +1061,7 @@ pub fn icon_button_at(ui: &mut Ui, id: Id, rect: Rect, icon: Icon, tip: &str) -> if resp.hovered() { ui.painter().rect_filled(rect, CornerRadius::same(5), t.hover); } - icons::paint(ui.painter(), rect.shrink(5.0), icon, t.icon); + icons::paint(ui.painter(), icon_glyph_rect(rect), icon, t.icon); resp.clicked() } diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..9412fb06f 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -200,6 +200,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | 2026-11-06 | patch | M7, #2032: closing a tab whose file has unsaved changes, by its X, a middle click, File ▸ Close tab or its shortcut, only showed a toast ("save first, or close again with Alt to discard") and left the tab open, so closing seemed not to work. It now asks the unsaved-changes question the window asks (`windows::TabClose`): Don't Save closes the tab, Cancel or Escape keeps it, Save saves the file and then closes it (a file without a path, or saved as .fig, asks where with Save as first and stays open if that is cancelled); Alt+close still drops the changes at once, and `file.close`'s `dialog.unsaved` request asks too. The three toasts left the catalogs. Tests: `titlebar_tests::closing_a_tab_with_unsaved_changes_asks`, `titlebar_tests::save_in_the_tab_question_saves_then_closes`. Reordering tabs by dragging, the issue's other half, landed on 2026-10-19 (`dragging_a_tab_along_the_bar_reorders_it_without_detaching`) | | 2026-11-05 | minor | M4, #1830: a paragraph's base direction can be forced (`TextDirection`: Auto, Ltr, Rtl on `ParaList`): Text ▸ Text direction ▸ Auto / Left to right / Right to left (`text.directionAuto` / `Ltr` / `Rtl`) and `text.direction {direction, ids?}` set the edited paragraphs while editing, else the layer's; `node.set textDirection`; the Type settings control once a right-to-left script is in the text; inspect `textDirection` / `lineDirections`; CSS `direction`; `.fig` lines' `sourceDirectionality` in and out. Layout gives each paragraph its base level (`Bidi::of` runs the algorithm per paragraph, as it starts over at each). Before, direction came from the letters only ("controls are available to override text direction per paragraph", Add right-to-left text). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests::a_lines_source_directionality_is_its_paragraphs_direction_both_ways`. | | 2026-11-02 | minor | M1, #1836: pick select. Tab while the keyboard selection box shows, or Alt/Ctrl+Space again, puts a pink outline on the first selected layer (the page's top layer with nothing selected); Tab and Shift+Tab move it between sibling layers as the Layers panel lists them, Enter into a frame's top child, Shift+Enter out to the parent (never the page), Space selects the layer under it, Escape or a press on the canvas ends it; the chord again while the pick cursor shows brings the box back (Accessibility at Figma). The control channel's `ui.key` sends the box's and the pick cursor's keys to them too. One documented row more (135, 134 bound); four gesture rows. Tests: `layers_keyboard_tests::tab_switches_the_selection_box_to_pick_select`. | +| 2026-11-10 | patch | M10, #2227: the Design panel's section header buttons (Appearance, Typography, Fill, Stroke, Effects) draw their icons at the size of the panel's other 24 pt icon buttons, 14 pt, not 12 pt; the Close and Swap buttons of the assets and prototype panels share the inset. Test: `header_icon_size_tests`. Numbers unchanged. | | 2026-11-05 | patch | M1, #2003: the Design panel's boolean operation menu leads Union, Subtract, Intersect and Exclude with original icons drawn in code (two offset squares, the result filled at reduced alpha). Numbers unchanged. | | 2026-11-02 | minor | M8, #1875: a fill per region. With regions of a vector selected in edit mode (a press inside one with the Move tool, `vector.edit.select {regions}`), the Fill section lists the regions' own fills (the layer's for a region that has none; mixed content when they differ) and its rows and the colour picker edit them: `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` on the edited layer go to the selected regions' stacks (`Region.fills`, what the renderer already draws), the layer's fills and fill style untouched; `regions: [index, ...]` names them on any vector layer (Edit vector layers). Tests: `regions_tests::the_fill_commands_edit_the_selected_regions`. Numbers unchanged. | | 2026-11-05 | patch | M1, #1758: a mouse's side buttons (4 and 5) pan the canvas as the middle button does, the pan ending on release over the canvas or off it; the grab cursor shows while they're held. | From 0ad70b95018d47c1b067baf02dc654f7a1232840 Mon Sep 17 00:00:00 2001 From: ljkx <177671075+ljkx@users.noreply.github.com> Date: Tue, 10 Nov 2026 23:31:31 +0100 Subject: [PATCH 122/239] M1: a programmatic paste after a property copy whose engine copy is gone pastes no stale layers (#1494) A row's fill copied through the control channel, then a stroke copied by a command, left the fill off the engine clipboard; a programmatic paste then fell through to the layers copied before the fill. It now does nothing, as a user's paste already did. Tests: the programmatic case above, an effect paste replacing the highlighted effect above the bottom one (index 1), and a property copied in one window pasting in another while the highlight stays in its window. --- crates/ui-egui/src/property_rows.rs | 19 ++++--- crates/ui-egui/src/property_rows_tests.rs | 67 +++++++++++++++++++++++ 2 files changed, 78 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/property_rows.rs b/crates/ui-egui/src/property_rows.rs index 2267fb347..c5c89485c 100644 --- a/crates/ui-egui/src/property_rows.rs +++ b/crates/ui-egui/src/property_rows.rs @@ -10,6 +10,10 @@ //! `stroke.paste`, `effect.paste`) while it is still the last thing copied: on top of their list, //! or in place of their highlighted row when it is of the same kind. A copy keeps its kind: a //! stroke never lands in the fills, whatever row is highlighted. +//! +//! A programmatic copy (the control channel) never writes the system clipboard, so it has no +//! mirror there: a programmatic paste takes it from the engine clipboard, while a user's paste +//! goes by what the system clipboard holds, as it does for copied layers. use egui::{Color32, Context, Rect, Response}; use figcraft_doc::NodeId; @@ -224,14 +228,13 @@ pub(crate) fn paste(app: &mut FigApp) -> bool { // programmatic paste reads only the engine clipboard. && (app.control_synthetic || (c.mirror.is_some() && app.ui.last_copy == c.mirror)); if !still_last { - // The system clipboard still holds this copy's mirror, but the engine's copy of it is gone - // (a command copied a paint or effect of another kind since): nothing to paste, rather - // than the layers copied before it. - return !app.control_synthetic - && c.mirror.is_some() - && app.ui.last_copy == c.mirror - && app.ui.last_copy_generation == app.session.clipboard.layers_generation - && c.layers_generation == app.session.clipboard.layers_generation; + // No layers were copied since this copy, but the engine's copy of it is gone (a command + // copied a paint or effect of another kind since): nothing to paste, rather than the + // layers copied before it. For a user's paste, only while the system clipboard still + // holds this copy's mirror; a programmatic paste reads only the engine clipboard. + let ours = app.control_synthetic + || (c.mirror.is_some() && app.ui.last_copy == c.mirror && app.ui.last_copy_generation == app.session.clipboard.layers_generation); + return ours && c.layers_generation == app.session.clipboard.layers_generation; } let ids = app.session.selection(); if ids.is_empty() { diff --git a/crates/ui-egui/src/property_rows_tests.rs b/crates/ui-egui/src/property_rows_tests.rs index b36ea94bb..d997973b7 100644 --- a/crates/ui-egui/src/property_rows_tests.rs +++ b/crates/ui-egui/src/property_rows_tests.rs @@ -444,3 +444,70 @@ fn a_click_on_a_rows_grip_highlights_that_row_for_the_selection() { select(&mut u, a); assert!(u.app.ui.property_row.is_none()); } + +#[test] +fn a_programmatic_paste_after_a_property_copy_whose_engine_copy_is_gone_pastes_no_stale_layers() { + let (mut u, a, b, _) = setup(); + u.app.control_synthetic = true; + // A layer copy first, then the fill row's, both programmatic. + crate::menus::invoke(&mut u.app, "edit.copy"); + assert_eq!(u.app.session.clipboard.nodes.len(), 1, "A was copied"); + crate::property_rows::copy(&mut u.app, PropertyKind::Fill, 0, &[a]); + // A stroke copied without its row: the fill is no longer on the clipboard. + u.app.run("stroke.copy", json!({"id": a})); + u.app.run("select.set", json!({"ids": [b]})); + let layers = u.app.session.doc().unwrap().node_count(); + crate::menus::paste(&mut u.app, None, None); + assert_eq!(u.app.session.doc().unwrap().node_count(), layers, "the layer copied before wasn't pasted"); + assert_eq!(fills(&u, b), ["00FF00"]); + assert!(u.app.session.doc().unwrap().node(b).unwrap().strokes.is_empty()); +} + +#[test] +fn an_effect_paste_replaces_the_highlighted_effect_above_the_bottom_one() { + let (mut u, a, b, clip) = setup(); + u.app.run("effect.add", json!({"ids": [b], "type": "innerShadow"})); + click_row(&mut u, "Layer blur"); + copy(&mut u); + select(&mut u, b); + // B's effects, bottom to top: a drop shadow, an inner shadow (drawn first, at the top). + click_row(&mut u, "Inner shadow"); + assert_eq!(u.app.ui.property_row.as_ref().map(|h| (h.kind, h.index)), Some((PropertyKind::Effect, 1))); + paste(&mut u, &clip); + let doc = u.app.session.doc().unwrap(); + let (blur, effects) = (&doc.node(a).unwrap().effects[0], &doc.node(b).unwrap().effects); + assert_eq!(effects.len(), 2, "replaced, not added"); + assert_eq!(effects[1], *blur, "the blur took the inner shadow's place"); + assert_eq!(effects[0].label(), "Drop shadow", "the drop shadow under it stays"); +} + +#[test] +fn a_property_copied_in_one_window_pastes_in_another_and_the_highlight_stays_in_its_window() { + let mut s = Session::empty(); + s.execute("file.new", &json!({"name": "A"})).unwrap(); + let a = rect(&mut s, 0.0, "#FF0000"); + s.execute("file.new", &json!({"name": "B"})).unwrap(); + let b = rect(&mut s, 0.0, "#00FF00"); + let clip = Rc::new(RefCell::new(None)); + let ctx = egui::Context::default(); + ctx.set_embed_viewports(false); + let mut app = crate::FigApp::new(s, Box::new(Clip(clip.clone()))); + ctx.run_ui(egui::RawInput::default(), |ui| app.ui(ui)).textures_delta.clear(); + // File A goes to a window of its own; the main window shows B. + let w = crate::control::handle(&mut app, &ctx, "window.new", &json!({"index": 0})).unwrap()["window"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [b]})); + let doc = app.session.ds().unwrap().uid; + app.ui.property_row = Some(Highlight { kind: PropertyKind::Fill, index: 0, ids: vec![b], doc, rect: None }); + crate::menus::invoke(&mut app, "edit.copy"); + assert_eq!(clip.borrow().as_deref(), Some("#00FF00")); + let text = clip.borrow().clone(); + let pasted = crate::windows::as_window(&mut app, w, |app| { + assert!(app.ui.property_row.is_none(), "the highlight belongs to the main window"); + app.run("select.set", json!({"ids": [a]})); + crate::menus::paste(app, text.as_deref(), None); + app.session.doc().unwrap().node(a).unwrap().fills.iter().map(|p| p.solid_color().unwrap().to_hex()).collect::>() + }); + let fills = pasted.expect("the window exists"); + assert_eq!(fills, ["FF0000", "00FF00"], "B's fill went on top of A's"); + assert!(app.ui.property_row.is_some(), "the main window keeps its highlight"); +} From 97ceeca35e1cfdb4f4183485e435a503c4d500a7 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Tue, 10 Nov 2026 20:55:23 -0500 Subject: [PATCH 123/239] M10: Windows: the window no longer draws below a hidden caption (#1343) FigCraft draws its own title bar on Windows and opens undecorated windows, but winit 0.30 still gives them WS_CAPTION | WS_BORDER. On some systems the desktop compositor reserves that caption, so the content is drawn about 30 px low (a black band above it) while clicks keep the client coordinates and land above what is drawn. Fixes #1343; the same report as #1422 and #2233. A per-frame step (apps/figcraft/src/window_frame.rs, run from raw_input_hook) clears WS_CAPTION and WS_BORDER from every winit window of the process (the main window and the other windows alike), keeps WS_THICKFRAME and the window buttons so edge resizing and snap work, and calls SetWindowPos(SWP_FRAMECHANGED) only when a style changed. It uses safe winsafe calls (no unsafe), Windows only; other platforms and the browser are unchanged. The maximize-to-work-area trim of DesignCraft's fix is left for a later change. Ports the fix of DesignCraft #2139 and PhotoCraft #2401. Tests: the style arithmetic (caption and border cleared, thick frame and buttons kept, a clean style unchanged) and the per-frame hook (runs every frame, a no-op when unset). Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- Cargo.lock | 1 + apps/figcraft/Cargo.toml | 3 + apps/figcraft/src/main.rs | 10 ++ apps/figcraft/src/window_frame.rs | 177 ++++++++++++++++++++++++++++++ docs/hardware-parity.md | 3 +- 5 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 apps/figcraft/src/window_frame.rs diff --git a/Cargo.lock b/Cargo.lock index 8ca91ac04..6bab85d73 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1810,6 +1810,7 @@ dependencies = [ "windows", "winit", "winresource", + "winsafe", "zbus", ] diff --git a/apps/figcraft/Cargo.toml b/apps/figcraft/Cargo.toml index f2ea73ba8..12fe93b5a 100644 --- a/apps/figcraft/Cargo.toml +++ b/apps/figcraft/Cargo.toml @@ -37,6 +37,9 @@ env_logger = { version = "0.11", default-features = false, features = ["auto-col [target.'cfg(windows)'.dependencies] craft-update = { workspace = true } windows = { version = "0.62", default-features = false, features = ["UI_ViewManagement", "System_UserProfile", "Foundation_Collections", "Gaming_Input"] } +# The custom title bar's window styles (src/window_frame.rs): safe Win32 wrappers (MIT); the `user` +# feature is User32.dll only. Same version as DesignCraft and PhotoCraft. +winsafe = { version = "0.0.29", default-features = false, features = ["user"] } # The system colour scheme (org.freedesktop.portal.Settings): winit reports no theme on Linux and # the BSDs, so the interface's "system" mode follows the portal's instead. zbus comes in through diff --git a/apps/figcraft/src/main.rs b/apps/figcraft/src/main.rs index 66b5f73ee..1d24e511b 100644 --- a/apps/figcraft/src/main.rs +++ b/apps/figcraft/src/main.rs @@ -29,6 +29,7 @@ mod graphics; mod recovery; mod services; mod startup; +mod window_frame; #[cfg(all(test, target_os = "macos"))] mod apple_events_tests; @@ -63,6 +64,8 @@ struct App { title: String, /// Shared with the services, which write the copies after a panic. recovery: recovery::Shared, + /// Keeps the custom title bar's undecorated windows borderless (Windows, #1343). + window_frame: window_frame::WindowFrame, /// Documents and quit requests from Finder, the Dock and Open With. #[cfg(target_os = "macos")] apple_events: fmv_macos_events::Inbox, @@ -111,6 +114,9 @@ impl eframe::App for App { } fn raw_input_hook(&mut self, _ctx: &egui::Context, raw_input: &mut egui::RawInput) { + // winit gives an undecorated window its caption back when it changes the window's flags + // (maximize, restore, ...): take it off again before the frame is laid out (#1343). + self.window_frame.run(); // Pointer and key events sent over the control channel (`ui.input`), for the window // about to draw. if let Some(events) = with_app(|fig| figcraft_ui_egui::windows::take_input(fig, raw_input.viewport_id)) { @@ -268,6 +274,7 @@ fn main() -> eframe::Result { // the old bespoke xdg-decoration probe that always drew FigCraft's custom title bar on KDE. fig.ui.title_bar = desktop_title_bar(); viewport = window_chrome(viewport, fig.ui.title_bar); + let custom_titlebar = fig.ui.title_bar == figcraft_ui_egui::TitleBar::Custom; if let Some(icon) = icon { viewport = viewport.with_icon(icon); } @@ -304,6 +311,9 @@ fn main() -> eframe::Result { ctx_slot, title: String::new(), recovery, + // The custom title bar's undecorated window must stay borderless, or its caption + // and border offset the content and the pointer on some Windows systems (#1343). + window_frame: window_frame::WindowFrame::new(custom_titlebar), #[cfg(target_os = "macos")] apple_events: apple_events.connect(&cc.egui_ctx), })) diff --git a/apps/figcraft/src/window_frame.rs b/apps/figcraft/src/window_frame.rs new file mode 100644 index 000000000..0033444ec --- /dev/null +++ b/apps/figcraft/src/window_frame.rs @@ -0,0 +1,177 @@ +//! Keeps the custom (undecorated) title bar windows truly borderless on Windows (#1343). +//! +//! winit 0.30 gives an undecorated window the `WS_CAPTION | WS_BORDER` styles and hides the +//! non-client area by spreading the client rect over it (`WM_NCCALCSIZE`). On some systems the +//! desktop compositor still reserves that frame for the window surface: the content is drawn about +//! 30 px low (a black band above it) while the pointer keeps the un-offset client coordinates, so +//! clicks land on something other than what is drawn under them. +//! +//! winit 0.27 omitted those styles for undecorated windows and had no offset. [`WindowFrame`] +//! restores that: it strips `WS_CAPTION` and `WS_BORDER` from every window of this process that +//! draws its own title bar, and has Windows recalculate the frame. winit puts the styles back +//! whenever it changes the window flags (maximize, restore, ...), so the step runs every frame; it +//! reads each style and writes only when it differs, so it costs next to nothing. +//! +//! The same fix is in DesignCraft (#2139) and PhotoCraft (#2401). The long-term fix is in winit +//! (storytold/winit#17); this module goes when the pinned winit has it. +//! +//! The Windows calls go through safe `winsafe` wrappers (the workspace forbids `unsafe`). Which +//! windows are ours is found by enumerating this process's top-level windows of winit's window +//! class, so the main window and every other window opened later are covered alike, and a file +//! dialog or message box of the same process is left alone. + +/// `WS_BORDER`. +#[cfg(any(windows, test))] +const WS_BORDER: u32 = 0x0080_0000; +/// `WS_CAPTION`, which already includes `WS_BORDER`. +#[cfg(any(windows, test))] +const WS_CAPTION: u32 = 0x00C0_0000; + +/// `style` without the OS title bar and frame (`WS_CAPTION`, `WS_BORDER`). The sizing border +/// (`WS_THICKFRAME`) and the window buttons stay, so edge resizing, Aero snap and the system menu +/// keep working, as they did with winit 0.27's undecorated windows. +#[cfg(any(windows, test))] +pub fn borderless_style(style: u32) -> u32 { + style & !(WS_CAPTION | WS_BORDER) +} + +/// The per-frame step that keeps the windows borderless; a no-op where the OS draws the frame +/// (macOS, Linux, the BSDs), where the app uses the system title bar, and in the browser. +pub struct WindowFrame { + step: Option>, +} + +impl WindowFrame { + /// The step for an app whose windows draw their own title bar when `custom_titlebar`. + pub fn new(custom_titlebar: bool) -> Self { + Self { step: platform::step(custom_titlebar) } + } + + /// Run the step; call it once per frame, before the frame is laid out. + pub fn run(&mut self) { + if let Some(step) = self.step.as_mut() { + step(); + } + } + + #[cfg(test)] + fn with_step(step: Box) -> Self { + Self { step: Some(step) } + } +} + +#[cfg(windows)] +mod platform { + use winsafe::{HWND, HwndPlace, POINT, SIZE, co}; + + /// winit's window class (`WindowAttributes`' default `class_name`). + const WINIT_CLASS: &str = "Window Class"; + + /// A step that strips the frame styles from this process's windows each call, or `None` when + /// the app uses the system title bar (the windows are decorated). + pub fn step(custom_titlebar: bool) -> Option> { + if !custom_titlebar { + return None; + } + let pid = std::process::id(); + Some(Box::new(move || { + // The windows are handed over as real `HWND`s; nothing is wrapped from a raw handle. + let _ = winsafe::EnumWindows(|hwnd| { + strip_if_ours(&hwnd, pid); + true + }); + })) + } + + /// Strip `hwnd` when it is one of this process's winit windows. + fn strip_if_ours(hwnd: &HWND, pid: u32) { + if hwnd.GetWindowThreadProcessId().1 != pid || !matches!(hwnd.GetClassName().as_deref(), Ok(WINIT_CLASS)) { + return; + } + strip(hwnd); + } + + /// Removes `WS_CAPTION`/`WS_BORDER` and has Windows recalculate the frame; a no-op once they + /// are gone. + fn strip(hwnd: &HWND) { + let style = hwnd.style(); + // The decision is the tested arithmetic; the write uses the same bits as winsafe's flags. + if super::borderless_style(style.raw()) == style.raw() { + return; + } + hwnd.set_style(style & !(co::WS::CAPTION | co::WS::BORDER)); + let _ = hwnd.SetWindowPos( + HwndPlace::None, + POINT::new(), + SIZE::new(), + co::SWP::FRAMECHANGED | co::SWP::NOMOVE | co::SWP::NOSIZE | co::SWP::NOZORDER | co::SWP::NOACTIVATE, + ); + } +} + +#[cfg(not(windows))] +mod platform { + pub fn step(_custom_titlebar: bool) -> Option> { + None + } +} + +#[cfg(test)] +mod window_frame_tests { + use std::sync::Arc; + use std::sync::atomic::{AtomicUsize, Ordering}; + + use super::{WS_BORDER, WS_CAPTION, WindowFrame, borderless_style}; + + #[cfg(windows)] + #[test] + fn the_style_bits_match_winsafes() { + use winsafe::co; + assert_eq!(co::WS::CAPTION.raw(), WS_CAPTION); + assert_eq!(co::WS::BORDER.raw(), WS_BORDER); + } + + const WS_SYSMENU: u32 = 0x0008_0000; + const WS_THICKFRAME: u32 = 0x0004_0000; + const WS_MINIMIZEBOX: u32 = 0x0002_0000; + const WS_MAXIMIZEBOX: u32 = 0x0001_0000; + const WS_VISIBLE: u32 = 0x1000_0000; + + #[test] + fn the_borderless_style_drops_the_caption_and_border_only() { + let decorated = WS_CAPTION | WS_BORDER | WS_SYSMENU | WS_THICKFRAME | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_VISIBLE; + let bare = borderless_style(decorated); + assert_eq!(bare & WS_CAPTION, 0, "caption gone"); + assert_eq!(bare & WS_BORDER, 0, "border gone"); + assert_eq!(bare & WS_THICKFRAME, WS_THICKFRAME, "edge resizing kept"); + assert_eq!(bare & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU), WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU, "window buttons kept"); + assert_eq!(bare & WS_VISIBLE, WS_VISIBLE, "unrelated bits kept"); + } + + #[test] + fn an_already_borderless_style_is_unchanged_so_no_frame_change_is_made() { + let bare = WS_THICKFRAME | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_VISIBLE; + assert_eq!(borderless_style(bare), bare); + assert_eq!(borderless_style(borderless_style(bare | WS_CAPTION)), bare); + } + + #[test] + fn the_step_runs_each_time_the_frame_runs_it() { + let calls = Arc::new(AtomicUsize::new(0)); + let n = calls.clone(); + let mut frame = WindowFrame::with_step(Box::new(move || { + n.fetch_add(1, Ordering::SeqCst); + })); + for _ in 0..3 { + frame.run(); + } + assert_eq!(calls.load(Ordering::SeqCst), 3); + } + + #[test] + fn no_step_is_fine() { + // Decorated windows and other platforms have no step; running must do nothing. + let mut frame = WindowFrame::new(false); + frame.run(); + } +} diff --git a/docs/hardware-parity.md b/docs/hardware-parity.md index 1d64bc411..846c8a199 100644 --- a/docs/hardware-parity.md +++ b/docs/hardware-parity.md @@ -1,6 +1,6 @@ # Hardware and platform parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** patch (under Wayland a minimised window answers control and MCP requests in about half a second instead of timing out after 60 s (#1906); images copied in other apps paste in the browser (#492); text reads only the fallback fonts it draws with; `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); a batch keeps one undo snapshot, not one per step (#1099); one depth cap bounds a whole render, pattern sources included, and render threads get 8 MiB stacks (#1082); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); macOS: the Quit menu and ⌘Q ask about unsaved changes (#857); egui/eframe 0.37 dependency migration; hidden-window screenshot deadlines; zoom previews; hidden windows answer control requests; macOS file opening, the Windows start-up message, Linux packaging; copy and paste in the browser; Windows QA pass; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; pen pressure for the Pencil and brushes on Windows and from browser styluses; macOS: quitting ends the process once everything is kept, avoiding the Touch Bar teardown crash (#781); Linux and BSD clipboard: images under Wayland, reads time out; minimised windows under Wayland; window controls on Wayland without server decorations; canvas textures on device pixels) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** patch (Windows: the custom title bar's windows stay borderless, so the content is no longer drawn about 30 px low with clicks landing above it (#1343); under Wayland a minimised window answers control and MCP requests in about half a second instead of timing out after 60 s (#1906); images copied in other apps paste in the browser (#492); text reads only the fallback fonts it draws with; `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); a batch keeps one undo snapshot, not one per step (#1099); one depth cap bounds a whole render, pattern sources included, and render threads get 8 MiB stacks (#1082); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); macOS: the Quit menu and ⌘Q ask about unsaved changes (#857); egui/eframe 0.37 dependency migration; hidden-window screenshot deadlines; zoom previews; hidden windows answer control requests; macOS file opening, the Windows start-up message, Linux packaging; copy and paste in the browser; Windows QA pass; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; pen pressure for the Pencil and brushes on Windows and from browser styluses; macOS: quitting ends the process once everything is kept, avoiding the Touch Bar teardown crash (#781); Linux and BSD clipboard: images under Wayland, reads time out; minimised windows under Wayland; window controls on Wayland without server decorations; canvas textures on device pixels) · **Target:** Figma Design (desktop app 126.10.7) How FigCraft uses hardware and which platforms it runs on, against Figma. Figma's desktop app is Electron with a GPU helper process; its canvas renders on the GPU (WebGL, with WebGPU rolling out @@ -50,6 +50,7 @@ Nothing has been timed against Figma on the same document (needs `.fig` import). | Date | Change | Summary | |---|---|---| +| 2026-11-10 | patch | M10, #1343 (also #1422, #2233): Windows: the window no longer draws below a hidden caption. FigCraft draws its own title bar on Windows and opens undecorated windows, but winit 0.30 still gives them `WS_CAPTION | WS_BORDER`; on some systems the desktop compositor reserves that caption, so the content was drawn about 30 px low (a black band above it) while clicks kept the client coordinates and landed above what was drawn. A per-frame step (`apps/figcraft/src/window_frame.rs`, safe `winsafe` calls, Windows only) clears `WS_CAPTION` and `WS_BORDER` from every FigCraft window, the main one and the others, keeping the sizing border and window buttons so edge resizing and snap work, and writes only when a style changed (winit puts them back on maximize and restore). The same fix as DesignCraft #2139 and PhotoCraft #2401; the maximize-to-work-area trim from DesignCraft is left for a later change. Not run on a Windows machine that shows the offset: the style math and the per-frame hook are tested, the window itself needs a live check. Tests: `window_frame_tests`. Numbers unchanged | | 2026-11-06 | patch | M8, #1906: under Wayland (seen on GNOME and KDE Plasma) a minimised FigCraft window still reports itself visible and the compositor stops asking it to draw, so every control or attached-MCP request waited for a frame and timed out after 60 s ("it was not applied"), though eframe kept running the app's logic. `control::background` now treats a window that drew no frame for `NOT_DRAWING_AFTER` (0.2 s) while a request waited for it as hidden: state-only requests are answered from the logic passes (0.54 s each, measured on GNOME Wayland; they took 13.7 s or timed out before), the wait starts again when the window draws, and screenshots and `ui.input` still wait for a frame. Test: `idle_tests::a_window_that_stopped_drawing_answers_from_its_logic_passes` | | 2026-10-31 | minor | M1, #492: Web row: the browser pastes images copied in other apps, read from the paste event under the same limits as the desktop. Numbers unchanged. | | 2026-10-30 | minor | M8: text reads only the fallback fonts it draws with. Each fallback family reads the face nearest a run's style, not all of them (Noto Sans CJK is seven files of 16–20 MB); families naming the faces of one file share its bytes; and the faces are worked out once per style until fonts change, not for every text laid out. First text laid out on a Linux machine with Noto Sans CJK, DejaVu Sans and Inter: 41 files (265 MiB, kept in memory) and 41 faces parsed → 3 files (20 MiB) and 4 faces; fallback lookups per text laid out ~45 µs → 0.2 µs. Tests: `fontdb_fallback_tests`. Numbers unchanged | From 503823f9589f78473515547484fc01e0c159d30e Mon Sep 17 00:00:00 2001 From: Denis Gomes <6731020+denisg0mes@users.noreply.github.com> Date: Tue, 10 Nov 2026 20:56:35 -0500 Subject: [PATCH 124/239] M8: hardware-parity names the copy an image draws from The canvas takes the smallest copy that holds the size an image shows in device pixels, whatever the canvas zoom, as #1483 did for images over 4096 px. The canvas row said the copy was no larger than the image shows, and both changelog rows said views at 100% and closer draw from the image itself; a 3000 px image fitted into a 600 px layer draws from a 1024 px copy at 100%. Co-Authored-By: Claude Opus 5.5 --- docs/hardware-parity.md | 4 ++-- docs/roadmap.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/hardware-parity.md b/docs/hardware-parity.md index fdc86d54d..3ee997999 100644 --- a/docs/hardware-parity.md +++ b/docs/hardware-parity.md @@ -12,7 +12,7 @@ since 2025). FigCraft renders the canvas on the CPU and presents it through wgpu | Feature | Figma | FigCraft (macOS / Windows / Linux / web) | Hours | |---|---|---|---| -| Canvas rendering | GPU | CPU (tiny-skia), banded across cores, retained (re-renders only what an edit or pan touches), levels of detail below 50% zoom, images drawn from a copy no larger than they show, down to 256 px (#1483); when renders from scratch are slow, a new zoom shows the whole view coarsely first, then refines it (#312); shown through wgpu (WebGPU or WebGL2 in the browser) | 30–60 for a GPU path | +| Canvas rendering | GPU | CPU (tiny-skia), banded across cores, retained (re-renders only what an edit or pan touches), levels of detail below 50% zoom, images drawn from the smallest copy that holds the size they show, down to 256 px (#1483); when renders from scratch are slow, a new zoom shows the whole view coarsely first, then refines it (#312); shown through wgpu (WebGPU or WebGL2 in the browser) | 30–60 for a GPU path | | Effects (blurs, glass, noise) | GPU | CPU | in the above | | HiDPI / Retina | yes | yes (all); a canvas image rendered at the screen's density is placed on whole device pixels, so fractional pans, zooms and display scales don't blur it (#359; geometry tests, the snapping not judged by eye) | — | | Wide-gamut display (Display P3) | yes, on capable displays | colours stored and exported in P3; the screen shows sRGB: eframe/egui-wgpu 0.37 configure an 8-bit sRGB surface with no colour space option, although wgpu 30 can present Display P3 or extended sRGB on Metal, DX12, Vulkan and WebGPU (see gaps #18). The colour picker warns about colours outside sRGB and View ▸ Soft-proof sRGB stripes them on the canvas | 2–5 | @@ -50,7 +50,7 @@ Nothing has been timed against Figma on the same document (needs `.fig` import). | Date | Change | Summary | |---|---|---| -| 2026-11-10 | minor | Zoomed-out images: the canvas's copies of an image shown smaller than its pixels now also come at 256, 512, 1024 and 2048 px, the smallest that holds what the screen shows, and images of 4096 px or less get them too (they were drawn from the image itself at any size). On a page of 237 photos, about 4.6 GB decoded against the 512 MB cache, every zoomed-out render decoded them again: 3.4 s a frame at 1% before, 0.9 s the first time and 4 ms after; peak memory 3.9 → 2.3 GB. Exports and views at 100% and closer still draw from the image itself. | +| 2026-11-10 | minor | Zoomed-out images: the canvas's copies of an image shown smaller than its pixels now also come at 256, 512, 1024 and 2048 px, the smallest that holds what the screen shows, and images of 4096 px or less get them too (they were drawn from the image itself at any size). On a page of 237 photos, about 4.6 GB decoded against the 512 MB cache, every zoomed-out render decoded them again: 3.4 s a frame at 1% before, 0.9 s the first time and 4 ms after; peak memory 3.9 → 2.3 GB. Exports, and images shown at their own size or larger, still draw from the image itself. | | 2026-11-06 | patch | M8, #1906: under Wayland (seen on GNOME and KDE Plasma) a minimised FigCraft window still reports itself visible and the compositor stops asking it to draw, so every control or attached-MCP request waited for a frame and timed out after 60 s ("it was not applied"), though eframe kept running the app's logic. `control::background` now treats a window that drew no frame for `NOT_DRAWING_AFTER` (0.2 s) while a request waited for it as hidden: state-only requests are answered from the logic passes (0.54 s each, measured on GNOME Wayland; they took 13.7 s or timed out before), the wait starts again when the window draws, and screenshots and `ui.input` still wait for a frame. Test: `idle_tests::a_window_that_stopped_drawing_answers_from_its_logic_passes` | | 2026-10-31 | minor | M1, #492: Web row: the browser pastes images copied in other apps, read from the paste event under the same limits as the desktop. Numbers unchanged. | | 2026-10-30 | minor | M8: text reads only the fallback fonts it draws with. Each fallback family reads the face nearest a run's style, not all of them (Noto Sans CJK is seven files of 16–20 MB); families naming the faces of one file share its bytes; and the faces are worked out once per style until fonts change, not for every text laid out. First text laid out on a Linux machine with Noto Sans CJK, DejaVu Sans and Inter: 41 files (265 MiB, kept in memory) and 41 faces parsed → 3 files (20 MiB) and 4 faces; fallback lookups per text laid out ~45 µs → 0.2 µs. Tests: `fontdb_fallback_tests`. Numbers unchanged | diff --git a/docs/roadmap.md b/docs/roadmap.md index 07faecb55..966597228 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -76,7 +76,7 @@ blockers. | Date | Change | Summary | |---|---|---| -| 2026-11-10 | minor | Zoomed-out images: the canvas's copies of an image shown smaller than its pixels now also come at 256, 512, 1024 and 2048 px, the smallest that holds what the screen shows, and images of 4096 px or less get them too (they were drawn from the image itself at any size). On a page of 237 photos, about 4.6 GB decoded against the 512 MB cache, every zoomed-out render decoded them again: 3.4 s a frame at 1% before, 0.9 s the first time and 4 ms after; peak memory 3.9 → 2.3 GB. Exports and views at 100% and closer still draw from the image itself. | +| 2026-11-10 | minor | Zoomed-out images: the canvas's copies of an image shown smaller than its pixels now also come at 256, 512, 1024 and 2048 px, the smallest that holds what the screen shows, and images of 4096 px or less get them too (they were drawn from the image itself at any size). On a page of 237 photos, about 4.6 GB decoded against the 512 MB cache, every zoomed-out render decoded them again: 3.4 s a frame at 1% before, 0.9 s the first time and 4 ms after; peak memory 3.9 → 2.3 GB. Exports, and images shown at their own size or larger, still draw from the image itself. | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`) draft catalog: 1,975 UI strings, 641 command labels and 31 menu wordings, clean-room from the English source; zh-TW, zh-HK, zh-MO and zh-Hant read it, explicit Hans stays Simplified; Noto Sans CJK TC then Taiwan system faces; no bundled font; native review pending. Numbers unchanged | | 2026-11-03 | patch | M4, #1747: a text layer still carrying the name its characters gave it is renamed as they are typed, so the Layers panel no longer shows the word a layer started with while the canvas shows another (`hello` typed into `hello there` read as `hello` in the panel). A name the author typed is kept, and only the editor follows the characters: commands leave the name alone, so the layer names `data.fill`, component property bindings and templates use as field keys stay put. Tests: `text_behaviour_tests::typing_renames_a_text_layer_that_still_carries_the_name_its_characters_gave_it`, `setting_characters_as_a_command_never_renames_the_layer`. Grade unchanged | | 2026-10-31 | minor | M12: as the help describes, holding Cmd/Ctrl while moving a connector's end places it on any part of an object instead of snapping to a side. It keeps that spot as a fraction of the object's box, so it follows the object when it moves or resizes, and without the key an end snaps as before. `board.connector {fromAt, toAt}` and `board.reattach {at}` take it; saved only when set. Numbers unchanged | From 19c8e01811824d8f5f99730e38b57c323d84557f Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 00:08:06 -0500 Subject: [PATCH 125/239] M10: Design panel: 24 pt icon buttons draw 16 pt glyphs, as a fill row does (#2227) A live check showed the header's eye still smaller than a fill row's: `icons::button`, which draws the fill rows, paints the icons' native 16 px glyph in a 24 pt button, while the shared inset gave 14. The inset is now 4, so section headers, `icon_button_at` and the panels' Close and Swap buttons draw 16 pt glyphs like the rest. The test compares the header's eye with both `icon_button_at` and `icons::button`. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/ui-egui/src/header_icon_size_tests.rs | 21 +++++++++++++------- crates/ui-egui/src/widgets.rs | 7 ++++--- docs/ui-parity.md | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/crates/ui-egui/src/header_icon_size_tests.rs b/crates/ui-egui/src/header_icon_size_tests.rs index 35db827df..917276c2a 100644 --- a/crates/ui-egui/src/header_icon_size_tests.rs +++ b/crates/ui-egui/src/header_icon_size_tests.rs @@ -3,7 +3,7 @@ use egui::{Context, Rect, pos2, vec2}; -use crate::icons::Icon; +use crate::icons::{self, Icon}; use crate::widgets::{icon_button_at, icon_glyph_rect, section_header}; /// Bounding box of everything painted in one frame of `add`. @@ -24,22 +24,29 @@ fn painted_box(add: impl FnOnce(&mut egui::Ui)) -> Rect { .fold(Rect::NOTHING, |a, b| a.union(b)) } +/// The header's eye, `icon_button_at`'s and a fill row's (`icons::button`, the reporter's +/// reference) are drawn at one size. #[test] -fn header_eye_draws_as_large_as_an_icon_buttons_eye() { +fn header_eye_draws_as_large_as_a_fill_rows_eye() { let header = painted_box(|ui| { section_header(ui, "Appearance", &[(Icon::Eye, "Hide")], false); }); - let button = painted_box(|ui| { + let at = painted_box(|ui| { let r = Rect::from_min_size(pos2(20.0, 20.0), vec2(24.0, 24.0)); icon_button_at(ui, ui.scope_id().with("b"), r, Icon::Eye, "Hide"); }); - assert!(header.is_finite() && button.is_finite(), "{header:?} {button:?}"); - assert!((header.width() - button.width()).abs() < 0.5, "widths {} vs {}", header.width(), button.width()); - assert!((header.height() - button.height()).abs() < 0.5, "heights {} vs {}", header.height(), button.height()); + let row = painted_box(|ui| { + icons::button(ui, Icon::Eye, 24.0, false, "Toggle visibility"); + }); + for (name, b) in [("icon_button_at", at), ("icons::button", row)] { + assert!(header.is_finite() && b.is_finite(), "{header:?} {b:?}"); + assert!((header.width() - b.width()).abs() < 0.5, "{name}: widths {} vs {}", header.width(), b.width()); + assert!((header.height() - b.height()).abs() < 0.5, "{name}: heights {} vs {}", header.height(), b.height()); + } } #[test] fn glyph_rect_is_the_shared_inset_of_the_button() { let b = Rect::from_min_size(pos2(0.0, 0.0), vec2(24.0, 24.0)); - assert_eq!(icon_glyph_rect(b).size(), vec2(14.0, 14.0)); + assert_eq!(icon_glyph_rect(b).size(), vec2(16.0, 16.0)); } diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 12cc02f14..79d0777f1 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -1045,9 +1045,10 @@ pub fn tight_end_n(ui: &mut Ui, count: usize, add: impl FnOnce(&mut Ui) -> R) add(&mut child) } -/// Inset of the glyph inside a 24 pt icon button: a 14 pt glyph, the size every icon button in the -/// panels draws at (section header buttons included). -pub const ICON_BUTTON_INSET: f32 = 5.0; +/// Inset of the glyph inside a 24 pt icon button: a 16 pt glyph, the icons' native size and what +/// `icons::button` draws (a fill row's eye), so every 24 pt icon button in the panels matches it +/// (section header buttons included). +pub const ICON_BUTTON_INSET: f32 = 4.0; /// The rect a 24 pt icon button paints its glyph in. pub fn icon_glyph_rect(button: Rect) -> Rect { diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 9412fb06f..b3f6506ac 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -200,7 +200,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | 2026-11-06 | patch | M7, #2032: closing a tab whose file has unsaved changes, by its X, a middle click, File ▸ Close tab or its shortcut, only showed a toast ("save first, or close again with Alt to discard") and left the tab open, so closing seemed not to work. It now asks the unsaved-changes question the window asks (`windows::TabClose`): Don't Save closes the tab, Cancel or Escape keeps it, Save saves the file and then closes it (a file without a path, or saved as .fig, asks where with Save as first and stays open if that is cancelled); Alt+close still drops the changes at once, and `file.close`'s `dialog.unsaved` request asks too. The three toasts left the catalogs. Tests: `titlebar_tests::closing_a_tab_with_unsaved_changes_asks`, `titlebar_tests::save_in_the_tab_question_saves_then_closes`. Reordering tabs by dragging, the issue's other half, landed on 2026-10-19 (`dragging_a_tab_along_the_bar_reorders_it_without_detaching`) | | 2026-11-05 | minor | M4, #1830: a paragraph's base direction can be forced (`TextDirection`: Auto, Ltr, Rtl on `ParaList`): Text ▸ Text direction ▸ Auto / Left to right / Right to left (`text.directionAuto` / `Ltr` / `Rtl`) and `text.direction {direction, ids?}` set the edited paragraphs while editing, else the layer's; `node.set textDirection`; the Type settings control once a right-to-left script is in the text; inspect `textDirection` / `lineDirections`; CSS `direction`; `.fig` lines' `sourceDirectionality` in and out. Layout gives each paragraph its base level (`Bidi::of` runs the algorithm per paragraph, as it starts over at each). Before, direction came from the letters only ("controls are available to override text direction per paragraph", Add right-to-left text). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests::a_lines_source_directionality_is_its_paragraphs_direction_both_ways`. | | 2026-11-02 | minor | M1, #1836: pick select. Tab while the keyboard selection box shows, or Alt/Ctrl+Space again, puts a pink outline on the first selected layer (the page's top layer with nothing selected); Tab and Shift+Tab move it between sibling layers as the Layers panel lists them, Enter into a frame's top child, Shift+Enter out to the parent (never the page), Space selects the layer under it, Escape or a press on the canvas ends it; the chord again while the pick cursor shows brings the box back (Accessibility at Figma). The control channel's `ui.key` sends the box's and the pick cursor's keys to them too. One documented row more (135, 134 bound); four gesture rows. Tests: `layers_keyboard_tests::tab_switches_the_selection_box_to_pick_select`. | -| 2026-11-10 | patch | M10, #2227: the Design panel's section header buttons (Appearance, Typography, Fill, Stroke, Effects) draw their icons at the size of the panel's other 24 pt icon buttons, 14 pt, not 12 pt; the Close and Swap buttons of the assets and prototype panels share the inset. Test: `header_icon_size_tests`. Numbers unchanged. | +| 2026-11-10 | patch | M10, #2227: the Design panel's section header buttons (Appearance, Typography, Fill, Stroke, Effects) draw their icons at the size of the panel's other 24 pt icon buttons, 16 pt (the icons' native size, as a fill row's eye), not 12 pt; `icon_button_at` goes from 14 to 16 pt with them; the Close and Swap buttons of the assets and prototype panels share the inset. Test: `header_icon_size_tests`. Numbers unchanged. | | 2026-11-05 | patch | M1, #2003: the Design panel's boolean operation menu leads Union, Subtract, Intersect and Exclude with original icons drawn in code (two offset squares, the result filled at reduced alpha). Numbers unchanged. | | 2026-11-02 | minor | M8, #1875: a fill per region. With regions of a vector selected in edit mode (a press inside one with the Move tool, `vector.edit.select {regions}`), the Fill section lists the regions' own fills (the layer's for a region that has none; mixed content when they differ) and its rows and the colour picker edit them: `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` on the edited layer go to the selected regions' stacks (`Region.fills`, what the renderer already draws), the layer's fills and fill style untouched; `regions: [index, ...]` names them on any vector layer (Edit vector layers). Tests: `regions_tests::the_fill_commands_edit_the_selected_regions`. Numbers unchanged. | | 2026-11-05 | patch | M1, #1758: a mouse's side buttons (4 and 5) pan the canvas as the middle button does, the pan ending on release over the canvas or off it; the grab cursor shows while they're held. | From 8e1a2ff26223e25bbf452bebb606564241eca7a0 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 00:35:51 -0500 Subject: [PATCH 126/239] M10: Docs: the hardware-parity row keeps its three cells (#1343) A bare pipe inside the code span `WS_CAPTION | WS_BORDER` split the table row; the two style names are separate code spans now. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- docs/hardware-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hardware-parity.md b/docs/hardware-parity.md index 846c8a199..b827a887c 100644 --- a/docs/hardware-parity.md +++ b/docs/hardware-parity.md @@ -50,7 +50,7 @@ Nothing has been timed against Figma on the same document (needs `.fig` import). | Date | Change | Summary | |---|---|---| -| 2026-11-10 | patch | M10, #1343 (also #1422, #2233): Windows: the window no longer draws below a hidden caption. FigCraft draws its own title bar on Windows and opens undecorated windows, but winit 0.30 still gives them `WS_CAPTION | WS_BORDER`; on some systems the desktop compositor reserves that caption, so the content was drawn about 30 px low (a black band above it) while clicks kept the client coordinates and landed above what was drawn. A per-frame step (`apps/figcraft/src/window_frame.rs`, safe `winsafe` calls, Windows only) clears `WS_CAPTION` and `WS_BORDER` from every FigCraft window, the main one and the others, keeping the sizing border and window buttons so edge resizing and snap work, and writes only when a style changed (winit puts them back on maximize and restore). The same fix as DesignCraft #2139 and PhotoCraft #2401; the maximize-to-work-area trim from DesignCraft is left for a later change. Not run on a Windows machine that shows the offset: the style math and the per-frame hook are tested, the window itself needs a live check. Tests: `window_frame_tests`. Numbers unchanged | +| 2026-11-10 | patch | M10, #1343 (also #1422, #2233): Windows: the window no longer draws below a hidden caption. FigCraft draws its own title bar on Windows and opens undecorated windows, but winit 0.30 still gives them `WS_CAPTION` and `WS_BORDER`; on some systems the desktop compositor reserves that caption, so the content was drawn about 30 px low (a black band above it) while clicks kept the client coordinates and landed above what was drawn. A per-frame step (`apps/figcraft/src/window_frame.rs`, safe `winsafe` calls, Windows only) clears `WS_CAPTION` and `WS_BORDER` from every FigCraft window, the main one and the others, keeping the sizing border and window buttons so edge resizing and snap work, and writes only when a style changed (winit puts them back on maximize and restore). The same fix as DesignCraft #2139 and PhotoCraft #2401; the maximize-to-work-area trim from DesignCraft is left for a later change. Not run on a Windows machine that shows the offset: the style math and the per-frame hook are tested, the window itself needs a live check. Tests: `window_frame_tests`. Numbers unchanged | | 2026-11-06 | patch | M8, #1906: under Wayland (seen on GNOME and KDE Plasma) a minimised FigCraft window still reports itself visible and the compositor stops asking it to draw, so every control or attached-MCP request waited for a frame and timed out after 60 s ("it was not applied"), though eframe kept running the app's logic. `control::background` now treats a window that drew no frame for `NOT_DRAWING_AFTER` (0.2 s) while a request waited for it as hidden: state-only requests are answered from the logic passes (0.54 s each, measured on GNOME Wayland; they took 13.7 s or timed out before), the wait starts again when the window draws, and screenshots and `ui.input` still wait for a frame. Test: `idle_tests::a_window_that_stopped_drawing_answers_from_its_logic_passes` | | 2026-10-31 | minor | M1, #492: Web row: the browser pastes images copied in other apps, read from the paste event under the same limits as the desktop. Numbers unchanged. | | 2026-10-30 | minor | M8: text reads only the fallback fonts it draws with. Each fallback family reads the face nearest a run's style, not all of them (Noto Sans CJK is seven files of 16–20 MB); families naming the faces of one file share its bytes; and the faces are worked out once per style until fonts change, not for every text laid out. First text laid out on a Linux machine with Noto Sans CJK, DejaVu Sans and Inter: 41 files (265 MiB, kept in memory) and 41 faces parsed → 3 files (20 MiB) and 4 faces; fallback lookups per text laid out ~45 µs → 0.2 µs. Tests: `fontdb_fallback_tests`. Numbers unchanged | From 985231858c5f63806793e1dd81d82341871147bf Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 00:38:03 -0500 Subject: [PATCH 127/239] M10: Design panel: Swap orientation and the quick actions use the shared icon size (#2227) The frame's Swap orientation button and the selection's quick-action buttons (24 pt) still painted their glyphs at the old 14 pt inset beside Fit to contents' 16 pt; they use `icon_glyph_rect` now. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/ui-egui/src/panels/right.rs | 4 ++-- docs/ui-parity.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index bba57c778..722d52e9f 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -453,7 +453,7 @@ fn header(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { if sresp.hovered() { ui.painter().rect_filled(sr, CornerRadius::same(5), t.hover); } - icons::paint(ui.painter(), sr.shrink(5.0), Icon::Rotate, t.icon); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(sr), Icon::Rotate, t.icon); if sresp.clicked() { app.run("frame.swapOrientation", json!({"ids": sel})); } @@ -505,7 +505,7 @@ fn header(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) { ("bool.union", Some(op)) => crate::layers::op_icon(op), _ => icon, }; - icons::paint(ui.painter(), br.shrink(5.0), icon, t.icon); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(br), icon, t.icon); if cmd == "bool.union" { menu_popup(&bresp).width(180.0).show(|ui| { for (op, c) in [ diff --git a/docs/ui-parity.md b/docs/ui-parity.md index b3f6506ac..dd24d0d0c 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -200,7 +200,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | 2026-11-06 | patch | M7, #2032: closing a tab whose file has unsaved changes, by its X, a middle click, File ▸ Close tab or its shortcut, only showed a toast ("save first, or close again with Alt to discard") and left the tab open, so closing seemed not to work. It now asks the unsaved-changes question the window asks (`windows::TabClose`): Don't Save closes the tab, Cancel or Escape keeps it, Save saves the file and then closes it (a file without a path, or saved as .fig, asks where with Save as first and stays open if that is cancelled); Alt+close still drops the changes at once, and `file.close`'s `dialog.unsaved` request asks too. The three toasts left the catalogs. Tests: `titlebar_tests::closing_a_tab_with_unsaved_changes_asks`, `titlebar_tests::save_in_the_tab_question_saves_then_closes`. Reordering tabs by dragging, the issue's other half, landed on 2026-10-19 (`dragging_a_tab_along_the_bar_reorders_it_without_detaching`) | | 2026-11-05 | minor | M4, #1830: a paragraph's base direction can be forced (`TextDirection`: Auto, Ltr, Rtl on `ParaList`): Text ▸ Text direction ▸ Auto / Left to right / Right to left (`text.directionAuto` / `Ltr` / `Rtl`) and `text.direction {direction, ids?}` set the edited paragraphs while editing, else the layer's; `node.set textDirection`; the Type settings control once a right-to-left script is in the text; inspect `textDirection` / `lineDirections`; CSS `direction`; `.fig` lines' `sourceDirectionality` in and out. Layout gives each paragraph its base level (`Bidi::of` runs the algorithm per paragraph, as it starts over at each). Before, direction came from the letters only ("controls are available to override text direction per paragraph", Add right-to-left text). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests::a_lines_source_directionality_is_its_paragraphs_direction_both_ways`. | | 2026-11-02 | minor | M1, #1836: pick select. Tab while the keyboard selection box shows, or Alt/Ctrl+Space again, puts a pink outline on the first selected layer (the page's top layer with nothing selected); Tab and Shift+Tab move it between sibling layers as the Layers panel lists them, Enter into a frame's top child, Shift+Enter out to the parent (never the page), Space selects the layer under it, Escape or a press on the canvas ends it; the chord again while the pick cursor shows brings the box back (Accessibility at Figma). The control channel's `ui.key` sends the box's and the pick cursor's keys to them too. One documented row more (135, 134 bound); four gesture rows. Tests: `layers_keyboard_tests::tab_switches_the_selection_box_to_pick_select`. | -| 2026-11-10 | patch | M10, #2227: the Design panel's section header buttons (Appearance, Typography, Fill, Stroke, Effects) draw their icons at the size of the panel's other 24 pt icon buttons, 16 pt (the icons' native size, as a fill row's eye), not 12 pt; `icon_button_at` goes from 14 to 16 pt with them; the Close and Swap buttons of the assets and prototype panels share the inset. Test: `header_icon_size_tests`. Numbers unchanged. | +| 2026-11-10 | patch | M10, #2227: the Design panel's section header buttons (Appearance, Typography, Fill, Stroke, Effects) draw their icons at the size of the panel's other 24 pt icon buttons, 16 pt (the icons' native size, as a fill row's eye), not 12 pt; `icon_button_at` goes from 14 to 16 pt with them; the Close and Swap buttons of the assets and prototype panels and the Design panel's Swap orientation and quick-action buttons share the inset. Test: `header_icon_size_tests`. Numbers unchanged. | | 2026-11-05 | patch | M1, #2003: the Design panel's boolean operation menu leads Union, Subtract, Intersect and Exclude with original icons drawn in code (two offset squares, the result filled at reduced alpha). Numbers unchanged. | | 2026-11-02 | minor | M8, #1875: a fill per region. With regions of a vector selected in edit mode (a press inside one with the Move tool, `vector.edit.select {regions}`), the Fill section lists the regions' own fills (the layer's for a region that has none; mixed content when they differ) and its rows and the colour picker edit them: `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` on the edited layer go to the selected regions' stacks (`Region.fills`, what the renderer already draws), the layer's fills and fill style untouched; `regions: [index, ...]` names them on any vector layer (Edit vector layers). Tests: `regions_tests::the_fill_commands_edit_the_selected_regions`. Numbers unchanged. | | 2026-11-05 | patch | M1, #1758: a mouse's side buttons (4 and 5) pan the canvas as the middle button does, the pan ending on release over the canvas or off it; the grab cursor shows while they're held. | From 8e6c342f13a8da5e78c60c713b82681761451899 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 02:01:32 -0500 Subject: [PATCH 128/239] M4: a rounded vector's fill and outline follow every corner after a Pen bridge (#1951) The reporter's file has a corner cut off by a segment drawn first, with the corner point then deleted with Delete. The region's loop is left as the open chain of the other four segments, and the cutting segment, which joins the chain's two ends, is in no loop. The stroke follows the network, so it rounds both ends of that segment; the fill and the selection outline follow the loop. Cause: VectorNetwork::rounded_smoothed rebuilds each loop by inserting a corner's arcs where the loop arrives at the point, so the point the loop starts at is never cut (in a closed loop it is arrived at last), and the open loop's closing edge ran straight to it. closing_segment now finds the segment joining an open loop's two ends when no loop holds it, and rounding walks it as the loop's last segment, so every corner of the fill and outline matches the stroke. Closed loops and the cases #1991 fixed are untouched. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/doc/src/tests.rs | 29 +++++++++++++++++++++++++++++ crates/doc/src/vector.rs | 24 ++++++++++++++++++++++-- docs/target-app-parity.md | 5 +++-- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/crates/doc/src/tests.rs b/crates/doc/src/tests.rs index 75dbe7cf1..0d4efd6ec 100644 --- a/crates/doc/src/tests.rs +++ b/crates/doc/src/tests.rs @@ -902,6 +902,35 @@ fn a_chamfered_rectangles_rounded_fill_is_cut_at_every_point() { } } +/// The reporter's network (#1951): a corner cut off by a segment drawn before the corner point was +/// deleted, so the region's loop is the open chain of the other four segments and the cutting +/// segment, joining the chain's two ends, is in no loop. Rounded, the fill and the region trace +/// the stroke's outline, cut by an arc at the chain's ends as at every other point. +#[test] +fn a_rounded_loop_left_open_where_a_segment_joins_its_ends_follows_that_segment() { + use figcraft_geom::BezPath; + use figcraft_geom::kurbo::{ParamCurveArclen, ParamCurveNearest}; + let corners = [Point::new(0.0, 0.0), Point::new(525.0, 525.0), Point::new(0.0, 525.0), Point::new(333.0, 0.0), Point::new(525.0, 183.0)]; + let mut net = VectorNetwork::from_points(&corners, false); + net.segments = [(0, 3), (1, 2), (2, 0), (4, 1), (3, 4)].iter().map(|&(a, b)| Segment::line(a, b)).collect(); + net.regions.push(Region { loops: vec![vec![3, 1, 2, 0]], winding: WindingRule::NonZero, fills: None, paint_space: None }); + for v in &mut net.vertices { + v.radius = 125.0; + } + let keeps_off = |path: &BezPath, p: Point| path.segments().map(|s| s.nearest(p, 1e-9).distance_sq.sqrt()).fold(f64::INFINITY, f64::min); + let length = |path: &BezPath| path.segments().map(|s| s.arclen(1e-9)).sum::(); + let stroke = net.stroke_path(); + let fill = net.fill_path(); + let region = net.rounded().unwrap().region_path(0).unwrap(); + for (i, p) in corners.iter().enumerate() { + assert!(keeps_off(&stroke, *p) > 2.0, "the stroke is cut at point {i}"); + assert!(keeps_off(&fill, *p) > 2.0, "the fill runs into point {i} ({:.2} from it)", keeps_off(&fill, *p)); + assert!(keeps_off(®ion, *p) > 2.0, "the region runs into point {i} ({:.2} from it)", keeps_off(®ion, *p)); + } + assert!((length(&fill) - length(&stroke)).abs() < 1e-6, "fill {} and stroke {} trace the same outline", length(&fill), length(&stroke)); + assert!((length(®ion) - length(&stroke)).abs() < 1e-6, "region {} and stroke {} trace the same outline", length(®ion), length(&stroke)); +} + #[test] fn stored_variable_ids_resolve_only_their_exact_collection() { let mut vars = crate::proto_expr_tests::vars(); diff --git a/crates/doc/src/vector.rs b/crates/doc/src/vector.rs index f53ad4408..b1b45423b 100644 --- a/crates/doc/src/vector.rs +++ b/crates/doc/src/vector.rs @@ -478,9 +478,10 @@ impl VectorNetwork { (Some(first), _) => first.a, _ => 0, }; - let mut rebuilt = Vec::with_capacity(lp.len() + by_vertex.len().min(lp.len())); + let mut rebuilt = Vec::with_capacity(lp.len() + by_vertex.len().min(lp.len()) + 1); let mut cur = start_v; - for &x in lp.iter() { + let closing = self.closing_segment(lp, start_v); + for &x in lp.iter().chain(closing.iter()) { rebuilt.push(x); let Some(s) = self.segments.get(x) else { continue }; cur = if s.a == cur { s.b } else { s.a }; @@ -497,6 +498,25 @@ impl VectorNetwork { Some(out) } + /// The segment that joins the two ends of an open loop `lp` (walked from `start_v`) when it is + /// in no loop of its own: a corner cut off by a segment drawn before the corner point was + /// deleted leaves the loop open there, and the stroke follows that segment. Rounding walks it + /// as the loop's last segment, so the points at the loop's ends are cut by arcs as the stroke's + /// are (#1951). + fn closing_segment(&self, lp: &[usize], start_v: usize) -> Option { + let mut cur = start_v; + for &x in lp { + let s = self.segments.get(x)?; + cur = if s.a == cur { s.b } else { s.a }; + } + if cur == start_v { + return None; + } + let in_loop = |i: usize| self.regions.iter().flat_map(|r| r.loops.iter().flatten()).any(|&x| x == i); + let ends = |s: &Segment| (s.a == cur && s.b == start_v) || (s.b == cur && s.a == start_v); + self.segments.iter().position(ends).filter(|&i| !in_loop(i)) + } + /// How point `v` (its `incident` segments) is rounded, if it is: not where the two segments /// run on smoothly or fold back. With `smoothing`, a point between two straight segments that /// are both `on_loop` gets a smoothed corner. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 031521f51..cf4955d1f 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-06 · **Change:** minor (justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap, also when the loop was left open at a segment drawn before the corner was deleted (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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 @@ -246,7 +246,7 @@ Hours in this narrative are the builders' estimates; the tables above supersede closed area (faces with holes), point/segment selection, handle mirroring (none/angle/angle and length) with a Point panel (position, corner radius, mirroring), smooth/sharp points, join and merge (joining the two ends of a path broken open by a deleted point closes it again, so its - fill follows the new segment, #1951), delete vs delete-and-heal, nudging, one undo step per gesture, eraser (⇧E), shape builder + fill follows the new segment, and a rounded loop left open where a segment joins its ends is cut by arcs at them too, #1951), delete vs delete-and-heal, nudging, one undo step per gesture, eraser (⇧E), shape builder (⇧M: the regions of overlapping shapes, click or drag to merge, Alt to remove, curves kept), variable width strokes (width profile presets with previews in the stroke settings, the Variable width tool ⇧W: drag the path to add a width point, slide points, drag their handles, Delete; @@ -655,6 +655,7 @@ Carried over from the ROADMAP's "Shipped so far" (2026-10-10). The test count th | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`) draft catalog: 1,975 UI strings, 641 command labels and 31 menu wordings, clean-room from the English source; zh-TW, zh-HK, zh-MO and zh-Hant read it, explicit Hans stays Simplified; Noto Sans CJK TC then Taiwan system faces; no bundled font; native review pending. Numbers unchanged | | 2026-11-04 | patch | M4, #1970: justified Chinese, Japanese and Korean text, written without spaces between words, aligns its right edge: the room on each line but a paragraph's last goes between its characters, each a word of its own as for line breaking ("Justify aligns the first word in each line of text to the left-most edge, and the last to the right-most edge"), wherever a line could break there, so none opens before a full stop or closing bracket, nor after an opening one. Latin text widens its spaces as before; mixed text widens both. A gap is reordered with the line's runs as a space of no width would be, so one beside a Hebrew word in Chinese text, or beside a Chinese word within that Hebrew, opens beside the word, not inside it. `figcraft_text::breaks::justify_between`, beside `break_between`, says where. Evidence: `tests::justified_ideographs_spread_the_room_between_characters` (fails on main). | | 2026-11-04 | patch | M8, #1951 (#1506 again): a path broken open by deleting a point (Delete, not Shift+Delete) is filled closed by a straight line across the gap, as an open path's fill is; joining its two ends again (the pen onto the other end, Connect, ⌘J) left the loop without the new segment, so once the points were rounded the fill and the selection outline ran straight across while the stroke followed the segment and its arcs. Joining now closes the loop through the new segment ("Click to close the path."; "You can use the Paint tool to add fills to any closed regions of a vector network."): `ops::connect` puts it into the loop whose segments are the chain between the ends, at the gap and in the loop's own order, so a hole keeps its winding whichever end was clicked first; a loop listed out of walking order is left as it was. Evidence: `vectoredit::tests::a_rounded_chamfer_made_other_ways_fills_along_its_arcs` (fails on main: the loop kept 4 of 5 segments), `a_rounded_chamfer_cut_in_the_editor_fills_along_its_arcs` (Shift+Delete, with and without a region fill), `doc::tests::a_chamfered_rectangles_rounded_fill_is_cut_at_every_point` (fill, region path and stroke agree for every loop order and segment direction of a chamfered rectangle). | +| 2026-11-11 | patch | M4, #1951 (reporter's file, v0.17.0): a corner cut off by a segment drawn first, the corner point then deleted with Delete, leaves the region's loop as the open chain of the other segments, the cutting segment (which joins the chain's two ends) in no loop; rounded, the loop's first point was never cut by an arc (rounding only adds arcs at points the loop arrives at) and the closing edge ran straight, so the fill and the selection outline missed corners the stroke rounded. `VectorNetwork::rounded_smoothed` now walks the segment joining an open loop's ends, when no loop holds it, as the loop's last segment (`closing_segment`). Evidence: `doc::tests::a_rounded_loop_left_open_where_a_segment_joins_its_ends_follows_that_segment` (fails on main: fill 1810.85 vs stroke 1818.58); #1991's tests unchanged. | | 2026-11-06 | patch | M3: glass's docs say which centre `splay` bends away from: the centre of the layer's bounds, as the reference tool's, checked side by side on a ring and an L at Splay 0% and 100% (an inner edge bends towards the hole in both). And where a glass shape gets no core: past 4M px on the desktop and 1M on the web (`MAX_SHAPE_PX`) it bends along its edge normals, so a large glass text or vector can bend differently once zoomed into, in a 2× export, or on the web. Docs only. Grade unchanged. | | 2026-11-02 | minor | M3, #1885: glass bends towards its core, the shape shrunk by `depth` and the bevel, as the reference tool's: round a sharp corner the bend turns smoothly, and a thin part (a capsule, a letter's stroke) bends across itself, checked side by side on a capsule 44 units tall. Rounded rectangles work it out in closed form. A shape too big to keep whole at the zoom bends along its edge normals instead, so no render works out a core over more pixels than a kept shape holds. Tests: `glass::tests::a_sharp_corner_bends_round_towards_the_core`, `glass::tests::a_thin_part_bends_across_itself`, `glass::tests::a_shape_too_big_to_keep_bends_along_its_normals`, `glass_cut_tests::a_cut_through_the_pane_matches_the_whole_render`. Grade unchanged. | | 2026-11-02 | minor | M3, #1885: glass's light is a line on its 1-unit bevel added to the backdrop, as the reference tool's: fully where the edge faces the light, none below 0.35 of facing it, 0.6 as much on the opposite side, with a faint gradient across the curve. `splay` turns the bend from along the edge's normal towards the way away from the layer's centre and no longer widens the light, as in the reference tool. Checked side by side on synthetic files: a splay of 1 bends the backdrop towards the centre in both. Tests: `glass::tests::the_light_lies_on_the_bevel_and_the_gradient_across_the_curve`, `backdrop_tests::splay_turns_the_bend_towards_the_centre`, `glass_cut_tests::the_light_is_a_line_on_the_bevel`. Grade unchanged. | From eeb1f404aa33ed37d5f5e1c24f1b3ece8503d59a Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 02:08:33 -0500 Subject: [PATCH 129/239] M4: Vector edit: a mirror mode turns a sharp point smooth (#2110) Choosing Mirror angle or Mirror angle and length on a sharp point (two segments, no handles) now makes it smooth, by the rule measured in Figma: both handles on one line through the point along (B - A) / |BA|^2 + (C - B) / |BC|^2; angle gives each handle 0.3905 x its own segment, angle and length gives both 0.3905 x the shorter segment (medium confidence). Open-path ends, points with a handle already and coincident neighbours keep the old behaviour. The Bend tool's make-smooth and auto-smooth rules are unchanged. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/canvas/vectoredit/ops.rs | 119 ++++++++++++++++++ crates/engine/src/canvas/vectoredit/tests.rs | 18 +++ .../src/vector_multi_behaviour_tests.rs | 7 +- docs/ui-parity.md | 5 +- 4 files changed, 145 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/canvas/vectoredit/ops.rs b/crates/engine/src/canvas/vectoredit/ops.rs index 32b8eef44..51fb6ef23 100644 --- a/crates/engine/src/canvas/vectoredit/ops.rs +++ b/crates/engine/src/canvas/vectoredit/ops.rs @@ -124,9 +124,62 @@ pub fn move_handles(net: &mut VectorNetwork, hs: &[(usize, bool)], d: Vec2, inde } } +/// Each handle of a sharp point turned smooth by a mirror mode is this fraction of the length of its +/// own segment. Measured in the incumbent (0.3905 and 0.390 at two angles): known to about 3 digits only. +const MIRROR_SMOOTH_FACTOR: f64 = 0.3905; + +/// Give a sharp point (two segments, no handles) the handles a mirror mode makes in the incumbent. +/// Both lie on one line through the point, along `(B - A) / |BA|^2 + (C - B) / |BC|^2` (A, C: the far +/// ends of the two segments). "Angle": each is [`MIRROR_SMOOTH_FACTOR`] x its own segment. +/// "Angle and length": both are that factor x the shorter segment (medium confidence: the +/// measurement could not separate this from other rules). Open-path ends, points with a handle +/// already and coincident neighbours are left alone. Returns whether handles were made. +fn smooth_sharp_point(net: &mut VectorNetwork, vi: usize, mode: HandleMirroring) -> bool { + if mode == HandleMirroring::None { + return false; + } + let inc = net.incident(vi); + let [(s1, a1), (s2, a2)] = inc.as_slice() else { return false }; + let (Some(h1), Some(h2)) = (net.handle(*s1, *a1), net.handle(*s2, *a2)) else { return false }; + if tvec(h1).hypot() > 1e-9 || tvec(h2).hypot() > 1e-9 { + return false; + } + let far = |s: usize, st: bool| net.segments.get(s).and_then(|x| net.vertices.get(if st { x.b } else { x.a })).map(|v| v.point()); + let (Some(b), Some(a), Some(c)) = (net.vertices.get(vi).map(|v| v.point()), far(*s1, *a1), far(*s2, *a2)) else { return false }; + let (ab, bc) = (b - a, c - b); + let (la, lc) = (ab.hypot(), bc.hypot()); + if !(la > 1e-9 && lc > 1e-9 && la.is_finite() && lc.is_finite()) { + return false; + } + let d = ab / (la * la) + bc / (lc * lc); + if !finite(d) || d.hypot() < 1e-12 { + return false; + } + let d = d.normalize(); + let (l_in, l_out) = if mode == HandleMirroring::AngleAndLength { + let l = MIRROR_SMOOTH_FACTOR * la.min(lc); + (l, l) + } else { + (MIRROR_SMOOTH_FACTOR * la, MIRROR_SMOOTH_FACTOR * lc) + }; + let (in_h, out_h) = (-d * l_in, d * l_out); + if !(finite(in_h) && finite(out_h)) { + return false; + } + net.set_handle(*s1, *a1, (in_h.x, in_h.y)); + net.set_handle(*s2, *a2, (out_h.x, out_h.y)); + true +} + /// Set the mirroring of vertices and make their handles agree with it. pub fn set_mirroring(net: &mut VectorNetwork, verts: &[usize], mode: HandleMirroring) { for &vi in verts { + if smooth_sharp_point(net, vi, mode) { + if let Some(v) = net.vertices.get_mut(vi) { + v.mirror = Some(mode); + } + continue; + } let inc = net.incident(vi); if let [(s1, a1), (s2, a2)] = inc.as_slice() && let (Some(h1), Some(h2)) = (net.handle(*s1, *a1), net.handle(*s2, *a2)) @@ -923,6 +976,72 @@ mod tests { assert!((a + b).hypot() < 1e-9, "made symmetric: {a:?} {b:?}"); } + /// An open path A, B, C (the measured triangle of #2110) with B sharp. + fn triangle_path() -> VectorNetwork { + VectorNetwork::from_points(&[Point::new(-250.0, -174.0), Point::new(117.0, -174.0), Point::new(-67.0, 194.0)], false) + } + + fn handles_at_b(n: &VectorNetwork) -> (Vec2, Vec2) { + (tvec(n.segments[0].tb), tvec(n.segments[1].ta)) + } + + #[test] + fn mirror_modes_smooth_a_sharp_point_as_measured() { + // Mirror angle and length: both handles 0.3905 x the shorter segment (367), opposite. + let mut n = triangle_path(); + set_mirroring(&mut n, &[1], HandleMirroring::AngleAndLength); + let (i, o) = handles_at_b(&n); + assert!((o - Vec2::new(86.24, 114.47)).hypot() < 0.1, "{o:?}"); + assert!((i + o).hypot() < 1e-9, "{i:?} {o:?}"); + assert!((o.hypot() - 143.3).abs() < 0.1, "{}", o.hypot()); + // Mirror angle: each handle 0.3905 x its own segment; still collinear. + let mut n = triangle_path(); + set_mirroring(&mut n, &[1], HandleMirroring::Angle); + let (i, o) = handles_at_b(&n); + assert!((i - Vec2::new(-86.24, -114.47)).hypot() < 0.1, "{i:?}"); + assert!((o - Vec2::new(96.69, 128.33)).hypot() < 0.1, "{o:?}"); + assert!((i.x * o.y - i.y * o.x).abs() < 1e-6, "collinear"); + assert!((i.hypot() - 143.3).abs() < 0.1 && (o.hypot() - 160.7).abs() < 0.1); + assert_eq!(n.mirroring(1), HandleMirroring::Angle); + } + + #[test] + fn mirror_modes_smooth_other_angles_and_several_points() { + // A right angle at B with legs 100 and 50: d = (1,0)/100 + (0,1)/50, so the line leans to +y. + let mut n = VectorNetwork::from_points(&[Point::new(0.0, 0.0), Point::new(100.0, 0.0), Point::new(100.0, 50.0)], false); + set_mirroring(&mut n, &[1], HandleMirroring::Angle); + let (i, o) = handles_at_b(&n); + let want = Vec2::new(0.01, 0.02).normalize(); + assert!((o.normalize() - want).hypot() < 1e-9, "{o:?}"); + assert!((o.hypot() - 19.525).abs() < 1e-9 && (i.hypot() - 39.05).abs() < 1e-9, "{i:?} {o:?}"); + // Two sharp points of a closed square, both selected: both become smooth. + let mut sq = square(); + set_mirroring(&mut sq, &[0, 2], HandleMirroring::AngleAndLength); + for v in [0, 2] { + assert!(sq.incident(v).iter().all(|(s, st)| sq.handle(*s, *st).is_some_and(|h| tvec(h).hypot() > 1.0)), "vertex {v}"); + assert_eq!(sq.mirroring(v), HandleMirroring::AngleAndLength); + } + assert!(sq.segments.iter().all(|s| tvec(s.ta).x.is_finite() && tvec(s.tb).y.is_finite())); + } + + #[test] + fn mirror_modes_leave_unmeasured_points_alone() { + // Open-path ends have only one segment. + let mut n = open_line(); + set_mirroring(&mut n, &[0, 2], HandleMirroring::Angle); + assert!(n.segments.iter().all(|s| s.is_straight())); + // A zero-length neighbour: stays sharp, finite. + let mut z = VectorNetwork::from_points(&[Point::new(5.0, 5.0), Point::new(5.0, 5.0), Point::new(60.0, 0.0)], false); + set_mirroring(&mut z, &[1], HandleMirroring::AngleAndLength); + assert!(z.segments.iter().all(|s| s.is_straight())); + // One handle already: the old behaviour (the lone handle stays, the other mirrors it). + let mut h = open_line(); + h.segments[1].ta = (10.0, 5.0); + set_mirroring(&mut h, &[1], HandleMirroring::Angle); + assert_eq!(h.segments[1].ta, (10.0, 5.0)); + assert_eq!(h.segments[0].tb, (-10.0, -5.0)); + } + fn loop_is_continuous(n: &VectorNetwork, lp: &[usize]) -> bool { let ends: Vec<(usize, usize)> = n .loop_walk(lp) diff --git a/crates/engine/src/canvas/vectoredit/tests.rs b/crates/engine/src/canvas/vectoredit/tests.rs index 3812c1b7b..84ba794d3 100644 --- a/crates/engine/src/canvas/vectoredit/tests.rs +++ b/crates/engine/src/canvas/vectoredit/tests.rs @@ -407,6 +407,24 @@ fn mirroring_position_and_join_commands() { assert!(s.execute("vector.join", &json!({"ids": [id]})).is_ok()); } +#[test] +fn mirror_mode_on_sharp_points_is_one_undo_step() { + // #2110: a mirror mode turns sharp points smooth; the whole command undoes in one step. + let mut s = Session::new(); + let r = ex(&mut s, "vector.create", json!({"points": [[-250, -174], [117, -174], [-67, 194]], "closed": false})); + let id = crate::params::id_of(&r["id"]).unwrap(); + ex(&mut s, "vector.edit.begin", json!({"id": id})); + ex(&mut s, "vector.edit.select", json!({"vertices": [1]})); + ex(&mut s, "vector.edit.mirroring", json!({"mode": "angleAndLength"})); + let n = net(&s, id); + let (i, o) = (n.segments[0].tb, n.segments[1].ta); + assert!((o.0 - 86.24).abs() < 0.1 && (o.1 - 114.47).abs() < 0.1, "{o:?}"); + assert!((i.0 + o.0).abs() < 1e-9 && (i.1 + o.1).abs() < 1e-9, "{i:?}"); + s.undo().unwrap(); + let n = net(&s, id); + assert!(n.segments.iter().all(|x| x.is_straight()), "one undo restores the sharp point"); +} + #[test] fn a_point_dropped_on_another_merges_into_it() { // #401: an open path's end dragged onto its start closes the path at that point. diff --git a/crates/engine/src/vector_multi_behaviour_tests.rs b/crates/engine/src/vector_multi_behaviour_tests.rs index ef337af83..c1daf39e7 100644 --- a/crates/engine/src/vector_multi_behaviour_tests.rs +++ b/crates/engine/src/vector_multi_behaviour_tests.rs @@ -215,9 +215,12 @@ fn corner_radius_mirroring_and_delete(s: &mut Session, a: NodeId, b: NodeId, atl fn bend_select_all_pen_and_clicks(s: &mut Session, a: NodeId, b: NodeId) { // The Bend tool (held with Cmd/Ctrl) bends the segment under the pointer, in its own layer. + // (The earlier mirroring step already turned the selected corners smooth, #2110.) + let a_before = net(s, a).segments; + let b_before = net(s, b).segments; drag(s, (250.0, 100.0), (250.0, 130.0), CMD); - assert!(net(s, b).segments.iter().any(|sg| !sg.is_straight()), "the bend lands on the layer under the pointer"); - assert!(net(s, a).segments.iter().all(|sg| sg.is_straight()), "other layers keep their segments"); + assert!(net(s, b).segments != b_before, "the bend lands on the layer under the pointer"); + assert!(net(s, a).segments == a_before, "other layers keep their segments"); // Select all takes every edited layer's points. let r = ex(s, "vector.edit.selectAll", json!({})); assert_eq!(r["count"], json!(8), "silent: select all takes the points of every edited layer (pinned)"); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..2720b78c4 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (a mirror mode (angle, or angle and length) on a sharp point turns it smooth, as in Figma (#2110); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -92,7 +92,7 @@ interaction feel not yet compared. | Rectangle, ellipse (arc handles and Design panel arc fields), polygon, star, line, arrow; Shift/Alt | done | Alt draws lines from the centre too (`shapes_behaviour_tests`) | | Corner radius handles (inside each corner of a rectangle or frame, a polygon's or star's top point; Alt: one corner), star ratio handle; Count and Ratio fields | done | handles hide under 48 px on screen; no count handle on the canvas (the Count field instead); corner smoothing rounds rectangles and frames only | | Pen: vector networks, branch, close, bend; pencil | done | pen pressure on Windows and from browser styluses only; outside edit mode the Pen closes on its first point, connects to its other points and continues a selected open path from an end point (`vector_multi_behaviour_tests`); Escape ends the path and keeps its layer in edit mode with the pen, so the next path joins the same vector and another Escape leaves edit mode (#760, `pen_end_tests`); Enter or a double-click ends the path (at the double-click's point, added once) and edits the vector with the Move tool, a double-click with the idle pen edits the layer under it, and in edit mode the pen's Enter or double-click takes the Move tool (#1430, `pen_vector_edit_tests`); switching from Design to Prototype or Inspect ends the path and returns to Move (#308) | -| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). Not yet: areas of other layers edited at once | +| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a mirror mode on a sharp point turns it smooth by the measured rule (#2110); a double-click a few pixels off a thin stroke enters edit mode (#646); entering edit mode and picking a region keep the canvas still (#322); a point dropped on another point merges with it, and dropping one end of an open path on the other closes it (a 2-point line's end just moves, #401); Flatten keeps open paths open (#377); paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn; Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). 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); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | | 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 | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-11 | patch | M4, #2110: in vector edit mode, choosing Mirror angle or Mirror angle and length for a sharp point (two segments, no handles) makes it smooth, as measured in Figma: both handles on one line through the point, along `(B - A) / |BA|^2 + (C - B) / |BC|^2` (A and C the far ends of its segments), each 0.3905 x its own segment for angle, both 0.3905 x the shorter segment for angle and length (the factor is known to about three digits; the length rule is medium confidence); several selected points each become smooth. Open-path ends, points that already have a handle, and points with a coincident neighbour keep the old behaviour. Evidence: tests in `crates/engine/src/canvas/vectoredit/ops.rs` and `tests.rs` | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From a75d8bf04ff501c1cdb740bb64d90ff36e11ec13 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 02:16:29 -0500 Subject: [PATCH 130/239] M4: Delete closes a region's loop through the segment that joins its ends (#1951) A Pen bridge between two degree-2 points leaves the region alone, and Delete on the point between them then rotated the loop open with the bridge in no loop, so even an unrounded fill ran straight across a curved bridge. reopen_loops now pushes the one segment in no loop that joins an open chain's ends onto the loop's end (winding kept, loop by loop), as connect does. This also covers removing segments and the eraser. closing_segment is public, derives its own start point, walks strictly (a loop out of walking order is left alone) and gives up when two segments qualify. The render fix stays as the fallback for files already saved in that state. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 reviewed; Sonnet 5.5 wrote at medium --- crates/doc/src/tests.rs | 15 +++++- crates/doc/src/vector.rs | 48 ++++++++++++++------ crates/engine/src/canvas/vectoredit/ops.rs | 34 ++++++++++++++ crates/engine/src/canvas/vectoredit/tests.rs | 21 +++++++++ docs/target-app-parity.md | 5 +- 5 files changed, 104 insertions(+), 19 deletions(-) diff --git a/crates/doc/src/tests.rs b/crates/doc/src/tests.rs index 0d4efd6ec..9d922d6c8 100644 --- a/crates/doc/src/tests.rs +++ b/crates/doc/src/tests.rs @@ -908,12 +908,23 @@ fn a_chamfered_rectangles_rounded_fill_is_cut_at_every_point() { /// the stroke's outline, cut by an arc at the chain's ends as at every other point. #[test] fn a_rounded_loop_left_open_where_a_segment_joins_its_ends_follows_that_segment() { + open_loop_follows_the_segment_joining_its_ends([(0, 3), (1, 2), (2, 0), (4, 1), (3, 4)], vec![3, 1, 2, 0]); +} + +/// The same network with the joining segment listed first, and with the loop walked the other way. +#[test] +fn an_open_loop_follows_the_segment_joining_its_ends_listed_first_or_walked_backwards() { + open_loop_follows_the_segment_joining_its_ends([(3, 4), (0, 3), (1, 2), (2, 0), (4, 1)], vec![4, 2, 3, 1]); + open_loop_follows_the_segment_joining_its_ends([(0, 3), (1, 2), (2, 0), (4, 1), (3, 4)], vec![0, 2, 1, 3]); +} + +fn open_loop_follows_the_segment_joining_its_ends(segments: [(usize, usize); 5], open_loop: Vec) { use figcraft_geom::BezPath; use figcraft_geom::kurbo::{ParamCurveArclen, ParamCurveNearest}; let corners = [Point::new(0.0, 0.0), Point::new(525.0, 525.0), Point::new(0.0, 525.0), Point::new(333.0, 0.0), Point::new(525.0, 183.0)]; let mut net = VectorNetwork::from_points(&corners, false); - net.segments = [(0, 3), (1, 2), (2, 0), (4, 1), (3, 4)].iter().map(|&(a, b)| Segment::line(a, b)).collect(); - net.regions.push(Region { loops: vec![vec![3, 1, 2, 0]], winding: WindingRule::NonZero, fills: None, paint_space: None }); + net.segments = segments.iter().map(|&(a, b)| Segment::line(a, b)).collect(); + net.regions.push(Region { loops: vec![open_loop], winding: WindingRule::NonZero, fills: None, paint_space: None }); for v in &mut net.vertices { v.radius = 125.0; } diff --git a/crates/doc/src/vector.rs b/crates/doc/src/vector.rs index b1b45423b..1538de2a6 100644 --- a/crates/doc/src/vector.rs +++ b/crates/doc/src/vector.rs @@ -472,15 +472,13 @@ impl VectorNetwork { // order the loop meets them. Each loop is rebuilt in one pass, so a polygon with many // rounded corners isn't quadratic. for lp in out.regions.iter_mut().flat_map(|r| r.loops.iter_mut()) { - let Some(&first_idx) = lp.first() else { continue }; - let start_v = match (self.segments.get(first_idx), lp.get(1).and_then(|&i| self.segments.get(i))) { - (Some(first), Some(second)) if first.a == second.a || first.a == second.b => first.b, - (Some(first), _) => first.a, - _ => 0, - }; + if lp.is_empty() { + continue; + } + let start_v = self.loop_start(lp).unwrap_or(0); let mut rebuilt = Vec::with_capacity(lp.len() + by_vertex.len().min(lp.len()) + 1); let mut cur = start_v; - let closing = self.closing_segment(lp, start_v); + let closing = self.closing_segment(lp); for &x in lp.iter().chain(closing.iter()) { rebuilt.push(x); let Some(s) = self.segments.get(x) else { continue }; @@ -498,23 +496,43 @@ impl VectorNetwork { Some(out) } - /// The segment that joins the two ends of an open loop `lp` (walked from `start_v`) when it is - /// in no loop of its own: a corner cut off by a segment drawn before the corner point was - /// deleted leaves the loop open there, and the stroke follows that segment. Rounding walks it - /// as the loop's last segment, so the points at the loop's ends are cut by arcs as the stroke's - /// are (#1951). - fn closing_segment(&self, lp: &[usize], start_v: usize) -> Option { + /// The point loop `lp` is walked from: the end of its first segment that its second does not + /// share. + fn loop_start(&self, lp: &[usize]) -> Option { + let first = self.segments.get(*lp.first()?)?; + match lp.get(1).and_then(|&i| self.segments.get(i)) { + Some(second) if first.a == second.a || first.a == second.b => Some(first.b), + _ => Some(first.a), + } + } + + /// The segment that joins the two ends of an open loop `lp` when it is in no loop of its own + /// (and the only such segment): a corner cut off by a segment drawn before the corner point was + /// deleted leaves the loop open there, and the stroke follows that segment. Only a loop that + /// walks in order as one continuous chain has one. Rounding walks it as the loop's last + /// segment, so the points at the loop's ends are cut by arcs as the stroke's are, and deleting + /// points or segments puts it into the loop (#1951). + pub fn closing_segment(&self, lp: &[usize]) -> Option { + let start_v = self.loop_start(lp)?; let mut cur = start_v; for &x in lp { let s = self.segments.get(x)?; - cur = if s.a == cur { s.b } else { s.a }; + cur = if s.a == cur { + s.b + } else if s.b == cur { + s.a + } else { + return None; + }; } if cur == start_v { return None; } let in_loop = |i: usize| self.regions.iter().flat_map(|r| r.loops.iter().flatten()).any(|&x| x == i); let ends = |s: &Segment| (s.a == cur && s.b == start_v) || (s.b == cur && s.a == start_v); - self.segments.iter().position(ends).filter(|&i| !in_loop(i)) + let mut joining = self.segments.iter().enumerate().filter(|(i, s)| ends(s) && !in_loop(*i)).map(|(i, _)| i); + let first = joining.next()?; + joining.next().is_none().then_some(first) } /// How point `v` (its `incident` segments) is rounded, if it is: not where the two segments diff --git a/crates/engine/src/canvas/vectoredit/ops.rs b/crates/engine/src/canvas/vectoredit/ops.rs index 32b8eef44..733885de1 100644 --- a/crates/engine/src/canvas/vectoredit/ops.rs +++ b/crates/engine/src/canvas/vectoredit/ops.rs @@ -468,6 +468,22 @@ fn reopen_loops(net: &mut VectorNetwork) { } } } + // An open chain whose two ends a segment in no loop already joins (a bridge drawn between two + // points before the point between them was deleted) closes through that segment, at the end so + // the loop's winding is kept, as `connect` closes it (#1951). One loop at a time, so two loops + // can't both take one segment. + let places: Vec<(usize, usize)> = net.regions.iter().enumerate().flat_map(|(ri, r)| (0..r.loops.len()).map(move |li| (ri, li))).collect(); + for (ri, li) in places { + let Some(lp) = net.regions.get(ri).and_then(|r| r.loops.get(li)) else { continue }; + if lp.len() < 2 { + continue; + } + if let Some(closing) = net.closing_segment(lp) + && let Some(lp) = net.regions.get_mut(ri).and_then(|r| r.loops.get_mut(li)) + { + lp.push(closing); + } + } } /// Cut a segment at `t` into two open ends at the same spot. Returns the two end vertices. @@ -1107,6 +1123,24 @@ mod tests { assert!(d.vertices.iter().all(|v| v.x.is_finite() && v.y.is_finite())); } + /// A curved bridge between two points of a ring, then the point between them deleted (Delete, + /// no healing): the region's loop closes through the bridge, so the fill follows its curve and + /// is as long as the stroke (#1951). + #[test] + fn deleting_a_point_behind_a_curved_bridge_keeps_the_bridge_in_the_loop() { + use figcraft_geom::BezPath; + use figcraft_geom::kurbo::ParamCurveArclen; + let pts = [(0.0, 0.0), (50.0, 0.0), (100.0, 0.0), (100.0, 50.0), (100.0, 100.0), (0.0, 100.0)].map(|(x, y)| Point::new(x, y)); + let mut n = VectorNetwork::from_points(&pts, true); + connect(&mut n, 1, 3, (25.0, 25.0), (-25.0, -25.0)).unwrap(); + assert_eq!((n.segments.len(), n.regions[0].loops[0].len()), (7, 6), "the ring kept"); + delete_vertices(&mut n, &[2], false); + assert_eq!((n.segments.len(), n.regions[0].loops[0].len()), (5, 5), "the loop holds the bridge: {:?}", n.regions); + let length = |p: &BezPath| p.segments().map(|s| s.arclen(1e-9)).sum::(); + let (fill, stroke) = (length(&n.fill_path()), length(&n.stroke_path())); + assert!((fill - stroke).abs() < 1e-6, "fill {fill} and stroke {stroke} follow the same outline"); + } + #[test] fn lasso_polygon() { let pts = [Point::new(5.0, 5.0), Point::new(50.0, 50.0), Point::new(15.0, 5.0)]; diff --git a/crates/engine/src/canvas/vectoredit/tests.rs b/crates/engine/src/canvas/vectoredit/tests.rs index 3812c1b7b..ebe849761 100644 --- a/crates/engine/src/canvas/vectoredit/tests.rs +++ b/crates/engine/src/canvas/vectoredit/tests.rs @@ -659,6 +659,27 @@ fn a_rounded_chamfer_made_other_ways_fills_along_its_arcs() { fill_traces_stroke(&s, id, "drawn with the pen"); } +/// The reporter's sequence (#1951): a bridge drawn between the two new points while the corner is +/// still there (both have two segments, so the region keeps its ring), then the corner deleted with +/// Delete. The region's loop must close through the bridge, so the rounded fill traces the stroke. +#[test] +fn deleting_the_corner_behind_a_pen_bridge_closes_the_loop_through_the_bridge() { + let mut s = Session::new(); + let id = rect(&mut s); + ex(&mut s, "vector.edit.addVertex", json!({"segment": 0, "t": 0.5})); + ex(&mut s, "vector.edit.addVertex", json!({"segment": 1, "t": 0.5})); + let n = net(&s, id); + let (top, right) = (vertex_at(&n, 50.0, 0.0), vertex_at(&n, 100.0, 50.0)); + ex(&mut s, "vector.edit.connect", json!({"a": top, "b": right})); + let n = net(&s, id); + assert_eq!((n.segments.len(), n.regions[0].loops[0].len()), (7, 6), "bridged, the ring kept: {:?}", n.regions); + let corner = vertex_at(&n, 100.0, 0.0); + ex(&mut s, "vector.edit.select", json!({"vertices": [corner]})); + ex(&mut s, "vector.edit.delete", json!({})); + ex(&mut s, "vector.edit.cornerRadius", json!({"radius": 43, "vertices": [0, 1, 2, 3, 4]})); + fill_traces_stroke(&s, id, "bridged, then the corner deleted"); +} + /// The rounded chamfered rectangle `id` (five points on the origin's 100×100 box, the top-right /// corner cut off between (50, 0) and (100, 50)): one region with every segment in its loop, and a /// fill that keeps off every sharp point and traces the same outline as the stroke. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index cf4955d1f..8d8cb2f05 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-06 · **Change:** minor (justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap, also when the loop was left open at a segment drawn before the corner was deleted (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap, also when the loop was left open at a segment drawn before the corner was deleted, which Delete now closes through that segment (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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 @@ -246,7 +246,7 @@ Hours in this narrative are the builders' estimates; the tables above supersede closed area (faces with holes), point/segment selection, handle mirroring (none/angle/angle and length) with a Point panel (position, corner radius, mirroring), smooth/sharp points, join and merge (joining the two ends of a path broken open by a deleted point closes it again, so its - fill follows the new segment, and a rounded loop left open where a segment joins its ends is cut by arcs at them too, #1951), delete vs delete-and-heal, nudging, one undo step per gesture, eraser (⇧E), shape builder + fill follows the new segment, and a rounded loop left open where a segment joins its ends is cut by arcs at them too, and Delete closes such a loop through that segment, #1951), delete vs delete-and-heal, nudging, one undo step per gesture, eraser (⇧E), shape builder (⇧M: the regions of overlapping shapes, click or drag to merge, Alt to remove, curves kept), variable width strokes (width profile presets with previews in the stroke settings, the Variable width tool ⇧W: drag the path to add a width point, slide points, drag their handles, Delete; @@ -656,6 +656,7 @@ Carried over from the ROADMAP's "Shipped so far" (2026-10-10). The test count th | 2026-11-04 | patch | M4, #1970: justified Chinese, Japanese and Korean text, written without spaces between words, aligns its right edge: the room on each line but a paragraph's last goes between its characters, each a word of its own as for line breaking ("Justify aligns the first word in each line of text to the left-most edge, and the last to the right-most edge"), wherever a line could break there, so none opens before a full stop or closing bracket, nor after an opening one. Latin text widens its spaces as before; mixed text widens both. A gap is reordered with the line's runs as a space of no width would be, so one beside a Hebrew word in Chinese text, or beside a Chinese word within that Hebrew, opens beside the word, not inside it. `figcraft_text::breaks::justify_between`, beside `break_between`, says where. Evidence: `tests::justified_ideographs_spread_the_room_between_characters` (fails on main). | | 2026-11-04 | patch | M8, #1951 (#1506 again): a path broken open by deleting a point (Delete, not Shift+Delete) is filled closed by a straight line across the gap, as an open path's fill is; joining its two ends again (the pen onto the other end, Connect, ⌘J) left the loop without the new segment, so once the points were rounded the fill and the selection outline ran straight across while the stroke followed the segment and its arcs. Joining now closes the loop through the new segment ("Click to close the path."; "You can use the Paint tool to add fills to any closed regions of a vector network."): `ops::connect` puts it into the loop whose segments are the chain between the ends, at the gap and in the loop's own order, so a hole keeps its winding whichever end was clicked first; a loop listed out of walking order is left as it was. Evidence: `vectoredit::tests::a_rounded_chamfer_made_other_ways_fills_along_its_arcs` (fails on main: the loop kept 4 of 5 segments), `a_rounded_chamfer_cut_in_the_editor_fills_along_its_arcs` (Shift+Delete, with and without a region fill), `doc::tests::a_chamfered_rectangles_rounded_fill_is_cut_at_every_point` (fill, region path and stroke agree for every loop order and segment direction of a chamfered rectangle). | | 2026-11-11 | patch | M4, #1951 (reporter's file, v0.17.0): a corner cut off by a segment drawn first, the corner point then deleted with Delete, leaves the region's loop as the open chain of the other segments, the cutting segment (which joins the chain's two ends) in no loop; rounded, the loop's first point was never cut by an arc (rounding only adds arcs at points the loop arrives at) and the closing edge ran straight, so the fill and the selection outline missed corners the stroke rounded. `VectorNetwork::rounded_smoothed` now walks the segment joining an open loop's ends, when no loop holds it, as the loop's last segment (`closing_segment`). Evidence: `doc::tests::a_rounded_loop_left_open_where_a_segment_joins_its_ends_follows_that_segment` (fails on main: fill 1810.85 vs stroke 1818.58); #1991's tests unchanged. | +| 2026-11-11 | patch | M4, #1951: Delete (and removing segments, and the eraser) closes a region's loop through the segment that joins its ends: a bridge drawn between two points of a ring leaves the region alone (`connect` rightly keeps the ring), and deleting the point between them rotated the loop open, the bridge in no loop, so even an unrounded fill ran straight across a curved bridge. `reopen_loops` now pushes the one segment in no loop that joins an open chain's ends onto the loop's end, keeping its winding, as #1991's connect does; `closing_segment` (now public) walks strictly, ignores segments already in loops and gives up when two qualify. The render fix stays as the fallback for files saved in that state. Evidence: `vectoredit::tests::deleting_the_corner_behind_a_pen_bridge_closes_the_loop_through_the_bridge` (fails before: the loop kept 4 of 5 segments), `ops::tests::deleting_a_point_behind_a_curved_bridge_keeps_the_bridge_in_the_loop`, `doc::tests::an_open_loop_follows_the_segment_joining_its_ends_listed_first_or_walked_backwards`. | | 2026-11-06 | patch | M3: glass's docs say which centre `splay` bends away from: the centre of the layer's bounds, as the reference tool's, checked side by side on a ring and an L at Splay 0% and 100% (an inner edge bends towards the hole in both). And where a glass shape gets no core: past 4M px on the desktop and 1M on the web (`MAX_SHAPE_PX`) it bends along its edge normals, so a large glass text or vector can bend differently once zoomed into, in a 2× export, or on the web. Docs only. Grade unchanged. | | 2026-11-02 | minor | M3, #1885: glass bends towards its core, the shape shrunk by `depth` and the bevel, as the reference tool's: round a sharp corner the bend turns smoothly, and a thin part (a capsule, a letter's stroke) bends across itself, checked side by side on a capsule 44 units tall. Rounded rectangles work it out in closed form. A shape too big to keep whole at the zoom bends along its edge normals instead, so no render works out a core over more pixels than a kept shape holds. Tests: `glass::tests::a_sharp_corner_bends_round_towards_the_core`, `glass::tests::a_thin_part_bends_across_itself`, `glass::tests::a_shape_too_big_to_keep_bends_along_its_normals`, `glass_cut_tests::a_cut_through_the_pane_matches_the_whole_render`. Grade unchanged. | | 2026-11-02 | minor | M3, #1885: glass's light is a line on its 1-unit bevel added to the backdrop, as the reference tool's: fully where the edge faces the light, none below 0.35 of facing it, 0.6 as much on the opposite side, with a faint gradient across the curve. `splay` turns the bend from along the edge's normal towards the way away from the layer's centre and no longer widens the light, as in the reference tool. Checked side by side on synthetic files: a splay of 1 bends the backdrop towards the centre in both. Tests: `glass::tests::the_light_lies_on_the_bevel_and_the_gradient_across_the_curve`, `backdrop_tests::splay_turns_the_bend_towards_the_centre`, `glass_cut_tests::the_light_is_a_line_on_the_bevel`. Grade unchanged. | From b8e67b87dd79766c01ffe508f2e51b8d97983bd2 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 02:36:13 -0500 Subject: [PATCH 131/239] M4: Docs: the mirror formula's pipes no longer split the table row (#2110) The |BA| and |BC| in the ui-parity row read as column separators; they are escaped now, so the row keeps its three cells. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- docs/ui-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 2720b78c4..8d76a06ea 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -187,7 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| -| 2026-11-11 | patch | M4, #2110: in vector edit mode, choosing Mirror angle or Mirror angle and length for a sharp point (two segments, no handles) makes it smooth, as measured in Figma: both handles on one line through the point, along `(B - A) / |BA|^2 + (C - B) / |BC|^2` (A and C the far ends of its segments), each 0.3905 x its own segment for angle, both 0.3905 x the shorter segment for angle and length (the factor is known to about three digits; the length rule is medium confidence); several selected points each become smooth. Open-path ends, points that already have a handle, and points with a coincident neighbour keep the old behaviour. Evidence: tests in `crates/engine/src/canvas/vectoredit/ops.rs` and `tests.rs` | +| 2026-11-11 | patch | M4, #2110: in vector edit mode, choosing Mirror angle or Mirror angle and length for a sharp point (two segments, no handles) makes it smooth, as measured in Figma: both handles on one line through the point, along `(B - A) / \|BA\|^2 + (C - B) / \|BC\|^2` (A and C the far ends of its segments), each 0.3905 x its own segment for angle, both 0.3905 x the shorter segment for angle and length (the factor is known to about three digits; the length rule is medium confidence); several selected points each become smooth. Open-path ends, points that already have a handle, and points with a coincident neighbour keep the old behaviour. Evidence: tests in `crates/engine/src/canvas/vectoredit/ops.rs` and `tests.rs` | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 016dba8c34d697419c7db87ebfd5aa13b925511e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 10 Nov 2026 23:49:43 -0800 Subject: [PATCH 132/239] Export: the color profile note says Display P3 tagging applies to exports that use the file's profile An export setting set to sRGB still writes sRGB files in a Display P3 document, so the note no longer says every exported PNG, JPG and WebP is tagged Display P3. Follows #1759. --- crates/ui-egui/locales/ar.toml | 2 +- crates/ui-egui/locales/bn.toml | 2 +- crates/ui-egui/locales/bs.toml | 2 +- crates/ui-egui/locales/cs.toml | 2 +- crates/ui-egui/locales/de.toml | 2 +- crates/ui-egui/locales/en.toml | 2 +- crates/ui-egui/locales/es.toml | 2 +- crates/ui-egui/locales/fi.toml | 2 +- crates/ui-egui/locales/fr.toml | 2 +- crates/ui-egui/locales/id.toml | 2 +- crates/ui-egui/locales/it.toml | 2 +- crates/ui-egui/locales/ja.toml | 2 +- crates/ui-egui/locales/ka.toml | 2 +- crates/ui-egui/locales/ko.toml | 2 +- crates/ui-egui/locales/nl.toml | 2 +- crates/ui-egui/locales/pl.toml | 2 +- crates/ui-egui/locales/pt-BR.toml | 2 +- crates/ui-egui/locales/ru.toml | 2 +- crates/ui-egui/locales/sv.toml | 2 +- crates/ui-egui/locales/th.toml | 2 +- crates/ui-egui/locales/tr.toml | 2 +- crates/ui-egui/locales/vi.toml | 2 +- crates/ui-egui/locales/zh-Hans.toml | 2 +- crates/ui-egui/locales/zh-Hant.toml | 2 +- crates/ui-egui/src/dialogs/color_profile.rs | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/crates/ui-egui/locales/ar.toml b/crates/ui-egui/locales/ar.toml index e50a9b9c4..cc55d730a 100644 --- a/crates/ui-egui/locales/ar.toml +++ b/crates/ui-egui/locales/ar.toml @@ -1496,7 +1496,7 @@ status = "draft — needs native review" "Text styles" = "أنماط النص" "Texts" = "النصوص" "Texture" = "النسيج" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "تُعاين الألوان على لوحة الرسم بفضاء sRGB؛ وتُوسم ملفات PNG وJPG وWebP المصدّرة بملف Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "تُعاين الألوان على لوحة الرسم بفضاء sRGB؛ وملفات PNG وJPG وWebP المصدّرة بملف تعريف الألوان الخاص بالملف تُوسم بملف Display P3." "The destination document is unavailable. Nothing was imported." = "المستند الوجهة غير متاح. لم يُستورد شيء." "The destination document was closed. Nothing was imported." = "أُغلق المستند الوجهة. لم يُستورد شيء." "The destination page was removed. Nothing was imported." = "أُزيلت الصفحة الوجهة. لم يُستورد شيء." diff --git a/crates/ui-egui/locales/bn.toml b/crates/ui-egui/locales/bn.toml index b79877271..03927be6b 100644 --- a/crates/ui-egui/locales/bn.toml +++ b/crates/ui-egui/locales/bn.toml @@ -1453,7 +1453,7 @@ status = "draft — needs native review" "Text styles" = "টেক্সট স্টাইলসমূহ" "Texts" = "টেক্সটসমূহ" "Texture" = "টেক্সচার" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "ক্যানভাস sRGB-তে রঙ প্রিভিউ করে; এক্সপোর্ট করা PNG, JPG এবং WebP ফাইলে Display P3 ট্যাগ করা থাকে।" +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "ক্যানভাস sRGB-তে রঙ প্রিভিউ করে; ফাইলের প্রোফাইল দিয়ে এক্সপোর্ট করা PNG, JPG এবং WebP ফাইলে Display P3 ট্যাগ করা থাকে।" "The destination document is unavailable. Nothing was imported." = "গন্তব্য ডকুমেন্ট অনুপলব্ধ। কিছু ইম্পোর্ট করা হয়নি।" "The destination document was closed. Nothing was imported." = "গন্তব্য ডকুমেন্ট বন্ধ করা হয়েছিল। কিছু ইম্পোর্ট করা হয়নি।" "The destination page was removed. Nothing was imported." = "গন্তব্য পেজ সরানো হয়েছে। কিছু ইম্পোর্ট করা হয়নি।" diff --git a/crates/ui-egui/locales/bs.toml b/crates/ui-egui/locales/bs.toml index 919bc0381..bbb268933 100644 --- a/crates/ui-egui/locales/bs.toml +++ b/crates/ui-egui/locales/bs.toml @@ -1508,7 +1508,7 @@ status = "draft — needs native review" "Text styles" = "Stilovi teksta" "Texts" = "Tekstovi" "Texture" = "Tekstura" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "Platno prikazuje boje u sRGB-u; izvezene PNG, JPG i WebP datoteke su označene kao Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Platno prikazuje boje u sRGB-u; PNG, JPG i WebP datoteke izvezene s profilom datoteke su označene kao Display P3." "The destination document is unavailable. Nothing was imported." = "Odredišni dokument nije dostupan. Ništa nije uvezeno." "The destination document was closed. Nothing was imported." = "Odredišni dokument je zatvoren. Ništa nije uvezeno." "The destination page was removed. Nothing was imported." = "Odredišna stranica je uklonjena. Ništa nije uvezeno." diff --git a/crates/ui-egui/locales/cs.toml b/crates/ui-egui/locales/cs.toml index 7ecc6779a..6f6399811 100644 --- a/crates/ui-egui/locales/cs.toml +++ b/crates/ui-egui/locales/cs.toml @@ -1428,7 +1428,7 @@ status = "draft — needs native review" "Text styles" = "Textové styly" "Texts" = "Texty" "Texture" = "Textura" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "Plátno zobrazuje barvy v sRGB; exportované soubory PNG, JPG a WebP mají profil Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Plátno zobrazuje barvy v sRGB; soubory PNG, JPG a WebP exportované s profilem souboru mají profil Display P3." "The file is deleted from the server: nobody can open or join it from there again, and this can't be undone. Copies that are open stay with whoever has them." = "Soubor se smaže ze serveru: nikdo ho odtud již neotevře ani se k němu nepřipojí a tuto akci nelze vrátit zpět. Otevřené kopie zůstanou těm, kteří je mají." "The file now holds another library" = "Soubor nyní obsahuje jinou knihovnu" "The file now holds another library (\"{name}\")" = "Soubor nyní obsahuje jinou knihovnu („{name}“)" diff --git a/crates/ui-egui/locales/de.toml b/crates/ui-egui/locales/de.toml index f57fcc5d3..d0e1536fe 100644 --- a/crates/ui-egui/locales/de.toml +++ b/crates/ui-egui/locales/de.toml @@ -1398,7 +1398,7 @@ status = "draft — needs native review" "Text styles" = "Textstile" "Texts" = "Texte" "Texture" = "Textur" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "Die Arbeitsfläche zeigt Farben in sRGB an; exportierte PNG-, JPG- und WebP-Dateien werden als Display P3 gekennzeichnet." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Die Arbeitsfläche zeigt Farben in sRGB an; PNG-, JPG- und WebP-Exporte mit dem Profil der Datei werden als Display P3 gekennzeichnet." "The destination document is unavailable. Nothing was imported." = "Das Zieldokument ist nicht verfügbar. Es wurde nichts importiert." "The destination document was closed. Nothing was imported." = "Das Zieldokument wurde geschlossen. Es wurde nichts importiert." "The destination page was removed. Nothing was imported." = "Die Zielseite wurde entfernt. Es wurde nichts importiert." diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index 625ee3bd8..3d3fb7fc4 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -1577,7 +1577,7 @@ name = "English" "Text styles" = "Text styles" "Texts" = "Texts" "Texture" = "Texture" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." "The destination document is unavailable. Nothing was imported." = "The destination document is unavailable. Nothing was imported." "The destination document was closed. Nothing was imported." = "The destination document was closed. Nothing was imported." "The destination page was removed. Nothing was imported." = "The destination page was removed. Nothing was imported." diff --git a/crates/ui-egui/locales/es.toml b/crates/ui-egui/locales/es.toml index 258a1527d..f6f437925 100644 --- a/crates/ui-egui/locales/es.toml +++ b/crates/ui-egui/locales/es.toml @@ -1491,7 +1491,7 @@ status = "draft — needs native review" "Text styles" = "Estilos de texto" "Texts" = "Textos" "Texture" = "Textura" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "El lienzo muestra los colores en sRGB; los archivos PNG, JPG y WebP exportados se etiquetan como Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "El lienzo muestra los colores en sRGB; los archivos PNG, JPG y WebP exportados con el perfil del archivo se etiquetan como Display P3." "The destination document is unavailable. Nothing was imported." = "El documento de destino no está disponible. No se importó nada." "The destination document was closed. Nothing was imported." = "Se cerró el documento de destino. No se importó nada." "The destination page was removed. Nothing was imported." = "Se eliminó la página de destino. No se importó nada." diff --git a/crates/ui-egui/locales/fi.toml b/crates/ui-egui/locales/fi.toml index 88fb21e06..d9544ec94 100644 --- a/crates/ui-egui/locales/fi.toml +++ b/crates/ui-egui/locales/fi.toml @@ -1522,7 +1522,7 @@ status = "draft — needs native review" "Text styles" = "Tekstityylit" "Texts" = "Tekstit" "Texture" = "Tekstuuri" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "Piirtoalue esikatselee värit sRGB-muodossa. Vietäviin PNG-, JPG- ja WebP-tiedostoihin merkitään Display P3 -profiili." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Piirtoalue esikatselee värit sRGB-muodossa. Tiedoston profiililla vietäviin PNG-, JPG- ja WebP-tiedostoihin merkitään Display P3 -profiili." "The destination document is unavailable. Nothing was imported." = "Kohdeasiakirja ei ole käytettävissä. Mitään ei tuotu." "The destination document was closed. Nothing was imported." = "Kohdeasiakirja suljettiin. Mitään ei tuotu." "The destination page was removed. Nothing was imported." = "Kohdesivu poistettiin. Mitään ei tuotu." diff --git a/crates/ui-egui/locales/fr.toml b/crates/ui-egui/locales/fr.toml index e40b3a060..33c7d1ad4 100644 --- a/crates/ui-egui/locales/fr.toml +++ b/crates/ui-egui/locales/fr.toml @@ -1457,7 +1457,7 @@ status = "draft — needs native review" "Text styles" = "Styles de texte" "Texts" = "Textes" "Texture" = "Texture" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "Le canevas affiche les couleurs en sRGB ; les fichiers PNG, JPG et WebP exportés sont balisés Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Le canevas affiche les couleurs en sRGB ; les fichiers PNG, JPG et WebP exportés avec le profil du fichier sont balisés Display P3." "The destination document is unavailable. Nothing was imported." = "Le document de destination est indisponible. Rien n’a été importé." "The destination document was closed. Nothing was imported." = "Le document de destination a été fermé. Rien n’a été importé." "The destination page was removed. Nothing was imported." = "La page de destination a été supprimée. Rien n’a été importé." diff --git a/crates/ui-egui/locales/id.toml b/crates/ui-egui/locales/id.toml index 59dbd492c..2945719fd 100644 --- a/crates/ui-egui/locales/id.toml +++ b/crates/ui-egui/locales/id.toml @@ -1434,7 +1434,7 @@ status = "draft — needs native review" "Text styles" = "Gaya teks" "Texts" = "Teks" "Texture" = "Tekstur" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "Kanvas mempratinjau warna dalam sRGB; file PNG, JPG, dan WebP yang diekspor ditandai Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Kanvas mempratinjau warna dalam sRGB; file PNG, JPG, dan WebP yang diekspor dengan profil file ditandai Display P3." "The file is deleted from the server: nobody can open or join it from there again, and this can't be undone. Copies that are open stay with whoever has them." = "File dihapus dari server: tidak ada yang dapat membuka atau bergabung ke file itu dari sana lagi, dan tindakan ini tidak dapat diurungkan. Salinan yang sedang terbuka tetap ada pada pemiliknya." "The file now holds another library" = "File kini berisi pustaka lain" "The file now holds another library (\"{name}\")" = "File kini berisi pustaka lain (\"{name}\")" diff --git a/crates/ui-egui/locales/it.toml b/crates/ui-egui/locales/it.toml index f61ee86fe..16001e8cb 100644 --- a/crates/ui-egui/locales/it.toml +++ b/crates/ui-egui/locales/it.toml @@ -1389,7 +1389,7 @@ status = "draft — needs native review" "Text styles" = "Stili di testo" "Texts" = "Testi" "Texture" = "Texture" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "Il canvas mostra i colori in sRGB; i file PNG, JPG e WebP esportati sono contrassegnati come Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Il canvas mostra i colori in sRGB; i file PNG, JPG e WebP esportati con il profilo del file sono contrassegnati come Display P3." "The destination document is unavailable. Nothing was imported." = "Il documento di destinazione non è disponibile. Non è stato importato nulla." "The destination document was closed. Nothing was imported." = "Il documento di destinazione è stato chiuso. Non è stato importato nulla." "The destination page was removed. Nothing was imported." = "La pagina di destinazione è stata rimossa. Non è stato importato nulla." diff --git a/crates/ui-egui/locales/ja.toml b/crates/ui-egui/locales/ja.toml index d440e910f..94a7e9574 100644 --- a/crates/ui-egui/locales/ja.toml +++ b/crates/ui-egui/locales/ja.toml @@ -1444,7 +1444,7 @@ status = "draft — needs native review" "Text styles" = "テキストスタイル" "Texts" = "テキスト" "Texture" = "テクスチャ" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "キャンバスは sRGB で色をプレビュー。書き出した PNG、JPG、WebP ファイルには Display P3 のタグが付く。" +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "キャンバスは sRGB で色をプレビュー。ファイルのプロファイルで書き出した PNG、JPG、WebP ファイルには Display P3 のタグが付く。" "The file is deleted from the server: nobody can open or join it from there again, and this can't be undone. Copies that are open stay with whoever has them." = "ファイルはサーバーから削除される:サーバーから開いたり参加したりすることは誰にもできなくなり、元に戻せない。開いているコピーは各自の手元に残る。" "The file now holds another library" = "このファイルは別のライブラリになっている" "The file now holds another library (\"{name}\")" = "このファイルは別のライブラリ(「{name}」)になっている" diff --git a/crates/ui-egui/locales/ka.toml b/crates/ui-egui/locales/ka.toml index 4c6764afa..816381c24 100644 --- a/crates/ui-egui/locales/ka.toml +++ b/crates/ui-egui/locales/ka.toml @@ -1477,7 +1477,7 @@ status = "draft — reviewed by a native speaker, awaiting a maintainer's approv "Text styles" = "ტექსტის სტილები" "Texts" = "ტექსტები" "Texture" = "ტექსტურა" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "ტილო ფერებს sRGB-ში აჩვენებს; ექსპორტირებულ PNG, JPG და WebP ფაილებს Display P3 ჭდე აქვს." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "ტილო ფერებს sRGB-ში აჩვენებს; ფაილის პროფილით ექსპორტირებულ PNG, JPG და WebP ფაილებს Display P3 ჭდე აქვს." "The destination document is unavailable. Nothing was imported." = "დანიშნულების დოკუმენტი მიუწვდომელია. იმპორტი არ შესრულდა." "The destination document was closed. Nothing was imported." = "დანიშნულების დოკუმენტი დაიხურა. იმპორტი არ შესრულდა." "The destination page was removed. Nothing was imported." = "დანიშნულების გვერდი წაიშალა. იმპორტი არ შესრულდა." diff --git a/crates/ui-egui/locales/ko.toml b/crates/ui-egui/locales/ko.toml index b4c960fbc..666fd02c8 100644 --- a/crates/ui-egui/locales/ko.toml +++ b/crates/ui-egui/locales/ko.toml @@ -1379,7 +1379,7 @@ status = "draft — needs native review" "Text styles" = "텍스트 스타일" "Texts" = "텍스트" "Texture" = "텍스처" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "캔버스는 sRGB로 색상을 미리 보여 줌. 내보낸 PNG, JPG, WebP 파일에는 Display P3 태그가 붙음." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "캔버스는 sRGB로 색상을 미리 보여 줌. 파일의 프로필로 내보낸 PNG, JPG, WebP 파일에는 Display P3 태그가 붙음." "The file is deleted from the server: nobody can open or join it from there again, and this can't be undone. Copies that are open stay with whoever has them." = "파일이 서버에서 삭제됨: 누구도 서버에서 다시 열거나 참여할 수 없으며 되돌릴 수 없음. 열려 있는 사본은 각자에게 남음." "The file now holds another library" = "이 파일은 이제 다른 라이브러리를 담고 있음" "The file now holds another library (\"{name}\")" = "이 파일은 이제 다른 라이브러리(\"{name}\")를 담고 있음" diff --git a/crates/ui-egui/locales/nl.toml b/crates/ui-egui/locales/nl.toml index 2d6816ab6..9e289ef1f 100644 --- a/crates/ui-egui/locales/nl.toml +++ b/crates/ui-egui/locales/nl.toml @@ -1458,7 +1458,7 @@ status = "draft — needs native review" "Text styles" = "Tekststijlen" "Texts" = "Teksten" "Texture" = "Texture" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "Het canvas toont de kleuren als voorvertoning in sRGB; geëxporteerde PNG-, JPG- en WebP-bestanden worden gelabeld als Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Het canvas toont de kleuren als voorvertoning in sRGB; PNG-, JPG- en WebP-bestanden die met het profiel van het bestand worden geëxporteerd, worden gelabeld als Display P3." "The destination document is unavailable. Nothing was imported." = "Het doeldocument is niet beschikbaar. Er is niets geïmporteerd." "The destination document was closed. Nothing was imported." = "Het doeldocument is gesloten. Er is niets geïmporteerd." "The destination page was removed. Nothing was imported." = "De doelpagina is verwijderd. Er is niets geïmporteerd." diff --git a/crates/ui-egui/locales/pl.toml b/crates/ui-egui/locales/pl.toml index bcc9f0051..fb93dcaf0 100644 --- a/crates/ui-egui/locales/pl.toml +++ b/crates/ui-egui/locales/pl.toml @@ -1465,7 +1465,7 @@ name = "Polski" "Text styles" = "Style tekstu" "Texts" = "Teksty" "Texture" = "Tekstura" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "Płótno wyświetla podgląd kolorów w sRGB; wyeksportowane pliki PNG, JPG i WebP są oznaczane profilem Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Płótno wyświetla podgląd kolorów w sRGB; pliki PNG, JPG i WebP wyeksportowane z profilem pliku są oznaczane profilem Display P3." "The destination document is unavailable. Nothing was imported." = "Dokument docelowy jest niedostępny. Nic nie zostało zaimportowane." "The destination document was closed. Nothing was imported." = "Dokument docelowy został zamknięty. Nic nie zostało zaimportowane." "The destination page was removed. Nothing was imported." = "Strona docelowa została usunięta. Nic nie zostało zaimportowane." diff --git a/crates/ui-egui/locales/pt-BR.toml b/crates/ui-egui/locales/pt-BR.toml index 9108dea4d..7e7500145 100644 --- a/crates/ui-egui/locales/pt-BR.toml +++ b/crates/ui-egui/locales/pt-BR.toml @@ -1377,7 +1377,7 @@ status = "draft — needs native review" "Text styles" = "Estilos de texto" "Texts" = "Textos" "Texture" = "Textura" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "A tela exibe as cores em sRGB; os arquivos PNG, JPG e WebP exportados são marcados como Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "A tela exibe as cores em sRGB; os arquivos PNG, JPG e WebP exportados com o perfil do arquivo são marcados como Display P3." "The file is deleted from the server: nobody can open or join it from there again, and this can't be undone. Copies that are open stay with whoever has them." = "O arquivo é excluído do servidor: ninguém poderá abri-lo nem entrar nele a partir de lá de novo, e isso não pode ser desfeito. As cópias abertas ficam com quem as tem." "The file now holds another library" = "O arquivo agora contém outra biblioteca" "The file now holds another library (\"{name}\")" = "O arquivo agora contém outra biblioteca (\"{name}\")" diff --git a/crates/ui-egui/locales/ru.toml b/crates/ui-egui/locales/ru.toml index 36e9abeaa..92670011a 100644 --- a/crates/ui-egui/locales/ru.toml +++ b/crates/ui-egui/locales/ru.toml @@ -1465,7 +1465,7 @@ name = "Русский" "Text styles" = "Текстовые стили" "Texts" = "Тексты" "Texture" = "Текстура" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "На холсте цвета отображаются в sRGB; экспортированные PNG, JPG и WebP помечены профилем Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "На холсте цвета отображаются в sRGB; PNG, JPG и WebP, экспортированные с профилем файла, помечены профилем Display P3." "The destination document is unavailable. Nothing was imported." = "Документ назначения недоступен. Ничего не импортировано." "The destination document was closed. Nothing was imported." = "Документ назначения закрыт. Ничего не импортировано." "The destination page was removed. Nothing was imported." = "Страница назначения удалена. Ничего не импортировано." diff --git a/crates/ui-egui/locales/sv.toml b/crates/ui-egui/locales/sv.toml index ce02b3f7f..93353be22 100644 --- a/crates/ui-egui/locales/sv.toml +++ b/crates/ui-egui/locales/sv.toml @@ -1537,7 +1537,7 @@ name = "Svenska" "Text styles" = "Textstilar" "Texts" = "Texter" "Texture" = "Textur" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "Arbetsytan förhandsgranskar färger i sRGB; exporterade PNG-, JPG- och WebP-filer märks med Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Arbetsytan förhandsgranskar färger i sRGB; PNG-, JPG- och WebP-filer som exporteras med filens profil märks med Display P3." "The destination document is unavailable. Nothing was imported." = "Måldokumentet är inte tillgängligt. Ingenting importerades." "The destination document was closed. Nothing was imported." = "Måldokumentet stängdes. Ingenting importerades." "The destination page was removed. Nothing was imported." = "Målsidan togs bort. Ingenting importerades." diff --git a/crates/ui-egui/locales/th.toml b/crates/ui-egui/locales/th.toml index f4662a2b8..629abaa56 100644 --- a/crates/ui-egui/locales/th.toml +++ b/crates/ui-egui/locales/th.toml @@ -1446,7 +1446,7 @@ status = "draft — needs native review" "Text styles" = "สไตล์ข้อความ" "Texts" = "ข้อความ" "Texture" = "เท็กซ์เจอร์" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "แคนวาสแสดงตัวอย่างสีใน sRGB ส่วนไฟล์ PNG, JPG และ WebP ที่ส่งออกจะติดแท็ก Display P3" +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "แคนวาสแสดงตัวอย่างสีใน sRGB ส่วนไฟล์ PNG, JPG และ WebP ที่ส่งออกด้วยโปรไฟล์ของไฟล์จะติดแท็ก Display P3" "The destination document is unavailable. Nothing was imported." = "เอกสารปลายทางใช้ไม่ได้ ไม่มีอะไรถูกนำเข้า" "The destination document was closed. Nothing was imported." = "เอกสารปลายทางถูกปิดแล้ว ไม่มีอะไรถูกนำเข้า" "The destination page was removed. Nothing was imported." = "หน้าปลายทางถูกลบแล้ว ไม่มีอะไรถูกนำเข้า" diff --git a/crates/ui-egui/locales/tr.toml b/crates/ui-egui/locales/tr.toml index b98f8389b..f27ccf52f 100644 --- a/crates/ui-egui/locales/tr.toml +++ b/crates/ui-egui/locales/tr.toml @@ -1433,7 +1433,7 @@ name = "Türkçe" "Text styles" = "Metin stilleri" "Texts" = "Metinler" "Texture" = "Doku" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "Tuval renkleri sRGB olarak önizler; dışa aktarılan PNG, JPG ve WebP dosyaları Display P3 olarak etiketlenir." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Tuval renkleri sRGB olarak önizler; dosyanın profiliyle dışa aktarılan PNG, JPG ve WebP dosyaları Display P3 olarak etiketlenir." "The file is deleted from the server: nobody can open or join it from there again, and this can't be undone. Copies that are open stay with whoever has them." = "Dosya sunucudan silinir: artık kimse onu oradan açamaz veya ona katılamaz ve bu işlem geri alınamaz. Açık olan kopyalar, kimdeyse onda kalır." "The file now holds another library" = "Dosya artık başka bir kitaplık içeriyor" "The file now holds another library (\"{name}\")" = "Dosya artık başka bir kitaplık içeriyor (“{name}”)" diff --git a/crates/ui-egui/locales/vi.toml b/crates/ui-egui/locales/vi.toml index 5bd9cf7ff..83142691c 100644 --- a/crates/ui-egui/locales/vi.toml +++ b/crates/ui-egui/locales/vi.toml @@ -1390,7 +1390,7 @@ status = "draft — needs native review" "Text styles" = "Kiểu văn bản" "Texts" = "Văn bản" "Texture" = "Kết cấu" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "Vùng vẽ xem trước màu theo sRGB; các tệp PNG, JPG và WebP xuất ra được gắn thẻ Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Vùng vẽ xem trước màu theo sRGB; các tệp PNG, JPG và WebP xuất ra theo cấu hình của tệp được gắn thẻ Display P3." "The destination document is unavailable. Nothing was imported." = "Tài liệu đích không khả dụng. Không có nội dung nào được nhập." "The destination document was closed. Nothing was imported." = "Tài liệu đích đã đóng. Không có nội dung nào được nhập." "The destination page was removed. Nothing was imported." = "Trang đích đã bị xóa. Không có nội dung nào được nhập." diff --git a/crates/ui-egui/locales/zh-Hans.toml b/crates/ui-egui/locales/zh-Hans.toml index f78f0d938..9c593ccd5 100644 --- a/crates/ui-egui/locales/zh-Hans.toml +++ b/crates/ui-egui/locales/zh-Hans.toml @@ -1387,7 +1387,7 @@ status = "draft — needs native review" "Text styles" = "文本样式" "Texts" = "文本" "Texture" = "纹理" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "画布以 sRGB 预览颜色;导出的 PNG、JPG 和 WebP 文件标记为 Display P3。" +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "画布以 sRGB 预览颜色;使用文件配置文件导出的 PNG、JPG 和 WebP 文件标记为 Display P3。" "The file is deleted from the server: nobody can open or join it from there again, and this can't be undone. Copies that are open stay with whoever has them." = "文件将从服务器删除:任何人都无法再从服务器打开或加入它,且无法撤销。已打开的副本仍归各自持有者所有。" "The file now holds another library" = "该文件现在包含另一个库" "The file now holds another library (\"{name}\")" = "该文件现在包含另一个库(“{name}”)" diff --git a/crates/ui-egui/locales/zh-Hant.toml b/crates/ui-egui/locales/zh-Hant.toml index a1179aa0c..fb941ceec 100644 --- a/crates/ui-egui/locales/zh-Hant.toml +++ b/crates/ui-egui/locales/zh-Hant.toml @@ -1542,7 +1542,7 @@ status = "draft — needs native review" "Texts" = "文字" "Texture" = "材質" "The bars are hidden. {shortcut} shows them again" = "工具列已隱藏。按 {shortcut} 可再次顯示" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "畫布以 sRGB 預覽顏色;匯出的 PNG、JPG 與 WebP 檔案會標記為 Display P3。" +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "畫布以 sRGB 預覽顏色;使用檔案描述檔匯出的 PNG、JPG 與 WebP 檔案會標記為 Display P3。" "The destination document is unavailable. Nothing was imported." = "目的地文件無法使用。未匯入任何內容。" "The destination document was closed. Nothing was imported." = "目的地文件已關閉。未匯入任何內容。" "The destination page was removed. Nothing was imported." = "目的地頁面已移除。未匯入任何內容。" diff --git a/crates/ui-egui/src/dialogs/color_profile.rs b/crates/ui-egui/src/dialogs/color_profile.rs index 3cf941dc0..1a5cb3587 100644 --- a/crates/ui-egui/src/dialogs/color_profile.rs +++ b/crates/ui-egui/src/dialogs/color_profile.rs @@ -36,7 +36,7 @@ pub(super) fn color_profile_dialog(app: &mut FigApp, ctx: &Context) { if !chosen.is_srgb() { ui.add_space(4.0); ui.label( - RichText::new(tr("The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3.")) + RichText::new(tr("The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3.")) .color(t.text_secondary) .font(regular(11.0)), ); From 3d4c798ff23a04a953118439f2a52b4c2d671d0c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 10 Nov 2026 23:58:47 -0800 Subject: [PATCH 133/239] Export: the Vietnamese color profile note names the file's color profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Vietnamese row said "cấu hình của tệp" (the file's configuration) for the file's profile. It now says "hồ sơ màu của tệp", the term the Color profile label uses. --- crates/ui-egui/locales/vi.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/locales/vi.toml b/crates/ui-egui/locales/vi.toml index 83142691c..578619809 100644 --- a/crates/ui-egui/locales/vi.toml +++ b/crates/ui-egui/locales/vi.toml @@ -1390,7 +1390,7 @@ status = "draft — needs native review" "Text styles" = "Kiểu văn bản" "Texts" = "Văn bản" "Texture" = "Kết cấu" -"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Vùng vẽ xem trước màu theo sRGB; các tệp PNG, JPG và WebP xuất ra theo cấu hình của tệp được gắn thẻ Display P3." +"The canvas previews colors in sRGB; PNG, JPG and WebP exports that use the file's profile are tagged Display P3." = "Vùng vẽ xem trước màu theo sRGB; các tệp PNG, JPG và WebP xuất ra theo hồ sơ màu của tệp được gắn thẻ Display P3." "The destination document is unavailable. Nothing was imported." = "Tài liệu đích không khả dụng. Không có nội dung nào được nhập." "The destination document was closed. Nothing was imported." = "Tài liệu đích đã đóng. Không có nội dung nào được nhập." "The destination page was removed. Nothing was imported." = "Trang đích đã bị xóa. Không có nội dung nào được nhập." From 35d46208cff4a6555e1add5edf2a5d5ddbcfa1a8 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 03:48:24 -0500 Subject: [PATCH 134/239] M4: Shared open loops all close through their segment; one index per rounding pass (#1951) Two regions over one open chain both got the closing segment when rounded, but reopen_loops gave it to the first loop only, so after an unrelated deletion the second region's curved closing segment dropped out of its fill. The pass now takes the segment for every loop that walks the same chain (same segment set); a different chain still can't share it. closing_segment no longer scans every segment and every loop per call: rounded_smoothed and reopen_loops build one LoopIndex (endpoint pair to segments, and which segments are in a loop) per pass and pass it in. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/doc/src/vector.rs | 35 ++++-- crates/engine/src/canvas/vectoredit/ops.rs | 118 +++++++++++++++++++-- 2 files changed, 137 insertions(+), 16 deletions(-) diff --git a/crates/doc/src/vector.rs b/crates/doc/src/vector.rs index 1538de2a6..fd6d48072 100644 --- a/crates/doc/src/vector.rs +++ b/crates/doc/src/vector.rs @@ -184,6 +184,13 @@ fn redirect_last_segment(net: &mut VectorNetwork, loop_segs: &[usize], from: usi } } +/// Which segments are in a loop, and which segments join each pair of points: the lookups +/// [`VectorNetwork::closing_segment`] reads, built once per pass by [`VectorNetwork::loop_index`]. +pub struct LoopIndex { + in_loop: Vec, + by_ends: std::collections::BTreeMap<(usize, usize), Vec>, +} + impl VectorNetwork { /// A network from a polyline / polygon. pub fn from_points(points: &[Point], closed: bool) -> Self { @@ -471,6 +478,7 @@ impl VectorNetwork { // The curves go between the two segments wherever a loop walks through the point, in the // order the loop meets them. Each loop is rebuilt in one pass, so a polygon with many // rounded corners isn't quadratic. + let index = self.loop_index(); for lp in out.regions.iter_mut().flat_map(|r| r.loops.iter_mut()) { if lp.is_empty() { continue; @@ -478,7 +486,7 @@ impl VectorNetwork { let start_v = self.loop_start(lp).unwrap_or(0); let mut rebuilt = Vec::with_capacity(lp.len() + by_vertex.len().min(lp.len()) + 1); let mut cur = start_v; - let closing = self.closing_segment(lp); + let closing = self.closing_segment(lp, &index); for &x in lp.iter().chain(closing.iter()) { rebuilt.push(x); let Some(s) = self.segments.get(x) else { continue }; @@ -506,13 +514,29 @@ impl VectorNetwork { } } + /// The lookups [`Self::closing_segment`] needs, built once for a pass over every loop. + pub fn loop_index(&self) -> LoopIndex { + let mut in_loop = vec![false; self.segments.len()]; + for &x in self.regions.iter().flat_map(|r| r.loops.iter().flatten()) { + if let Some(f) = in_loop.get_mut(x) { + *f = true; + } + } + let mut by_ends: std::collections::BTreeMap<(usize, usize), Vec> = std::collections::BTreeMap::new(); + for (i, s) in self.segments.iter().enumerate() { + by_ends.entry((s.a.min(s.b), s.a.max(s.b))).or_default().push(i); + } + LoopIndex { in_loop, by_ends } + } + /// The segment that joins the two ends of an open loop `lp` when it is in no loop of its own /// (and the only such segment): a corner cut off by a segment drawn before the corner point was /// deleted leaves the loop open there, and the stroke follows that segment. Only a loop that /// walks in order as one continuous chain has one. Rounding walks it as the loop's last /// segment, so the points at the loop's ends are cut by arcs as the stroke's are, and deleting - /// points or segments puts it into the loop (#1951). - pub fn closing_segment(&self, lp: &[usize]) -> Option { + /// points or segments puts it into the loop (#1951). `index` is this network's [`Self::loop_index`], + /// shared by every loop of one pass. + pub fn closing_segment(&self, lp: &[usize], index: &LoopIndex) -> Option { let start_v = self.loop_start(lp)?; let mut cur = start_v; for &x in lp { @@ -528,9 +552,8 @@ impl VectorNetwork { if cur == start_v { return None; } - let in_loop = |i: usize| self.regions.iter().flat_map(|r| r.loops.iter().flatten()).any(|&x| x == i); - let ends = |s: &Segment| (s.a == cur && s.b == start_v) || (s.b == cur && s.a == start_v); - let mut joining = self.segments.iter().enumerate().filter(|(i, s)| ends(s) && !in_loop(*i)).map(|(i, _)| i); + let mut joining = + index.by_ends.get(&(cur.min(start_v), cur.max(start_v)))?.iter().copied().filter(|&i| !index.in_loop.get(i).copied().unwrap_or(false)); let first = joining.next()?; joining.next().is_none().then_some(first) } diff --git a/crates/engine/src/canvas/vectoredit/ops.rs b/crates/engine/src/canvas/vectoredit/ops.rs index 733885de1..f4609dc1e 100644 --- a/crates/engine/src/canvas/vectoredit/ops.rs +++ b/crates/engine/src/canvas/vectoredit/ops.rs @@ -470,17 +470,28 @@ fn reopen_loops(net: &mut VectorNetwork) { } // An open chain whose two ends a segment in no loop already joins (a bridge drawn between two // points before the point between them was deleted) closes through that segment, at the end so - // the loop's winding is kept, as `connect` closes it (#1951). One loop at a time, so two loops - // can't both take one segment. - let places: Vec<(usize, usize)> = net.regions.iter().enumerate().flat_map(|(ri, r)| (0..r.loops.len()).map(move |li| (ri, li))).collect(); - for (ri, li) in places { - let Some(lp) = net.regions.get(ri).and_then(|r| r.loops.get(li)) else { continue }; - if lp.len() < 2 { - continue; + // the loop's winding is kept, as `connect` closes it (#1951). Every loop that walks the same + // chain (two regions over one ring) takes it, as the render does; a different chain can't + // share it. The lookups are built once, so a segment one loop took doesn't hide it from the + // next. + let index = net.loop_index(); + let mut closings: Vec<(usize, usize, usize, Vec)> = Vec::new(); + for (ri, r) in net.regions.iter().enumerate() { + for (li, lp) in r.loops.iter().enumerate() { + if lp.len() < 2 { + continue; + } + if let Some(closing) = net.closing_segment(lp, &index) { + let mut chain = lp.clone(); + chain.sort_unstable(); + if closings.iter().all(|(_, _, c, other)| *c != closing || *other == chain) { + closings.push((ri, li, closing, chain)); + } + } } - if let Some(closing) = net.closing_segment(lp) - && let Some(lp) = net.regions.get_mut(ri).and_then(|r| r.loops.get_mut(li)) - { + } + for (ri, li, closing, _) in closings { + if let Some(lp) = net.regions.get_mut(ri).and_then(|r| r.loops.get_mut(li)) { lp.push(closing); } } @@ -1209,4 +1220,91 @@ mod tests { assert!(ends.iter().any(|x| (x - (centre.x - 0.5)).abs() < 0.01), "{ends:?}"); assert!(ends.iter().any(|x| (x - (centre.x + 0.5)).abs() < 0.01), "{ends:?}"); } + + /// An open chain of four segments over five points whose two ends a fifth segment (in no + /// loop) joins, as a bridge drawn before the point between them was deleted. + fn bridged_open_chain() -> VectorNetwork { + let corners = [ + Point::new(0.0, 0.0), + Point::new(525.0, 525.0), + Point::new(0.0, 525.0), + Point::new(333.0, 0.0), + Point::new(525.0, 183.0), + Point::new(900.0, 900.0), + ]; + let mut n = VectorNetwork::from_points(&corners, false); + n.segments = [(0, 3), (1, 2), (2, 0), (4, 1), (3, 4)].iter().map(|&(a, b)| Segment::line(a, b)).collect(); + n.regions.clear(); + for v in &mut n.vertices { + v.radius = 125.0; + } + n + } + + #[test] + fn regions_over_one_open_chain_all_close_through_the_joining_segment() { + use figcraft_geom::BezPath; + use figcraft_geom::kurbo::ParamCurveArclen; + let mut n = bridged_open_chain(); + for _ in 0..2 { + n.regions.push(Region { loops: vec![vec![3, 1, 2, 0]], winding: WindingRule::NonZero, fills: None, ..Default::default() }); + } + delete_vertices(&mut n, &[5], false); + for (i, r) in n.regions.iter().enumerate() { + assert_eq!(r.loops[0], vec![3, 1, 2, 0, 4], "region {i} closes through the segment: {:?}", n.regions); + } + let length = |path: &BezPath| path.segments().map(|s| s.arclen(1e-9)).sum::(); + let stroke = length(&n.stroke_path()); + let rounded = n.rounded().unwrap(); + for i in 0..2 { + let fill = length(&rounded.region_path(i).unwrap()); + assert!((fill - stroke).abs() < 1e-6, "region {i}: fill {fill} and stroke {stroke} trace the same outline"); + } + } + + #[test] + fn a_segment_joining_two_different_chains_goes_to_the_first_only() { + let mut n = bridged_open_chain(); + n.regions.push(Region { loops: vec![vec![3, 1, 2, 0]], winding: WindingRule::NonZero, fills: None, ..Default::default() }); + n.regions.push(Region { loops: vec![vec![0, 2, 1, 3]], winding: WindingRule::NonZero, fills: None, ..Default::default() }); + reopen_loops(&mut n); + assert_eq!(n.regions[0].loops[0].len(), 5); + assert_eq!(n.regions[1].loops[0].len(), 5, "the same segment set is the same chain"); + let mut m = bridged_open_chain(); + m.segments.push(Segment::line(1, 2)); + m.regions.push(Region { loops: vec![vec![3, 1, 2, 0]], winding: WindingRule::NonZero, fills: None, ..Default::default() }); + m.regions.push(Region { loops: vec![vec![3, 5, 2, 0]], winding: WindingRule::NonZero, fills: None, ..Default::default() }); + reopen_loops(&mut m); + let closed = m.regions.iter().filter(|r| r.loops[0].len() == 5).count(); + assert!(closed <= 1, "different chains don't share the segment: {:?}", m.regions); + } + + #[test] + fn many_open_loops_with_no_closing_segment_round_as_before() { + let mut n = VectorNetwork::from_points(&[Point::new(0.0, 0.0), Point::new(10.0, 0.0)], false); + n.segments.clear(); + n.vertices.clear(); + for k in 0..40 { + let x = f64::from(k) * 100.0; + let base = n.vertices.len(); + for p in [(x, 0.0), (x + 50.0, 0.0), (x + 50.0, 50.0), (x, 50.0)] { + n.vertices.push(Vertex { radius: 8.0, ..Vertex::new(p.0, p.1) }); + } + let first = n.segments.len(); + // Three sides of a square, an open loop with nothing to close it. + for (a, b) in [(0, 1), (1, 2), (2, 3)] { + n.segments.push(Segment::line(base + a, base + b)); + } + n.regions.push(Region { + loops: vec![vec![first, first + 1, first + 2]], + winding: WindingRule::NonZero, + fills: None, + ..Default::default() + }); + } + let r = n.rounded().unwrap(); + assert_eq!(r.regions.len(), 40); + // Each loop gained only its two inner corners' arcs (two corners, one arc each). + assert!(r.regions.iter().all(|reg| reg.loops[0].len() == 5), "{:?}", r.regions[0]); + } } From 153fa08d077a6a94a9c5eb44c3878176f15329df Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 04:38:33 -0500 Subject: [PATCH 135/239] M4: reopen_loops looks up each closing segment's chain in a map (#1951) Checking a loop's closing segment against every closing already accepted was quadratic in the number of open loops. A map from closing segment to the chain that took it first answers it in one lookup; behaviour is unchanged. A test closes 50 independent chains through their own segments. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/engine/src/canvas/vectoredit/ops.rs | 33 +++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/canvas/vectoredit/ops.rs b/crates/engine/src/canvas/vectoredit/ops.rs index f4609dc1e..f8b9d7d66 100644 --- a/crates/engine/src/canvas/vectoredit/ops.rs +++ b/crates/engine/src/canvas/vectoredit/ops.rs @@ -475,7 +475,9 @@ fn reopen_loops(net: &mut VectorNetwork) { // share it. The lookups are built once, so a segment one loop took doesn't hide it from the // next. let index = net.loop_index(); - let mut closings: Vec<(usize, usize, usize, Vec)> = Vec::new(); + // The chain that first took each closing segment, so a later loop is checked in one lookup. + let mut owner: std::collections::BTreeMap> = std::collections::BTreeMap::new(); + let mut closings: Vec<(usize, usize, usize)> = Vec::new(); for (ri, r) in net.regions.iter().enumerate() { for (li, lp) in r.loops.iter().enumerate() { if lp.len() < 2 { @@ -484,13 +486,13 @@ fn reopen_loops(net: &mut VectorNetwork) { if let Some(closing) = net.closing_segment(lp, &index) { let mut chain = lp.clone(); chain.sort_unstable(); - if closings.iter().all(|(_, _, c, other)| *c != closing || *other == chain) { - closings.push((ri, li, closing, chain)); + if *owner.entry(closing).or_insert_with(|| chain.clone()) == chain { + closings.push((ri, li, closing)); } } } } - for (ri, li, closing, _) in closings { + for (ri, li, closing) in closings { if let Some(lp) = net.regions.get_mut(ri).and_then(|r| r.loops.get_mut(li)) { lp.push(closing); } @@ -1262,6 +1264,29 @@ mod tests { } } + /// Many independent open chains, each with its own closing segment, all close through it. + #[test] + fn many_open_chains_each_close_through_their_own_segment() { + let one = bridged_open_chain(); + let (nv, ns) = (one.vertices.len(), one.segments.len()); + let mut n = VectorNetwork::default(); + for (i, dx) in (0..50usize).zip((0..50u32).map(|k| f64::from(k) * 1000.0)) { + n.vertices.extend(one.vertices.iter().map(|v| Vertex { x: v.x + dx, ..*v })); + n.segments.extend(one.segments.iter().map(|s| Segment { a: s.a + i * nv, b: s.b + i * nv, ..*s })); + let base = i * ns; + n.regions.push(Region { + loops: vec![vec![base + 3, base + 1, base + 2, base]], + winding: WindingRule::NonZero, + fills: None, + ..Default::default() + }); + } + reopen_loops(&mut n); + for (i, r) in n.regions.iter().enumerate() { + assert_eq!(r.loops[0].last(), Some(&(i * ns + 4)), "chain {i} closes through its own segment"); + } + } + #[test] fn a_segment_joining_two_different_chains_goes_to_the_first_only() { let mut n = bridged_open_chain(); From 641cc415944ceec43faebe9095e3e6ba3f11c3bc Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 04:54:20 -0500 Subject: [PATCH 136/239] M4: Flatten bakes a vector's point corner radius into its path (#2195) Flatten used the vector's network as stored, so a rounded point kept its radius and the box kept the cut-off sharp vertex. It now takes the network as the layer draws it (VectorNetwork::rounded_smoothed through geometry::drawn_network): each rounded point becomes the arc's end points joined by curves, every radius reads 0, and the layer's box is re-fitted to the baked geometry. Shapes' own radii were already baked; a rounded point beside a curved segment keeps today's behaviour. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/cmd/structure.rs | 4 +- crates/engine/src/vector_behaviour_tests.rs | 65 +++++++++++++++++++++ docs/ui-parity.md | 5 +- 3 files changed, 71 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/structure.rs b/crates/engine/src/cmd/structure.rs index 3339faa38..385868ca9 100644 --- a/crates/engine/src/cmd/structure.rs +++ b/crates/engine/src/cmd/structure.rs @@ -496,7 +496,9 @@ fn collect_flatten_parts( } let part = match &node.kind { NodeKind::Vector { network } => { - let mut part = network.clone(); + // Rounded points bake into the path (the arc's end points joined by curves), drawn the way + // the layer draws them, so the shape looks the same and the box fits the real geometry. + let mut part = figcraft_doc::geometry::drawn_network(network, node.corners.smoothing).into_owned(); if !part.regions.is_empty() && part.regions.iter().all(|region| region.fills.is_none() && region.paint_space.is_none()) { let winding = if part.regions.iter().any(|region| region.winding == WindingRule::EvenOdd) { WindingRule::EvenOdd diff --git a/crates/engine/src/vector_behaviour_tests.rs b/crates/engine/src/vector_behaviour_tests.rs index c990ad348..a652304be 100644 --- a/crates/engine/src/vector_behaviour_tests.rs +++ b/crates/engine/src/vector_behaviour_tests.rs @@ -829,3 +829,68 @@ fn vector_points_take_the_requested_size() { let e = s.execute("vector.create", &json!({"points": points, "width": 16, "height": -1})).unwrap_err().to_string(); assert!(e.contains("positive"), "{e}"); } + +/// A vector from `points` with a corner radius per point (`radii`), via `vector.create`. +fn rounded_vector(s: &mut Session, points: &[(f64, f64)], radii: &[f64], closed: bool) -> NodeId { + let pts: Vec = points.iter().map(|p| json!([p.0, p.1])).collect(); + let id = id_of(&ex(s, "vector.create", json!({"points": pts, "closed": closed}))["id"]).unwrap(); + if let NodeKind::Vector { network } = &mut s.doc_mut().unwrap().get_mut(id).unwrap().kind { + for (v, r) in network.vertices.iter_mut().zip(radii) { + v.radius = *r; + } + } + id +} + +/// #2195: Flatten bakes a vector's point radii into its path: the rounded vertex becomes the +/// arc's end points joined by curves, the layer stays a vector, the box fits the real geometry. +#[test] +fn flatten_bakes_a_vectors_point_radius() { + // An open V with the apex rounded. + let mut s = Session::new(); + let v = rounded_vector(&mut s, &[(0.0, 0.0), (184.0, 245.0), (368.0, 0.0)], &[0.0, 60.0, 0.0], false); + let before = net(&s, v); + let drawn = before.rounded().unwrap().stroke_path().perimeter(1e-4); + let h_before = s.doc().unwrap().node(v).unwrap().height; + let out = ex(&mut s, "vector.flatten", json!({"ids": [v]})); + let f = id_of(&out["id"]).unwrap(); + let after = net(&s, f); + assert_eq!(after.vertices.len(), 4, "the apex became two points: 3 + 1"); + assert!(after.vertices.iter().all(|p| p.radius == 0.0), "no radius left"); + let len = after.stroke_path().perimeter(1e-4); + assert!((len - drawn).abs() < 0.5, "the outline is the same: {len} vs {drawn}"); + let h = s.doc().unwrap().node(f).unwrap().height; + let bb = after.bounds().unwrap(); + assert!(h < h_before && (h - 245.0).abs() > 1.0, "the box shrinks from 245: {h}"); + assert!((h - bb.height()).abs() < 1e-6 && bb.y0.abs() < 1e-6, "the box is the baked path's bounds: {h} vs {bb:?}"); + println!("open V: points {} -> {}, height {h_before} -> {h}", before.vertices.len(), after.vertices.len()); + s.undo().unwrap(); + assert!(s.doc().unwrap().node(v).is_some() && s.doc().unwrap().node(f).is_none(), "one undo step"); + assert_eq!(net(&s, v).vertices[1].radius, 60.0); + + // A closed triangle rounded at every point. + let mut s = Session::new(); + let v = rounded_vector(&mut s, &[(0.0, 0.0), (368.0, 0.0), (184.0, 245.0)], &[40.0; 3], true); + let drawn = net(&s, v).rounded().unwrap(); + let (len, area) = (drawn.stroke_path().perimeter(1e-4), drawn.fill_path().area().abs()); + let f = id_of(&ex(&mut s, "vector.flatten", json!({"ids": [v]}))["id"]).unwrap(); + let after = net(&s, f); + assert_eq!(after.vertices.len(), 6, "each corner became two points"); + assert!(after.vertices.iter().all(|p| p.radius == 0.0)); + assert_eq!(after.regions.len(), 1, "still one filled region"); + assert!((after.stroke_path().perimeter(1e-4) - len).abs() < 0.5); + assert!((after.fill_path().area().abs() - area).abs() < 0.5, "same fill area"); + let n = s.doc().unwrap().node(f).unwrap().clone(); + let bb = after.bounds().unwrap(); + assert!(n.height < 245.0 && (n.height - bb.height()).abs() < 1e-6 && (n.width - bb.width()).abs() < 1e-6); + println!("triangle: points 3 -> {}, height 245 -> {}", after.vertices.len(), n.height); + + // Guard: no radius, nothing changes. + let mut s = Session::new(); + let v = rounded_vector(&mut s, &[(0.0, 0.0), (184.0, 245.0), (368.0, 0.0)], &[0.0; 3], false); + let before = net(&s, v); + let f = id_of(&ex(&mut s, "vector.flatten", json!({"ids": [v]}))["id"]).unwrap(); + assert_eq!(net(&s, f).vertices.len(), 3); + assert_eq!(s.doc().unwrap().node(f).unwrap().height, 245.0); + assert_eq!(net(&s, f).vertices, before.vertices); +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..0cb5c7b29 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-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (Flatten bakes a vector's point corner radius into its path (#2195); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -92,7 +92,7 @@ interaction feel not yet compared. | Rectangle, ellipse (arc handles and Design panel arc fields), polygon, star, line, arrow; Shift/Alt | done | Alt draws lines from the centre too (`shapes_behaviour_tests`) | | Corner radius handles (inside each corner of a rectangle or frame, a polygon's or star's top point; Alt: one corner), star ratio handle; Count and Ratio fields | done | handles hide under 48 px on screen; no count handle on the canvas (the Count field instead); corner smoothing rounds rectangles and frames only | | Pen: vector networks, branch, close, bend; pencil | done | pen pressure on Windows and from browser styluses only; outside edit mode the Pen closes on its first point, connects to its other points and continues a selected open path from an end point (`vector_multi_behaviour_tests`); Escape ends the path and keeps its layer in edit mode with the pen, so the next path joins the same vector and another Escape leaves edit mode (#760, `pen_end_tests`); Enter or a double-click ends the path (at the double-click's point, added once) and edits the vector with the Move tool, a double-click with the idle pen edits the layer under it, and in edit mode the pen's Enter or double-click takes the Move tool (#1430, `pen_vector_edit_tests`); switching from Design to Prototype or Inspect ends the path and returns to Move (#308) | -| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). Not yet: areas of other layers edited at once | +| 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), and bakes a vector's point corner radius into its path (each rounded point becomes the arc's end points joined by curves, the layer stays a vector and its box fits the real geometry, #2195); paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn; Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). 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); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | | 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 | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-11 | patch | #2195: Flatten on a vector whose points have a corner radius bakes the rounding into the path, as measured in Figma web: each rounded point becomes the arc's end points joined by curves (a 3-point V with radius 60 on the apex gives 4 points), the layer stays a vector, every radius reads 0 afterwards and the box shrinks to the real geometry (245 to 205.09 high). Shapes' own radii were already baked. Numbers unchanged. | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 06ffeca8017c54bb3b381850672b405b1537ad59 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 05:55:33 -0500 Subject: [PATCH 137/239] M4: Every loop a bridge closes takes it; only a real removal closes loops (#1951) The closing pass moves out of reopen_loops (back to main's body) into close_bridged_loops, run only by remove_segments and delete_vertices when the segment or point count changed. Every loop takes what closing_segment returns against one snapshot, so two fills that shared a deleted border both close through the bridge, as rounding already draws them. The owner map is gone. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 decided; Sonnet 5.5 wrote at medium --- crates/engine/src/canvas/vectoredit/ops.rs | 114 +++++++++++++++------ 1 file changed, 83 insertions(+), 31 deletions(-) diff --git a/crates/engine/src/canvas/vectoredit/ops.rs b/crates/engine/src/canvas/vectoredit/ops.rs index f8b9d7d66..222c6f4ff 100644 --- a/crates/engine/src/canvas/vectoredit/ops.rs +++ b/crates/engine/src/canvas/vectoredit/ops.rs @@ -312,6 +312,7 @@ fn remove_vertex_index(net: &mut VectorNetwork, vi: usize) { /// Remove segments (fixing region loops); points left without any segment go too. pub fn remove_segments(net: &mut VectorNetwork, segs: &[usize]) { + let before = net.segments.len(); let mut touched: Vec = segs.iter().filter_map(|s| net.segments.get(*s)).flat_map(|s| [s.a, s.b]).collect(); remove_segments_only(net, segs); touched.sort_unstable(); @@ -322,6 +323,9 @@ pub fn remove_segments(net: &mut VectorNetwork, segs: &[usize]) { } } reopen_loops(net); + if net.segments.len() != before { + close_bridged_loops(net); + } } fn remove_segments_only(net: &mut VectorNetwork, segs: &[usize]) { @@ -349,6 +353,7 @@ fn remove_segments_only(net: &mut VectorNetwork, segs: &[usize]) { /// Delete vertices, joining their neighbours where a vertex had exactly two segments (`heal`). pub fn delete_vertices(net: &mut VectorNetwork, idx: &[usize], heal: bool) { + let before = net.vertices.len(); let mut idx: Vec = idx.to_vec(); idx.sort_unstable(); idx.dedup(); @@ -408,6 +413,9 @@ pub fn delete_vertices(net: &mut VectorNetwork, idx: &[usize], heal: bool) { } net.sanitize(); reopen_loops(net); + if net.vertices.len() != before { + close_bridged_loops(net); + } } /// Handles for the curve that heals over deleted point `vi` between `(vertex, handle)` ends `o1` @@ -468,32 +476,21 @@ fn reopen_loops(net: &mut VectorNetwork) { } } } - // An open chain whose two ends a segment in no loop already joins (a bridge drawn between two - // points before the point between them was deleted) closes through that segment, at the end so - // the loop's winding is kept, as `connect` closes it (#1951). Every loop that walks the same - // chain (two regions over one ring) takes it, as the render does; a different chain can't - // share it. The lookups are built once, so a segment one loop took doesn't hide it from the - // next. +} + +/// After points or segments were removed: an open loop whose two ends a segment in no loop already +/// joins (a bridge drawn between two points before what lay between them was deleted) closes +/// through that segment, at the loop's end so its winding is kept, as `connect` closes it (#1951). +/// Every loop takes what [`VectorNetwork::closing_segment`] gives it against one snapshot of the +/// network, which is what rounding walks: two fills that shared the removed border share the +/// bridge, as they shared the border. Only a removal can open a loop at two points a segment +/// already joins (a cut's ends are new points), so only `delete_vertices` and `remove_segments` +/// run this, and only when they removed something. +fn close_bridged_loops(net: &mut VectorNetwork) { let index = net.loop_index(); - // The chain that first took each closing segment, so a later loop is checked in one lookup. - let mut owner: std::collections::BTreeMap> = std::collections::BTreeMap::new(); - let mut closings: Vec<(usize, usize, usize)> = Vec::new(); - for (ri, r) in net.regions.iter().enumerate() { - for (li, lp) in r.loops.iter().enumerate() { - if lp.len() < 2 { - continue; - } - if let Some(closing) = net.closing_segment(lp, &index) { - let mut chain = lp.clone(); - chain.sort_unstable(); - if *owner.entry(closing).or_insert_with(|| chain.clone()) == chain { - closings.push((ri, li, closing)); - } - } - } - } - for (ri, li, closing) in closings { - if let Some(lp) = net.regions.get_mut(ri).and_then(|r| r.loops.get_mut(li)) { + let closings: Vec> = net.regions.iter().flat_map(|r| r.loops.iter()).map(|lp| net.closing_segment(lp, &index)).collect(); + for (lp, closing) in net.regions.iter_mut().flat_map(|r| r.loops.iter_mut()).zip(closings) { + if let Some(closing) = closing { lp.push(closing); } } @@ -1281,27 +1278,82 @@ mod tests { ..Default::default() }); } - reopen_loops(&mut n); + close_bridged_loops(&mut n); for (i, r) in n.regions.iter().enumerate() { assert_eq!(r.loops[0].last(), Some(&(i * ns + 4)), "chain {i} closes through its own segment"); } } #[test] - fn a_segment_joining_two_different_chains_goes_to_the_first_only() { + fn a_segment_joining_two_different_chains_closes_both() { let mut n = bridged_open_chain(); n.regions.push(Region { loops: vec![vec![3, 1, 2, 0]], winding: WindingRule::NonZero, fills: None, ..Default::default() }); n.regions.push(Region { loops: vec![vec![0, 2, 1, 3]], winding: WindingRule::NonZero, fills: None, ..Default::default() }); - reopen_loops(&mut n); + delete_vertices(&mut n, &[5], false); assert_eq!(n.regions[0].loops[0].len(), 5); assert_eq!(n.regions[1].loops[0].len(), 5, "the same segment set is the same chain"); let mut m = bridged_open_chain(); m.segments.push(Segment::line(1, 2)); m.regions.push(Region { loops: vec![vec![3, 1, 2, 0]], winding: WindingRule::NonZero, fills: None, ..Default::default() }); m.regions.push(Region { loops: vec![vec![3, 5, 2, 0]], winding: WindingRule::NonZero, fills: None, ..Default::default() }); - reopen_loops(&mut m); - let closed = m.regions.iter().filter(|r| r.loops[0].len() == 5).count(); - assert!(closed <= 1, "different chains don't share the segment: {:?}", m.regions); + let drawn = m.rounded().unwrap(); + delete_vertices(&mut m, &[5], false); + assert_eq!(m.regions[0].loops[0], vec![3, 1, 2, 0, 4], "{:?}", m.regions); + assert_eq!(m.regions[1].loops[0], vec![3, 5, 2, 0, 4], "different chains share the segment too: {:?}", m.regions); + let after = m.rounded().unwrap(); + for i in 0..2 { + assert_eq!(after.region_path(i).unwrap(), drawn.region_path(i).unwrap(), "region {i} is stored as rounding drew it"); + } + } + + /// Two fills that shared a border, a bridge drawn between the border's ends, then the border's + /// middle point deleted: both fills close through the bridge (#1951). + #[test] + fn two_fills_that_shared_a_deleted_border_both_close_through_the_bridge() { + use figcraft_geom::Shape; + let pts = [(0.0, 0.0), (50.0, 0.0), (100.0, 0.0), (100.0, 100.0), (50.0, 100.0), (0.0, 100.0)].map(|(x, y)| Point::new(x, y)); + let mut n = VectorNetwork::from_points(&pts, true); + n.vertices.push(Vertex::new(50.0, 50.0)); + n.segments.push(Segment::line(1, 6)); + n.segments.push(Segment::line(6, 4)); + n.regions.clear(); + for lp in [vec![0, 6, 7, 4, 5], vec![1, 2, 3, 7, 6]] { + n.regions.push(Region { loops: vec![lp], winding: WindingRule::NonZero, fills: None, ..Default::default() }); + } + connect(&mut n, 1, 4, (30.0, 30.0), (30.0, -30.0)).unwrap(); + delete_vertices(&mut n, &[6], false); + assert_eq!(n.regions[0].loops[0], vec![4, 5, 0, 6]); + assert_eq!(n.regions[1].loops[0], vec![1, 2, 3, 6], "the second fill closes through the bridge too"); + let area = |i: usize| n.region_path(i).unwrap().area().abs(); + assert!((area(0) + area(1) - 10_000.0).abs() < 1e-6, "the fills meet along the bridge"); + } + + #[test] + fn removing_nothing_leaves_an_open_loop_alone() { + let mut n = bridged_open_chain(); + n.regions.push(Region { loops: vec![vec![3, 1, 2, 0]], winding: WindingRule::NonZero, fills: None, ..Default::default() }); + let before = n.clone(); + remove_segments(&mut n, &[]); + assert_eq!(n, before); + remove_segments(&mut n, &[99]); + assert_eq!(n, before); + delete_vertices(&mut n, &[], false); + assert_eq!(n, before); + delete_vertices(&mut n, &[99], true); + assert_eq!(n, before); + delete_vertices(&mut n, &[5], false); + assert_eq!(n.regions[0].loops[0], vec![3, 1, 2, 0, 4]); + } + + /// The same bridge as the curved-bridge test, reached by removing segments. + #[test] + fn removing_segments_behind_a_curved_bridge_keeps_the_bridge_in_the_loop() { + let pts = [(0.0, 0.0), (50.0, 0.0), (100.0, 0.0), (100.0, 50.0), (100.0, 100.0), (0.0, 100.0)].map(|(x, y)| Point::new(x, y)); + let mut n = VectorNetwork::from_points(&pts, true); + connect(&mut n, 1, 3, (25.0, 25.0), (-25.0, -25.0)).unwrap(); + remove_segments(&mut n, &[1, 2]); + assert_eq!((n.segments.len(), n.regions[0].loops[0].len()), (5, 5)); + assert_eq!(n.regions[0].loops[0], vec![1, 2, 3, 0, 4]); } #[test] From a28c03d9f1f18284cbd2315e7809733652ce57fe Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 08:26:17 -0500 Subject: [PATCH 138/239] M2.1: grid Fill tracks share the space and let a fixed child overflow, as measured in Figma On a fixed-size axis a Fill (1fr) track now splits the free space by its fraction, after gaps and padding, and a fixed-size or hug-size child alone in it asks nothing of the track, so a child bigger than its share overflows into the next track. Measured in Figma web: frame 300 x 200, rows 1fr / 1fr, children 100 x 150 and 100 x 20 give rows 100 / 100 (second child at y 100); with a row gap of 10, rows 95 / 95 (y 105); with the frame height on Hug the rows fit their content, 150 / 20 (frame 170). This replaces the 2026-10-11 rule from the documentation (a track never gets less than its content). Unchanged: a Fill child's own minimum, spanning children, Hug and Fixed tracks, the Hug-axis path. Three behaviour cases flipped to the measured rule and three added with the measured numbers; the two parity docs are updated. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/layout/src/behaviour_tests.rs | 37 ++++++++++++++++++++++------ crates/layout/src/lib.rs | 28 ++++++++++++++++----- docs/auto-layout-parity.md | 7 +++--- docs/target-app-parity.md | 8 +++--- 4 files changed, 59 insertions(+), 21 deletions(-) diff --git a/crates/layout/src/behaviour_tests.rs b/crates/layout/src/behaviour_tests.rs index 50dcc79ad..c0b9b983b 100644 --- a/crates/layout/src/behaviour_tests.rs +++ b/crates/layout/src/behaviour_tests.rs @@ -674,27 +674,48 @@ fn grid_rules() { rects: &[(0.0, 0.0, 60.0, 20.0), (60.0, 0.0, 240.0, 20.0)], }, Case { - rule: "fr tracks behave like the CSS fr unit: a fixed child taller than its share keeps its row", - // Share 50 < 80: row 1 keeps 80, row 2 gets the remaining 20. + rule: "fr tracks as measured in Figma: a fixed child taller than its share keeps its row's share and overflows", + // Share 50 < 80: rows stay 50 / 50, child 1 overflows into row 2. frame: Frame { mode: Grid, size: (100.0, 100.0), columns: &[fr(1.0)], rows: &[fr(1.0), fr(1.0)], ..FRAME }, kids: &[kid(20.0, 80.0), Kid { sizing: (Fixed, Fill), ..KID }], want: (100.0, 100.0), - rects: &[(0.0, 0.0, 20.0, 80.0), (0.0, 80.0, 20.0, 20.0)], + rects: &[(0.0, 0.0, 20.0, 80.0), (0.0, 50.0, 20.0, 50.0)], }, Case { - rule: "fr tracks: children bigger than every share keep their sizes (the grid overflows)", + rule: "fr tracks as measured in Figma: children bigger than every share keep their sizes (the grid overflows)", frame: Frame { mode: Grid, size: (100.0, 100.0), columns: &[fr(1.0)], rows: &[fr(1.0), fr(1.0)], ..FRAME }, kids: &[kid(20.0, 80.0), kid(20.0, 70.0)], want: (100.0, 100.0), - rects: &[(0.0, 0.0, 20.0, 80.0), (0.0, 80.0, 20.0, 70.0)], + rects: &[(0.0, 0.0, 20.0, 80.0), (0.0, 50.0, 20.0, 70.0)], }, Case { - rule: "fr columns: a fixed child wider than its share keeps its column", - // Share 100 < 150: column 1 keeps 150; column 2 (2fr alone) gets the other 150. + rule: "fr columns as measured in Figma: a fixed child wider than its share overflows its column", + // Share 100 < 150: columns stay 100 / 200. frame: Frame { mode: Grid, size: (300.0, 20.0), columns: &[fr(1.0), fr(2.0)], ..FRAME }, kids: &[kid(150.0, 20.0), Kid { sizing: (Fill, Fixed), ..KID }], want: (300.0, 20.0), - rects: &[(0.0, 0.0, 150.0, 20.0), (150.0, 0.0, 150.0, 20.0)], + rects: &[(0.0, 0.0, 150.0, 20.0), (100.0, 0.0, 200.0, 20.0)], + }, + Case { + rule: "fr rows as measured in Figma: 300 x 200, 1fr / 1fr, a 150-tall child does not widen its row", + frame: Frame { mode: Grid, size: (300.0, 200.0), columns: &[fr(1.0)], rows: &[fr(1.0), fr(1.0)], ..FRAME }, + kids: &[kid(100.0, 150.0), kid(100.0, 20.0)], + want: (300.0, 200.0), + rects: &[(0.0, 0.0, 100.0, 150.0), (0.0, 100.0, 100.0, 20.0)], + }, + Case { + rule: "fr rows as measured in Figma: the row gap comes off first (95 / 95, second child at 105)", + frame: Frame { mode: Grid, size: (300.0, 200.0), cross_gap: 10.0, columns: &[fr(1.0)], rows: &[fr(1.0), fr(1.0)], ..FRAME }, + kids: &[kid(100.0, 150.0), kid(100.0, 20.0)], + want: (300.0, 200.0), + rects: &[(0.0, 0.0, 100.0, 150.0), (0.0, 105.0, 100.0, 20.0)], + }, + Case { + rule: "fr rows as measured in Figma: with the frame on Hug the rows size to content (150 / 20, frame 170)", + frame: Frame { mode: Grid, size: (300.0, 200.0), sizing: (Fixed, Hug), columns: &[fr(1.0)], rows: &[fr(1.0), fr(1.0)], ..FRAME }, + kids: &[kid(100.0, 150.0), kid(100.0, 20.0)], + want: (300.0, 170.0), + rects: &[(0.0, 0.0, 100.0, 150.0), (0.0, 150.0, 100.0, 20.0)], }, Case { rule: "placement: left to right, top to bottom; rows grow to fit the children", diff --git a/crates/layout/src/lib.rs b/crates/layout/src/lib.rs index 880c6dad7..3cac241c5 100644 --- a/crates/layout/src/lib.rs +++ b/crates/layout/src/lib.rs @@ -794,9 +794,9 @@ fn track_spec(specs: &[figcraft_doc::GridTrack], i: usize) -> (Sizing, f64) { } /// Resolve track sizes: fixed tracks keep their size, hug tracks fit their content, fill tracks -/// share what is left by their fractional units like the CSS `fr` unit (a track never gets less -/// than its content: one whose share is too small keeps its content size and the others share the -/// rest). `avail` is None when the frame hugs that axis (fill tracks then hug their content too). +/// share what is left by their fractional units (a track whose share is below its content, which +/// only a Fill child's minimum or a spanning child asks for, keeps that size and the others share +/// the rest). `avail` is None when the frame hugs that axis (fill tracks then hug their content too). fn resolve_tracks(specs: &[figcraft_doc::GridTrack], content: &[f64], avail: Option) -> Vec { let mut out: Vec = (0..content.len()) .map(|i| match track_spec(specs, i) { @@ -891,13 +891,29 @@ pub fn grid_geometry(doc: &Document, frame: NodeId) -> Option { let gy = finite_or_zero(al.cross_gap).max(0.0); let hug_w = f.child_layout.sizing_h == Sizing::Hug; let hug_h = f.child_layout.sizing_v == Sizing::Hug; - // What each child asks of its tracks: its size, or (filling a non-hugging axis) its minimum. + // What each child asks of its tracks: its size, its minimum when it fills a non-hugging axis, or + // nothing when it sits alone in a Fill track of a non-hugging axis. let (mut ws, mut hs) = (Vec::with_capacity(cells.len()), Vec::with_capacity(cells.len())); for c in &cells { let (w, h) = outer_size(doc, c.id); let cl = doc.node(c.id).map(|n| n.child_layout.clone()).unwrap_or_default(); - ws.push(if cl.sizing_h == Sizing::Fill && !hug_w { cl.min_w.unwrap_or(0.0) } else { w }); - hs.push(if cl.sizing_v == Sizing::Fill && !hug_h { cl.min_h.unwrap_or(0.0) } else { h }); + // Measured in Figma: a Fill track of a fixed-size axis shares the space by its fraction and + // ignores a fixed-size (or hug-size) child in it, which overflows into the next track. + let in_fill = |tracks: &[figcraft_doc::GridTrack], start: usize, span: usize| span == 1 && track_spec(tracks, start).0 == Sizing::Fill; + ws.push(if cl.sizing_h == Sizing::Fill && !hug_w { + cl.min_w.unwrap_or(0.0) + } else if !hug_w && in_fill(&al.column_tracks, c.column, c.column_span) { + 0.0 + } else { + w + }); + hs.push(if cl.sizing_v == Sizing::Fill && !hug_h { + cl.min_h.unwrap_or(0.0) + } else if !hug_h && in_fill(&al.row_tracks, c.row, c.row_span) { + 0.0 + } else { + h + }); } let col_content = track_content(&cells, &ws, &al.column_tracks, cols, gx, true, hug_w); let row_content = track_content(&cells, &hs, &al.row_tracks, rows, gy, false, hug_h); diff --git a/docs/auto-layout-parity.md b/docs/auto-layout-parity.md index f60cd4350..0e9c0cc24 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-03 · **Change:** patch (a Cmd/Ctrl-click on a padding field sets all four sides with the value typed, as the Guide to auto layout's shortcut guide says; Suggest auto layout is its own command, as the help center says: it adds as many auto layout frames as needed, splitting a frame's layers into rows or columns by the gaps between them, and keeps the placement of the design where the gaps are even (#1823); baseline alignment puts a layer without text with its bottom on the line, as the help center's figure shows an icon next to text (#1825); 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) +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-11-11 · **Change:** patch (grid Fill (`fr`) tracks share the space of a fixed-size axis by their fractions and let a fixed-size child overflow, as measured in Figma (300 x 200, two rows, 100 x 150 and 100 x 20 children: rows 100 / 100, second child at y 100; with a row gap of 10, rows 95 / 95 and y 105; on Hug the rows fit their content, 150 / 20) -- this replaces the 2026-10-11 rule from the documentation; a Cmd/Ctrl-click on a padding field sets all four sides with the value typed, as the Guide to auto layout's shortcut guide says; Suggest auto layout is its own command, as the help center says: it adds as many auto layout frames as needed, splitting a frame's layers into rows or columns by the gaps between them, and keeps the placement of the design where the gaps are even (#1823); baseline alignment puts a layer without text with its bottom on the line, as the help center's figure shows an icon next to text (#1825); 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%, @@ -67,7 +67,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Ignore auto layout: out of the flow, kept in the frame; constraints apply only then | pass | `absolute_position_rules` | | Canvas stacking: last on top by default, first on top on request; the layer order stays | **fixed** + **added** | `reverseZ` was stored but never drawn: now the canvas, PNG, SVG and PDF exports and hit testing paint in that order; Design panel control | | Grid: `fr` tracks share by fraction; fixed tracks keep their size; hug tracks fit their content | pass | `grid_rules` | -| Grid `fr` tracks behave like the CSS `fr` unit: a track never gets less than its content | **fixed** | was `minmax(0, 1fr)`: a fixed-size child taller than its share overflowed into the next row | +| Grid `fr` tracks as measured in Figma: on a fixed-size axis they share the space left after gaps and padding by their fractions and a fixed-size child bigger than its share overflows into the next track (`minmax(0, 1fr)`); on a Hug axis they size to their content | **fixed** | 300 x 200 frame, rows 1fr / 1fr, children 100 x 150 and 100 x 20: rows 100 / 100, second child at y 100; row gap 10: rows 95 / 95, y 105; frame height Hug: rows 150 / 20, frame 170; columns the same. Measured in Figma 2026-11-11; was the CSS rule from the documentation (2026-10-11) | | Grid placement left to right, top to bottom; rows grow; anchors; spans; gaps; padding | pass | `grid_rules` | | Grid children align independently in their cells | **added** | `gridAlignH` / `gridAlignV` (Auto follows the frame), Design panel cell alignment | | A hugging grid with `fr` tracks | silent | the file format calls it invalid; `fr` tracks hug their content | @@ -79,7 +79,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Feature | Status | Evidence / notes | |---|---|---| | Horizontal, vertical, wrap (both directions) | done | `crates/layout` | -| Grid auto layout: fixed / hug / `fr` tracks, cells, spans, gaps, cell alignment | done | `fr` like CSS `fr` | +| Grid auto layout: fixed / hug / `fr` tracks, cells, spans, gaps, cell alignment | done | `fr` as measured | | Gap, auto gap (between / evenly / around), padding (per side), alignment 3×3 | done | a Cmd/Ctrl-click on a padding field (the pair or a side) makes the value typed go to all four sides in one undo step (Guide to auto layout, Keyboard shortcut guide; `padding_individual_tests`) | | Text baseline alignment | done | | | Hug / Fill / Fixed sizing with coherent rules (Fill turns a hugging parent Fixed) | done | `al_nesting_tests.rs`, `al_behaviour_tests.rs` | @@ -101,6 +101,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Date | Change | Summary | |---|---|---| +| 2026-11-11 | patch | M2.1: grid Fill (`fr`) tracks share the space of a fixed-size axis by their fractions and let a fixed-size child overflow, as measured in Figma (300 x 200, two rows, 100 x 150 and 100 x 20 children: rows 100 / 100, second child at y 100; with a row gap of 10, rows 95 / 95 and y 105; on Hug the rows fit their content, 150 / 20) (this replaces the 2026-10-11 rule from the documentation). Layout behaviour suite 64 -> 67 cases (three flipped, three added) | | 2026-11-05 | patch | M2, #1823: Suggest auto layout is no longer Add auto layout under another name: `layout.suggest` splits a frame's layers into rows (Vertical) or else columns (Horizontal) by the gaps between their boxes, wraps each band of several layers in a new frame without fill or clipping that hugs it, and repeats inside it (16 levels, 1,000 layers per frame at most). The frame keeps its size; gap and padding come from the bands, so layers keep their boxes where the gaps are even and the bands start at the same offset; instances and layers inside them are refused; uneven gaps (smallest used), bands that start at different offsets across the flow (lined up at the smallest) and layers that overlap along both axes come back as `warnings`. A band frame hugs only when its own split succeeds: a band whose layers overlap along both axes gets no auto layout and stays Fixed, so it cannot reflow those children. `direction` sets the top level only; one undo step; `layout.add` is unchanged. Tests in `layout_suggest_tests.rs` | | 2026-11-02 | patch | M2: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. The modifier was ignored before. Test: `padding_individual_tests` | | 2026-11-03 | patch | M2, #1825: baseline alignment of a layer without text (an icon next to a text) puts its bottom on the line's baseline, as the help center's figure shows ("the bottoms of the icon and the word home are aligned on the red line"); it kept to the top of the line. A layer reaching below the text's baseline moves the text down, and a line with no text lines the layers' bottoms up (the documentation is silent; CSS baseline alignment does the same). Tests: `alignment_rules` (three cases), engine `baseline_alignment_puts_an_icons_bottom_on_the_text_baseline`. Numbers unchanged. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 031521f51..b0f035d02 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-06 · **Change:** minor (justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (grid Fill (`fr`) tracks share the space of a fixed-size axis by their fractions and let a fixed-size child overflow, as measured in Figma (300 x 200, two rows, 100 x 150 and 100 x 20 children: rows 100 / 100, second child at y 100; with a row gap of 10, rows 95 / 95 and y 105; on Hug the rows fit their content, 150 / 20) -- this replaces the 2026-10-11 rule from the documentation; justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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 @@ -104,7 +104,7 @@ Breadth: does it exist. Ready: depth, correctness and fidelity for real projects | 6 | Strokes | 3 | 95% | 75% | Stroke QA with real files (colour styles on strokes, stroke weight and per-side weight variables, brush strokes landed, see 20) | 1–2 | | 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 | +| 9 | Auto layout & constraints | 9 | 98% | 74% | Behaviour against real Figma files (behaviour suite from the documentation, `fr` tracks as measured, 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 (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 | @@ -332,8 +332,7 @@ Hours in this narrative are the builders' estimates; the tables above supersede "Navigate to" a section shows its frame shown last, else its first; ready for dev turns "Changed" when the contents are edited, resolved with a reason; Compare changes shows what a changed frame or section looked like when it was marked next to how it is now, with the - changed layers and their property changes. *Left:* whether `fr` rows of a fixed-height grid - should make room for fixed-size children (now `minmax(0, 1fr)`-like). 1–2 h. + changed layers and their property changes. 1–2 h. 4. **Components depth**: *landed:* component properties (edit/delete/bind) with the properties panel, add variant, instance swap UI, per-layer overrides with reset, restore main, instance structure protection; Assets panel with live thumbnails, search and drag-to-canvas (drops into @@ -652,6 +651,7 @@ Carried over from the ROADMAP's "Shipped so far" (2026-10-10). The test count th | Date | Change | Summary | |---|---|---| +| 2026-11-11 | patch | M2.1: grid Fill (`fr`) tracks share the space of a fixed-size axis by their fractions and let a fixed-size child overflow, as measured in Figma (300 x 200, two rows, 100 x 150 and 100 x 20 children: rows 100 / 100, second child at y 100; with a row gap of 10, rows 95 / 95 and y 105; on Hug the rows fit their content, 150 / 20) (this replaces the 2026-10-11 rule from the documentation). Percentages unchanged | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`) draft catalog: 1,975 UI strings, 641 command labels and 31 menu wordings, clean-room from the English source; zh-TW, zh-HK, zh-MO and zh-Hant read it, explicit Hans stays Simplified; Noto Sans CJK TC then Taiwan system faces; no bundled font; native review pending. Numbers unchanged | | 2026-11-04 | patch | M4, #1970: justified Chinese, Japanese and Korean text, written without spaces between words, aligns its right edge: the room on each line but a paragraph's last goes between its characters, each a word of its own as for line breaking ("Justify aligns the first word in each line of text to the left-most edge, and the last to the right-most edge"), wherever a line could break there, so none opens before a full stop or closing bracket, nor after an opening one. Latin text widens its spaces as before; mixed text widens both. A gap is reordered with the line's runs as a space of no width would be, so one beside a Hebrew word in Chinese text, or beside a Chinese word within that Hebrew, opens beside the word, not inside it. `figcraft_text::breaks::justify_between`, beside `break_between`, says where. Evidence: `tests::justified_ideographs_spread_the_room_between_characters` (fails on main). | | 2026-11-04 | patch | M8, #1951 (#1506 again): a path broken open by deleting a point (Delete, not Shift+Delete) is filled closed by a straight line across the gap, as an open path's fill is; joining its two ends again (the pen onto the other end, Connect, ⌘J) left the loop without the new segment, so once the points were rounded the fill and the selection outline ran straight across while the stroke followed the segment and its arcs. Joining now closes the loop through the new segment ("Click to close the path."; "You can use the Paint tool to add fills to any closed regions of a vector network."): `ops::connect` puts it into the loop whose segments are the chain between the ends, at the gap and in the loop's own order, so a hole keeps its winding whichever end was clicked first; a loop listed out of walking order is left as it was. Evidence: `vectoredit::tests::a_rounded_chamfer_made_other_ways_fills_along_its_arcs` (fails on main: the loop kept 4 of 5 segments), `a_rounded_chamfer_cut_in_the_editor_fills_along_its_arcs` (Shift+Delete, with and without a region fill), `doc::tests::a_chamfered_rectangles_rounded_fill_is_cut_at_every_point` (fill, region path and stroke agree for every loop order and segment direction of a chamfered rectangle). | From daa6b5b21990c1ea58df5ed1b10097b6af2601e1 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 08:27:14 -0500 Subject: [PATCH 139/239] M2.1: auto layout parity doc: the behaviour suite's case count The suite has 68 cases with this branch's three (the intro still said 64, and the revision row named totals nobody had counted). Co-Authored-By: Claude Opus 5.5 --- docs/auto-layout-parity.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/auto-layout-parity.md b/docs/auto-layout-parity.md index 0e9c0cc24..584b28cb7 100644 --- a/docs/auto-layout-parity.md +++ b/docs/auto-layout-parity.md @@ -5,7 +5,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%, ready ~74% (estimated)**: every rule of the public documentation is a test case with the sizes and -positions it implies (`crates/layout/src/behaviour_tests.rs`, 64 cases, and +positions it implies (`crates/layout/src/behaviour_tests.rs`, 68 cases, and `crates/engine/src/al_behaviour_tests.rs` through commands), and all pass; nothing yet against real Figma files. Remaining: 3–6 h. @@ -101,7 +101,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Date | Change | Summary | |---|---|---| -| 2026-11-11 | patch | M2.1: grid Fill (`fr`) tracks share the space of a fixed-size axis by their fractions and let a fixed-size child overflow, as measured in Figma (300 x 200, two rows, 100 x 150 and 100 x 20 children: rows 100 / 100, second child at y 100; with a row gap of 10, rows 95 / 95 and y 105; on Hug the rows fit their content, 150 / 20) (this replaces the 2026-10-11 rule from the documentation). Layout behaviour suite 64 -> 67 cases (three flipped, three added) | +| 2026-11-11 | patch | M2.1: grid Fill (`fr`) tracks share the space of a fixed-size axis by their fractions and let a fixed-size child overflow, as measured in Figma (300 x 200, two rows, 100 x 150 and 100 x 20 children: rows 100 / 100, second child at y 100; with a row gap of 10, rows 95 / 95 and y 105; on Hug the rows fit their content, 150 / 20) (this replaces the 2026-10-11 rule from the documentation). Layout behaviour suite: three cases flipped, three added | | 2026-11-05 | patch | M2, #1823: Suggest auto layout is no longer Add auto layout under another name: `layout.suggest` splits a frame's layers into rows (Vertical) or else columns (Horizontal) by the gaps between their boxes, wraps each band of several layers in a new frame without fill or clipping that hugs it, and repeats inside it (16 levels, 1,000 layers per frame at most). The frame keeps its size; gap and padding come from the bands, so layers keep their boxes where the gaps are even and the bands start at the same offset; instances and layers inside them are refused; uneven gaps (smallest used), bands that start at different offsets across the flow (lined up at the smallest) and layers that overlap along both axes come back as `warnings`. A band frame hugs only when its own split succeeds: a band whose layers overlap along both axes gets no auto layout and stays Fixed, so it cannot reflow those children. `direction` sets the top level only; one undo step; `layout.add` is unchanged. Tests in `layout_suggest_tests.rs` | | 2026-11-02 | patch | M2: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. The modifier was ignored before. Test: `padding_individual_tests` | | 2026-11-03 | patch | M2, #1825: baseline alignment of a layer without text (an icon next to a text) puts its bottom on the line's baseline, as the help center's figure shows ("the bottoms of the icon and the word home are aligned on the red line"); it kept to the top of the line. A layer reaching below the text's baseline moves the text down, and a line with no text lines the layers' bottoms up (the documentation is silent; CSS baseline alignment does the same). Tests: `alignment_rules` (three cases), engine `baseline_alignment_puts_an_icons_bottom_on_the_text_baseline`. Numbers unchanged. | From 92753a8f6dada9072426073fac7f42320db56081 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 09:39:43 -0500 Subject: [PATCH 140/239] M2.1: auto layout parity doc: a Fill child's minimum still sizes its fr track The minmax(0, 1fr) rule holds for fixed-size and hug-size children; a Fill child's own minimum keeps its track at least that big, as before (not measured). Co-Authored-By: Claude Opus 5.5 --- docs/auto-layout-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/auto-layout-parity.md b/docs/auto-layout-parity.md index 584b28cb7..f40381ecc 100644 --- a/docs/auto-layout-parity.md +++ b/docs/auto-layout-parity.md @@ -67,7 +67,7 @@ Status: **pass** (a case in the suite holds), **fixed** (the suite found a diver | Ignore auto layout: out of the flow, kept in the frame; constraints apply only then | pass | `absolute_position_rules` | | Canvas stacking: last on top by default, first on top on request; the layer order stays | **fixed** + **added** | `reverseZ` was stored but never drawn: now the canvas, PNG, SVG and PDF exports and hit testing paint in that order; Design panel control | | Grid: `fr` tracks share by fraction; fixed tracks keep their size; hug tracks fit their content | pass | `grid_rules` | -| Grid `fr` tracks as measured in Figma: on a fixed-size axis they share the space left after gaps and padding by their fractions and a fixed-size child bigger than its share overflows into the next track (`minmax(0, 1fr)`); on a Hug axis they size to their content | **fixed** | 300 x 200 frame, rows 1fr / 1fr, children 100 x 150 and 100 x 20: rows 100 / 100, second child at y 100; row gap 10: rows 95 / 95, y 105; frame height Hug: rows 150 / 20, frame 170; columns the same. Measured in Figma 2026-11-11; was the CSS rule from the documentation (2026-10-11) | +| Grid `fr` tracks as measured in Figma: on a fixed-size axis they share the space left after gaps and padding by their fractions and a fixed-size child bigger than its share overflows into the next track (`minmax(0, 1fr)` for fixed-size and hug-size children); a Fill child's own minimum width or height still keeps its track at least that big (not measured, kept from before: two 1fr rows in 200 with a 150 minimum resolve to 150 / 50); on a Hug axis they size to their content | **fixed** | 300 x 200 frame, rows 1fr / 1fr, children 100 x 150 and 100 x 20: rows 100 / 100, second child at y 100; row gap 10: rows 95 / 95, y 105; frame height Hug: rows 150 / 20, frame 170; columns the same. Measured in Figma 2026-11-11; was the CSS rule from the documentation (2026-10-11) | | Grid placement left to right, top to bottom; rows grow; anchors; spans; gaps; padding | pass | `grid_rules` | | Grid children align independently in their cells | **added** | `gridAlignH` / `gridAlignV` (Auto follows the frame), Design panel cell alignment | | A hugging grid with `fr` tracks | silent | the file format calls it invalid; `fr` tracks hug their content | From b8f05d1948635fc9e416533d02ca269be99d27dd Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 09:58:57 -0500 Subject: [PATCH 141/239] M4: a typed number and full stop start a numbered list at that number, as measured in Figma Typing `5. ` at the start of a plain paragraph starts a numbered list whose first item reads 5 (Figma has no start-number field); the next item goes on with 6. Digits only, 1 to 9999; `0. `, `12a. ` and `2)` stay text (not measured), `1)` works as before. The measured restart rows (plain paragraph, bullet item) are no longer marked silent. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/canvas/textedit.rs | 28 +++++++++++++++++++----- crates/engine/src/text_tail_tests.rs | 32 +++++++++++++++++++++++++++- crates/text/src/tail_tests.rs | 12 +++++++++-- docs/target-app-parity.md | 11 +++++----- 4 files changed, 69 insertions(+), 14 deletions(-) diff --git a/crates/engine/src/canvas/textedit.rs b/crates/engine/src/canvas/textedit.rs index 7191f15dd..0f82330af 100644 --- a/crates/engine/src/canvas/textedit.rs +++ b/crates/engine/src/canvas/textedit.rs @@ -284,20 +284,35 @@ fn insert_model(s: &mut Session, text: &str, ime_commit: bool) -> Result. " or "1) " typed at the start of a plain paragraph starts a list + // (the creation characters of Create bulleted and numbered lists). As measured in Figma + // (2026-11-11), a typed "5. " starts the numbered list at 5 (there is no start-number + // field). "0. " and a bracket after a number other than 1 are not measured: plain text. if text == " " && a == b && t.para_list(t.para_of(a)).list == ListStyle::None { let chars: Vec = t.characters.chars().collect(); let start = line_start(&chars, a); let typed: String = chars.get(start..a).unwrap_or(&[]).iter().collect(); + let mut first = 1_u32; let list = match typed.as_str() { "-" | "*" => ListStyle::Bulleted, - "1." | "1)" => ListStyle::Numbered, - _ => ListStyle::None, + "1)" => ListStyle::Numbered, + _ => match typed.strip_suffix('.').filter(|d| !d.is_empty() && d.bytes().all(|b| b.is_ascii_digit())) { + Some(d) => match d.parse::() { + Ok(n) if (1..=MAX_TYPED_LIST_START).contains(&n) => { + first = n; + ListStyle::Numbered + } + _ => ListStyle::None, + }, + None => ListStyle::None, + }, }; if list != ListStyle::None { t.replace_range(start, a, ""); - t.set_para_lists(start, start, |pl| pl.list = list); + t.set_para_lists(start, start, |pl| { + pl.list = list; + pl.start_offset = first - 1; + }); (te.caret, te.anchor) = (start, start); outcome = ImeInsertion::Transformed; return; @@ -310,6 +325,9 @@ fn insert_model(s: &mut Session, text: &str, ime_commit: bool) -> Result **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (a typed number and a full stop at the start of a paragraph starts a numbered list at that number, as measured in Figma 2026-11-11; justified Chinese, Japanese and Korean text, written without spaces, spreads each line's room between its characters so its right edge aligns (#1970); joining the two ends of a path broken open by a deleted point closes it again, so its fill and selection outline follow the new segment and its corner radius instead of a straight line across the gap (#1951); glass's docs say which centre splay bends away from and where a shape gets no core; glass bends towards its core, rounded rectangles in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps, measured against the reference tool; 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 @@ -303,13 +303,11 @@ Hours in this narrative are the builders' estimates; the tables above supersede Backspace by grapheme cluster; double-click and word moves by script run; IME composition with CJK; vertical trim (cap height to baseline). The tail suite (`crates/text/src/tail_tests.rs`, `crates/engine/src/text_tail_tests.rs`): lists per paragraph, nested up to 8 levels with Tab and - Shift+Tab (1. a. i. and • ◦ ▪ per level, counts restarting after plain paragraphs), Enter on an - empty item and Backspace at an item's start stepping out, `- `/`* `/`1. ` starting a list; list + Shift+Tab (1. a. i. and • ◦ ▪ per level, counts restarting after plain paragraphs and bullet items, as measured in Figma), Enter on an + empty item and Backspace at an item's start stepping out, `- `/`* `/`N. ` starting a list (a typed `5. ` starts the numbering at 5, as measured in Figma); list spacing between items; hanging lists and hanging punctuation; decoration style (solid, dotted, wavy), thickness, underline offset, skip ink and colour, with inspect, CSS and the REST import. - *Left:* visual QA; hanging punctuation in right-to-left paragraphs and centred text, list - numbering that continues across a plain paragraph and a list's own start number (documentation - silent); decoration colour in SVG exports (drawn with the text's fill, like run fills); Korean + *Left:* visual QA; hanging punctuation in right-to-left paragraphs and centred text; decoration colour in SVG exports (drawn with the text's fill, like run fills); Korean keeps breaking by syllable and Han runs aren't split by a dictionary (documentation silent). 0.5 h. 3. **Auto layout and sections depth**: *landed:* on-canvas padding/gap handles (also wrapped-row and grid column/row gaps, grid tracks outlined), min/max width/height (UI, Hug/Fill/Fixed, @@ -652,6 +650,7 @@ Carried over from the ROADMAP's "Shipped so far" (2026-10-10). The test count th | Date | Change | Summary | |---|---|---| +| 2026-11-11 | patch | M4: typing a number, a full stop and a space at the start of a plain paragraph starts a numbered list at that number (`5. ` then "x", Enter, "y" reads 5. then 6.), as measured in Figma web on 2026-11-11 (it has no start-number field: the start comes only from the typed number); before, only `1. ` and `1)` started a list. `0. `, `12a. ` and a bracket after a number other than 1 stay text (not measured), and the number is capped at 9999. Also measured: a plain paragraph or a bullet item between numbered items restarts the count at 1, and an indented sub-item does not break the outer count; those rows were pinned as silent. Tests: `text_tail_tests::typed_list_starts`, `typed_number_starts_the_list_there`, `tail_tests` restart rows. Numbers unchanged | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`) draft catalog: 1,975 UI strings, 641 command labels and 31 menu wordings, clean-room from the English source; zh-TW, zh-HK, zh-MO and zh-Hant read it, explicit Hans stays Simplified; Noto Sans CJK TC then Taiwan system faces; no bundled font; native review pending. Numbers unchanged | | 2026-11-04 | patch | M4, #1970: justified Chinese, Japanese and Korean text, written without spaces between words, aligns its right edge: the room on each line but a paragraph's last goes between its characters, each a word of its own as for line breaking ("Justify aligns the first word in each line of text to the left-most edge, and the last to the right-most edge"), wherever a line could break there, so none opens before a full stop or closing bracket, nor after an opening one. Latin text widens its spaces as before; mixed text widens both. A gap is reordered with the line's runs as a space of no width would be, so one beside a Hebrew word in Chinese text, or beside a Chinese word within that Hebrew, opens beside the word, not inside it. `figcraft_text::breaks::justify_between`, beside `break_between`, says where. Evidence: `tests::justified_ideographs_spread_the_room_between_characters` (fails on main). | | 2026-11-04 | patch | M8, #1951 (#1506 again): a path broken open by deleting a point (Delete, not Shift+Delete) is filled closed by a straight line across the gap, as an open path's fill is; joining its two ends again (the pen onto the other end, Connect, ⌘J) left the loop without the new segment, so once the points were rounded the fill and the selection outline ran straight across while the stroke followed the segment and its arcs. Joining now closes the loop through the new segment ("Click to close the path."; "You can use the Paint tool to add fills to any closed regions of a vector network."): `ops::connect` puts it into the loop whose segments are the chain between the ends, at the gap and in the loop's own order, so a hole keeps its winding whichever end was clicked first; a loop listed out of walking order is left as it was. Evidence: `vectoredit::tests::a_rounded_chamfer_made_other_ways_fills_along_its_arcs` (fails on main: the loop kept 4 of 5 segments), `a_rounded_chamfer_cut_in_the_editor_fills_along_its_arcs` (Shift+Delete, with and without a region fill), `doc::tests::a_chamfered_rectangles_rounded_fill_is_cut_at_every_point` (fill, region path and stroke agree for every loop order and segment direction of a chamfered rectangle). | From 4d3fe2aa1ac041df7fa4d785beb8429d66678ed8 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 11 Nov 2026 15:59:59 +0000 Subject: [PATCH 142/239] svg import: cap attributes per element, map span offsets to characters once --- crates/svg/src/import.rs | 35 ++++++++++++++++++++++---- crates/svg/src/import/budget.rs | 2 +- crates/svg/src/import/hostile_tests.rs | 12 +++++++++ crates/svg/src/import/text.rs | 12 ++++++--- crates/svg/src/import/text_tests.rs | 8 ++++++ 5 files changed, 60 insertions(+), 9 deletions(-) diff --git a/crates/svg/src/import.rs b/crates/svg/src/import.rs index 1ac8a78bf..f77b10bfa 100644 --- a/crates/svg/src/import.rs +++ b/crates/svg/src/import.rs @@ -704,13 +704,28 @@ fn simple_hash(b: &[u8]) -> String { /// Deepest element nesting the parser is given: deeper documents would exhaust the stack. const MAX_NESTING: usize = 512; +/// The most attributes one element may have. The XML parser checks each attribute against the +/// earlier ones, so a huge count is quadratic work; real elements have a few dozen at most. +const MAX_ATTRIBUTES: usize = 4096; + /// How deep elements nest in `data`: a scan of its tags (comments, CDATA, declarations and quoted /// attribute values skipped) that stops once past `limit`. pub(crate) fn nesting(data: &[u8], limit: usize) -> usize { + scan(data, limit).0 +} + +/// Whether an element of `data` has more than [`MAX_ATTRIBUTES`] attributes (counted as quoted +/// values, before the parser sees them). +pub(crate) fn too_wide(data: &[u8]) -> bool { + scan(data, usize::MAX).1 > MAX_ATTRIBUTES +} + +/// [`nesting`] and the most attribute values on one element; stops once either is past its limit. +fn scan(data: &[u8], limit: usize) -> (usize, usize) { let find = |from: usize, pat: &[u8]| -> usize { data.get(from..).and_then(|r| r.windows(pat.len()).position(|w| w == pat)).map_or(data.len(), |p| from + p + pat.len()) }; - let (mut depth, mut max, mut i) = (0usize, 0usize, 0usize); + let (mut depth, mut max, mut i, mut widest) = (0usize, 0usize, 0usize, 0usize); while let Some(off) = data.get(i..).and_then(|r| r.iter().position(|b| *b == b'<')) { i += off; let rest = data.get(i..).unwrap_or(&[]); @@ -725,12 +740,15 @@ pub(crate) fn nesting(data: &[u8], limit: usize) -> usize { i = find(i + 2, b">"); } else { // A start tag: to its `>` outside quotes; `/>` closes it. - let (mut quote, mut j, mut closed) = (None, i + 1, false); + let (mut quote, mut j, mut closed, mut attrs) = (None, i + 1, false, 0usize); while let Some(&c) = data.get(j) { match quote { Some(q) if c == q => quote = None, Some(_) => {} - None if c == b'"' || c == b'\'' => quote = Some(c), + None if c == b'"' || c == b'\'' => { + quote = Some(c); + attrs += 1; + } None if c == b'>' => { closed = data.get(j.wrapping_sub(1)) == Some(&b'/'); break; @@ -739,17 +757,21 @@ pub(crate) fn nesting(data: &[u8], limit: usize) -> usize { } j += 1; } + widest = widest.max(attrs); + if widest > MAX_ATTRIBUTES { + return (max, widest); + } if !closed { depth += 1; max = max.max(depth); if max > limit { - return max; + return (max, widest); } } i = j + 1; } } - max + (max, widest) } /// Whether `data` nests elements more than [`MAX_NESTING`] deep: the byte scan first, then the @@ -883,6 +905,9 @@ fn import_within( ) -> Result { // SVGZ is unpacked here, within a budget, so every check below sees the real document. let data = budget::document(data, &limits).map_err(ImportError)?; + if too_wide(&data) { + return Err(ImportError(format!("an element has more than {MAX_ATTRIBUTES} attributes"))); + } if too_deep(&data) { return Err(ImportError(format!("elements nested more than {MAX_NESTING} deep"))); } diff --git a/crates/svg/src/import/budget.rs b/crates/svg/src/import/budget.rs index 7de080af4..c50266dc0 100644 --- a/crates/svg/src/import/budget.rs +++ b/crates/svg/src/import/budget.rs @@ -87,7 +87,7 @@ fn embedded(used: &Used, limits: &Limits, data: &[u8], opts: &Options) -> Option } }; used.bytes.fetch_add(plain.len(), Ordering::Relaxed); - if super::too_deep(&plain) { + if super::too_wide(&plain) || super::too_deep(&plain) { return None; } used.depth.fetch_add(1, Ordering::Relaxed); diff --git a/crates/svg/src/import/hostile_tests.rs b/crates/svg/src/import/hostile_tests.rs index 0af1297d0..16731407c 100644 --- a/crates/svg/src/import/hostile_tests.rs +++ b/crates/svg/src/import/hostile_tests.rs @@ -181,3 +181,15 @@ fn entity_expansion_cannot_bypass_the_nesting_limit() { let err = import_svg(&mut d, data.as_bytes(), p, 0.0, 0.0, "x").err().map(|e| e.to_string()).unwrap_or_default(); assert!(err.contains("nested more than 512 deep"), "{err:?}"); } + +#[test] +fn an_element_with_thousands_of_attributes_is_refused_before_parsing() { + use super::too_wide; + let many = |n: usize| (0..n).map(|i| format!(" a{i}=\"1\"")).collect::(); + assert!(!too_wide(format!("", many(4096)).as_bytes())); + assert!(too_wide(format!("", many(4097)).as_bytes())); + assert!(!too_wide(format!("{}", "".repeat(10_000)).as_bytes()), "per element, not per file"); + let mut d = Document::new("t"); + let p = d.first_page().unwrap(); + assert!(import_svg(&mut d, &svg(&format!("", many(100_000))), p, 0.0, 0.0, "x").is_err()); +} diff --git a/crates/svg/src/import/text.rs b/crates/svg/src/import/text.rs index cee54bbd8..7ed8d018f 100644 --- a/crates/svg/src/import/text.rs +++ b/crates/svg/src/import/text.rs @@ -195,7 +195,7 @@ pub(crate) fn text(cx: &mut Ctx, t: &usvg::Text, parent: NodeId, base: Affine, d let x = chunk.x().map_or(pen_x, f64::from) + d(t.dx()); let y = chunk.y().map_or(pen_y, f64::from) + d(t.dy()); char_at += count; - let ci = |b: usize| text.get(..b).map_or(count, |p| p.chars().count()); + let ci = char_index(text); let spans: Vec<_> = chunk.spans().iter().map(|sp| (ci(sp.start()), ci(sp.end()), sp, span_style(sp, s, fonts))).collect(); if spans.is_empty() { continue; @@ -229,6 +229,13 @@ pub(crate) fn text(cx: &mut Ctx, t: &usvg::Text, parent: NodeId, base: Affine, d } } +/// The characters of `text` before a byte offset (all of them for an offset that is past the end +/// or inside a character), by a search in a table built once: many spans don't rescan the prefix. +fn char_index(text: &str) -> impl Fn(usize) -> usize + '_ { + let starts: Vec = text.char_indices().map(|(i, _)| i).collect(); + move |b| if text.is_char_boundary(b) { starts.partition_point(|s| *s < b) } else { starts.len() } +} + /// The text of `lines` (one per line, stacked at their pitch; `s`: their scale): characters, the /// first span's style and a run per span, fills still to come. fn text_data(lines: &[Line], s: f64) -> TextData { @@ -262,8 +269,7 @@ fn on_path(cx: &mut Ctx, t: &usvg::Text, world: Affine, parent: NodeId) -> bool let Some(len) = figcraft_geom::measure::polylines(&path).and_then(|l| l.first().map(|l| l.length())).filter(|l| *l > 1e-9) else { return false }; let fonts = cx.fonts.get_or_insert_with(Fonts::load); let text = chunk.text(); - let count = text.chars().count(); - let ci = |b: usize| text.get(..b).map_or(count, |p| p.chars().count()); + let ci = char_index(text); let spans: Vec<_> = chunk.spans().iter().map(|sp| (ci(sp.start()), ci(sp.end()), sp, span_style(sp, 1.0, fonts))).collect(); let line = Line { x: 0.0, y: 0.0, anchor: chunk.anchor(), text: text.to_string(), spans }; let mut td = text_data(std::slice::from_ref(&line), 1.0); diff --git a/crates/svg/src/import/text_tests.rs b/crates/svg/src/import/text_tests.rs index f267b2947..94c6ae5b2 100644 --- a/crates/svg/src/import/text_tests.rs +++ b/crates/svg/src/import/text_tests.rs @@ -30,3 +30,11 @@ fn css_system_font_names_keep_their_name_where_the_system_font_is() { assert_eq!(family(&named(&["-apple-system", "BlinkMacSystemFont", "system-ui", "sans-serif"]), &elsewhere), "Inter"); assert_eq!(family(&named(&["-apple-system"]), &elsewhere), "-apple-system", "nothing installed: the first name it gives"); } + +#[test] +fn char_index_counts_the_characters_before_a_byte_offset() { + let t = "aé😀b"; + let ci = super::char_index(t); + assert_eq!([ci(0), ci(1), ci(3), ci(7), ci(8)], [0, 1, 2, 3, 4]); + assert_eq!([ci(2), ci(4), ci(99)], [4, 4, 4], "inside a character or past the end: all of them"); +} From 1935c3eac22b9c4dc62e278ef56fd0f036001c5e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 11 Nov 2026 16:03:10 +0000 Subject: [PATCH 143/239] layout: bound the snap lines a frame's grids generate --- crates/layout/src/depth_tests.rs | 12 ++++++++++++ crates/layout/src/lib.rs | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/crates/layout/src/depth_tests.rs b/crates/layout/src/depth_tests.rs index f8b597a34..b533c7e42 100644 --- a/crates/layout/src/depth_tests.rs +++ b/crates/layout/src/depth_tests.rs @@ -93,3 +93,15 @@ fn deeply_nested_fill_frames_lay_out_without_running_out_of_stack() { assert_eq!(width(&d, chain[DEEP - 1]), 10.0, "past the nesting the layout follows, layers stay"); }); } + +#[test] +fn snap_lines_are_bounded_across_a_frames_grids() { + use figcraft_doc::{Document, GridKind, LayoutGrid, NodeKind}; + let mut d = Document::new("t"); + let p = d.first_page().unwrap(); + let f = d.create(p, NodeKind::Frame, "F", 0.0, 0.0, 4000.0, 4000.0).unwrap(); + d.get_mut(f).unwrap().grids = vec![LayoutGrid { kind: GridKind::Grid, size: 1.0, visible: true, ..LayoutGrid::default() }; 1000]; + let (xs, ys) = crate::grid_snap_lines(&d, f); + assert!(xs.len() + ys.len() < 250_000, "{}", xs.len() + ys.len()); + assert!(xs.len() > 4000 && ys.len() > 4000, "the first grids still give their lines"); +} diff --git a/crates/layout/src/lib.rs b/crates/layout/src/lib.rs index 880c6dad7..04abbc39a 100644 --- a/crates/layout/src/lib.rs +++ b/crates/layout/src/lib.rs @@ -1159,6 +1159,9 @@ pub fn grid_snap_lines(doc: &Document, frame: NodeId) -> (Vec, Vec) { grid_snap_lines_in(doc, frame, doc.world_transform(frame)) } +/// The most snap coordinates a frame's grids give together (a few dozen grids' worth of lines). +const MAX_SNAP_LINES: usize = 200_000; + /// [`grid_snap_lines`] mapped from the frame's coordinates by `xf` (the frame's world transform /// for page lines). pub fn grid_snap_lines_in(doc: &Document, frame: NodeId, xf: Affine) -> (Vec, Vec) { @@ -1166,6 +1169,10 @@ pub fn grid_snap_lines_in(doc: &Document, frame: NodeId, xf: Affine) -> (Vec= MAX_SNAP_LINES { + break; + } for r in grid_lines(g, f.width, f.height) { let a = xf * Point::new(r.x0, r.y0); let b = xf * Point::new(r.x1, r.y1); From 9aaf7114e09268b8893d3ba01a8790e94f674577 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 11 Nov 2026 16:37:35 +0000 Subject: [PATCH 144/239] widgets: bound the decoded pixels of a widget's images, read from their headers --- crates/engine/src/extensions/widgets.rs | 48 +++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/extensions/widgets.rs b/crates/engine/src/extensions/widgets.rs index 13c6088c4..efdd21414 100644 --- a/crates/engine/src/extensions/widgets.rs +++ b/crates/engine/src/extensions/widgets.rs @@ -41,6 +41,8 @@ const FIELD: &str = "figcraft.widget.field"; const HOVER: &str = "figcraft.widget.hover"; /// Images in a widget are at most this many pixels on a side. const MAX_IMAGE_SIDE: u32 = 4096; +/// All images of one widget together are at most this many pixels once decoded (four of the largest). +const MAX_IMAGES_PIXELS: u64 = 4 * 4096 * 4096; /// Whether `n` is a widget's own layer. pub fn is_widget(n: &Node) -> bool { @@ -259,8 +261,9 @@ fn build(s: &mut Session, plugin: &str, w: NodeId, r: &WidgetRender) -> Result<( _ => n.plugin_data.remove(MENU), }; set_hover(n, r.root.hover.as_ref()); + let mut pixels = 0; for c in &r.root.children { - add(doc, w, c, cmd)?; + add(doc, w, c, cmd, &mut pixels)?; } // An SVG brings as many layers as it describes. if doc.subtree(w).len() > MAX_NODES { @@ -271,7 +274,7 @@ fn build(s: &mut Session, plugin: &str, w: NodeId, r: &WidgetRender) -> Result<( } /// Add layer `d` (and what it holds) inside `parent`, locked. -fn add(doc: &mut Document, parent: NodeId, d: &WidgetNode, cmd: &str) -> Result<()> { +fn add(doc: &mut Document, parent: NodeId, d: &WidgetNode, cmd: &str, pixels: &mut u64) -> Result<()> { let (kind, name) = match d.kind { WidgetKind::Frame => (NodeKind::Frame, "Frame"), WidgetKind::Text => (NodeKind::Text(TextData { characters: d.text.clone(), ..TextData::default() }), "Text"), @@ -292,6 +295,16 @@ fn add(doc: &mut Document, parent: NodeId, d: &WidgetNode, cmd: &str) -> Result< if bytes.len() > MAX_IMAGE_BYTES { return Err(bad(cmd, format!("an image is larger than {} KB", MAX_IMAGE_BYTES / 1024))); } + // From the header, before anything is decoded: a small file can hold billions of pixels. + if let Some((w, h)) = figcraft_render::images::dimensions(&bytes) { + if w > MAX_IMAGE_SIDE || h > MAX_IMAGE_SIDE { + return Err(bad(cmd, format!("an image is larger than {MAX_IMAGE_SIDE} pixels on a side"))); + } + *pixels += u64::from(w) * u64::from(h); + if *pixels > MAX_IMAGES_PIXELS { + return Err(bad(cmd, format!("the images are larger than {MAX_IMAGES_PIXELS} pixels together"))); + } + } let (hash, iw, ih) = crate::cmd::create::add_readable_image(doc, bytes).map_err(|e| bad(cmd, e))?; if iw > MAX_IMAGE_SIDE || ih > MAX_IMAGE_SIDE { return Err(bad(cmd, format!("an image is larger than {MAX_IMAGE_SIDE} pixels on a side"))); @@ -302,7 +315,7 @@ fn add(doc: &mut Document, parent: NodeId, d: &WidgetNode, cmd: &str) -> Result< } doc.insert(n, parent, None)?; crate::cmd::props::apply(cmd, doc, id, &props(d, false))?; - d.children.iter().try_for_each(|c| add(doc, id, c, cmd)) + d.children.iter().try_for_each(|c| add(doc, id, c, cmd, pixels)) } /// Add SVG layer `d` inside `parent`: a frame of the picture's own size holding its layers, locked @@ -604,3 +617,32 @@ pub fn specs() -> Vec { spec!("widget.list", "List widgets", "{} → {widgets: [{id, plugin, name, page, state, targets, fields, menu}]}", false, list), ] } + +#[cfg(test)] +mod pixel_budget_tests { + use super::*; + use base64::Engine as _; + + /// A `side` x `side` blank PNG (a few KB however many pixels). + fn png(side: u32) -> String { + let pix = figcraft_render::Pixmap::new(side, side).unwrap(); + base64::engine::general_purpose::STANDARD.encode(figcraft_render::encode_png(&pix).unwrap()) + } + + #[test] + fn images_of_a_widget_share_a_decoded_pixel_budget() { + let mut doc = Document::new("t"); + let page = doc.first_page().unwrap(); + let data = png(4096); + let image = |i: usize| serde_json::from_value::(json!({"type": "image", "name": format!("I{i}"), "data": data})).unwrap(); + let mut pixels = 0; + for i in 0..4 { + add(&mut doc, page, &image(i), "widget.insert", &mut pixels).unwrap(); + } + let err = add(&mut doc, page, &image(4), "widget.insert", &mut pixels).unwrap_err().to_string(); + assert!(err.contains("together"), "{err}"); + // A header past the side limit is refused before it is decoded. + let wide = serde_json::from_value::(json!({"type": "image", "data": png(4097)})).unwrap(); + assert!(add(&mut doc, page, &wide, "widget.insert", &mut 0).unwrap_err().to_string().contains("pixels on a side")); + } +} From a40c76ab68a1d9856a6a79d26e01603643da885d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 11 Nov 2026 16:48:03 +0000 Subject: [PATCH 145/239] collab-net: cut a host's peer names and colours where the guest keeps them --- crates/collab-net/src/client_cap_tests.rs | 14 ++++++++++++++ crates/collab-net/src/join.rs | 21 +++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/crates/collab-net/src/client_cap_tests.rs b/crates/collab-net/src/client_cap_tests.rs index 920d53483..73f181774 100644 --- a/crates/collab-net/src/client_cap_tests.rs +++ b/crates/collab-net/src/client_cap_tests.rs @@ -59,3 +59,17 @@ fn joins_past_the_cap_are_left_out_until_someone_leaves() { send(joined(over)); assert!(matches!(inbox.drain().as_slice(), [Event::PeerLeft(7), Event::PeerJoined(p)] if p.client_id == over)); } + +#[test] +fn a_hosts_long_names_and_colours_are_cut_where_they_are_kept() { + let inbox = inbox(); + let cfg = GuestConfig::new(Invite::new("127.0.0.1:47900", "0123456789abcdef", "AbCdEfGhIjKlMnOpQrStUv"), "Ada".into()); + let resume = Mutex::new(None); + let mut seen = Seen::default(); + let long = "x".repeat(100_000); + take(ServerMsg::PeerJoined(Peer { client_id: 1, name: long.clone(), color: long }), &cfg, &inbox, &mut seen, &resume, &|| {}); + match inbox.drain().as_slice() { + [Event::PeerJoined(p)] => assert!(p.name.chars().count() <= 256 && p.color.chars().count() <= 32), + other => panic!("{other:?}"), + } +} diff --git a/crates/collab-net/src/join.rs b/crates/collab-net/src/join.rs index 8aacff711..5982ed6e8 100644 --- a/crates/collab-net/src/join.rs +++ b/crates/collab-net/src/join.rs @@ -226,6 +226,19 @@ pub(crate) struct Seen { peers: Vec, } +/// `p` with its name and colour cut to what the UI shows: the host is untrusted, and the roster is +/// copied whenever someone's identity is updated. +fn bounded(mut p: Peer) -> Peer { + p.name = p.name.chars().take(MAX_PEER_NAME).collect(); + p.color = p.color.chars().take(MAX_COLOR).collect(); + p +} + +/// The most characters of a colour (`#rrggbb` and a few spellings more) kept for someone. +const MAX_COLOR: usize = 32; +/// The most characters of a name kept for someone. +const MAX_PEER_NAME: usize = 256; + /// What taking in one message from the host means for the connection. pub(crate) enum Taken { Continue, @@ -251,7 +264,7 @@ pub(crate) fn take(mut m: ServerMsg, cfg: &GuestConfig, inbox: &Inbox, seen: &mu *r = Some(Resume { session, client_id, seq, secret }); } // The sync client opens the document (and fills in its name and pages). - let peers: Vec = peers.iter().take(MAX_PEERS).cloned().collect(); + let peers: Vec = peers.iter().take(MAX_PEERS).cloned().map(bounded).collect(); let inv = &cfg.invite; let info = SessionInfo { role: Role::Guest, @@ -274,14 +287,14 @@ pub(crate) fn take(mut m: ServerMsg, cfg: &GuestConfig, inbox: &Inbox, seen: &mu inbox.push(Event::Sync(m)); return Taken::Welcomed; } - ServerMsg::PeerJoined(p) => match seen.info.as_mut() { + ServerMsg::PeerJoined(p) => match (seen.info.as_mut(), bounded(p)) { // The host tells you how you are shown. - Some(info) if p.client_id == info.me => { + (Some(info), p) if p.client_id == info.me => { info.name = p.name; info.color = p.color; inbox.push(Event::Welcome { info: info.clone(), peers: seen.peers.clone() }); } - _ => { + (_, p) => { match seen.peers.iter().position(|q| q.client_id == p.client_id) { Some(i) => { seen.peers.remove(i); From 57006fa74dfd26b68cf37800db142fb29b2e759f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 11 Nov 2026 09:10:34 -0800 Subject: [PATCH 146/239] Updates: take craft-update from craft-libs main at 6e03f65bf --- Cargo.lock | 3 ++- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8ca91ac04..73d4d60fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1134,7 +1134,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=1b34eba41e62138fc2438d2734523b302840b45d#1b34eba41e62138fc2438d2734523b302840b45d" +source = "git+https://github.com/storytold/craft-libs?rev=6e03f65bf45181db77ba6229716e6624db9eb25b#6e03f65bf45181db77ba6229716e6624db9eb25b" dependencies = [ "chrono", "dunce", @@ -1144,6 +1144,7 @@ dependencies = [ "image", "log", "plist", + "rustix 1.1.5", "semver", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index af0dcaa8b..21833c3ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-l # pull a second egui family version). craft-window = { git = "https://github.com/storytold/craft-libs", rev = "e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" } # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "1b34eba41e62138fc2438d2734523b302840b45d", features = ["egui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "6e03f65bf45181db77ba6229716e6624db9eb25b", features = ["egui"] } # The suite's font store: exact lookup of a missing font in the pinned Google Fonts and Noto # indexes, and checksum-verified installs into the one folder every Craft app reads (craft-libs). craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" } From fa4883ad3ae3a459fe90b3162af50e38a696844c Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 12:38:33 -0500 Subject: [PATCH 147/239] M8: UI parity doc: the main menu row after the merge with #2220 The merge spliced this branch's submenu sentence into the middle of main's row. The row is main's again, with the measured first-frame sentence in place of the old 0.15 s one and #2220's overflow sentence kept. Co-Authored-By: Claude Opus 5.5 --- docs/ui-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 7a7f78a39..9aeed7924 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -25,7 +25,7 @@ interaction feel not yet compared. | 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 | | Context menus | done | canvas and layers; submenus as in the main menu below, and a right-click in a new spot starts a fresh menu (Select layer closed); Shift+F10 or the keyboard's Menu key opens them from the keyboard (at the focused layer row or below the canvas selection) and the menu takes the keyboard (`layers_keyboard_tests`) | | Home screen: Recents, Online and Templates | done (ours) | The sidebar switches between the three (`ui.set {homeSection}`). Online: your online files (see the collaboration checklist). Recents: new file, open, join with a code, open files, recent files (cards with the picture each file carries on its page colour, the file's icon, name and "Edited ... ago" or "File not found", full path on hover; or a Name, Last modified and Created table with sortable headers; sorted by name, creation or last change either way; grid or list and the sort kept in the preferences, `ui.set {homeRecentsView, homeRecentsSort, homeRecentsOrder}`; a click selects, a double-click or Enter opens, arrow keys move the selection; Open, Show in folder and Remove from recents on right-click), a Getting started card (six tips with their shortcuts from the keymap; its close button is remembered in the preferences and Help ▸ Getting started brings it back) and, while there are no recent files, four templates to start from. Templates: the eight starter templates as cards (thumbnail rendered from the document, cached per theme; name, description, kind and size), a search field and a kind filter, an empty state; Tab reaches every card and Enter opens it; cards and tabs are named for screen readers. A first run opens here. No Community files or drafts folder | -| Main menu from the logo | done | generated from `catalog.rs`; popups sized to content. Submenus open after 0.15 s on their row (a click or the keyboard opens one at once) and close at once when another row is hovered; while the pointer heads for an open submenu inside the triangle to its near edge, the rows it crosses don't take over, and resting 0.3 s on one hands over; closing the menu, however it closes, clears which submenus were open, so it reopens with none (`menu_aim_tests`, 10 tests; timings tuned by feel, not measured against Figma). A menu or submenu that would run past the window's bottom moves up to fit (never above the top), and one taller than the window scrolls with the wheel, the keyboard's focus kept in view; the context menu's submenus share this (#2217, `menu_overflow_tests`on the first frame their row is hovered (a click or the keyboard opens one at once; Figma's main menu measured 2026-11-07 with synthetic pointer events: median 11 ms to open, 13 ms to switch rows) and close at once when another row is hovered; while the pointer heads for an open submenu inside the triangle to its near edge, the rows it crosses don't take over, and resting 0.3 s on one hands over; closing the menu, however it closes, clears which submenus were open, so it reopens with none (`menu_aim_tests`, 10 tests; the open delay is measured; the safe triangle and its 0.3 s rest are still tuned by feel, and Figma's main menu showed no triangle at all in that measurement, so the aim is kept pending the maintainer's decision). Menu and palette items that need a value ask for it first: Create link, Offset path and Move to page in a dialog of the shared controls, the language, user name, server and nudge items in Preferences, Open recent on the home screen's Recents; File ▸ Rename edits the file name in place | +| Main menu from the logo | done | generated from `catalog.rs`; popups sized to content. Submenus open on the first frame their row is hovered (a click or the keyboard opens one at once; Figma's main menu measured 2026-11-07 with synthetic pointer events: median 11 ms to open, 13 ms to switch rows) and close at once when another row is hovered; while the pointer heads for an open submenu inside the triangle to its near edge, the rows it crosses don't take over, and resting 0.3 s on one hands over; closing the menu, however it closes, clears which submenus were open, so it reopens with none (`menu_aim_tests`, 10 tests; the open delay is measured; the safe triangle and its 0.3 s rest are still tuned by feel, and Figma's main menu showed no triangle at all in that measurement, so the aim is kept pending the maintainer's decision). A menu or submenu that would run past the window's bottom moves up to fit (never above the top), and one taller than the window scrolls with the wheel, the keyboard's focus kept in view; the context menu's submenus share this (#2217, `menu_overflow_tests`). Menu and palette items that need a value ask for it first: Create link, Offset path and Move to page in a dialog of the shared controls, the language, user name, server and nudge items in Preferences, Open recent on the home screen's Recents; File ▸ Rename edits the file name in place | | Keyboard shortcuts panel | done | closes when the home screen shows (#548); docked, tabbed by group like the documentation, searchable, per-platform keycaps; held keys, gestures and presentation keys listed beside the bindings; a label too long for its column ends with "…" and shows in full on hover | | Several windows | partial | File ▸ New window, Open in new window on a tab, a tab dragged off the strip; screen-reader tree in the main window only; positions not restored | | Multiplayer avatars, Share button | missing | waits for multiplayer | From 9f51517f235d873fec731c50709baeddc5f5572e Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 12:39:56 -0500 Subject: [PATCH 148/239] M8: view.pan's parameter text and the MCP guide give the measured steps 64 screen pixels a step, five times as far with big (320), as the code and the measurement have it; they still said ten times and 20 / 200. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/view.rs | 2 +- docs/mcp.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/view.rs b/crates/engine/src/cmd/view.rs index 5717650af..5ef6aaba1 100644 --- a/crates/engine/src/cmd/view.rs +++ b/crates/engine/src/cmd/view.rs @@ -302,7 +302,7 @@ pub fn specs() -> Vec { spec!("view.multiplayerCursors", "Multiplayer cursors", "{on?} others' cursors in a live session", false, |s, p| { toggle(s, p, "view.multiplayerCursors") }), - spec!("view.pan", "Pan the view", "{dx, dy (arrow-key steps, e.g. 1 or -1), big? (ten times as far, like Shift)}", false, pan), + spec!("view.pan", "Pan the view", "{dx, dy (arrow-key steps, e.g. 1 or -1), big? (five times as far, like Shift)}", false, pan), spec!("view.outlines", "Outlines", "{on?}", false, |s, p| toggle(s, p, "view.outlines")), spec!("view.outlinesSelection", "Outlines for selection", "{on?} outline mode for the selected layers only", false, |s, p| { toggle(s, p, "view.outlinesSelection") diff --git a/docs/mcp.md b/docs/mcp.md index 04b37e1f0..b72e71180 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -622,7 +622,7 @@ on; `key` resolves keys the way the canvas does. Commands behind keys: `board.nextSticky` (`Shift+Cmd/Ctrl+Enter`, also while typing in a sticky). Keys no design-file shortcut uses; on a design file they refuse. - `view.pan {dx, dy, big?}`: the arrow keys with nothing selected (`key ArrowRight` does the same) - pan the view by 20 screen pixels a step, 200 with `big` (Shift). + pan the view by 64 screen pixels a step, 320 with `big` (Shift). - `view.multiplayerCursors {on?}` (`Alt+Cmd+\`): show or hide others' cursors in a live session. - `view.outlinesHiddenLayers {on?}` and `view.outlinesObjectBounds {on?}`: what outline mode (`view.outlines`, `view.outlinesSelection`) draws besides the shapes: hidden layers, and the box From 2f8dd85f4284c9b1ba0007d401d76200551c209e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 11 Nov 2026 17:43:55 +0000 Subject: [PATCH 149/239] load: share one layer allowance across Penpot raw SVGs, sum font-run coverage once --- crates/engine/src/cmd/file/load.rs | 111 +++++++++++++++++++++++------ 1 file changed, 91 insertions(+), 20 deletions(-) diff --git a/crates/engine/src/cmd/file/load.rs b/crates/engine/src/cmd/file/load.rs index 3e917d5dd..77dd68198 100644 --- a/crates/engine/src/cmd/file/load.rs +++ b/crates/engine/src/cmd/file/load.rs @@ -399,11 +399,19 @@ pub(crate) fn load_fig(bytes: &[u8], name: &str) -> Option) { + expand_penpot_raw_svgs_within(doc, notes, MAX_PENPOT_SVG_LAYERS); +} + +/// [`expand_penpot_raw_svgs`] with at most `room` layers made in all. +fn expand_penpot_raw_svgs_within(doc: &mut Document, notes: &mut Vec, mut room: usize) { let layers = doc .nodes() .filter_map(|node| { @@ -413,12 +421,25 @@ fn expand_penpot_raw_svgs(doc: &mut Document, notes: &mut Vec) { }) .collect::>(); let mut ok_count = 0usize; + // The SVG importer caps its own layers per file; `room` is the cap over all of a file's placeholders. for (id, name, width, height, xml, empty) in layers { + if room == 0 { + if let Some(n) = doc.node_mut(id) { + n.plugin_data.insert("penpot.svgRawStatus".into(), "not-expanded".into()); + } + if notes.len() < 100 { + notes.push(format!("Penpot SVG '{name}': not converted, the file's SVG layers are over the limit; the original markup is preserved")); + } + continue; + } if !empty { notes.push(format!("Penpot SVG '{name}': has separate child layers; the original tree was preserved to prevent duplicate rendering")); continue; } - match figcraft_svg::import_svg_with_notes(doc, xml.as_bytes(), id, 0.0, 0.0, &name) { + let before = doc.node_count(); + let imported = figcraft_svg::import_svg_with_notes(doc, xml.as_bytes(), id, 0.0, 0.0, &name); + room = room.saturating_sub(doc.node_count().saturating_sub(before)); + match imported { Ok(imported) => { // An SVG can be syntactically valid yet contain no supported drawable // elements. Do not claim success or leave an empty extra frame. @@ -470,6 +491,28 @@ fn expand_penpot_raw_svgs(doc: &mut Document, notes: &mut Vec) { } } +/// Whether some of the first `len` characters are in none of `runs`. Where runs start and stop +/// covering is summed once, so runs overlapping any number of times cost no more than their count. +fn has_uncovered(len: usize, runs: &[figcraft_doc::StyleRun]) -> bool { + let mut change = vec![0i64; len + 1]; + for run in runs { + let (start, end) = (run.start.min(len), run.end.min(len)); + if start < end { + if let Some(c) = change.get_mut(start) { + *c += 1; + } + if let Some(c) = change.get_mut(end) { + *c -= 1; + } + } + } + let mut open = 0i64; + change.iter().take(len).any(|c| { + open += c; + open <= 0 + }) +} + /// Non-destructive font diagnostic for the action palette, CLI and control API. /// Includes styled runs, not just the default typeface of each text layer. pub(super) fn font_report(doc: &Document) -> Value { @@ -485,21 +528,15 @@ fn font_report_with_families(doc: &Document, installed: &[String]) -> Value { if text.characters.is_empty() { continue; } - let mut covered = vec![false; text.characters.chars().count().min(100_000)]; + let len = text.characters.chars().count().min(100_000); let mut used = BTreeSet::new(); for run in &text.runs { - let start = run.start.min(covered.len()); - let end = run.end.min(covered.len()); - if start < end { - if !run.style.font_family.trim().is_empty() { - used.insert(run.style.font_family.clone()); - } - for entry in covered.iter_mut().take(end).skip(start) { - *entry = true; - } + if run.start.min(len) < run.end.min(len) && !run.style.font_family.trim().is_empty() { + used.insert(run.style.font_family.clone()); } } - if covered.iter().any(|entry| !entry) { + let uncovered = has_uncovered(len, &text.runs); + if uncovered { used.insert(text.style.font_family.clone()); } for family in used { @@ -599,19 +636,14 @@ fn missing_penpot_font_warnings(doc: &Document, families: &[String]) -> Vec"#; + let ids: Vec = (0..2) + .map(|i| { + let id = doc.create(page, NodeKind::Frame, &format!("S{i}"), 0.0, 0.0, 10.0, 10.0).unwrap(); + let layer = doc.node_mut(id).unwrap(); + layer.plugin_data.insert("penpot.svgRawXml".into(), svg.into()); + layer.plugin_data.insert("penpot.svgRawStatus".into(), "pending".into()); + id + }) + .collect(); + let mut warnings = Vec::new(); + expand_penpot_raw_svgs_within(&mut doc, &mut warnings, 1); + let status = |i: usize| doc.node(ids[i]).unwrap().plugin_data.get("penpot.svgRawStatus").cloned(); + assert_eq!(status(0).as_deref(), Some("expanded"), "the first uses the allowance"); + assert_eq!(status(1).as_deref(), Some("not-expanded")); + assert!(doc.node(ids[1]).unwrap().children.is_empty()); + assert!(warnings.iter().any(|w| w.contains("over the limit")), "{warnings:?}"); + } + + #[test] + fn many_overlapping_style_runs_are_summed_once() { + use figcraft_doc::StyleRun; + let mut doc = Document::new("Runs"); + let page = doc.first_page().unwrap(); + let mut t = TextData::new("x".repeat(100_000)); + t.style.font_family = "Unused Base".into(); + let mut run = t.style.clone(); + run.font_family = "Run Font".into(); + t.runs = (0..50_000).map(|_| StyleRun { start: 0, end: 100_000, style: run.clone() }).collect(); + doc.create(page, NodeKind::Text(t), "Long", 0.0, 0.0, 100.0, 30.0).unwrap(); + let report = font_report_with_families(&doc, &[]); + assert_eq!(report["fonts"].as_array().map(Vec::len), Some(1), "{report}"); + assert_eq!(report["fonts"][0]["family"], "Run Font"); + } + #[test] fn expands_inline_svg_into_editable_shapes_without_discarding_source() { let mut doc = Document::new("SVG fixture"); From a8e34e75a8e15b27e5654f417081f0b546d5b76b Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 11 Nov 2026 18:38:59 +0000 Subject: [PATCH 150/239] components: work out each main's layer paths once while linking imported instances --- crates/engine/src/assets/components.rs | 2 +- crates/engine/src/assets/components/rebase.rs | 22 +++++++++++++++++-- crates/engine/src/cmd/file/load.rs | 4 +++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/assets/components.rs b/crates/engine/src/assets/components.rs index 7ddb22427..cb273fc51 100644 --- a/crates/engine/src/assets/components.rs +++ b/crates/engine/src/assets/components.rs @@ -60,7 +60,7 @@ pub use patch::sync_after_edit; pub(crate) use patch::{FULL_REBUILD, PATCHED}; #[cfg(test)] use rebase::RebaseSources; -pub use rebase::rebase_instance; +pub use rebase::{MainPaths, rebase_instance, rebase_instance_with}; pub use sync::keep_text_overrides; pub use variants::{default_variant, exposed_copies, find_variant, mirror_issues, variant_conflicts, variant_name, variant_options, variant_props}; diff --git a/crates/engine/src/assets/components/rebase.rs b/crates/engine/src/assets/components/rebase.rs index ea9cb6f3e..aa782cb20 100644 --- a/crates/engine/src/assets/components/rebase.rs +++ b/crates/engine/src/assets/components/rebase.rs @@ -165,10 +165,28 @@ impl<'a> RebaseSources<'a> { /// values (after detaching an outer instance, restoring a main, or copying a nested instance out): /// the look is kept exactly. Values a component property sets aren't overrides. pub fn rebase_instance(doc: &mut Document, inst: NodeId) { + rebase_instance_with(doc, inst, &mut MainPaths::new()); +} + +/// The layers of mains by path, kept across several [`rebase_instance_with`] calls. Rebasing only +/// writes instances' `source` and `overrides`, never a main's layers or names, so a main's paths +/// stay right for as long as the caller changes nothing else. +pub type MainPaths = BTreeMap>>; + +/// [`rebase_instance`], taking each main's path map from `mains` (and adding it there). +pub fn rebase_instance_with(doc: &mut Document, inst: NodeId, mains: &mut MainPaths) { let Some(NodeKind::Instance { component, .. }) = doc.node(inst).map(|n| n.kind.clone()) else { return }; let mine = path_map(doc, inst, true); - let theirs: BTreeMap = - if doc.contains(component) { path_map(doc, component, false).into_iter().map(|(k, v)| (v, k)).collect() } else { BTreeMap::new() }; + let theirs = mains + .entry(component) + .or_insert_with(|| { + std::rc::Rc::new(if doc.contains(component) { + path_map(doc, component, false).into_iter().map(|(k, v)| (v, k)).collect() + } else { + BTreeMap::new() + }) + }) + .clone(); let value_groups = |a: &Node, b: &Node| -> Vec { diff_groups(a, b).into_iter().filter(|g| !matches!(*g, "size" | "position")).map(str::to_string).collect() }; diff --git a/crates/engine/src/cmd/file/load.rs b/crates/engine/src/cmd/file/load.rs index 3e917d5dd..d03921653 100644 --- a/crates/engine/src/cmd/file/load.rs +++ b/crates/engine/src/cmd/file/load.rs @@ -652,8 +652,10 @@ fn link_instances(doc: &mut Document) { let mut insts: Vec<(usize, NodeId)> = doc.nodes().filter(|n| matches!(n.kind, NodeKind::Instance { .. })).map(|n| (doc.ancestors(n.id).len(), n.id)).collect(); insts.sort_by_key(|a| std::cmp::Reverse(a.0)); + // Rebasing leaves the mains alone, so each main's layer paths are worked out once. + let mut mains = crate::components::MainPaths::new(); for (_, i) in insts { - crate::components::rebase_instance(doc, i); + crate::components::rebase_instance_with(doc, i, &mut mains); } } From 70ed6c1636b1560f8f17d8471f1c2661d06130b7 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 11 Nov 2026 18:53:53 +0000 Subject: [PATCH 151/239] svg import: budget attribute work over the whole file and DTD, map span offsets in one pass --- crates/svg/src/import.rs | 42 ++++++++++++++++++++------ crates/svg/src/import/hostile_tests.rs | 12 ++++++++ crates/svg/src/import/text.rs | 33 +++++++++++++++----- crates/svg/src/import/text_tests.rs | 2 +- 4 files changed, 71 insertions(+), 18 deletions(-) diff --git a/crates/svg/src/import.rs b/crates/svg/src/import.rs index f77b10bfa..fbdb9b2c1 100644 --- a/crates/svg/src/import.rs +++ b/crates/svg/src/import.rs @@ -714,18 +714,26 @@ pub(crate) fn nesting(data: &[u8], limit: usize) -> usize { scan(data, limit).0 } -/// Whether an element of `data` has more than [`MAX_ATTRIBUTES`] attributes (counted as quoted -/// values, before the parser sees them). +/// The most the parser's duplicate-attribute checks may cost over a whole document, as the sum of +/// each element's attribute count squared (a real file with 100,000 elements of 20 attributes is +/// 40 million). +const MAX_ATTRIBUTE_WORK: usize = 1 << 28; + +/// Whether an element of `data` has more than [`MAX_ATTRIBUTES`] attributes, or all of them cost +/// more than [`MAX_ATTRIBUTE_WORK`] (counted as quoted values, before the parser sees them; the +/// declarations of a DTD count as one element, as entities can hold elements). pub(crate) fn too_wide(data: &[u8]) -> bool { - scan(data, usize::MAX).1 > MAX_ATTRIBUTES + let (_, widest, work) = scan(data, usize::MAX); + widest > MAX_ATTRIBUTES || work > MAX_ATTRIBUTE_WORK } -/// [`nesting`] and the most attribute values on one element; stops once either is past its limit. -fn scan(data: &[u8], limit: usize) -> (usize, usize) { +/// [`nesting`], the most attribute values on one element and the attribute work (see +/// [`MAX_ATTRIBUTE_WORK`]); stops once any is past its limit. +fn scan(data: &[u8], limit: usize) -> (usize, usize, usize) { let find = |from: usize, pat: &[u8]| -> usize { data.get(from..).and_then(|r| r.windows(pat.len()).position(|w| w == pat)).map_or(data.len(), |p| from + p + pat.len()) }; - let (mut depth, mut max, mut i, mut widest) = (0usize, 0usize, 0usize, 0usize); + let (mut depth, mut max, mut i, mut widest, mut work) = (0usize, 0usize, 0usize, 0usize, 0usize); while let Some(off) = data.get(i..).and_then(|r| r.iter().position(|b| *b == b'<')) { i += off; let rest = data.get(i..).unwrap_or(&[]); @@ -733,6 +741,19 @@ fn scan(data: &[u8], limit: usize) -> (usize, usize) { i = find(i + 4, b"-->"); } else if rest.starts_with(b""); + } else if rest.starts_with(b"` closing its subset (the first `>` when it has none). + let end = match (rest.iter().position(|b| *b == b'['), rest.iter().position(|b| *b == b'>')) { + (Some(o), Some(g)) if o < g => find(i, b"]>"), + _ => find(i, b">"), + }; + let quotes = data.get(i..end).unwrap_or(&[]).iter().filter(|b| matches!(**b, b'"' | b'\'')).count(); + widest = widest.max(quotes / 2); + work = work.saturating_add((quotes / 2).saturating_mul(quotes / 2)); + if widest > MAX_ATTRIBUTES || work > MAX_ATTRIBUTE_WORK { + return (max, widest, work); + } + i = end; } else if rest.starts_with(b""); } else if rest.starts_with(b" (usize, usize) { j += 1; } widest = widest.max(attrs); - if widest > MAX_ATTRIBUTES { - return (max, widest); + work = work.saturating_add(attrs * attrs); + if widest > MAX_ATTRIBUTES || work > MAX_ATTRIBUTE_WORK { + return (max, widest, work); } if !closed { depth += 1; max = max.max(depth); if max > limit { - return (max, widest); + return (max, widest, work); } } i = j + 1; } } - (max, widest) + (max, widest, work) } /// Whether `data` nests elements more than [`MAX_NESTING`] deep: the byte scan first, then the diff --git a/crates/svg/src/import/hostile_tests.rs b/crates/svg/src/import/hostile_tests.rs index 16731407c..daeaa085a 100644 --- a/crates/svg/src/import/hostile_tests.rs +++ b/crates/svg/src/import/hostile_tests.rs @@ -193,3 +193,15 @@ fn an_element_with_thousands_of_attributes_is_refused_before_parsing() { let p = d.first_page().unwrap(); assert!(import_svg(&mut d, &svg(&format!("", many(100_000))), p, 0.0, 0.0, "x").is_err()); } + +#[test] +fn attribute_work_is_bounded_over_the_whole_document_and_its_dtd() { + use super::too_wide; + let many = |n: usize| (0..n).map(|i| format!(" a{i}=\"1\"")).collect::(); + let tag = format!("", many(4000)); + assert!(!too_wide(format!("{}", tag.repeat(10)).as_bytes())); + assert!(too_wide(format!("{}", tag.repeat(40)).as_bytes()), "each element is within the limit, all together are not"); + let dtd = format!("'>]>&e;", many(5000)); + assert!(too_wide(dtd.as_bytes()), "entities can hold elements"); + assert!(!too_wide(b"]>")); +} diff --git a/crates/svg/src/import/text.rs b/crates/svg/src/import/text.rs index 7ed8d018f..6f557fb13 100644 --- a/crates/svg/src/import/text.rs +++ b/crates/svg/src/import/text.rs @@ -195,7 +195,7 @@ pub(crate) fn text(cx: &mut Ctx, t: &usvg::Text, parent: NodeId, base: Affine, d let x = chunk.x().map_or(pen_x, f64::from) + d(t.dx()); let y = chunk.y().map_or(pen_y, f64::from) + d(t.dy()); char_at += count; - let ci = char_index(text); + let ci = char_index(text, chunk.spans().iter().flat_map(|sp| [sp.start(), sp.end()])); let spans: Vec<_> = chunk.spans().iter().map(|sp| (ci(sp.start()), ci(sp.end()), sp, span_style(sp, s, fonts))).collect(); if spans.is_empty() { continue; @@ -229,11 +229,30 @@ pub(crate) fn text(cx: &mut Ctx, t: &usvg::Text, parent: NodeId, base: Affine, d } } -/// The characters of `text` before a byte offset (all of them for an offset that is past the end -/// or inside a character), by a search in a table built once: many spans don't rescan the prefix. -fn char_index(text: &str) -> impl Fn(usize) -> usize + '_ { - let starts: Vec = text.char_indices().map(|(i, _)| i).collect(); - move |b| if text.is_char_boundary(b) { starts.partition_point(|s| *s < b) } else { starts.len() } +/// The characters of `text` before each of the byte `offsets` (all of them for an offset that is +/// past the end or inside a character): one pass over the text, whatever the number of spans. +fn char_index(text: &str, offsets: impl IntoIterator) -> impl Fn(usize) -> usize { + let mut want: Vec = offsets.into_iter().collect(); + want.sort_unstable(); + want.dedup(); + let mut found: Vec<(usize, usize)> = Vec::with_capacity(want.len()); + let mut wanted = want.into_iter().peekable(); + let mut count = 0; + for (i, _) in text.char_indices() { + while let Some(&o) = wanted.peek() { + match o.cmp(&i) { + std::cmp::Ordering::Equal => found.push((o, count)), + std::cmp::Ordering::Greater => break, + std::cmp::Ordering::Less => {} + } + wanted.next(); + } + count += 1; + } + if wanted.any(|o| o == text.len()) { + found.push((text.len(), count)); + } + move |b| found.binary_search_by_key(&b, |f| f.0).ok().and_then(|k| found.get(k)).map_or(count, |f| f.1) } /// The text of `lines` (one per line, stacked at their pitch; `s`: their scale): characters, the @@ -269,7 +288,7 @@ fn on_path(cx: &mut Ctx, t: &usvg::Text, world: Affine, parent: NodeId) -> bool let Some(len) = figcraft_geom::measure::polylines(&path).and_then(|l| l.first().map(|l| l.length())).filter(|l| *l > 1e-9) else { return false }; let fonts = cx.fonts.get_or_insert_with(Fonts::load); let text = chunk.text(); - let ci = char_index(text); + let ci = char_index(text, chunk.spans().iter().flat_map(|sp| [sp.start(), sp.end()])); let spans: Vec<_> = chunk.spans().iter().map(|sp| (ci(sp.start()), ci(sp.end()), sp, span_style(sp, 1.0, fonts))).collect(); let line = Line { x: 0.0, y: 0.0, anchor: chunk.anchor(), text: text.to_string(), spans }; let mut td = text_data(std::slice::from_ref(&line), 1.0); diff --git a/crates/svg/src/import/text_tests.rs b/crates/svg/src/import/text_tests.rs index 94c6ae5b2..c43bd7f9e 100644 --- a/crates/svg/src/import/text_tests.rs +++ b/crates/svg/src/import/text_tests.rs @@ -34,7 +34,7 @@ fn css_system_font_names_keep_their_name_where_the_system_font_is() { #[test] fn char_index_counts_the_characters_before_a_byte_offset() { let t = "aé😀b"; - let ci = super::char_index(t); + let ci = super::char_index(t, [0, 1, 3, 7, 8, 2, 4, 99]); assert_eq!([ci(0), ci(1), ci(3), ci(7), ci(8)], [0, 1, 2, 3, 4]); assert_eq!([ci(2), ci(4), ci(99)], [4, 4, 4], "inside a character or past the end: all of them"); } From 9d48625995fc63c99e0164e424f78bcea3ac8a47 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 11 Nov 2026 18:57:25 +0000 Subject: [PATCH 152/239] layout: leave out a grid that would pass the snap budget --- crates/layout/src/depth_tests.rs | 2 +- crates/layout/src/lib.rs | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/layout/src/depth_tests.rs b/crates/layout/src/depth_tests.rs index b533c7e42..20e022817 100644 --- a/crates/layout/src/depth_tests.rs +++ b/crates/layout/src/depth_tests.rs @@ -102,6 +102,6 @@ fn snap_lines_are_bounded_across_a_frames_grids() { let f = d.create(p, NodeKind::Frame, "F", 0.0, 0.0, 4000.0, 4000.0).unwrap(); d.get_mut(f).unwrap().grids = vec![LayoutGrid { kind: GridKind::Grid, size: 1.0, visible: true, ..LayoutGrid::default() }; 1000]; let (xs, ys) = crate::grid_snap_lines(&d, f); - assert!(xs.len() + ys.len() < 250_000, "{}", xs.len() + ys.len()); + assert!(xs.len() + ys.len() <= 200_000, "{}", xs.len() + ys.len()); assert!(xs.len() > 4000 && ys.len() > 4000, "the first grids still give their lines"); } diff --git a/crates/layout/src/lib.rs b/crates/layout/src/lib.rs index 04abbc39a..b3d8e27f0 100644 --- a/crates/layout/src/lib.rs +++ b/crates/layout/src/lib.rs @@ -1169,11 +1169,13 @@ pub fn grid_snap_lines_in(doc: &Document, frame: NodeId, xf: Affine) -> (Vec= MAX_SNAP_LINES { + // A frame-wide budget: each grid adds up to ~17,000 lines, and a file can hold any number of grids; + // a grid that would pass it is left out whole. + let lines = grid_lines(g, f.width, f.height); + if xs.len() + ys.len() + 2 * lines.len() > MAX_SNAP_LINES { break; } - for r in grid_lines(g, f.width, f.height) { + for r in lines { let a = xf * Point::new(r.x0, r.y0); let b = xf * Point::new(r.x1, r.y1); match g.kind { From 2cfd2a3531e7df2dae4d9821b1b733756b659eb0 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 11 Nov 2026 19:16:24 +0000 Subject: [PATCH 153/239] collab-net: hand the sync client the bounded roster; assert the kept prefixes --- crates/collab-net/src/client_cap_tests.rs | 26 +++++++++++++++++++++-- crates/collab-net/src/join.rs | 4 ++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/crates/collab-net/src/client_cap_tests.rs b/crates/collab-net/src/client_cap_tests.rs index 73f181774..5af7c7a2f 100644 --- a/crates/collab-net/src/client_cap_tests.rs +++ b/crates/collab-net/src/client_cap_tests.rs @@ -4,7 +4,7 @@ use std::sync::{Arc, Mutex}; -use figcraft_collab::message::{Peer, Presence, ServerMsg}; +use figcraft_collab::message::{Access, CatchUp, Peer, Presence, Processed, ServerMsg}; use figcraft_engine::live::{Event, MAX_PEERS}; use crate::guest::GuestConfig; @@ -69,7 +69,29 @@ fn a_hosts_long_names_and_colours_are_cut_where_they_are_kept() { let long = "x".repeat(100_000); take(ServerMsg::PeerJoined(Peer { client_id: 1, name: long.clone(), color: long }), &cfg, &inbox, &mut seen, &resume, &|| {}); match inbox.drain().as_slice() { - [Event::PeerJoined(p)] => assert!(p.name.chars().count() <= 256 && p.color.chars().count() <= 32), + [Event::PeerJoined(p)] => assert_eq!((p.name.as_str(), p.color.as_str()), ("x".repeat(256).as_str(), "x".repeat(32).as_str())), other => panic!("{other:?}"), } } + +#[test] +fn the_welcome_handed_to_the_sync_client_carries_the_bounded_roster() { + let inbox = inbox(); + let cfg = GuestConfig::new(Invite::new("127.0.0.1:47900", "0123456789abcdef", "AbCdEfGhIjKlMnOpQrStUv"), "Ada".into()); + let resume = Mutex::new(None); + let long = "y".repeat(100_000); + let welcome = ServerMsg::Welcome { + session: 1, + client_id: 9, + seq: 0, + catch_up: CatchUp::Snapshot(Vec::new()), + processed: Processed::default(), + peers: vec![Peer { client_id: 1, name: long.clone(), color: long }], + access: Access::default(), + secret: 0, + }; + take(welcome, &cfg, &inbox, &mut Seen::default(), &resume, &|| {}); + let events = inbox.drain(); + let Some(Event::Sync(ServerMsg::Welcome { peers, .. })) = events.iter().find(|e| matches!(e, Event::Sync(_))) else { panic!("{events:?}") }; + assert_eq!(peers.first().map(|p| (p.name.chars().count(), p.color.chars().count())), Some((256, 32))); +} diff --git a/crates/collab-net/src/join.rs b/crates/collab-net/src/join.rs index 5982ed6e8..b5de889f9 100644 --- a/crates/collab-net/src/join.rs +++ b/crates/collab-net/src/join.rs @@ -281,6 +281,10 @@ pub(crate) fn take(mut m: ServerMsg, cfg: &GuestConfig, inbox: &Inbox, seen: &mu view: None, }; seen.peers = peers.clone(); + // The sync client keeps the roster of the welcome it is handed: the bounded one. + if let ServerMsg::Welcome { peers: sent, .. } = &mut m { + sent.clone_from(&peers); + } seen.info = Some(info.clone()); welcomed(); inbox.push(Event::Welcome { info, peers }); From b190e675b9446d8f0090ae928eff485411522233 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 14:34:56 -0500 Subject: [PATCH 154/239] M4: a list item made by Enter has no start of its own, so a split list restarts at 1, as measured Enter copied the item's start (a typed "5. " gives 4) onto the new item, so once a middle item was unlisted the next one restarted at its copied start. Every paragraph an insertion creates now has start_offset 0; the first item keeps its start. Measured in Figma: unlisting "b" in 5. 6. 7. leaves "c" at 1., and the same for a list started with 1. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/canvas/textedit.rs | 8 +++++ crates/engine/src/text_tail_tests.rs | 50 ++++++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/canvas/textedit.rs b/crates/engine/src/canvas/textedit.rs index 0f82330af..f726cc7ab 100644 --- a/crates/engine/src/canvas/textedit.rs +++ b/crates/engine/src/canvas/textedit.rs @@ -319,6 +319,14 @@ fn insert_model(s: &mut Session, text: &str, ime_commit: bool) -> Result NodeId { + let t = text(s, "x"); + s.execute("node.set", &json!({"id": t, "props": {"characters": ""}})).unwrap(); + begin(s, t, Some(0), false).unwrap(); + for c in first.chars() { + insert(s, &c.to_string()).unwrap(); + } + for step in ["Enter", "b", "Enter", "c"] { + if step == "Enter" { + key(s, step, false, false, false).unwrap(); + } else { + insert(s, step).unwrap(); + } + } + t +} + +#[test] +fn a_list_split_by_unlisting_a_middle_item_restarts_at_one() { + // As measured in Figma (2026-11-11): typed "5. a", Enter, "b", Enter, "c" reads 5. 6. 7.; + // Backspace at the start of "b" takes its marker and "c" then reads 1., for "1. " too. + // `list_markers` counts on after a numbered item and restarts a numbered item that follows a + // plain paragraph at its own start, so the starts and the neighbours give the markers. + for (first, start) in [("5. a", 4), ("1. a", 0)] { + let mut s = Session::new(); + let t = three_typed_items(&mut s, first); + assert_eq!( + data(&s, t).characters, + "a +b +c" + ); + // The guard: unsplit, "b" and "c" go on counting (5. 6. 7.). + let d = data(&s, t); + assert_eq!(lists(&s, t), [(N, 0); 3], "{first}: no split"); + assert_eq!((d.para_list(0).start_offset, d.para_list(1).start_offset, d.para_list(2).start_offset), (start, 0, 0), "{first}"); + set_caret(&mut s, 2, false).unwrap(); + key(&mut s, "Backspace", false, false, false).unwrap(); + let d = data(&s, t); + assert_eq!(lists(&s, t), [(N, 0), (P, 0), (N, 0)], "{first}: split"); + assert_eq!(d.para_list(2).start_offset, 0, "{first}: c restarts at 1 (the item made by Enter has no start)"); + } +} + #[test] fn list_keys_at_list_items() { // (chars, lists before, caret, key, shift, chars after, lists after, derivation) From 14670b99d4bf43b563ee504fc49dea2832b5e9b9 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 14:42:37 -0500 Subject: [PATCH 155/239] M3: an instance lists the properties its variant uses; long property names stay on one line (#2022) In Figma's data a component set holds one text property per variant (plus leftovers of deleted variants), and an instance lists only the ones its current variant's layers read (measured in Figma's web app). FigCraft listed every definition on every instance, and wrapped a long property name inside an 84 x 20 box so its lines painted over the rows around it. - components::instance_prop_list: prop_list keeping slots and the properties a layer of the component references (a nested instance counts, its layers and slot content are not entered). component.properties and the Properties panel use it for instances; sets, components and variants still list every definition. - prop_label cuts the name to one line with an ellipsis and shows the full name on hover. - Tests: an_instance_lists_only_the_properties_its_variant_uses, a_long_property_name_stays_on_one_line, and the pin a_set_keeps_each_named_text_definition_and_layers_read_their_own. Two tests and one setup that listed an unbound boolean on an instance now bind it to a layer. - docs/components-parity.md: the properties row, header and revision history. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/assets/components.rs | 24 +++++++++++ crates/engine/src/assets/components/tests.rs | 5 ++- crates/engine/src/cmd/component/props.rs | 5 ++- crates/engine/src/prop_order_tests.rs | 27 ++++++++++++- crates/format/src/fig/prop_value_tests.rs | 40 +++++++++++++++++++ .../src/component_props_reorder_tests.rs | 31 +++++++++++++- crates/ui-egui/src/export_name_tests.rs | 2 +- crates/ui-egui/src/panels/component_panel.rs | 14 ++++--- docs/components-parity.md | 5 ++- 9 files changed, 140 insertions(+), 13 deletions(-) diff --git a/crates/engine/src/assets/components.rs b/crates/engine/src/assets/components.rs index 7ddb22427..a5016dc39 100644 --- a/crates/engine/src/assets/components.rs +++ b/crates/engine/src/assets/components.rs @@ -298,6 +298,30 @@ pub fn prop_list(doc: &Document, c: NodeId) -> Vec<(String, PropDef)> { } } +/// The properties an instance of `component` lists: [`prop_list`] without the boolean, text and +/// instance swap properties that no layer of the component reads. A set's variants share its +/// definitions, so one a variant's layers don't bind (another variant's text, a leftover of a +/// deleted variant) stays defined, and shows on the set, but not on this variant's instances +/// (#2022). Slots stay. Walks as [`slots_of`] does: a nested instance counts, its own layers and +/// the content put into slots are not entered. +pub fn instance_prop_list(doc: &Document, component: NodeId) -> Vec<(String, PropDef)> { + let mut used: std::collections::HashSet = std::collections::HashSet::new(); + let mut stack = vec![component]; + let mut seen = 0usize; + while let Some(c) = stack.pop() { + seen += 1; + if seen > 1_000_000 { + break; + } + let Some(n) = doc.node(c) else { continue }; + used.extend(n.prop_refs.values().cloned()); + if c == component || (!is_instance(doc, c) && !holds_content(n)) { + stack.extend(n.children.iter().rev().copied()); + } + } + prop_list(doc, component).into_iter().filter(|(k, d)| !takes_value(d) || used.contains(k)).collect() +} + /// Whether instances store a value for the property (every kind but slots). pub fn takes_value(d: &PropDef) -> bool { !matches!(d, PropDef::Slot { .. }) diff --git a/crates/engine/src/assets/components/tests.rs b/crates/engine/src/assets/components/tests.rs index ffaac176f..fc7d21e86 100644 --- a/crates/engine/src/assets/components/tests.rs +++ b/crates/engine/src/assets/components/tests.rs @@ -395,8 +395,11 @@ fn unbind_delete_and_vary(s: &mut Session, c: NodeId, i: NodeId, title: NodeId, ex(s, "component.deleteProperty", json!({"id": c, "name": "Heading"})); assert!(node(s, title).prop_refs.is_empty()); assert!(matches!(&node(s, i).kind, NodeKind::Instance { props, .. } if !props.contains_key("Heading"))); - let desc = ex(s, "component.properties", json!({"id": i})); + // "Show dot" is still defined but no layer reads it any more: the main lists it, the instance doesn't (#2022). + let desc = ex(s, "component.properties", json!({"id": c})); assert_eq!(desc["properties"].as_array().unwrap().len(), 1); + let desc = ex(s, "component.properties", json!({"id": i})); + assert!(desc["properties"].as_array().unwrap().is_empty()); // A variant property on a lone component makes it a component set. let set = idv(&ex(s, "component.addProperty", json!({"id": c, "name": "Theme", "type": "variant", "default": "Light"}))); assert!(matches!(node(s, set).kind, NodeKind::ComponentSet { .. })); diff --git a/crates/engine/src/cmd/component/props.rs b/crates/engine/src/cmd/component/props.rs index 2d97d6f0a..97bef3ce2 100644 --- a/crates/engine/src/cmd/component/props.rs +++ b/crates/engine/src/cmd/component/props.rs @@ -8,7 +8,7 @@ use super::{ req_string, req_targets, set_boolean_default, slot_edited, slots_of, string, takes_value, targets, variant_conflicts, variant_name, variant_options, variant_props, variant_set, }; -use crate::components::prop_list; +use crate::components::{instance_prop_list, prop_list}; /// Whether instance `id` has a component property `name` that a `kind` variable can drive (a /// boolean property takes a boolean variable, a text or variant property a string one). @@ -606,7 +606,8 @@ pub(crate) fn describe_props(doc: &Document, id: NodeId) -> Value { } // Slots: the frames (on a main) or this instance's copy, with whether it holds its own content. let slots = slots_of(doc, if values.is_some() { id } else { variant_set(doc, comp).unwrap_or(comp) }); - for (k, d) in prop_list(doc, comp) { + let defs = if values.is_some() { instance_prop_list(doc, comp) } else { prop_list(doc, comp) }; + for (k, d) in defs { let mut v = def_json(&k, &d); if !takes_value(&d) { let layers: Vec = slots.iter().filter(|(_, n)| *n == k).map(|(l, _)| *l).collect(); diff --git a/crates/engine/src/prop_order_tests.rs b/crates/engine/src/prop_order_tests.rs index 02f329e15..3b996e250 100644 --- a/crates/engine/src/prop_order_tests.rs +++ b/crates/engine/src/prop_order_tests.rs @@ -77,8 +77,9 @@ fn every_kind_of_property_keeps_its_place_on_rename() { let icon = idv(&ex(&mut s, "component.create", json!({"ids": [icon_f]}))); let nested = idv(&ex(&mut s, "instance.create", json!({"component": icon, "x": 60, "y": 10, "parent": f}))); let small = idv(&ex(&mut s, "component.create", json!({"ids": [f]}))); + let zoom_layer = idv(&ex(&mut s, "shape.rectangle", json!({"x": 150, "y": 10, "width": 10, "height": 10, "parent": small}))); // Made in an order that isn't by name: Zoom (boolean), Label (text), Glyph (instance swap), Body (slot). - ex(&mut s, "component.addProperty", json!({"id": small, "name": "Zoom", "type": "boolean"})); + ex(&mut s, "component.addProperty", json!({"id": small, "name": "Zoom", "type": "boolean", "layer": zoom_layer})); ex(&mut s, "component.addProperty", json!({"id": small, "name": "Label", "type": "text", "layer": label})); ex(&mut s, "component.addProperty", json!({"id": small, "name": "Glyph", "type": "instanceSwap", "layer": nested})); ex(&mut s, "component.makeSlot", json!({"id": body})); @@ -133,3 +134,27 @@ fn make_slot_takes_the_name_typed() { by_name.sort(); assert_eq!(listed, by_name); } + +/// An instance lists the properties its own variant's layers use (#2022): in Figma's data a set +/// has one text property per variant (and leftovers of deleted ones), measured: an instance of +/// variant A lists `State` and `A label`, never `B label` or a property no layer reads. +#[test] +fn an_instance_lists_only_the_properties_its_variant_uses() { + let mut s = Session::new(); + let mut variants = Vec::new(); + let mut texts = Vec::new(); + for (k, name) in ["Type=Flag, State=Default", "Type=Flag, State=Selected"].iter().enumerate() { + let f = idv(&ex(&mut s, "frame.create", json!({"x": 0, "y": k * 60, "width": 120, "height": 40, "name": name}))); + texts.push(idv(&ex(&mut s, "text.create", json!({"text": "Label", "x": 4, "y": 4, "parent": f, "name": "Label"})))); + variants.push(idv(&ex(&mut s, "component.create", json!({"ids": [f]})))); + } + let set = idv(&ex(&mut s, "component.combineVariants", json!({"ids": variants}))); + ex(&mut s, "component.addProperty", json!({"id": set, "name": "Default label", "type": "text", "layer": texts[0]})); + ex(&mut s, "component.addProperty", json!({"id": set, "name": "Selected label", "type": "text", "layer": texts[1]})); + ex(&mut s, "component.addProperty", json!({"id": set, "name": "Gone label", "type": "text"})); + assert_eq!(names(&mut s, set), ["Type", "State", "Default label", "Selected label", "Gone label"], "the set keeps every definition"); + let inst = idv(&ex(&mut s, "instance.create", json!({"component": variants[0], "x": 400, "y": 0}))); + assert_eq!(names(&mut s, inst), ["Type", "State", "Default label"]); + ex(&mut s, "instance.setProperties", json!({"ids": [inst], "properties": {"State": "Selected"}})); + assert_eq!(names(&mut s, inst), ["Type", "State", "Selected label"]); +} diff --git a/crates/format/src/fig/prop_value_tests.rs b/crates/format/src/fig/prop_value_tests.rs index 24248d32a..150cac39a 100644 --- a/crates/format/src/fig/prop_value_tests.rs +++ b/crates/format/src/fig/prop_value_tests.rs @@ -186,3 +186,43 @@ fn property_values_written_only_as_variables_are_applied() { assert_eq!(props.get("Hint"), Some(&Value::Bool(false))); assert_eq!(props.get("Label"), Some(&Value::String("Name on card".into()))); } + +/// #2022: a set keeps each named text definition under its own name (Figma writes one per variant, +/// plus leftovers of deleted variants), and each variant's text reads its own copy. +#[test] +fn a_set_keeps_each_named_text_definition_and_layers_read_their_own() { + let text = |chars: &str| o(vec![("textValue", o(vec![("characters", s(chars))]))]); + let names = ["Type=Flag / State=Default label", "Type=Flag / State=Selected label", "Type=Issue / State=Default label"]; + let set_defs: Vec> = + names.iter().zip([70, 71, 72]).zip(["One", "Two", "Gone"]).map(|((n, id), c)| definition(id, n, "TEXT", text(c))).collect(); + let copies = |first: u32| Kv::Array((0..3).map(|k| o(vec![("id", g(first + k)), ("parentPropDefId", g(70 + k))])).collect()); + let msg = message(vec![ + node(9, "FRAME", "Chip", Some(2), vec![("isStateGroup", Kv::Bool(true)), ("componentPropDefs", Kv::Array(set_defs))]), + node(10, "SYMBOL", "Type=Flag, State=Default", Some(9), vec![("componentPropDefs", copies(80))]), + node(11, "TEXT", "Label", Some(10), vec![bound("TEXT_DATA", 80)]), + node(20, "SYMBOL", "Type=Flag, State=Selected", Some(9), vec![("componentPropDefs", copies(90))]), + node(21, "TEXT", "Label", Some(20), vec![bound("TEXT_DATA", 91)]), + ]); + let (rest, _, _) = to_rest(&msg, "Synthetic", crate::rest::MAX_NODES); + let defs = &by_id(&rest["document"], "9:9")["componentPropertyDefinitions"]; + for (k, n) in names.iter().enumerate() { + assert_eq!(defs[format!("{n}#9:{}", 70 + k)]["type"], "TEXT", "{n}"); + } + assert_eq!(defs.as_object().map(|d| d.len()), Some(3), "{defs}"); + assert_eq!(by_id(&rest["document"], "9:11")["componentPropertyReferences"]["characters"], format!("{}#9:70", names[0])); + assert_eq!(by_id(&rest["document"], "9:21")["componentPropertyReferences"]["characters"], format!("{}#9:71", names[1])); + + let (doc, _) = crate::rest::import_fig(&rest, &crate::rest::no_images).unwrap(); + let refs: Vec> = doc + .ids() + .filter_map(|id| doc.node(id)) + .filter(|n| n.name == "Label" && n.source.is_none()) + .map(|n| n.prop_refs.get("characters").cloned()) + .collect(); + assert_eq!(refs.len(), 2, "{refs:?}"); + assert!(refs.contains(&Some(names[0].to_string())) && refs.contains(&Some(names[1].to_string())), "{refs:?}"); + for set in doc.ids().filter_map(|id| doc.node(id)).filter(|n| matches!(n.kind, NodeKind::Component { .. })) { + let NodeKind::Component { props, .. } = &set.kind else { continue }; + assert!(names.iter().all(|n| props.contains_key(*n)), "{} holds {:?}", set.name, props.keys().collect::>()); + } +} diff --git a/crates/ui-egui/src/component_props_reorder_tests.rs b/crates/ui-egui/src/component_props_reorder_tests.rs index 729185ce7..cc12489d0 100644 --- a/crates/ui-egui/src/component_props_reorder_tests.rs +++ b/crates/ui-egui/src/component_props_reorder_tests.rs @@ -19,12 +19,19 @@ fn id(v: serde_json::Value) -> NodeId { fn setup() -> (Ui, NodeId, NodeId) { let mut s = Session::new(); let mut variants = Vec::new(); + let mut icons = Vec::new(); for (k, name) in ["Size=Small, State=Default", "Size=Large, State=Default", "Size=Small, State=Hover"].iter().enumerate() { let f = id(s.execute("frame.create", &json!({"x": 0, "y": k * 60, "width": 80, "height": 40, "name": name})).unwrap()); + // A layer in every variant reads "Icon": an instance lists only the properties its variant uses. + let icon = id(s.execute("shape.rectangle", &json!({"x": 4, "y": 4, "width": 10, "height": 10, "parent": f})).unwrap()); + icons.push(icon); variants.push(id(s.execute("component.create", &json!({"ids": [f]})).unwrap())); } let set = id(s.execute("component.combineVariants", &json!({"ids": variants})).unwrap()); - s.execute("component.addProperty", &json!({"id": set, "name": "Icon", "type": "boolean", "default": true})).unwrap(); + s.execute("component.addProperty", &json!({"id": set, "name": "Icon", "type": "boolean", "default": true, "layer": icons[0]})).unwrap(); + for icon in &icons[1..] { + s.execute("component.bindProperty", &json!({"layer": icon, "property": "Icon"})).unwrap(); + } let inst = id(s.execute("instance.create", &json!({"component": set, "x": 400, "y": 0})).unwrap()); s.execute("select.set", &json!({"ids": [set]})).unwrap(); (Ui::new(s), set, inst) @@ -123,3 +130,25 @@ fn escape_cancels_a_property_drag_and_keeps_the_selection() { assert_eq!(undo_len(&u), undo); assert_eq!(u.app.session.ds().unwrap().selection, [set], "the Escape only cancels the drag"); } + +/// A long property name is cut to one line inside its label box instead of wrapping over the rows +/// above and below (#2022); the name itself stays whole. +#[test] +fn a_long_property_name_stays_on_one_line() { + let long = "Flag Default label with a long name"; + let mut s = Session::new(); + let f = id(s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 120, "height": 40, "name": "Chip"})).unwrap()); + let t = id(s.execute("text.create", &json!({"text": "Label", "x": 4, "y": 4, "parent": f})).unwrap()); + let c = id(s.execute("component.create", &json!({"ids": [f]})).unwrap()); + s.execute("component.addProperty", &json!({"id": c, "name": long, "type": "text", "layer": t})).unwrap(); + let inst = id(s.execute("instance.create", &json!({"component": c, "x": 400, "y": 0})).unwrap()); + s.execute("select.set", &json!({"ids": [inst]})).unwrap(); + let mut u = Ui::new(s); + let texts = crate::export_name_tests::painted(&mut u); + let panel = u.app.ui.right_panel_rect.expect("the right panel shows"); + let labels: Vec<(String, egui::Rect)> = texts.into_iter().filter(|(t, r)| t.starts_with("Flag") && r.min.x >= panel.min.x).collect(); + let [(text, rect)] = labels.as_slice() else { panic!("one property label: {labels:?}") }; + assert!(text.ends_with('…'), "cut with an ellipsis, not {text:?}"); + assert!(rect.height() <= crate::widgets::FIELD_H, "one line, not {} tall", rect.height()); + assert_eq!(names(&mut u, inst), [long], "the name itself stays whole"); +} diff --git a/crates/ui-egui/src/export_name_tests.rs b/crates/ui-egui/src/export_name_tests.rs index 3f85374aa..f66a51665 100644 --- a/crates/ui-egui/src/export_name_tests.rs +++ b/crates/ui-egui/src/export_name_tests.rs @@ -10,7 +10,7 @@ use crate::layers_drag_tests::Ui; use crate::widgets::FIELD_H; /// The text painted this frame, with each piece's box. -fn painted(u: &mut Ui) -> Vec<(String, Rect)> { +pub(crate) fn painted(u: &mut Ui) -> Vec<(String, Rect)> { fn walk(shape: &Shape, out: &mut Vec<(String, Rect)>) { match shape { Shape::Text(t) => out.push((t.galley.text().to_string(), t.visual_bounding_rect())), diff --git a/crates/ui-egui/src/panels/component_panel.rs b/crates/ui-egui/src/panels/component_panel.rs index 048071e3f..94d127387 100644 --- a/crates/ui-egui/src/panels/component_panel.rs +++ b/crates/ui-egui/src/panels/component_panel.rs @@ -14,8 +14,8 @@ use egui::{Id, Sense, Ui, vec2}; use figcraft_doc::{Document, Node, NodeId, NodeKind, PropDef, VariableType}; use figcraft_engine::cmd::component::{can_add_variant, can_combine_variants}; use figcraft_engine::components::{ - PROP_BINDING, default_variant, inside_instance, owning_component, owning_instance, prop_list, slot_def, slot_edited, slots_of, variant_conflicts, - variant_options, variant_props, variant_set, + PROP_BINDING, default_variant, inside_instance, instance_prop_list, owning_component, owning_instance, prop_list, slot_def, slot_edited, + slots_of, variant_conflicts, variant_options, variant_props, variant_set, }; use serde_json::{Value, json}; @@ -748,7 +748,7 @@ fn instance_props(app: &mut FigApp, ui: &mut Ui, doc: &Document, n: &Node, comps } } // Boolean, text and instance-swap properties. - for (k, d) in prop_list(doc, *component) { + for (k, d) in instance_prop_list(doc, *component) { let v = props.get(&k).cloned().unwrap_or_else(|| figcraft_engine::components::prop_default_value(&d)); row(ui, 32.0, |ui| { prop_label(ui, &k, type_icon(&d)); @@ -968,8 +968,12 @@ fn comp_rows(ui: &mut Ui, found: &CompSearch, checked: &impl Fn(NodeId) -> bool) fn prop_label(ui: &mut Ui, name: &str, icon: Icon) { let t = Tokens::get(ui.ctx()); - let (r, _) = ui.allocate_exact_size(vec2(84.0, 20.0), Sense::hover()); + let (r, resp) = ui.allocate_exact_size(vec2(84.0, 20.0), Sense::hover()); icons::paint(ui.painter(), egui::Rect::from_min_size(egui::pos2(r.min.x, r.center().y - 6.0), vec2(12.0, 12.0)), icon, t.icon_secondary); - let g = ui.painter().layout(name.to_string(), crate::theme::regular(11.0), t.text_secondary, r.width() - 18.0); + let shown = widgets::elide(ui, name, r.width() - 18.0); + let g = ui.painter().layout_no_wrap(shown.clone(), crate::theme::regular(11.0), t.text_secondary); ui.painter().galley(egui::pos2(r.min.x + 18.0, r.center().y - g.size().y / 2.0), g, t.text_secondary); + if shown != name { + resp.on_hover_text(name); + } } diff --git a/docs/components-parity.md b/docs/components-parity.md index 8fcaea78a..d8d20aaab 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-11-06 · **Change:** minor (the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (an instance lists only the properties its variant's layers use and long property names are cut to one line (#2022); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; 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 @@ -12,6 +12,7 @@ accounts). | Feature | Status | Notes | |---|---|---| +| 2026-11-11 | minor | M3, #2022: an instance lists only the properties its variant's layers use (its variant properties, slots, and the boolean, text and instance swap properties a layer of its current variant reads), as measured in Figma's web app: an instance of variant A lists `State` and `A label`, never `B label` or a property no layer reads. The set and its variants still list every definition, so unused ones can be deleted there. A long property name in the panel is cut to one line with an ellipsis, the full name on hover, instead of wrapping over the rows around it. Tests: `prop_order_tests::an_instance_lists_only_the_properties_its_variant_uses`, `component_props_reorder_tests::a_long_property_name_stays_on_one_line`, `prop_value_tests::a_set_keeps_each_named_text_definition_and_layers_read_their_own`. Grade unchanged. | | 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 | @@ -22,7 +23,7 @@ accounts). | Switching variants keeps overrides where names match and both variants had the same value; text layers keep theirs | done | | | Default variant: the top-left one (new instances, Assets thumbnail, generated code) | done | | | Variant property order (names rewritten), duplicate combinations reported | done | drag a property in the Properties section to reorder it, one undo step (#679), or `component.editProperty {index}` | -| Properties: boolean, text, instance swap (preferred values), variant | done | listed in the order they were made, a rename keeping the place (#1536; the shared ones don't reorder by drag yet); every component menu scrolls past 320 pt, the default of an instance-swap property's too (#1338); the instance-swap menus (an instance's property and swap menus, a property's default, the playground) open with a search field that filters by name as you type, with Up, Down and Enter to pick and Escape to clear then close; the slot and preferred components menus have no search yet | +| Properties: boolean, text, instance swap (preferred values), variant | done | listed in the order they were made, a rename keeping the place (#1536; the shared ones don't reorder by drag yet); every component menu scrolls past 320 pt, the default of an instance-swap property's too (#1338); the instance-swap menus (an instance's property and swap menus, a property's default, the playground) open with a search field that filters by name as you type, with Up, Down and Enter to pick and Escape to clear then close; the slot and preferred components menus have no search yet; an instance lists the properties its variant's layers use, so a set with one text property per variant shows one text field per instance (#2022; measured in Figma's web app, 2026-11-11); long names are cut to one line, the full name on hover | | Slots (preferred components, fill menu, kept across updates) | done | Figma 2025 feature; Make slot asks for the name first (a field under the frame's Slot row), and slots are renamed in the component's Properties list (#1537); no rename with only the slot's frame selected yet | | Exposed nested instances | done | hidden ones hide their properties | | Descriptions | done | | From 7c3f9ce7e349c5ae43cb2ee475e1b84803f3420b Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 16:03:31 -0500 Subject: [PATCH 156/239] M4: the list start reset runs once per edit and leaves plain paragraphs' levels alone insert_model cleared the copied start with one set_para_lists call per newline, each scanning the whole text, and set_para_lists also zeroed the level of plain paragraphs. Add TextData::clear_list_starts (one pass, touches only start_offset, no-op when no paragraph has a start) and call it once over the created paragraphs, only when the text has a newline. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/doc/src/text.rs | 38 ++++++++++++++++++++++++++++ crates/engine/src/canvas/textedit.rs | 7 +++-- crates/engine/src/text_tail_tests.rs | 36 ++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 4 deletions(-) diff --git a/crates/doc/src/text.rs b/crates/doc/src/text.rs index b9587293e..390aa703f 100644 --- a/crates/doc/src/text.rs +++ b/crates/doc/src/text.rs @@ -886,6 +886,25 @@ impl TextData { } pl.indent = pl.indent.min(MAX_LIST_INDENT); } + self.fold_paragraph_lists(); + } + + /// Give paragraphs `a..=b` (by index) no start number of their own, as an item made by Enter + /// has none. Touches nothing else: a plain paragraph keeps its level, a bullet its settings. + /// One pass over the range, and nothing at all when no paragraph carries a start. + pub fn clear_list_starts(&mut self, a: usize, b: usize) { + if self.paragraphs.iter().all(|p| p.start_offset == 0) { + return; + } + self.fill_paragraphs(); + for pl in self.paragraphs.get_mut(a..=b).unwrap_or(&mut []) { + pl.start_offset = 0; + } + self.fold_paragraph_lists(); + } + + /// One style for all paragraphs with no nesting or start folds back into `list`. + fn fold_paragraph_lists(&mut self) { if let Some(first) = self.paragraphs.first().copied() && first == (ParaList { list: first.list, ..ParaList::default() }) && self.paragraphs.iter().all(|p| *p == first) @@ -1104,6 +1123,25 @@ mod case_tests { t.set_para_lists(0, 0, |p| p.list = P); assert_eq!(t.para_list(0), ParaList::default()); } + + #[test] + fn clear_list_starts_touches_only_starts() { + use ListStyle::{None as P, Numbered as N}; + let mut t = TextData { characters: "a\nb\nc".into(), ..Default::default() }; + t.paragraphs = vec![ + ParaList { list: N, start_offset: 4, ..ParaList::default() }, + ParaList { list: P, indent: 1, ..ParaList::default() }, + ParaList { list: N, indent: 2, start_offset: 7, ..ParaList::default() }, + ]; + t.clear_list_starts(1, 2); + assert_eq!(t.para_list(0).start_offset, 4, "outside the range"); + assert_eq!(t.para_list(1), ParaList { list: P, indent: 1, ..ParaList::default() }, "a plain paragraph keeps its level"); + assert_eq!(t.para_list(2), ParaList { list: N, indent: 2, start_offset: 0, ..ParaList::default() }); + // Out of range and no-start cases leave it alone. + t.clear_list_starts(5, 9); + t.clear_list_starts(0, 0); + assert_eq!(t.para_list(0).start_offset, 0); + } } #[cfg(test)] diff --git a/crates/engine/src/canvas/textedit.rs b/crates/engine/src/canvas/textedit.rs index f726cc7ab..51a1640f7 100644 --- a/crates/engine/src/canvas/textedit.rs +++ b/crates/engine/src/canvas/textedit.rs @@ -322,10 +322,9 @@ fn insert_model(s: &mut Session, text: &str, ime_commit: bool) -> Result = (0..2001).map(|i| format!("l{i}")).collect(); + insert(&mut s, &lines.join("\n")).unwrap(); + let d = data(&s, t); + assert_eq!(d.paragraph_count(), 2001); + assert_eq!(d.para_list(0).start_offset, 4, "the first item keeps its start"); + assert!((1..d.paragraph_count()).all(|p| d.para_list(p).start_offset == 0 && d.para_list(p).list == N)); +} From cf77dfdabc040b98e2958429e40ad495dfd15659 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 11 Nov 2026 21:31:26 +0000 Subject: [PATCH 157/239] load: an SVG that doesn't fit the allowance is taken out again; charge after cleanup --- crates/engine/src/cmd/file/load.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/file/load.rs b/crates/engine/src/cmd/file/load.rs index 77dd68198..da03ca1d1 100644 --- a/crates/engine/src/cmd/file/load.rs +++ b/crates/engine/src/cmd/file/load.rs @@ -438,7 +438,6 @@ fn expand_penpot_raw_svgs_within(doc: &mut Document, notes: &mut Vec, mu } let before = doc.node_count(); let imported = figcraft_svg::import_svg_with_notes(doc, xml.as_bytes(), id, 0.0, 0.0, &name); - room = room.saturating_sub(doc.node_count().saturating_sub(before)); match imported { Ok(imported) => { // An SVG can be syntactically valid yet contain no supported drawable @@ -453,6 +452,21 @@ fn expand_penpot_raw_svgs_within(doc: &mut Document, notes: &mut Vec, mu } continue; } + // Charged once the empty ones are gone; one that doesn't fit is taken out again. + let added = doc.node_count().saturating_sub(before); + if added > room { + let _ = doc.remove(imported.frame); + if let Some(n) = doc.node_mut(id) { + n.plugin_data.insert("penpot.svgRawStatus".into(), "not-expanded".into()); + } + if notes.len() < 100 { + notes.push(format!( + "Penpot SVG '{name}': not converted, the file's SVG layers are over the limit; the original markup is preserved" + )); + } + continue; + } + room -= added; let size = doc.node(imported.frame).map(|n| (n.width, n.height)); if let Some((svg_w, svg_h)) = size && svg_w.is_finite() @@ -837,7 +851,9 @@ mod penpot_svg_v10_tests { }) .collect(); let mut warnings = Vec::new(); - expand_penpot_raw_svgs_within(&mut doc, &mut warnings, 1); + let nodes = doc.node_count(); + expand_penpot_raw_svgs_within(&mut doc, &mut warnings, 4); + assert!(doc.node_count() - nodes <= 4, "never more layers than the allowance"); let status = |i: usize| doc.node(ids[i]).unwrap().plugin_data.get("penpot.svgRawStatus").cloned(); assert_eq!(status(0).as_deref(), Some("expanded"), "the first uses the allowance"); assert_eq!(status(1).as_deref(), Some("not-expanded")); From cb52621414be379d0bebc2f2ae233895c300fcd4 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 17:13:26 -0500 Subject: [PATCH 158/239] M5: marquee selection follows Figma's measured rules (gap 4) A plain marquee now selects each top-level layer it touches: a partly covered frame or section gives the layers in it the marquee touches, an enclosed one is selected itself, an empty frame on touch, a rotated shape by its outline. A drag from inside a frame never selects that frame and also takes the top-level layers it touches outside it. Once the marquee selects a frame whole, no frame opens and a partly covered frame comes whole. Measured in Figma's web app, 2026-11-11. Flipped existing assertions: marquee_selects_what_it_touches, cmd_marquee_selects_nested_layers, a_box_selects_like_a_marquee. Tests: marquee_behaviour_tests. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 briefed; Sonnet 5.5 wrote at medium --- crates/doc/src/geometry.rs | 143 +++++++++++-- crates/engine/src/canvas/tools/pointer.rs | 21 +- crates/engine/src/lib.rs | 2 + crates/engine/src/marquee_behaviour_tests.rs | 200 ++++++++++++++++++ crates/engine/src/select_area_tests.rs | 8 +- .../engine/src/selection_behaviour_tests.rs | 4 +- crates/engine/src/selection_depth_tests.rs | 8 +- docs/mcp.md | 6 +- docs/ui-parity.md | 5 +- 9 files changed, 357 insertions(+), 40 deletions(-) create mode 100644 crates/engine/src/marquee_behaviour_tests.rs diff --git a/crates/doc/src/geometry.rs b/crates/doc/src/geometry.rs index 189e06192..c9cc9958b 100644 --- a/crates/doc/src/geometry.rs +++ b/crates/doc/src/geometry.rs @@ -355,14 +355,15 @@ pub fn enter_target(doc: &Document, leaf: NodeId, selection: &[NodeId]) -> NodeI inner.unwrap_or_else(|| select_target(doc, leaf, selection, false)) } -/// Nodes on `page` whose world bounds intersect `rect` (marquee): top-level children, or the -/// children of top-level frames when the marquee starts inside a frame (`within`). +/// Nodes a marquee over `rect` touches, one level only: the children of `within` (a focus view's +/// frame), or the top-level layers of `page`. Frames are not opened or enclosed here; see +/// [`marquee_select`] for a plain marquee. pub fn marquee(doc: &Document, page: NodeId, rect: Rect, within: Option) -> Vec { let parent = within.unwrap_or(page); doc.node(parent).map(|p| marquee_children(doc, p, rect)).unwrap_or_default() } -/// Nodes on `page` a Cmd/Ctrl marquee selects: the innermost layers whose bounds touch `rect` +/// Nodes on `page` a Cmd/Ctrl marquee selects: the innermost layers the marquee touches /// (frames, groups and instances are looked into; a container none of whose children are touched /// counts itself; boolean groups count as one shape). pub fn marquee_deep(doc: &Document, page: NodeId, rect: Rect) -> Vec { @@ -384,25 +385,131 @@ pub fn marquee_deep(doc: &Document, page: NodeId, rect: Rect) -> Vec { out } -/// The visible, unlocked children of `p` whose world bounds touch `rect` (on both axes: lines and -/// other flat layers too). +/// The visible, unlocked children of `p` the marquee touches (see [`marquee_touches`]). fn marquee_children(doc: &Document, p: &Node, rect: Rect) -> Vec { - p.children - .iter() - .copied() - .filter(|c| doc.node(*c).is_some_and(|n| n.visible && !n.locked)) - .filter(|c| doc.world_bounds(*c).is_some_and(|b| b.x0 <= rect.x1 && b.x1 >= rect.x0 && b.y0 <= rect.y1 && b.y1 >= rect.y0)) - .collect() + p.children.iter().copied().filter(|c| doc.node(*c).is_some_and(|n| n.visible && !n.locked && marquee_touches(doc, *c, n, rect))).collect() } -/// Figma marquee rule: a marquee that fully contains a top-level frame selects the frame; one -/// starting on empty canvas selects top-level objects it touches. -pub fn marquee_select(doc: &Document, page: NodeId, rect: Rect, start_inside: Option) -> Vec { - if let Some(frame) = start_inside { - let inside = marquee(doc, page, rect, Some(frame)); - return inside; +/// The outline a rotated shape is touched by. One line: return the turned box instead +/// (`figcraft_geom::rounded_rect(n.width, n.height, [0.0; 4], 0.0)`) if Figma proves to test that. +fn marquee_outline(n: &Node) -> Option { + shape_path(n) +} + +/// Whether the marquee touches layer `id`: its world box overlaps `rect` (inclusive, so lines and +/// zero-size marquees count) and, for a rotated shape, its outline in page space does too. +fn marquee_touches(doc: &Document, id: NodeId, n: &Node, rect: Rect) -> bool { + let box_hit = doc.world_bounds(id).is_some_and(|b| b.x0 <= rect.x1 && b.x1 >= rect.x0 && b.y0 <= rect.y1 && b.y1 >= rect.y0); + if !box_hit + || !matches!( + n.kind, + NodeKind::Rectangle + | NodeKind::Ellipse { .. } + | NodeKind::Polygon { .. } + | NodeKind::Star { .. } + | NodeKind::Line + | NodeKind::Vector { .. } + ) + { + return box_hit; } - marquee(doc, page, rect, None) + let xf = doc.world_transform(id); + let [a, b, c, d, e, f] = xf.as_coeffs(); + const EPS: f64 = 1e-9; + let rotated = !((b.abs() < EPS && c.abs() < EPS) || (a.abs() < EPS && d.abs() < EPS)); + if !rotated { + return true; + } + let det = a * d - b * c; + if ![a, b, c, d, e, f, det].iter().all(|v| v.is_finite()) || det.abs() < EPS { + return true; + } + marquee_outline(n).is_none_or(|path| path_touches_rect(n, &path, xf, rect)) +} + +/// Whether the marquee and the shape drawn as local `path` under `xf` share a point: a path end +/// inside the marquee, a path segment crossing a marquee edge, or the marquee inside the filled shape. +fn path_touches_rect(n: &Node, path: &BezPath, xf: figcraft_geom::Affine, rect: Rect) -> bool { + use figcraft_geom::kurbo::{Line, ParamCurve, PathSeg}; + let inside = |p: Point| p.x >= rect.x0 && p.x <= rect.x1 && p.y >= rect.y0 && p.y <= rect.y1; + let mut world = path.clone(); + world.apply_affine(xf); + if world.segments().any(|s| inside(s.start()) || inside(s.end())) { + return true; + } + let (tl, tr, br, bl) = (Point::new(rect.x0, rect.y0), Point::new(rect.x1, rect.y0), Point::new(rect.x1, rect.y1), Point::new(rect.x0, rect.y1)); + let edges = [(tl, tr), (tr, br), (br, bl), (bl, tl)]; + for (p, q) in edges { + if (q - p).hypot() < 1e-9 { + continue; + } + let line = Line::new(p, q); + if world.segments().any(|s: PathSeg| s.intersect_line(line).iter().any(|h| (0.0..=1.0).contains(&h.line_t))) { + return true; + } + } + is_closed(n) && fills_point(n, path, xf.inverse() * tl) +} + +/// Whether a marquee takes a touched top-level layer whole, opens it for the layers in it, or skips it. +enum Touch { + Whole, + /// The frame the drag started in: only the layers in it the marquee touches. + Open, + /// A partly covered frame or section: the layers in it, or the frame itself once the marquee is at the top level. + Partial, + Skip, +} + +/// Figma's marquee rule (measured in the web app, 2026-11-11): each top-level layer the marquee +/// touches is selected whole, except a frame with children or a section with its contents shown: +/// enclosed by the marquee it is selected itself, otherwise the marquee takes the layers in it that +/// it touches. The frame the drag started in (`start_inside`) is never selected itself, only the +/// layers in it the marquee touches. Selecting a frame or section whole keeps the marquee at the +/// top level: no frame opens then, and a partly covered one is selected whole. Components, instances, board items and sections with hidden +/// contents are selected only when enclosed. +pub fn marquee_select(doc: &Document, page: NodeId, rect: Rect, start_inside: Option) -> Vec { + let Some(page_node) = doc.node(page) else { return Vec::new() }; + let touched = marquee_children(doc, page_node, rect); + let classified: Vec<(NodeId, Touch, bool)> = touched + .iter() + .filter_map(|t| { + let n = doc.node(*t)?; + let enclosed = doc.world_bounds(*t).is_some_and(|b| rect.contains(b.origin()) && rect.contains(Point::new(b.x1, b.y1))); + let container = n.kind.is_frame_like() || matches!(n.kind, NodeKind::Section { .. }); + let opens = match &n.kind { + NodeKind::Frame | NodeKind::Section { .. } => !n.is_board_atom() && !n.hides_contents() && !n.children.is_empty(), + _ => false, + }; + let plain_empty_frame = matches!(n.kind, NodeKind::Frame) && n.children.is_empty() && !n.is_board_atom(); + let act = if start_inside == Some(*t) { + Touch::Open + } else if opens { + if enclosed { Touch::Whole } else { Touch::Partial } + } else if plain_empty_frame || !(container || n.is_board_atom()) || enclosed { + Touch::Whole + } else { + Touch::Skip + }; + let whole_container = container && matches!(act, Touch::Whole); + Some((*t, act, whole_container)) + }) + .collect(); + let top_level_mode = classified.iter().any(|(_, _, whole_container)| *whole_container); + let mut out = Vec::new(); + for (t, act, _) in &classified { + match act { + Touch::Whole => out.push(*t), + Touch::Partial if top_level_mode => out.push(*t), + Touch::Open | Touch::Partial if !top_level_mode => { + if let Some(n) = doc.node(*t) { + out.extend(marquee_children(doc, n, rect)); + } + } + Touch::Open | Touch::Partial | Touch::Skip => {} + } + } + out } /// Bounds of a node's outline in page coordinates for snapping (the box corners and centre). diff --git a/crates/engine/src/canvas/tools/pointer.rs b/crates/engine/src/canvas/tools/pointer.rs index fb802353e..1e9c645e3 100644 --- a/crates/engine/src/canvas/tools/pointer.rs +++ b/crates/engine/src/canvas/tools/pointer.rs @@ -47,16 +47,23 @@ impl Session { /// the layers it touches (`deep`: nested ones too); `additive` (Shift) toggles them. pub(crate) fn marquee_selection(&self, r: Rect, within: Option, deep: bool, base: &[NodeId], additive: bool) -> Result> { let (doc, page) = (self.doc()?, self.page()?); - let mut hits = - if deep { figcraft_doc::geometry::marquee_deep(doc, page, r) } else { figcraft_doc::geometry::marquee_select(doc, page, r, within) }; - if let Some(f) = self.ds()?.focused() { + let focused = self.ds()?.focused(); + let mut hits = match (deep, focused) { + (true, _) => figcraft_doc::geometry::marquee_deep(doc, page, r), + (false, Some(f)) => figcraft_doc::geometry::marquee(doc, page, r, Some(f)), + (false, None) => figcraft_doc::geometry::marquee_select(doc, page, r, within), + }; + if let Some(f) = focused { hits.retain(|h| *h != f && doc.is_ancestor(f, *h)); } - // A marquee over a frame from outside selects the frame only when it covers it fully. - if within.is_none() && !deep { + // A widget's layers are part of the widget: a marquee from outside never opens one. + if !deep { hits.retain(|h| { - let full = doc.world_bounds(*h).is_some_and(|b| r.contains(b.origin()) && r.contains(Point::new(b.x1, b.y1))); - full || !doc.node(*h).is_some_and(|n| n.kind.is_frame_like() || matches!(n.kind, NodeKind::Section { .. })) + doc.node(*h) + .and_then(|n| n.parent) + .filter(|p| Some(*p) != within) + .and_then(|p| doc.node(p)) + .is_none_or(|p| !crate::widgets::is_widget(p)) }); } // Shift toggles: what was selected and is touched again comes out. diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 89de7f22f..1ec7c3d7d 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -421,6 +421,8 @@ mod live_tests; #[cfg(test)] mod lock_behaviour_tests; #[cfg(test)] +mod marquee_behaviour_tests; +#[cfg(test)] mod mask_tests; #[cfg(test)] mod masks_behaviour_tests; diff --git a/crates/engine/src/marquee_behaviour_tests.rs b/crates/engine/src/marquee_behaviour_tests.rs new file mode 100644 index 000000000..90c37ccd1 --- /dev/null +++ b/crates/engine/src/marquee_behaviour_tests.rs @@ -0,0 +1,200 @@ +//! Marquee selection, as measured in Figma's web app (2026-11-11, the "marquee rules" and "confirming +//! pass" readings) and described in the help-center article "Select layers and objects": a drag +//! selects each top-level layer it touches; a partly covered frame or section gives the layers in it +//! the marquee touches, an enclosed one is selected itself; a drag started inside a frame never selects +//! that frame; selecting a frame whole keeps the marquee at the top level; a rotated shape is touched by +//! its outline, an unrotated one by its box. + +use serde_json::{Value, json}; + +use crate::Session; +use crate::params::id_of; +use crate::tools::{PointerEvent, PointerKind}; +use figcraft_doc::NodeId; +use figcraft_geom::Point; + +fn ex(s: &mut Session, cmd: &str, p: Value) -> Value { + s.execute(cmd, &p).unwrap_or_else(|e| panic!("{cmd}: {e}")) +} + +fn id(v: &Value) -> NodeId { + id_of(&v["id"]).unwrap() +} + +fn rect(s: &mut Session, x: f64, y: f64, w: f64, h: f64, parent: Option) -> NodeId { + let mut p = json!({"x": x, "y": y, "width": w, "height": h}); + if let Some(parent) = parent { + p["parent"] = json!(parent); + } + id(&ex(s, "shape.rectangle", p)) +} + +fn ev(kind: PointerKind, x: f64, y: f64) -> PointerEvent { + PointerEvent::at(kind, x, y, 1.0) +} + +fn drag(s: &mut Session, a: (f64, f64), b: (f64, f64)) { + s.pointer(&ev(PointerKind::Down, a.0, a.1)).unwrap(); + s.pointer(&ev(PointerKind::Move, b.0, b.1)).unwrap(); + s.pointer(&ev(PointerKind::Up, b.0, b.1)).unwrap(); +} + +fn sorted(mut v: Vec) -> Vec { + v.sort(); + v +} + +#[allow(dead_code)] +struct Scene { + f1: NodeId, + r1: NodeId, + r2: NodeId, + e: NodeId, + u: NodeId, + rr: NodeId, + re: NodeId, + f2: NodeId, + g: NodeId, + s: NodeId, + r5: NodeId, +} + +/// The confirming pass's layout: `f1` (0,0 300x200) holding `r1` (20,20) and `r2` (220,120), both 60x60; +/// ellipse `e` (500,0 200x200); rectangle `u` (900,0 100x100); `rr` rectangle (0,400 200x100) and ellipse +/// `re` (500,400 200x100) turned 45 degrees about their centres; the empty frame `f2` (0,700 200x150); +/// the group `g` of two rectangles (300,700) and (360,760); the section `s` (600,700 300x200) holding `r5`. +fn scene(s: &mut Session) -> Scene { + let f1 = id(&ex(s, "frame.create", json!({"x": 0, "y": 0, "width": 300, "height": 200}))); + let r1 = rect(s, 20.0, 20.0, 60.0, 60.0, Some(f1)); + let r2 = rect(s, 220.0, 120.0, 60.0, 60.0, Some(f1)); + let e = id(&ex(s, "shape.ellipse", json!({"x": 500, "y": 0, "width": 200, "height": 200}))); + let u = rect(s, 900.0, 0.0, 100.0, 100.0, None); + let rr = rect(s, 0.0, 400.0, 200.0, 100.0, None); + ex(s, "node.set", json!({"id": rr, "props": {"rotation": 45}})); + let re = id(&ex(s, "shape.ellipse", json!({"x": 500, "y": 400, "width": 200, "height": 100}))); + ex(s, "node.set", json!({"id": re, "props": {"rotation": 45}})); + let f2 = id(&ex(s, "frame.create", json!({"x": 0, "y": 700, "width": 200, "height": 150}))); + let g1 = rect(s, 300.0, 700.0, 80.0, 80.0, None); + let g2 = rect(s, 360.0, 760.0, 80.0, 80.0, None); + let g = id(&ex(s, "object.group", json!({"ids": [g1, g2]}))); + let sec = id(&ex(s, "node.create", json!({"type": "section", "x": 600, "y": 700, "width": 300, "height": 200}))); + let r5 = rect(s, 20.0, 20.0, 60.0, 60.0, Some(sec)); + ex(s, "select.none", json!({})); + Scene { f1, r1, r2, e, u, rr, re, f2, g, s: sec, r5 } +} + +fn selected(s: &mut Session, a: (f64, f64), b: (f64, f64)) -> Vec { + ex(s, "select.none", json!({})); + drag(s, a, b); + let sel = sorted(s.selection()); + ex(s, "select.none", json!({})); + sel +} + +#[test] +fn a_partly_covered_frame_gives_the_layers_it_touches() { + let mut s = Session::new(); + let k = scene(&mut s); + assert_eq!(selected(&mut s, (-50.0, -50.0), (60.0, 60.0)), vec![k.r1], "measured case 2: Rectangle 1, not F1"); +} + +#[test] +fn an_enclosed_frame_is_selected_itself() { + let mut s = Session::new(); + let k = scene(&mut s); + assert_eq!(selected(&mut s, (-20.0, -20.0), (320.0, 220.0)), vec![k.f1], "measured b"); +} + +#[test] +fn an_empty_frame_is_selected_on_touch() { + let mut s = Session::new(); + let k = scene(&mut s); + assert_eq!(selected(&mut s, (-20.0, 680.0), (50.0, 720.0)), vec![k.f2], "measured c: Frame 2"); +} + +#[test] +fn a_group_is_selected_whole_on_touch() { + let mut s = Session::new(); + let k = scene(&mut s); + assert_eq!(selected(&mut s, (290.0, 690.0), (310.0, 710.0)), vec![k.g], "measured c: Group 1, not the rectangle"); +} + +#[test] +fn a_partly_covered_section_gives_the_layers_it_touches() { + let mut s = Session::new(); + let k = scene(&mut s); + assert_eq!(selected(&mut s, (590.0, 690.0), (650.0, 750.0)), vec![k.r5], "measured c: Rectangle 5, not the section"); +} + +#[test] +fn an_unrotated_shape_is_touched_by_its_box() { + let mut s = Session::new(); + let k = scene(&mut s); + assert_eq!(selected(&mut s, (490.0, -10.0), (505.0, 5.0)), vec![k.e], "measured case 3: the ellipse's box corner selects it"); + assert_eq!(selected(&mut s, (890.0, -10.0), (905.0, 5.0)), vec![k.u], "control"); +} + +#[test] +fn a_rotated_rectangle_is_touched_by_its_outline() { + let mut s = Session::new(); + let k = scene(&mut s); + assert_eq!(selected(&mut s, (-30.0, 320.0), (4.0, 354.0)), Vec::::new(), "measured case 3: the box corner selects nothing"); + assert_eq!(selected(&mut s, (-30.0, 320.0), (100.0, 450.0)), vec![k.rr]); +} + +#[test] +fn a_rotated_ellipse_is_not_touched_by_its_axis_aligned_box() { + let mut s = Session::new(); + let k = scene(&mut s); + assert_eq!(selected(&mut s, (470.0, 320.0), (504.0, 354.0)), Vec::::new(), "measured case 3: the box corner selects nothing"); + assert_eq!(selected(&mut s, (470.0, 320.0), (600.0, 450.0)), vec![k.re]); +} + +#[test] +fn a_rotated_ellipse_is_not_touched_through_the_corner_of_its_turned_box() { + let mut s = Session::new(); + let k = scene(&mut s); + // Not the measurement's literal numbers (see the brief, section 5): a point inside the turned box + // but outside the ellipse. + let p = Point::new(690.0, 420.0); + let doc = s.doc().unwrap(); + let n = doc.node(k.re).unwrap(); + assert!(n.local_rect().contains(doc.world_transform(k.re).inverse() * p), "the probe is inside the turned box"); + assert_eq!(selected(&mut s, (727.0, 407.0), (690.0, 420.0)), Vec::::new()); +} + +#[test] +fn a_drag_from_inside_a_frame_never_selects_it() { + let mut s = Session::new(); + let k = scene(&mut s); + let start_x = |s: &Session| s.doc().unwrap().world_bounds(k.f1).map(|b| (b.x0, b.y0)); + assert_eq!(selected(&mut s, (150.0, 100.0), (180.0, 150.0)), Vec::::new(), "measured e1"); + assert_eq!(start_x(&s), Some((0.0, 0.0))); + assert_eq!(selected(&mut s, (150.0, 100.0), (180.0, 250.0)), Vec::::new(), "measured e2"); + assert_eq!(start_x(&s), Some((0.0, 0.0))); + assert_eq!(selected(&mut s, (150.0, 100.0), (600.0, 100.0)), vec![k.e], "measured e3: the ellipse only"); + assert_eq!(start_x(&s), Some((0.0, 0.0))); + assert_eq!(selected(&mut s, (150.0, 100.0), (250.0, 150.0)), vec![k.r2], "today's rule, not measured"); + assert_eq!(start_x(&s), Some((0.0, 0.0))); +} + +#[test] +fn selecting_a_frame_whole_keeps_the_marquee_at_the_top_level() { + let mut s = Session::new(); + let k = scene(&mut s); + // Encloses the empty f2, covers rr, and partly covers f1 over r1: no frame opens, f1 comes whole. + assert_eq!( + selected(&mut s, (-20.0, 50.0), (210.0, 860.0)), + sorted(vec![k.f2, k.f1, k.rr]), + "the article: selecting a top-level frame selects only top-level layers; measured: a partly covered frame comes whole" + ); +} + +#[test] +fn a_marquee_enclosing_an_empty_frame_takes_a_partly_covered_frame_whole() { + let mut s = Session::new(); + let f1 = id(&ex(&mut s, "frame.create", json!({"x": 0, "y": 0, "width": 300, "height": 200}))); + let _r1 = rect(&mut s, 20.0, 20.0, 60.0, 60.0, Some(f1)); + let f2 = id(&ex(&mut s, "frame.create", json!({"x": 400, "y": 0, "width": 200, "height": 150}))); + assert_eq!(selected(&mut s, (650.0, 170.0), (40.0, -10.0)), sorted(vec![f1, f2]), "measured re-measure: F2 and F1, not R1"); +} diff --git a/crates/engine/src/select_area_tests.rs b/crates/engine/src/select_area_tests.rs index 8f1d4cf75..30de60d4c 100644 --- a/crates/engine/src/select_area_tests.rs +++ b/crates/engine/src/select_area_tests.rs @@ -1,6 +1,6 @@ //! `select.area`: what a marquee over a box selects, without a pointer (keyboard box selection in -//! the app, agents over MCP): top-level layers, a frame only when fully covered, the children of -//! the frame the box starts in, Shift-like toggling, Cmd/Ctrl-like nested layers; no box asks the +//! the app, agents over MCP): top-level layers, a frame only when fully covered (otherwise the +//! layers in it the box touches), the children of the frame the box starts in, Shift-like toggling, Cmd/Ctrl-like nested layers; no box asks the //! app to draw one. use serde_json::{Value, json}; @@ -40,8 +40,8 @@ fn a_box_selects_like_a_marquee() { let inner = rect(&mut s, 20.0, 20.0, Some(frame)); let a = rect(&mut s, 0.0, 0.0, None); let b = rect(&mut s, 100.0, 0.0, None); - // Top-level layers it touches; a frame only touched from outside isn't selected. - assert_eq!(area(&mut s, -10.0, -10.0, 340.0, 40.0, json!({})), sorted(vec![a, b])); + // Top-level layers it touches; a frame only touched from outside gives the layers in it the box touches. + assert_eq!(area(&mut s, -10.0, -10.0, 340.0, 40.0, json!({})), sorted(vec![a, b, inner])); // A negative size draws the box the other way. assert_eq!(area(&mut s, 130.0, 30.0, -140.0, -40.0, json!({})), sorted(vec![a, b])); // Covering the frame selects it. diff --git a/crates/engine/src/selection_behaviour_tests.rs b/crates/engine/src/selection_behaviour_tests.rs index c58527286..6422f4b93 100644 --- a/crates/engine/src/selection_behaviour_tests.rs +++ b/crates/engine/src/selection_behaviour_tests.rs @@ -214,8 +214,8 @@ fn marquee_selects_what_it_touches() { (450.0, 40.0), NONE, vec![], - vec![], - "from the canvas, a top-level frame is selected only when the marquee covers all of it", + vec![k.g, k.n], + "from the canvas, a partly covered top-level frame gives the layers in it the marquee touches (measured); the nested frame comes whole", ), ((-10.0, -10.0), (450.0, 310.0), NONE, vec![], vec![k.f], "a marquee covering a top-level frame selects the frame"), ( diff --git a/crates/engine/src/selection_depth_tests.rs b/crates/engine/src/selection_depth_tests.rs index 5897ac6fd..a754e7343 100644 --- a/crates/engine/src/selection_depth_tests.rs +++ b/crates/engine/src/selection_depth_tests.rs @@ -66,10 +66,10 @@ fn cmd_click_selects_the_nested_layer() { #[test] fn cmd_marquee_selects_nested_layers() { let mut s = Session::new(); - let (f, _, [a, b, c], out) = scene(&mut s); - // From empty canvas, a plain marquee across the frame only touches top-level layers (and the - // frame isn't fully covered). - assert_eq!(marquee(&mut s, (-10.0, 10.0), (500.0, 70.0), false, false), vec![out]); + let (f, g, [a, b, c], out) = scene(&mut s); + // From empty canvas, a plain marquee across the frame (not fully covered) gives the layers in it + // it touches (the group whole), plus the top-level layer. + assert_eq!(sorted(marquee(&mut s, (-10.0, 10.0), (500.0, 70.0), false, false)), sorted(vec![g, out])); // Cmd/Ctrl: the innermost layers it touches, through the frame and the group. assert_eq!(sorted(marquee(&mut s, (-10.0, 10.0), (500.0, 70.0), false, true)), sorted(vec![a, b, out])); assert_eq!(sorted(marquee(&mut s, (-10.0, 10.0), (100.0, 190.0), false, true)), sorted(vec![a, b, c])); diff --git a/docs/mcp.md b/docs/mcp.md index 04b37e1f0..1c582b0f3 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -675,8 +675,8 @@ on; `key` resolves keys the way the canvas does. Commands behind keys: panel has the keyboard (after F6 or a click on a row), else on the canvas below the selection; the menu takes the keyboard and gives it back when it closes (no-op headless). - `select.area {x, y, width, height, add?, deep?}`: select what a marquee from `x, y` over that box - (page units) would: top-level layers, a frame only when the box covers it, the children of the - top-level frame the box starts in; `add` toggles like a Shift marquee, `deep` takes nested layers + (page units) would: the top-level layers it touches (a rotated shape by its outline), a frame or section + only when the box covers it and otherwise the layers in it the box touches, never the frame the box starts in; `add` toggles like a Shift marquee, `deep` takes nested layers like Cmd/Ctrl. Returns `{selection}`. Without a box (`F8` in the app) it draws one for the keyboard around the selection (or in the middle of the view): the arrows move it, Shift+arrows move its far corner (10 screen pixels a press), Enter selects (Shift+Enter adds, Cmd/Ctrl+Enter @@ -2059,7 +2059,7 @@ turned off 0°. / Shift+Enter), `select.next` / `select.previous` (Tab / Shift+Tab). With `pointer`, `cmd: true` clicks select the nested layer, `cmd` drags from empty canvas select the nested layers they touch, and `shift` drags toggle what they touch. A press on the background of a top-level frame with - layers in it (the frame not selected) starts a marquee inside it, as on the canvas; an empty frame + layers in it (the frame not selected) starts a marquee, as on the canvas; an empty frame is picked and dragged. Locked layers (selectable with `select.set`) get no handles and stay put when the rest of the selection is dragged. `select.all` / `select.inverse` skip hidden and locked layers. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 224286838..59583fd13 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-10 · **Change:** minor (the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame never selects that frame (`marquee_behaviour_tests`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -56,7 +56,7 @@ interaction feel not yet compared. | Item | Status | Notes | |---|---|---| -| Click, Shift-click, marquee, Shift-marquee toggle | done | Shift-drag on a selected layer moves the selection, kept to one axis (#498); a marquee selects what it touches; from a top-level frame's background, the layers inside it; locked and hidden layers are skipped (`selection_behaviour_tests`) (a locked layer selected from the panel ignores the arrow keys and the nudge commands; its properties still edit; measured in Figma's web app, 2026-11-10) | +| Click, Shift-click, marquee, Shift-marquee toggle | done | Shift-drag on a selected layer moves the selection, kept to one axis (#498); a marquee selects the top-level layers it touches, by the box and a rotated shape by its outline (rectangle and ellipse measured, the other shapes by the same code); a partly covered top-level frame or section gives the layers in it the marquee touches, an enclosed one is selected itself, an empty frame on touch; a drag from a frame's background never selects that frame and also takes what it touches outside it; selecting a frame whole keeps the marquee at the top level (a partly covered frame then comes whole too); locked and hidden layers are skipped (`marquee_behaviour_tests`, `selection_behaviour_tests`; measured in Figma's web app, 2026-11-11; Shift and Cmd/Ctrl marquees not measured) (a locked layer selected from the panel ignores the arrow keys and the nudge commands; its properties still edit; measured in Figma's web app, 2026-11-10) | | Deep select (Cmd/Ctrl-click, Cmd/Ctrl-marquee) | done | | | Select layer menu (every layer under the click) | done | | | Enter / Shift+Enter (children / parent), Tab / Shift+Tab (siblings) | done | Tab renames the next layer while renaming | @@ -187,6 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-11 | patch | M5, gap 4: marquee selection as measured in Figma's web app (Select layers and objects, Selection marquee): a partly covered top-level frame or section gives the layers in it the marquee touches (it was selected only when enclosed, so nothing came), an empty frame is selected on touch, a rotated shape is touched by its outline and not its box, a drag from inside a frame never selects that frame and also takes the top-level layers it touches outside it, and selecting a frame whole keeps the marquee at the top level (a partly covered frame then comes whole, not its layers). Flipped: `marquee_selects_what_it_touches`, `cmd_marquee_selects_nested_layers`, `a_box_selects_like_a_marquee`. Tests: `marquee_behaviour_tests`. Counts unchanged | | 2026-11-10 | patch | M5, #1560: locked layers follow Figma's rules (Lock and unlock layers; measured in Figma's web app): a locked layer selected in the Layers panel ignores the arrow keys and the nudge commands while its properties still edit, and a child of a locked layer keeps its padlock inert (the Layers panel padlock, Lock/Unlock and `object.toggleLock` without a value no longer lock the child on its own) | | 2026-11-10 | patch | #2217: the main menu's submenus (Object, say) ran past the window's bottom, behind the taskbar, with the lowest commands out of reach, because submenus were not constrained to the window (to keep them beside their row). Every menu panel now scrolls when taller than the window less 8 pt margins, and a submenu is held within the window's height (moved up, never above the top) while keeping its place beside its row, so menu-aim is unchanged. Tests: `menu_overflow_tests.rs`. Numbers unchanged. | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | From 604c78466cc0aef37b8b7a814e05e492381cab56 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 17:40:52 -0500 Subject: [PATCH 159/239] M5: marquee: a drag from inside a frame takes it whole when it takes another top-level frame, as re-measured In top-level mode the frame the drag started in is now selected whole (re-measure 2: [F1, F2], R1 not selected); with no other frame taken only the touched shapes are. Test 9 uses the re-measure's literal marquees; docs reworded and docs/mcp.md rewrapped. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 briefed; Sonnet 5.5 wrote at medium --- crates/doc/src/geometry.rs | 16 +++++---- crates/engine/src/marquee_behaviour_tests.rs | 34 +++++++++++++++----- docs/mcp.md | 7 ++-- docs/ui-parity.md | 6 ++-- 4 files changed, 43 insertions(+), 20 deletions(-) diff --git a/crates/doc/src/geometry.rs b/crates/doc/src/geometry.rs index c9cc9958b..479ca439b 100644 --- a/crates/doc/src/geometry.rs +++ b/crates/doc/src/geometry.rs @@ -454,7 +454,8 @@ fn path_touches_rect(n: &Node, path: &BezPath, xf: figcraft_geom::Affine, rect: /// Whether a marquee takes a touched top-level layer whole, opens it for the layers in it, or skips it. enum Touch { Whole, - /// The frame the drag started in: only the layers in it the marquee touches. + /// The frame the drag started in: the layers in it the marquee touches, or the frame itself + /// (whole) once the marquee is at the top level. Open, /// A partly covered frame or section: the layers in it, or the frame itself once the marquee is at the top level. Partial, @@ -464,9 +465,10 @@ enum Touch { /// Figma's marquee rule (measured in the web app, 2026-11-11): each top-level layer the marquee /// touches is selected whole, except a frame with children or a section with its contents shown: /// enclosed by the marquee it is selected itself, otherwise the marquee takes the layers in it that -/// it touches. The frame the drag started in (`start_inside`) is never selected itself, only the -/// layers in it the marquee touches. Selecting a frame or section whole keeps the marquee at the -/// top level: no frame opens then, and a partly covered one is selected whole. Components, instances, board items and sections with hidden +/// it touches. The frame the drag started in (`start_inside`) is selected only when the marquee also +/// takes another top-level frame (then whole); otherwise only the layers in it the marquee touches. +/// Selecting a frame or section whole keeps the marquee at the top level: no frame opens then, and a +/// partly covered one is selected whole. Components, instances, board items and sections with hidden /// contents are selected only when enclosed. pub fn marquee_select(doc: &Document, page: NodeId, rect: Rect, start_inside: Option) -> Vec { let Some(page_node) = doc.node(page) else { return Vec::new() }; @@ -500,13 +502,13 @@ pub fn marquee_select(doc: &Document, page: NodeId, rect: Rect, start_inside: Op for (t, act, _) in &classified { match act { Touch::Whole => out.push(*t), - Touch::Partial if top_level_mode => out.push(*t), - Touch::Open | Touch::Partial if !top_level_mode => { + Touch::Open | Touch::Partial if top_level_mode => out.push(*t), + Touch::Open | Touch::Partial => { if let Some(n) = doc.node(*t) { out.extend(marquee_children(doc, n, rect)); } } - Touch::Open | Touch::Partial | Touch::Skip => {} + Touch::Skip => {} } } out diff --git a/crates/engine/src/marquee_behaviour_tests.rs b/crates/engine/src/marquee_behaviour_tests.rs index 90c37ccd1..cede8c253 100644 --- a/crates/engine/src/marquee_behaviour_tests.rs +++ b/crates/engine/src/marquee_behaviour_tests.rs @@ -1,8 +1,8 @@ //! Marquee selection, as measured in Figma's web app (2026-11-11, the "marquee rules" and "confirming -//! pass" readings) and described in the help-center article "Select layers and objects": a drag +//! pass" readings, and the two evening re-measures) and described in the help-center article "Select layers and objects": a drag //! selects each top-level layer it touches; a partly covered frame or section gives the layers in it -//! the marquee touches, an enclosed one is selected itself; a drag started inside a frame never selects -//! that frame; selecting a frame whole keeps the marquee at the top level; a rotated shape is touched by +//! the marquee touches, an enclosed one is selected itself; a drag started inside a frame selects that frame +//! only when the marquee also takes another top-level frame (then whole); selecting a frame whole keeps the marquee at the top level; a rotated shape is touched by //! its outline, an unrotated one by its box. use serde_json::{Value, json}; @@ -154,17 +154,18 @@ fn a_rotated_ellipse_is_not_touched_by_its_axis_aligned_box() { fn a_rotated_ellipse_is_not_touched_through_the_corner_of_its_turned_box() { let mut s = Session::new(); let k = scene(&mut s); - // Not the measurement's literal numbers (see the brief, section 5): a point inside the turned box - // but outside the ellipse. - let p = Point::new(690.0, 420.0); + // The re-measure's literal marquees (evening, section 1): corner A, the deeper B, and the control. + let p = Point::new(692.0, 419.0); let doc = s.doc().unwrap(); let n = doc.node(k.re).unwrap(); assert!(n.local_rect().contains(doc.world_transform(k.re).inverse() * p), "the probe is inside the turned box"); - assert_eq!(selected(&mut s, (727.0, 407.0), (690.0, 420.0)), Vec::::new()); + assert_eq!(selected(&mut s, (715.0, 411.0), (692.0, 419.0)), Vec::::new(), "measured marquee A"); + assert_eq!(selected(&mut s, (715.0, 411.0), (683.0, 419.0)), Vec::::new(), "measured marquee B"); + assert_eq!(selected(&mut s, (715.0, 411.0), (667.0, 419.0)), vec![k.re], "measured control"); } #[test] -fn a_drag_from_inside_a_frame_never_selects_it() { +fn a_drag_from_inside_a_frame_selects_only_what_it_touches() { let mut s = Session::new(); let k = scene(&mut s); let start_x = |s: &Session| s.doc().unwrap().world_bounds(k.f1).map(|b| (b.x0, b.y0)); @@ -198,3 +199,20 @@ fn a_marquee_enclosing_an_empty_frame_takes_a_partly_covered_frame_whole() { let f2 = id(&ex(&mut s, "frame.create", json!({"x": 400, "y": 0, "width": 200, "height": 150}))); assert_eq!(selected(&mut s, (650.0, 170.0), (40.0, -10.0)), sorted(vec![f1, f2]), "measured re-measure: F2 and F1, not R1"); } + +#[test] +fn a_drag_from_inside_a_frame_takes_it_whole_when_it_takes_another_top_level_frame() { + let mut s = Session::new(); + let f1 = id(&ex(&mut s, "frame.create", json!({"x": 0, "y": 0, "width": 300, "height": 200}))); + let r1 = rect(&mut s, 20.0, 20.0, 60.0, 60.0, Some(f1)); + let _r2 = rect(&mut s, 220.0, 120.0, 60.0, 60.0, Some(f1)); + let f2 = id(&ex(&mut s, "frame.create", json!({"x": 0, "y": 400, "width": 200, "height": 150}))); + let rr = rect(&mut s, 400.0, 400.0, 200.0, 100.0, None); + ex(&mut s, "select.none", json!({})); + assert_eq!(selected(&mut s, (150.0, 100.0), (90.0, 720.0)), sorted(vec![f1, f2]), "re-measure 2, case 1"); + let sel = selected(&mut s, (150.0, 50.0), (50.0, 720.0)); + assert_eq!(sel, sorted(vec![f1, f2]), "re-measure 2, case 2b: R1 is covered in part and still not selected"); + assert!(!sel.contains(&r1)); + assert_eq!(selected(&mut s, (150.0, 100.0), (450.0, 450.0)), sorted(vec![f1, f2, rr]), "re-measure 2, case 3"); + assert_eq!(selected(&mut s, (290.0, 100.0), (450.0, 450.0)), vec![rr], "re-measure 2, case 3b: the frame only when another is taken"); +} diff --git a/docs/mcp.md b/docs/mcp.md index 1c582b0f3..5ff485795 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -675,8 +675,11 @@ on; `key` resolves keys the way the canvas does. Commands behind keys: panel has the keyboard (after F6 or a click on a row), else on the canvas below the selection; the menu takes the keyboard and gives it back when it closes (no-op headless). - `select.area {x, y, width, height, add?, deep?}`: select what a marquee from `x, y` over that box - (page units) would: the top-level layers it touches (a rotated shape by its outline), a frame or section - only when the box covers it and otherwise the layers in it the box touches, never the frame the box starts in; `add` toggles like a Shift marquee, `deep` takes nested layers + (page units) would: the top-level layers it touches (a rotated shape by its outline); an empty + frame on touch; any other frame or section only when the box covers it, otherwise the layers in it + the box touches, except that once the box takes a frame whole, a partly covered frame comes whole + too, and the frame the box starts in is selected only then (when the box also takes another + top-level frame); `add` toggles like a Shift marquee, `deep` takes nested layers like Cmd/Ctrl. Returns `{selection}`. Without a box (`F8` in the app) it draws one for the keyboard around the selection (or in the middle of the view): the arrows move it, Shift+arrows move its far corner (10 screen pixels a press), Enter selects (Shift+Enter adds, Cmd/Ctrl+Enter diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 59583fd13..3c9abe701 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-11 · **Change:** minor (the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame never selects that frame (`marquee_behaviour_tests`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -56,7 +56,7 @@ interaction feel not yet compared. | Item | Status | Notes | |---|---|---| -| Click, Shift-click, marquee, Shift-marquee toggle | done | Shift-drag on a selected layer moves the selection, kept to one axis (#498); a marquee selects the top-level layers it touches, by the box and a rotated shape by its outline (rectangle and ellipse measured, the other shapes by the same code); a partly covered top-level frame or section gives the layers in it the marquee touches, an enclosed one is selected itself, an empty frame on touch; a drag from a frame's background never selects that frame and also takes what it touches outside it; selecting a frame whole keeps the marquee at the top level (a partly covered frame then comes whole too); locked and hidden layers are skipped (`marquee_behaviour_tests`, `selection_behaviour_tests`; measured in Figma's web app, 2026-11-11; Shift and Cmd/Ctrl marquees not measured) (a locked layer selected from the panel ignores the arrow keys and the nudge commands; its properties still edit; measured in Figma's web app, 2026-11-10) | +| Click, Shift-click, marquee, Shift-marquee toggle | done | Shift-drag on a selected layer moves the selection, kept to one axis (#498); a marquee selects the top-level layers it touches, by the box and a rotated shape by its outline (rectangle and ellipse measured, the other shapes by the same code); a partly covered top-level frame or section gives the layers in it the marquee touches, an enclosed one is selected itself, an empty frame on touch; a drag from a frame's background selects that frame only when the marquee also takes another top-level frame (then whole), and also takes what it touches outside it; selecting a frame whole keeps the marquee at the top level (a partly covered frame then comes whole too); locked and hidden layers are skipped (`marquee_behaviour_tests`, `selection_behaviour_tests`; measured in Figma's web app, 2026-11-11; Shift and Cmd/Ctrl marquees not measured) (a locked layer selected from the panel ignores the arrow keys and the nudge commands; its properties still edit; measured in Figma's web app, 2026-11-10) | | Deep select (Cmd/Ctrl-click, Cmd/Ctrl-marquee) | done | | | Select layer menu (every layer under the click) | done | | | Enter / Shift+Enter (children / parent), Tab / Shift+Tab (siblings) | done | Tab renames the next layer while renaming | @@ -187,7 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| -| 2026-11-11 | patch | M5, gap 4: marquee selection as measured in Figma's web app (Select layers and objects, Selection marquee): a partly covered top-level frame or section gives the layers in it the marquee touches (it was selected only when enclosed, so nothing came), an empty frame is selected on touch, a rotated shape is touched by its outline and not its box, a drag from inside a frame never selects that frame and also takes the top-level layers it touches outside it, and selecting a frame whole keeps the marquee at the top level (a partly covered frame then comes whole, not its layers). Flipped: `marquee_selects_what_it_touches`, `cmd_marquee_selects_nested_layers`, `a_box_selects_like_a_marquee`. Tests: `marquee_behaviour_tests`. Counts unchanged | +| 2026-11-11 | patch | M5, gap 4: marquee selection as measured in Figma's web app (Select layers and objects, Selection marquee): a partly covered top-level frame or section gives the layers in it the marquee touches (it was selected only when enclosed, so nothing came), an empty frame is selected on touch, a rotated shape is touched by its outline and not its box, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole), and also takes the top-level layers it touches outside it, and selecting a frame whole keeps the marquee at the top level (a partly covered frame then comes whole, not its layers). Flipped: `marquee_selects_what_it_touches`, `cmd_marquee_selects_nested_layers`, `a_box_selects_like_a_marquee`. Tests: `marquee_behaviour_tests`. Counts unchanged | | 2026-11-10 | patch | M5, #1560: locked layers follow Figma's rules (Lock and unlock layers; measured in Figma's web app): a locked layer selected in the Layers panel ignores the arrow keys and the nudge commands while its properties still edit, and a child of a locked layer keeps its padlock inert (the Layers panel padlock, Lock/Unlock and `object.toggleLock` without a value no longer lock the child on its own) | | 2026-11-10 | patch | #2217: the main menu's submenus (Object, say) ran past the window's bottom, behind the taskbar, with the lowest commands out of reach, because submenus were not constrained to the window (to keep them beside their row). Every menu panel now scrolls when taller than the window less 8 pt margins, and a submenu is held within the window's height (moved up, never above the top) while keeping its place beside its row, so menu-aim is unchanged. Tests: `menu_overflow_tests.rs`. Numbers unchanged. | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | From accdfbae260e5cde81501017393a61ab35cd6dc0 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 18:38:18 -0500 Subject: [PATCH 160/239] M3, #2196: ui-parity rotation row states the flipped-ancestor limit and that it was not measured Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- docs/ui-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index caad55b12..882c3293b 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -187,7 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| -| 2026-11-10 | minor | The Rotation field shows and sets the layer's rotation on the page (its own angle plus its parents'), in frames and groups alike, as measured in Figma's web app (#2196) | +| 2026-11-10 | minor | The Rotation field shows and sets the layer's rotation on the page (its own angle plus its parents' when no ancestor is flipped; with a flipped ancestor FigCraft reads the composed angle, which flips the sign of the layer's own angle, and Figma's behaviour there was not measured), in frames and groups alike, as measured in Figma's web app for rotated, unflipped parents (#2196) | | 2026-11-10 | patch | M5, #1560: locked layers follow Figma's rules (Lock and unlock layers; measured in Figma's web app): a locked layer selected in the Layers panel ignores the arrow keys and the nudge commands while its properties still edit, and a child of a locked layer keeps its padlock inert (the Layers panel padlock, Lock/Unlock and `object.toggleLock` without a value no longer lock the child on its own) | | 2026-11-10 | patch | #2217: the main menu's submenus (Object, say) ran past the window's bottom, behind the taskbar, with the lowest commands out of reach, because submenus were not constrained to the window (to keep them beside their row). Every menu panel now scrolls when taller than the window less 8 pt margins, and a submenu is held within the window's height (moved up, never above the top) while keeping its place beside its row, so menu-aim is unchanged. Tests: `menu_overflow_tests.rs`. Numbers unchanged. | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | From c93d6c465e1b9cf117805b0e0687cedd0fc9f1e2 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 18:38:20 -0500 Subject: [PATCH 161/239] M3, #2188: ui-parity limits the measurement claim to the tested examples, not instances Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- docs/ui-parity.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 88180c647..825e0717b 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-10 · **Change:** minor (Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 (#2188); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; instances and components were not measured (#2188); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -80,7 +80,7 @@ interaction feel not yet compared. | Smart selection spacing | partial | with layers in a row, a column or an aligned grid selected, the Layout section shows horizontal and vertical spacing ("Mixed" until set; typed, scrubbed, fractional and negative) and pink handles in the gaps on the canvas drag them, one undo step, Escape cancels (`arrange.spacing`; sizes, parents and offsets within each track kept; at most 2,000 layers; flow children, locked layers and layers inside instances left out). A ring at each layer's centre drags it to another place in a regular row, column or complete top-left-aligned grid: the others close up and make room around it with the gaps kept, and with Cmd/Ctrl held the two layers swap places instead, previewed live while dragging (`selection_reorder_tests`; no ring on a layer under 16 px on screen). Not covered: reordering irregular grids, and several marked layers moved together. Checked by its author on macOS and in the app on Windows (#402) | | Selection colors | partial | the Design panel shows the section from two distinct colours, or from one when a selected layer has children (a frame, group, component or instance), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also offers enabled libraries' published color styles and Create style (`selection.createColorStyle`); no library variables and no new variable from a row (#403) | | Keyboard box selection | done | Alt+Space on macOS, Ctrl+Space on Windows and Linux, or F8 (`select.area`): a box around the selection or in the middle of the view; arrows move it, Cmd/Ctrl+arrows or Shift+arrows size it (Shift with Cmd/Ctrl: farther), Enter selects like a marquee (Shift+Enter toggles, Cmd/Ctrl+Enter nested), Escape closes; Tab while the box shows, or the chord again, switches to pick select: a pink outline on the first selected layer (the page's top layer with nothing selected), Tab and Shift+Tab move it between sibling layers in Layers order, Enter into a frame's top child, Shift+Enter out to the parent, Space selects it, Escape or a press on the canvas ends it; `ui.key` takes the same keys (#1836) | -| Selection colors | partial | the Design panel shows the section from two distinct colours, or from one when a selected layer has children (a frame, group, component or instance; a lone layer without children, or several layers without children in one colour, hide it), counting the selected layers' own fills and strokes and their descendants' (measured in Figma's web app, 2026-11-09, #2188), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also lists each enabled library's published color styles under the library's name (a library that can't be read offers none), and a linked row's menu switches it to another style; a library style is copied in, linked and read-only, in the same undo step (`selection.applyColorStyle` with `library`). Create style on an ordinary row asks for a name (the next free "Color n" first) and makes a style of the row's whole paint, gradients, opacity, blend mode and variables bound to gradient stops included, linked to every fill and stroke the row stands for in one undo step; a name in use keeps the window open (`selection.createColorStyle`). Text ranges with fills of their own take the style's value, without a link. No library variables from there, and no new variable from a row (#403) | +| Selection colors | partial | the Design panel shows the section from two distinct colours, or from one when a selected layer has children (a frame, group, component or instance; a lone layer without children, or several layers without children in one colour, hide it), counting the selected layers' own fills and strokes and their descendants' (measured in Figma's web app, 2026-11-09, #2188, on frames, groups and rectangles only; the rule for components and instances is not measured), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also lists each enabled library's published color styles under the library's name (a library that can't be read offers none), and a linked row's menu switches it to another style; a library style is copied in, linked and read-only, in the same undo step (`selection.applyColorStyle` with `library`). Create style on an ordinary row asks for a name (the next free "Color n" first) and makes a style of the row's whole paint, gradients, opacity, blend mode and variables bound to gradient stops included, linked to every fill and stroke the row stands for in one undo step; a name in use keeps the window open (`selection.createColorStyle`). Text ranges with fills of their own take the style's value, without a link. No library variables from there, and no new variable from a row (#403) | | Keyboard box selection | done | Alt+Space on macOS, Ctrl+Space on Windows and Linux, or F8 (`select.area`): a box around the selection or in the middle of the view; arrows move it, Cmd/Ctrl+arrows or Shift+arrows size it (Shift with Cmd/Ctrl: farther), Enter selects like a marquee (Shift+Enter toggles, Cmd/Ctrl+Enter nested), Escape closes | ## Tools @@ -187,7 +187,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| -| 2026-11-09 | patch | M3, #2188: Selection colors shows for a selection holding a layer with children (a frame, group, component or instance) from one distinct colour, and for layers without children only from two, as measured in Figma's web app on 2026-11-09: a frame holding one red rectangle, a group of two red rectangles and a frame with a lone black-stroked rectangle show one row; one red rectangle, two red rectangles and a childless green frame show none; a red and a blue loose rectangle show two. Tests: `selection_colors_tests`. Counts unchanged | +| 2026-11-09 | patch | M3, #2188: Selection colors shows for a selection holding a layer with children (a frame, group, component or instance) from one distinct colour, and for layers without children only from two; measured in Figma's web app on 2026-11-09 for the examples below only, and instance and component behaviour was not measured: a frame holding one red rectangle, a group of two red rectangles and a frame with a lone black-stroked rectangle show one row; one red rectangle, two red rectangles and a childless green frame show none; a red and a blue loose rectangle show two. Tests: `selection_colors_tests`. Counts unchanged | | 2026-11-10 | patch | M5, #1560: locked layers follow Figma's rules (Lock and unlock layers; measured in Figma's web app): a locked layer selected in the Layers panel ignores the arrow keys and the nudge commands while its properties still edit, and a child of a locked layer keeps its padlock inert (the Layers panel padlock, Lock/Unlock and `object.toggleLock` without a value no longer lock the child on its own) | | 2026-11-10 | patch | #2217: the main menu's submenus (Object, say) ran past the window's bottom, behind the taskbar, with the lowest commands out of reach, because submenus were not constrained to the window (to keep them beside their row). Every menu panel now scrolls when taller than the window less 8 pt margins, and a submenu is held within the window's height (moved up, never above the top) while keeping its place beside its row, so menu-aim is unchanged. Tests: `menu_overflow_tests.rs`. Numbers unchanged. | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | From 3c70b08fd541aa50389390e3adfb7bb98b6b2c41 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 12 Nov 2026 09:16:08 +0700 Subject: [PATCH 162/239] Spanish labels for the Annotation tool --- crates/ui-egui/locales/es.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/ui-egui/locales/es.toml b/crates/ui-egui/locales/es.toml index 258a1527d..c29c5b6c5 100644 --- a/crates/ui-egui/locales/es.toml +++ b/crates/ui-egui/locales/es.toml @@ -22,6 +22,7 @@ status = "draft — needs native review" "Along the top" = "A lo largo del borde superior" "An earlier vote" = "Una votación anterior" "Android Vector Drawable" = "Android Vector Drawable" +"Annotation" = "Anotación" "Best effort" = "Mejor aproximación" "Between the selected layers" = "Entre las capas seleccionadas" "Brainstorm" = "Lluvia de ideas" @@ -2365,6 +2366,7 @@ status = "draft — needs native review" "text.underline" = "Subrayado" "text.weightDown" = "Reducir peso de fuente" "text.weightUp" = "Aumentar peso de fuente" +"tool.annotation" = "Anotación" "tool.arrow" = "Flecha" "tool.comment" = "Comentario" "tool.connector" = "Conector" From a69b27fd1e66af3f3bfffbc73f82bc4758f76428 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 12 Nov 2026 09:16:53 +0700 Subject: [PATCH 163/239] Spanish labels for Invert zoom direction --- crates/ui-egui/locales/es.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/ui-egui/locales/es.toml b/crates/ui-egui/locales/es.toml index 258a1527d..1dfdc7076 100644 --- a/crates/ui-egui/locales/es.toml +++ b/crates/ui-egui/locales/es.toml @@ -35,6 +35,7 @@ status = "draft — needs native review" "Couldn't download the variables" = "No se pudieron descargar las variables" "Couldn't download {name}" = "No se pudo descargar {name}" "Create from color" = "Crear a partir del color" +"Invert zoom direction" = "Invertir la dirección del zoom" "New collection" = "Nueva colección" "Delete results" = "Eliminar resultados" "Pasted design layers" = "Capas de diseño pegadas" @@ -2214,6 +2215,7 @@ status = "draft — needs native review" "plugins.runLast" = "Ejecutar el último plugin" "pref.autoSave" = "Guardar archivos automáticamente" "pref.highlightHover" = "Resaltar capas al pasar el cursor" +"pref.invertZoom" = "Invertir la dirección del zoom" "pref.keepTool" = "Mantener la herramienta tras usarla" "pref.language" = "Idioma de la interfaz" "pref.nudge" = "Cantidad de desplazamiento" From 82da8f513acdcb49f75cec25685c7e74874178fd Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 12 Nov 2026 09:19:05 +0700 Subject: [PATCH 164/239] file.openRecent: check the index with the shared req_index --- crates/engine/src/cmd/file/open.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/file/open.rs b/crates/engine/src/cmd/file/open.rs index b6e154c35..ea9a0d90a 100644 --- a/crates/engine/src/cmd/file/open.rs +++ b/crates/engine/src/cmd/file/open.rs @@ -30,11 +30,9 @@ pub(super) fn open_recent(s: &mut Session, p: &Value) -> Result { allow(&path, Access::Read)?; Some(path) } - (None, Some(i)) => { - if !(i >= 0.0 && i.fract() == 0.0) { - return Err(bad(CMD, "no such recent file")); - } - Some(s.prefs.recent_files.iter().filter(|r| listed(r)).nth(i as usize).cloned().ok_or_else(|| bad(CMD, "no such recent file"))?) + (None, Some(_)) => { + let i = req_index(CMD, p, "index")?; + Some(s.prefs.recent_files.iter().filter(|r| listed(r)).nth(i).cloned().ok_or_else(|| bad(CMD, "no such recent file"))?) } _ => None, }; From 654eb205f4423a6bda4f26b29c6d246808334ed2 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 12 Nov 2026 09:21:49 +0700 Subject: [PATCH 165/239] Wrap style: describe the three levels in our own words --- crates/doc/src/text.rs | 4 ++-- crates/engine/src/styles_behaviour_tests.rs | 4 ++-- crates/engine/src/text_behaviour_tests.rs | 4 ++-- docs/ui-parity.md | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/doc/src/text.rs b/crates/doc/src/text.rs index 5ee10f5df..1229fbe48 100644 --- a/crates/doc/src/text.rs +++ b/crates/doc/src/text.rs @@ -293,8 +293,8 @@ pub struct ParaList { /// The paragraph's base direction (Text ▸ Text direction); `Auto` follows its letters. #[serde(skip_serializing_if = "crate::node::is_default")] pub direction: TextDirection, - /// The paragraph's own wrap style ("You can apply a wrap style at three levels: Text layer, - /// Paragraph, Text style"); `None` follows the layer's [`TextData::wrap_style`]. + /// The paragraph's own wrap style (a wrap style can be set on the text layer, a paragraph or a + /// text style); `None` follows the layer's [`TextData::wrap_style`]. #[serde(skip_serializing_if = "Option::is_none")] pub wrap: Option, } diff --git a/crates/engine/src/styles_behaviour_tests.rs b/crates/engine/src/styles_behaviour_tests.rs index 0dd38d76f..6fd0ff829 100644 --- a/crates/engine/src/styles_behaviour_tests.rs +++ b/crates/engine/src/styles_behaviour_tests.rs @@ -420,8 +420,8 @@ fn text_styles_carry_paragraph_spacing_indent_lists_and_features() { #[test] fn text_styles_carry_the_wrap_style() { - // Explore text properties: "You can apply a wrap style at three levels: Text layer, - // Paragraph, Text style." A style made from a text takes its wrap style, applying it sets it, + // Explore text properties: a wrap style can be set on the text layer, a paragraph or a text + // style. A style made from a text takes its wrap style, applying it sets it, // editing it on a styled text unlinks it. use figcraft_doc::WrapStyle::{Auto, Balance, Pretty}; let mut s = Session::new(); diff --git a/crates/engine/src/text_behaviour_tests.rs b/crates/engine/src/text_behaviour_tests.rs index f6a308eec..74a013e90 100644 --- a/crates/engine/src/text_behaviour_tests.rs +++ b/crates/engine/src/text_behaviour_tests.rs @@ -497,8 +497,8 @@ fn balance_and_pretty_wrap_styles_break_lines_as_documented() { #[test] fn wrap_style_per_paragraph_overrides_the_layers() { - // Explore text properties: "You can apply a wrap style at three levels: Text layer, - // Paragraph, Text style." A paragraph's own wrap style beats the layer's; setting the layer + // Explore text properties: a wrap style can be set on the text layer, a paragraph or a text + // style. A paragraph's own wrap style beats the layer's; setting the layer // sets every paragraph again. let font = test_mono_font(); let mut s = Session::new(); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index fceff35ce..a66c75ac7 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -96,7 +96,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); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | | 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: wrap style (Auto, Balance, Pretty) | done | per text layer (`wrapStyle` on `node.set`, `text.wrapStyle`, the Type settings control under Vertical trim, inspect, CSS `text-wrap: balance` or `pretty`): Auto breaks greedily; Balance narrows each paragraph as far as it goes without another line, so its lines come out close to the same length (what browsers do for `text-wrap: balance`); Pretty keeps lines full and, when the last line is one word, narrows one of the last four lines just enough to give a word to the lines after it (Explore text properties: "Auto: Figma fits as many words as possible on each line before wrapping to the next", "Balance: Figma distributes text as evenly as possible across every line, so each line is close to the same length", "Pretty: Figma keeps each line full, but adjusts the last four lines to avoid an orphan"). Saved line breaks from a file still win. At three levels, as "You can apply a wrap style at three levels: Text layer, Paragraph, Text style" says: the paragraph level is the caret's or the selection's paragraphs while editing (`text.wrapStyle`; the control follows them), or `start`/`end` on `node.set wrapStyle` (a paragraph's own style beats the layer's; setting the layer sets every paragraph again; Enter carries it to the new paragraph; inspect reports `lineWrapStyles` when paragraphs differ and CSS `text-wrap` only when they agree); the text-style level is a style's `wrapStyle` (shown read-only in the style editor, applied with the style, moved by `style.update`, unlinking when edited). The `.fig` import/export mapping stays open (#1827): a `.fig` export leaves the wrap styles out and a `.fig` import reads every text as Auto, so the wrap styles are lost through a `.fig` round trip. Test: `text_behaviour_tests::wrap_style_per_paragraph_overrides_the_layers`, `styles_behaviour_tests::text_styles_carry_the_wrap_style`, `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented` | +| Text: wrap style (Auto, Balance, Pretty) | done | per text layer (`wrapStyle` on `node.set`, `text.wrapStyle`, the Type settings control under Vertical trim, inspect, CSS `text-wrap: balance` or `pretty`): Auto breaks greedily; Balance narrows each paragraph as far as it goes without another line, so its lines come out close to the same length (what browsers do for `text-wrap: balance`); Pretty keeps lines full and, when the last line is one word, narrows one of the last four lines just enough to give a word to the lines after it (Explore text properties: "Auto: Figma fits as many words as possible on each line before wrapping to the next", "Balance: Figma distributes text as evenly as possible across every line, so each line is close to the same length", "Pretty: Figma keeps each line full, but adjusts the last four lines to avoid an orphan"). Saved line breaks from a file still win. At three levels (the text layer, a paragraph and a text style, per Explore text properties): the paragraph level is the caret's or the selection's paragraphs while editing (`text.wrapStyle`; the control follows them), or `start`/`end` on `node.set wrapStyle` (a paragraph's own style beats the layer's; setting the layer sets every paragraph again; Enter carries it to the new paragraph; inspect reports `lineWrapStyles` when paragraphs differ and CSS `text-wrap` only when they agree); the text-style level is a style's `wrapStyle` (shown read-only in the style editor, applied with the style, moved by `style.update`, unlinking when edited). The `.fig` import/export mapping stays open (#1827): a `.fig` export leaves the wrap styles out and a `.fig` import reads every text as Auto, so the wrap styles are lost through a `.fig` round trip. Test: `text_behaviour_tests::wrap_style_per_paragraph_overrides_the_layers`, `styles_behaviour_tests::text_styles_carry_the_wrap_style`, `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented` | | Text: direction override (Text ▸ Text direction) | done | per paragraph (`ParaList::direction`: auto, ltr, rtl): Text ▸ Text direction ▸ Auto / Left to right / Right to left and `text.direction {direction, ids?}` set the edited paragraphs while editing, else every paragraph of the selected texts; `node.set textDirection` the layer's (or the chars `start`/`end` name); the Type settings control appears once a right-to-left script is in the text or a direction is forced; inspect reports `textDirection` when the paragraphs agree and `lineDirections` otherwise; Developer Mode's CSS writes `direction: ltr` or `rtl` when every paragraph is forced the same way (with `text-align: left` beside `rtl`, as Left is absolute on the canvas); `.fig` import and export carry each line's `sourceDirectionality`, read up to the paragraph count. Layout gives the paragraph its base level, so a forced right-to-left paragraph of Latin letters starts at the right, mirrors its list gutter and indent and orders its runs right to left, and a forced left-to-right paragraph of Hebrew the other way ("By default, Figma automatically handles text direction based on language detection. However, controls are available to override text direction per paragraph", "Go to Text > Text direction. Select Left to right or Right to left", Add right-to-left text). Not included: a direction in text styles (the article names none). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests` | | 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`) | From b1ee6535c9aada73b0d6d6f92438864d4cc0c47a Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 12 Nov 2026 09:23:03 +0700 Subject: [PATCH 166/239] Ellipse tests: drop an unused binding and a comment about an allowance main never had --- crates/geom/src/tests.rs | 3 +-- crates/render/src/band_tests.rs | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/geom/src/tests.rs b/crates/geom/src/tests.rs index 909a3c475..059dd6098 100644 --- a/crates/geom/src/tests.rs +++ b/crates/geom/src/tests.rs @@ -341,8 +341,7 @@ fn a_whole_ellipse_is_four_cubics_through_the_extremes() { assert!((s.p3 - want[i]).hypot() < 1e-9, "{w}x{h}: anchor {i} is {:?}", s.p3); // Handle length is 0.5523 of the radius along the tangent. let k = 0.552_284_749_830_793_4; - let (r_along, r_across) = if i % 2 == 0 { (ry, rx) } else { (rx, ry) }; - let _ = r_across; + let r_along = if i % 2 == 0 { ry } else { rx }; assert!(((s.p1 - s.p0).hypot() - k * r_along).abs() < 1e-9, "{w}x{h}: handle {i}"); } } diff --git a/crates/render/src/band_tests.rs b/crates/render/src/band_tests.rs index 9fcf29f20..6cdf2cd88 100644 --- a/crates/render/src/band_tests.rs +++ b/crates/render/src/band_tests.rs @@ -96,9 +96,8 @@ fn a_real_band_artifact_fails_but_edge_noise_passes() { let width = 880; // scale 2 let flat = vec![100u8; width * 4]; // 44 pixels whose colour channels differ by 60 (alpha unchanged): the mean is - // 44 * 3 * 60 / (880 * 4) = 2.25, which the earlier `0.25 + 0.05 * off` allowance (2.45 here) - // let through; the count, 44, is within a twentieth of the row. A real artifact, so it fails - // on the mean now. + // 44 * 3 * 60 / (880 * 4) = 2.25, and the count, 44, is within a twentieth of the row. A real + // artifact, so it fails on the mean. let mut artifact = flat.clone(); for px in artifact.chunks_mut(4).take(44) { px.iter_mut().take(3).for_each(|c| *c += 60); From b640fbc1143ae12d1b55d15d4e2a33feca46efdd Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 12 Nov 2026 09:27:39 +0700 Subject: [PATCH 167/239] Docs: describe the property highlight in our own words --- docs/ui-parity.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index d90b7da9b..1d7ca5083 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -36,7 +36,7 @@ interaction feel not yet compared. | Colour picker image well | partial | the Image tab shows a checkered placeholder and Upload from computer until there is a file (no dialog at once); an image paint shows its asset preview; a file dropped on the open picker replaces the image, keeping the fill mode, crop, position and adjustments (`image.replace`). Layers' fills and strokes only (text ranges, styles and selection colours keep Upload). The Fill and Stroke swatches take no drop: a dragged file's position isn't known, so a drop with none goes to the open picker | | Colour picker on a new fill or stroke | done | + opens the picker on the new paint when the selection shares one paint list; on a mixed selection + adds a paint to each layer and no picker opens (#404) | | Fill section on a text with coloured characters | done | a text's Fill section shows what its characters show: characters coloured differently while editing are mixed content ("Click + to replace mixed content", as a mixed selection; the developer documentation's `fills`: "Text nodes can have multiple sets of fills if some characters are colored differently than others"), and characters that all share fills the layer doesn't have show those. Any layer-level fill edit (a row, its picker, +, reordering, `fill.*`, `node.set`) reaches every character, starting from the list they showed; the characters' own fills go in the same undo step; the canvas gradient and crop handles show and edit the paint the row shows, the characters' own, also when their image is already in Crop mode (`text_mixed_fill_tests`, `canvas::handles::character_fill_tests`, engine `text_fill_tests`; #1856). A range selected while editing keeps its own Fill row | -| Fill, stroke and effect rows: click to highlight, Cmd/Ctrl+C, Cmd/Ctrl+V | done | a click on a row's reorder grip (left of its fields) or its background between its controls highlights it in the selected-row colour, one row at a time; Cmd/Ctrl+C (or Edit ▸ Copy) then copies that paint or effect instead of the layers (`fill.copy`, `stroke.copy`, `effect.copy`, as the row's menu does; a stroke takes its weight and settings along) and Cmd/Ctrl+V pastes it onto every selected layer (`fill.paste`, `stroke.paste`, `effect.paste`), one undo step: on top of each layer's list, or in place of the highlighted row when it is of the same kind. A copy keeps its kind: a stroke goes to the strokes and an effect to the effects whatever row is highlighted, and the last row copied is the one pasted. A solid colour also goes to the system clipboard as its hex code; a programmatic copy never writes it. A later layer copy, or text or an image copied in another app, is pasted instead; every window pastes the same copy. Escape, a press on the canvas or elsewhere in the Design panel, another selection, file or tab let the highlight go (#1494). The help center says only "Click to highlight the property on the right sidebar"; adding on top follows the forum's accepted answer for adding one fill without replacing the others, not an observation. Delete and Cmd/Ctrl+X still act on the layers; the keyboard alone can't highlight a row | +| Fill, stroke and effect rows: click to highlight, Cmd/Ctrl+C, Cmd/Ctrl+V | done | a click on a row's reorder grip (left of its fields) or its background between its controls highlights it in the selected-row colour, one row at a time; Cmd/Ctrl+C (or Edit ▸ Copy) then copies that paint or effect instead of the layers (`fill.copy`, `stroke.copy`, `effect.copy`, as the row's menu does; a stroke takes its weight and settings along) and Cmd/Ctrl+V pastes it onto every selected layer (`fill.paste`, `stroke.paste`, `effect.paste`), one undo step: on top of each layer's list, or in place of the highlighted row when it is of the same kind. A copy keeps its kind: a stroke goes to the strokes and an effect to the effects whatever row is highlighted, and the last row copied is the one pasted. A solid colour also goes to the system clipboard as its hex code; a programmatic copy never writes it. A later layer copy, or text or an image copied in another app, is pasted instead; every window pastes the same copy. Escape, a press on the canvas or elsewhere in the Design panel, another selection, file or tab let the highlight go (#1494). The help center says only that a property is highlighted with a click; adding on top follows the forum's accepted answer for adding one fill without replacing the others, not an observation. Delete and Cmd/Ctrl+X still act on the layers; the keyboard alone can't highlight a row | | Blend mode menus: the layer's (Design panel) and each paint's (colour picker) | done | Pass through and Normal are distinct (Normal isolates a group's or frame's children); paints have no pass-through; plus darker drawn exactly on the canvas | ## Layers and Assets panels @@ -189,7 +189,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| | 2026-11-10 | patch | #2217: the main menu's submenus (Object, say) ran past the window's bottom, behind the taskbar, with the lowest commands out of reach, because submenus were not constrained to the window (to keep them beside their row). Every menu panel now scrolls when taller than the window less 8 pt margins, and a submenu is held within the window's height (moved up, never above the top) while keeping its place beside its row, so menu-aim is unchanged. Tests: `menu_overflow_tests.rs`. Numbers unchanged. | -| 2026-11-09 | minor | M1, #1494: fill, stroke and effect rows in the Design panel couldn't be selected, so the keyboard couldn't copy one (only the row's menu could). A click on a row's grip or background now highlights it (`property_rows`; the row is a click target under its controls and its grip takes a click, neither focusable, so Tab still goes control to control), Cmd/Ctrl+C copies that paint or effect, and Cmd/Ctrl+V pastes it onto the selected layers, on top or in place of their highlighted row of that kind, while it is still the last copy ("Click to highlight the property on the right sidebar", Copy and paste properties between layers). Escape or a press on the canvas lets the highlight go before the selection. Tests: `property_rows_tests` (22) | +| 2026-11-09 | minor | M1, #1494: fill, stroke and effect rows in the Design panel couldn't be selected, so the keyboard couldn't copy one (only the row's menu could). A click on a row's grip or background now highlights it (`property_rows`; the row is a click target under its controls and its grip takes a click, neither focusable, so Tab still goes control to control), Cmd/Ctrl+C copies that paint or effect, and Cmd/Ctrl+V pastes it onto the selected layers, on top or in place of their highlighted row of that kind, while it is still the last copy (Copy and paste properties between layers). Escape or a press on the canvas lets the highlight go before the selection. Tests: `property_rows_tests` (22) | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. | From 1ac46ba0af3829d322d2adc09506363487fa9440 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 21:41:31 -0500 Subject: [PATCH 168/239] Board tables: the resize growth test scans system fonts; one Tables and one Mind maps row (#2172) The merge with the mind-maps main kept both sides' Tables and Mind maps rows in boards-parity.md (union): the stale "Mind maps | missing" and main's old Tables row are gone, keeping this PR's Tables row and main's Mind maps row. The new text-growth test scans system fonts itself, as its neighbour does, so it measures text when it runs first. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/board_tables_tests.rs | 3 +++ docs/boards-parity.md | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/board_tables_tests.rs b/crates/engine/src/board_tables_tests.rs index d15aedc7b..3d4d8ce3a 100644 --- a/crates/engine/src/board_tables_tests.rs +++ b/crates/engine/src/board_tables_tests.rs @@ -377,6 +377,9 @@ fn a_table_never_shrinks_below_its_cells() { #[test] fn a_resized_table_still_grows_with_its_text_and_undoes_in_one_step() { + // Text measures only once system fonts are scanned (without craft-fonts), so scan them here + // without depending on another test having scanned them first. + figcraft_text::scan_system_fonts(); let (mut s, t) = table_3x3(["", "", ""]); drag(&mut s, (240.0, 122.0), (240.0, 272.0)); assert!(near(node(&s, t).height, 272.0)); diff --git a/docs/boards-parity.md b/docs/boards-parity.md index f5f7d17cf..30ad2da7e 100644 --- a/docs/boards-parity.md +++ b/docs/boards-parity.md @@ -61,8 +61,6 @@ all end with the same geometry. | Board widgets | missing | design-file widgets exist (`crates/engine/src/extensions/widgets.rs`), not wired to boards | | Templates (retrospective, brainstorm, flow chart…) | partial | five built-in templates drawn up for FigCraft (retrospective, brainstorm, weekly planner, flow chart, kanban board), placed from the toolbar's templates picker (each with a picture of itself) or `board.template {name, x?, y?}` as ordinary sections, stickies, shapes, connectors and text in one undo step; `board.templates` lists them. No community templates, no saving your own | | Tables | partial | `board.table {rows, columns, cells?, x?, y?}` (at most 50 × 20): an auto layout frame of rows of cells with text, a tinted header row and lines between rows and columns; a cell's row grows with its text; resizing a table by its bottom edge or its height grows the last row and a corner drag shares the change equally over every row and column (a side drag changes no row), the table keeps hugging its rows and a cell keeps at least 40 each way (measured in FigJam's web app, 2026-11-09: its floor is about 52, FigCraft's is 40, and its right edge grows only the last column); a double-click types in the cell under the pointer; add or remove a row or column from the bar over the selection or `board.tableEdit {id, action, index?}`; cells copied from a spreadsheet (tab-separated text, quoted cells kept whole) paste as a table, up to 50 × 20 with a note when there was more; undoable and synced in live sessions. No per-column widths yet (a width change splits equally), no column resizing by dragging, no cell colours, no Tab between cells; comma-separated text pastes as text | -| Mind maps | missing | | -| Tables | partial | `board.table {rows, columns, cells?, x?, y?}` (at most 50 × 20): an auto layout frame of rows of cells with text, a tinted header row and lines between rows and columns; a cell's row grows with its text; a double-click types in the cell under the pointer; add or remove a row or column from the bar over the selection or `board.tableEdit {id, action, index?}`; cells copied from a spreadsheet (tab-separated text, quoted cells kept whole) paste as a table, up to 50 × 20 with a note when there was more; undoable and synced in live sessions. No column resizing by dragging, no cell colours, no Tab between cells; comma-separated text pastes as text | | Mind maps | partial | from commands only so far (#2226): `board.mindMap {x?, y?, text?, children?}` places a first node (bold, no box) with three children on its right, joined by curved branches; `board.mindMapAdd {id?, relation?: child\|sibling}` adds a node. Nodes are text that grows wider as it is typed and taller with line breaks; a node's children stand in one column 88 units right of the widest node of its own column, 48 apart, centred on it, and the map lays itself out again in the normalize pass after every edit, undo and live-session change; moving the first node moves the map; a deleted node's children stay where they are without their branch. Branches are board connectors (`branch`: stroke 4, #757575, round caps), so their style, end points, weight and colour change like any connector's. No toolbar entry, shortcuts, "+" handles, dragging a node onto another, left side or `.jam` import yet | | Washi tape, code blocks, image cropping on boards | missing | images can be placed as in design files | | Audio and huddles | missing | | From 2067a0b525c7a27e6f6ceecd697cd5c2adc40109 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 12 Nov 2026 10:25:44 +0700 Subject: [PATCH 169/239] Fix main: the slot test reads an unbound property's stored value; drop a stale Tamil string #2269 lists only the text properties bound to a layer on an instance, so the unbound base Text of #2126's test is no longer listed: the test now checks its stored value. #2242 reworded the colour profile note after #2160 translated it. --- crates/engine/src/slot_tests.rs | 11 ++++++++--- crates/ui-egui/locales/ta.toml | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/slot_tests.rs b/crates/engine/src/slot_tests.rs index adb96d541..4fbe5066a 100644 --- a/crates/engine/src/slot_tests.rs +++ b/crates/engine/src/slot_tests.rs @@ -417,12 +417,16 @@ fn assert_slot_text(s: &mut Session, instance: NodeId, expected: &str) { assert!(html.contains(&format!(">{expected}

")), "slot Label HTML: {html}"); } -fn assert_local_slot_text(s: &mut Session, instance: NodeId, expected: &str) { +fn assert_stored_slot_text(s: &Session, instance: NodeId, expected: &str) { assert!( matches!(&node(s, instance).kind, NodeKind::Instance { props, .. } if props.get("Text") == Some(&json!(expected))), "instance {instance} must store its own Text value {expected:?}: {:?}", node(s, instance).kind ); +} + +fn assert_local_slot_text(s: &mut Session, instance: NodeId, expected: &str) { + assert_stored_slot_text(s, instance, expected); let properties = props_of(s, instance); let text = properties.iter().find(|p| p["name"] == "Text").unwrap_or_else(|| panic!("instance {instance} has no Text property: {properties:?}")); assert_eq!(text["value"], expected, "instance {instance} Text property"); @@ -475,14 +479,15 @@ fn slot_text_properties_do_not_read_an_unbound_base_property() { ex(&mut s, "component.addProperty", json!({"id": base, "name": "Text", "type": "text", "default": "Wrong owner"})); let i = idv(&ex(&mut s, "instance.create", json!({"component": composition, "x": 400}))); let nested_base = kids(&s, i)[0]; - assert_local_slot_text(&mut s, nested_base, "Wrong owner"); + // Bound to no layer, the base's Text isn't listed on its instance (#2269); its value stays stored. + assert_stored_slot_text(&s, nested_base, "Wrong owner"); let nested = copy_of(&s, i, main_content); assert_local_slot_text(&mut s, nested, "Default"); assert_slot_text(&mut s, nested, "Default"); ex(&mut s, "instance.setProperties", json!({"ids": [nested], "properties": {"Text": "Custom"}})); assert_local_slot_text(&mut s, nested, "Custom"); assert_slot_text(&mut s, nested, "Custom"); - assert_local_slot_text(&mut s, nested_base, "Wrong owner"); + assert_stored_slot_text(&s, nested_base, "Wrong owner"); assert_slot_text(&mut s, main_content, "Default"); healthy(&s); } diff --git a/crates/ui-egui/locales/ta.toml b/crates/ui-egui/locales/ta.toml index 6ae9473ec..1fe649d13 100644 --- a/crates/ui-egui/locales/ta.toml +++ b/crates/ui-egui/locales/ta.toml @@ -1575,7 +1575,6 @@ status = "draft — needs native review" "Texts" = "உரைகள்" "Texture" = "அமைப்பு" "The bars are hidden. {shortcut} shows them again" = "பட்டைகள் மறைக்கப்பட்டுள்ளன. {shortcut} அவற்றை மீண்டும் காட்டும்" -"The canvas previews colors in sRGB; exported PNG, JPG and WebP files are tagged Display P3." = "கேன்வாஸ் நிறங்களை sRGB இல் காட்டுகிறது; ஏற்றுமதி செய்த PNG, JPG, WebP கோப்புகள் Display P3 எனக் குறிக்கப்படும்." "The destination document is unavailable. Nothing was imported." = "இலக்கு ஆவணம் கிடைக்கவில்லை. எதுவும் இறக்குமதி செய்யப்படவில்லை." "The destination document was closed. Nothing was imported." = "இலக்கு ஆவணம் மூடப்பட்டது. எதுவும் இறக்குமதி செய்யப்படவில்லை." "The destination page was removed. Nothing was imported." = "இலக்குப் பக்கம் அகற்றப்பட்டது. எதுவும் இறக்குமதி செய்யப்படவில்லை." From 0dac231109afb76d7749892d3d07a831cd549154 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 22:43:57 -0500 Subject: [PATCH 170/239] Docs: qualify the eyedropper row for a zoomed-out image (#2192 review) Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- docs/ui-parity.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 7ecb04b6a..4c3df3659 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -100,7 +100,7 @@ interaction feel not yet compared. | Text: wrap style (Auto, Balance, Pretty) | done | per text layer (`wrapStyle` on `node.set`, `text.wrapStyle`, the Type settings control under Vertical trim, inspect, CSS `text-wrap: balance` or `pretty`): Auto breaks greedily; Balance narrows each paragraph as far as it goes without another line, so its lines come out close to the same length (what browsers do for `text-wrap: balance`); Pretty keeps lines full and, when the last line is one word, narrows one of the last four lines just enough to give a word to the lines after it (Explore text properties: "Auto: Figma fits as many words as possible on each line before wrapping to the next", "Balance: Figma distributes text as evenly as possible across every line, so each line is close to the same length", "Pretty: Figma keeps each line full, but adjusts the last four lines to avoid an orphan"). Saved line breaks from a file still win. Not yet included: per-paragraph settings, text-style support and the `.fig` import/export mapping (#1827). Test: `text_behaviour_tests::balance_and_pretty_wrap_styles_break_lines_as_documented` | | Text: direction override (Text ▸ Text direction) | done | per paragraph (`ParaList::direction`: auto, ltr, rtl): Text ▸ Text direction ▸ Auto / Left to right / Right to left and `text.direction {direction, ids?}` set the edited paragraphs while editing, else every paragraph of the selected texts; `node.set textDirection` the layer's (or the chars `start`/`end` name); the Type settings control appears once a right-to-left script is in the text or a direction is forced; inspect reports `textDirection` when the paragraphs agree and `lineDirections` otherwise; Developer Mode's CSS writes `direction: ltr` or `rtl` when every paragraph is forced the same way (with `text-align: left` beside `rtl`, as Left is absolute on the canvas); `.fig` import and export carry each line's `sourceDirectionality`, read up to the paragraph count. Layout gives the paragraph its base level, so a forced right-to-left paragraph of Latin letters starts at the right, mirrors its list gutter and indent and orders its runs right to left, and a forced left-to-right paragraph of Hebrew the other way ("By default, Figma automatically handles text direction based on language detection. However, controls are available to override text direction per paragraph", "Go to Text > Text direction. Select Left to right or Right to left", Add right-to-left text). Not included: a direction in text styles (the article names none). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests` | | 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`): one screen pixel centred on the pointer, sampled as the canvas draws it, so an image magnified past 2x gives the pixel under the pointer, not a blend with its neighbours (#2189, `eyedropper_image_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`) | +| 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`): one screen pixel centred on the pointer, sampled as the canvas draws it when zoomed in, so an image magnified past 2x gives the pixel under the pointer, not a blend with its neighbours; zoomed out it samples the full-resolution image (the canvas may show a smaller copy, which the eyedropper does not use), so it can differ slightly from the shown colour (#2189, `eyedropper_image_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 | | Stretch and scatter brushes (Figma Draw) | done | eight presets drawn in code; the Pencil's brush is set by `tool.pencilBrush`, not from the toolbar | @@ -188,7 +188,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| -| 2026-11-09 | patch | M3, #2189: the eyedropper picks the colour the canvas shows. It sampled a 1x1 render without the canvas's magnified-image pixels, so on an image magnified past 2x it blended a 1 px line with its neighbours (#3D444D picked as #343B44 beside #151B23), and the pixel it sampled began at the pointer instead of being centred on it. Test: `eyedropper_image_tests` | +| 2026-11-09 | patch | M3, #2189: the eyedropper picks the colour the canvas shows. It sampled a 1x1 render without the canvas's magnified-image pixels, so on an image magnified past 2x it blended a 1 px line with its neighbours (#3D444D picked as #343B44 beside #151B23), and the pixel it sampled began at the pointer instead of being centred on it. It now matches the canvas when zoomed in; zoomed out it still samples the full-resolution image, not the smaller copy the canvas may show. Test: `eyedropper_image_tests` | | 2026-11-11 | patch | M5, gap 4: marquee selection as measured in Figma's web app (Select layers and objects, Selection marquee): a partly covered top-level frame or section gives the layers in it the marquee touches (it was selected only when enclosed, so nothing came), an empty frame is selected on touch, a rotated shape is touched by its outline and not its box, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole), and also takes the top-level layers it touches outside it, and selecting a frame whole keeps the marquee at the top level (a partly covered frame then comes whole, not its layers). Flipped: `marquee_selects_what_it_touches`, `cmd_marquee_selects_nested_layers`, `a_box_selects_like_a_marquee`. Tests: `marquee_behaviour_tests`. Counts unchanged | | 2026-11-08 | minor | Vector edit mode, #1875, measured in Figma (web, real keys): Copy with segments selected takes only those (with just a point selected, the segments touching it) and a paste outside edit mode is a new vector layer in place; Cut removes them, the path splitting into subpaths in the same layer with edit mode staying on, and a paste outside gives a new layer with the cut segments; Paste while editing a vector adds the clipboard's segments, or a copied layer's outline, to the same network in place, selecting the pasted points, with no new layer and the bounds growing. FigCraft copied the whole layer, Cut left nothing to paste and Paste did nothing. `edit.copy`, `edit.cut` and `edit.paste` act so with no `ids`/`parent` given (Ctrl+X is the real Cut again; Shift+Delete still heals); the copy carries the layer's look (fills, strokes, effects, opacity, blend; the width profile only when every segment is copied); layers with no outline are skipped. Tests: `vector_clipboard_tests` | | 2026-11-08 | patch | Selection: Escape with layers selected clears the selection instead of stepping out to the parent first. Measured in the Figma web app with a rectangle in a group in a frame, selected from the canvas, from the Layers panel and after Tab: one Escape selects nothing. Editing, gestures and the pen still end first | From 7e4389138edd6d19e243dfb9fe7e75abab699116 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 22:43:59 -0500 Subject: [PATCH 171/239] Docs: count Selection colors in paint groups, not distinct colours (#2191 review) Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- docs/ui-parity.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index efefad868..4a046a1f4 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -79,9 +79,9 @@ interaction feel not yet compared. | Locked layers | done | selectable from the layers panel; no handles, not dragged with the rest of a selection | | Edit ▸ Set default properties: new layers take the selected layer's properties | done | from a shape (any layer but text): new rectangles, ellipses, polygons and stars drawn or clicked with their tools take its fills, strokes and their settings, effects, opacity, blend and corners; from a text layer: new text from the Text tool takes its fills and font (#2028). Silent in the help center on frames, lines and arrows: they keep their own look, as do layers made by commands; the defaults last for the session | | Smart selection spacing | partial | with layers in a row, a column or an aligned grid selected, the Layout section shows horizontal and vertical spacing ("Mixed" until set; typed, scrubbed, fractional and negative) and pink handles in the gaps on the canvas drag them, one undo step, Escape cancels (`arrange.spacing`; sizes, parents and offsets within each track kept; at most 2,000 layers; flow children, locked layers and layers inside instances left out). A ring at each layer's centre drags it to another place in a regular row, column or complete top-left-aligned grid: the others close up and make room around it with the gaps kept, and with Cmd/Ctrl held the two layers swap places instead, previewed live while dragging (`selection_reorder_tests`; no ring on a layer under 16 px on screen). Not covered: reordering irregular grids, and several marked layers moved together. Checked by its author on macOS and in the app on Windows (#402) | -| Selection colors | partial | the Design panel shows the section from two distinct colours, or from one when a selected layer has children (a frame, group, component or instance), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also offers enabled libraries' published color styles and Create style (`selection.createColorStyle`); no library variables and no new variable from a row (#403) | +| Selection colors | partial | the Design panel shows the section from two paint groups (paints sharing a style, a variable and a value count as one group), or from one when a selected layer has children (a frame, group, component or instance), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also offers enabled libraries' published color styles and Create style (`selection.createColorStyle`); no library variables and no new variable from a row (#403) | | Keyboard box selection | done | Alt+Space on macOS, Ctrl+Space on Windows and Linux, or F8 (`select.area`): a box around the selection or in the middle of the view; arrows move it, Cmd/Ctrl+arrows or Shift+arrows size it (Shift with Cmd/Ctrl: farther), Enter selects like a marquee (Shift+Enter toggles, Cmd/Ctrl+Enter nested), Escape closes; Tab while the box shows, or the chord again, switches to pick select: a pink outline on the first selected layer (the page's top layer with nothing selected), Tab and Shift+Tab move it between sibling layers in Layers order, Enter into a frame's top child, Shift+Enter out to the parent, Space selects it, Escape or a press on the canvas ends it; `ui.key` takes the same keys (#1836) | -| Selection colors | partial | the Design panel shows the section from two distinct colours, or from one when a selected layer has children (a frame, group, component or instance; a lone layer without children, or several layers without children in one colour, hide it), counting the selected layers' own fills and strokes and their descendants' (measured in Figma's web app, 2026-11-09, #2188, on frames, groups and rectangles only; the rule for components and instances is not measured), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also lists each enabled library's published color styles under the library's name (a library that can't be read offers none), and a linked row's menu switches it to another style; a library style is copied in, linked and read-only, in the same undo step (`selection.applyColorStyle` with `library`). Create style on an ordinary row asks for a name (the next free "Color n" first) and makes a style of the row's whole paint, gradients, opacity, blend mode and variables bound to gradient stops included, linked to every fill and stroke the row stands for in one undo step; a name in use keeps the window open (`selection.createColorStyle`). Text ranges with fills of their own take the style's value, without a link. No library variables from there, and no new variable from a row (#403) | +| Selection colors | partial | the Design panel shows the section from two paint groups (paints sharing a style, a variable and a value count as one group), or from one when a selected layer has children (a frame, group, component or instance; a layer without children shows it only with two paint groups, such as a red fill and a blue stroke; one paint group, however many layers share it, hides it), counting the selected layers' own fills and strokes and their descendants' (measured in Figma's web app, 2026-11-09, #2188, on frames, groups and rectangles only; the rule for components and instances is not measured), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also lists each enabled library's published color styles under the library's name (a library that can't be read offers none), and a linked row's menu switches it to another style; a library style is copied in, linked and read-only, in the same undo step (`selection.applyColorStyle` with `library`). Create style on an ordinary row asks for a name (the next free "Color n" first) and makes a style of the row's whole paint, gradients, opacity, blend mode and variables bound to gradient stops included, linked to every fill and stroke the row stands for in one undo step; a name in use keeps the window open (`selection.createColorStyle`). Text ranges with fills of their own take the style's value, without a link. No library variables from there, and no new variable from a row (#403) | | Keyboard box selection | done | Alt+Space on macOS, Ctrl+Space on Windows and Linux, or F8 (`select.area`): a box around the selection or in the middle of the view; arrows move it, Cmd/Ctrl+arrows or Shift+arrows size it (Shift with Cmd/Ctrl: farther), Enter selects like a marquee (Shift+Enter toggles, Cmd/Ctrl+Enter nested), Escape closes | ## Tools @@ -188,7 +188,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| -| 2026-11-09 | patch | M3, #2188: Selection colors shows for a selection holding a layer with children (a frame, group, component or instance) from one distinct colour, and for layers without children only from two; measured in Figma's web app on 2026-11-09 for the examples below only, and instance and component behaviour was not measured: a frame holding one red rectangle, a group of two red rectangles and a frame with a lone black-stroked rectangle show one row; one red rectangle, two red rectangles and a childless green frame show none; a red and a blue loose rectangle show two. Tests: `selection_colors_tests`. Counts unchanged | +| 2026-11-09 | patch | M3, #2188: Selection colors shows for a selection holding a layer with children (a frame, group, component or instance) from one paint group, and for layers without children only from two paint groups (groups are counted by style, variable and paint value, as `collect` does, not by distinct colours); measured in Figma's web app on 2026-11-09 for the examples below only, and instance and component behaviour was not measured: a frame holding one red rectangle, a group of two red rectangles and a frame with a lone black-stroked rectangle show one row; one red rectangle, two red rectangles and a childless green frame show none; a red and a blue loose rectangle show two (two paint groups). A childless rectangle with a red fill and a blue stroke has two paint groups, so the engine shows the section (not measured). Tests: `selection_colors_tests`. Counts unchanged | | 2026-11-11 | patch | M5, gap 4: marquee selection as measured in Figma's web app (Select layers and objects, Selection marquee): a partly covered top-level frame or section gives the layers in it the marquee touches (it was selected only when enclosed, so nothing came), an empty frame is selected on touch, a rotated shape is touched by its outline and not its box, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole), and also takes the top-level layers it touches outside it, and selecting a frame whole keeps the marquee at the top level (a partly covered frame then comes whole, not its layers). Flipped: `marquee_selects_what_it_touches`, `cmd_marquee_selects_nested_layers`, `a_box_selects_like_a_marquee`. Tests: `marquee_behaviour_tests`. Counts unchanged | | 2026-11-08 | minor | Vector edit mode, #1875, measured in Figma (web, real keys): Copy with segments selected takes only those (with just a point selected, the segments touching it) and a paste outside edit mode is a new vector layer in place; Cut removes them, the path splitting into subpaths in the same layer with edit mode staying on, and a paste outside gives a new layer with the cut segments; Paste while editing a vector adds the clipboard's segments, or a copied layer's outline, to the same network in place, selecting the pasted points, with no new layer and the bounds growing. FigCraft copied the whole layer, Cut left nothing to paste and Paste did nothing. `edit.copy`, `edit.cut` and `edit.paste` act so with no `ids`/`parent` given (Ctrl+X is the real Cut again; Shift+Delete still heals); the copy carries the layer's look (fills, strokes, effects, opacity, blend; the width profile only when every segment is copied); layers with no outline are skipped. Tests: `vector_clipboard_tests` | | 2026-11-08 | patch | Selection: Escape with layers selected clears the selection instead of stepping out to the parent first. Measured in the Figma web app with a rectangle in a group in a frame, selected from the canvas, from the Layers panel and after Tab: one Escape selects nothing. Editing, gestures and the pen still end first | From 7e748d4af8540be268aa905926db0d55056ab075 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 22:47:01 -0500 Subject: [PATCH 172/239] Rotation field: a relative edit turns a selected parent before its child (#2200 review) Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/ui-egui/src/field_tests.rs | 18 ++++++++++++++++++ crates/ui-egui/src/panels/right.rs | 7 ++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index 2f8182b03..ebadce835 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -485,6 +485,24 @@ fn the_rotation_field_shows_and_sets_the_rotation_on_the_page() { assert_eq!(undo_steps(&u), steps + 1); } +#[test] +fn a_relative_rotation_edit_turns_a_selected_parent_before_its_child_whatever_the_selection_order() { + let mut s = Session::new(); + let f = id(s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 400, "height": 400})).unwrap()); + let c = id(s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 120, "height": 80, "parent": f})).unwrap()); + s.execute("node.set", &json!({"ids": [f], "props": {"rotation": 10}})).unwrap(); + s.execute("node.set", &json!({"ids": [c], "props": {"absoluteRotation": 30}})).unwrap(); + // The child first, then its parent. + s.execute("select.set", &json!({"ids": [c, f]})).unwrap(); + let mut u = Ui::new(s); + u.ctx.enable_accesskit(); + u.frame(vec![]); + let page = |u: &Ui, n: NodeId| figcraft_geom::rotation_degrees(u.app.session.doc().unwrap().world_transform(n)); + assert_eq!(field(&mut u, "Rotation").1, "Mixed"); + type_into(&mut u, "Rotation", "+10", Key::Enter); + assert!((page(&u, f) - 20.0).abs() < 1e-6 && (page(&u, c) - 40.0).abs() < 1e-6, "{} {}", page(&u, f), page(&u, c)); +} + #[test] fn arithmetic_commits_tab_moves_on_and_escape_restores() { let (mut u, a, _) = setup(); diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index ff3c11000..a059dbccd 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -75,7 +75,12 @@ impl FigApp { None => return, }; let Ok(doc) = self.session.doc() else { return }; - let values: Vec<(NodeId, f64)> = ids.iter().filter_map(|i| Some((*i, rel.apply(shown(doc.node(*i)?))?))).collect(); + let mut values: Vec<(NodeId, f64)> = ids.iter().filter_map(|i| Some((*i, rel.apply(shown(doc.node(*i)?))?))).collect(); + if key == "absoluteRotation" { + // A page angle depends on the parents': turn a selected parent before the layers in it + // (as `node.set` orders a multi-id call), whatever order the selection is in. + values.sort_by_key(|(i, _)| doc.ancestors(*i).len()); + } if values.is_empty() || self.session.begin_interaction("Edit").is_err() { return; } From 2c83448dfd7bd13cbbe9c5401fbcc8579337230d Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 00:35:45 -0500 Subject: [PATCH 173/239] M4: UI parity doc: a sharp point whose far ends coincide keeps the old behaviour (#2110) The revision row now lists A = C (zero direction) among the cases smooth_sharp_point leaves alone. Co-Authored-By: Claude Opus 5.5 --- docs/ui-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 73351e25d..b80b8e891 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -212,7 +212,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| -| 2026-11-11 | patch | M4, #2110: in vector edit mode, choosing Mirror angle or Mirror angle and length for a sharp point (two segments, no handles) makes it smooth, as measured in Figma: both handles on one line through the point, along `(B - A) / \|BA\|^2 + (C - B) / \|BC\|^2` (A and C the far ends of its segments), each 0.3905 x its own segment for angle, both 0.3905 x the shorter segment for angle and length (the factor is known to about three digits; the length rule is medium confidence); several selected points each become smooth. Open-path ends, points that already have a handle, and points with a coincident neighbour keep the old behaviour. Evidence: tests in `crates/engine/src/canvas/vectoredit/ops.rs` and `tests.rs` | +| 2026-11-11 | patch | M4, #2110: in vector edit mode, choosing Mirror angle or Mirror angle and length for a sharp point (two segments, no handles) makes it smooth, as measured in Figma: both handles on one line through the point, along `(B - A) / \|BA\|^2 + (C - B) / \|BC\|^2` (A and C the far ends of its segments), each 0.3905 x its own segment for angle, both 0.3905 x the shorter segment for angle and length (the factor is known to about three digits; the length rule is medium confidence); several selected points each become smooth. Open-path ends, points that already have a handle, points with a coincident neighbour, and points whose two far ends coincide (A = C, so the direction is zero) keep the old behaviour. Evidence: tests in `crates/engine/src/canvas/vectoredit/ops.rs` and `tests.rs` | | 2026-11-07 | patch | Transform: Shift while rotating lands on absolute multiples of 15°, measured in Figma (a layer at 7° or -4.27° Shift-rotated by its corner ends at 15°); FigCraft rounded the turn since the drag began, so 7° landed on 7 + k*15. The gesture keeps the selection's shared rotation and rounds base + turn; a selection with different rotations keeps rounding the turn. Test: `shift_rotating_lands_on_multiples_of_15_not_steps_from_the_start` | | 2026-11-10 | patch | M1 review follow-up: strengthen canvas alpha, clipping/coverage, grid geometry/order and drawn-theme tests; use settled fresh sidebars at each width, check HEX visibility and opacity alignment, and assert picker toggling preserves page alpha. Production behavior unchanged. | | 2026-11-09 | patch | M1: canvas page transparency uses a checkerboard that follows light/dark themes and applies background alpha once, including partial or missing renders. The page control also fits both sidebar width limits. Tests: `canvas::background::tests`, `field_tests::page_background_colour_and_opacity_fit_a_resized_sidebar`. Numbers unchanged | From f0d39197be3ce290722ceae8d35b01d4eac8c7d6 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 00:45:36 -0500 Subject: [PATCH 174/239] M8: Scale tool drags pivot on the opposite handle, and its origin starts at the centre Measured in Figma's web app (2026-11-09): a handle drag ignores the origin grid and pivots on the opposite handle's point (Alt: the centre); only the numeric Scale field uses the origin, which starts at the centre. scale_factor drops the anchor, tool.scaleAnchor defaults to c, and K, 2, Enter now scales about the centre. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/canvas/tools.rs | 5 +- crates/engine/src/canvas/tools/drag.rs | 2 +- crates/engine/src/canvas/tools/handles.rs | 18 ++---- crates/engine/src/cmd/view.rs | 2 +- crates/engine/src/scale_tool_tests.rs | 68 ++++++++++++++++------- crates/engine/src/session/new.rs | 2 +- crates/ui-egui/src/field_tests.rs | 9 +-- docs/ui-parity.md | 7 ++- 8 files changed, 67 insertions(+), 46 deletions(-) diff --git a/crates/engine/src/canvas/tools.rs b/crates/engine/src/canvas/tools.rs index 1ccf4f8ca..1a7b8eda5 100644 --- a/crates/engine/src/canvas/tools.rs +++ b/crates/engine/src/canvas/tools.rs @@ -586,8 +586,9 @@ pub struct ToolState { /// Vector edit mode's pen: where the last press that started something new (no path being /// drawn) was, and the undo depth before it, so a double-click there takes that edit back. pub(crate) pen_press: Option<(Point, usize)>, - /// The Scale tool's anchor: column and row (0 start, 1 middle, 2 end) of the point of the - /// selection box that stays put (`tool.scaleAnchor`). + /// The Scale tool's origin: column and row (0 start, 1 middle, 2 end) of the point of the + /// selection box that stays put when the Scale field sets a factor (`tool.scaleAnchor`; the + /// centre, `(1, 1)`, until set). Handle drags ignore it and pivot on the opposite handle. pub scale_anchor: (u8, u8), /// The last drag move handled (a held button repeats it every frame). pub(crate) last_move: Option, diff --git a/crates/engine/src/canvas/tools/drag.rs b/crates/engine/src/canvas/tools/drag.rs index ea336a142..2208f74ee 100644 --- a/crates/engine/src/canvas/tools/drag.rs +++ b/crates/engine/src/canvas/tools/drag.rs @@ -640,7 +640,7 @@ impl Session { /// text included, children by the same factor whatever their constraints. fn scale_drag(&mut self, ev: &PointerEvent, r: &ResizeStart, q: Point, guides: Vec) -> Result<()> { let (frame, w0, h0) = r.frame; - let Some((k, pivot)) = scale_factor(r.handle, q, w0, h0, self.tool.scale_anchor, ev.alt) else { return Ok(()) }; + let Some((k, pivot)) = scale_factor(r.handle, q, w0, h0, ev.alt) else { return Ok(()) }; let nodes = r.nodes.clone(); let inv = frame.inverse(); // A layer's place in the box scales about the pivot; a negative factor turns it over. diff --git a/crates/engine/src/canvas/tools/handles.rs b/crates/engine/src/canvas/tools/handles.rs index ecd29e67a..96d9dee78 100644 --- a/crates/engine/src/canvas/tools/handles.rs +++ b/crates/engine/src/canvas/tools/handles.rs @@ -387,30 +387,22 @@ fn opposite(h: Handle) -> Handle { } /// The Scale tool's factor and pivot (in the box's axes) for dragging `handle` of a `w0`×`h0` box -/// to `q`. The pivot is the anchor point (`anchor`: column, row), or the opposite handle when the -/// anchor lies on the side being dragged, or the centre (`from_center`). Corners follow the axis -/// that moved the most; a negative factor flips. None when the box has no size to scale by. -pub(crate) fn scale_factor(handle: Handle, q: Point, w0: f64, h0: f64, anchor: (u8, u8), from_center: bool) -> Option<(f64, Point)> { +/// to `q`. The pivot is the opposite handle's point, or the centre (`from_center`); the origin grid +/// never decides it (measured in Figma's web app, 2026-11-09). Corners follow the axis that moved +/// the most; a negative factor flips. None when the box has no size to scale by. +pub(crate) fn scale_factor(handle: Handle, q: Point, w0: f64, h0: f64, from_center: bool) -> Option<(f64, Point)> { const EPS: f64 = 1e-9; if !(q.x.is_finite() && q.y.is_finite() && w0.is_finite() && h0.is_finite()) || matches!(handle, Handle::Rotate(_)) { return None; } let h = handle_point(handle, w0, h0); - let anchor_pt = anchor_in_box(anchor, w0, h0); // The axes the handle moves along. let (ax_x, ax_y) = match handle { Handle::Edge(0) | Handle::Edge(2) => (false, true), Handle::Edge(_) => (true, false), _ => (true, true), }; - let on_side = (ax_x && (anchor_pt.x - h.x).abs() < EPS) || (ax_y && (anchor_pt.y - h.y).abs() < EPS); - let pivot = if from_center { - Point::new(w0 / 2.0, h0 / 2.0) - } else if on_side { - handle_point(opposite(handle), w0, h0) - } else { - anchor_pt - }; + let pivot = if from_center { Point::new(w0 / 2.0, h0 / 2.0) } else { handle_point(opposite(handle), w0, h0) }; let ratio = |on: bool, to: f64, from: f64, p: f64| (on && (from - p).abs() > EPS).then(|| (to - p) / (from - p)); let kx = ratio(ax_x, q.x, h.x, pivot.x); let ky = ratio(ax_y, q.y, h.y, pivot.y); diff --git a/crates/engine/src/cmd/view.rs b/crates/engine/src/cmd/view.rs index dc58926fe..fa5ee8dcb 100644 --- a/crates/engine/src/cmd/view.rs +++ b/crates/engine/src/cmd/view.rs @@ -641,7 +641,7 @@ pub fn specs() -> Vec { spec!( "tool.scaleAnchor", "Scale anchor", - "{anchor?: tl|t|tr|l|c|r|bl|b|br} (the point of the selection that stays put when the Scale tool scales; omit to read it)", + "{anchor?: tl|t|tr|l|c|r|bl|b|br} (the origin of the Scale tool's factor field: the point of the selection that stays put; defaults to c, handle drags pivot on the opposite handle whatever it is; omit to read it)", false, |s, p| { if let Some(a) = string(p, "anchor") { diff --git a/crates/engine/src/scale_tool_tests.rs b/crates/engine/src/scale_tool_tests.rs index f61eba934..eab7b7313 100644 --- a/crates/engine/src/scale_tool_tests.rs +++ b/crates/engine/src/scale_tool_tests.rs @@ -57,29 +57,54 @@ fn anchors_round_trip() { } #[test] -fn the_pivot_is_the_anchor_unless_it_is_on_the_dragged_side() { +fn the_pivot_is_the_opposite_handle_or_the_centre_with_alt() { let (w, h) = (100.0, 50.0); - let tl = (0, 0); - // Bottom-right corner from the top-left anchor: classic, by the axis that moved the most. - assert_eq!(scale_factor(Handle::Corner(2), Point::new(200.0, 60.0), w, h, tl, false), Some((2.0, Point::new(0.0, 0.0)))); - // Top-right corner: the anchor is on its top side, so the opposite corner stays put. - assert_eq!(scale_factor(Handle::Corner(1), Point::new(150.0, -25.0), w, h, tl, false), Some((1.5, Point::new(0.0, 50.0)))); - // Right edge: from the anchor; left edge: the anchor is on it, so from the right edge. - assert_eq!(scale_factor(Handle::Edge(1), Point::new(50.0, 999.0), w, h, tl, false), Some((0.5, Point::new(0.0, 0.0)))); - assert_eq!(scale_factor(Handle::Edge(3), Point::new(-100.0, 0.0), w, h, tl, false), Some((2.0, Point::new(100.0, 25.0)))); - // A centre anchor, or Alt, scales about the centre. - assert_eq!(scale_factor(Handle::Corner(2), Point::new(150.0, 75.0), w, h, (1, 1), false), Some((2.0, Point::new(50.0, 25.0)))); - assert_eq!(scale_factor(Handle::Edge(2), Point::new(0.0, 75.0), w, h, tl, true), Some((2.0, Point::new(50.0, 25.0)))); + // Bottom-right corner: the top-left corner stays put, by the axis that moved the most. + assert_eq!(scale_factor(Handle::Corner(2), Point::new(200.0, 60.0), w, h, false), Some((2.0, Point::new(0.0, 0.0)))); + // Top-right corner: the bottom-left corner stays put. + assert_eq!(scale_factor(Handle::Corner(1), Point::new(150.0, -25.0), w, h, false), Some((1.5, Point::new(0.0, 50.0)))); + // Right edge: the left edge's middle; left edge: the right edge's middle. + assert_eq!(scale_factor(Handle::Edge(1), Point::new(50.0, 999.0), w, h, false), Some((0.5, Point::new(0.0, 25.0)))); + assert_eq!(scale_factor(Handle::Edge(3), Point::new(-100.0, 0.0), w, h, false), Some((2.0, Point::new(100.0, 25.0)))); + // Alt scales about the centre. + assert_eq!(scale_factor(Handle::Edge(2), Point::new(0.0, 75.0), w, h, true), Some((2.0, Point::new(50.0, 25.0)))); // Past the pivot flips; it never collapses to nothing. - assert_eq!(scale_factor(Handle::Corner(2), Point::new(-100.0, -50.0), w, h, tl, false).map(|k| k.0), Some(-1.0)); - assert_eq!(scale_factor(Handle::Corner(2), Point::new(0.0, 0.0), w, h, tl, false).map(|k| k.0), Some(0.01)); + assert_eq!(scale_factor(Handle::Corner(2), Point::new(-100.0, -50.0), w, h, false).map(|k| k.0), Some(-1.0)); + assert_eq!(scale_factor(Handle::Corner(2), Point::new(0.0, 0.0), w, h, false).map(|k| k.0), Some(0.01)); // Lines (no height) scale along their length. - assert_eq!(scale_factor(Handle::Corner(1), Point::new(300.0, 7.0), 100.0, 0.0, tl, false).map(|k| k.0), Some(3.0)); + assert_eq!(scale_factor(Handle::Corner(1), Point::new(300.0, 7.0), 100.0, 0.0, false).map(|k| k.0), Some(3.0)); for bad in [f64::NAN, f64::INFINITY] { - assert_eq!(scale_factor(Handle::Corner(2), Point::new(bad, 0.0), w, h, tl, false), None); + assert_eq!(scale_factor(Handle::Corner(2), Point::new(bad, 0.0), w, h, false), None); } - assert_eq!(scale_factor(Handle::Rotate(0), Point::new(1.0, 1.0), w, h, tl, false), None); - assert_eq!(scale_factor(Handle::Corner(2), Point::new(5.0, 5.0), 0.0, 0.0, tl, false), None); + assert_eq!(scale_factor(Handle::Rotate(0), Point::new(1.0, 1.0), w, h, false), None); + assert_eq!(scale_factor(Handle::Corner(2), Point::new(5.0, 5.0), 0.0, 0.0, false), None); +} + +/// Measured in Figma's web app, 2026-11-09: a drag ignores the origin grid and pivots on the +/// opposite handle (a 100 x 100 layer at 9000, 5000: the bottom-right corner keeps the top left; +/// the right edge keeps the left edge's middle and scales both ways). +#[test] +fn a_scale_handle_drag_pivots_on_the_opposite_handle_whatever_the_origin() { + for origin in ["c", "tl"] { + let mut s = Session::new(); + let r = rect(&mut s, 9000.0, 5000.0, 100.0, 100.0); + ex(&mut s, "select.set", json!({"ids": [r]})); + ex(&mut s, "tool.scale", json!({})); + ex(&mut s, "tool.scaleAnchor", json!({"anchor": origin})); + drag(&mut s, (9100.0, 5100.0), (9144.0, 5144.0), false); + assert_rect(bounds(&s, r), [9000.0, 5000.0, 9144.0, 5144.0]); + s.undo().unwrap(); + // The right edge's middle: the left edge's middle stays, the layer scales evenly. + drag(&mut s, (9100.0, 5050.0), (9150.0, 5050.0), false); + assert_rect(bounds(&s, r), [9000.0, 4975.0, 9150.0, 5125.0]); + } +} + +#[test] +fn the_scale_origin_starts_at_the_centre() { + let mut s = Session::new(); + assert_eq!(ex(&mut s, "tool.scaleAnchor", json!({}))["anchor"], json!("c")); + assert_eq!(s.tool.scale_anchor, (1, 1)); } #[test] @@ -118,7 +143,7 @@ fn the_live_readout_shows_the_factor_and_pivot() { } #[test] -fn the_anchor_and_alt_choose_what_stays_put() { +fn the_anchor_is_read_back_and_alt_scales_from_the_centre() { let mut s = Session::new(); let r = rect(&mut s, 0.0, 0.0, 100.0, 50.0); ex(&mut s, "select.set", json!({"ids": [r]})); @@ -126,12 +151,13 @@ fn the_anchor_and_alt_choose_what_stays_put() { assert_eq!(ex(&mut s, "tool.scaleAnchor", json!({"anchor": "c"}))["anchor"], json!("c")); assert_eq!(ex(&mut s, "tool.scaleAnchor", json!({}))["anchor"], json!("c"), "reads it back"); assert!(s.execute("tool.scaleAnchor", &json!({"anchor": "nowhere"})).is_err()); + // A drag pivots on the opposite corner whatever the anchor. drag(&mut s, (100.0, 50.0), (150.0, 75.0), false); - assert_rect(bounds(&s, r), [-50.0, -25.0, 150.0, 75.0]); + assert_rect(bounds(&s, r), [0.0, 0.0, 150.0, 75.0]); // Alt scales from the centre whatever the anchor. ex(&mut s, "tool.scaleAnchor", json!({"anchor": "tl"})); drag(&mut s, (150.0, 75.0), (125.0, 62.5), true); - assert_rect(bounds(&s, r), [-25.0, -12.5, 125.0, 62.5]); + assert_rect(bounds(&s, r), [25.0, 12.5, 125.0, 62.5]); } #[test] diff --git a/crates/engine/src/session/new.rs b/crates/engine/src/session/new.rs index f3b75b630..1ed6d820b 100644 --- a/crates/engine/src/session/new.rs +++ b/crates/engine/src/session/new.rs @@ -17,7 +17,7 @@ impl Session { default_props: Default::default(), prefs: Prefs::default(), prefs_unsaved: false, - tool: tools::ToolState::default(), + tool: tools::ToolState { scale_anchor: (1, 1), ..tools::ToolState::default() }, ui_requests: Vec::new(), ui_dark: None, journal: Vec::new(), diff --git a/crates/ui-egui/src/field_tests.rs b/crates/ui-egui/src/field_tests.rs index 19ef933e2..6ce8c95fc 100644 --- a/crates/ui-egui/src/field_tests.rs +++ b/crates/ui-egui/src/field_tests.rs @@ -879,7 +879,7 @@ fn enter_in_another_field_after_tab_keeps_the_scale_tool() { assert_eq!(u.app.session.tool.tool, figcraft_engine::ToolId::Scale); } -/// K, 2, Enter: 100 x 100 becomes 200 x 200 about the panel's origin, the tool is Move, one undo step. +/// K, 2, Enter: 100 x 100 becomes 200 x 200 about the panel's origin (the centre), the tool is Move, one undo step. #[test] fn k_two_enter_scales_the_selection_by_two() { let (mut u, r) = scale_setup(); @@ -889,8 +889,8 @@ fn k_two_enter_scales_the_selection_by_two() { u.frame(vec![Event::Text("2".to_string())]); key(&mut u, Key::Enter, Modifiers::NONE); u.frame(vec![]); - // About the panel's origin, FigCraft's top-left default (Figma's grid starts at the centre). - assert_eq!(geom(&u, r), (0.0, 0.0, 200.0, 200.0)); + // About the panel's origin, which starts at the centre as Figma's grid does. + assert_eq!(geom(&u, r), (-50.0, -50.0, 200.0, 200.0)); assert!(!scale_field_focused(&u), "the field let go of the keyboard"); assert_eq!(u.app.session.tool.tool, figcraft_engine::ToolId::Move); assert_eq!(u.app.session.ds().unwrap().selection, vec![r]); @@ -909,7 +909,8 @@ fn the_scale_field_takes_2x_and_1_5() { u.frame(vec![Event::Text(text.to_string())]); key(&mut u, Key::Enter, Modifiers::NONE); u.frame(vec![]); - assert_eq!(geom(&u, r), (0.0, 0.0, size, size), "{text}"); + let at = 50.0 - size / 2.0; + assert_eq!(geom(&u, r), (at, at, size, size), "{text}"); } } diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 0ee9bde96..14a6ac060 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-10 · **Change:** minor (Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (M8: Scale tool handle drags pivot on the opposite handle whatever the origin, and the origin starts at the centre (measured in Figma's web app, 2026-11-09); Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin, which starts at the centre in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -71,7 +71,7 @@ interaction feel not yet compared. | Enter with a shape or frame tool chosen | done | places what a click makes (100×100, lines 100 long, sections 400×300) in the middle of the view, selected (`tool.place`); from the toolbar, Enter on the chosen tool. With nothing selected, the arrows first show a crosshair in the middle of the view and then move it by the nudge amounts (`tool.crosshair`; Shift the large one), and Enter places there; Escape or a tool change takes it away ("Use the arrow keys to activate the crosshair cursor. It will appear in the middle of the viewport indicating where the new object will be placed", Accessibility at Figma; #1839) | | Alt-drag duplicate | done | the copy snaps to the layer it came from too (edges, centres, equal spacing); Duplicate (Cmd+D) then repeats the copy's offset, also after a Duplicate whose copy was moved, as long as the copies stay selected (the documentation doesn't say; pinned from community answers) | | Drag threshold; double-click into groups and text | done | a press moves or resizes only once the pointer has travelled 3 px on screen, so a click or double-click made with an unsteady hand drags nothing; a double-click goes one level into a group and the next one edits the text under it, wherever on the text it lands, with all of it selected (a double-click in the text being edited selects the word) (`double_click_tests`); Enter on a selected text does the same (all of it selected, typing replaces it) and Escape leaves editing with the layer still selected (`text_enter_tests`) | -| Scale tool (K): handles about an anchor, live factor, panel | done | Pressing K opens the Scale section with its factor field focused and its text selected; typing 2 (or 2x, 1.5) then Enter scales the selection by it about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured), as one undo step, then closes the section and returns to Move with the selection kept; Escape in the field closes it, back to Move, nothing changed. Measured in Figma's web app, 2026-11-09. Tests: `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`. | +| Scale tool (K): handles about the opposite handle, live factor, panel | done | Dragging a handle ignores the origin grid and pivots on the opposite handle's point (the opposite corner, or the opposite edge's middle for an edge, which scales both ways), with Alt on the centre; the origin grid (`tool.scaleAnchor`) starts at the centre and sets only what the Scale field and the W and H fields keep fixed (W and H with a non-centre origin are unmeasured). Measured in Figma's web app, 2026-11-09. Tests: `a_scale_handle_drag_pivots_on_the_opposite_handle_whatever_the_origin`, `the_scale_origin_starts_at_the_centre`. Pressing K opens the Scale section with its factor field focused and its text selected; typing 2 (or 2x, 1.5) then Enter scales the selection by it about the panel's origin, which starts at the centre, as one undo step, then closes the section and returns to Move with the selection kept; Escape in the field closes it, back to Move, nothing changed. Measured in Figma's web app, 2026-11-09. Tests: `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`. | | Nudge 1 / Shift 10 (preference), Cmd+arrows resize | done | arrows reorder auto layout children | | Smart guides: edges, centres, equal spacing (between two layers or continuing a row's gap, labelled), spacing labels, parent, layout grid, ruler guides | done | red, `snap.rs`; a guide dragged out of a ruler or moved snaps to layer edges and centres too (Snap to Objects; Cmd/Ctrl suspends), on its own axis only; page guides see the page's top-level layers, frame guides the frame's box, layout grids and every layer in it, along a rotated frame's own axes; thresholds not yet compared with Figma's (`guide_snap_tests`) | | Ctrl to suspend snapping while dragging (macOS) | done | Control on macOS (Cmd keeps working), Ctrl elsewhere; moving, resizing and drawing | @@ -314,5 +314,6 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | 2026-10-11 | minor | Canvas fixes: boolean groups clicked where their result is, a layer dragged inside a group stays in it, View ▸ Frame outlines and View ▸ Slices draw | | 2026-10-11 | minor | Outline mode done: outlines for the selection (the selected layers draw as outlines, the rest normally) and mask outlines | | 2026-10-11 | minor | Design panel arc fields, live boolean editing (operands on the canvas, live results, per-operand operations), shape builder on strokes and open paths, one-sided widths (Alt-drag a width handle) | -| 2026-11-09 | patch | M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`) | +| 2026-11-09 | patch | M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin, which starts at the centre in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`) | +| 2026-11-12 | patch | M8: Scale tool handle drags pivot on the opposite handle whatever the origin, and the origin starts at the centre, so K, 2, Enter scales about the centre (measured in Figma's web app, 2026-11-09; `a_scale_handle_drag_pivots_on_the_opposite_handle_whatever_the_origin`, `the_scale_origin_starts_at_the_centre`) | | 2026-10-10 | major | Created from the ROADMAP's look-and-feel and interaction items, the keymap and the canvas code | From 6d36c87ce6cc936a6fa428cb214e3797222ce10e Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 00:46:34 -0500 Subject: [PATCH 175/239] M8: keep the 2026-11-09 revision row as it was The revision history records what each change said at the time; the new 2026-11-12 row carries the origin change. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and reviewed --- docs/ui-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 14a6ac060..d1580cb9d 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -314,6 +314,6 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | 2026-10-11 | minor | Canvas fixes: boolean groups clicked where their result is, a layer dragged inside a group stays in it, View ▸ Frame outlines and View ▸ Slices draw | | 2026-10-11 | minor | Outline mode done: outlines for the selection (the selected layers draw as outlines, the rest normally) and mask outlines | | 2026-10-11 | minor | Design panel arc fields, live boolean editing (operands on the canvas, live results, per-operand operations), shape builder on strokes and open paths, one-sided widths (Alt-drag a width handle) | -| 2026-11-09 | patch | M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin, which starts at the centre in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`) | +| 2026-11-09 | patch | M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`) | | 2026-11-12 | patch | M8: Scale tool handle drags pivot on the opposite handle whatever the origin, and the origin starts at the centre, so K, 2, Enter scales about the centre (measured in Figma's web app, 2026-11-09; `a_scale_handle_drag_pivots_on_the_opposite_handle_whatever_the_origin`, `the_scale_origin_starts_at_the_centre`) | | 2026-10-10 | major | Created from the ROADMAP's look-and-feel and interaction items, the keymap and the canvas code | From ee11036d669583972e84bb0d6a56ada6c36d18f1 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 00:53:59 -0500 Subject: [PATCH 176/239] M8: every 24 pt icon button paints its glyph at 16 pt (#2238) The Layers panel's Minimize, search and add page buttons, the Assets back button, the Versions panel's row menus, the Dev Mode status button, the Prototype panel's flow buttons, the preview pane's bar buttons, Home's Online row menus and the style picker's 24 pt buttons painted their glyphs through shrink(5.0), 14 pt. They go through widgets::icon_glyph_rect like the Design panel's (#2229), 16 pt. Left as they were: the style picker's 22 pt edit/check button and 20 pt variable button, and the popover's close button (24 pt, deliberate 12 pt cross). Tests: icon_button_size_tests (Layers and Assets, the status button) and icon_size_tests beside versions, proto_panel, online, the style picker and the player; header_icon_size_tests gains painted_rects and paints_icon_at_button_size for them. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/ui-egui/src/header_icon_size_tests.rs | 30 +++++++++++++-- crates/ui-egui/src/home/online.rs | 30 ++++++++++++++- crates/ui-egui/src/icon_button_size_tests.rs | 37 +++++++++++++++++++ crates/ui-egui/src/lib.rs | 2 + crates/ui-egui/src/panels/assets_panel.rs | 2 +- crates/ui-egui/src/panels/layers.rs | 8 ++-- crates/ui-egui/src/panels/proto_panel.rs | 20 +++++++++- crates/ui-egui/src/panels/section_panel.rs | 2 +- crates/ui-egui/src/panels/versions.rs | 26 ++++++++++++- crates/ui-egui/src/present/player.rs | 2 +- crates/ui-egui/src/present/tests.rs | 18 +++++++++ crates/ui-egui/src/widgets/style_picker.rs | 3 +- .../ui-egui/src/widgets/style_picker/tests.rs | 14 +++++++ docs/ui-parity.md | 1 + 14 files changed, 178 insertions(+), 17 deletions(-) create mode 100644 crates/ui-egui/src/icon_button_size_tests.rs diff --git a/crates/ui-egui/src/header_icon_size_tests.rs b/crates/ui-egui/src/header_icon_size_tests.rs index 917276c2a..a72a44b4e 100644 --- a/crates/ui-egui/src/header_icon_size_tests.rs +++ b/crates/ui-egui/src/header_icon_size_tests.rs @@ -6,11 +6,13 @@ use egui::{Context, Rect, pos2, vec2}; use crate::icons::{self, Icon}; use crate::widgets::{icon_button_at, icon_glyph_rect, section_header}; -/// Bounding box of everything painted in one frame of `add`. -fn painted_box(add: impl FnOnce(&mut egui::Ui)) -> Rect { +/// The bounding box of every glyph-like shape painted in one frame of `add`, one per shape, with +/// the pointer at `pointer` (hover-only buttons) when given. +pub(crate) fn painted_rects(pointer: Option, add: impl FnOnce(&mut egui::Ui)) -> Vec { let ctx = Context::default(); let mut add = Some(add); - let raw = egui::RawInput { screen_rect: Some(Rect::from_min_size(pos2(0.0, 0.0), vec2(400.0, 200.0))), ..Default::default() }; + let events = pointer.map(egui::Event::PointerMoved).into_iter().collect(); + let raw = egui::RawInput { screen_rect: Some(Rect::from_min_size(pos2(0.0, 0.0), vec2(400.0, 600.0))), events, ..Default::default() }; let mut out = ctx.run_ui(raw, |ui| { if let Some(f) = add.take() { f(ui); @@ -21,7 +23,27 @@ fn painted_box(add: impl FnOnce(&mut egui::Ui)) -> Rect { .iter() .filter(|s| matches!(s.shape, egui::Shape::Path(_) | egui::Shape::Mesh(_) | egui::Shape::LineSegment { .. } | egui::Shape::Circle(_))) .map(|s| s.shape.visual_bounding_rect()) - .fold(Rect::NOTHING, |a, b| a.union(b)) + .collect() +} + +/// Bounding box of everything painted in one frame of `add`. +fn painted_box(add: impl FnOnce(&mut egui::Ui)) -> Rect { + painted_rects(None, add).into_iter().fold(Rect::NOTHING, |a, b| a.union(b)) +} + +/// Whether `painted` holds `icon` drawn at the size of a 24 pt `icons::button`'s glyph (16 pt): the +/// reference glyph's shapes, moved by one offset, are all among `painted` (same sizes and spacing, +/// so a three-dot glyph's spread counts too). +pub(crate) fn paints_icon_at_button_size(painted: &[Rect], icon: Icon) -> bool { + let reference = painted_rects(None, |ui| { + icons::button(ui, icon, 24.0, false, "reference"); + }); + let same = |a: Rect, b: Rect| (a.min - b.min).length() < 0.5 && (a.size() - b.size()).length() < 0.5; + let Some(first) = reference.first() else { return false }; + painted.iter().any(|p| { + let shift = p.min - first.min; + reference.iter().all(|r| painted.iter().any(|q| same(*q, r.translate(shift)))) + }) } /// The header's eye, `icon_button_at`'s and a fill row's (`icons::button`, the reporter's diff --git a/crates/ui-egui/src/home/online.rs b/crates/ui-egui/src/home/online.rs index a011836dd..0b01017bb 100644 --- a/crates/ui-egui/src/home/online.rs +++ b/crates/ui-egui/src/home/online.rs @@ -180,7 +180,7 @@ fn row(app: &mut FigApp, ui: &mut Ui, t: &Tokens, f: &OnlineFile, busy: bool) { if mresp.hovered() { ui.painter().rect_filled(more, CornerRadius::same(5), t.pressed); } - icons::paint(ui.painter(), more.shrink(5.0), Icon::Dots, t.icon); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(more), Icon::Dots, t.icon); let ctx = ui.ctx().clone(); let at = (f.server.as_str(), f.file.as_str()); crate::right::menu_popup(&mresp).width(240.0).show(|ui| { @@ -302,7 +302,7 @@ fn team_row(app: &mut FigApp, ui: &mut Ui, t: &Tokens, server: &str, web: &str, if mresp.hovered() { ui.painter().rect_filled(more, CornerRadius::same(5), t.pressed); } - icons::paint(ui.painter(), more.shrink(5.0), Icon::Dots, t.icon); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(more), Icon::Dots, t.icon); crate::right::menu_popup(&mresp).width(240.0).show(|ui| { if crate::right::menu_item(ui, tr("Open"), "") { open_team(app, server, f); @@ -427,3 +427,29 @@ pub fn inspect(app: &FigApp) -> Value { "rename": app.ui.online.rename.as_ref().map(|r| &r.2), }) } + +#[cfg(test)] +mod icon_size_tests { + use super::*; + use crate::header_icon_size_tests::{painted_rects, paints_icon_at_button_size}; + use figcraft_engine::figcraft_collab::message::Access; + + /// The menu buttons of Online's file rows and team rows paint their dots at 16 pt (#2238). + #[test] + fn online_row_menus_paint_16pt() { + let t_app = || FigApp::new(figcraft_engine::Session::new(), Box::new(crate::NoServices)); + let mut app = t_app(); + let file = OnlineFile { server: "wss://share.example/".into(), file: "f".into(), name: "Trail".into(), ..OnlineFile::default() }; + let rows = painted_rects(None, |ui| { + let t = Tokens::get(ui.ctx()); + row(&mut app, ui, &t, &file, false); + }); + assert!(paints_icon_at_button_size(&rows, Icon::Dots), "file row menu is not 16 pt"); + let team = TeamFile { file: "f".into(), name: "Trail".into(), updated: 0, people: 0, access: Access::Edit }; + let teams = painted_rects(None, |ui| { + let t = Tokens::get(ui.ctx()); + team_row(&mut app, ui, &t, "wss://share.example/", "", &team); + }); + assert!(paints_icon_at_button_size(&teams, Icon::Dots), "team row menu is not 16 pt"); + } +} diff --git a/crates/ui-egui/src/icon_button_size_tests.rs b/crates/ui-egui/src/icon_button_size_tests.rs new file mode 100644 index 000000000..2d94f3fb8 --- /dev/null +++ b/crates/ui-egui/src/icon_button_size_tests.rs @@ -0,0 +1,37 @@ +//! Every 24 pt icon button paints its glyph at 16 pt, the size `icons::button` draws (#2238, after +//! the Design panel's in #2227). The panels' own buttons: the Layers panel's header, the Assets +//! panel's back button and the Dev Mode status button. The tests of the other panels sit beside +//! them (`present/tests.rs`, and the `icon_size_tests` modules of `versions`, `proto_panel`, +//! `online` and the style picker). + +use egui::{Rect, pos2, vec2}; +use figcraft_engine::Session; + +use crate::header_icon_size_tests::{painted_rects, paints_icon_at_button_size}; +use crate::icons::Icon; +use crate::{FigApp, NoServices}; + +fn app() -> FigApp { + FigApp::new(Session::new(), Box::new(NoServices)) +} + +#[test] +fn layers_and_assets_icon_buttons_paint_16pt() { + let mut a = app(); + let rail = painted_rects(None, |ui| crate::layers::left_panel(&mut a, ui)); + for icon in [Icon::Panels, Icon::Search, Icon::Plus] { + assert!(paints_icon_at_button_size(&rail, icon), "Layers panel: {icon:?} is not 16 pt"); + } + a.ui.libraries = true; + let back = painted_rects(None, |ui| crate::assets_panel::show(&mut a, ui)); + assert!(paints_icon_at_button_size(&back, Icon::ChevronLeft), "Assets panel: the back chevron is not 16 pt"); +} + +#[test] +fn the_dev_mode_status_button_paints_a_16pt_glyph() { + let mut a = app(); + let doc = a.session.doc().unwrap().clone(); + let button = Rect::from_min_size(pos2(20.0, 20.0), vec2(24.0, 24.0)); + let painted = painted_rects(None, |ui| crate::section_panel::status_icon(&mut a, ui, &doc, &[], button)); + assert!(paints_icon_at_button_size(&painted, Icon::Code), "the status button's code glyph is not 16 pt"); +} diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 320f94ba2..5e31468a6 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -132,6 +132,8 @@ mod home_tests; #[cfg(test)] mod host_save_tests; #[cfg(test)] +mod icon_button_size_tests; +#[cfg(test)] mod idle_tests; #[cfg(test)] mod ime_tests; diff --git a/crates/ui-egui/src/panels/assets_panel.rs b/crates/ui-egui/src/panels/assets_panel.rs index 0da5a9bee..41f7762ff 100644 --- a/crates/ui-egui/src/panels/assets_panel.rs +++ b/crates/ui-egui/src/panels/assets_panel.rs @@ -818,7 +818,7 @@ fn libraries_view(app: &mut FigApp, ui: &mut Ui) { if bresp.hovered() { ui.painter().rect_filled(back, CornerRadius::same(5), t.hover); } - icons::paint(ui.painter(), back.shrink(5.0), Icon::ChevronLeft, t.icon); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(back), Icon::ChevronLeft, t.icon); ui.painter().text(pos2(back.max.x + 6.0, hr.center().y), Align2::LEFT_CENTER, tr("Libraries"), semibold(12.0), t.text); if bresp.clicked() { app.ui.libraries = false; diff --git a/crates/ui-egui/src/panels/layers.rs b/crates/ui-egui/src/panels/layers.rs index 1a62a851c..28664cae7 100644 --- a/crates/ui-egui/src/panels/layers.rs +++ b/crates/ui-egui/src/panels/layers.rs @@ -168,7 +168,7 @@ pub fn left_panel(app: &mut FigApp, ui: &mut Ui) { 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); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(hr), Icon::Panels, t.icon); if hresp.clicked() { app.run("view.minimize", json!({})); } @@ -204,7 +204,7 @@ fn pages(app: &mut FigApp, ui: &mut Ui) { if sresp.hovered() || app.ui.page_search { ui.painter().rect_filled(sr, CornerRadius::same(5), t.hover); } - icons::paint(ui.painter(), sr.shrink(5.0), Icon::Search, t.icon); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(sr), Icon::Search, t.icon); let search_id = Id::unique("page_search_field"); if sresp.clicked() { app.ui.page_search = !app.ui.page_search; @@ -218,7 +218,7 @@ fn pages(app: &mut FigApp, ui: &mut Ui) { if aresp.hovered() { ui.painter().rect_filled(ar, CornerRadius::same(5), t.hover); } - icons::paint(ui.painter(), ar.shrink(5.0), Icon::Plus, t.icon); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(ar), Icon::Plus, t.icon); if aresp.clicked() { app.ui.pages_focus = app.session.ds().ok().map(|d| d.uid); if !crate::menus::dev_mode_refuses(app, "page.add") { @@ -1090,7 +1090,7 @@ fn layers(app: &mut FigApp, ui: &mut Ui) { if sresp.hovered() || app.ui.layer_search { ui.painter().rect_filled(sr, CornerRadius::same(5), t.hover); } - icons::paint(ui.painter(), sr.shrink(5.0), Icon::Search, t.icon); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(sr), Icon::Search, t.icon); let search_id = Id::unique("layer_search_field"); if sresp.clicked() { app.ui.layer_search = !app.ui.layer_search; diff --git a/crates/ui-egui/src/panels/proto_panel.rs b/crates/ui-egui/src/panels/proto_panel.rs index fa9f2585c..63b9278ac 100644 --- a/crates/ui-egui/src/panels/proto_panel.rs +++ b/crates/ui-egui/src/panels/proto_panel.rs @@ -374,7 +374,7 @@ fn icon_button(ui: &mut Ui, id: Id, rect: Rect, icon: Icon, tip: &str) -> bool { if resp.hovered() { ui.painter().rect_filled(rect, CornerRadius::same(5), t.hover); } - icons::paint(ui.painter(), rect.shrink(5.0), icon, t.icon); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(rect), icon, t.icon); resp.clicked() } @@ -1354,3 +1354,21 @@ fn scroll_section(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId], }); } } + +#[cfg(test)] +mod icon_size_tests { + use super::*; + use crate::header_icon_size_tests::{painted_rects, paints_icon_at_button_size}; + + /// The panel's 24 pt icon buttons (flow play, preview, remove) paint their glyphs at 16 pt (#2238). + #[test] + fn prototype_icon_buttons_paint_16pt() { + for icon in [Icon::Play, Icon::Preview, Icon::Minus] { + let painted = painted_rects(None, |ui| { + let rect = Rect::from_min_size(pos2(20.0, 20.0), vec2(24.0, 24.0)); + icon_button(ui, Id::unique("proto_icon_size"), rect, icon, "x"); + }); + assert!(paints_icon_at_button_size(&painted, icon), "{icon:?} is not 16 pt"); + } + } +} diff --git a/crates/ui-egui/src/panels/section_panel.rs b/crates/ui-egui/src/panels/section_panel.rs index 4ea146924..0aa880052 100644 --- a/crates/ui-egui/src/panels/section_panel.rs +++ b/crates/ui-egui/src/panels/section_panel.rs @@ -71,7 +71,7 @@ pub fn status_icon(app: &mut FigApp, ui: &mut Ui, doc: &Document, ids: &[NodeId] Some((DevStatus::None, _)) | None => t.icon, Some(_) => t.accent_text, }; - icons::paint(ui.painter(), rect.shrink(5.0), Icon::Code, color); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(rect), Icon::Code, color); menu_popup(&resp).width(160.0).show(|ui| status_menu(app, ui, ids, doc)); } diff --git a/crates/ui-egui/src/panels/versions.rs b/crates/ui-egui/src/panels/versions.rs index 7046b5fa7..73ed3eb16 100644 --- a/crates/ui-egui/src/panels/versions.rs +++ b/crates/ui-egui/src/panels/versions.rs @@ -441,7 +441,7 @@ fn version_row(ui: &mut Ui, row: &Row, last: bool, previewing: bool) -> Option Option { if more.hovered() || menu_open { ui.painter().rect_filled(br, CornerRadius::same(5), t.pressed); } - icons::paint(ui.painter(), br.shrink(5.0), Icon::Dots, t.icon); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(br), Icon::Dots, t.icon); } let more = more.tip(tr("More")); let mut menu = |ui: &mut Ui| { @@ -607,3 +607,25 @@ fn buttons(ui: &mut Ui, primary: &str, enabled: bool) -> Option { }) .inner } + +#[cfg(test)] +mod icon_size_tests { + use super::*; + use crate::header_icon_size_tests::{painted_rects, paints_icon_at_button_size}; + + /// The version and branch rows' More buttons (shown on hover) paint their dots at 16 pt (#2238). + #[test] + fn version_and_branch_menus_paint_16pt() { + let over = Some(pos2(20.0, 20.0)); + let row = Row { id: "v".into(), name: "Draft".into(), description: String::new(), time: 0, auto: false }; + let version = painted_rects(over, |ui| { + version_row(ui, &row, true, false); + }); + assert!(paints_icon_at_button_size(&version, Icon::Dots), "version row menu is not 16 pt"); + let branch = BranchRow { id: "b".into(), name: "Try".into(), time: 0, state: BranchState::Active }; + let branches = painted_rects(over, |ui| { + branch_row(ui, &branch); + }); + assert!(paints_icon_at_button_size(&branches, Icon::Dots), "branch row menu is not 16 pt"); + } +} diff --git a/crates/ui-egui/src/present/player.rs b/crates/ui-egui/src/present/player.rs index 8bcbea09d..66a8e30f3 100644 --- a/crates/ui-egui/src/present/player.rs +++ b/crates/ui-egui/src/present/player.rs @@ -173,7 +173,7 @@ fn top_bar(p: &mut Presenter, ui: &mut Ui, bar: Rect, now: f64, chrome: Chrome) resp = resp.tip(tr("Inspect the layer under the pointer: size, colours, typography")); } if chrome.pane { - icons::paint(ui.painter(), br.shrink(5.0), *icon, if on { t.accent_on } else { t.icon }); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(br), *icon, if on { t.accent_on } else { t.icon }); } else { ui.painter().text(br.center(), Align2::CENTER_CENTER, shown, regular(11.5), if on { t.accent_on } else { text }); } diff --git a/crates/ui-egui/src/present/tests.rs b/crates/ui-egui/src/present/tests.rs index bba998788..1a8b0f076 100644 --- a/crates/ui-egui/src/present/tests.rs +++ b/crates/ui-egui/src/present/tests.rs @@ -436,3 +436,21 @@ fn smart_animate_frame_cost() { let per = t0.elapsed().as_secs_f64() * 1000.0 / f64::from(n); eprintln!("smart animate: {per:.2} ms per frame (80 layers, 400x800 px)"); } + +/// The preview pane's 24 pt bar buttons paint their glyphs at 16 pt (#2238). +#[test] +fn pane_bar_buttons_paint_16pt() { + use super::layout::Chrome; + use super::player::player; + use crate::header_icon_size_tests::{painted_rects, paints_icon_at_button_size}; + use crate::icons::Icon; + let (d, a, ..) = device_doc(); + let mut p = player_on(d, a); + let pane = Chrome { pane: true, bar_h: 32.0, pad: 12.0, round: 8, keys: false }; + let painted = painted_rects(None, |ui| { + player(&mut p, ui, Rect::from_min_size(pos2(0.0, 0.0), vec2(400.0, 500.0)), 0.0, pane); + }); + for icon in [Icon::Close, Icon::Play, Icon::Reset] { + assert!(paints_icon_at_button_size(&painted, icon), "{icon:?} is not 16 pt"); + } +} diff --git a/crates/ui-egui/src/widgets/style_picker.rs b/crates/ui-egui/src/widgets/style_picker.rs index cc820ed71..57e045a06 100644 --- a/crates/ui-egui/src/widgets/style_picker.rs +++ b/crates/ui-egui/src/widgets/style_picker.rs @@ -303,7 +303,8 @@ fn menu_icon(ui: &mut Ui, rect: Rect, icon: Icon, tip: &str, on: bool) -> Respon if on || resp.hovered() { ui.painter().rect_filled(rect, CornerRadius::same(5), t.menu_hover); } - icons::paint(ui.painter(), rect.shrink(5.0), icon, t.menu_text); + let glyph = if rect.size() == vec2(24.0, 24.0) { crate::widgets::icon_glyph_rect(rect) } else { rect.shrink(5.0) }; + icons::paint(ui.painter(), glyph, icon, t.menu_text); resp } diff --git a/crates/ui-egui/src/widgets/style_picker/tests.rs b/crates/ui-egui/src/widgets/style_picker/tests.rs index 984f6c8d4..08c27f12d 100644 --- a/crates/ui-egui/src/widgets/style_picker/tests.rs +++ b/crates/ui-egui/src/widgets/style_picker/tests.rs @@ -558,3 +558,17 @@ fn text_style_editor_binds_variables_from_its_fields() { assert_eq!((def.font_size, def.font_style.as_str()), (18.0, "Bold"), "the style takes the variables' values"); assert!(u.app.ui.last_error.is_none(), "{:?}", u.app.ui.last_error); } + +/// The picker's 24 pt icon buttons paint their glyphs at 16 pt; a smaller button keeps a smaller one +/// (#2238). +#[test] +fn style_picker_icon_buttons_paint_16pt() { + use crate::header_icon_size_tests::{painted_rects, paints_icon_at_button_size}; + use crate::icons::Icon; + for icon in [Icon::Plus, Icon::Detach, Icon::ChevronLeft] { + let painted = painted_rects(None, |ui| { + menu_icon(ui, Rect::from_min_size(egui::pos2(20.0, 20.0), vec2(24.0, 24.0)), icon, "x", false); + }); + assert!(paints_icon_at_button_size(&painted, icon), "{icon:?} is not 16 pt"); + } +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 0ee9bde96..0c9f44d4c 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -241,6 +241,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | 2026-11-06 | patch | M7, #2032: closing a tab whose file has unsaved changes, by its X, a middle click, File ▸ Close tab or its shortcut, only showed a toast ("save first, or close again with Alt to discard") and left the tab open, so closing seemed not to work. It now asks the unsaved-changes question the window asks (`windows::TabClose`): Don't Save closes the tab, Cancel or Escape keeps it, Save saves the file and then closes it (a file without a path, or saved as .fig, asks where with Save as first and stays open if that is cancelled); Alt+close still drops the changes at once, and `file.close`'s `dialog.unsaved` request asks too. The three toasts left the catalogs. Tests: `titlebar_tests::closing_a_tab_with_unsaved_changes_asks`, `titlebar_tests::save_in_the_tab_question_saves_then_closes`. Reordering tabs by dragging, the issue's other half, landed on 2026-10-19 (`dragging_a_tab_along_the_bar_reorders_it_without_detaching`) | | 2026-11-05 | minor | M4, #1830: a paragraph's base direction can be forced (`TextDirection`: Auto, Ltr, Rtl on `ParaList`): Text ▸ Text direction ▸ Auto / Left to right / Right to left (`text.directionAuto` / `Ltr` / `Rtl`) and `text.direction {direction, ids?}` set the edited paragraphs while editing, else the layer's; `node.set textDirection`; the Type settings control once a right-to-left script is in the text; inspect `textDirection` / `lineDirections`; CSS `direction`; `.fig` lines' `sourceDirectionality` in and out. Layout gives each paragraph its base level (`Bidi::of` runs the algorithm per paragraph, as it starts over at each). Before, direction came from the letters only ("controls are available to override text direction per paragraph", Add right-to-left text). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests::a_lines_source_directionality_is_its_paragraphs_direction_both_ways`. | | 2026-11-02 | minor | M1, #1836: pick select. Tab while the keyboard selection box shows, or Alt/Ctrl+Space again, puts a pink outline on the first selected layer (the page's top layer with nothing selected); Tab and Shift+Tab move it between sibling layers as the Layers panel lists them, Enter into a frame's top child, Shift+Enter out to the parent (never the page), Space selects the layer under it, Escape or a press on the canvas ends it; the chord again while the pick cursor shows brings the box back (Accessibility at Figma). The control channel's `ui.key` sends the box's and the pick cursor's keys to them too. One documented row more (135, 134 bound); four gesture rows. Tests: `layers_keyboard_tests::tab_switches_the_selection_box_to_pick_select`. | +| 2026-11-12 | patch | M8, #2238: every 24 pt icon button outside the Design panel draws its glyph at 16 pt through `widgets::icon_glyph_rect`, not 14 pt: the Layers panel's Minimize, search and add page buttons, the Assets back button, the Versions panel's row menus, the Dev Mode status button, the Prototype panel's flow buttons, the preview pane's bar buttons, Home's Online row menus and the style picker's 24 pt buttons. Smaller buttons (the picker's 22 and 20 pt ones, the popover's 24 pt close button with its 12 pt cross) keep their smaller glyphs. Tests: `icon_button_size_tests` and the `icon_size_tests` beside the panels. Numbers unchanged. | | 2026-11-10 | patch | M10, #2227: the Design panel's section header buttons (Appearance, Typography, Fill, Stroke, Effects) draw their icons at the size of the panel's other 24 pt icon buttons, 16 pt (the icons' native size, as a fill row's eye), not 12 pt; `icon_button_at` goes from 14 to 16 pt with them; the Close and Swap buttons of the assets and prototype panels and the Design panel's Swap orientation and quick-action buttons share the inset. Test: `header_icon_size_tests`. Numbers unchanged. | | 2026-11-05 | patch | M1, #2003: the Design panel's boolean operation menu leads Union, Subtract, Intersect and Exclude with original icons drawn in code (two offset squares, the result filled at reduced alpha). Numbers unchanged. | | 2026-11-02 | minor | M8, #1875: a fill per region. With regions of a vector selected in edit mode (a press inside one with the Move tool, `vector.edit.select {regions}`), the Fill section lists the regions' own fills (the layer's for a region that has none; mixed content when they differ) and its rows and the colour picker edit them: `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` on the edited layer go to the selected regions' stacks (`Region.fills`, what the renderer already draws), the layer's fills and fill style untouched; `regions: [index, ...]` names them on any vector layer (Edit vector layers). Tests: `regions_tests::the_fill_commands_edit_the_selected_regions`. Numbers unchanged. | From 4254a3f39240e9c2eab0a87ee1eb397914a9a183 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 01:36:52 -0500 Subject: [PATCH 177/239] M8: keep the status line's #2146 entry as it was Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and reviewed --- docs/ui-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 711f514ad..e68b7ea65 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-10 · **Change:** minor (M8: Scale tool handle drags pivot on the opposite handle whatever the origin, and the origin starts at the centre (measured in Figma's web app, 2026-11-09); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin, which starts at the centre in one undo step, after which the tool returns to Move with the selection kept; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (M8: Scale tool handle drags pivot on the opposite handle whatever the origin, and the origin starts at the centre (measured in Figma's web app, 2026-11-09); the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: From 293c9226099308e1f334b758ceebb48476841a29 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 01:41:23 -0500 Subject: [PATCH 178/239] Docs: drag modifiers measured in Figma Move and resize modifiers were compared in Figma web on 2026-11-08: Shift locks a move to the dominant axis, Alt copies, Shift keeps the ratio and an edge scales about the opposite edge middle, Alt keeps the centre, Shift+Alt does both, and a modifier changed mid-drag is read fresh. FigCraft matches; Ctrl/Cmd was not measurable. The three ui-parity rows, a revision row and the status line record it, and target-app-parity no longer says modifiers are uncompared. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- docs/target-app-parity.md | 4 ++-- docs/ui-parity.md | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 031ef0726..6c69fe034 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -126,7 +126,7 @@ Breadth: does it exist. Ready: depth, correctness and fidelity for real projects | Dimension | Weight | Ready | Hours | Evidence | Doc | |---|---|---|---|---|---| | Features (depth) | 35 | 63% | 28–67 (areas 1–13, 15, 16, 20) | The table above; core editor ~72% | this file | -| UI/UX fidelity | 15 | 58% | 40–60 | Look & feel compared side by side with UI3 (~65% by the builders); tool-by-tool interaction (modifiers while dragging, hover states, popovers) not yet compared (a cursor for every tool and modifier, number fields and panel widths built from the documentation, not compared); accessibility names and keyboard navigation landed | [ui-parity](ui-parity.md) | +| UI/UX fidelity | 15 | 58% | 40–60 | Look & feel compared side by side with UI3 (~65% by the builders); tool-by-tool interaction not yet compared (move and resize modifiers compared in Figma's web app on 2026-11-08 and matching, Ctrl/Cmd not measured; hover states and popovers not compared) (a cursor for every tool and modifier, number fields and panel widths built from the documentation, not compared); accessibility names and keyboard navigation landed | [ui-parity](ui-parity.md) | | File formats | 12 | 61% | 5–10 | `.sketch` read (Sketch 48 and newer, best effort; 2026-10-21): live symbols, shared styles, Sketch 2025 frames and stacks, checked on three real files against Sketch's own renders (0.8–2% of pixels differ on average); `.fig` read, best effort, with editable vector networks and (2026-10-17) more fidelity, budgets for large files and an import report (tested on generated fixtures, not real files); layers copied from another design app paste the same way (tested only with clipboard HTML made from our own export), `.fig` write experimental (round trips through our own importer; written files open and draw in other software); REST JSON import, SVG in/out, PNG/JPG/WebP/PDF export solid, with a behaviour suite from the documentation | [file-format-parity](file-format-parity.md) | | Collaboration | 10 | 13% | 52–104 | Local comments, version history and branches with review and merge; the multiplayer core (sync model, server ordering, client reconciliation, convergence tests) landed in #103, and live sessions (preview) co-edit a file hosted by a desktop app or kept on a self-hosted `figcraft-server` with edit and view links, joined from the app or the browser, with cursor chat and spotlight (`docs/collab-protocol.md`) | [collaboration-parity](collaboration-parity.md) | | Stability | 8 | 55% | 20–40 | Never-crash lints, command guard with rollback, recovery copies, 963 tests incl. junk-parameter sweeps and a seeded retained-render walk; but two days old, one release (v0.2.0), no field reports, QA mostly on macOS | [gaps](gaps.md) | @@ -196,7 +196,7 @@ and is left out as an area, but its effect on working with Figma users is counte | Discount | Factor | Evidence | |---|---|---| -| Interaction fidelity | ×0.90 | UI3 look compared side by side (~65% by the builders); no tool-by-tool comparison of cursors, modifier keys while dragging, snapping thresholds or popovers yet; Ctrl to suspend snapping on macOS missing ([ui-parity](ui-parity.md)) | +| Interaction fidelity | ×0.90 | UI3 look compared side by side (~65% by the builders); no tool-by-tool comparison of cursors, snapping thresholds or popovers yet (move and resize modifiers were compared in Figma's web app on 2026-11-08 and match, Ctrl/Cmd not measured); Ctrl to suspend snapping on macOS missing ([ui-parity](ui-parity.md)) | | Stability on real machines | ×0.90 | Never-crash lints, command guard with rollback, recovery copies and 963 tests, but no field record at all: the repository is private, v0.2.0 has had no outside users or issue reports, CI tests run on Linux only and hands-on QA is on macOS. Harsher than VectorCraft's ×0.92 because there is no outside evidence either way | | File exchange with Figma users | ×0.85 | A Figma designer's work lives in shared Figma files. FigCraft opens a `.fig` (best effort, not yet checked on real files) and writes an experimental one (written files open and draw in other software; effects, images and prototypes unchecked there); incoming work can come through the REST API JSON (one way, needs an access token), outgoing only as SVG, PDF, PNG or code. Teammates, reviewers and developers would all need FigCraft ([file-format-parity](file-format-parity.md), [collaboration-parity](collaboration-parity.md)) | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index a9883b4d3..c1272cf79 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-10 · **Change:** minor (the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (drag modifiers compared in Figma's web app (2026-11-08): Shift locks a move to the dominant axis, Alt copies, Shift keeps a resize's ratio, Alt keeps its centre, all read afresh on every move, and FigCraft matches (Ctrl/Cmd not measurable); the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -59,17 +59,17 @@ interaction feel not yet compared. | Item | Status | Notes | |---|---|---| -| Click, Shift-click, marquee, Shift-marquee toggle | done | Shift-drag on a selected layer moves the selection, kept to one axis (#498); a marquee selects the top-level layers it touches, by the box and a rotated shape by its outline (rectangle and ellipse measured, the other shapes by the same code); a partly covered top-level frame or section gives the layers in it the marquee touches, an enclosed one is selected itself, an empty frame on touch; a drag from a frame's background selects that frame only when the marquee also takes another top-level frame (then whole), and also takes what it touches outside it; selecting a frame whole keeps the marquee at the top level (a partly covered frame then comes whole too); locked and hidden layers are skipped (`marquee_behaviour_tests`, `selection_behaviour_tests`; measured in Figma's web app, 2026-11-11; Shift and Cmd/Ctrl marquees not measured) (a locked layer selected from the panel ignores the arrow keys and the nudge commands; its properties still edit; measured in Figma's web app, 2026-11-10) | +| Click, Shift-click, marquee, Shift-marquee toggle | done | Shift-drag on a selected layer moves the selection, kept to the dominant axis with no 45° snap (#498; `shift_drag_moves_the_selection`; measured in Figma's web app, 2026-11-08); a marquee selects the top-level layers it touches, by the box and a rotated shape by its outline (rectangle and ellipse measured, the other shapes by the same code); a partly covered top-level frame or section gives the layers in it the marquee touches, an enclosed one is selected itself, an empty frame on touch; a drag from a frame's background selects that frame only when the marquee also takes another top-level frame (then whole), and also takes what it touches outside it; selecting a frame whole keeps the marquee at the top level (a partly covered frame then comes whole too); locked and hidden layers are skipped (`marquee_behaviour_tests`, `selection_behaviour_tests`; measured in Figma's web app, 2026-11-11; Shift and Cmd/Ctrl marquees not measured) (a locked layer selected from the panel ignores the arrow keys and the nudge commands; its properties still edit; measured in Figma's web app, 2026-11-10) | | Deep select (Cmd/Ctrl-click, Cmd/Ctrl-marquee) | done | | | Select layer menu (every layer under the click) | done | | | Escape with layers selected | done | clears the selection at once, whatever the nesting; it never selects the parent. Measured in the Figma web app (2026-11-08) with a rectangle in a group in a frame, selected from the canvas (a double-click into the group), from the Layers panel, and after Tab moved the selection to its sibling: one Escape selects nothing, a second leaves nothing selected. Escape still leaves text and vector editing, ends gestures and the pen first, and ends the focus view once nothing or the focused frame is selected (`selection_behaviour_tests`, `devfocus_tests`) | | Enter / Shift+Enter (children / parent), Tab / Shift+Tab (siblings) | done | Tab renames the next layer while renaming | -| Resize handles: Shift keeps proportions, Alt from centre, constraints-aware | done | Alt shrinks too; past an edge flips (several layers mirror); groups and mixed rotations scale each layer along its own axes, keeping rotation and flip (no skew: children turned off a right angle are approximate); Cmd/Ctrl ignores a frame's constraints (`transform_behaviour_tests`) | +| Resize handles: Shift keeps proportions, Alt from centre, constraints-aware | done | Alt shrinks too; past an edge flips (several layers mirror); groups and mixed rotations scale each layer along its own axes, keeping rotation and flip (no skew: children turned off a right angle are approximate); Cmd/Ctrl ignores a frame's constraints (`transform_behaviour_tests`); Shift keeps the ratio (a corner by the axis dragged most, an edge scaling the other axis about the opposite edge's middle), Alt keeps the centre, Shift+Alt does both, each read afresh on every move (`handle_drags_resize_by_the_documented_rules`; measured in Figma's web app, 2026-11-08; Ctrl/Cmd while dragging not measurable) | | Rotate just outside a corner; Shift in 15° steps | done | rotated handle box when layers share a rotation; Shift lands the rotation on multiples of 15° (measured in Figma: a layer at 7° or -4.27° ends at 15°), not 15° steps from where the drag began; layers with different rotations step the turn from 0 | | Flip, rotate 90° | done | | | Rotation origin (Alt+R) | done | a handle at the selection's centre to drag (snaps to the box's corners, edge middles and centre), double-click puts it back, Escape or Alt+R hides it; the corner handles, the rotation field, Rotate 90°/180° and `transform.rotate` turn about it; it follows the layers and lasts as long as the selection, not saved (the documentation doesn't say; pinned) | | Enter with a shape or frame tool chosen | done | places what a click makes (100×100, lines 100 long, sections 400×300) in the middle of the view, selected (`tool.place`); from the toolbar, Enter on the chosen tool. With nothing selected, the arrows first show a crosshair in the middle of the view and then move it by the nudge amounts (`tool.crosshair`; Shift the large one), and Enter places there; Escape or a tool change takes it away ("Use the arrow keys to activate the crosshair cursor. It will appear in the middle of the viewport indicating where the new object will be placed", Accessibility at Figma; #1839) | -| Alt-drag duplicate | done | the copy snaps to the layer it came from too (edges, centres, equal spacing); Duplicate (Cmd+D) then repeats the copy's offset, also after a Duplicate whose copy was moved, as long as the copies stay selected (the documentation doesn't say; pinned from community answers) | +| Alt-drag duplicate | done | the copy snaps to the layer it came from too (edges, centres, equal spacing); Duplicate (Cmd+D) then repeats the copy's offset, also after a Duplicate whose copy was moved, as long as the copies stay selected (the documentation doesn't say; pinned from community answers); Alt going down or up mid-drag turns the move into a copy or back to the original, with Shift a copy kept to one axis (`alt_pressed_during_a_drag_turns_the_move_into_a_copy`, `alt_shift_drag_on_a_selected_layer_duplicates_it`; measured in Figma's web app, 2026-11-08) | | Drag threshold; double-click into groups and text | done | a press moves or resizes only once the pointer has travelled 3 px on screen, so a click or double-click made with an unsteady hand drags nothing; a double-click goes one level into a group and the next one edits the text under it, wherever on the text it lands, with all of it selected (a double-click in the text being edited selects the word) (`double_click_tests`); Enter on a selected text does the same (all of it selected, typing replaces it) and Escape leaves editing with the layer still selected (`text_enter_tests`) | | Scale tool (K): handles about an anchor, live factor, panel | done | Pressing K opens the Scale section with its factor field focused and its text selected; typing 2 (or 2x, 1.5) then Enter scales the selection by it about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured), as one undo step, then closes the section and returns to Move with the selection kept; Escape in the field closes it, back to Move, nothing changed. Measured in Figma's web app, 2026-11-09. Tests: `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`. | | Nudge 1 / Shift 10 (preference), Cmd+arrows resize | done | arrows reorder auto layout children | @@ -213,6 +213,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| +| 2026-11-12 | patch | Drag modifiers compared in Figma's web app (2026-11-08): Shift locks a move to the dominant axis with no 45° snap, Alt copies, Shift keeps a resize's ratio (an edge scales about the opposite edge's middle), Alt keeps the centre, Shift+Alt does both, and a modifier changed mid-drag is read fresh on each move; FigCraft matches in all six, Ctrl/Cmd while dragging could not be measured; no code change | this page | | 2026-11-10 | patch | M1, #2198: with a shape, frame, slice or Text tool the pointer was the system's crosshair, white under some pointer styles on Windows and lost on the default white frame; it is now drawn at the pointer in dark lines with a white edge, open at the centre (`Glyph::Crosshair`), so it shows on any canvas colour. | | 2026-11-10 | minor | M4, #2222: a boolean group takes a corner radius that rounds every sharp corner of its result (measured in Figma's web app), Boolean groups row | | 2026-11-08 | minor | M8: measured in Figma on 2026-11-08, vector edit mode's Point section: X and Y show the value the selected points share, or Mixed when they differ, and a typed value sets every selected point's own coordinate in the layer being edited, points of other edited layers left as they are (it moved the group's top-left before); a relative edit (`+10`, `*2`, `/2`) typed into a Mixed field applies to each point's own value (`vector.edit.position` takes a number or `{add}`, `{mul}`, `{div}` per axis); the W and H row and other edited layers' points are unchanged. | From 57b885f8d5d405c639f7cacadd875fee1ab277b2 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 02:04:58 -0500 Subject: [PATCH 179/239] M12: Boards: a sticky's text-size menu (Small 16 to Huge 96), remembered for new stickies Measured in FigJam's web app on 2026-11-12: a sticky's own toolbar has a text-size menu (Small 16, Medium 24, Large 40, Extra large 64, Huge 96), a fresh sticky is Small = 16 (the 18 of 2026-11-09 did not reproduce), the note grows taller at Huge and shrinks back, a size chosen with two stickies selected sets both, and the sticky tool remembers the last size. STICKY_TEXT_SIZE is 16 and STICKY_SIZES holds the table. board.setStyle {fontSize} sizes stickies' notes and sets the sticky tool's size (BoardTool.sticky_size); board.sticky takes the tool's size or a fontSize (1 to 1000). The contextual bar shows a size menu (the current name or number, a check on the current entry) when only stickies carry text; shapes keep S/M/L/XL. Docs: boards-parity rows, revision history and status line. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/board_tests.rs | 68 +++++++++++++++++++++---- crates/engine/src/board_tools_tests.rs | 2 +- crates/engine/src/boards/board.rs | 9 +++- crates/engine/src/boards/board/edit.rs | 15 ++++-- crates/engine/src/boards/board/items.rs | 26 ++++++---- crates/ui-egui/locales/en.toml | 5 ++ crates/ui-egui/src/board_ui_tests.rs | 26 ++++++++++ crates/ui-egui/src/canvas/board_bar.rs | 58 ++++++++++++++++++++- docs/boards-parity.md | 9 ++-- 9 files changed, 187 insertions(+), 31 deletions(-) diff --git a/crates/engine/src/board_tests.rs b/crates/engine/src/board_tests.rs index 6dc1e28f8..dfcb28d32 100644 --- a/crates/engine/src/board_tests.rs +++ b/crates/engine/src/board_tests.rs @@ -88,7 +88,7 @@ fn a_sticky_is_a_square_frame_whose_note_grows_taller_as_it_fills() { assert_eq!(n.fills[0].solid_color(), board_color("blue")); assert!(n.layout.is_some() && !n.effects.is_empty()); assert_eq!(n.children.len(), 2, "the note and its author"); - assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 18.0); + assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 16.0); // A click on the note picks the sticky whole. let doc = s.doc().unwrap(); assert_eq!(figcraft_doc::geometry::select_target(doc, note, &[], false), st); @@ -99,19 +99,69 @@ fn a_sticky_is_a_square_frame_whose_note_grows_taller_as_it_fills() { assert!(node(&s, st).width == 200.0 && node(&s, st).height >= 200.0); // Undo puts the short note back. s.execute("edit.undo", &json!({})).unwrap(); - assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 18.0); + assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 16.0); } #[test] -fn a_new_sticky_starts_at_18() { +fn a_new_sticky_is_small_16() { let mut s = board(); for (cmd, p) in [("board.sticky", json!({"x": 0, "y": 0, "text": "Hi"})), ("board.sticky", json!({"x": 300, "y": 0}))] { let note = id(&s.execute(cmd, &p).unwrap(), "text"); - assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 18.0); + assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 16.0); } let next = id(&s.execute("board.nextSticky", &json!({})).unwrap(), "text"); - assert_eq!(node(&s, next).kind.text().unwrap().style.font_size, 18.0); - assert_eq!(STICKY_TEXT_SIZE, 18.0); + assert_eq!(node(&s, next).kind.text().unwrap().style.font_size, 16.0); + assert_eq!(STICKY_TEXT_SIZE, 16.0); +} + +#[test] +fn the_sticky_sizes_are_figjams() { + let table = [("Small", 16.0), ("Medium", 24.0), ("Large", 40.0), ("Extra large", 64.0), ("Huge", 96.0)]; + assert_eq!(crate::board::STICKY_SIZES, table); +} + +fn note_size(s: &Session, note: NodeId) -> f64 { + node(s, note).kind.text().unwrap().style.font_size +} + +#[test] +fn set_style_font_size_sizes_every_selected_sticky() { + let mut s = board(); + let a = s.execute("board.sticky", &json!({"x": 0, "y": 0, "text": "A"})).unwrap(); + let b = s.execute("board.sticky", &json!({"x": 400, "y": 0, "text": "B"})).unwrap(); + let ids = json!([id(&a, "id").0, id(&b, "id").0]); + s.execute("board.setStyle", &json!({"ids": ids, "fontSize": 24})).unwrap(); + assert_eq!(note_size(&s, id(&a, "text")), 24.0); + assert_eq!(note_size(&s, id(&b, "text")), 24.0); + let bad = s.execute("board.setStyle", &json!({"ids": ids, "fontSize": 0})); + assert!(bad.is_err()); +} + +#[test] +fn the_sticky_tool_remembers_the_last_size() { + let mut s = board(); + let a = s.execute("board.sticky", &json!({"x": 0, "y": 0, "text": "A"})).unwrap(); + s.execute("board.setStyle", &json!({"ids": [id(&a, "id").0], "fontSize": 40})).unwrap(); + let b = s.execute("board.sticky", &json!({"x": 400, "y": 0, "text": "B"})).unwrap(); + assert_eq!(note_size(&s, id(&b, "text")), 40.0); + let c = s.execute("board.sticky", &json!({"x": 800, "y": 0, "fontSize": 64})).unwrap(); + assert_eq!(note_size(&s, id(&c, "text")), 64.0); + assert!(s.execute("board.sticky", &json!({"x": 0, "y": 400, "fontSize": 5000})).is_err()); +} + +#[test] +fn a_huge_sticky_grows_taller_and_shrinks_back() { + figcraft_text::scan_system_fonts(); + let mut s = board(); + let r = s.execute("board.sticky", &json!({"x": 0, "y": 0, "text": "Alpha"})).unwrap(); + let st = id(&r, "id"); + let ids = json!([st.0]); + let (w, h16) = (node(&s, st).width, node(&s, st).height); + s.execute("board.setStyle", &json!({"ids": ids, "fontSize": 96})).unwrap(); + assert_eq!(node(&s, st).width, w, "the width stays"); + assert!(node(&s, st).height > h16, "Huge is taller than Small"); + s.execute("board.setStyle", &json!({"ids": ids, "fontSize": 40})).unwrap(); + assert_eq!(node(&s, st).height, h16, "Large is square again"); } #[test] @@ -131,7 +181,7 @@ fn a_sticky_keeps_its_text_size_as_text_is_added() { } let ten = node(&s, note).kind.text().unwrap().clone(); assert_eq!(ten.characters.matches('\n').count(), 9, "ten lines"); - assert_eq!(ten.style.font_size, 18.0); + assert_eq!(ten.style.font_size, 16.0); assert!(node(&s, note).height > text_height, "ten lines make the text taller"); assert!(node(&s, st).height > height, "and the note"); assert_eq!(node(&s, st).child_layout.sizing_v, figcraft_doc::Sizing::Hug, "the note hugs its text"); @@ -140,8 +190,8 @@ fn a_sticky_keeps_its_text_size_as_text_is_added() { crate::textedit::end(&mut s).unwrap(); let t = node(&s, note).kind.text().unwrap().clone(); assert!(t.characters.chars().count() >= 250); - assert_eq!(t.style.font_size, 18.0); - assert!(t.runs.iter().all(|r| r.style.font_size == 18.0)); + assert_eq!(t.style.font_size, 16.0); + assert!(t.runs.iter().all(|r| r.style.font_size == 16.0)); assert_eq!(node(&s, st).width, w, "the note keeps its width"); assert!(node(&s, st).height > h10, "and grows taller"); } diff --git a/crates/engine/src/board_tools_tests.rs b/crates/engine/src/board_tools_tests.rs index 1e306a7d9..f36503edc 100644 --- a/crates/engine/src/board_tools_tests.rs +++ b/crates/engine/src/board_tools_tests.rs @@ -166,9 +166,9 @@ fn styles_labels_and_their_refusals() { assert!(s.execute("board.label", &json!({"id": c, "text": ""})).unwrap()["label"].is_null()); assert!(!s.doc().unwrap().contains(l)); // What doesn't take a style or colour says so. - assert!(s.execute("board.setStyle", &json!({"ids": [a], "fontSize": 30})).is_err(), "stickies size their own text"); assert!(s.execute("board.setStyle", &json!({"ids": [c], "fontSize": 0})).is_err()); let st = id(&s.execute("board.stamp", &json!({"x": 0, "y": 0, "stamp": "check"})).unwrap(), "id"); + assert!(s.execute("board.setStyle", &json!({"ids": [st], "fontSize": 30})).is_err(), "a stamp has no text to size"); assert!(s.execute("board.setColor", &json!({"ids": [st], "color": "blue"})).is_err()); assert!(s.execute("board.setColor", &json!({"ids": [a]})).is_err()); assert!(s.execute("board.label", &json!({"id": a, "text": "x"})).is_err()); diff --git a/crates/engine/src/boards/board.rs b/crates/engine/src/boards/board.rs index d87b82914..ddee2d823 100644 --- a/crates/engine/src/boards/board.rs +++ b/crates/engine/src/boards/board.rs @@ -100,12 +100,16 @@ const HIGHLIGHTER: (f64, f32) = (20.0, 0.45); const ERASER_PX: f64 = 8.0; /// The text sizes the contextual bar offers. pub const TEXT_SIZES: [(&str, f64); 4] = [("S", 12.0), ("M", 16.0), ("L", 24.0), ("XL", 36.0)]; +/// The text sizes a sticky's menu offers (FigJam's, measured 2026-11-12): name and size. +pub const STICKY_SIZES: [(&str, f64); 5] = [("Small", 16.0), ("Medium", 24.0), ("Large", 40.0), ("Extra large", 64.0), ("Huge", 96.0)]; /// The board tools' choices: the colour new stickies get, the shape and stamp the tools place, /// how new connectors run and the marker's and highlighter's colours. #[derive(Clone, Debug)] pub struct BoardTool { pub sticky: Color, + /// The text size new stickies get (the last one chosen on a sticky). + pub sticky_size: f64, pub shape: BoardShape, pub stamp: Stamp, pub routing: Routing, @@ -118,6 +122,7 @@ impl Default for BoardTool { let first = BOARD_COLORS.first().map_or(Color::WHITE, |c| c.1); Self { sticky: first, + sticky_size: STICKY_TEXT_SIZE, shape: BoardShape::Rectangle, stamp: Stamp::ThumbsUp, routing: Routing::Elbow, @@ -132,7 +137,7 @@ pub fn specs() -> Vec { spec!( "board.sticky", "Sticky note", - "{x, y (its top-left, in the parent), text?, color? (yellow|orange|red|pink|violet|blue|green|gray or hex; default the sticky tool's), author? (a name, or false for none; default yours), parent?} → {id, text}", + "{x, y (its top-left, in the parent), text?, color? (yellow|orange|red|pink|violet|blue|green|gray or hex; default the sticky tool's), fontSize? (1 to 1000; default the sticky tool's, 16 at first), author? (a name, or false for none; default yours), parent?} → {id, text}", true, sticky_cmd ), @@ -217,7 +222,7 @@ pub fn specs() -> Vec { spec!( "board.setStyle", "Board style", - "{ids?, shape? (shapes with text), fontSize? (their text), style?: straight|elbow|curved, startCap?, endCap? (connectors)}", + "{ids?, shape? (shapes with text), fontSize? (the text of stickies, shapes, labels and mind nodes; stickies remember it for new ones), style?: straight|elbow|curved, startCap?, endCap? (connectors)}", true, set_style ), diff --git a/crates/engine/src/boards/board/edit.rs b/crates/engine/src/boards/board/edit.rs index 88a38d438..61a3c5659 100644 --- a/crates/engine/src/boards/board/edit.rs +++ b/crates/engine/src/boards/board/edit.rs @@ -130,9 +130,12 @@ impl Restyle { BoardItem::Connector(ref c) => self.restyle_connector(doc, id, c.clone())?, _ => false, }; - // Text sizes: shapes' and labels' text (stickies size theirs to fit). + // Text sizes: the text of stickies, shapes, labels and mind nodes (a sticky's note grows taller + // when its text no longer fits, by its auto layout). let sized = match (self.size, &item) { - (Some(size), BoardItem::Shape { .. } | BoardItem::Label { .. } | BoardItem::MindNode) => resize_text(doc, id, size), + (Some(size), BoardItem::Sticky { .. } | BoardItem::Shape { .. } | BoardItem::Label { .. } | BoardItem::MindNode) => { + resize_text(doc, id, size) + } _ => false, }; Ok(changed || sized) @@ -191,13 +194,19 @@ pub(super) fn set_style(s: &mut Session, p: &Value) -> Result { let restyle = Restyle::of(cmd, p)?; let doc = s.doc_mut()?; let mut changed = Vec::new(); + let mut sticky_sized = false; for (id, item) in items(doc, &ids) { + let sticky = matches!(item, BoardItem::Sticky { .. }); if restyle.apply(doc, id, item)? { changed.push(id); + sticky_sized |= sticky && restyle.size.is_some(); } } if changed.is_empty() { - return Err(bad(cmd, "nothing selected takes these (shapes with text, connectors, labels)")); + return Err(bad(cmd, "nothing selected takes these (stickies, shapes with text, connectors, labels)")); + } + if let (true, Some(size)) = (sticky_sized, restyle.size) { + s.tool.board.sticky_size = size; } Ok(json!({"ids": changed})) } diff --git a/crates/engine/src/boards/board/items.rs b/crates/engine/src/boards/board/items.rs index c70952695..431a27cf9 100644 --- a/crates/engine/src/boards/board/items.rs +++ b/crates/engine/src/boards/board/items.rs @@ -57,12 +57,13 @@ pub(crate) fn add_text(doc: &mut Document, parent: NodeId, text: &str, size: f64 Ok(id) } -/// The text size of a new sticky's note, FigJam's "Small" default (measured in the web app, -/// 2026-11-09): it never changes as the note fills, the note grows taller instead. -pub const STICKY_TEXT_SIZE: f64 = 18.0; +/// The text size of a new sticky's note, FigJam's "Small" default: 16, measured twice in the web +/// app on 2026-11-12 from the size field's value (an earlier reading of 18 did not reproduce). It +/// never changes as the note fills, the note grows taller instead. +pub const STICKY_TEXT_SIZE: f64 = 16.0; /// A sticky note's layers: the frame, the note and (when known) its author. -fn make_sticky(doc: &mut Document, parent: NodeId, at: (f64, f64), text: &str, color: Color, author: &str) -> Result<(NodeId, NodeId)> { +fn make_sticky(doc: &mut Document, parent: NodeId, at: (f64, f64), text: &str, color: Color, author: &str, size: f64) -> Result<(NodeId, NodeId)> { let id = add(doc, parent, NodeKind::Frame, "Sticky", at, (STICKY, STICKY), |n| { n.fills = vec![Paint::solid(color)]; n.corners.radii = [2.0; 4]; @@ -80,7 +81,7 @@ fn make_sticky(doc: &mut Document, parent: NodeId, at: (f64, f64), text: &str, c n.board = Some(BoardItem::Sticky { author: author.to_string() }); })?; let inner = STICKY - 2.0 * STICKY_PAD; - let note = add_text(doc, id, text, STICKY_TEXT_SIZE, INK, TextAlignH::Left, inner)?; + let note = add_text(doc, id, text, size, INK, TextAlignH::Left, inner)?; if !author.is_empty() { let a = add_text(doc, id, author, 10.0, AUTHOR_INK, TextAlignH::Left, inner)?; if let Some(n) = doc.node_mut(a) { @@ -102,7 +103,12 @@ pub(super) fn sticky_cmd(s: &mut Session, p: &Value) -> Result { let parent = parent_of(cmd, s, p)?; let text = string(p, "text").unwrap_or_default(); let at = (num_or(p, "x", 0.0), num_or(p, "y", 0.0)); - let (id, note) = make_sticky(s.doc_mut()?, parent, at, &text, color, &author)?; + let size = match num(p, "fontSize") { + None => s.tool.board.sticky_size, + Some(v) if v.is_finite() && (1.0..=1000.0).contains(&v) => v, + Some(_) => return Err(bad(cmd, "`fontSize` is from 1 to 1000")), + }; + let (id, note) = make_sticky(s.doc_mut()?, parent, at, &text, color, &author, size)?; s.set_selection(vec![id]); Ok(json!({"id": id, "text": note})) } @@ -155,11 +161,11 @@ pub(super) fn next_sticky(s: &mut Session, p: &Value) -> Result { "above" => (0.0, -(STICKY + STICKY_GAP)), other => return Err(bad(cmd, format!("`side` is right, below, left or above, not `{other}`"))), }; - let author = author(s); + let (author, size) = (author(s), s.tool.board.sticky_size); if editing.is_some() { textedit::end(s)?; } - let (id, note) = make_sticky(s.doc_mut()?, parent, (at.x + dx, at.y + dy), "", color, &author)?; + let (id, note) = make_sticky(s.doc_mut()?, parent, (at.x + dx, at.y + dy), "", color, &author, size)?; s.set_selection(vec![id]); if boolean(p, "edit") == Some(true) { // Typing goes on in the new sticky once this step is recorded. @@ -227,13 +233,13 @@ pub(super) fn add_connected(s: &mut Session, p: &Value) -> Result { } None => (to_at, from_side, to_side), }; - let (routing, author, page) = (s.tool.board.routing, author(s), s.page()?); + let (routing, author, page, size) = (s.tool.board.routing, author(s), s.page()?, s.tool.board.sticky_size); if editing.is_some() { textedit::end(s)?; } let doc = s.doc_mut()?; let (id, text) = match shape { - None => make_sticky(doc, parent, to_at, "", color, &author)?, + None => make_sticky(doc, parent, to_at, "", color, &author, size)?, Some(shape) => make_shape(doc, parent, to_at, next, shape, "", color)?, }; let connector = Connector { diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index 71e6ff010..b0abc6b8e 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -1578,6 +1578,11 @@ name = "English" "Text content" = "Text content" "Text on a path" = "Text on a path" "Text size" = "Text size" +"Small" = "Small" +"Medium" = "Medium" +"Large" = "Large" +"Extra large" = "Extra large" +"Huge" = "Huge" "Text style" = "Text style" "Text styles" = "Text styles" "Texts" = "Texts" diff --git a/crates/ui-egui/src/board_ui_tests.rs b/crates/ui-egui/src/board_ui_tests.rs index 867ba139a..bd0a8b21f 100644 --- a/crates/ui-egui/src/board_ui_tests.rs +++ b/crates/ui-egui/src/board_ui_tests.rs @@ -398,3 +398,29 @@ fn cmd_while_moving_a_connector_end_places_it_on_the_object() { drag(&mut u, Modifiers::NONE); assert!(matches!(end(&u), figcraft_doc::End::Node { at: None, side: figcraft_doc::Side::Right, .. }), "{:?}", end(&u)); } + +#[test] +fn a_selected_sticky_has_a_size_menu_instead_of_the_size_cells() { + let mut u = board(); + let r = u.app.session.execute("board.sticky", &json!({"x": 0, "y": 0, "text": "Alpha"})).unwrap(); + let note = figcraft_engine::board::text_of(u.app.session.doc().unwrap(), id(&r)).unwrap(); + u.frame(vec![]); + u.frame(vec![]); + let shapes = flat(&u.frame_output(vec![]).shapes); + assert!(has_text(&shapes, "Small"), "the menu reads Small"); + assert!(!has_text(&shapes, "XL"), "no S/M/L/XL cells"); + // The menu sits after the 8 colours (208 from the bar's left edge). + let b = bar(&u).expect("the bar shows"); + click(&mut u, pos2(b.min.x + 208.0 + 40.0, b.center().y)); + let shapes = flat(&u.frame_output(vec![]).shapes); + // Each row is padded to line up with the check mark on the current one. + for name in ["✓ Small", " Medium", " Large", " Extra large", " Huge"] { + assert!(has_text(&shapes, name), "{name:?} in the menu"); + } + click(&mut u, text_center(&shapes, " Large")); + let size = |u: &Ui| u.app.session.doc().unwrap().node(note).unwrap().kind.text().unwrap().style.font_size; + assert_eq!(size(&u), 40.0); + u.frame(vec![]); + let shapes = flat(&u.frame_output(vec![]).shapes); + assert!(has_text(&shapes, "Large") && !has_text(&shapes, "Small"), "the menu reads Large"); +} diff --git a/crates/ui-egui/src/canvas/board_bar.rs b/crates/ui-egui/src/canvas/board_bar.rs index e75116b66..fa3d5e4e5 100644 --- a/crates/ui-egui/src/canvas/board_bar.rs +++ b/crates/ui-egui/src/canvas/board_bar.rs @@ -4,7 +4,7 @@ use egui::{Color32, CornerRadius, Pos2, Rect, Sense, Stroke, StrokeKind, Ui, pos2, vec2}; use figcraft_doc::{BOARD_COLORS, BoardItem, BoardShape, NodeId, NodeKind, Routing, Stamp, StrokeCap}; -use figcraft_engine::board::{BoardTool, TEXT_SIZES}; +use figcraft_engine::board::{BoardTool, STICKY_SIZES, TEXT_SIZES}; use figcraft_engine::board_grid::GridStyle; use serde_json::{Value, json}; @@ -96,6 +96,9 @@ struct Has { color: bool, shape: Option, text: bool, + /// The first selected sticky's text size: stickies take a size menu (not the S/M/L/XL cells) + /// when they are the only text-bearing objects selected. + sticky: Option, connector: Option, /// Every selected board object is a connector: the colour part offers any colour too. only_lines: bool, @@ -121,7 +124,15 @@ fn has(app: &FigApp) -> Option { for n in ds.selection.iter().filter_map(|id| ds.doc.node(*id)) { others |= n.board.is_some() && !matches!(n.board, Some(BoardItem::Connector(_))); match &n.board { - Some(BoardItem::Sticky { .. } | BoardItem::Ink) => h.color = true, + Some(BoardItem::Sticky { .. }) => { + h.color = true; + let size = figcraft_engine::board::text_of(&ds.doc, n.id) + .and_then(|t| ds.doc.node(t)) + .and_then(|t| t.kind.text()) + .map_or(figcraft_engine::board::STICKY_TEXT_SIZE, |t| t.style.font_size); + h.sticky.get_or_insert(size); + } + Some(BoardItem::Ink) => h.color = true, Some(BoardItem::Shape { shape }) => { h.color = true; h.text = true; @@ -154,6 +165,8 @@ const SWATCH: f32 = 20.0; const GAP: f32 = 4.0; /// The room each part takes after its controls (the divider and the gap around it). const PART_END: f32 = 8.0; +/// The sticky size menu's width: its name ("Extra large") and the chevron. +const STICKY_W: f32 = 96.0; impl Has { /// The bar's width for these parts. @@ -168,6 +181,9 @@ impl Has { if self.shape.is_some() { w += CELL + 12.0 + GAP + PART_END; } + if self.sticky.is_some() && !self.text { + w += STICKY_W + PART_END; + } if self.text { w += TEXT_SIZES.len() as f32 * (CELL + 2.0) + PART_END; } @@ -226,6 +242,8 @@ pub fn show(app: &mut FigApp, ctx: &egui::Context) { } if h.text { x = size_part(app, ui, x, cy, &t); + } else if let Some(size) = h.sticky { + x = sticky_size_part(app, ui, size, pos2(x, cy), &t); } if h.table { x = crate::board_picker::table_part(app, ui, x, cy, &t); @@ -338,6 +356,42 @@ fn size_part(app: &mut FigApp, ui: &mut Ui, mut x: f32, cy: f32, t: &Tokens) -> divider(ui, t, x, cy) } +/// A sticky size's name as the UI says it (`None` when no entry has that size). +fn sticky_size_label(size: f64) -> Option<&'static str> { + STICKY_SIZES.iter().find(|(_, s)| (*s - size).abs() < 0.01).map(|(name, _)| match *name { + "Small" => tr_noop("Small"), + "Medium" => tr_noop("Medium"), + "Large" => tr_noop("Large"), + "Extra large" => tr_noop("Extra large"), + _ => tr_noop("Huge"), + }) +} + +/// The sticky text size menu at `at` (its left edge and middle), showing `size` by name, or as a +/// number when no entry has it; `board.setStyle {fontSize}`; where the next part starts. +fn sticky_size_part(app: &mut FigApp, ui: &mut Ui, size: f64, at: Pos2, t: &Tokens) -> f32 { + let r = Rect::from_min_size(pos2(at.x, at.y - CELL / 2.0), vec2(STICKY_W, CELL)); + let tip = tr("Text size"); + let resp = ui.interact(r, ui.scope_id().with("bb_sticky_size"), Sense::click()).on_hover_text(tip); + a11y::menu_button(&resp, tip, a11y::menu_open(&resp)); + if resp.hovered() { + ui.painter().rect_filled(r, CornerRadius::same(5), t.hover); + } + let name = sticky_size_label(size).map_or_else(|| format!("{}", (size * 100.0).round() / 100.0), |l| tr(l).to_string()); + ui.painter().text(pos2(r.min.x + 8.0, at.y), egui::Align2::LEFT_CENTER, name, semibold(11.0), t.text); + icons::paint(ui.painter(), Rect::from_center_size(pos2(r.max.x - 9.0, at.y), vec2(12.0, 12.0)), Icon::Chevron, t.icon_secondary); + crate::right::menu_popup(&resp).show(|ui| { + for (name, value) in STICKY_SIZES { + let label = sticky_size_label(value).unwrap_or(name); + if crate::right::menu_check(ui, (value - size).abs() < 0.01, tr(label), "") { + app.run("board.setStyle", json!({"fontSize": value})); + ui.close(); + } + } + }); + divider(ui, t, at.x + STICKY_W, at.y) +} + /// A start or end point menu's width: the end's picture and the menu's chevron. const CAP_W: f32 = 62.0; /// The line style menu's width. diff --git a/docs/boards-parity.md b/docs/boards-parity.md index 04cb832bc..139461500 100644 --- a/docs/boards-parity.md +++ b/docs/boards-parity.md @@ -1,6 +1,6 @@ # Boards parity -> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-10 · **Change:** minor (resizing a board table by height changes its rows, not blank space below them: a bottom or top edge grows the last row, a corner shares the change over every row, and a table keeps at least 40 per cell, measured in FigJam's web app, 2026-11-09 (#2172); a `.jam` file's stickies come in as native board stickies, with their colour, text and author kept and the size as saved (#1808); a sticky's text stays 18 and the note grows taller instead of the text shrinking, as measured in FigJam's web app (#2157); mind maps, first step: a first node with three children on curved branches, laid out again after every edit (`board.mindMap`, `board.mindMapAdd`, #2226); a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) +> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-12 · **Change:** minor (a sticky has a text-size menu in the contextual bar, Small 16, Medium 24, Large 40, Extra large 64 and Huge 96, with Small the default (an earlier reading of 18 did not reproduce); `board.setStyle {fontSize}` sizes stickies and the sticky tool remembers the last size for new ones; the note grows taller at Huge and shrinks back, as measured in FigJam's web app, 2026-11-12; resizing a board table by height changes its rows, not blank space below them: a bottom or top edge grows the last row, a corner shares the change over every row, and a table keeps at least 40 per cell, measured in FigJam's web app, 2026-11-09 (#2172); a `.jam` file's stickies come in as native board stickies, with their colour, text and author kept and the size as saved (#1808); a sticky's text stays 18 and the note grows taller instead of the text shrinking, as measured in FigJam's web app (#2157); mind maps, first step: a first node with three children on curved branches, laid out again after every edit (`board.mindMap`, `board.mindMapAdd`, #2226); a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) **Breadth ~47%, ready ~29% (estimated, erring low).** A board is a FigCraft file of its own kind (`file.newBoard`) with a dot grid on the page, sticky notes, shapes with text, connectors that @@ -28,10 +28,10 @@ all end with the same geometry. |---|---|---| | Board files: File ▸ New board, the home screen's New board card, a light page | done | `file.newBoard`; the kind shows in `inspect_document`, tabs and file rows (a note mark; design files a pen nib) | | Board toolbar at the bottom | done | Move/Hand, Marker/Highlighter/Eraser, Sticky (colour flyout), Shapes (flyout), Connector, Text, Section, Stamp (flyout), Comment, Actions, then the templates and the Design panel's buttons — on the same 32 pt grid as a design file's (no Resources button, as there) | -| Design panel hidden by default; a contextual bar above the selection | done | colour, shape, text size (S/M/L/XL); for connectors straight/elbow/curved, the start and end points (none, round, square, line arrow, triangle arrow, reversed triangle, circle, diamond), solid or dashed, the weight, and any colour in the colour picker beside the board colours (#1596); each control says what it is on hover; the Design panel opens with its button or View ▸ Design panel | +| Design panel hidden by default; a contextual bar above the selection | done | colour, shape, text size (S/M/L/XL for shapes and labels; a size menu, Small to Huge, for stickies); for connectors straight/elbow/curved, the start and end points (none, round, square, line arrow, triangle arrow, reversed triangle, circle, diamond), solid or dashed, the weight, and any colour in the colour picker beside the board colours (#1596); each control says what it is on hover; the Design panel opens with its button or View ▸ Design panel | | Prototyping and Developer Mode refuse on boards | done | `proto.*`, `dev.*`, `view.prototype`, `view.devMode` say why | -| Sticky notes | done | a square frame (200 wide, growing taller through auto layout), 8 soft colours, a soft shadow, the note's text 18 by default and fixed (FigJam's "Small"): the note grows taller as it fills and never shrinks its text, measured in FigJam's web app, 2026-11-09; stickies saved with another size keep it, and there is no size menu yet (#2157), the author's name at the bottom; a click places one and starts typing; Enter or a double-click edits; Shift+Cmd/Ctrl+Enter adds the next one beside it | -| Sticky options: hide the author, change size presets, sticky stacks | partial | `board.sticky {author: false}`; no size presets or stacks | +| Sticky notes | done | a square frame (200 wide, growing taller through auto layout), 8 soft colours, a soft shadow, the note's text 16 by default (FigJam's "Small", read twice from its size field, 2026-11-12) and fixed as it fills: the note grows taller and never shrinks its text (2026-11-09, #2157); a size menu in the contextual bar (Small 16, Medium 24, Large 40, Extra large 64, Huge 96; a number when the size matches none) sets every selected sticky, the note grows taller when Huge no longer fits and shrinks back to square at Large, and the sticky tool remembers the last size for new stickies, all measured in FigJam's web app, 2026-11-12; stickies saved with another size keep it, the author's name at the bottom; a click places one and starts typing; Enter or a double-click edits; Shift+Cmd/Ctrl+Enter adds the next one beside it | +| Sticky options: hide the author, change size presets, sticky stacks | partial | `board.sticky {author: false}`; size presets done (the bar's menu, `board.setStyle {fontSize}`, `board.sticky {fontSize}`); no stacks | | Shapes with text | done | rectangle, rounded rectangle, ellipse, diamond, triangle, speech bubble, chevron; text centred and wrapping inside the outline; shape type and text size from the contextual bar | | Shape auto-fit to its text, more shapes (cylinder, cross, star…), shape libraries | missing | | | Connectors | done | from a layer's side (the facing one, or one named) to another layer or a free point, straight, elbow or curved, arrowheads (the stroke's caps), a label in the middle of the route by length (double-click to add); while one is dragged out it shows as it will be made (route, line and arrowhead), the object under the pointer outlined with its four attach points (side middles), the one the end goes to ringed; an end dropped on the outer half of an object takes the side it is towards (a drop along a whole edge chooses that edge), one in the middle takes the facing side; re-routed when either end moves or resizes; a deleted end stays where it was; an end attached to a side starts 4 pt outside the border (`board_route::END_GAP`), so the stroke never lies on the fill; elbows leaving one side share their first run along its normal and curves leave tangent to it (#1916) | @@ -72,6 +72,7 @@ all end with the same geometry. | Date | Change | Summary | |---|---|---| +| 2026-11-12 | minor | M12: a sticky's text-size menu. Measured in FigJam's web app, 2026-11-12: the menu lists Small 16, Medium 24, Large 40, Extra large 64 and Huge 96 (typing 40 shows Large), a fresh sticky is Small = 16 (read twice from the size field; the 18 of 2026-11-09 did not reproduce), the note stays square to Extra large and grows taller at Huge with the same width and shrinks back at Large, choosing a size with two stickies selected sets both, and the sticky tool remembers the last size. `STICKY_TEXT_SIZE` is 16, `STICKY_SIZES` holds the table, `board.setStyle {fontSize}` sizes stickies and sets the tool's size, `board.sticky` takes `fontSize`, and the contextual bar shows a size menu when only stickies carry text (shapes keep S/M/L/XL, unmeasured). Stacks are still missing. Tests: `a_new_sticky_is_small_16`, `the_sticky_sizes_are_figjams`, `set_style_font_size_sizes_every_selected_sticky`, `the_sticky_tool_remembers_the_last_size`, `a_huge_sticky_grows_taller_and_shrinks_back`, `a_selected_sticky_has_a_size_menu_instead_of_the_size_cells` | | 2026-11-09 | minor | M12, #2172: a board table's height change goes into its rows. Measured in FigJam's web app, 2026-11-09 (a table has no lock-proportions control and never scales proportionally): a bottom-edge drag grows only the last row, a corner drag shares the change equally over every row and column, text keeps its size, and a table stops shrinking at about 52 per cell with a row never shorter than its wrapped text. FigCraft already split a width change equally (every cell fills); the bug was height: a bottom or corner resize turned the table from hugging to fixed height, so the rows stayed at 40 with blank space below them (or were clipped when shrunk) and typing no longer grew the table. `board_table::settle_resize`, called first in the normalize pass, finds a table left at a fixed height, puts the change into the rows' minimum height (the last row, or every row when both axes changed), raises a width that is too narrow to `columns x 40`, and returns the table to hugging, so every route (drag, `node.set`, `transform.resize`, MCP, live-session peers) gives the same result, in one undo step. FigCraft's floor is 40 (FigJam's is about 52) and there are no per-column widths yet: a side drag of the right edge still splits equally where FigJam grows only the last column. Numbers unchanged. Tests: `board_tables_tests` (the bottom, corner and side drags, the floor, typing after a resize and undo, live sessions, junk). | | 2026-11-09 | patch | M12, #2157: a sticky's text is 18 and stays 18 (measured in FigJam's web app: ten lines, then a long paragraph, never changed it; the note kept its width and grew taller). The normalize pass no longer resets a sticky's text to a size by its length (24 down to 11 before), so stickies in saved files keep their size. Size presets (Small to Huge) are still missing. Tests: `a_new_sticky_starts_at_18`, `a_sticky_keeps_its_text_size_as_text_is_added`, `a_sticky_saved_with_another_text_size_keeps_it` | | 2026-11-10 | minor | M12, #2226 (step 1 of 4): mind maps in the document and engine. A mind map node is a board object of its own (`BoardItem::MindNode`: text with no box) and a branch is a connector marked `branch`; the map's shape is read from its branches. `board.mindMap` places a first node with three children and `board.mindMapAdd` adds a child or a sibling, each one undo step. The normalize pass lays a touched map out again from its first node (`board::settle_mind_maps`, `figcraft_doc::mind_layout`): 88 between columns, 48 between siblings, each stack centred on its parent, numbers from a FigJam file saved and decoded. Tests: `board_mindmap_tests` in doc (five) and engine (eight). Numbers unchanged (no toolbar entry yet). | From 03bfdadb880e88fda641e486885565c5a3c63e6e Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 02:38:07 -0500 Subject: [PATCH 180/239] Docs: one Resize handles row after the merge Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and reviewed --- docs/ui-parity.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 01666632f..15927b607 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -65,7 +65,6 @@ interaction feel not yet compared. | Escape with layers selected | done | clears the selection at once, whatever the nesting; it never selects the parent. Measured in the Figma web app (2026-11-08) with a rectangle in a group in a frame, selected from the canvas (a double-click into the group), from the Layers panel, and after Tab moved the selection to its sibling: one Escape selects nothing, a second leaves nothing selected. Escape still leaves text and vector editing, ends gestures and the pen first, and ends the focus view once nothing or the focused frame is selected (`selection_behaviour_tests`, `devfocus_tests`) | | Enter / Shift+Enter (children / parent), Tab / Shift+Tab (siblings) | done | Tab renames the next layer while renaming | | Resize handles: Shift keeps proportions, Alt from centre, constraints-aware | done | Alt shrinks too; past an edge flips (several layers mirror); groups and mixed rotations scale each layer along its own axes, keeping rotation and flip (no skew: children turned off a right angle are approximate); Cmd/Ctrl ignores a frame's constraints (`transform_behaviour_tests`); Shift keeps the ratio (a corner by the axis dragged most, an edge scaling the other axis about the opposite edge's middle), Alt keeps the centre, Shift+Alt does both, each read afresh on every move (`handle_drags_resize_by_the_documented_rules`; measured in Figma's web app, 2026-11-08; Ctrl/Cmd while dragging not measurable) | -| Resize handles: Shift keeps proportions, Alt from centre, constraints-aware | done | Alt shrinks too; past an edge flips (several layers mirror); groups and mixed rotations scale each layer along its own axes, keeping rotation and flip (no skew: children turned off a right angle are approximate); Cmd/Ctrl ignores a frame's constraints (`transform_behaviour_tests`) | | Rotate just outside a corner; Shift in 15° steps | done | rotated handle box when layers share a rotation; the Rotation field shows and sets the rotation on the page (its own angle plus its parents'), in frames and groups alike, measured in Figma's web app 2026-11-10 (#2196): a rectangle drawn inside a turned frame reads 0, typing 7 makes it 7 on the page; the panel sends `node.set absoluteRotation`, while `rotation` stays the angle to the parent for scripts, inspect, codegen and the formats. Pinned, not measured: several layers read one value when their page angles agree (typing sets them all, one undo step); a flipped layer reads in the same form as before (a horizontal flip reads 180 plus the angle) and typing keeps the flip; a flipped parent is handled by the world math. Tests: `absolute_rotation_sets_the_rotation_on_the_page_keeping_the_centre`, `the_absolute_rotation_key_turns_about_a_moved_origin_too`, `the_rotation_field_shows_and_sets_the_rotation_on_the_page` | | Rotate just outside a corner; Shift in 15° steps | done | rotated handle box when layers share a rotation; Shift lands the rotation on multiples of 15° (measured in Figma: a layer at 7° or -4.27° ends at 15°), not 15° steps from where the drag began; layers with different rotations step the turn from 0 | | Flip, rotate 90° | done | | From 70552482c428aef528a11ca67bf5b4d050f5f2bf Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 02:51:37 -0500 Subject: [PATCH 181/239] M8: the popover's close glyph is 16 pt too, and the style picker's 24 pt check allows rounding (#2238) The popover's 24 pt close button painted its cross through rect.shrink(6.0), a 12 pt glyph; it now goes through icon_glyph_rect like the other 24 pt buttons, with a painted-size test that failed before the change. The style picker's menu_icon picked the 16 pt glyph with an exact size equality, so a button at a fractional x that measured a hair off 24 in f32 painted at 14 pt; it now allows 0.5 pt of rounding. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/ui-egui/src/popover.rs | 4 ++-- crates/ui-egui/src/popover_tests.rs | 21 +++++++++++++++++++++ crates/ui-egui/src/widgets/style_picker.rs | 6 +++++- docs/ui-parity.md | 2 +- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/popover.rs b/crates/ui-egui/src/popover.rs index d91558d46..82886227d 100644 --- a/crates/ui-egui/src/popover.rs +++ b/crates/ui-egui/src/popover.rs @@ -262,13 +262,13 @@ fn header_text(t: Tokens, dark: bool) -> Color32 { if dark { t.menu_text } else { t.text } } -/// The X: a 24-point button, its icon inset 6 (the colour picker's header). +/// The X: a 24-point button, its cross 16 points like every 24 pt icon button (the colour picker's header). fn close_button(ui: &mut Ui, id: Id, rect: Rect, dark: bool, t: Tokens) -> bool { let resp = ui.interact(rect, id, Sense::click()).tip(tr("Close")); if resp.hovered() { ui.painter().rect_filled(rect, CornerRadius::same(5), if dark { Color32::from_white_alpha(20) } else { t.hover }); } - icons::paint(ui.painter(), rect.shrink(6.0), Icon::Close, if dark { t.menu_text } else { t.icon }); + icons::paint(ui.painter(), crate::widgets::icon_glyph_rect(rect), Icon::Close, if dark { t.menu_text } else { t.icon }); resp.clicked() } diff --git a/crates/ui-egui/src/popover_tests.rs b/crates/ui-egui/src/popover_tests.rs index 06daca851..6c4e559ee 100644 --- a/crates/ui-egui/src/popover_tests.rs +++ b/crates/ui-egui/src/popover_tests.rs @@ -194,3 +194,24 @@ fn a_caller_can_put_it_where_it_likes() { draw(&ctx, &mut t, &mut p, at, Hold::default(), vec![]); assert!(near(p.rect.min, pos2(360.0, 300.0)), "dropped where the drag left it: {:?}", p.rect); } + +mod icon_size_tests { + use super::*; + use crate::header_icon_size_tests::paints_icon_at_button_size; + use crate::icons::Icon; + + /// The header's 24 pt X paints its cross at 16 pt, like every other 24 pt icon button (#2238). + #[test] + fn the_close_button_paints_a_16pt_cross() { + let ctx = context(); + let mut t = 0.0; + let mut p = Popover::new("popover_close_size", "Colour"); + let shapes = settle(&ctx, &mut t, &mut p, Open::At(pos2(160.0, 100.0))); + let painted: Vec = shapes + .iter() + .filter(|s| matches!(s, egui::Shape::Path(_) | egui::Shape::Mesh(_) | egui::Shape::LineSegment { .. } | egui::Shape::Circle(_))) + .map(|s| s.visual_bounding_rect()) + .collect(); + assert!(paints_icon_at_button_size(&painted, Icon::Close), "the popover's close cross is not 16 pt"); + } +} diff --git a/crates/ui-egui/src/widgets/style_picker.rs b/crates/ui-egui/src/widgets/style_picker.rs index 57e045a06..ca063abad 100644 --- a/crates/ui-egui/src/widgets/style_picker.rs +++ b/crates/ui-egui/src/widgets/style_picker.rs @@ -303,7 +303,11 @@ fn menu_icon(ui: &mut Ui, rect: Rect, icon: Icon, tip: &str, on: bool) -> Respon if on || resp.hovered() { ui.painter().rect_filled(rect, CornerRadius::same(5), t.menu_hover); } - let glyph = if rect.size() == vec2(24.0, 24.0) { crate::widgets::icon_glyph_rect(rect) } else { rect.shrink(5.0) }; + let glyph = if (rect.width() - 24.0).abs() < 0.5 && (rect.height() - 24.0).abs() < 0.5 { + crate::widgets::icon_glyph_rect(rect) + } else { + rect.shrink(5.0) + }; icons::paint(ui.painter(), glyph, icon, t.menu_text); resp } diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 0c9f44d4c..524d64f03 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -241,7 +241,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | 2026-11-06 | patch | M7, #2032: closing a tab whose file has unsaved changes, by its X, a middle click, File ▸ Close tab or its shortcut, only showed a toast ("save first, or close again with Alt to discard") and left the tab open, so closing seemed not to work. It now asks the unsaved-changes question the window asks (`windows::TabClose`): Don't Save closes the tab, Cancel or Escape keeps it, Save saves the file and then closes it (a file without a path, or saved as .fig, asks where with Save as first and stays open if that is cancelled); Alt+close still drops the changes at once, and `file.close`'s `dialog.unsaved` request asks too. The three toasts left the catalogs. Tests: `titlebar_tests::closing_a_tab_with_unsaved_changes_asks`, `titlebar_tests::save_in_the_tab_question_saves_then_closes`. Reordering tabs by dragging, the issue's other half, landed on 2026-10-19 (`dragging_a_tab_along_the_bar_reorders_it_without_detaching`) | | 2026-11-05 | minor | M4, #1830: a paragraph's base direction can be forced (`TextDirection`: Auto, Ltr, Rtl on `ParaList`): Text ▸ Text direction ▸ Auto / Left to right / Right to left (`text.directionAuto` / `Ltr` / `Rtl`) and `text.direction {direction, ids?}` set the edited paragraphs while editing, else the layer's; `node.set textDirection`; the Type settings control once a right-to-left script is in the text; inspect `textDirection` / `lineDirections`; CSS `direction`; `.fig` lines' `sourceDirectionality` in and out. Layout gives each paragraph its base level (`Bidi::of` runs the algorithm per paragraph, as it starts over at each). Before, direction came from the letters only ("controls are available to override text direction per paragraph", Add right-to-left text). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests::a_lines_source_directionality_is_its_paragraphs_direction_both_ways`. | | 2026-11-02 | minor | M1, #1836: pick select. Tab while the keyboard selection box shows, or Alt/Ctrl+Space again, puts a pink outline on the first selected layer (the page's top layer with nothing selected); Tab and Shift+Tab move it between sibling layers as the Layers panel lists them, Enter into a frame's top child, Shift+Enter out to the parent (never the page), Space selects the layer under it, Escape or a press on the canvas ends it; the chord again while the pick cursor shows brings the box back (Accessibility at Figma). The control channel's `ui.key` sends the box's and the pick cursor's keys to them too. One documented row more (135, 134 bound); four gesture rows. Tests: `layers_keyboard_tests::tab_switches_the_selection_box_to_pick_select`. | -| 2026-11-12 | patch | M8, #2238: every 24 pt icon button outside the Design panel draws its glyph at 16 pt through `widgets::icon_glyph_rect`, not 14 pt: the Layers panel's Minimize, search and add page buttons, the Assets back button, the Versions panel's row menus, the Dev Mode status button, the Prototype panel's flow buttons, the preview pane's bar buttons, Home's Online row menus and the style picker's 24 pt buttons. Smaller buttons (the picker's 22 and 20 pt ones, the popover's 24 pt close button with its 12 pt cross) keep their smaller glyphs. Tests: `icon_button_size_tests` and the `icon_size_tests` beside the panels. Numbers unchanged. | +| 2026-11-12 | patch | M8, #2238: every 24 pt icon button outside the Design panel draws its glyph at 16 pt through `widgets::icon_glyph_rect`, not 14 pt: the Layers panel's Minimize, search and add page buttons, the Assets back button, the Versions panel's row menus, the Dev Mode status button, the Prototype panel's flow buttons, the preview pane's bar buttons, Home's Online row menus and the style picker's 24 pt buttons. The popover's 24 pt close button draws its cross at 16 pt too. Smaller buttons (the picker's 22 and 20 pt ones) keep their smaller glyphs. Tests: `icon_button_size_tests` and the `icon_size_tests` beside the panels. Numbers unchanged. | | 2026-11-10 | patch | M10, #2227: the Design panel's section header buttons (Appearance, Typography, Fill, Stroke, Effects) draw their icons at the size of the panel's other 24 pt icon buttons, 16 pt (the icons' native size, as a fill row's eye), not 12 pt; `icon_button_at` goes from 14 to 16 pt with them; the Close and Swap buttons of the assets and prototype panels and the Design panel's Swap orientation and quick-action buttons share the inset. Test: `header_icon_size_tests`. Numbers unchanged. | | 2026-11-05 | patch | M1, #2003: the Design panel's boolean operation menu leads Union, Subtract, Intersect and Exclude with original icons drawn in code (two offset squares, the result filled at reduced alpha). Numbers unchanged. | | 2026-11-02 | minor | M8, #1875: a fill per region. With regions of a vector selected in edit mode (a press inside one with the Move tool, `vector.edit.select {regions}`), the Fill section lists the regions' own fills (the layer's for a region that has none; mixed content when they differ) and its rows and the colour picker edit them: `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` on the edited layer go to the selected regions' stacks (`Region.fills`, what the renderer already draws), the layer's fills and fill style untouched; `regions: [index, ...]` names them on any vector layer (Edit vector layers). Tests: `regions_tests::the_fill_commands_edit_the_selected_regions`. Numbers unchanged. | From 6cb015d4f82b9041df0d23f8c405fd6281e33693 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 03:03:25 -0500 Subject: [PATCH 182/239] M5: Select layer lists locked layers with a padlock and picks them (#1560) The context menu's Select layer now lists locked layers (and what a locked frame holds) with a padlock in the leading column, and picking one selects it, as the help center's "Lock and unlock layers" says and as measured in Figma's web app, 2026-11-10. The submenu shows only with more than one layer under the pointer (measured on a single locked layer only, the least certain rule). Clicks, hover and marquee still never reach a locked layer. - doc: geometry::HitOpts { locked } and layers_at_opts; layers_at and the other public hit functions keep their signatures and pass the default. - engine: select.layersAt lists locked layers and its rows gain locked (the layer or an ancestor is locked). - ui-egui: indented_item takes locked and paints the Layers panel's padlock icon; a row both selected and locked shows the check. - docs: ui-parity Select layer row, revision row and status line; mcp.md select.layersAt. Tests: layers_at_a_point_list_locked_layers_with_a_flag_and_select_set_takes_them, select_layer_marks_locked_layers_with_a_padlock_and_picks_them, select_layer_needs_more_than_one_layer_under_the_pointer. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 briefed; Sonnet 5.5 wrote at medium --- crates/doc/src/geometry.rs | 57 +++++++++++----- crates/engine/src/cmd/edit.rs | 2 +- crates/engine/src/cmd/edit/select.rs | 8 ++- crates/engine/src/selection_depth_tests.rs | 25 +++++++ crates/ui-egui/src/context_menu_tests.rs | 77 ++++++++++++++++++++++ crates/ui-egui/src/menus/select_layer.rs | 23 ++++--- crates/ui-egui/src/menus/tree.rs | 10 ++- docs/mcp.md | 4 +- docs/ui-parity.md | 5 +- 9 files changed, 177 insertions(+), 34 deletions(-) diff --git a/crates/doc/src/geometry.rs b/crates/doc/src/geometry.rs index 479ca439b..fa81926d9 100644 --- a/crates/doc/src/geometry.rs +++ b/crates/doc/src/geometry.rs @@ -152,7 +152,7 @@ fn near_path(path: &BezPath, p: Point, dist: f64) -> bool { /// boolean groups are hit where their `result` is. pub fn hit_leaf(doc: &Document, page: NodeId, pt: Point, tol: f64, result: BoolResult) -> Option { let p = doc.node(page)?; - p.children.iter().rev().find_map(|c| hit_rec(doc, *c, pt, tol, 0, result, None).filter(|_| !masked_out(doc, p, *c, pt))) + p.children.iter().rev().find_map(|c| hit_rec(doc, *c, pt, tol, 0, result, None, HitOpts::default()).filter(|_| !masked_out(doc, p, *c, pt))) } /// Whether child `c` of `parent` is masked at `pt`: a visible mask below it (the nearest mask @@ -175,7 +175,7 @@ fn covers(doc: &Document, id: NodeId, n: &Node, pt: Point, depth: usize) -> bool /// Like [`hit_leaf`], but only within layer `root` (it included). pub fn hit_in(doc: &Document, root: NodeId, pt: Point, tol: f64, result: BoolResult) -> Option { - hit_rec(doc, root, pt, tol, 0, result, None) + hit_rec(doc, root, pt, tol, 0, result, None, HitOpts::default()) } /// [`hit_leaf`] (or [`hit_in`] for a `root` that isn't a page) in outline mode: shapes are hit @@ -185,8 +185,8 @@ pub fn hit_in(doc: &Document, root: NodeId, pt: Point, tol: f64, result: BoolRes /// when it shows them, and every layer on the edge of its box when it shows object bounds. pub fn hit_outlines(doc: &Document, root: NodeId, pt: Point, tol: f64, result: BoolResult, also: OutlineHits) -> Option { match doc.node(root) { - Some(p) if p.is_page() => p.children.iter().rev().find_map(|c| hit_rec(doc, *c, pt, tol, 0, result, Some(also))), - _ => hit_rec(doc, root, pt, tol, 0, result, Some(also)), + Some(p) if p.is_page() => p.children.iter().rev().find_map(|c| hit_rec(doc, *c, pt, tol, 0, result, Some(also), HitOpts::default())), + _ => hit_rec(doc, root, pt, tol, 0, result, Some(also), HitOpts::default()), } } @@ -204,13 +204,31 @@ fn on_box_edge(doc: &Document, id: NodeId, n: &Node, pt: Point, tol: f64) -> boo r.inflate(tol, tol).contains(lp) && !(r.width() > 2.0 * tol && r.height() > 2.0 * tol && r.inflate(-tol, -tol).contains(lp)) } -fn hit_rec(doc: &Document, id: NodeId, pt: Point, tol: f64, depth: usize, result: BoolResult, also: Option) -> Option { +/// Options for the hit tests that the plain pick never sets. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct HitOpts { + /// Reach locked layers (and what a locked frame holds) too. A click, hover or marquee never + /// does; the Select layer list does. + pub locked: bool, +} + +#[allow(clippy::too_many_arguments)] +fn hit_rec( + doc: &Document, + id: NodeId, + pt: Point, + tol: f64, + depth: usize, + result: BoolResult, + also: Option, + opts: HitOpts, +) -> Option { if depth > 512 { return None; } let n = doc.node(id)?; let outline = also.is_some(); - if (!n.visible && !also.is_some_and(|a| a.hidden)) || n.locked { + if (!n.visible && !also.is_some_and(|a| a.hidden)) || n.locked && !opts.locked { return None; } if let NodeKind::Section { contents_hidden: true } = n.kind { @@ -228,7 +246,7 @@ fn hit_rec(doc: &Document, id: NodeId, pt: Point, tol: f64, depth: usize, result return None; } for c in n.paint_order().rev() { - if let Some(h) = hit_rec(doc, c, pt, tol, depth + 1, result, also).filter(|_| !masked_out(doc, n, c, pt)) { + if let Some(h) = hit_rec(doc, c, pt, tol, depth + 1, result, also, opts).filter(|_| !masked_out(doc, n, c, pt)) { return Some(h); } } @@ -239,14 +257,21 @@ fn hit_rec(doc: &Document, id: NodeId, pt: Point, tol: f64, depth: usize, result None } -/// Every visible, unlocked layer under `pt` (page coordinates) with its depth below the page, in -/// layer-tree order (each layer before what it contains, the front-most first): what -/// "Select layer" in the context menu lists. Clip content is honoured; boolean groups (hit where -/// their `result` is) and sections with hidden contents count as one layer. +/// Every visible, unlocked layer under `pt`: [`layers_at_opts`] with the default options. pub fn layers_at(doc: &Document, page: NodeId, pt: Point, tol: f64, result: BoolResult) -> Vec<(NodeId, usize)> { - fn rec(doc: &Document, id: NodeId, pt: Point, tol: f64, depth: usize, result: BoolResult, out: &mut Vec<(NodeId, usize)>) { + layers_at_opts(doc, page, pt, tol, result, HitOpts::default()) +} + +/// Every visible layer under `pt` (page coordinates) with its depth below the page, in +/// layer-tree order (each layer before what it contains, the front-most first): what +/// "Select layer" in the context menu lists. Locked layers are left out unless `opts.locked`. +/// Clip content is honoured; boolean groups (hit where their `result` is) and sections with +/// hidden contents count as one layer. +pub fn layers_at_opts(doc: &Document, page: NodeId, pt: Point, tol: f64, result: BoolResult, opts: HitOpts) -> Vec<(NodeId, usize)> { + #[allow(clippy::too_many_arguments)] + fn rec(doc: &Document, id: NodeId, pt: Point, tol: f64, depth: usize, result: BoolResult, opts: HitOpts, out: &mut Vec<(NodeId, usize)>) { let Some(n) = doc.node(id) else { return }; - if !n.visible || n.locked || depth > 512 { + if !n.visible || n.locked && !opts.locked || depth > 512 { return; } let clips = n.clip && n.kind.is_frame_like(); @@ -256,14 +281,14 @@ pub fn layers_at(doc: &Document, page: NodeId, pt: Point, tol: f64, result: Bool let at = out.len(); let whole = matches!(n.kind, NodeKind::BooleanOp { .. } | NodeKind::Section { contents_hidden: true }); if whole { - if hit_rec(doc, id, pt, tol, depth, result, None).is_some() { + if hit_rec(doc, id, pt, tol, depth, result, None, opts).is_some() { out.push((id, depth)); } return; } for c in n.paint_order().rev() { let before = out.len(); - rec(doc, c, pt, tol, depth + 1, result, out); + rec(doc, c, pt, tol, depth + 1, result, opts, out); if out.len() > before && masked_out(doc, n, c, pt) { out.truncate(before); } @@ -276,7 +301,7 @@ pub fn layers_at(doc: &Document, page: NodeId, pt: Point, tol: f64, result: Bool if let Some(p) = doc.node(page) { for c in p.children.iter().rev() { let before = out.len(); - rec(doc, *c, pt, tol, 0, result, &mut out); + rec(doc, *c, pt, tol, 0, result, opts, &mut out); if out.len() > before && masked_out(doc, p, *c, pt) { out.truncate(before); } diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index c03721af4..29b0f63a8 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -207,7 +207,7 @@ pub fn specs() -> Vec { spec!( "select.layersAt", "Layers at a point", - "{x, y (page coordinates)} → {layers: [{id, name, type, depth}]} (every layer under the point, front-most first; what the context menu's Select layer lists)", + "{x, y (page coordinates)} → {layers: [{id, name, type, depth, locked}]} (every layer under the point, locked ones too, front-most first; locked is true when the layer or an ancestor is locked; what the context menu's Select layer lists)", false, layers_at ), diff --git a/crates/engine/src/cmd/edit/select.rs b/crates/engine/src/cmd/edit/select.rs index 27eaf7d83..17f80af6b 100644 --- a/crates/engine/src/cmd/edit/select.rs +++ b/crates/engine/src/cmd/edit/select.rs @@ -8,9 +8,13 @@ pub(super) fn layers_at(s: &mut Session, p: &Value) -> Result { let zoom = s.ds()?.view.zoom.max(1e-6); let sel = s.selection(); let result = crate::booleans::result_outline(doc, &sel); - let layers: Vec = figcraft_doc::geometry::layers_at(doc, s.page()?, figcraft_geom::Point::new(x, y), 2.0 / zoom, Some(&result)) + let opts = figcraft_doc::geometry::HitOpts { locked: true }; + let layers: Vec = figcraft_doc::geometry::layers_at_opts(doc, s.page()?, figcraft_geom::Point::new(x, y), 2.0 / zoom, Some(&result), opts) .into_iter() - .filter_map(|(id, depth)| doc.node(id).map(|n| json!({"id": id, "name": n.name, "type": n.kind.type_name(), "depth": depth}))) + .filter_map(|(id, depth)| { + doc.node(id) + .map(|n| json!({"id": id, "name": n.name, "type": n.kind.type_name(), "depth": depth, "locked": crate::tools::locked_in(doc, id)})) + }) .collect(); Ok(json!({"layers": layers})) } diff --git a/crates/engine/src/selection_depth_tests.rs b/crates/engine/src/selection_depth_tests.rs index a754e7343..8e04a5a66 100644 --- a/crates/engine/src/selection_depth_tests.rs +++ b/crates/engine/src/selection_depth_tests.rs @@ -118,8 +118,33 @@ fn layers_at_a_point_list_the_stack_front_most_first() { let got: Vec<(NodeId, u64)> = out["layers"].as_array().unwrap().iter().map(|l| (id_of(&l["id"]).unwrap(), l["depth"].as_u64().unwrap())).collect(); assert_eq!(got, vec![(f, 0), (over, 1), (g, 1), (a, 2)]); + assert!(out["layers"].as_array().unwrap().iter().all(|l| l["locked"] == json!(false)), "none is locked"); assert_eq!(out["layers"][0]["type"], json!("FRAME")); // Nothing under empty canvas; junk is refused. assert_eq!(ex(&mut s, "select.layersAt", json!({"x": 2000, "y": 2000}))["layers"], json!([])); assert!(s.execute("select.layersAt", &json!({"x": "left"})).is_err()); } + +/// Measured in Figma's web app, 2026-11-10 (Select layer lists a locked layer, and picking it selects it). +#[test] +fn layers_at_a_point_list_locked_layers_with_a_flag_and_select_set_takes_them() { + let mut s = Session::new(); + let (f, g, [a, ..], _) = scene(&mut s); + let over = rect_in(&mut s, 10.0, 10.0, Some(f)); + let lk = rect_in(&mut s, 10.0, 10.0, Some(f)); + ex(&mut s, "object.toggleLock", json!({"ids": [lk], "locked": true})); + let out = ex(&mut s, "select.layersAt", json!({"x": 30, "y": 30})); + let got: Vec<(NodeId, u64, bool)> = out["layers"] + .as_array() + .unwrap() + .iter() + .map(|l| (id_of(&l["id"]).unwrap(), l["depth"].as_u64().unwrap(), l["locked"].as_bool().unwrap())) + .collect(); + assert_eq!(got, vec![(f, 0, false), (lk, 1, true), (over, 1, false), (g, 1, false), (a, 2, false)]); + ex(&mut s, "select.set", json!({"ids": [lk]})); + assert_eq!(s.selection(), vec![lk]); + ex(&mut s, "select.none", json!({})); + s.pointer(&ev(PointerKind::Down, 30.0, 30.0, false, false)).unwrap(); + s.pointer(&ev(PointerKind::Up, 30.0, 30.0, false, false)).unwrap(); + assert_eq!(s.selection(), vec![over], "a click still skips the locked layer"); +} diff --git a/crates/ui-egui/src/context_menu_tests.rs b/crates/ui-egui/src/context_menu_tests.rs index 41c2e0be3..6ff9ebed9 100644 --- a/crates/ui-egui/src/context_menu_tests.rs +++ b/crates/ui-egui/src/context_menu_tests.rs @@ -127,3 +127,80 @@ fn copying_a_link_from_a_frames_name_label_links_that_frame() { crate::menus::invoke(&mut u.app, "edit.copyLink"); assert_eq!(copied.lock().unwrap().last().cloned(), Some(format!("figcraft://node/{}", a.0))); } + +/// Two overlapping rectangles, the upper one locked; the menu opens on the overlap with nothing +/// selected. Returns the app's UI and the ids (lower, locked). +fn overlap_ui() -> (Ui, figcraft_doc::NodeId, figcraft_doc::NodeId) { + let mut s = Session::new(); + let lower = id(&s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 80, "height": 80, "name": "Lower"})).unwrap()); + let upper = id(&s.execute("shape.rectangle", &json!({"x": 120, "y": 120, "width": 80, "height": 80, "name": "Upper"})).unwrap()); + s.execute("object.toggleLock", &json!({"ids": [upper], "locked": true})).unwrap(); + let mut u = Ui::new(s); + u.frame(vec![]); + (u, lower, upper) +} + +/// Measured in Figma's web app, 2026-11-10 (Lock and unlock layers: locked layers are listed in Select layer). +#[test] +fn select_layer_marks_locked_layers_with_a_padlock_and_picks_them() { + let (mut u, lower, upper) = overlap_ui(); + let at = u.app.to_screen(150.0, 150.0); + crate::canvas::open_context_menu(&mut u.app, at, false); + u.app.session.set_selection(vec![]); + crate::menus::open_select_layer(&u.ctx, true); + u.frame(vec![]); + let shapes = flat(&u.frame_output(vec![]).shapes); + // The Layers panel lists the same names; the menu's rows are the right-most copies. + let menu_row = |name: &str| { + let (_, pos, size) = crate::live_tests::texts(&shapes) + .into_iter() + .filter(|(t, _, _)| t == name) + .max_by(|a, b| a.1.x.total_cmp(&b.1.x)) + .unwrap_or_else(|| panic!("no row {name:?}")); + (pos, size) + }; + let (lower_at, upper_at) = (menu_row("Lower"), menu_row("Upper")); + assert!(lower_at.0.x > 300.0 && upper_at.0.x > 300.0, "both layers are listed in the menu"); + let in_leading = |(pos, size): (Pos2, egui::Vec2)| { + let c = pos + size / 2.0; + shapes + .iter() + .filter(|s| !matches!(s, egui::Shape::Text(_))) + .filter(|s| { + let r = s.visual_bounding_rect(); + r.is_positive() + && (r.center().y - c.y).abs() < 8.0 + && r.max.x < c.x - size.x / 2.0 - 4.0 + && r.min.x > c.x - size.x / 2.0 - 40.0 + && r.width() < 20.0 + }) + .count() + }; + assert!(in_leading(upper_at) > 0, "the locked row has a padlock in its leading column"); + assert_eq!(in_leading(lower_at), 0, "the other row has nothing there"); + let p = upper_at.0 + upper_at.1 / 2.0; + for pressed in [true, false] { + u.frame(vec![ + egui::Event::PointerMoved(p), + egui::Event::PointerButton { pos: p, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE }, + ]); + } + assert_eq!(u.app.session.selection(), vec![upper], "picking the locked row selects it"); + let _ = lower; +} + +/// Measured on a single locked layer only (Figma's web app, 2026-11-10): the least certain rule. +#[test] +fn select_layer_needs_more_than_one_layer_under_the_pointer() { + let (mut u, _, _) = overlap_ui(); + let one = u.app.to_screen(105.0, 105.0); + crate::canvas::open_context_menu(&mut u.app, one, false); + u.frame(vec![]); + let shapes = flat(&u.frame_output(vec![]).shapes); + assert!(!has_text(&shapes, "Select layer"), "one layer under the pointer: no Select layer"); + let two = u.app.to_screen(150.0, 150.0); + crate::canvas::open_context_menu(&mut u.app, two, false); + u.frame(vec![]); + let shapes = flat(&u.frame_output(vec![]).shapes); + assert!(has_text(&shapes, "Select layer"), "two layers: it shows"); +} diff --git a/crates/ui-egui/src/menus/select_layer.rs b/crates/ui-egui/src/menus/select_layer.rs index 73571f38e..0628dfa3b 100644 --- a/crates/ui-egui/src/menus/select_layer.rs +++ b/crates/ui-egui/src/menus/select_layer.rs @@ -15,7 +15,8 @@ pub fn open_select_layer(ctx: &egui::Context, open: bool) { } /// The context menu's "Select layer" submenu (right-click on the canvas): every layer under the -/// click, nested ones indented, the selected ones checked. Returns whether one was picked. +/// click (locked ones with a padlock), nested ones indented, the selected ones checked; shown +/// only with more than one layer under the pointer. Returns whether one was picked. pub(super) fn select_layer_menu(app: &mut FigApp, ui: &mut Ui, pos: egui::Pos2, t: &Tokens) -> bool { if !app.canvas.rect.contains(pos) { return false; @@ -23,15 +24,21 @@ pub(super) fn select_layer_menu(app: &mut FigApp, ui: &mut Ui, pos: egui::Pos2, let p = app.to_page(pos); let Ok(ds) = app.session.ds() else { return false }; let tol = 2.0 / ds.view.zoom.max(1e-6); - let layers: Vec<(figcraft_doc::NodeId, usize, String)> = - figcraft_doc::geometry::layers_at(&ds.doc, ds.page, p, tol, Some(&figcraft_engine::booleans::result_outline(&ds.doc, &ds.selection))) + let opts = figcraft_doc::geometry::HitOpts { locked: true }; + let layers: Vec<(figcraft_doc::NodeId, usize, String, bool)> = { + let result = figcraft_engine::booleans::result_outline(&ds.doc, &ds.selection); + figcraft_doc::geometry::layers_at_opts(&ds.doc, ds.page, p, tol, Some(&result), opts) .into_iter() .take(40) .filter_map(|(id, depth)| { - ds.doc.node(id).map(|n| (id, depth, if n.name.is_empty() { n.kind.type_name().to_lowercase() } else { n.name.clone() })) + ds.doc.node(id).map(|n| { + let name = if n.name.is_empty() { n.kind.type_name().to_lowercase() } else { n.name.clone() }; + (id, depth, name, figcraft_engine::tools::locked_in(&ds.doc, id)) + }) }) - .collect(); - if layers.is_empty() { + .collect() + }; + if layers.len() < 2 { return false; } let sel = ds.selection.clone(); @@ -40,8 +47,8 @@ pub(super) fn select_layer_menu(app: &mut FigApp, ui: &mut Ui, pos: egui::Pos2, SubmenuOptions { area: Id::unique("ctx_select_layer"), key: SELECT_LAYER, label: tr("Select layer"), gap: 4.0, constrain: true, tokens: t }, |ui| { let mut picked = None; - for (id, depth, name) in &layers { - if indented_item(ui, name, "", true, sel.contains(id), 12.0 * (*depth).min(8) as f32, t) { + for (id, depth, name, locked) in &layers { + if indented_item(ui, name, "", true, sel.contains(id), *locked, 12.0 * (*depth).min(8) as f32, t) { picked = Some(*id); } } diff --git a/crates/ui-egui/src/menus/tree.rs b/crates/ui-egui/src/menus/tree.rs index ac4e7059d..b48a8c9de 100644 --- a/crates/ui-egui/src/menus/tree.rs +++ b/crates/ui-egui/src/menus/tree.rs @@ -395,11 +395,13 @@ fn need_width(ui: &Ui, w: f32) { } pub(crate) fn item(ui: &mut Ui, label: &str, shortcut: &str, enabled: bool, checked: bool, t: &Tokens) -> bool { - indented_item(ui, label, shortcut, enabled, checked, 0.0, t) + indented_item(ui, label, shortcut, enabled, checked, false, 0.0, t) } -/// A menu row whose label starts `indent` pixels further in (nested layers). -pub(super) fn indented_item(ui: &mut Ui, label: &str, shortcut: &str, enabled: bool, checked: bool, indent: f32, t: &Tokens) -> bool { +/// A menu row whose label starts `indent` pixels further in (nested layers); `locked` paints a +/// padlock in the leading column (a checked row shows the check instead). +#[allow(clippy::too_many_arguments)] +pub(super) fn indented_item(ui: &mut Ui, label: &str, shortcut: &str, enabled: bool, checked: bool, locked: bool, indent: f32, t: &Tokens) -> bool { let w = ui.available_width(); let (r, resp) = ui.allocate_exact_size(vec2(w, 28.0), Sense::click()); a11y::menu_item(&resp, label, shortcut, checked.then_some(true)); @@ -415,6 +417,8 @@ pub(super) fn indented_item(ui: &mut Ui, label: &str, shortcut: &str, enabled: b let col = if enabled { t.menu_text } else { t.menu_dim }; if checked { icons::paint(ui.painter(), Rect::from_center_size(pos2(r.min.x + 12.0, r.center().y), vec2(12.0, 12.0)), Icon::Check, col); + } else if locked { + icons::paint(ui.painter(), Rect::from_center_size(pos2(r.min.x + 12.0, r.center().y), vec2(12.0, 12.0)), Icon::Lock, col); } let galley = ui.painter().layout_no_wrap(label.to_string(), regular(12.0), col); let keys = (!shortcut.is_empty()) diff --git a/docs/mcp.md b/docs/mcp.md index a6c04af07..d01f3867e 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -2082,8 +2082,8 @@ turned off 0°. `node.set {pointCount}` keeps stars to 3–60 points; `miterAngle` (degrees, the Design panel's Miter angle) sets the miter limit (`limit = 1 / sin(angle / 2)`); `get_node` reports a join other than miter (`strokeJoin`) or a miter angle other than the default ~28.96° (`miterAngle`). -- **Select**: `select.layersAt {x, y}` lists every layer under a page point, front-most first with its - depth (the context menu's Select layer); `select.set`, `select.children` / `select.parent` (Enter +- **Select**: `select.layersAt {x, y}` lists every layer under a page point, locked ones too, front-most first with its + depth and a `locked` flag (true when the layer or an ancestor is locked; the context menu's Select layer); `select.set`, `select.children` / `select.parent` (Enter / Shift+Enter), `select.next` / `select.previous` (Tab / Shift+Tab). With `pointer`, `cmd: true` clicks select the nested layer, `cmd` drags from empty canvas select the nested layers they touch, and `shift` drags toggle what they touch. A press on the background of a top-level frame with diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 1911dbbcd..c8c23e295 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-10 · **Change:** minor (the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (Select layer lists locked layers with a padlock and selects them, and shows only with more than one layer under the pointer (#1560); the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -61,7 +61,7 @@ interaction feel not yet compared. |---|---|---| | Click, Shift-click, marquee, Shift-marquee toggle | done | Shift-drag on a selected layer moves the selection, kept to one axis (#498); a marquee selects the top-level layers it touches, by the box and a rotated shape by its outline (rectangle and ellipse measured, the other shapes by the same code); a partly covered top-level frame or section gives the layers in it the marquee touches, an enclosed one is selected itself, an empty frame on touch; a drag from a frame's background selects that frame only when the marquee also takes another top-level frame (then whole), and also takes what it touches outside it; selecting a frame whole keeps the marquee at the top level (a partly covered frame then comes whole too); locked and hidden layers are skipped (`marquee_behaviour_tests`, `selection_behaviour_tests`; measured in Figma's web app, 2026-11-11; Shift and Cmd/Ctrl marquees not measured) (a locked layer selected from the panel ignores the arrow keys and the nudge commands; its properties still edit; measured in Figma's web app, 2026-11-10) | | Deep select (Cmd/Ctrl-click, Cmd/Ctrl-marquee) | done | | -| Select layer menu (every layer under the click) | done | | +| Select layer menu (every layer under the click) | done | shown only with more than one layer under the pointer; locked layers are listed with a padlock in the leading column and are selectable there, as Lock and unlock layers' note says (measured in Figma's web app, 2026-11-10; the "more than one layer" gate was measured on a single locked layer only) (`select_layer_marks_locked_layers_with_a_padlock_and_picks_them`, `select_layer_needs_more_than_one_layer_under_the_pointer`) | | Escape with layers selected | done | clears the selection at once, whatever the nesting; it never selects the parent. Measured in the Figma web app (2026-11-08) with a rectangle in a group in a frame, selected from the canvas (a double-click into the group), from the Layers panel, and after Tab moved the selection to its sibling: one Escape selects nothing, a second leaves nothing selected. Escape still leaves text and vector editing, ends gestures and the pen first, and ends the focus view once nothing or the focused frame is selected (`selection_behaviour_tests`, `devfocus_tests`) | | Enter / Shift+Enter (children / parent), Tab / Shift+Tab (siblings) | done | Tab renames the next layer while renaming | | Resize handles: Shift keeps proportions, Alt from centre, constraints-aware | done | Alt shrinks too; past an edge flips (several layers mirror); groups and mixed rotations scale each layer along its own axes, keeping rotation and flip (no skew: children turned off a right angle are approximate); Cmd/Ctrl ignores a frame's constraints (`transform_behaviour_tests`) | @@ -217,6 +217,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| +| 2026-11-12 | patch | M5, #1560: the context menu's Select layer lists locked layers with a padlock in the leading column (the Layers panel's padlock icon; a row both selected and locked shows the check) and picking one selects it, as Lock and unlock layers' note says and as measured in Figma's web app, 2026-11-10; the submenu shows only with more than one layer under the pointer (measured on a single locked layer only: the least certain rule). Left clicks, hover and marquee still never reach a locked layer. `select.layersAt` lists locked layers too and its rows gain `locked`. Tests: `layers_at_a_point_list_locked_layers_with_a_flag_and_select_set_takes_them`, `select_layer_marks_locked_layers_with_a_padlock_and_picks_them`, `select_layer_needs_more_than_one_layer_under_the_pointer`. Counts unchanged | | 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start); FigCraft draws it opaque (how Figma treats a translucent fill was not measured); gradient, image and hidden fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | | 2026-11-10 | minor | The Rotation field shows and sets the layer's rotation on the page (its own angle plus its parents' when no ancestor is flipped; with a flipped ancestor FigCraft reads the composed angle, which flips the sign of the layer's own angle, and Figma's behaviour there was not measured), in frames and groups alike, as measured in Figma's web app for rotated, unflipped parents (#2196) | | 2026-11-09 | patch | M3, #2189: the eyedropper picks the colour the canvas shows. It sampled a 1x1 render without the canvas's magnified-image pixels, so on an image magnified past 2x it blended a 1 px line with its neighbours (#3D444D picked as #343B44 beside #151B23), and the pixel it sampled began at the pointer instead of being centred on it. It now matches the canvas when zoomed in; zoomed out it still samples the full-resolution image, not the smaller copy the canvas may show. Test: `eyedropper_image_tests` | From 87f7b7d9446476e04f38b0c75f6966c8efce293f Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 03:09:01 -0500 Subject: [PATCH 183/239] M5: drop two lint allows the argument count does not need The workspace threshold for too_many_arguments is 10; hit_rec and rec take 8. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and reviewed --- crates/doc/src/geometry.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/doc/src/geometry.rs b/crates/doc/src/geometry.rs index fa81926d9..cc1a218e9 100644 --- a/crates/doc/src/geometry.rs +++ b/crates/doc/src/geometry.rs @@ -212,7 +212,6 @@ pub struct HitOpts { pub locked: bool, } -#[allow(clippy::too_many_arguments)] fn hit_rec( doc: &Document, id: NodeId, @@ -268,7 +267,6 @@ pub fn layers_at(doc: &Document, page: NodeId, pt: Point, tol: f64, result: Bool /// Clip content is honoured; boolean groups (hit where their `result` is) and sections with /// hidden contents count as one layer. pub fn layers_at_opts(doc: &Document, page: NodeId, pt: Point, tol: f64, result: BoolResult, opts: HitOpts) -> Vec<(NodeId, usize)> { - #[allow(clippy::too_many_arguments)] fn rec(doc: &Document, id: NodeId, pt: Point, tol: f64, depth: usize, result: BoolResult, opts: HitOpts, out: &mut Vec<(NodeId, usize)>) { let Some(n) = doc.node(id) else { return }; if !n.visible || n.locked && !opts.locked || depth > 512 { From 100a6b7e6f42e5e7aeaf1329f29ee2fa8ffb979f Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 03:12:41 -0500 Subject: [PATCH 184/239] M9: .jam import: shapes with text come in as native board shapes (#1808) On a whiteboard, a FigJam shape with text whose generated records are complete becomes a native board shape for the 23 kinds FigCraft draws: an empty centred frame holding FigCraft's own outline (the file's paints, weight and dashes kept) and the text. The 7 kinds without an outline, and shapes with damaged records, keep the generated layers; the former warn with the kind's name. Stickies and shapes share one native-board hook in the layer mapper. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 briefed; Sonnet 5.5 wrote at medium --- crates/format/src/fig/board_import_tests.rs | 139 +++++++++++++++++++- crates/format/src/fig/map.rs | 3 + crates/format/src/fig/map/board.rs | 118 +++++++++++++++++ crates/format/src/fig/map/layer.rs | 9 +- crates/ui-egui/locales/en.toml | 1 + docs/boards-parity.md | 5 +- docs/file-format-parity.md | 5 +- 7 files changed, 269 insertions(+), 11 deletions(-) diff --git a/crates/format/src/fig/board_import_tests.rs b/crates/format/src/fig/board_import_tests.rs index 89c6cba83..b1b1e30c7 100644 --- a/crates/format/src/fig/board_import_tests.rs +++ b/crates/format/src/fig/board_import_tests.rs @@ -9,7 +9,7 @@ fn board_schema() -> Schema { /// [`board_schema`] over another base schema. fn board_schema_of(base: &str) -> Schema { - Schema::parse(&base.replace( + Schema::parse(&base.replace("enum ShapeWithTextType SQUARE ELLIPSE", "enum ShapeWithTextType SQUARE ROUNDED_RECTANGLE ELLIPSE DIAMOND TRIANGLE_UP TRIANGLE_DOWN PARALLELOGRAM_RIGHT PARALLELOGRAM_LEFT TRAPEZOID PENTAGON HEXAGON OCTAGON STAR PLUS ARROW_LEFT ARROW_RIGHT CHEVRON SPEECH_BUBBLE ENG_DATABASE DOCUMENT_SINGLE PREDEFINED_PROCESS MANUAL_INPUT INTERNAL_STORAGE ENG_QUEUE ENG_FILE ENG_FOLDER SHIELD DOCUMENT_MULTIPLE SUMMING_JUNCTION OR").replace( "\nmessage Blob ", ", GeneratedData nodeGenerationData, GeneratedData derivedImmutableFrameData, string textAlignHorizontal, string textAlignVertical\nmessage GeneratedData NodeChange[] overrides, uint version\nmessage Blob ", )) @@ -549,3 +549,140 @@ fn a_fig_sticky_stays_a_design_frame() { assert!(frame.board.is_none()); assert_eq!(frame.children.len(), 3); } + +/// `board_node("SHAPE_WITH_TEXT")` of one FigJam kind. +fn shape_node(kind: &'static str) -> Kv<'static> { + let mut layer = board_node("SHAPE_WITH_TEXT"); + set(&mut layer, "shapeWithTextType", e(kind)); + layer +} + +/// On a whiteboard a diamond is a native shape: FigCraft draws its outline and its text sits inside. +#[test] +fn a_jam_diamond_is_a_native_shape_drawn_by_figcraft() { + let (doc, warnings) = jam(shape_node("DIAMOND")); + let frame = named(&doc, "Board object"); + assert_eq!(frame.board, Some(figcraft_doc::BoardItem::Shape { shape: figcraft_doc::BoardShape::Diamond })); + assert!(frame.fills.is_empty()); + assert_eq!((frame.width, frame.height), (240.0, 240.0)); + assert_eq!(frame.layout.as_ref().expect("shape auto layout").padding, [0.25 * 240.0; 4]); + assert_eq!(frame.children.len(), 2, "the outline and the text: {warnings:?}"); + let outline = doc.node(frame.children[0]).unwrap(); + let NodeKind::Vector { network } = &outline.kind else { panic!("{:?}", outline.kind) }; + assert_eq!(*network, figcraft_doc::VectorNetwork::from_path(&figcraft_doc::BoardShape::Diamond.path(240.0, 240.0))); + assert_eq!(outline.fills[0].solid_color().unwrap().to_rgba8(), [255, 191, 64, 255]); + assert!(outline.child_layout.absolute); + assert_eq!(outline.constraints.horizontal, figcraft_doc::HConstraint::Scale); + assert_eq!(outline.constraints.vertical, figcraft_doc::VConstraint::Scale); + let label = doc.node(frame.children[1]).unwrap().kind.text().unwrap(); + assert_eq!(label.characters, "Olá\nIdea"); + assert_eq!(label.align_h, figcraft_doc::TextAlignH::Center); +} + +/// 23 of FigJam's 30 shape kinds have a FigCraft outline; the other 7 stay frames and say which. +#[test] +fn every_figjam_shape_kind_maps_or_stays_a_frame() { + let kinds = [ + "SQUARE", + "ROUNDED_RECTANGLE", + "ELLIPSE", + "DIAMOND", + "TRIANGLE_UP", + "TRIANGLE_DOWN", + "PARALLELOGRAM_RIGHT", + "PARALLELOGRAM_LEFT", + "TRAPEZOID", + "PENTAGON", + "HEXAGON", + "OCTAGON", + "STAR", + "PLUS", + "ARROW_LEFT", + "ARROW_RIGHT", + "CHEVRON", + "SPEECH_BUBBLE", + "ENG_DATABASE", + "DOCUMENT_SINGLE", + "PREDEFINED_PROCESS", + "MANUAL_INPUT", + "INTERNAL_STORAGE", + "ENG_QUEUE", + "ENG_FILE", + "ENG_FOLDER", + "SHIELD", + "DOCUMENT_MULTIPLE", + "SUMMING_JUNCTION", + "OR", + ]; + assert_eq!(kinds.len(), 30); + let mut mapped = 0; + for kind in kinds { + let table = super::map::board_shape(kind); + let (doc, warnings) = jam(shape_node(kind)); + let frame = named(&doc, "Board object"); + if let Some(shape) = table { + mapped += 1; + assert_eq!(frame.board, Some(figcraft_doc::BoardItem::Shape { shape }), "{kind}"); + } else { + assert!(frame.board.is_none(), "{kind}"); + assert!(warnings.iter().any(|w| w.contains(kind) && w.contains("no FigCraft outline")), "{kind}: {warnings:?}"); + } + } + assert_eq!(mapped, 23); +} + +/// A square keeps the paints and weight the file gave it, as read. +#[test] +fn a_square_keeps_its_paints_and_weight() { + let mut layer = shape_node("SQUARE"); + let background = + record(0, vec![("fillPaints", arr(vec![solid(1.0, 1.0, 1.0)])), ("strokePaints", arr(vec![solid(0.5, 0.5, 0.5)])), ("strokeWeight", f(4.0))]); + set(&mut layer, "nodeGenerationData", o(vec![("overrides", arr(vec![background, record(1, text("Olá", 16.0))]))])); + let (doc, _) = jam(layer); + let frame = named(&doc, "Board object"); + assert_eq!(frame.board, Some(figcraft_doc::BoardItem::Shape { shape: figcraft_doc::BoardShape::Rectangle })); + let outline = doc.node(frame.children[0]).unwrap(); + assert_eq!(outline.fills[0].solid_color().unwrap().to_rgba8(), [255, 255, 255, 255]); + assert_eq!(outline.strokes[0].solid_color().unwrap().to_rgba8(), [128, 128, 128, 255]); + assert_eq!(outline.stroke.weight, 4.0); +} + +/// A shape record that isn't complete keeps today's generated layers and no board item. +#[test] +fn a_damaged_shape_record_keeps_the_generated_layers() { + let mut cases = Vec::new(); + let mut a = shape_node("DIAMOND"); + set(&mut a, "derivedImmutableFrameData", o(vec![("version", u(2))])); + cases.push(a); + let mut b = shape_node("DIAMOND"); + set(&mut b, "nodeGenerationData", o(vec![("overrides", arr(vec![record(1, text("Olá", 16.0))]))])); + cases.push(b); + let mut c = shape_node("DIAMOND"); + let background = record(0, vec![("fillPaints", arr(vec![solid(1.0, 1.0, 1.0)]))]); + set(&mut c, "nodeGenerationData", o(vec![("overrides", arr(vec![background]))])); + cases.push(c); + for (i, layer) in cases.into_iter().enumerate() { + let (as_fig, fig_warnings) = imported(layer.clone()); + let (doc, warnings) = jam(layer); + let frame = named(&doc, "Board object"); + assert!(frame.board.is_none(), "case {i}"); + assert_eq!(frame.children.len(), named(&as_fig, "Board object").children.len(), "case {i}: the generated layers, as in a .fig"); + let sorted = |mut w: Vec| { + w.sort(); + w + }; + assert_eq!(sorted(warnings), sorted(fig_warnings), "case {i}: today's warnings"); + } +} + +/// A shape with no text yet is still a native shape (an empty one). +#[test] +fn a_jam_shape_without_text_is_still_a_native_shape() { + let mut layer = shape_node("SQUARE"); + let background = record(0, vec![("fillPaints", arr(vec![solid(1.0, 1.0, 1.0)]))]); + set(&mut layer, "nodeGenerationData", o(vec![("overrides", arr(vec![background, record(1, text("", 16.0))]))])); + let (doc, _) = jam(layer); + let frame = named(&doc, "Board object"); + assert_eq!(frame.board, Some(figcraft_doc::BoardItem::Shape { shape: figcraft_doc::BoardShape::Rectangle })); + assert_eq!(doc.node(frame.children[1]).unwrap().kind.text().unwrap().characters, ""); +} diff --git a/crates/format/src/fig/map.rs b/crates/format/src/fig/map.rs index d150e5c63..5e4ab7e9d 100644 --- a/crates/format/src/fig/map.rs +++ b/crates/format/src/fig/map.rs @@ -28,6 +28,9 @@ mod proto; mod text; mod variables; +#[cfg(test)] +pub(super) use board::board_shape; + use component::OverrideScope; #[cfg(test)] use paint::paint; diff --git a/crates/format/src/fig/map/board.rs b/crates/format/src/fig/map/board.rs index 7dcf57cfe..5b885f060 100644 --- a/crates/format/src/fig/map/board.rs +++ b/crates/format/src/fig/map/board.rs @@ -5,6 +5,7 @@ use super::layer::{own_text, valid_size}; use super::paint::paint; use super::{Affine, Kv, MAX_DEPTH, Mapper, Obj, Value, View, generated_record, json, num}; +use figcraft_doc::BoardShape; impl<'a> Mapper<'a> { /// A sticky as a native board sticky: its frame (size, place, opacity and shadows as saved, @@ -86,3 +87,120 @@ impl<'a> Mapper<'a> { Some(kids) } } + +impl<'a> Mapper<'a> { + /// A sticky or shape with text as a native board item, or `None` with the note that it is + /// a frame with its generated layers. + pub(super) fn native_board_item(&mut self, own: &str, o: &mut Obj, v: &View<'a>, rest_id: &str, depth: usize) -> Option> { + let native = if own == "STICKY" { self.native_sticky(o, v, rest_id, depth) } else { self.native_shape(o, v, rest_id, depth) }; + if native.is_none() && own == "STICKY" { + self.warn("sticky layers import as frames with their text"); + } else if native.is_none() { + self.warn("shape with text layers import as frames with their text"); + } + native + } +} + +impl<'a> Mapper<'a> { + /// A shape with text as a native board shape: an empty frame holding FigCraft's own outline + /// (the file's paints and weight) and the text, centred. `None` (nothing changed) when the kind + /// has no FigCraft outline or a generated record is damaged: then the caller keeps the + /// generated layers. + pub(super) fn native_shape(&mut self, o: &mut Obj, v: &View<'a>, rest_id: &str, depth: usize) -> Option> { + let kind = v.str("shapeWithTextType").unwrap_or("SQUARE"); + let Some(shape) = board_shape(kind) else { + self.warn(format!("shape with text kind {kind} has no FigCraft outline; kept as a frame")); + return None; + }; + if v.get("nodeGenerationData").is_none() || v.get("derivedImmutableFrameData").and_then(|d| num(d, "version")) != Some(1.0) { + return None; + } + let record = |id: u32| { + let (style, bounds) = (generated_record(v, "nodeGenerationData", id)?, generated_record(v, "derivedImmutableFrameData", id)?); + let view = View::of(style).with([(bounds, 1.0)]); + (valid_size(view.get("size")).is_some() && view.transform().is_some()).then_some(view) + }; + let background = record(0)?; + let body = record(1)?; + if depth >= MAX_DEPTH || self.count.saturating_add(2) > self.budget() { + return None; + } + let (w, h) = v.size().or_else(|| o.get("size").and_then(|s| Some((s.get("x")?.as_f64()?, s.get("y")?.as_f64()?))))?; + if !(w.is_finite() && h.is_finite() && w > 0.0 && h > 0.0) { + return None; + } + // Everything is valid: build the outline from the record's paints, then the frame. + let mut outline = Obj::new(); + outline.insert("id".into(), json!(format!("{rest_id};generated0"))); + outline.insert("type".into(), json!("VECTOR")); + outline.insert("name".into(), json!("Outline")); + self.common(&mut outline, &background, "VECTOR", Affine::IDENTITY, None); + outline.insert("size".into(), json!({"x": w, "y": h})); + outline.insert("relativeTransform".into(), json!([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]])); + outline.insert("vectorNetwork".into(), serde_json::to_value(figcraft_doc::VectorNetwork::from_path(&shape.path(w, h))).ok()?); + outline.insert("layoutPositioning".into(), json!("ABSOLUTE")); + outline.insert("constraints".into(), json!({"horizontal": "SCALE", "vertical": "SCALE"})); + outline.remove("cornerRadius"); + let mut label = Obj::new(); + label.insert("id".into(), json!(format!("{rest_id};generated1"))); + label.insert("type".into(), json!("TEXT")); + label.insert("name".into(), json!(own_text(&body).map_or_else(|| "Text".to_string(), |c| c.chars().take(40).collect()))); + self.common(&mut label, &body, "TEXT", Affine::IDENTITY, None); + self.text(&mut label, &body); + if let Some(Value::Object(style)) = label.get_mut("style") { + style.insert("textAutoResize".into(), json!("HEIGHT")); + style.insert("textAlignHorizontal".into(), json!("CENTER")); + } + label.insert("layoutSizingHorizontal".into(), json!("FILL")); + o.insert("fills".into(), json!([])); + o.insert("strokes".into(), json!([])); + o.insert("clipsContent".into(), json!(false)); + o.remove("cornerRadius"); + let [top, right, bottom, left] = shape.text_insets(); + for (k, val) in [ + ("layoutMode", json!("VERTICAL")), + ("primaryAxisAlignItems", json!("CENTER")), + ("counterAxisAlignItems", json!("CENTER")), + ("paddingTop", json!(top * h)), + ("paddingRight", json!(right * w)), + ("paddingBottom", json!(bottom * h)), + ("paddingLeft", json!(left * w)), + ] { + o.insert(k.into(), val); + } + self.count += 2; + o.insert("board".into(), json!({"type": "shape", "shape": shape.id()})); + Some(vec![Value::Object(outline), Value::Object(label)]) + } +} + +/// FigJam's `shapeWithTextType` as the outline FigCraft draws for it; `None` for the kinds it has none for. +pub(in crate::fig) fn board_shape(kind: &str) -> Option { + Some(match kind { + "SQUARE" => BoardShape::Rectangle, + "ROUNDED_RECTANGLE" => BoardShape::RoundedRectangle, + "ELLIPSE" => BoardShape::Ellipse, + "DIAMOND" => BoardShape::Diamond, + "TRIANGLE_UP" => BoardShape::Triangle, + "TRIANGLE_DOWN" => BoardShape::TriangleDown, + "PARALLELOGRAM_RIGHT" => BoardShape::ParallelogramRight, + "PARALLELOGRAM_LEFT" => BoardShape::ParallelogramLeft, + "TRAPEZOID" => BoardShape::Trapezoid, + "PENTAGON" => BoardShape::Pentagon, + "HEXAGON" => BoardShape::Hexagon, + "OCTAGON" => BoardShape::Octagon, + "STAR" => BoardShape::Star, + "PLUS" => BoardShape::Plus, + "ARROW_LEFT" => BoardShape::ArrowLeft, + "ARROW_RIGHT" => BoardShape::ArrowRight, + "CHEVRON" => BoardShape::Chevron, + "SPEECH_BUBBLE" => BoardShape::SpeechBubble, + "ENG_DATABASE" => BoardShape::Database, + "DOCUMENT_SINGLE" => BoardShape::Document, + "PREDEFINED_PROCESS" => BoardShape::PredefinedProcess, + "MANUAL_INPUT" => BoardShape::ManualInput, + "INTERNAL_STORAGE" => BoardShape::InternalStorage, + _ => return None, + }) +} diff --git a/crates/format/src/fig/map/layer.rs b/crates/format/src/fig/map/layer.rs index 869686537..f30279b0f 100644 --- a/crates/format/src/fig/map/layer.rs +++ b/crates/format/src/fig/map/layer.rs @@ -175,8 +175,8 @@ impl<'a> Mapper<'a> { let connector_label = own == "CONNECTOR" && !connector_snapshot && self.connector_label_fits(&view, depth); let ty = if connector_label { "FRAME" } else { Self::mapped_type(own, &view, connector_snapshot, connector_terminal, stand)? }; // A whiteboard's sticky says it imports as a frame only when it can't be a native one. - let native_sticky = self.board && own == "STICKY"; - if let Some((_, what)) = stand.filter(|_| own != "TEXT_PATH" && !native_sticky) { + let native_board = self.board && matches!(own, "STICKY" | "SHAPE_WITH_TEXT"); + if let Some((_, what)) = stand.filter(|_| own != "TEXT_PATH" && !native_board) { self.warn(format!("{} layers import as {what}", own.to_ascii_lowercase().replace('_', " "))); } if connector_snapshot { @@ -264,7 +264,7 @@ impl<'a> Mapper<'a> { }); kids.splice(0..0, connector_kids); if stand.is_some_and(|s| s.0 == "FRAME") { - let native = if native_sticky { self.native_sticky(&mut o, &view, &rest_id, depth) } else { None }; + let native = if native_board { self.native_board_item(own, &mut o, &view, &rest_id, depth) } else { None }; if let Some(native) = native { kids.splice(0..0, native); } else if let Some(snapshot) = self.board_snapshot(&mut o, &view, own, &rest_id, depth) { @@ -273,9 +273,6 @@ impl<'a> Mapper<'a> { kids.splice(0..0, self.shape_with_text(&mut o, &view, own, &rest_id)); kids.extend(self.inner_text(&o, &view, &rest_id, own == "STICKY")); } - if native_sticky && !o.contains_key("board") { - self.warn("sticky layers import as frames with their text"); - } } if !kids.is_empty() { o.insert("children".into(), Value::Array(kids)); diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index 71e6ff010..b1d9fb928 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -1891,6 +1891,7 @@ name = "English" "stale or invalid grid track sizing entries were ignored" = "stale or invalid grid track sizing entries were ignored" "stars and polygons without point counts or geometry use the default point count" = "stars and polygons without point counts or geometry use the default point count" "sticky layers import as frames with their text" = "sticky layers import as frames with their text" +"shape with text layers import as frames with their text" = "shape with text layers import as frames with their text" "style settings of some vector segments aren't supported; those segments use the layer's stroke" = "style settings of some vector segments aren't supported; those segments use the layer's stroke" "text path underline or strikethrough decoration is not rendered" = "text path underline or strikethrough decoration is not rendered" "text style overrides refer to missing table entries" = "text style overrides refer to missing table entries" diff --git a/docs/boards-parity.md b/docs/boards-parity.md index 04cb832bc..9489e51a3 100644 --- a/docs/boards-parity.md +++ b/docs/boards-parity.md @@ -1,6 +1,6 @@ # Boards parity -> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-10 · **Change:** minor (resizing a board table by height changes its rows, not blank space below them: a bottom or top edge grows the last row, a corner shares the change over every row, and a table keeps at least 40 per cell, measured in FigJam's web app, 2026-11-09 (#2172); a `.jam` file's stickies come in as native board stickies, with their colour, text and author kept and the size as saved (#1808); a sticky's text stays 18 and the note grows taller instead of the text shrinking, as measured in FigJam's web app (#2157); mind maps, first step: a first node with three children on curved branches, laid out again after every edit (`board.mindMap`, `board.mindMapAdd`, #2226); a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) +> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-10 · **Change:** minor (a `.jam` file's shapes with text come in as native board shapes for the 23 kinds FigCraft draws, the other 7 as frames (#1808); resizing a board table by height changes its rows, not blank space below them: a bottom or top edge grows the last row, a corner shares the change over every row, and a table keeps at least 40 per cell, measured in FigJam's web app, 2026-11-09 (#2172); a `.jam` file's stickies come in as native board stickies, with their colour, text and author kept and the size as saved (#1808); a sticky's text stays 18 and the note grows taller instead of the text shrinking, as measured in FigJam's web app (#2157); mind maps, first step: a first node with three children on curved branches, laid out again after every edit (`board.mindMap`, `board.mindMapAdd`, #2226); a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) **Breadth ~47%, ready ~29% (estimated, erring low).** A board is a FigCraft file of its own kind (`file.newBoard`) with a dot grid on the page, sticky notes, shapes with text, connectors that @@ -66,7 +66,7 @@ all end with the same geometry. | Audio and huddles | missing | | | AI features (summaries, sorting stickies, generating boards) | missing | | | Grid on the page | done | the canvas render draws it after the page colour and before the layers (`figcraft_render::Dots`), so objects cover it. Dots by default, or lines, graph paper (a strong line every 2–12 cells over fainter ones, like Japanese section paper) or none; spacing (4–512), mark size and contrast are settings kept with the preferences (`board.grid`; Preferences ▸ Board grid). Zoomed out it thins out (dots and lines by halves, graph paper down to its strong lines) until the marks are at least 14 points apart (10 for lines), the marks the next step drops fading out first; dots stay about a point and a half across on screen (1 to 3 points), scaled by the size setting. Dark marks on a light page, light ones on a dark page, from the theme's ink; written straight into the image, no allocation per mark, a crossing of two lines blended once; never in exports. FigCraft's own settings: the incumbent's board grid has none | -| `.jam` import and export | **partial**: a `.jam` opens as a board, best effort (#1342): its stickies come in as native stickies (their colour, text and author kept; size as saved), its shapes with text as frames with their generated layers and its connectors as vectors, not yet as native board objects (an elbowed connector keeps the path it was saved with, #1910); no export | see [`file-format-parity.md`](file-format-parity.md) | +| `.jam` import and export | **partial**: a `.jam` opens as a board, best effort (#1342): its stickies come in as native stickies (their colour, text and author kept; size as saved), its shapes with text as native shapes for the 23 kinds FigCraft draws (the file's paints and weight kept, the outline FigCraft's own; the 7 others stay frames with their generated layers) and its connectors as vectors, not yet as native board objects (an elbowed connector keeps the path it was saved with, #1910); no export | see [`file-format-parity.md`](file-format-parity.md) | ## Revision history @@ -76,6 +76,7 @@ all end with the same geometry. | 2026-11-09 | patch | M12, #2157: a sticky's text is 18 and stays 18 (measured in FigJam's web app: ten lines, then a long paragraph, never changed it; the note kept its width and grew taller). The normalize pass no longer resets a sticky's text to a size by its length (24 down to 11 before), so stickies in saved files keep their size. Size presets (Small to Huge) are still missing. Tests: `a_new_sticky_starts_at_18`, `a_sticky_keeps_its_text_size_as_text_is_added`, `a_sticky_saved_with_another_text_size_keeps_it` | | 2026-11-10 | minor | M12, #2226 (step 1 of 4): mind maps in the document and engine. A mind map node is a board object of its own (`BoardItem::MindNode`: text with no box) and a branch is a connector marked `branch`; the map's shape is read from its branches. `board.mindMap` places a first node with three children and `board.mindMapAdd` adds a child or a sibling, each one undo step. The normalize pass lays a touched map out again from its first node (`board::settle_mind_maps`, `figcraft_doc::mind_layout`): 88 between columns, 48 between siblings, each stack centred on its parent, numbers from a FigJam file saved and decoded. Tests: `board_mindmap_tests` in doc (five) and engine (eight). Numbers unchanged (no toolbar entry yet). | | 2026-11-03 | minor | M12, #1919: as the quick create help says ("Click to select and create the next shape in that direction, or drag the preview to any location on your board"; "A new shape is created with a connector and its text field active"), a "+" beside the selected sticky or shape can be dragged: the preview follows the pointer and, let go on empty board, the next one is made there, centred on the pointer, and joined by a connector leaving by the handle's side and arriving by the side facing it (`board.addConnected` gains `at: [x, y]`, a point of the page placed in the parent's coordinates); let go on another sticky or shape, inside a section or frame too (`board::sticky_or_shape_at`), a connector joins the two instead (`board.connector`), that object outlined while the pointer is over it; let go off the canvas or over the toolbar, nothing, and the bar above the selection stays away meanwhile, as for any drag. The click is as before. A shape picker on drop and choosing the connector type are not done (the help doesn't describe them). Tests: `board_connect_tests` (the drag ones), engine `board_connected_tests::the_next_one_goes_where_it_is_dropped`. Numbers unchanged. | +| 2026-11-12 | minor | M9, #1808: `.jam` import: a FigJam shape with text comes in as a native board shape (`BoardItem::Shape`) for the 23 kinds FigCraft draws (square, rounded rectangle, ellipse, diamond, triangles, parallelograms, trapezoid, pentagon, hexagon, octagon, star, plus, arrows, chevron, speech bubble, database, document, predefined process, manual input, internal storage). The frame is empty with centred auto layout and the kind's text insets; it holds an `Outline` vector drawn by FigCraft (`BoardShape::path`, so FigJam's 3 pt corner on a square is lost, and `board.setShape` and resizing treat it as FigCraft's own) with the file's paints, weight and dashes as read, and the text, centred. The 7 kinds FigCraft has no outline for (ENG_QUEUE, ENG_FILE, ENG_FOLDER, SHIELD, DOCUMENT_MULTIPLE, SUMMING_JUNCTION, OR) stay frames with their generated layers and a warning naming the kind; so does a shape whose generated records are damaged (a shape with no text yet is still native, with an empty text layer), and the same shape in a `.fig`. Tests: `board_import_tests.rs` (five). Numbers unchanged. | | 2026-11-10 | minor | M9, #1808: a `.jam` sticky imports as a native board sticky (`BoardItem::Sticky`): its frame keeps the saved size (240 pt, not FigCraft's 200), place, opacity and shadows, the saved colour is kept as it is (not snapped to the board colours), the note and the author line are its text layers, and it lays out like one made here (vertical, space between, hugging the height down to the saved size, the saved inset as padding). The importer reads a `board` field on the REST JSON (a FigCraft extension) for this; a sticky whose generated records are damaged, or the same sticky in a `.fig`, keeps the generated layers as before. Shapes, connectors, stamps and tables are unchanged; the note's text keeps the file's size until it is edited. Tests: `board_import_tests.rs` (native sticky, no author, damaged records, `.fig` unchanged), `import_regression_tests.rs` (the `board` field and junk values). Numbers unchanged. | | 2026-11-04 | minor | M12, #1916: a connector end attached to a side starts 4 pt outside the border (`board_route::END_GAP`), as FigJam's do (the issue's screenshots: the line starts a few pixels outside, with a round cap), so the stroke never lies on the fill; elbows leaving one side share their first run along its normal, curves leave tangent to it and straight ones fan out from the same point; the `.jam` importer's routes, re-attached ends, path handles and labels follow the route's points; an end placed by hand with Cmd/Ctrl held keeps its exact point. Tests: `board_route_tests` (three). Numbers unchanged. | | 2026-11-04 | patch | M6, #1910: a `.jam` elbowed connector saved with its path (FigJam's `connectorControlPoints`) keeps it on import: the points become the `ConnectorPath::Runs` a connector reshaped by hand has and the line is walked along them, so a connector drawn around a layer stays around it; one whose points don't make a path from its ends' sides is routed as before. Still a vector, not a native board object. Details in [`file-format-parity.md`](file-format-parity.md). | diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 56de5f480..e690394bc 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-11-10 · **Change:** minor (`.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (`.jam` import: shapes with text come in as native board shapes (#1808); `.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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 @@ -20,7 +20,7 @@ and prototype interactions are still unchecked there. | `.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 (with their corner radius and smoothing, #2222), 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; an instance scaled with the Scale tool, which stores `symbolData.uniformScaleFactor`, draws its layers at the main's lengths times that factor, composed through nested instances: sizes and places, corner radii, stroke weights and dashes, effect radii, spreads and offsets, auto layout gaps and paddings, grid gaps, min and max sizes, layout grids, font sizes, pixel line heights and letter spacings, paragraph spacing and indent, except where an override or derived row gives the value, which is already at the instance's scale; per-point vector corner radii also take their vector-data row's factor; the vector outline paths a layer carries (a network's points follow the layer's size), fixed grid tracks, image tile scales and glass effects are not scaled by the factor, #2091), 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); an elbowed one saved with its path (`connectorControlPoints`: a point and an axis per run between the first and the last) keeps that path when it leaves and arrives by the ends' sides (#1910), and a curved one's saved `connectorBezierControlPoints` are not read; 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 stickies as native board stickies (their colour, text and author kept, size as saved, #1808) and generated 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 (an elbowed connector keeps the path it was saved with, #1910), 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 | — | +| `.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 stickies as native board stickies (their colour, text and author kept, size as saved, #1808), shapes with text as native board shapes for the 23 kinds FigCraft draws (their paints and weight kept, the outline FigCraft's own; the 7 others keep their generated backgrounds and text, #1341, as ordinary layers) (see [boards-parity](boards-parity.md)); tables, stamps, code blocks and the like come in as frames with their text and connectors as vectors (an elbowed connector keeps the path it was saved with, #1910), 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 | — | | `.deck` (Slides) | native to other Figma products | no | no | out of scope | — | | REST API file JSON (`GET /v1/files/:key`) + local variables JSON + `images/` folder | the API's output | **yes** (`file.open`, `file.import`, CLI) | no | pages, layer tree, geometry, paints, strokes, effects, text runs, vectors, auto layout (sizing modes left out read as hug, as documented; grid track sizes from `gridColumnsSizing` / `gridRowsSizing`: px, fr, auto, `minmax(0, 1fr)`, `repeat()`), constraints, grids, components, sets, instances with overrides (sizes and resizing included), component properties, slots (`SLOT` layers bound to their slot property; an instance's slot keeps its content as the instance's own unless its property value is the main's default content; slot limits and preferred components are warnings), styles, prototyping (incl. conditionals and variable modes), variables with modes, aliases, scopes and bindings, image adjustments (the same tint sign as `.fig`); the import report after opening; warnings for what's skipped (video triggers and actions, modifier keys). Unit tests in `crates/format/src/rest/*_tests.rs` | — | | `.figcraft` (ours: zip of `document.json` + images, versions inside) | — | yes | yes | streamed JSON, 50k layers save ~0.09 s / load ~0.16 s (`cargo xtask bench`); old files keep opening (`large_tests.rs`); image members are `images/`, and a key that can't be one — path text, a space, over 128 chars — is left out with a complaint instead of loaded (`image_tests`); saves write a unique staging file and rename it into place (#284); optional auto-save of files with a path (`pref.autoSave`, #305); Save and auto-save refuse to write over a file another app (figcraft-cli, say) changed since it was opened or saved here, judged by its size and modification time: Revert to saved loads those changes, Save as keeps both, `file.save {overwrite: true}` replaces them (#1330); `kind: "board"` marks a board (left out for design files, so files from before boards are design files; the home screen reads it for the file's mark); board objects keep their `board` metadata on the layer; Developer Mode measurements are kept on the layer they start from (`measurements: [{to} | {side}]`, left out when there are none, so older files open with none) | — | @@ -203,6 +203,7 @@ scales and empty-style clears; they have not been checked in other software. | 2026-11-07 | minor | `.fig` import, #2091 item 1: an instance scaled with the Scale tool stores `symbolData.uniformScaleFactor`, which the import never read, so the layers of a 128 px instance of a 256 px component came in at 256 px with the main's radii, strokes and spacing. The layers of an instance now take the main's lengths times the factor (composed through nested instances, so 0.5 inside 0.5 is 0.25 for the inner layers), the lengths the Scale tool scales: sizes and places, corner radii, stroke weights and dashes, effect radii, spreads and offsets, auto layout gaps and paddings, grid gaps, min and max sizes, layout grids, font sizes, pixel line heights and letter spacings, paragraph spacing and indent. A value an override or derived row gives is taken as written, already at the instance's scale; the instance's own size is the file's; a missing, non-finite, non-positive or out-of-range factor (outside 0.001 to 1000) changes nothing. Not scaled: vector outline paths (a network's points follow the layer's size), per-point corner radii, fixed grid tracks, image tile scales and glass effects. Tests: `fig::tests::a_scaled_instance_draws_its_layers_at_the_factor` and `fig::scale_factor_tests`. Numbers unchanged | | 2026-11-03 | patch | M6, #1909: `.jam` import: a connector end whose magnet is `AUTO` (FigJam picks the side when it draws) or `CENTER` (the end aims at the layer's middle) left the side its stale `relativePosition` named, the left one in the reporter's file, so the connectors looped behind their shape or crossed it. It now leaves the side facing the other end, as a board connector drawn here does (`Side::Auto`), for straight, elbowed and curved connectors alike; a named magnet (`TOP`, `RIGHT`, `BOTTOM`, `LEFT`) is unchanged, and an end without a magnet still takes the edge its point lies on. The Plugin API lists the magnets (`ConnectorEndpoint.magnet`: "Which side of the node it attaches to"; NONE, AUTO, TOP, LEFT, BOTTOM, RIGHT, CENTER; "Straight connectors may use only CENTER or NONE magnets"). Test: `connectors_with_an_automatic_side_leave_the_side_facing_the_target`. Numbers unchanged. | | 2026-11-04 | minor | JPG export: `quality` (1 to 100, default 90) on `file.export`, `export.add` / `export.update` and MCP `export`, kept in the export setting; an sRGB file's JPGs embed the sRGB ICC profile, as Display P3 files' JPGs already embedded theirs, since an untagged JPG is only assumed to be sRGB (#2004). | +| 2026-11-12 | minor | M9, #1808: `.jam` import: a FigJam shape with text comes in as a native board shape (`BoardItem::Shape`) for the 23 kinds FigCraft draws (square, rounded rectangle, ellipse, diamond, triangles, parallelograms, trapezoid, pentagon, hexagon, octagon, star, plus, arrows, chevron, speech bubble, database, document, predefined process, manual input, internal storage). The frame is empty with centred auto layout and the kind's text insets; it holds an `Outline` vector drawn by FigCraft (`BoardShape::path`, so FigJam's 3 pt corner on a square is lost, and `board.setShape` and resizing treat it as FigCraft's own) with the file's paints, weight and dashes as read, and the text, centred. The 7 kinds FigCraft has no outline for (ENG_QUEUE, ENG_FILE, ENG_FOLDER, SHIELD, DOCUMENT_MULTIPLE, SUMMING_JUNCTION, OR) stay frames with their generated layers and a warning naming the kind; so does a shape whose generated records are damaged or whose text is blank, and the same shape in a `.fig`. Tests: `board_import_tests.rs` (four). Numbers unchanged. | | 2026-11-10 | minor | M9, #1808: `.jam` import: a FigJam sticky comes in as a native board sticky. The mapper knows the canvas header (`fig-jam.`) and, for a whiteboard only, writes a `board` field (`{"type": "sticky", "author": ..}`, a FigCraft extension of the REST JSON) on a sticky whose generated records are complete (layout version 1, one visible solid background paint without strokes, a non-blank note), with the background's colour and corner radius, the file's size, place, opacity and shadows, the note and the author line as text layers and no background vector; the REST importer sets it as the layer's board item and ignores a junk `board` value with a warning. A sticky that isn't complete, or any sticky in a `.fig`, keeps the generated layers and the old note. Shapes with text, connectors, stamps and tables are unchanged. Tests: `fig::tests::board` (four), `rest::import_regression_tests` (two). | | 2026-11-04 | minor | `.fig` and `.jam` import, #1910: an elbowed connector saved with its path keeps it. FigJam stores `connectorControlPoints`, one per run between the first and the last, each a point on its run (in the connector's parent's coordinates) with the run's axis; the first run leaves the start's side and the last arrives at the end's. They become the `ConnectorPath::Runs` a board connector reshaped by hand has (`figcraft_doc::route_along`), so a connector drawn around a layer in FigJam stays around it instead of being routed through it. Points that don't make such a path (off both axes, two runs in a row the same way, a first or last run sideways to its side or going back into its object, more runs than a hand could make) leave the connector to the router as before, and only connectors routed here count in the "follow FigCraft's own routing" note. A curved connector's `connectorBezierControlPoints` are still not read. Tests: `tail_tests::an_elbow_connector_saved_with_its_path_keeps_it`, `tail_tests::an_elbow_whose_saved_path_doesnt_fit_its_sides_is_routed_here`. | | 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 | From 9e22cc7bc3bbeed335ffed5866cc99b2f8b7a27f Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 03:30:43 -0500 Subject: [PATCH 185/239] M9: .jam shapes keep their fixed size and a blank record's outer text (#1808) A native shape frame now writes fixed sizing on both axes, as a shape made here has, so the first edit no longer shrinks it to hug its text. A shape whose generated text is blank while the outer layer still carries text keeps the generated layers (#1397). The kind name in the no-outline note is clipped, the docs rows match the code, and the new key sits in order. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 briefed; Sonnet 5.5 wrote at medium --- crates/format/src/fig/board_import_tests.rs | 19 +++++++++++++++++++ crates/format/src/fig/map/board.rs | 9 ++++++++- crates/format/src/fig/map/layer.rs | 2 +- crates/ui-egui/locales/en.toml | 2 +- docs/boards-parity.md | 4 ++-- docs/file-format-parity.md | 4 ++-- 6 files changed, 33 insertions(+), 7 deletions(-) diff --git a/crates/format/src/fig/board_import_tests.rs b/crates/format/src/fig/board_import_tests.rs index b1b1e30c7..efbabde05 100644 --- a/crates/format/src/fig/board_import_tests.rs +++ b/crates/format/src/fig/board_import_tests.rs @@ -566,6 +566,11 @@ fn a_jam_diamond_is_a_native_shape_drawn_by_figcraft() { assert!(frame.fills.is_empty()); assert_eq!((frame.width, frame.height), (240.0, 240.0)); assert_eq!(frame.layout.as_ref().expect("shape auto layout").padding, [0.25 * 240.0; 4]); + assert_eq!( + (frame.child_layout.sizing_h, frame.child_layout.sizing_v), + (figcraft_doc::Sizing::Fixed, figcraft_doc::Sizing::Fixed), + "a fixed box, as a shape made here: it must not hug its text" + ); assert_eq!(frame.children.len(), 2, "the outline and the text: {warnings:?}"); let outline = doc.node(frame.children[0]).unwrap(); let NodeKind::Vector { network } = &outline.kind else { panic!("{:?}", outline.kind) }; @@ -686,3 +691,17 @@ fn a_jam_shape_without_text_is_still_a_native_shape() { assert_eq!(frame.board, Some(figcraft_doc::BoardItem::Shape { shape: figcraft_doc::BoardShape::Rectangle })); assert_eq!(doc.node(frame.children[1]).unwrap().kind.text().unwrap().characters, ""); } + +/// Blank generated text must not hide text the outer node still carries (#1397): on a whiteboard +/// too, such a shape keeps the generated layers. +#[test] +fn a_jam_shape_whose_text_only_the_outer_node_carries_keeps_it() { + let mut layer = shape_node("SQUARE"); + set(&mut layer, "textData", o(vec![("characters", s("Outer saved text"))])); + let background = record(0, vec![("fillPaints", arr(vec![solid(1.0, 1.0, 1.0)]))]); + set(&mut layer, "nodeGenerationData", o(vec![("overrides", arr(vec![background, record(1, text(" ", 24.0))]))])); + let (doc, _) = jam(layer); + let frame = named(&doc, "Board object"); + assert!(frame.board.is_none(), "the generated layers keep the outer text"); + assert!(frame.children.iter().filter_map(|id| doc.node(*id)?.kind.text()).any(|t| t.characters == "Outer saved text")); +} diff --git a/crates/format/src/fig/map/board.rs b/crates/format/src/fig/map/board.rs index 5b885f060..7ea2de801 100644 --- a/crates/format/src/fig/map/board.rs +++ b/crates/format/src/fig/map/board.rs @@ -110,7 +110,7 @@ impl<'a> Mapper<'a> { pub(super) fn native_shape(&mut self, o: &mut Obj, v: &View<'a>, rest_id: &str, depth: usize) -> Option> { let kind = v.str("shapeWithTextType").unwrap_or("SQUARE"); let Some(shape) = board_shape(kind) else { - self.warn(format!("shape with text kind {kind} has no FigCraft outline; kept as a frame")); + self.warn(format!("shape with text kind {} has no FigCraft outline; kept as a frame", crate::rest::props::clip_str(kind))); return None; }; if v.get("nodeGenerationData").is_none() || v.get("derivedImmutableFrameData").and_then(|d| num(d, "version")) != Some(1.0) { @@ -123,6 +123,11 @@ impl<'a> Mapper<'a> { }; let background = record(0)?; let body = record(1)?; + // Blank generated text must not hide text the outer node still carries (#1397): the + // generated layers keep it. + if own_text(&body).is_none() && own_text(v).is_some() { + return None; + } if depth >= MAX_DEPTH || self.count.saturating_add(2) > self.budget() { return None; } @@ -162,6 +167,8 @@ impl<'a> Mapper<'a> { ("layoutMode", json!("VERTICAL")), ("primaryAxisAlignItems", json!("CENTER")), ("counterAxisAlignItems", json!("CENTER")), + ("primaryAxisSizingMode", json!("FIXED")), + ("counterAxisSizingMode", json!("FIXED")), ("paddingTop", json!(top * h)), ("paddingRight", json!(right * w)), ("paddingBottom", json!(bottom * h)), diff --git a/crates/format/src/fig/map/layer.rs b/crates/format/src/fig/map/layer.rs index f30279b0f..a2bc20ad0 100644 --- a/crates/format/src/fig/map/layer.rs +++ b/crates/format/src/fig/map/layer.rs @@ -174,7 +174,7 @@ impl<'a> Mapper<'a> { // A label without a snapshot: the connector becomes a frame holding its line and its label. let connector_label = own == "CONNECTOR" && !connector_snapshot && self.connector_label_fits(&view, depth); let ty = if connector_label { "FRAME" } else { Self::mapped_type(own, &view, connector_snapshot, connector_terminal, stand)? }; - // A whiteboard's sticky says it imports as a frame only when it can't be a native one. + // A whiteboard's sticky or shape with text says it imports as a frame only when it can't be a native one. let native_board = self.board && matches!(own, "STICKY" | "SHAPE_WITH_TEXT"); if let Some((_, what)) = stand.filter(|_| own != "TEXT_PATH" && !native_board) { self.warn(format!("{} layers import as {what}", own.to_ascii_lowercase().replace('_', " "))); diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index b1d9fb928..c916ccd0f 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -1883,6 +1883,7 @@ name = "English" "set-variable actions without a value were skipped" = "set-variable actions without a value were skipped" "set-variable-mode actions on collections or modes that aren't in the variables JSON were skipped" = "set-variable-mode actions on collections or modes that aren't in the variables JSON were skipped" "shape generated outline is missing or damaged; using its rectangle" = "shape generated outline is missing or damaged; using its rectangle" +"shape with text layers import as frames with their text" = "shape with text layers import as frames with their text" "slot content assignment target is missing or is not slot content" = "slot content assignment target is missing or is not slot content" "slot content assignment uses the empty GUID sentinel and was skipped" = "slot content assignment uses the empty GUID sentinel and was skipped" "slot layers without a matching slot property were imported as frames" = "slot layers without a matching slot property were imported as frames" @@ -1891,7 +1892,6 @@ name = "English" "stale or invalid grid track sizing entries were ignored" = "stale or invalid grid track sizing entries were ignored" "stars and polygons without point counts or geometry use the default point count" = "stars and polygons without point counts or geometry use the default point count" "sticky layers import as frames with their text" = "sticky layers import as frames with their text" -"shape with text layers import as frames with their text" = "shape with text layers import as frames with their text" "style settings of some vector segments aren't supported; those segments use the layer's stroke" = "style settings of some vector segments aren't supported; those segments use the layer's stroke" "text path underline or strikethrough decoration is not rendered" = "text path underline or strikethrough decoration is not rendered" "text style overrides refer to missing table entries" = "text style overrides refer to missing table entries" diff --git a/docs/boards-parity.md b/docs/boards-parity.md index 9489e51a3..9b1972be9 100644 --- a/docs/boards-parity.md +++ b/docs/boards-parity.md @@ -1,6 +1,6 @@ # Boards parity -> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-10 · **Change:** minor (a `.jam` file's shapes with text come in as native board shapes for the 23 kinds FigCraft draws, the other 7 as frames (#1808); resizing a board table by height changes its rows, not blank space below them: a bottom or top edge grows the last row, a corner shares the change over every row, and a table keeps at least 40 per cell, measured in FigJam's web app, 2026-11-09 (#2172); a `.jam` file's stickies come in as native board stickies, with their colour, text and author kept and the size as saved (#1808); a sticky's text stays 18 and the note grows taller instead of the text shrinking, as measured in FigJam's web app (#2157); mind maps, first step: a first node with three children on curved branches, laid out again after every edit (`board.mindMap`, `board.mindMapAdd`, #2226); a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) +> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-12 · **Change:** minor (a `.jam` file's shapes with text come in as native board shapes for the 23 kinds FigCraft draws, the other 7 as frames (#1808); resizing a board table by height changes its rows, not blank space below them: a bottom or top edge grows the last row, a corner shares the change over every row, and a table keeps at least 40 per cell, measured in FigJam's web app, 2026-11-09 (#2172); a `.jam` file's stickies come in as native board stickies, with their colour, text and author kept and the size as saved (#1808); a sticky's text stays 18 and the note grows taller instead of the text shrinking, as measured in FigJam's web app (#2157); mind maps, first step: a first node with three children on curved branches, laid out again after every edit (`board.mindMap`, `board.mindMapAdd`, #2226); a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) **Breadth ~47%, ready ~29% (estimated, erring low).** A board is a FigCraft file of its own kind (`file.newBoard`) with a dot grid on the page, sticky notes, shapes with text, connectors that @@ -76,7 +76,7 @@ all end with the same geometry. | 2026-11-09 | patch | M12, #2157: a sticky's text is 18 and stays 18 (measured in FigJam's web app: ten lines, then a long paragraph, never changed it; the note kept its width and grew taller). The normalize pass no longer resets a sticky's text to a size by its length (24 down to 11 before), so stickies in saved files keep their size. Size presets (Small to Huge) are still missing. Tests: `a_new_sticky_starts_at_18`, `a_sticky_keeps_its_text_size_as_text_is_added`, `a_sticky_saved_with_another_text_size_keeps_it` | | 2026-11-10 | minor | M12, #2226 (step 1 of 4): mind maps in the document and engine. A mind map node is a board object of its own (`BoardItem::MindNode`: text with no box) and a branch is a connector marked `branch`; the map's shape is read from its branches. `board.mindMap` places a first node with three children and `board.mindMapAdd` adds a child or a sibling, each one undo step. The normalize pass lays a touched map out again from its first node (`board::settle_mind_maps`, `figcraft_doc::mind_layout`): 88 between columns, 48 between siblings, each stack centred on its parent, numbers from a FigJam file saved and decoded. Tests: `board_mindmap_tests` in doc (five) and engine (eight). Numbers unchanged (no toolbar entry yet). | | 2026-11-03 | minor | M12, #1919: as the quick create help says ("Click to select and create the next shape in that direction, or drag the preview to any location on your board"; "A new shape is created with a connector and its text field active"), a "+" beside the selected sticky or shape can be dragged: the preview follows the pointer and, let go on empty board, the next one is made there, centred on the pointer, and joined by a connector leaving by the handle's side and arriving by the side facing it (`board.addConnected` gains `at: [x, y]`, a point of the page placed in the parent's coordinates); let go on another sticky or shape, inside a section or frame too (`board::sticky_or_shape_at`), a connector joins the two instead (`board.connector`), that object outlined while the pointer is over it; let go off the canvas or over the toolbar, nothing, and the bar above the selection stays away meanwhile, as for any drag. The click is as before. A shape picker on drop and choosing the connector type are not done (the help doesn't describe them). Tests: `board_connect_tests` (the drag ones), engine `board_connected_tests::the_next_one_goes_where_it_is_dropped`. Numbers unchanged. | -| 2026-11-12 | minor | M9, #1808: `.jam` import: a FigJam shape with text comes in as a native board shape (`BoardItem::Shape`) for the 23 kinds FigCraft draws (square, rounded rectangle, ellipse, diamond, triangles, parallelograms, trapezoid, pentagon, hexagon, octagon, star, plus, arrows, chevron, speech bubble, database, document, predefined process, manual input, internal storage). The frame is empty with centred auto layout and the kind's text insets; it holds an `Outline` vector drawn by FigCraft (`BoardShape::path`, so FigJam's 3 pt corner on a square is lost, and `board.setShape` and resizing treat it as FigCraft's own) with the file's paints, weight and dashes as read, and the text, centred. The 7 kinds FigCraft has no outline for (ENG_QUEUE, ENG_FILE, ENG_FOLDER, SHIELD, DOCUMENT_MULTIPLE, SUMMING_JUNCTION, OR) stay frames with their generated layers and a warning naming the kind; so does a shape whose generated records are damaged (a shape with no text yet is still native, with an empty text layer), and the same shape in a `.fig`. Tests: `board_import_tests.rs` (five). Numbers unchanged. | +| 2026-11-12 | minor | M9, #1808: `.jam` import: a FigJam shape with text comes in as a native board shape (`BoardItem::Shape`) for the 23 kinds FigCraft draws (square, rounded rectangle, ellipse, diamond, triangles, parallelograms, trapezoid, pentagon, hexagon, octagon, star, plus, arrows, chevron, speech bubble, database, document, predefined process, manual input, internal storage). The frame is empty and a fixed size, as a shape made here, with centred auto layout and the kind's text insets; it holds an `Outline` vector drawn by FigCraft (`BoardShape::path`, so FigJam's 3 pt corner on a square is lost, and `board.setShape` and resizing treat it as FigCraft's own) with the file's paints, weight and dashes as read, and the text, centred. The 7 kinds FigCraft has no outline for (ENG_QUEUE, ENG_FILE, ENG_FOLDER, SHIELD, DOCUMENT_MULTIPLE, SUMMING_JUNCTION, OR) stay frames with their generated layers and a warning naming the kind; so does a shape whose generated records are damaged, or whose generated text is blank while the outer layer still carries text (#1397), and the same shape in a `.fig`; a shape with no text at all is still native, with an empty text layer. Tests: `board_import_tests.rs` (six). Numbers unchanged. | | 2026-11-10 | minor | M9, #1808: a `.jam` sticky imports as a native board sticky (`BoardItem::Sticky`): its frame keeps the saved size (240 pt, not FigCraft's 200), place, opacity and shadows, the saved colour is kept as it is (not snapped to the board colours), the note and the author line are its text layers, and it lays out like one made here (vertical, space between, hugging the height down to the saved size, the saved inset as padding). The importer reads a `board` field on the REST JSON (a FigCraft extension) for this; a sticky whose generated records are damaged, or the same sticky in a `.fig`, keeps the generated layers as before. Shapes, connectors, stamps and tables are unchanged; the note's text keeps the file's size until it is edited. Tests: `board_import_tests.rs` (native sticky, no author, damaged records, `.fig` unchanged), `import_regression_tests.rs` (the `board` field and junk values). Numbers unchanged. | | 2026-11-04 | minor | M12, #1916: a connector end attached to a side starts 4 pt outside the border (`board_route::END_GAP`), as FigJam's do (the issue's screenshots: the line starts a few pixels outside, with a round cap), so the stroke never lies on the fill; elbows leaving one side share their first run along its normal, curves leave tangent to it and straight ones fan out from the same point; the `.jam` importer's routes, re-attached ends, path handles and labels follow the route's points; an end placed by hand with Cmd/Ctrl held keeps its exact point. Tests: `board_route_tests` (three). Numbers unchanged. | | 2026-11-04 | patch | M6, #1910: a `.jam` elbowed connector saved with its path (FigJam's `connectorControlPoints`) keeps it on import: the points become the `ConnectorPath::Runs` a connector reshaped by hand has and the line is walked along them, so a connector drawn around a layer stays around it; one whose points don't make a path from its ends' sides is routed as before. Still a vector, not a native board object. Details in [`file-format-parity.md`](file-format-parity.md). | diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index e690394bc..57132c32a 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-11-10 · **Change:** minor (`.jam` import: shapes with text come in as native board shapes (#1808); `.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (`.jam` import: shapes with text come in as native board shapes (#1808); `.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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 @@ -203,7 +203,7 @@ scales and empty-style clears; they have not been checked in other software. | 2026-11-07 | minor | `.fig` import, #2091 item 1: an instance scaled with the Scale tool stores `symbolData.uniformScaleFactor`, which the import never read, so the layers of a 128 px instance of a 256 px component came in at 256 px with the main's radii, strokes and spacing. The layers of an instance now take the main's lengths times the factor (composed through nested instances, so 0.5 inside 0.5 is 0.25 for the inner layers), the lengths the Scale tool scales: sizes and places, corner radii, stroke weights and dashes, effect radii, spreads and offsets, auto layout gaps and paddings, grid gaps, min and max sizes, layout grids, font sizes, pixel line heights and letter spacings, paragraph spacing and indent. A value an override or derived row gives is taken as written, already at the instance's scale; the instance's own size is the file's; a missing, non-finite, non-positive or out-of-range factor (outside 0.001 to 1000) changes nothing. Not scaled: vector outline paths (a network's points follow the layer's size), per-point corner radii, fixed grid tracks, image tile scales and glass effects. Tests: `fig::tests::a_scaled_instance_draws_its_layers_at_the_factor` and `fig::scale_factor_tests`. Numbers unchanged | | 2026-11-03 | patch | M6, #1909: `.jam` import: a connector end whose magnet is `AUTO` (FigJam picks the side when it draws) or `CENTER` (the end aims at the layer's middle) left the side its stale `relativePosition` named, the left one in the reporter's file, so the connectors looped behind their shape or crossed it. It now leaves the side facing the other end, as a board connector drawn here does (`Side::Auto`), for straight, elbowed and curved connectors alike; a named magnet (`TOP`, `RIGHT`, `BOTTOM`, `LEFT`) is unchanged, and an end without a magnet still takes the edge its point lies on. The Plugin API lists the magnets (`ConnectorEndpoint.magnet`: "Which side of the node it attaches to"; NONE, AUTO, TOP, LEFT, BOTTOM, RIGHT, CENTER; "Straight connectors may use only CENTER or NONE magnets"). Test: `connectors_with_an_automatic_side_leave_the_side_facing_the_target`. Numbers unchanged. | | 2026-11-04 | minor | JPG export: `quality` (1 to 100, default 90) on `file.export`, `export.add` / `export.update` and MCP `export`, kept in the export setting; an sRGB file's JPGs embed the sRGB ICC profile, as Display P3 files' JPGs already embedded theirs, since an untagged JPG is only assumed to be sRGB (#2004). | -| 2026-11-12 | minor | M9, #1808: `.jam` import: a FigJam shape with text comes in as a native board shape (`BoardItem::Shape`) for the 23 kinds FigCraft draws (square, rounded rectangle, ellipse, diamond, triangles, parallelograms, trapezoid, pentagon, hexagon, octagon, star, plus, arrows, chevron, speech bubble, database, document, predefined process, manual input, internal storage). The frame is empty with centred auto layout and the kind's text insets; it holds an `Outline` vector drawn by FigCraft (`BoardShape::path`, so FigJam's 3 pt corner on a square is lost, and `board.setShape` and resizing treat it as FigCraft's own) with the file's paints, weight and dashes as read, and the text, centred. The 7 kinds FigCraft has no outline for (ENG_QUEUE, ENG_FILE, ENG_FOLDER, SHIELD, DOCUMENT_MULTIPLE, SUMMING_JUNCTION, OR) stay frames with their generated layers and a warning naming the kind; so does a shape whose generated records are damaged or whose text is blank, and the same shape in a `.fig`. Tests: `board_import_tests.rs` (four). Numbers unchanged. | +| 2026-11-12 | minor | M9, #1808: `.jam` import: a FigJam shape with text comes in as a native board shape (`BoardItem::Shape`) for the 23 kinds FigCraft draws (square, rounded rectangle, ellipse, diamond, triangles, parallelograms, trapezoid, pentagon, hexagon, octagon, star, plus, arrows, chevron, speech bubble, database, document, predefined process, manual input, internal storage). The frame is empty and a fixed size, as a shape made here, with centred auto layout and the kind's text insets; it holds an `Outline` vector drawn by FigCraft (`BoardShape::path`, so FigJam's 3 pt corner on a square is lost, and `board.setShape` and resizing treat it as FigCraft's own) with the file's paints, weight and dashes as read, and the text, centred. The 7 kinds FigCraft has no outline for (ENG_QUEUE, ENG_FILE, ENG_FOLDER, SHIELD, DOCUMENT_MULTIPLE, SUMMING_JUNCTION, OR) stay frames with their generated layers and a warning naming the kind; so does a shape whose generated records are damaged, or whose generated text is blank while the outer layer still carries text (#1397), and the same shape in a `.fig`; a shape with no text at all is still native, with an empty text layer. Tests: `board_import_tests.rs` (six). Numbers unchanged. | | 2026-11-10 | minor | M9, #1808: `.jam` import: a FigJam sticky comes in as a native board sticky. The mapper knows the canvas header (`fig-jam.`) and, for a whiteboard only, writes a `board` field (`{"type": "sticky", "author": ..}`, a FigCraft extension of the REST JSON) on a sticky whose generated records are complete (layout version 1, one visible solid background paint without strokes, a non-blank note), with the background's colour and corner radius, the file's size, place, opacity and shadows, the note and the author line as text layers and no background vector; the REST importer sets it as the layer's board item and ignores a junk `board` value with a warning. A sticky that isn't complete, or any sticky in a `.fig`, keeps the generated layers and the old note. Shapes with text, connectors, stamps and tables are unchanged. Tests: `fig::tests::board` (four), `rest::import_regression_tests` (two). | | 2026-11-04 | minor | `.fig` and `.jam` import, #1910: an elbowed connector saved with its path keeps it. FigJam stores `connectorControlPoints`, one per run between the first and the last, each a point on its run (in the connector's parent's coordinates) with the run's axis; the first run leaves the start's side and the last arrives at the end's. They become the `ConnectorPath::Runs` a board connector reshaped by hand has (`figcraft_doc::route_along`), so a connector drawn around a layer in FigJam stays around it instead of being routed through it. Points that don't make such a path (off both axes, two runs in a row the same way, a first or last run sideways to its side or going back into its object, more runs than a hand could make) leave the connector to the router as before, and only connectors routed here count in the "follow FigCraft's own routing" note. A curved connector's `connectorBezierControlPoints` are still not read. Tests: `tail_tests::an_elbow_connector_saved_with_its_path_keeps_it`, `tail_tests::an_elbow_whose_saved_path_doesnt_fit_its_sides_is_routed_here`. | | 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 | From e27d67fa035ac9ea518abb40acb54d9ca12cbf6a Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 03:39:53 -0500 Subject: [PATCH 186/239] Docs: Last updated matches the newest revision row Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and fixed --- docs/ui-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 15927b607..ce669529c 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-10 · **Change:** minor (drag modifiers compared in Figma's web app (2026-11-08): Shift locks a move to the dominant axis, Alt copies, Shift keeps a resize's ratio, Alt keeps its centre, all read afresh on every move, and FigCraft matches (Ctrl/Cmd not measurable); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (drag modifiers compared in Figma's web app (2026-11-08): Shift locks a move to the dominant axis, Alt copies, Shift keeps a resize's ratio, Alt keeps its centre, all read afresh on every move, and FigCraft matches (Ctrl/Cmd not measurable); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: From 39e3496fefd1336e5a63632d8c8bc559a3fe2bb1 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 04:40:16 -0500 Subject: [PATCH 187/239] M5: a locked layer in Select layer says so to assistive technology (#1560) The padlock in a Select layer row is only paint, so a screen reader could not tell a locked layer from the rest. A locked row now gets the description "locked" (the same string the Layers panel adds), joined with any description the row already has. New a11y::describe sets a description on an existing node without touching its label or role. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/ui-egui/src/a11y.rs | 12 ++++++++++++ crates/ui-egui/src/context_menu_tests.rs | 22 ++++++++++++++++++++++ crates/ui-egui/src/menus/tree.rs | 3 +++ 3 files changed, 37 insertions(+) diff --git a/crates/ui-egui/src/a11y.rs b/crates/ui-egui/src/a11y.rs index d0e34d6fe..d09cb5165 100644 --- a/crates/ui-egui/src/a11y.rs +++ b/crates/ui-egui/src/a11y.rs @@ -995,6 +995,18 @@ pub fn disabled(resp: &Response) { node(resp, "", |n| n.set_disabled()); } +/// `resp`'s node also says `text` (a menu row's state, e.g. "locked"), after any description +/// already set (joined with ", "). +pub fn describe(resp: &Response, text: &str) { + node(resp, "", |n| { + let d = match n.description() { + Some(old) if !old.is_empty() => format!("{old}, {text}"), + _ => text.to_string(), + }; + n.set_description(d); + }); +} + /// What a layer row says besides its name. pub struct RowInfo<'a> { /// The layer's type ("Frame", "Text"). diff --git a/crates/ui-egui/src/context_menu_tests.rs b/crates/ui-egui/src/context_menu_tests.rs index 6ff9ebed9..ab480e225 100644 --- a/crates/ui-egui/src/context_menu_tests.rs +++ b/crates/ui-egui/src/context_menu_tests.rs @@ -189,6 +189,28 @@ fn select_layer_marks_locked_layers_with_a_padlock_and_picks_them() { let _ = lower; } +/// The padlock is only paint: the locked row says "locked" to assistive technology too. +#[test] +fn select_layer_locked_row_is_described_as_locked() { + let (mut u, _, _) = overlap_ui(); + let at = u.app.to_screen(150.0, 150.0); + crate::canvas::open_context_menu(&mut u.app, at, false); + u.app.session.set_selection(vec![]); + crate::menus::open_select_layer(&u.ctx, true); + u.ctx.enable_accesskit(); + u.frame(vec![]); + let nodes: Vec = + u.frame_output(vec![]).platform_output.accesskit_update.expect("an AccessKit update").nodes.into_iter().map(|(_, n)| n).collect(); + let row = |name: &str| { + nodes + .iter() + .find(|n| n.role() == egui::accesskit::Role::MenuItem && n.label() == Some(name)) + .unwrap_or_else(|| panic!("no menu row {name:?}")) + }; + assert!(row("Upper").description().is_some_and(|d| d.contains("locked")), "the locked row says locked"); + assert!(!row("Lower").description().is_some_and(|d| d.contains("locked")), "the other row doesn't"); +} + /// Measured on a single locked layer only (Figma's web app, 2026-11-10): the least certain rule. #[test] fn select_layer_needs_more_than_one_layer_under_the_pointer() { diff --git a/crates/ui-egui/src/menus/tree.rs b/crates/ui-egui/src/menus/tree.rs index b48a8c9de..7443ffc57 100644 --- a/crates/ui-egui/src/menus/tree.rs +++ b/crates/ui-egui/src/menus/tree.rs @@ -408,6 +408,9 @@ pub(super) fn indented_item(ui: &mut Ui, label: &str, shortcut: &str, enabled: b if !enabled { a11y::disabled(&resp); } + if locked { + a11y::describe(&resp, i18n::tr("locked")); + } // The keyboard's item is highlighted like the hovered one. a11y::own_focus(&resp); let hov = plain_row_hover(ui, &resp) && enabled; From bb480bdfad9a8ad5d6fc01959e14267a8ac9113b Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 05:25:35 -0500 Subject: [PATCH 188/239] M6: .fig import: a numbered list keeps its start only where it starts counting (#2273) Figma writes a list's start on every line of the list (measured in Figma's web app, 2026-11-12, from a saved .fig: a list started at 5 has listStartOffset 4 on all its lines, and the item split off by Backspace is written with 0). The import kept every line's value, so after a split the items after it restarted at the old start instead of 1. The import now keeps a start only on the item where a numbered list starts counting, and gives every item that goes on counting 0, for .fig and REST listStartOffsets alike. The rule is one function in the document model, list_item_starts_counting, which the layout's list numbering now uses too. The export is unchanged and its re-import now equals what went in. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 queued; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/doc/src/text.rs | 43 ++++++++++++++++++++++++ crates/engine/src/text_tail_tests.rs | 25 ++++++++++++++ crates/format/src/fig/text_list_tests.rs | 22 ++++++++++-- crates/format/src/rest/tests.rs | 12 +++++++ crates/format/src/rest/text.rs | 3 ++ crates/text/src/layout.rs | 18 +++++----- docs/file-format-parity.md | 5 +-- 7 files changed, 116 insertions(+), 12 deletions(-) diff --git a/crates/doc/src/text.rs b/crates/doc/src/text.rs index dafbfb1f3..240fe797b 100644 --- a/crates/doc/src/text.rs +++ b/crates/doc/src/text.rs @@ -277,6 +277,31 @@ pub enum TextDirection { pub const MAX_LIST_INDENT: u8 = 8; /// One paragraph's list settings and base direction. +/// For each paragraph, whether it is an item where a list starts counting. Numbers count the items +/// of one list at one level and restart after a plain paragraph, a shallower item or the other +/// kind of list; the first item of such a run starts counting (and takes its own start number). +/// The layout numbers by this rule. +pub fn list_item_starts_counting(lists: &[ParaList]) -> Vec { + let mut run = [ListStyle::None; MAX_LIST_INDENT as usize + 1]; + lists + .iter() + .map(|pl| { + if pl.list == ListStyle::None { + run.fill(ListStyle::None); + return false; + } + let d = usize::from(pl.indent).min(run.len() - 1); + for c in run.iter_mut().skip(d + 1) { + *c = ListStyle::None; + } + let Some(c) = run.get_mut(d) else { return false }; + let starts = *c != pl.list; + *c = pl.list; + starts + }) + .collect() +} + #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Default)] #[serde(default)] pub struct ParaList { @@ -937,6 +962,24 @@ impl TextData { self.fold_paragraph_lists(); } + /// Keep a start number only on the item where a numbered list starts counting, and give every + /// item that goes on counting 0 (the rule the layout numbers by, [`list_item_starts_counting`]). + /// An imported file may carry the list's start on every line; once the list is split, the + /// items after the split must restart at 1, not at the old start. + pub fn keep_list_starts_where_counting_starts(&mut self) { + if self.paragraphs.iter().all(|p| p.start_offset == 0) { + return; + } + self.fill_paragraphs(); + let starts = list_item_starts_counting(&(0..self.paragraph_count()).map(|i| self.para_list(i)).collect::>()); + for (pl, starts) in self.paragraphs.iter_mut().zip(starts) { + if !starts { + pl.start_offset = 0; + } + } + self.fold_paragraph_lists(); + } + /// One style for all paragraphs with no nesting or start folds back into `list`. fn fold_paragraph_lists(&mut self) { if let Some(first) = self.paragraphs.first().copied() diff --git a/crates/engine/src/text_tail_tests.rs b/crates/engine/src/text_tail_tests.rs index 1498118a1..6a58023f2 100644 --- a/crates/engine/src/text_tail_tests.rs +++ b/crates/engine/src/text_tail_tests.rs @@ -482,3 +482,28 @@ fn a_many_line_paste_clears_every_created_start() { assert_eq!(d.para_list(0).start_offset, 4, "the first item keeps its start"); assert!((1..d.paragraph_count()).all(|p| d.para_list(p).start_offset == 0 && d.para_list(p).list == N)); } + +#[test] +fn an_imported_list_split_in_the_middle_restarts_at_one() { + // #2273: a list started at 5 reaches us with 4 on every line; splitting off "b" must leave "c" + // reading 1., not 5. + let file = json!({"name": "File", "document": {"id": "0:0", "type": "DOCUMENT", "children": [{"id": "0:1", "name": "Page", "type": "CANVAS", "children": [ + {"id": "1:2", "name": "List", "type": "TEXT", "relativeTransform": [[1, 0, 0], [0, 1, 0]], "size": {"x": 100, "y": 60}, "characters": "a\nb\nc", + "style": {"fontFamily": "Inter", "fontSize": 12}, + "lineTypes": ["ORDERED", "ORDERED", "ORDERED"], "lineIndentations": [1, 1, 1], "listStartOffsets": [4, 4, 4]}]}]}}); + let (imported, _) = figcraft_format::rest::import(&file, &figcraft_format::rest::no_images).unwrap(); + let from = imported.nodes().find_map(|n| if let figcraft_doc::NodeKind::Text(td) = &n.kind { Some(td.clone()) } else { None }).unwrap(); + assert_eq!(from.para_list(0).start_offset, 4); + assert_eq!((from.para_list(1).start_offset, from.para_list(2).start_offset), (0, 0), "the items that go on counting carry no start"); + let mut s = Session::new(); + let t = text(&mut s, "x"); + if let figcraft_doc::NodeKind::Text(td) = &mut s.doc_mut().unwrap().get_mut(t).unwrap().kind { + td.characters = from.characters.clone(); + td.paragraphs = (0..from.paragraph_count()).map(|i| from.para_list(i)).collect(); + } + begin(&mut s, t, Some(2), false).unwrap(); + key(&mut s, "Backspace", false, false, false).unwrap(); + let d = data(&s, t); + assert_eq!(lists(&s, t).iter().map(|l| l.0).collect::>(), vec![N, P, N]); + assert_eq!((d.para_list(0).start_offset, d.para_list(2).start_offset), (4, 0), "c reads 1."); +} diff --git a/crates/format/src/fig/text_list_tests.rs b/crates/format/src/fig/text_list_tests.rs index a2d6702bc..ef0439694 100644 --- a/crates/format/src/fig/text_list_tests.rs +++ b/crates/format/src/fig/text_list_tests.rs @@ -64,7 +64,7 @@ fn numbered_lists_keep_their_start() { assert_eq!(starts(&doc, "From 1"), [(N, 0)]); assert_eq!(starts(&doc, "From 2"), [(N, 1)], "shows 2."); assert_eq!(starts(&doc, "First only"), [(N, 3), (N, 0), (N, 0)]); - assert_eq!(starts(&doc, "Every line"), [(N, 3), (N, 3), (N, 3)]); + assert_eq!(starts(&doc, "Every line"), [(N, 3), (N, 0), (N, 0)], "Figma writes the start on every line; only the first counts"); assert_eq!(starts(&doc, "Mixed"), [(P, 0), (N, 4), (B, 0)], "bullets have no number, so no start"); assert_eq!(starts(&doc, "Junk"), [(N, 0)], "a negative offset counts from 1"); } @@ -89,5 +89,23 @@ fn the_export_writes_where_a_list_starts() { // line or per list counts the same); bullets and plain lines carry none. assert_eq!(offsets, [1.0, 1.0, 0.0, 5.0, 0.0]); let (back, _) = import(&bytes, "x").unwrap(); - assert_eq!(starts(&back, "List"), [(N, 1), (N, 1), (P, 0), (N, 5), (B, 0)]); + assert_eq!(starts(&back, "List"), [(N, 1), (N, 0), (P, 0), (N, 5), (B, 0)], "reads back as it went in"); +} + +#[test] +fn a_start_on_every_line_counts_only_where_the_list_starts() { + use ListStyle::{None as P, Numbered as N}; + let nodes = vec![ + node(0, None, "DOCUMENT", "Document", vec![]), + node(1, Some((0, "!")), "CANVAS", "Page", vec![]), + text_node(2, "Three", "a\nb\nc", vec![line("ORDERED_LIST", 4, true), line("ORDERED_LIST", 4, false), line("ORDERED_LIST", 4, false)]), + text_node(3, "Split", "a\nb\nc", vec![line("ORDERED_LIST", 4, true), line("PLAIN", 4, false), line("ORDERED_LIST", 0, true)]), + text_node(4, "Two lists", "a\nb\nc", vec![line("ORDERED_LIST", 4, true), line("PLAIN", 4, false), line("ORDERED_LIST", 6, true)]), + ]; + let sc = Schema::parse(LIST_SCHEMA).unwrap(); + let (doc, warnings) = import(&canvas(&sc, &o(vec![("nodeChanges", arr(nodes))])), "x").unwrap(); + assert!(warnings.is_empty(), "{warnings:?}"); + assert_eq!(starts(&doc, "Three"), [(N, 4), (N, 0), (N, 0)]); + assert_eq!(starts(&doc, "Split"), [(N, 4), (P, 0), (N, 0)]); + assert_eq!(starts(&doc, "Two lists"), [(N, 4), (P, 0), (N, 6)], "a second list keeps its own start"); } diff --git a/crates/format/src/rest/tests.rs b/crates/format/src/rest/tests.rs index 6dc710979..86e58e6f7 100644 --- a/crates/format/src/rest/tests.rs +++ b/crates/format/src/rest/tests.rs @@ -801,3 +801,15 @@ fn an_arc_without_an_end_is_whole_wherever_it_starts() { assert_eq!(sweep, std::f64::consts::TAU, "start {start}"); } } + +#[test] +fn a_start_on_every_line_counts_only_where_the_list_starts() { + let (doc, _) = one(json!([ + {"id": "t1", "name": "Every", "type": "TEXT", "relativeTransform": at(0.0, 0.0), "size": {"x": 10, "y": 10}, "characters": "a\nb\nc", + "style": {"fontFamily": "Inter", "fontSize": 12}, + "lineTypes": ["ORDERED", "ORDERED", "ORDERED"], "lineIndentations": [1, 1, 1], "listStartOffsets": [4, 4, 4]} + ])); + let figcraft_doc::NodeKind::Text(t) = &named(&doc, "Every").kind else { panic!("not text") }; + let offsets: Vec = (0..t.paragraph_count()).map(|p| t.para_list(p).start_offset).collect(); + assert_eq!(offsets, [4, 0, 0]); +} diff --git a/crates/format/src/rest/text.rs b/crates/format/src/rest/text.rs index f53eb0684..971e2fb8f 100644 --- a/crates/format/src/rest/text.rs +++ b/crates/format/src/rest/text.rs @@ -283,6 +283,9 @@ fn lists(v: &Value, td: &mut TextData) { .collect(); // Clamp the levels and fold one style for all back into the layer's list style. td.set_para_lists(0, td.char_count(), |_| {}); + // Only the item where a numbered list starts counting keeps its start; Figma writes the start on + // every line of the list, and a list split later must restart at 1. + td.keep_list_starts_where_counting_starts(); } /// The decoration's style, thickness, offset, skip ink and colour (`{value, unit}` lengths with diff --git a/crates/text/src/layout.rs b/crates/text/src/layout.rs index a003deb42..ebe35c722 100644 --- a/crates/text/src/layout.rs +++ b/crates/text/src/layout.rs @@ -1469,25 +1469,27 @@ pub(crate) fn list_markers(lists: &[ParaList]) -> Vec { // "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]; + let starts = figcraft_doc::list_item_starts_counting(lists); + let mut count = [0usize; figcraft_doc::MAX_LIST_INDENT as usize + 1]; lists .iter() - .map(|pl| { + .zip(starts) + .map(|(pl, starts)| { if pl.list == ListStyle::None { - count.fill((ListStyle::None, 0)); + count.fill(0); return String::new(); } let d = usize::from(pl.indent).min(count.len() - 1); for c in count.iter_mut().skip(d + 1) { - *c = (ListStyle::None, 0); + *c = 0; } let Some(c) = count.get_mut(d) else { return String::new() }; let first = usize::try_from(pl.start_offset).unwrap_or(usize::MAX).saturating_add(1); - *c = if c.0 == pl.list { (pl.list, c.1.saturating_add(1)) } else { (pl.list, first) }; + *c = if starts { first } else { c.saturating_add(1) }; match (pl.list, d % 3) { - (ListStyle::Numbered, 1) => format!("{}.", alpha(c.1)), - (ListStyle::Numbered, 2) => format!("{}.", roman(c.1)), - (ListStyle::Numbered, _) => format!("{}.", c.1), + (ListStyle::Numbered, 1) => format!("{}.", alpha(*c)), + (ListStyle::Numbered, 2) => format!("{}.", roman(*c)), + (ListStyle::Numbered, _) => format!("{}.", *c), _ => BULLET.to_string(), } }) diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 56de5f480..4d2f01948 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-11-10 · **Change:** minor (`.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (`.fig` import: a numbered list keeps its start only where it starts counting (#2273); `.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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 (with their corner radius and smoothing, #2222), 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; an instance scaled with the Scale tool, which stores `symbolData.uniformScaleFactor`, draws its layers at the main's lengths times that factor, composed through nested instances: sizes and places, corner radii, stroke weights and dashes, effect radii, spreads and offsets, auto layout gaps and paddings, grid gaps, min and max sizes, layout grids, font sizes, pixel line heights and letter spacings, paragraph spacing and indent, except where an override or derived row gives the value, which is already at the instance's scale; per-point vector corner radii also take their vector-data row's factor; the vector outline paths a layer carries (a network's points follow the layer's size), fixed grid tracks, image tile scales and glass effects are not scaled by the factor, #2091), 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); an elbowed one saved with its path (`connectorControlPoints`: a point and an axis per run between the first and the last) keeps that path when it leaves and arrives by the ends' sides (#1910), and a curved one's saved `connectorBezierControlPoints` are not read; 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 | +| `.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 (with their corner radius and smoothing, #2222), 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; an instance scaled with the Scale tool, which stores `symbolData.uniformScaleFactor`, draws its layers at the main's lengths times that factor, composed through nested instances: sizes and places, corner radii, stroke weights and dashes, effect radii, spreads and offsets, auto layout gaps and paddings, grid gaps, min and max sizes, layout grids, font sizes, pixel line heights and letter spacings, paragraph spacing and indent, except where an override or derived row gives the value, which is already at the instance's scale; per-point vector corner radii also take their vector-data row's factor; the vector outline paths a layer carries (a network's points follow the layer's size), fixed grid tracks, image tile scales and glass effects are not scaled by the factor, #2091), 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 (Figma writes a list's start on every line; import keeps it only on the item where the list starts counting, so a list split later restarts at 1, #2273), 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); an elbowed one saved with its path (`connectorControlPoints`: a point and an axis per run between the first and the last) keeps that path when it leaves and arrives by the ends' sides (#1910), and a curved one's saved `connectorBezierControlPoints` are not read; 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 stickies as native board stickies (their colour, text and author kept, size as saved, #1808) and generated 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 (an elbowed connector keeps the path it was saved with, #1910), 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 | — | @@ -196,6 +196,7 @@ scales and empty-style clears; they have not been checked in other software. | Date | Change | Summary | |---|---|---| +| 2026-11-12 | patch | M6, #2273: `.fig` import: a numbered list keeps its start only on the item where it starts counting. Figma writes the start on every line of the list (measured in Figma's web app, 2026-11-12, from a saved .fig: a list started at 5 has `listStartOffset` 4 on all its lines, and the item split off by Backspace is written with 0), so reading every line's value restarted the items after a split at the old start. The export is unchanged and a re-import now equals what went in; REST `listStartOffsets` read the same way | | 2026-11-10 | minor | M4, #2222: a boolean group's corner radius and smoothing are read and written by the `.fig` importer and exporter, and by the REST importer | | 2026-11-07 | patch | Fonts, #2092: a font loaded with `text.loadFont` is the counterpart of a font uploaded to the organization, which Figma's help center ("Manage conflicting fonts") ranks first, ahead of installed fonts and the web fonts. FigCraft chose the first face added for a family and style, so the built-in Inter 4.x kept Regular, SemiBold and Bold after Inter 3.19 was loaded and only Medium refitted. A loaded face now wins over the other faces of its family and style, the latest load over earlier ones; style matching and fallbacks are unchanged, and `refitted` lists the text whose size changes. Installed versus built-in order is not changed here. Test: `fontdb::tests::a_loaded_face_wins_over_the_built_in_one_of_its_family_and_style`. Numbers unchanged. | | 2026-11-08 | minor | M6, #2097 follow-up: per-point vector corner radii take the scale of the row supplying `vectorData`, including nested instance rows; override and derived rows are not scaled twice. Network caching distinguishes the instance scale even when resizing gives two vectors the same final box. Synthetic tests cover missing/unit factors, half/double scale, derived size alone, overridden and derived vector data, nested scale and equal-size cache separation. Layer-radius fallback remains the separate #2115 change. Numbers unchanged. | From 7cb5af017d566a232f8018149d77e3277f452b74 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 05:46:11 -0500 Subject: [PATCH 189/239] M9: a .jam shape past the size cap draws its outline at the cap (#1808) The REST reader caps every size at 1,000,000; the native outline was built from the uncapped size, so it reached past its frame. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and fixed --- crates/format/src/fig/board_import_tests.rs | 15 +++++++++++++++ crates/format/src/fig/map/board.rs | 3 +++ crates/format/src/rest/props.rs | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/crates/format/src/fig/board_import_tests.rs b/crates/format/src/fig/board_import_tests.rs index efbabde05..fb4d4ba30 100644 --- a/crates/format/src/fig/board_import_tests.rs +++ b/crates/format/src/fig/board_import_tests.rs @@ -584,6 +584,21 @@ fn a_jam_diamond_is_a_native_shape_drawn_by_figcraft() { assert_eq!(label.align_h, figcraft_doc::TextAlignH::Center); } +/// A shape past the importer's size cap is drawn at the capped size, so its outline stays inside +/// its frame. +#[test] +fn a_jam_shape_past_the_size_cap_draws_its_outline_at_the_cap() { + let mut layer = shape_node("DIAMOND"); + set(&mut layer, "size", xy(2_000_000.0, 2_000_000.0)); + let (doc, warnings) = jam(layer); + let frame = named(&doc, "Board object"); + assert_eq!(frame.board, Some(figcraft_doc::BoardItem::Shape { shape: figcraft_doc::BoardShape::Diamond }), "{warnings:?}"); + assert_eq!((frame.width, frame.height), (1e6, 1e6)); + let outline = doc.node(frame.children[0]).unwrap(); + let NodeKind::Vector { network } = &outline.kind else { panic!("{:?}", outline.kind) }; + assert_eq!(*network, figcraft_doc::VectorNetwork::from_path(&figcraft_doc::BoardShape::Diamond.path(1e6, 1e6))); +} + /// 23 of FigJam's 30 shape kinds have a FigCraft outline; the other 7 stay frames and say which. #[test] fn every_figjam_shape_kind_maps_or_stays_a_frame() { diff --git a/crates/format/src/fig/map/board.rs b/crates/format/src/fig/map/board.rs index 7ea2de801..723c490bd 100644 --- a/crates/format/src/fig/map/board.rs +++ b/crates/format/src/fig/map/board.rs @@ -135,6 +135,9 @@ impl<'a> Mapper<'a> { if !(w.is_finite() && h.is_finite() && w > 0.0 && h > 0.0) { return None; } + // The REST reader caps every size; the outline is drawn at the capped size too, so it + // stays inside its frame. + let (w, h) = (w.min(crate::rest::props::MAX_SIZE), h.min(crate::rest::props::MAX_SIZE)); // Everything is valid: build the outline from the record's paints, then the frame. let mut outline = Obj::new(); outline.insert("id".into(), json!(format!("{rest_id};generated0"))); diff --git a/crates/format/src/rest/props.rs b/crates/format/src/rest/props.rs index f5be3d279..e68af9d88 100644 --- a/crates/format/src/rest/props.rs +++ b/crates/format/src/rest/props.rs @@ -13,7 +13,7 @@ use serde_json::Value; use super::Ctx; /// Largest width/height/stroke/radius/spacing value taken from the file. -pub(super) const MAX_SIZE: f64 = 1e6; +pub(crate) const MAX_SIZE: f64 = 1e6; /// Largest coordinate taken from the file. pub(super) const MAX_COORD: f64 = 1e7; /// Most entries read from any one list (paints, effects, dashes, grids…). From 4e9b414cc786ef245198c2f065086895eca9a5cd Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 05:56:47 -0500 Subject: [PATCH 190/239] M6: tests for where a list starts counting, through the issue's own steps (#2273) The engine test now follows the issue: a list typed at 5, saved as .fig and opened, split by Backspace at the start of "b". The REST fixture is a top-level list, the junk sweep reaches the new loop through a listed text layer, and the document crate tests the new rule for nested, bullet, plain and over-deep levels. ParaList gets its doc comment back, and the revision row names the item written with 0. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 queued; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/doc/src/text.rs | 39 ++++++++++++++++++++++++++-- crates/engine/src/text_tail_tests.rs | 35 +++++++++++++------------ crates/format/src/rest/tests.rs | 11 ++++++-- docs/file-format-parity.md | 2 +- 4 files changed, 65 insertions(+), 22 deletions(-) diff --git a/crates/doc/src/text.rs b/crates/doc/src/text.rs index 240fe797b..2ce80a8cf 100644 --- a/crates/doc/src/text.rs +++ b/crates/doc/src/text.rs @@ -276,7 +276,6 @@ pub enum TextDirection { /// Deepest list nesting (levels 0..=MAX_LIST_INDENT). pub const MAX_LIST_INDENT: u8 = 8; -/// One paragraph's list settings and base direction. /// For each paragraph, whether it is an item where a list starts counting. Numbers count the items /// of one list at one level and restart after a plain paragraph, a shallower item or the other /// kind of list; the first item of such a run starts counting (and takes its own start number). @@ -302,6 +301,7 @@ pub fn list_item_starts_counting(lists: &[ParaList]) -> Vec { .collect() } +/// One paragraph's list settings and base direction. #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Default)] #[serde(default)] pub struct ParaList { @@ -971,7 +971,7 @@ impl TextData { return; } self.fill_paragraphs(); - let starts = list_item_starts_counting(&(0..self.paragraph_count()).map(|i| self.para_list(i)).collect::>()); + let starts = list_item_starts_counting(&self.paragraphs); for (pl, starts) in self.paragraphs.iter_mut().zip(starts) { if !starts { pl.start_offset = 0; @@ -1294,6 +1294,41 @@ mod case_tests { t.clear_list_starts(0, 0); assert_eq!(t.para_list(0).start_offset, 0); } + + #[test] + fn list_starts_stay_only_where_counting_starts() { + use ListStyle::{Bulleted as B, None as P, Numbered as N}; + let pl = |list, indent, start_offset| ParaList { list, indent, start_offset, ..ParaList::default() }; + // (paragraphs, the starts kept, derivation) + let cases: Vec<(Vec, Vec, &str)> = vec![ + (vec![pl(N, 0, 4), pl(N, 0, 4), pl(N, 0, 4)], vec![4, 0, 0], "items that go on counting lose theirs"), + (vec![pl(N, 0, 4), pl(P, 0, 0), pl(N, 0, 6)], vec![4, 0, 6], "a list after a plain paragraph keeps its own"), + (vec![pl(N, 0, 4), pl(B, 0, 0), pl(N, 0, 6)], vec![4, 0, 6], "and one after a bullet item"), + ( + vec![pl(N, 0, 4), pl(N, 1, 2), pl(N, 1, 2), pl(N, 0, 4)], + vec![4, 2, 0, 0], + "a nested level keeps its first item's; the outer count goes on", + ), + (vec![pl(N, 0, 1), pl(N, 1, 2), pl(N, 0, 9), pl(N, 1, 3)], vec![1, 2, 0, 3], "a shallower item starts the deeper count again"), + (vec![pl(N, 255, 4), pl(N, 9, 4), pl(N, 8, 4)], vec![4, 0, 0], "levels past the deepest count as the deepest"), + ]; + for (paragraphs, want, why) in cases { + let characters = vec!["x"; paragraphs.len()].join("\n"); + let mut t = TextData { characters, paragraphs, ..TextData::new("") }; + t.keep_list_starts_where_counting_starts(); + let got: Vec = (0..t.paragraph_count()).map(|p| t.para_list(p).start_offset).collect(); + assert_eq!(got, want, "{why}"); + } + // No start anywhere: nothing is spelled out. + let mut t = TextData { list: N, ..TextData::new("a\nb") }; + t.keep_list_starts_where_counting_starts(); + assert!(t.paragraphs.is_empty()); + // More entries than paragraphs, and an empty last paragraph. + let mut t = TextData { paragraphs: vec![pl(N, 0, 4); 5], ..TextData::new("a\n") }; + t.keep_list_starts_where_counting_starts(); + assert_eq!((t.para_list(0).start_offset, t.para_list(1).start_offset), (4, 0)); + assert!(list_item_starts_counting(&[]).is_empty()); + } } #[cfg(test)] diff --git a/crates/engine/src/text_tail_tests.rs b/crates/engine/src/text_tail_tests.rs index 6a58023f2..af854a6ea 100644 --- a/crates/engine/src/text_tail_tests.rs +++ b/crates/engine/src/text_tail_tests.rs @@ -484,26 +484,27 @@ fn a_many_line_paste_clears_every_created_start() { } #[test] -fn an_imported_list_split_in_the_middle_restarts_at_one() { - // #2273: a list started at 5 reaches us with 4 on every line; splitting off "b" must leave "c" - // reading 1., not 5. - let file = json!({"name": "File", "document": {"id": "0:0", "type": "DOCUMENT", "children": [{"id": "0:1", "name": "Page", "type": "CANVAS", "children": [ - {"id": "1:2", "name": "List", "type": "TEXT", "relativeTransform": [[1, 0, 0], [0, 1, 0]], "size": {"x": 100, "y": 60}, "characters": "a\nb\nc", - "style": {"fontFamily": "Inter", "fontSize": 12}, - "lineTypes": ["ORDERED", "ORDERED", "ORDERED"], "lineIndentations": [1, 1, 1], "listStartOffsets": [4, 4, 4]}]}]}}); - let (imported, _) = figcraft_format::rest::import(&file, &figcraft_format::rest::no_images).unwrap(); - let from = imported.nodes().find_map(|n| if let figcraft_doc::NodeKind::Text(td) = &n.kind { Some(td.clone()) } else { None }).unwrap(); - assert_eq!(from.para_list(0).start_offset, 4); - assert_eq!((from.para_list(1).start_offset, from.para_list(2).start_offset), (0, 0), "the items that go on counting carry no start"); +fn a_list_back_from_a_fig_split_in_the_middle_restarts_at_one() { + // #2273's steps: type "5. a", Enter, "b", Enter, "c"; save a copy as .fig and open it; + // Backspace at the start of "b". The export writes the start on every line, as Figma does, + // and "c" must then read 1., not 5. let mut s = Session::new(); - let t = text(&mut s, "x"); - if let figcraft_doc::NodeKind::Text(td) = &mut s.doc_mut().unwrap().get_mut(t).unwrap().kind { - td.characters = from.characters.clone(); - td.paragraphs = (0..from.paragraph_count()).map(|i| from.para_list(i)).collect(); - } + three_typed_items(&mut s, "5. a"); + crate::textedit::end(&mut s).unwrap(); + let (bytes, _) = figcraft_format::fig::export(s.doc().unwrap(), None).unwrap(); + let (back, _) = figcraft_format::fig::import(&bytes, "x").unwrap(); + let t = back.nodes().find(|n| n.kind.text().is_some()).map(|n| n.id).unwrap(); + let mut s = Session::with_document(back); + let d = data(&s, t); + assert_eq!(lists(&s, t), [(N, 0); 3]); + assert_eq!( + (d.para_list(0).start_offset, d.para_list(1).start_offset, d.para_list(2).start_offset), + (4, 0, 0), + "only the first item carries the start" + ); begin(&mut s, t, Some(2), false).unwrap(); key(&mut s, "Backspace", false, false, false).unwrap(); let d = data(&s, t); - assert_eq!(lists(&s, t).iter().map(|l| l.0).collect::>(), vec![N, P, N]); + assert_eq!(lists(&s, t), [(N, 0), (P, 0), (N, 0)]); assert_eq!((d.para_list(0).start_offset, d.para_list(2).start_offset), (4, 0), "c reads 1."); } diff --git a/crates/format/src/rest/tests.rs b/crates/format/src/rest/tests.rs index 86e58e6f7..6630ee406 100644 --- a/crates/format/src/rest/tests.rs +++ b/crates/format/src/rest/tests.rs @@ -675,7 +675,11 @@ fn kitchen_sink() -> Value { ]}, {"id": "k9", "name": "Sec", "type": "SECTION", "sectionContentsHidden": true, "relativeTransform": at(0.0, 0.0), "size": {"x": 50, "y": 50}, "children": [{"id": "k10", "name": "Use", "type": "INSTANCE", "componentId": "3:1", "relativeTransform": at(0.0, 0.0), "size": {"x": 24, "y": 24}, - "componentProperties": {"Show#4:1": {"type": "BOOLEAN", "value": false}}}]} + "componentProperties": {"Show#4:1": {"type": "BOOLEAN", "value": false}}}]}, + {"id": "k11", "name": "Listed", "type": "TEXT", "relativeTransform": at(0.0, 0.0), "size": {"x": 10, "y": 10}, "characters": "a\nb\nc\nd\ne\n", + "style": {"fontFamily": "Inter", "fontSize": 12}, + "lineTypes": ["ORDERED", "ORDERED", "ORDERED", "UNORDERED", "ORDERED", "ORDERED"], "lineIndentations": [0, 0, 1, 0, 300, 0], + "listStartOffsets": [4, 4, 3, 2, 7, 9]} ]); if let (Some(kids), Some(more)) = (v.pointer_mut("/document/children/0/children").and_then(Value::as_array_mut), extra.as_array()) { kids.extend(more.iter().cloned()); @@ -692,6 +696,9 @@ fn kitchen_sink_imports_cleanly() { assert!(matches!(named(&doc, "Sec").kind, NodeKind::Section { contents_hidden: true })); assert!(matches!(&named(&doc, "Use").kind, NodeKind::Instance { props, .. } if props.get("Show") == Some(&json!(false)))); assert!(matches!(named(&doc, "Txt").kind, NodeKind::Text(ref t) if t.list == ListStyle::Numbered && t.runs.len() == 3)); + let NodeKind::Text(l) = &named(&doc, "Listed").kind else { panic!("not text") }; + let got: Vec<(u8, u32)> = (0..l.paragraph_count()).map(|p| (l.para_list(p).indent, l.para_list(p).start_offset)).collect(); + assert_eq!(got, [(0, 4), (0, 0), (1, 3), (0, 0), (8, 7), (0, 9)], "starts stay where a count starts; the level is capped"); assert!(warnings.iter().all(|w| !w.contains("panick")), "{warnings:?}"); } @@ -807,7 +814,7 @@ fn a_start_on_every_line_counts_only_where_the_list_starts() { let (doc, _) = one(json!([ {"id": "t1", "name": "Every", "type": "TEXT", "relativeTransform": at(0.0, 0.0), "size": {"x": 10, "y": 10}, "characters": "a\nb\nc", "style": {"fontFamily": "Inter", "fontSize": 12}, - "lineTypes": ["ORDERED", "ORDERED", "ORDERED"], "lineIndentations": [1, 1, 1], "listStartOffsets": [4, 4, 4]} + "lineTypes": ["ORDERED", "ORDERED", "ORDERED"], "listStartOffsets": [4, 4, 4]} ])); let figcraft_doc::NodeKind::Text(t) = &named(&doc, "Every").kind else { panic!("not text") }; let offsets: Vec = (0..t.paragraph_count()).map(|p| t.para_list(p).start_offset).collect(); diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 4d2f01948..ef3f5cbbd 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -196,7 +196,7 @@ scales and empty-style clears; they have not been checked in other software. | Date | Change | Summary | |---|---|---| -| 2026-11-12 | patch | M6, #2273: `.fig` import: a numbered list keeps its start only on the item where it starts counting. Figma writes the start on every line of the list (measured in Figma's web app, 2026-11-12, from a saved .fig: a list started at 5 has `listStartOffset` 4 on all its lines, and the item split off by Backspace is written with 0), so reading every line's value restarted the items after a split at the old start. The export is unchanged and a re-import now equals what went in; REST `listStartOffsets` read the same way | +| 2026-11-12 | patch | M6, #2273: `.fig` import: a numbered list keeps its start only on the item where it starts counting. Figma writes the start on every line of the list (measured in Figma's web app, 2026-11-12, from a saved .fig: a list started at 5 has `listStartOffset` 4 on all its lines, and after Backspace takes a middle item out of the list, the item after it starts a new list and is written with 0), so reading every line's value restarted the items after a split at the old start. The export is unchanged and a re-import now equals what went in; REST `listStartOffsets` read the same way | | 2026-11-10 | minor | M4, #2222: a boolean group's corner radius and smoothing are read and written by the `.fig` importer and exporter, and by the REST importer | | 2026-11-07 | patch | Fonts, #2092: a font loaded with `text.loadFont` is the counterpart of a font uploaded to the organization, which Figma's help center ("Manage conflicting fonts") ranks first, ahead of installed fonts and the web fonts. FigCraft chose the first face added for a family and style, so the built-in Inter 4.x kept Regular, SemiBold and Bold after Inter 3.19 was loaded and only Medium refitted. A loaded face now wins over the other faces of its family and style, the latest load over earlier ones; style matching and fallbacks are unchanged, and `refitted` lists the text whose size changes. Installed versus built-in order is not changed here. Test: `fontdb::tests::a_loaded_face_wins_over_the_built_in_one_of_its_family_and_style`. Numbers unchanged. | | 2026-11-08 | minor | M6, #2097 follow-up: per-point vector corner radii take the scale of the row supplying `vectorData`, including nested instance rows; override and derived rows are not scaled twice. Network caching distinguishes the instance scale even when resizing gives two vectors the same final box. Synthetic tests cover missing/unit factors, half/double scale, derived size alone, overridden and derived vector data, nested scale and equal-size cache separation. Layer-radius fallback remains the separate #2115 change. Numbers unchanged. | From 76965c78caebfcfd51f2673fef142bf6e46cebfd Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 07:04:38 -0500 Subject: [PATCH 191/239] M8: Align is unavailable for a layer in an auto layout frame's flow, as in Figma Measured in Figma's web app on 2026-11-12: with one child of an auto layout frame selected, the Design panel's Align buttons are greyed out, Alt+A and Alt+S do nothing and the frame's alignment doesn't change. align_target now returns none for a single layer that takes part in its auto layout frame's flow, so can_align is false and the align commands leave the layout alone. An absolutely positioned child still aligns to its frame, and multi-layer selections are unchanged (neither measured). The panel's disabled tip says why ("A layer in an auto layout frame is placed by its frame"), through the new align_blocked_by_auto_layout. Tidy up was measured to differ from Figma and is not changed here. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 queued; Opus 5.5 briefed; Sonnet 5.5 measured and wrote at medium --- crates/engine/src/al_behaviour_tests.rs | 33 +++++++++++++++++++ crates/engine/src/cmd/arrange.rs | 15 +++++++++ crates/ui-egui/locales/en.toml | 1 + .../src/canvas/selection_cache_tests.rs | 15 +++++++++ crates/ui-egui/src/panels/right.rs | 14 ++++++-- docs/ui-parity.md | 4 ++- 6 files changed, 78 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/al_behaviour_tests.rs b/crates/engine/src/al_behaviour_tests.rs index 514a39fdc..49950de6d 100644 --- a/crates/engine/src/al_behaviour_tests.rs +++ b/crates/engine/src/al_behaviour_tests.rs @@ -336,3 +336,36 @@ fn auto_layout_keys_beside_no_auto_layout_are_refused() { set(&mut s, f, json!({"layout": null, "name": "Plain"})); assert!(s.doc().unwrap().node(f).unwrap().layout.is_none()); } + +#[test] +fn align_is_unavailable_for_a_child_in_an_auto_layout_flow() { + use crate::cmd::arrange::{align_blocked_by_auto_layout, can_align}; + let mut s = Session::new(); + let f = al_frame(&mut s, json!({"gap": 10})); + let a = rect(&mut s, f, 20.0, 20.0, "#ff0000"); + let b = rect(&mut s, f, 20.0, 20.0, "#00ff00"); + let at = |s: &Session, i: NodeId| s.doc().unwrap().world_bounds(i).unwrap(); + let (before_a, before_b) = (at(&s, a), at(&s, b)); + assert_eq!(before_b.x0, 30.0, "the layout placed the second one after the first"); + let doc = s.doc().unwrap(); + assert!(!can_align(doc, &[b]), "Align is greyed out for one child of the frame"); + assert!(align_blocked_by_auto_layout(doc, &[b]), "because its frame places it"); + for cmd in ["align.left", "align.hcenter", "align.right", "align.top", "align.vcenter", "align.bottom"] { + s.execute(cmd, &json!({"ids": [b]})).unwrap(); + assert_eq!((at(&s, a), at(&s, b)), (before_a, before_b), "{cmd} leaves the layout alone"); + } +} + +#[test] +fn an_absolute_child_of_an_auto_layout_frame_still_aligns_to_it() { + use crate::cmd::arrange::{align_blocked_by_auto_layout, can_align}; + let mut s = Session::new(); + let f = al_frame(&mut s, json!({})); + let kid = rect(&mut s, f, 20.0, 20.0, "#ff0000"); + set(&mut s, kid, json!({"absolute": true})); + let doc = s.doc().unwrap(); + assert!(can_align(doc, &[kid])); + assert!(!align_blocked_by_auto_layout(doc, &[kid])); + s.execute("align.right", &json!({"ids": [kid]})).unwrap(); + assert_eq!(s.doc().unwrap().world_bounds(kid).unwrap().x1, 200.0); +} diff --git a/crates/engine/src/cmd/arrange.rs b/crates/engine/src/cmd/arrange.rs index 88146ea95..a7b96fbb4 100644 --- a/crates/engine/src/cmd/arrange.rs +++ b/crates/engine/src/cmd/arrange.rs @@ -164,12 +164,27 @@ pub fn can_align(doc: &Document, ids: &[NodeId]) -> bool { align_target(doc, &roots(doc, ids)).is_some() } +/// Whether `ids` is one layer that its auto layout frame places: Figma greys out Align for it, +/// since the frame decides where it goes (measured in Figma's web app, 2026-11-12). +pub fn align_blocked_by_auto_layout(doc: &Document, ids: &[NodeId]) -> bool { + matches!(roots(doc, ids).as_slice(), [id] if in_auto_layout_flow(doc, *id)) +} + +/// Whether the layer sits in an auto layout frame and takes part in its flow (not absolutely positioned). +fn in_auto_layout_flow(doc: &Document, id: NodeId) -> bool { + let Some(n) = doc.node(id) else { return false }; + !n.child_layout.absolute && n.parent.and_then(|p| doc.node(p)).is_some_and(|p| p.layout.is_some()) +} + /// What `roots` align to: one layer to its parent frame, several to their combined bounds. fn align_target(doc: &Document, roots: &[NodeId]) -> Option { match roots { [] => None, [id] => { let parent = doc.node(*id)?.parent.filter(|pp| !doc.node(*pp).is_some_and(Node::is_page))?; + if in_auto_layout_flow(doc, *id) { + return None; + } Some(doc.world_bounds(parent).unwrap_or_default()) } _ => Some(doc.bounds_of(roots).unwrap_or_default()), diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index 71e6ff010..378161fa4 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -21,6 +21,7 @@ name = "English" "A collection of this file with these modes and variables: override their values per mode and add variables of its own" = "A collection of this file with these modes and variables: override their values per mode and add variables of its own" "A .figcraft file with this name already exists. Choose its full name to confirm replacement." = "A .figcraft file with this name already exists. Choose its full name to confirm replacement." "A later vote" = "A later vote" +"A layer in an auto layout frame is placed by its frame" = "A layer in an auto layout frame is placed by its frame" "A layer on its own aligns to its frame: select more layers, or one in a frame" = "A layer on its own aligns to its frame: select more layers, or one in a frame" "A responsive product page: hero, features, figures, a quote and a footer" = "A responsive product page: hero, features, figures, a quote and a footer" "A spring plays until it settles: its mass, stiffness and damping set how long" = "A spring plays until it settles: its mass, stiffness and damping set how long" diff --git a/crates/ui-egui/src/canvas/selection_cache_tests.rs b/crates/ui-egui/src/canvas/selection_cache_tests.rs index 061fe5b59..3166e3014 100644 --- a/crates/ui-egui/src/canvas/selection_cache_tests.rs +++ b/crates/ui-egui/src/canvas/selection_cache_tests.rs @@ -237,3 +237,18 @@ fn the_gesture_start_stands_in_only_while_the_selection_is_only_moved() { app.session.ds_mut().unwrap().selection.pop(); assert!(crate::selection_cache::moved(app.session.ds().unwrap()).is_none()); } + +#[test] +fn the_align_buttons_are_off_for_a_layer_in_an_auto_layout_flow() { + let mut s = Session::new(); + let f = id(s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 200, "height": 100})).unwrap()); + let kid = id(s.execute("shape.rectangle", &json!({"parent": f, "x": 0, "y": 0, "width": 20, "height": 20})).unwrap()); + s.execute("node.set", &json!({"id": f, "props": {"layout": "horizontal", "padding": 0, "gap": 0}})).unwrap(); + s.execute("select.set", &json!({"ids": [kid]})).unwrap(); + let app = FigApp::new(s, Box::new(NoServices)); + let ctx = Context::default(); + let ds = app.session.ds().unwrap(); + let pv = crate::right::position_values(&ctx, &ds.doc.clone(), &ds.selection.clone()); + assert!(!pv.can_align, "Align is greyed out"); + assert!(pv.align_blocked, "and the tip says the frame places the layer"); +} diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index 3c64f665c..eff4dc393 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -611,6 +611,8 @@ fn position(app: &mut FigApp, ui: &mut Ui, doc: &Arc, shown: &Arc, pub y: Option, pub rot: Option, @@ -641,6 +643,7 @@ pub(crate) fn position_values(ctx: &egui::Context, doc: &Arc, sel: &[N let parent = |n: &Node| n.parent.and_then(|p| doc.node(p)); crate::selection_cache::cached(ctx, "position", doc, sel, &[], || PositionValues { can_align: figcraft_engine::cmd::arrange::can_align(doc, sel), + align_blocked: figcraft_engine::cmd::arrange::align_blocked_by_auto_layout(doc, sel), x: common(doc, sel, |n| x_of(doc, n)), y: common(doc, sel, |n| y_of(doc, n)), rot: common(doc, sel, |n| rot_of(doc, n)), @@ -659,7 +662,7 @@ pub(crate) fn position_values(ctx: &egui::Context, doc: &Arc, sel: &[N fn position_fields(app: &mut FigApp, ui: &mut Ui, doc: &Arc, sel: &[NodeId]) { let pv = position_values(ui.ctx(), doc, sel); let col = widgets::col_width(ui.available_width()); - align_row(app, ui, sel, pv.can_align, col); + align_row(app, ui, sel, pv.can_align, pv.align_blocked, col); position_row(app, ui, doc, sel, &pv, col); rotation_row(app, ui, doc, sel, pv.rot, col); if pv.in_frame { @@ -668,7 +671,7 @@ fn position_fields(app: &mut FigApp, ui: &mut Ui, doc: &Arc, sel: &[No } /// Alignment, and distribution and tidy up for three or more layers. -fn align_row(app: &mut FigApp, ui: &mut Ui, sel: &[NodeId], can_align: bool, col: f32) { +fn align_row(app: &mut FigApp, ui: &mut Ui, sel: &[NodeId], can_align: bool, blocked: bool, col: f32) { let ids = sel.to_vec(); widgets::sublabels(ui, tr("Alignment"), None); row(ui, 32.0, |ui| { @@ -688,7 +691,12 @@ fn align_row(app: &mut FigApp, ui: &mut Ui, sel: &[NodeId], can_align: bool, col let v = widgets::segmented(ui, &items[3..], None, w).map(|i| i + 3); h.or(v) }); - picked.response.on_disabled_hover_text(tr("A layer on its own aligns to its frame: select more layers, or one in a frame")); + let why = if blocked { + tr("A layer in an auto layout frame is placed by its frame") + } else { + tr("A layer on its own aligns to its frame: select more layers, or one in a frame") + }; + picked.response.on_disabled_hover_text(why); if let Some(i) = picked.inner { app.run(cmds[i], json!({"ids": ids})); } diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 1911dbbcd..bc7d651ae 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-10 · **Change:** minor (the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (Align is disabled for a layer in an auto layout frame's flow, as measured in Figma's web app on 2026-11-12, with a tip saying the frame places it; single and multi-layer Align and Distribute measured to match; Tidy up not yet (M8); the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -69,6 +69,7 @@ interaction feel not yet compared. | Rotate just outside a corner; Shift in 15° steps | done | rotated handle box when layers share a rotation; Shift lands the rotation on multiples of 15° (measured in Figma: a layer at 7° or -4.27° ends at 15°), not 15° steps from where the drag began; layers with different rotations step the turn from 0 | | Flip, rotate 90° | done | | | Rotation origin (Alt+R) | done | a handle at the selection's centre to drag (snaps to the box's corners, edge middles and centre), double-click puts it back, Escape or Alt+R hides it; the corner handles, the rotation field, Rotate 90°/180° and `transform.rotate` turn about it; it follows the layers and lasts as long as the selection, not saved (the documentation doesn't say; pinned) | +| Align and Distribute (Design panel and shortcuts) | done | single and multi-layer Align and Distribute were measured in Figma's web app on 2026-11-12 and match: one layer aligns to its frame, several to their combined bounds, Distribute spaces three or more. Align is disabled for a child in an auto layout frame's flow (Alt+A and Alt+S do nothing, the frame is untouched), as measured; the panel's tip says the frame places the layer, and an absolutely positioned child still aligns to its frame (not measured, so today's behaviour is kept). Tidy up was measured to differ (Figma keeps the order and sizes and evens one gap per axis): not yet. Tests: `align_is_unavailable_for_a_child_in_an_auto_layout_flow`, `an_absolute_child_of_an_auto_layout_frame_still_aligns_to_it`, `the_align_buttons_are_off_for_a_layer_in_an_auto_layout_flow` | | Enter with a shape or frame tool chosen | done | places what a click makes (100×100, lines 100 long, sections 400×300) in the middle of the view, selected (`tool.place`); from the toolbar, Enter on the chosen tool. With nothing selected, the arrows first show a crosshair in the middle of the view and then move it by the nudge amounts (`tool.crosshair`; Shift the large one), and Enter places there; Escape or a tool change takes it away ("Use the arrow keys to activate the crosshair cursor. It will appear in the middle of the viewport indicating where the new object will be placed", Accessibility at Figma; #1839) | | Alt-drag duplicate | done | the copy snaps to the layer it came from too (edges, centres, equal spacing); Duplicate (Cmd+D) then repeats the copy's offset, also after a Duplicate whose copy was moved, as long as the copies stay selected (the documentation doesn't say; pinned from community answers) | | Drag threshold; double-click into groups and text | done | a press moves or resizes only once the pointer has travelled 3 px on screen, so a click or double-click made with an unsteady hand drags nothing; a double-click goes one level into a group and the next one edits the text under it, wherever on the text it lands, with all of it selected (a double-click in the text being edited selects the word) (`double_click_tests`); Enter on a selected text does the same (all of it selected, typing replaces it) and Escape leaves editing with the layer still selected (`text_enter_tests`) | @@ -217,6 +218,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| +| 2026-11-12 | minor | M8: Align is unavailable for the one selected layer of an auto layout frame that takes part in its flow, as in Figma (measured in Figma's web app on 2026-11-12: the Design panel's Align buttons are greyed out, Alt+A and Alt+S do nothing and the frame's alignment doesn't change). `align_target` returns none for it, so `can_align` is false and the `align.*` commands leave the layout alone; the disabled tip reads "A layer in an auto layout frame is placed by its frame" (`align_blocked_by_auto_layout`). An absolutely positioned child still aligns to its frame and multi-layer selections are unchanged (neither measured). Single and multi-layer Align and Distribute otherwise matched Figma; Tidy up differs (Figma keeps the order and sizes and evens one gap per axis) and is not yet changed. Tests: `align_is_unavailable_for_a_child_in_an_auto_layout_flow`, `an_absolute_child_of_an_auto_layout_frame_still_aligns_to_it`, `the_align_buttons_are_off_for_a_layer_in_an_auto_layout_flow` | | 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start); FigCraft draws it opaque (how Figma treats a translucent fill was not measured); gradient, image and hidden fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | | 2026-11-10 | minor | The Rotation field shows and sets the layer's rotation on the page (its own angle plus its parents' when no ancestor is flipped; with a flipped ancestor FigCraft reads the composed angle, which flips the sign of the layer's own angle, and Figma's behaviour there was not measured), in frames and groups alike, as measured in Figma's web app for rotated, unflipped parents (#2196) | | 2026-11-09 | patch | M3, #2189: the eyedropper picks the colour the canvas shows. It sampled a 1x1 render without the canvas's magnified-image pixels, so on an image magnified past 2x it blended a 1 px line with its neighbours (#3D444D picked as #343B44 beside #151B23), and the pixel it sampled began at the pointer instead of being centred on it. It now matches the canvas when zoomed in; zoomed out it still samples the full-resolution image, not the smaller copy the canvas may show. Test: `eyedropper_image_tests` | From b54df860de57f23d73346d732a794080de929cc9 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 07:10:52 -0500 Subject: [PATCH 192/239] M6: .fig export writes image adjustments (#2297) An image paint's adjustments (exposure, contrast, saturation, temperature, tint, highlights, shadows) were dropped on export with a warning, although the importer already reads them. The export now writes them as the paint's `paintFilter`: seven floats, with saturation as vibrance and the tint's sign flipped to the file's (positive towards magenta). A paint without adjustments gets no `paintFilter`. The warning is gone. The schema gains `PaintFilterMessage` and `Paint.paintFilter`. A round-trip test turns the importer's fixture around and pins the written values and field numbers. Not checked in other software. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 briefed; Sonnet 5.5 wrote at medium --- crates/format/src/fig/export.rs | 3 +- crates/format/src/fig/export/paint.rs | 17 +++++- crates/format/src/fig/image_filter_tests.rs | 65 ++++++++++++++++++++- docs/file-format-parity.md | 7 ++- 4 files changed, 83 insertions(+), 9 deletions(-) diff --git a/crates/format/src/fig/export.rs b/crates/format/src/fig/export.rs index f00de3606..e8fe84166 100644 --- a/crates/format/src/fig/export.rs +++ b/crates/format/src/fig/export.rs @@ -141,7 +141,8 @@ message StyleId GUID guid=1 message VariableID GUID guid=1 message VariableSetID GUID guid=1 message ColorStopVar Color color=1, VariableData colorVar=2, float position=3 -message Paint PaintType type=1, Color color=2, float opacity=3, bool visible=4, BlendMode blendMode=5, ColorStop[] stops=6, Matrix transform=7, Image image=8, ImageScaleMode imageScaleMode=10, float rotation=11, float scale=12, VariableData colorVar=21, ColorStopVar[] stopsVar=23 +message PaintFilterMessage float tint=1, float shadows=2, float highlights=3, float exposure=5, float temperature=7, float vibrance=8, float contrast=9 +message Paint PaintType type=1, Color color=2, float opacity=3, bool visible=4, BlendMode blendMode=5, ColorStop[] stops=6, Matrix transform=7, Image image=8, ImageScaleMode imageScaleMode=10, float rotation=11, float scale=12, PaintFilterMessage paintFilter=14, VariableData colorVar=21, ColorStopVar[] stopsVar=23 message Effect EffectType type=1, Color color=2, Vector offset=3, float radius=4, bool visible=5, BlendMode blendMode=6, float spread=7, bool showShadowBehindNode=8, BlurOpType blurOpType=19, float startRadius=21, Vector startOffset=20, Vector endOffset=28, NoiseType noiseType=26, Vector noiseSize=22, float density=25, float opacity=27, Color secondaryColor=24, bool clipToShape=23, VariableData radiusVar=9, VariableData colorVar=10, VariableData spreadVar=11, VariableData xVar=12, VariableData yVar=13, VariableData startRadiusVar=45 struct FontName string family, string style, string postscript struct Number float value, NumberUnits units diff --git a/crates/format/src/fig/export/paint.rs b/crates/format/src/fig/export/paint.rs index 2bb62ae2f..4d87871f6 100644 --- a/crates/format/src/fig/export/paint.rs +++ b/crates/format/src/fig/export/paint.rs @@ -76,8 +76,21 @@ impl<'d> Exporter<'d> { if let (ImageScaleMode::Crop, Some(c)) = (img.scale_mode, img.crop) { f.push(("transform", matrix(Affine::new(c)))); } - if img.filters != Default::default() { - self.warn("image adjustments (exposure, contrast, …) were left out"); + if !img.filters.is_identity() { + let x = &img.filters; + // The file's tint is positive towards magenta, ours towards green; `0.0 -` keeps zero positive. + f.push(( + "paintFilter", + o(vec![ + ("exposure", fl(f64::from(x.exposure))), + ("contrast", fl(f64::from(x.contrast))), + ("vibrance", fl(f64::from(x.saturation))), + ("temperature", fl(f64::from(x.temperature))), + ("tint", fl(0.0 - f64::from(x.tint))), + ("highlights", fl(f64::from(x.highlights))), + ("shadows", fl(f64::from(x.shadows))), + ]), + )); } } PaintKind::Pattern(_) => { diff --git a/crates/format/src/fig/image_filter_tests.rs b/crates/format/src/fig/image_filter_tests.rs index 3fa50a200..d1297293f 100644 --- a/crates/format/src/fig/image_filter_tests.rs +++ b/crates/format/src/fig/image_filter_tests.rs @@ -16,8 +16,8 @@ fn image_filter_schema() -> Schema { Schema::parse(&text).unwrap() } -#[test] -fn image_filters_import_from_current_container_and_skip_ambiguous_data() { +/// A file with one image rectangle per filter case (current container, legacy, both, neutral, unknown fields). +fn image_filter_fixture() -> Vec { let filter = |fields: Vec<(&'static str, Kv<'static>)>| o(fields); let image_paint = |id: u64, name: &'static str, mut extra: Vec<(&'static str, Kv<'static>)>| { let mut paint = vec![("type", e("IMAGE")), ("image", o(vec![("hash", Kv::Bytes(HASH.to_vec()))]))]; @@ -54,7 +54,12 @@ fn image_filters_import_from_current_container_and_skip_ambiguous_data() { vec![("paintFilter", filter(vec![("brightness", f(0.4)), ("detail", f(-0.2)), ("vignette", f(0.3)), ("mystery", f(0.1))]))], ), ]; - let bytes = zip_file(&canvas(&image_filter_schema(), &o(vec![("nodeChanges", arr(nodes))]))); + zip_file(&canvas(&image_filter_schema(), &o(vec![("nodeChanges", arr(nodes))]))) +} + +#[test] +fn image_filters_import_from_current_container_and_skip_ambiguous_data() { + let bytes = image_filter_fixture(); let (doc, warnings) = import(&bytes, "ImageFilters.fig").unwrap(); let get = |name: &str| { let node = doc.nodes().find(|node| node.name == name).unwrap(); @@ -102,3 +107,57 @@ fn warnings_naming_unknown_filter_fields_are_capped() { let named = warnings.iter().filter(|w| w.contains("unsupported image filter")).count(); assert!((100..=crate::rest::MAX_WARNINGS).contains(&named), "{named} of {} warnings", warnings.len()); } + +#[test] +fn image_adjustments_survive_a_fig_export() { + let (doc, _) = import(&image_filter_fixture(), "ImageFilters.fig").unwrap(); + let filters_of = |doc: &figcraft_doc::Document, name: &str| { + let node = doc.nodes().find(|node| node.name == name).unwrap(); + let figcraft_doc::color::PaintKind::Image(image) = &node.fills[0].kind else { panic!("{name} is not an image fill") }; + image.filters + }; + let (bytes, warnings) = export::export(&doc, None).unwrap(); + assert!(!warnings.iter().any(|w| w.contains("image adjustments")), "{warnings:?}"); + let (back, _) = import(&bytes, "Back.fig").unwrap(); + for name in ["Current", "Negative tint", "Neutral"] { + let (a, b) = (filters_of(&doc, name), filters_of(&back, name)); + for (x, y) in [ + (a.exposure, b.exposure), + (a.contrast, b.contrast), + (a.saturation, b.saturation), + (a.temperature, b.temperature), + (a.tint, b.tint), + (a.highlights, b.highlights), + (a.shadows, b.shadows), + ] { + assert!((x - y).abs() < 1e-6, "{name}: {a:?} came back as {b:?}"); + } + } + assert!(filters_of(&back, "Neutral").is_identity()); + assert!(!filters_of(&back, "Current").is_identity()); + + // What is written: the file's names and signs. + let archive = Archive::open(&bytes).unwrap(); + let (schema, message) = decode_canvas(&archive.canvas).unwrap(); + let msg = schema.decode_message(schema.find("Message").unwrap(), &message).unwrap(); + let fill_of = |name: &str| { + let nc = msg.get("nodeChanges").unwrap().list().iter().find(|nc| nc.get("name").and_then(Kv::str) == Some(name)).unwrap(); + nc.get("fillPaints").unwrap().list()[0].clone() + }; + let current = fill_of("Current"); + let written = |paint: &Kv, field: &str| paint.get("paintFilter").and_then(|f| f.get(field)).and_then(Kv::f64); + assert!((written(¤t, "vibrance").unwrap() + 0.4).abs() < 1e-6); + assert!((written(¤t, "tint").unwrap() - 1.0).abs() < 1e-6); + assert!((written(¤t, "shadows").unwrap() - 0.7).abs() < 1e-6); + assert!(fill_of("Neutral").get("paintFilter").is_none()); + + // The numbers the format uses. + let s = Schema::parse(export::SCHEMA).unwrap(); + let def = |n: &str| s.defs.iter().find(|d| d.name == n).unwrap(); + let id = |d: &str, f: &str| def(d).fields.iter().find(|x| x.name == f).unwrap().value; + assert_eq!(id("Paint", "paintFilter"), 14); + assert_eq!( + ["tint", "shadows", "highlights", "exposure", "temperature", "vibrance", "contrast"].map(|f| id("PaintFilterMessage", f)), + [1, 2, 3, 5, 7, 8, 9] + ); +} diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 56de5f480..d38af63f9 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-11-10 · **Change:** minor (`.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (`.fig` export writes image adjustments (#2297); `.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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 @@ -98,7 +98,7 @@ scales and empty-style clears; they have not been checked in other software. stroke outline of plain strokes (a ring around boxes and whole ellipses, the widened path of other centred strokes); solid, gradient (handles as the paint transform) and image paints (the image bytes, named by their SHA-1, scale mode, - rotation, tile scale, crop); strokes (weight, align, join, caps, dashes, miter limit, per-side + rotation, tile scale, crop, adjustments: exposure, contrast, saturation (the file's vibrance), temperature, tint, highlights and shadows); strokes (weight, align, join, caps, dashes, miter limit, per-side weights); shadows, layer and background blurs (progressive too), noise and texture; corners and smoothing, constraints, clip content, masks with their type; auto layout (direction, wrap, gaps, padding, alignment, hug, strokes in layout, stacking order, grids with their tracks, their sizes (fixed, hug, fill) and cells) and how @@ -139,7 +139,7 @@ scales and empty-style clears; they have not been checked in other software. guides, prototype device settings, slot properties and slot content, brush strokes (written plain), strokes wider on one side of their path (written as filled outlines, or with the width on both sides when the shape has a fill too), pattern fills, WebP export settings (written as PNG), - image adjustments, glass settings other than frost, springs other than Gentle (written as ease + glass settings other than frost, springs other than Gentle (written as ease out), set-variable, set-variable-mode and conditional actions, scroll-to offsets, text decoration looks, variable font axes, text on a path, nested list levels, list spacing, hanging punctuation, leading trim, OpenType features, per-layer operations inside boolean groups, different stroke ends @@ -196,6 +196,7 @@ scales and empty-style clears; they have not been checked in other software. | Date | Change | Summary | |---|---|---| +| 2026-11-12 | minor | M6, #2297: the `.fig` exporter writes an image paint's adjustments as `paintFilter` (seven fields: exposure, contrast, vibrance from saturation, temperature, tint, highlights, shadows; the tint's sign is flipped, as the importer reads it), and no longer warns about them; the importer already read them. Not checked in other software | | 2026-11-10 | minor | M4, #2222: a boolean group's corner radius and smoothing are read and written by the `.fig` importer and exporter, and by the REST importer | | 2026-11-07 | patch | Fonts, #2092: a font loaded with `text.loadFont` is the counterpart of a font uploaded to the organization, which Figma's help center ("Manage conflicting fonts") ranks first, ahead of installed fonts and the web fonts. FigCraft chose the first face added for a family and style, so the built-in Inter 4.x kept Regular, SemiBold and Bold after Inter 3.19 was loaded and only Medium refitted. A loaded face now wins over the other faces of its family and style, the latest load over earlier ones; style matching and fallbacks are unchanged, and `refitted` lists the text whose size changes. Installed versus built-in order is not changed here. Test: `fontdb::tests::a_loaded_face_wins_over_the_built_in_one_of_its_family_and_style`. Numbers unchanged. | | 2026-11-08 | minor | M6, #2097 follow-up: per-point vector corner radii take the scale of the row supplying `vectorData`, including nested instance rows; override and derived rows are not scaled twice. Network caching distinguishes the instance scale even when resizing gives two vectors the same final box. Synthetic tests cover missing/unit factors, half/double scale, derived size alone, overridden and derived vector data, nested scale and equal-size cache separation. Layer-radius fallback remains the separate #2115 change. Numbers unchanged. | From 501df234997fabf2340944cb6e3ca03c25e3b446 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 07:33:54 -0500 Subject: [PATCH 193/239] M6: the .fig export writes sanitized image adjustments (#2297) A document can hold image adjustments outside -1..=1 or not a number (a saved file, or a fills property); the renderer and the importer clamp them, but the export wrote the raw values for other readers. The export now writes the sanitized values, and a paint whose adjustments are all neutral after sanitizing writes no `paintFilter`. The round-trip test pins both cases and that all seven fields are written on a partly neutral paint. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 briefed; Sonnet 5.5 wrote at medium --- crates/format/src/fig/export/paint.rs | 4 ++-- crates/format/src/fig/image_filter_tests.rs | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/crates/format/src/fig/export/paint.rs b/crates/format/src/fig/export/paint.rs index 4d87871f6..bec9a72c8 100644 --- a/crates/format/src/fig/export/paint.rs +++ b/crates/format/src/fig/export/paint.rs @@ -76,8 +76,8 @@ impl<'d> Exporter<'d> { if let (ImageScaleMode::Crop, Some(c)) = (img.scale_mode, img.crop) { f.push(("transform", matrix(Affine::new(c)))); } - if !img.filters.is_identity() { - let x = &img.filters; + let x = img.filters.sanitized(); + if !x.is_identity() { // The file's tint is positive towards magenta, ours towards green; `0.0 -` keeps zero positive. f.push(( "paintFilter", diff --git a/crates/format/src/fig/image_filter_tests.rs b/crates/format/src/fig/image_filter_tests.rs index d1297293f..8923a4d7d 100644 --- a/crates/format/src/fig/image_filter_tests.rs +++ b/crates/format/src/fig/image_filter_tests.rs @@ -110,12 +110,24 @@ fn warnings_naming_unknown_filter_fields_are_capped() { #[test] fn image_adjustments_survive_a_fig_export() { - let (doc, _) = import(&image_filter_fixture(), "ImageFilters.fig").unwrap(); + let (mut doc, _) = import(&image_filter_fixture(), "ImageFilters.fig").unwrap(); let filters_of = |doc: &figcraft_doc::Document, name: &str| { let node = doc.nodes().find(|node| node.name == name).unwrap(); let figcraft_doc::color::PaintKind::Image(image) = &node.fills[0].kind else { panic!("{name} is not an image fill") }; image.filters }; + // Values a document can hold and the file can't: out of range, and not a number. + let ids: Vec = doc.ids().collect(); + for id in ids { + let Some(node) = doc.node_mut(id) else { continue }; + let name = node.name.clone(); + let Some(figcraft_doc::color::PaintKind::Image(image)) = node.fills.first_mut().map(|p| &mut p.kind) else { continue }; + match name.as_str() { + "Legacy" => image.filters.exposure = 5.0, + "Explicit neutral" => image.filters.contrast = f32::NAN, + _ => {} + } + } let (bytes, warnings) = export::export(&doc, None).unwrap(); assert!(!warnings.iter().any(|w| w.contains("image adjustments")), "{warnings:?}"); let (back, _) = import(&bytes, "Back.fig").unwrap(); @@ -150,6 +162,13 @@ fn image_adjustments_survive_a_fig_export() { assert!((written(¤t, "tint").unwrap() - 1.0).abs() < 1e-6); assert!((written(¤t, "shadows").unwrap() - 0.7).abs() < 1e-6); assert!(fill_of("Neutral").get("paintFilter").is_none()); + assert!((written(&fill_of("Legacy"), "exposure").unwrap() - 1.0).abs() < 1e-6, "written within the file's range"); + assert!(fill_of("Explicit neutral").get("paintFilter").is_none(), "not a number is no adjustment"); + let partly = fill_of("Negative tint"); + for field in ["exposure", "contrast", "vibrance", "temperature", "tint", "highlights", "shadows"] { + assert!(written(&partly, field).is_some(), "{field} is written"); + } + assert!((written(&partly, "tint").unwrap() + 1.0).abs() < 1e-6); // The numbers the format uses. let s = Schema::parse(export::SCHEMA).unwrap(); From f1e92749d971a30ac2523fcddd8c6aaa06ef90c0 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 08:01:11 -0500 Subject: [PATCH 194/239] M6: .fig export writes vector region paints (#2302) Each vector region with paints of its own (an empty list included) now names an entry of the network's style table, so the paints come back on import; equal lists share one entry and a region without paints writes style 0. Only the paint frame of a region, which the importer cannot read, still warns. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 briefed; Sonnet 5.5 wrote at medium --- crates/format/src/fig/export/shape.rs | 22 ++++++++---- crates/format/src/fig/export_tests.rs | 51 ++++++++++++++++++--------- crates/format/src/fig/tail_tests.rs | 22 ++++++++++++ docs/file-format-parity.md | 12 ++++--- 4 files changed, 79 insertions(+), 28 deletions(-) diff --git a/crates/format/src/fig/export/shape.rs b/crates/format/src/fig/export/shape.rs index bfc2b0224..393a5d566 100644 --- a/crates/format/src/fig/export/shape.rs +++ b/crates/format/src/fig/export/shape.rs @@ -170,8 +170,8 @@ impl<'d> Exporter<'d> { /// The editable network (with per-point corner radii, handle mirroring and end caps) and, /// when it has filled areas, their outline. pub(super) fn vector(&mut self, n: &Node, net: &VectorNetwork, f: &mut Fields) { - if net.regions.iter().any(|region| region.fills.is_some() || region.paint_space.is_some()) { - self.warn("vector region paints were left out of the .fig export"); + if net.regions.iter().any(|region| region.paint_space.is_some()) { + self.warn("vector region paint frames were left out (their gradients and images follow the layer's box)"); } let entries: usize = net.regions.iter().flat_map(|r| &r.loops).map(Vec::len).sum(); if net.vertices.len() + net.segments.len() + entries > MAX_NETWORK { @@ -249,11 +249,19 @@ impl<'d> Exporter<'d> { tb: (finite(sg.tb.0), finite(sg.tb.1)), }) .collect(); - let regions = net - .regions - .iter() - .map(|r| network::Region { style: 0, non_zero: r.winding == WindingRule::NonZero, loops: r.loops.clone() }) - .collect(); + // A region with paints of its own (an empty list included) names a style entry that + // holds them; one without writes style 0 and shows the layer's fills. + let mut regions = Vec::with_capacity(net.regions.len()); + for r in &net.regions { + let style = match &r.fills { + Some(paints) => { + let list = self.paints(paints, true, &Bound::default()); + style_of(vec![("fillPaints", list)]) + } + None => 0, + }; + regions.push(network::Region { style, non_zero: r.winding == WindingRule::NonZero, loops: r.loops.clone() }); + } let blob = network::encode(&network::Network { vertices, segments, regions }); let table = styles.into_iter().zip(1u32..).map(|(mut st, id)| { st.insert(0, ("styleID", u(id))); diff --git a/crates/format/src/fig/export_tests.rs b/crates/format/src/fig/export_tests.rs index 221cd7cd9..9cb417078 100644 --- a/crates/format/src/fig/export_tests.rs +++ b/crates/format/src/fig/export_tests.rs @@ -843,21 +843,38 @@ fn round_trip_keeps_the_details() { } #[test] -fn fig_export_warns_when_region_paints_are_left_out() { - let mut doc = generate(3); - let Some(id) = doc.nodes().find_map(|node| match &node.kind { - NodeKind::Vector { network } if !network.regions.is_empty() => Some(node.id), - _ => None, - }) else { - panic!("generated document has no filled vector"); - }; - let node = doc.node_mut(id).unwrap(); - let NodeKind::Vector { network } = &mut node.kind else { panic!("expected vector fixture") }; - let region = network.regions.first_mut().unwrap(); - region.fills = Some(Vec::new()); +fn vector_region_paints_round_trip() { + let square = [(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)].map(|(x, y)| Point::new(x, y)); + let mut doc = Document::new("regions"); + let page = doc.first_page().unwrap(); + let mut two = VectorNetwork::from_points(&square, true); + let again = two.regions[0].clone(); + two.regions.push(again); + let mut half = Paint::solid(Color { r: 0.25, g: 0.5, b: 0.75, a: 1.0 }); + half.opacity = 0.5; + let gradient = Paint::gradient(Gradient::default_for(GradientKind::Linear, Color { r: 1.0, g: 0.0, b: 0.0, a: 1.0 })); + two.regions[0].fills = Some(vec![half, gradient]); + two.regions[1].fills = Some(Vec::new()); + let id = doc.create(page, NodeKind::Vector { network: two }, "Painted", 0.0, 0.0, 100.0, 100.0).unwrap(); + doc.node_mut(id).unwrap().fills = vec![Paint::solid(Color::BLACK)]; + let inherit = VectorNetwork::from_points(&square, true); + let id2 = doc.create(page, NodeKind::Vector { network: inherit }, "Inherits", 0.0, 0.0, 100.0, 100.0).unwrap(); + doc.node_mut(id2).unwrap().fills = vec![Paint::solid(Color::BLACK)]; - let (_, warnings) = export(&doc, None).unwrap(); - assert!(warnings.iter().any(|warning| warning == "vector region paints were left out of the .fig export"), "{warnings:?}"); + let (back, warnings) = round_trip(&doc, "region paints"); + assert!(!warnings.iter().any(|w| w.contains("region")), "{warnings:?}"); + let regions_of = |d: &Document, name: &str| match d.nodes().find(|n| n.name == name).map(|n| &n.kind) { + Some(NodeKind::Vector { network }) => network.regions.clone(), + k => panic!("{name}: {k:?}"), + }; + let painted = regions_of(&back, "Painted"); + assert_eq!(painted.len(), 2); + let fills = painted[0].fills.as_ref().expect("the first region keeps its paints"); + assert_eq!(fills.len(), 2); + assert!(matches!(&fills[0].kind, PaintKind::Solid { .. }) && (fills[0].opacity - 0.5).abs() < 1e-6); + assert!(matches!(&fills[1].kind, PaintKind::Gradient(_))); + assert_eq!(painted[1].fills, Some(Vec::new()), "an unfilled region stays unfilled"); + assert_eq!(regions_of(&back, "Inherits")[0].fills, None, "a region with no paints of its own still shows the layer's"); } #[test] @@ -875,16 +892,18 @@ fn fig_export_warns_when_inherited_region_paints_have_a_paint_frame() { let region = network.regions.first_mut().unwrap(); region.fills = None; region.paint_space = Some(RegionPaintSpace { width: 20.0, height: 10.0, transform: Affine::translate((4.0, 8.0)) }); + let text = "vector region paint frames were left out (their gradients and images follow the layer's box)"; let (_, warnings) = export(&doc, None).unwrap(); - assert!(warnings.iter().any(|warning| warning == "vector region paints were left out of the .fig export"), "{warnings:?}"); + assert!(warnings.iter().any(|warning| warning == text), "{warnings:?}"); let mut plain = doc; let node = plain.node_mut(id).unwrap(); let NodeKind::Vector { network } = &mut node.kind else { panic!("expected vector fixture") }; network.regions[0].paint_space = None; + network.regions[0].fills = Some(vec![Paint::solid(Color::BLACK)]); let (_, warnings) = export(&plain, None).unwrap(); - assert!(!warnings.iter().any(|warning| warning == "vector region paints were left out of the .fig export"), "{warnings:?}"); + assert!(!warnings.iter().any(|warning| warning.contains("region paint")), "{warnings:?}"); } #[test] diff --git a/crates/format/src/fig/tail_tests.rs b/crates/format/src/fig/tail_tests.rs index 663d6002b..375736e77 100644 --- a/crates/format/src/fig/tail_tests.rs +++ b/crates/format/src/fig/tail_tests.rs @@ -359,6 +359,28 @@ fn vector_region_missing_and_empty_paints_remain_distinct() { assert_eq!(network_of(&empty, "Wave").regions[0].fills, Some(Vec::new())); } +#[test] +fn vector_region_fills_survive_a_fig_export() { + let solid = o(vec![("type", e("SOLID")), ("color", o(vec![("r", f(0.2)), ("g", f(0.4)), ("b", f(0.8)), ("a", f(1.0))])), ("opacity", f(0.5))]); + let gradient = o(vec![ + ("type", e("GRADIENT_LINEAR")), + ( + "stops", + arr(vec![ + o(vec![("position", f(0.0)), ("color", o(vec![("r", f(1.0)), ("g", f(0.0)), ("b", f(0.0)), ("a", f(1.0))]))]), + o(vec![("position", f(1.0)), ("color", o(vec![("r", f(0.0)), ("g", f(0.0)), ("b", f(1.0)), ("a", f(1.0))]))]), + ]), + ), + ]); + let (doc, _) = import(®ion_canvas(Some(vec![solid, gradient]), 1), "Region fills").unwrap(); + let first = network_of(&doc, "Wave").regions[0].fills.clone(); + assert!(first.as_ref().is_some_and(|fills| fills.len() == 2), "{first:?}"); + let (bytes, warnings) = crate::fig::export::export(&doc, None).unwrap(); + assert!(!warnings.iter().any(|warning| warning.contains("region paints")), "{warnings:?}"); + let (back, _) = import(&bytes, "Again").unwrap(); + assert_eq!(network_of(&back, "Wave").regions[0].fills, first); +} + #[test] fn vector_region_linked_fill_uses_style_paints_without_recording_definition() { let linked = solid(0.9, 0.1, 0.2); diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 56de5f480..5d9655120 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-11-10 · **Change:** minor (`.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (`.fig` export writes vector region paints (#2302); `.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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 @@ -81,8 +81,9 @@ visible and opaque (a page also its background opacity): a reader takes what is draws nothing below a hidden page. The message lists one node change per layer, parents first, each with its GUID, its parent and a position string that orders it among its siblings; vector networks and outlines go in blobs, written once -each. `.fig` export warns and drops vector region paint stacks; import and editing preserve their -source paint coordinates. +each. `.fig` export writes a vector's region paint stacks (each filled area's own paints as an entry of the +network's style table, named by the area's style id); a region's kept paint frame is left out with a +warning; import and editing preserve their source paint coordinates. Scaled instances retain an explicit override when a length is reset to the unscaled main's value, rather than losing it to the field diff. This covers corners, strokes, layout and grid lengths, @@ -93,7 +94,7 @@ scales and empty-style clears; they have not been checked in other software. - **Written:** pages (name, background); frames, groups, sections, rectangles (as rounded rectangles, with their four radii), ellipses (arcs), polygons, stars, lines, vectors (editable - network blobs with per-point corner radius, handle mirroring, caps and joins, plus the outline of + network blobs with per-point corner radius, handle mirroring, caps and joins, each filled area's own paints, plus the outline of their filled areas), text, boolean groups, slices; the fill outline of frames and shapes and the stroke outline of plain strokes (a ring around boxes and whole ellipses, the widened path of other centred strokes); @@ -133,7 +134,7 @@ scales and empty-style clears; they have not been checked in other software. - **Left out, with a warning each:** colour calculations that resolve to nothing (an operand missing, or more than 32 variables to read), variable bindings the format has no field for (component properties, arc fields, font weight: written as the values they give), text styles on part of a - text (written as values), variables' publishing, code syntax and inheritance settings, extended + text (written as values), the paint frames of vector regions, variables' publishing, code syntax and inheritance settings, extended collections (written as collections of their own), comments, Developer Mode annotations, statuses, resources, measurements and code links, plugin data, ruler guides, prototype device settings, slot properties and slot content, brush @@ -196,6 +197,7 @@ scales and empty-style clears; they have not been checked in other software. | Date | Change | Summary | |---|---|---| +| 2026-11-12 | minor | M6, #2302: the `.fig` export writes the paints of a vector's own regions: each region with paints of its own (an empty list means unfilled) names an entry of the network's style table (`styleOverrideTable[].fillPaints`), equal lists share one entry, and a region without paints writes style 0. The fill outline is still one path with style 0. A region's kept paint frame is still left out, with a narrower warning. The importer already read this; not checked in other software | | 2026-11-10 | minor | M4, #2222: a boolean group's corner radius and smoothing are read and written by the `.fig` importer and exporter, and by the REST importer | | 2026-11-07 | patch | Fonts, #2092: a font loaded with `text.loadFont` is the counterpart of a font uploaded to the organization, which Figma's help center ("Manage conflicting fonts") ranks first, ahead of installed fonts and the web fonts. FigCraft chose the first face added for a family and style, so the built-in Inter 4.x kept Regular, SemiBold and Bold after Inter 3.19 was loaded and only Medium refitted. A loaded face now wins over the other faces of its family and style, the latest load over earlier ones; style matching and fallbacks are unchanged, and `refitted` lists the text whose size changes. Installed versus built-in order is not changed here. Test: `fontdb::tests::a_loaded_face_wins_over_the_built_in_one_of_its_family_and_style`. Numbers unchanged. | | 2026-11-08 | minor | M6, #2097 follow-up: per-point vector corner radii take the scale of the row supplying `vectorData`, including nested instance rows; override and derived rows are not scaled twice. Network caching distinguishes the instance scale even when resizing gives two vectors the same final box. Synthetic tests cover missing/unit factors, half/double scale, derived size alone, overridden and derived vector data, nested scale and equal-size cache separation. Layer-radius fallback remains the separate #2115 change. Numbers unchanged. | From 98f946267d9a4838e0f30fe42e78823d2f244c97 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 08:13:55 -0500 Subject: [PATCH 195/239] M6: gaps.md says the export writes region paints; the warning test can fail again (#2302) Gap 1's 2026-10-26 bullet still said the export drops region fills. tail_tests asserted on "region paints", which the narrowed warning can never contain; it now checks for any region warning. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and fixed; Fable 5.2 reviewed --- crates/format/src/fig/tail_tests.rs | 2 +- docs/gaps.md | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/format/src/fig/tail_tests.rs b/crates/format/src/fig/tail_tests.rs index 375736e77..264216bcc 100644 --- a/crates/format/src/fig/tail_tests.rs +++ b/crates/format/src/fig/tail_tests.rs @@ -376,7 +376,7 @@ fn vector_region_fills_survive_a_fig_export() { let first = network_of(&doc, "Wave").regions[0].fills.clone(); assert!(first.as_ref().is_some_and(|fills| fills.len() == 2), "{first:?}"); let (bytes, warnings) = crate::fig::export::export(&doc, None).unwrap(); - assert!(!warnings.iter().any(|warning| warning.contains("region paints")), "{warnings:?}"); + assert!(!warnings.iter().any(|warning| warning.contains("region")), "{warnings:?}"); let (back, _) = import(&bytes, "Again").unwrap(); assert_eq!(network_of(&back, "Wave").regions[0].fills, first); } diff --git a/docs/gaps.md b/docs/gaps.md index e7cbdb76a..66ac5bb9f 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Where FigCraft falls short of Figma -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (gap 13: a boolean group's corner radius (#2222); gap 24: mind maps, first step: a first node with three children on curved branches, laid out again after every edit (`board.mindMap`, `board.mindMapAdd`, #2226); gap 10: library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; gap 6: widgets draw lines and SVG pictures (plugin API 6); gap 7: text reads only the fallback fonts it draws with; a board connector's path can be reshaped by dragging its path handles (#1710); gap 10: library analytics count insertions and show insertions and detachments over time; gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; gap 14: a collection of this file extends, following its edits at once; colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; gap 6: plugin widgets have hover styles; gap 7: the browser draws a zoom's full render a band at a time; `.fig` import keeps the file's saved line breaks while the text and its box are unedited (#1236); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); Arabic draft catalog; gap 7: the browser refines a zoom's preview once the zoom has paused; gap 17: branches in live sessions, branch history entries, the list-merge rows brought up to date; gap 6: plugin widgets take text input and a property menu (plugin API 4); gap 24: board templates and tables; gap 24: a shared timer and voting sessions; gap 24: the board dot grid, connector ends dragged to re-attach, curved connectors; egui/eframe 0.37 verified for gap 18; known gaps from the #1311 review in gaps 4, 14, 15 and 16; gap 16: measurements kept on the canvas, a read-only layers panel in Dev Mode; gap 24: boards and their tail; Dev Mode tail: import lines in layer trees, compare with versions, an inspect-only canvas; gap 5: reviewed Turkish, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; sharing with a join code; text box sizes measured against documents re-saved by other software; live sessions per document; .fig export checked by opening written files in other software; 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; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; `.fig` import: editable vector networks, more layer kinds, variable prototype actions; `.fig` import, best effort: gap 1 down to its tail; Windows QA pass: everyday workflows on Windows 11, eight fixes incl. unsaved work kept after a crash or a forced quit; 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: gap 14 down to its tail; the 2026-10-17 landings: `.fig` import fidelity, budgets for large files, the import report, a `.fig` copy from Save as and paste from another design app (gap 1); menus, the Actions palette, editor fixes, Selection colors and smart-selection spacing (gap 4); catalog counts re-measured (gap 5); bounded canvas pan overscan) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (gap 1: the `.fig` export writes vector region paints (#2302); gap 13: a boolean group's corner radius (#2222); gap 24: mind maps, first step: a first node with three children on curved branches, laid out again after every edit (`board.mindMap`, `board.mindMapAdd`, #2226); gap 10: library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; gap 6: widgets draw lines and SVG pictures (plugin API 6); gap 7: text reads only the fallback fonts it draws with; a board connector's path can be reshaped by dragging its path handles (#1710); gap 10: library analytics count insertions and show insertions and detachments over time; gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; gap 14: a collection of this file extends, following its edits at once; colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; gap 6: plugin widgets have hover styles; gap 7: the browser draws a zoom's full render a band at a time; `.fig` import keeps the file's saved line breaks while the text and its box are unedited (#1236); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); Arabic draft catalog; gap 7: the browser refines a zoom's preview once the zoom has paused; gap 17: branches in live sessions, branch history entries, the list-merge rows brought up to date; gap 6: plugin widgets take text input and a property menu (plugin API 4); gap 24: board templates and tables; gap 24: a shared timer and voting sessions; gap 24: the board dot grid, connector ends dragged to re-attach, curved connectors; egui/eframe 0.37 verified for gap 18; known gaps from the #1311 review in gaps 4, 14, 15 and 16; gap 16: measurements kept on the canvas, a read-only layers panel in Dev Mode; gap 24: boards and their tail; Dev Mode tail: import lines in layer trees, compare with versions, an inspect-only canvas; gap 5: reviewed Turkish, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; sharing with a join code; text box sizes measured against documents re-saved by other software; live sessions per document; .fig export checked by opening written files in other software; 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; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; `.fig` import: editable vector networks, more layer kinds, variable prototype actions; `.fig` import, best effort: gap 1 down to its tail; Windows QA pass: everyday workflows on Windows 11, eight fixes incl. unsaved work kept after a crash or a forced quit; 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: gap 14 down to its tail; the 2026-10-17 landings: `.fig` import fidelity, budgets for large files, the import report, a `.fig` copy from Save as and paste from another design app (gap 1); menus, the Actions palette, editor fixes, Selection colors and smart-selection spacing (gap 4); catalog counts re-measured (gap 5); bounded canvas pan overscan) · **Target:** Figma Design (desktop app 126.10.7) Every known shortfall against Figma, one entry each, ranked by how much it stops a Figma user from doing real work in FigCraft. Agents: pick work from the top unless the owner says otherwise. The @@ -87,8 +87,8 @@ No alpha blockers: the alpha gate in [`roadmap.md`](roadmap.md#alpha-gate) passe layer budgets; the issue sample was checked locally only. Native board metadata and direct `.jam` opening (#1342) remain separate work. - **Landed (2026-10-26):** `.fig` import reads vector-region fill stacks; vector editing and path - operations retain them with their source paint coordinates. `.fig` export still warns and drops - region fills. Evidence: `crates/format/src/fig/tail_tests.rs`, `crates/engine/src/shapebuilder_region_paints_tests.rs`. + operations retain them with their source paint coordinates. `.fig` export writes them since + 2026-11-12 (#2302); a region's kept paint frame is left out, with a warning. Evidence: `crates/format/src/fig/tail_tests.rs`, `crates/engine/src/shapebuilder_region_paints_tests.rs`. - **Fixed (2026-10-29, #1236):** imported text keeps the line breaks the file saved with it (`derivedTextData`), so a font whose advances differ slightly from the file's (another build of the family, a stand-in) no longer wraps a word early or splits one in a narrow box. The @@ -595,6 +595,7 @@ No alpha blockers: the alpha gate in [`roadmap.md`](roadmap.md#alpha-gate) passe | Date | Change | Summary | |---|---|---| +| 2026-11-12 | minor | Gap 1: the `.fig` export writes vector region paints (#2302); the 2026-10-26 "Landed" bullet no longer says the export drops them | | 2026-11-10 | minor | Gap 13: a boolean group's corner radius rounds every sharp corner of its result (#2222); the boolean clause leaves the 2026-10-12 "Left" list | | 2026-11-10 | minor | Gap 24: mind maps, first step (`board.mindMap`, `board.mindMapAdd`; the map lays itself out again after every edit, #2226); the toolbar entry, shortcuts, drag to re-parent and `.jam` import are what is missing of them. | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`) draft catalog: 1,975 UI strings, 641 command labels and 31 menu wordings, clean-room from the English source; zh-TW, zh-HK, zh-MO and zh-Hant read it, explicit Hans stays Simplified; Noto Sans CJK TC then Taiwan system faces; no bundled font; native review pending. Numbers unchanged | From 89d8b50e9df18e553969b4571fd76cad0ea2ddce Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 09:56:45 -0500 Subject: [PATCH 196/239] M8: polygons and stars get a Count handle on the canvas, as in Figma A selected polygon or star shows a Count handle on its first point clockwise from the top (a polygon's vertex 1, a star's outer point 1, not inset). Dragging it sets the count to round(360 / the pointer's clockwise angle from the top point about the centre), measured in the shape's own frame and clamped to 3 to 60, written through node.set pointCount in one undo step. The readout and hover label read "Count N". Measured in Figma's web app on 2026-11-12; a polygon's maximum wasn't read, so it is clamped at 60 like the star's. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 queued; Opus 5.5 briefed; Sonnet 5.5 measured and wrote at medium --- crates/engine/src/canvas/shape_handles.rs | 45 ++++++++- crates/engine/src/shape_handles_tests.rs | 106 +++++++++++++++++++++- crates/ui-egui/src/canvas/overlays.rs | 1 + docs/ui-parity.md | 5 +- 4 files changed, 150 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/canvas/shape_handles.rs b/crates/engine/src/canvas/shape_handles.rs index 6ddd99943..726f7d011 100644 --- a/crates/engine/src/canvas/shape_handles.rs +++ b/crates/engine/src/canvas/shape_handles.rs @@ -6,12 +6,16 @@ //! [`INSET_PX`] in, so it can be grabbed at radius 0). Dragging it along the bisector sets the //! radius of every corner; with Alt, only that corner of a rectangle or frame (the documentation //! is silent on Alt). +//! - **Count**: a polygon's or star's sits on its first point clockwise from the top; dragging it +//! sets the count from the pointer's angle about the centre, measured clockwise from the top +//! point: `round(360 / angle)`, clamped to 3 to 60 (measured in Figma's web app, 2026-11-12; a +//! polygon's maximum wasn't read). //! - **Ratio**: a star's sits on its first inner point; dragging it towards or away from the //! centre sets the inner radius as a share of the outer one. //! //! Positions are in page coordinates and work for rotated and flipped layers at any zoom; the //! handles hide on layers smaller than [`MIN_PX`] on screen. The Move tool's gesture (`tools.rs`) -//! writes the result through `node.set` (`cornerRadius`, `topLeftRadius`…, `innerRadius`), one +//! writes the result through `node.set` (`cornerRadius`, `topLeftRadius`…, `innerRadius`, `pointCount`), one //! undo step per drag. use figcraft_doc::{Document, Node, NodeId, NodeKind}; @@ -20,18 +24,22 @@ use serde::Serialize; use serde_json::{Map, Value, json}; /// One shape handle: a corner's radius (corner index: tl, tr, br, bl; 0 for a polygon's or -/// star's top point) or a star's ratio. +/// star's top point), a star's ratio or a polygon's or star's point count. #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)] #[serde(rename_all = "camelCase", tag = "kind")] pub enum ShapeHandle { Radius { corner: usize }, Ratio, + Count, } /// Layers smaller than this on screen (either side, in pixels) show no shape handles. pub const MIN_PX: f64 = 48.0; /// How far in from its corner a handle sits at least (screen pixels). pub const INSET_PX: f64 = 10.0; +/// The fewest and most points the Count handle sets (a star's range in the help center). +const COUNT_MIN: f64 = 3.0; +const COUNT_MAX: f64 = 60.0; /// How near the pointer must be to pick a handle (screen pixels). const HIT_PX: f64 = 6.0; @@ -113,6 +121,29 @@ fn ratio_point(n: &Node, count: u32, ratio: f64) -> Option { figcraft_geom::star_points(n.width, n.height, count, ratio).get(1).copied() } +/// The Count handle (local): a polygon's vertex 1 or a star's outer point 1, the first clockwise +/// from the top. +fn count_point(n: &Node) -> Option { + match n.kind { + NodeKind::Polygon { count } => figcraft_geom::polygon_points(n.width, n.height, count).get(1).copied(), + NodeKind::Star { count, inner_ratio } => figcraft_geom::star_points(n.width, n.height, count, inner_ratio).get(2).copied(), + _ => None, + } +} + +/// The count a pointer at local point `q` sets: `round(360 / angle)` for its clockwise angle from +/// the top about the centre, on the unit circle the shape's box maps from; finite for any `q`. +fn count_at(n: &Node, q: Point) -> Option { + let (rx, ry) = (n.width / 2.0, n.height / 2.0); + if rx.partial_cmp(&0.0) != Some(std::cmp::Ordering::Greater) || ry.partial_cmp(&0.0) != Some(std::cmp::Ordering::Greater) { + return None; + } + let (x, y) = (q.x / rx - 1.0, q.y / ry - 1.0); + let angle = x.atan2(-y).rem_euclid(std::f64::consts::TAU).to_degrees(); + let count = (360.0 / angle.max(1e-9)).round(); + count.is_finite().then(|| count.clamp(COUNT_MIN, COUNT_MAX)) +} + /// The shape handles of the selection at `zoom` (screen pixels per page unit): each handle and /// where it is (page coordinates). pub fn handles(doc: &Document, sel: &[NodeId], zoom: f64) -> Vec<(ShapeHandle, [f64; 2])> { @@ -128,6 +159,9 @@ pub fn handles(doc: &Document, sel: &[NodeId], zoom: f64) -> Vec<(ShapeHandle, [ { out.push((ShapeHandle::Ratio, pt(p))); } + if let Some(p) = count_point(n) { + out.push((ShapeHandle::Count, pt(p))); + } out } @@ -160,6 +194,10 @@ pub fn drag(doc: &Document, id: NodeId, h: ShapeHandle, p: Point, alt: bool) -> }; Some(Map::from_iter([(key.to_string(), json!(r))])) } + ShapeHandle::Count => { + count_point(n)?; + Some(Map::from_iter([("pointCount".to_string(), json!(count_at(n, q)?))])) + } ShapeHandle::Ratio => { let NodeKind::Star { count, .. } = n.kind else { return None }; // Along the inner point's ray, measured on the unit circle the star's box maps from. @@ -172,11 +210,12 @@ pub fn drag(doc: &Document, id: NodeId, h: ShapeHandle, p: Point, alt: bool) -> } } -/// The live readout while dragging `h` of `id`: the corner's radius, or the star's ratio in percent. +/// The live readout while dragging `h` of `id`: the corner's radius, the star's ratio in percent or the point count. pub fn value(doc: &Document, id: NodeId, h: ShapeHandle) -> Option { let n = doc.node(id)?; let v = match (h, &n.kind) { (ShapeHandle::Ratio, NodeKind::Star { inner_ratio, .. }) => inner_ratio * 100.0, + (ShapeHandle::Count, NodeKind::Polygon { count }) | (ShapeHandle::Count, NodeKind::Star { count, .. }) => f64::from(*count), (ShapeHandle::Radius { corner }, _) => corners(n).into_iter().nth(corner).map(|(c, r)| r.clamp(0.0, c.max_r))?, _ => return None, }; diff --git a/crates/engine/src/shape_handles_tests.rs b/crates/engine/src/shape_handles_tests.rs index 73647f4d6..65220d7a7 100644 --- a/crates/engine/src/shape_handles_tests.rs +++ b/crates/engine/src/shape_handles_tests.rs @@ -3,6 +3,7 @@ use figcraft_doc::{NodeId, NodeKind}; use figcraft_geom::Point; use serde_json::{Value, json}; +use std::f64::consts::TAU; use crate::Session; use crate::params::id_of; @@ -63,7 +64,11 @@ fn polygon_and_star_handles() { let doc = s.doc().unwrap().clone(); let hs = handles(&doc, &[star], 1.0); let kinds: Vec = hs.iter().map(|h| h.0).collect(); - assert_eq!(kinds, vec![ShapeHandle::Radius { corner: 0 }, ShapeHandle::Ratio], "a star has a radius and a ratio handle"); + assert_eq!( + kinds, + vec![ShapeHandle::Radius { corner: 0 }, ShapeHandle::Ratio, ShapeHandle::Count], + "a star has a radius, a ratio and a count handle" + ); // The ratio handle sits on the first inner point; dragging it to the centre's side shrinks it. let ratio_at = hs[1].1; let inner = figcraft_geom::star_points(200.0, 200.0, 5, 0.38)[1]; @@ -78,7 +83,7 @@ fn polygon_and_star_handles() { assert!(radii(&s, star)[0] > 1.0, "the star's points round"); let mut s = Session::new(); let poly = create(&mut s, "shape.polygon", json!({"x": 0, "y": 0, "width": 200, "height": 200})); - assert_eq!(handles(s.doc().unwrap(), &[poly], 1.0).len(), 1, "a polygon has one radius handle"); + assert_eq!(handles(s.doc().unwrap(), &[poly], 1.0).len(), 2, "a polygon has a radius and a count handle"); } #[test] @@ -100,3 +105,100 @@ fn handles_show_only_where_they_can_be_used() { s.execute("vector.edit.begin", &json!({"id": r})).unwrap(); assert!(s.shape_handles().is_empty(), "none while editing points"); } + +fn count_of(s: &Session, id: NodeId) -> u32 { + match s.doc().unwrap().node(id).unwrap().kind { + NodeKind::Polygon { count } | NodeKind::Star { count, .. } => count, + _ => panic!("a polygon or star"), + } +} + +fn count_handle(s: &Session, id: NodeId) -> [f64; 2] { + handles(s.doc().unwrap(), &[id], 1.0).into_iter().find(|h| h.0 == ShapeHandle::Count).expect("a count handle").1 +} + +/// The page point at `deg` degrees clockwise from the shape's own top, `r` from its centre (200 x 200 box). +fn at_angle(s: &Session, id: NodeId, deg: f64, r: f64) -> (f64, f64) { + let a = deg.to_radians(); + let p = s.doc().unwrap().world_transform(id) * Point::new(100.0 + r * a.sin(), 100.0 - r * a.cos()); + (p.x, p.y) +} + +fn count_drag(s: &mut Session, id: NodeId, deg: f64) { + let h = count_handle(s, id); + let to = at_angle(s, id, deg, 80.0); + drag(s, (h[0], h[1]), to, false); +} + +#[test] +fn a_polygon_has_a_count_handle_on_its_first_vertex_clockwise_from_the_top() { + let mut s = Session::new(); + let poly = create(&mut s, "shape.polygon", json!({"x": 0, "y": 0, "width": 200, "height": 200})); + s.execute("node.set", &json!({"ids": [poly], "props": {"pointCount": 5}})).unwrap(); + let h = count_handle(&s, poly); + let v1 = figcraft_geom::polygon_points(200.0, 200.0, 5)[1]; + assert!((Point::new(h[0], h[1]) - v1).hypot() < 1e-6, "on vertex 1, not inset: {h:?} vs {v1:?}"); + assert!((h[0] - (100.0 + 100.0 * (TAU / 5.0).sin())).abs() < 1e-6, "72 degrees from the top"); + // Hovering it finds it, not the radius handle. + assert_eq!(hit(s.doc().unwrap(), &[poly], Point::new(h[0], h[1]), 1.0).map(|x| x.1), Some(ShapeHandle::Count)); +} + +#[test] +fn dragging_the_count_handle_sets_the_count_by_the_angle_about_the_centre() { + let mut s = Session::new(); + let poly = create(&mut s, "shape.polygon", json!({"x": 0, "y": 0, "width": 200, "height": 200})); + s.execute("node.set", &json!({"ids": [poly], "props": {"pointCount": 5}})).unwrap(); + for (deg, want) in [(90.0, 4), (45.0, 8), (120.0, 3), (0.5, 60), (0.0, 60), (200.0, 3)] { + count_drag(&mut s, poly, deg); + assert_eq!(count_of(&s, poly), want, "{deg} degrees"); + } + // The radius from the centre doesn't matter. + let h = count_handle(&s, poly); + let to = at_angle(&s, poly, 90.0, 30.0); + drag(&mut s, (h[0], h[1]), to, false); + assert_eq!(count_of(&s, poly), 4, "90 degrees near the centre"); + // The readout is the count. + let doc = s.doc().unwrap(); + assert_eq!(crate::shape_handles::value(doc, poly, ShapeHandle::Count), Some(4.0)); + // The finite guard: a pointer on the centre gives a finite count. + let h = count_handle(&s, poly); + drag(&mut s, (h[0], h[1]), (100.0, 100.0), false); + assert!((3..=60).contains(&count_of(&s, poly))); +} + +#[test] +fn dragging_a_stars_count_handle_sets_its_points() { + let mut s = Session::new(); + let star = create(&mut s, "shape.star", json!({"x": 0, "y": 0, "width": 200, "height": 200})); + let h = count_handle(&s, star); + let outer = figcraft_geom::star_points(200.0, 200.0, 5, 0.38)[2]; + assert!((Point::new(h[0], h[1]) - outer).hypot() < 1e-6, "on its first outer point clockwise from the top"); + for (deg, want) in [(90.0, 4), (45.0, 8), (130.0, 3), (1.0, 60)] { + count_drag(&mut s, star, deg); + assert_eq!(count_of(&s, star), want, "{deg} degrees"); + } + let NodeKind::Star { inner_ratio, .. } = s.doc().unwrap().node(star).unwrap().kind else { panic!("star") }; + assert!((inner_ratio - 0.38).abs() < 0.02, "the ratio stays through count drags: {inner_ratio}"); +} + +#[test] +fn a_count_drag_is_one_undo_step() { + let mut s = Session::new(); + let poly = create(&mut s, "shape.polygon", json!({"x": 0, "y": 0, "width": 200, "height": 200})); + s.execute("node.set", &json!({"ids": [poly], "props": {"pointCount": 5}})).unwrap(); + count_drag(&mut s, poly, 45.0); + assert_eq!(count_of(&s, poly), 8); + s.undo().unwrap(); + assert_eq!(count_of(&s, poly), 5, "one Ctrl+Z takes the drag back"); +} + +#[test] +fn a_rotated_polygons_count_angle_is_measured_in_its_own_frame() { + let mut s = Session::new(); + let poly = create(&mut s, "shape.polygon", json!({"x": 0, "y": 0, "width": 200, "height": 200})); + s.execute("node.set", &json!({"ids": [poly], "props": {"pointCount": 5, "rotation": 30}})).unwrap(); + for (deg, want) in [(90.0, 4), (45.0, 8)] { + count_drag(&mut s, poly, deg); + assert_eq!(count_of(&s, poly), want, "{deg} degrees in the shape's frame"); + } +} diff --git a/crates/ui-egui/src/canvas/overlays.rs b/crates/ui-egui/src/canvas/overlays.rs index 3e15693f9..b285d8792 100644 --- a/crates/ui-egui/src/canvas/overlays.rs +++ b/crates/ui-egui/src/canvas/overlays.rs @@ -701,6 +701,7 @@ fn shape_overlay(app: &FigApp, painter: &egui::Painter, col: Color32) { let text = match hint.handle { ShapeHandle::Radius { .. } => format!("{} {}", tr("Radius"), hint.value), ShapeHandle::Ratio => format!("{} {}%", tr("Ratio"), hint.value), + ShapeHandle::Count => format!("{} {}", tr("Count"), hint.value), }; pill(painter, c + vec2(12.0, 12.0), Align2::LEFT_TOP, text, col); } diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 1911dbbcd..2bbf44c03 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-10 · **Change:** minor (the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (M8: a selected polygon or star has a Count handle on the canvas, on its first point clockwise from the top; dragging it sets the count from the pointer's angle about the centre, as measured in Figma's web app; the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -95,7 +95,7 @@ interaction feel not yet compared. | Move, hand (Space), zoom (hold Z, Alt out, drag area) | done | the middle mouse button and a mouse's side buttons (4 and 5) pan as Space does (#1758) | | Frame (presets panel, swap orientation), section, slice | done | | | Rectangle, ellipse (arc handles and Design panel arc fields), polygon, star, line, arrow; Shift/Alt | done | Alt draws lines from the centre too (`shapes_behaviour_tests`) | -| Corner radius handles (inside each corner of a rectangle or frame, a polygon's or star's top point; Alt: one corner), star ratio handle; Count and Ratio fields | done | handles hide under 48 px on screen; no count handle on the canvas (the Count field instead); corner smoothing rounds rectangles and frames only | +| Corner radius handles (inside each corner of a rectangle or frame, a polygon's or star's top point; Alt: one corner), star ratio handle; Count and Ratio fields | done | handles hide under 48 px on screen; a Count handle sits on a polygon's first vertex or a star's first outer point clockwise from the top, and the count follows the pointer's angle about the centre, `round(360 / angle)` clockwise from the top point, clamped to 3 to 60, in one undo step (measured in Figma's web app, 2026-11-12; a polygon's maximum wasn't read and is clamped at 60 like the star's, the help center's range); corner smoothing rounds rectangles and frames only | | Pen: vector networks, branch, close, bend; pencil | done | pen pressure on Windows and from browser styluses only; outside edit mode the Pen closes on its first point, connects to its other points and continues a selected open path from an end point (`vector_multi_behaviour_tests`); Escape ends the path and keeps its layer in edit mode with the pen, so the next path joins the same vector and another Escape leaves edit mode (#760, `pen_end_tests`); Enter or a double-click ends the path (at the double-click's point, added once) and edits the vector with the Move tool, a double-click with the idle pen edits the layer under it, and in edit mode the pen's Enter or double-click takes the Move tool (#1430, `pen_vector_edit_tests`); switching from Design to Prototype or Inspect ends the path and returns to Move (#308) | | Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); the Point section's X and Y show the value the selected points share, or Mixed, and a typed value sets every selected point's own coordinate, in the layer being edited (measured in Figma on 2026-11-08). Not yet: areas of other layers edited at once; the Point section's X and Y over points of several edited layers | | Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a double-click a few pixels off a thin stroke enters edit mode (#646); entering edit mode and picking a region keep the canvas still (#322); a point dropped on another point merges with it, and dropping one end of an open path on the other closes it (a 2-point line's end just moves, #401); Flatten keeps open paths open (#377), and bakes a vector's point corner radius into its path (each rounded point becomes the arc's end points joined by curves, the layer stays a vector and its box fits the real geometry, #2195); paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn; Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). Not yet: areas of other layers edited at once | @@ -327,4 +327,5 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | 2026-10-11 | minor | Outline mode done: outlines for the selection (the selected layers draw as outlines, the rest normally) and mask outlines | | 2026-10-11 | minor | Design panel arc fields, live boolean editing (operands on the canvas, live results, per-operand operations), shape builder on strokes and open paths, one-sided widths (Alt-drag a width handle) | | 2026-11-09 | patch | M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`) | +| 2026-11-12 | minor | M8: a selected polygon or star has a Count handle on the canvas (hover label Count N), measured in Figma's web app on 2026-11-12: it sits on the first vertex clockwise from the top (a star's first outer point, not inset), and a drag sets the count to round(360 / the pointer's clockwise angle from the top point about the centre), so 90 degrees gives 4, 72 gives 5 and 45 gives 8, with the step shrinking as the count grows; one drag is one undo step. The count is clamped to 3 to 60 (the help center's range for a star; a polygon's maximum was not read). Tests: `a_polygon_has_a_count_handle_on_its_first_vertex_clockwise_from_the_top`, `dragging_the_count_handle_sets_the_count_by_the_angle_about_the_centre`, `a_count_drag_is_one_undo_step` | | 2026-10-10 | major | Created from the ROADMAP's look-and-feel and interaction items, the keymap and the canvas code | From 9a29a3cbb767ccbfda324d4e8dee5c0869f37735 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 10:55:40 -0500 Subject: [PATCH 197/239] M8: a double-click on a layer's icon zooms to it, as in Figma Measured in Figma's web app on 2026-11-12: a double-click on a layer's icon in the Layers panel zooms the canvas to the layer and starts no rename; a double-click on the name renames. The row now checks whether the double-click fell within the rect it paints the icon in, and if so selects the layer and runs view.zoomSelection. A double-click elsewhere on the row is unchanged. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 queued; Sonnet 5.5 measured and wrote at medium --- crates/ui-egui/src/layers_behaviour_tests.rs | 43 ++++++++++++++++++++ crates/ui-egui/src/panels/layers.rs | 16 ++++++-- docs/ui-parity.md | 5 ++- 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/layers_behaviour_tests.rs b/crates/ui-egui/src/layers_behaviour_tests.rs index c56adecdf..611a202d4 100644 --- a/crates/ui-egui/src/layers_behaviour_tests.rs +++ b/crates/ui-egui/src/layers_behaviour_tests.rs @@ -841,3 +841,46 @@ fn search_fields_keep_their_text_in_the_middle() { let off = off_centre(&mut u, "Search assets"); assert!(off < 1.0, "Search assets is {off} points off the middle"); } + +/// Measured in Figma's web app, 2026-11-12: a double-click on a layer's icon zooms the canvas to +/// the layer and starts no rename (a double-click on the name renames, as before). +#[test] +fn a_double_click_on_a_layers_icon_zooms_to_it_instead_of_renaming() { + let mut s = Session::new(); + rect(&mut s, "near", 0.0, None); + let far = rect(&mut s, "far", 3000.0, None); + s.execute("select.none", &json!({})).unwrap(); + let mut u = Ui::new(s); + u.frame(vec![]); + let y = u.row_at(far).y; + // The row's left edge: the first point from the left at which the pointer is over it. At depth + // 0 the icon's centre is 8 (margin) + 4 + 22 points further right. + let mut left = None; + for x in 0..150 { + let p = Pos2::new(x as f32, y); + u.app.session.ds_mut().unwrap().hover = None; + u.frame(vec![Event::PointerMoved(p)]); + if u.app.session.ds().unwrap().hover == Some(far) { + left = Some(x as f32); + break; + } + } + let icon = Pos2::new(left.expect("the row has a left edge") + 34.0, y); + let view = |u: &Ui| { + let v = &u.app.session.ds().unwrap().view; + (v.cx, v.cy, v.zoom) + }; + let before = view(&u); + for _ in 0..2 { + u.button(icon, true); + u.button(icon, false); + } + u.frame(vec![]); + assert_eq!(u.app.ui.rename, None, "a double-click on the icon renames nothing"); + assert_eq!(u.app.session.selection(), vec![far], "the layer is selected"); + let after = view(&u); + assert_ne!(after, before, "the view moved"); + u.app.session.execute("view.set", &json!({"cx": before.0, "cy": before.1, "zoom": before.2})).unwrap(); + u.app.session.execute("view.zoomSelection", &json!({})).unwrap(); + assert_eq!(after, view(&u), "the view frames the layer, as view.zoomSelection does"); +} diff --git a/crates/ui-egui/src/panels/layers.rs b/crates/ui-egui/src/panels/layers.rs index 1a62a851c..9eba7e027 100644 --- a/crates/ui-egui/src/panels/layers.rs +++ b/crates/ui-egui/src/panels/layers.rs @@ -1239,7 +1239,8 @@ fn layers(app: &mut FigApp, ui: &mut Ui) { let icon = node_icon(&doc, row.id); let shown = n.visible && !row.dimmed; let icon_col = row_color(&t, is_comp || icon == Icon::Slot, shown, t.icon, t.text_tertiary); - icons::paint(ui.painter(), Rect::from_center_size(pos2(x0 + 22.0, r.center().y), vec2(14.0, 14.0)), icon, icon_col); + let icon_rect = Rect::from_center_size(pos2(x0 + 22.0, r.center().y), vec2(14.0, 14.0)); + icons::paint(ui.painter(), icon_rect, icon, icon_col); let name_x = x0 + 36.0; if app.ui.rename.is_some_and(|rn| rn.id == row.id) { if let Some(new) = rename_field(app, ui, row.id, row.depth, &n.name, r) { @@ -1260,8 +1261,17 @@ fn layers(app: &mut FigApp, ui: &mut Ui) { if resp.clicked() { clicked = Some((row.id, ui.input(|i| i.modifiers))); } - if resp.double_clicked() && !crate::menus::dev_mode_refuses(app, "object.rename") { - app.ui.rename = Some(Rename { id: row.id, start: true }); + if resp.double_clicked() { + // On the icon it zooms to the layer and renames nothing (measured in Figma's web + // app, 2026-11-12); elsewhere on the row it renames. + if resp.interact_pointer_pos().is_some_and(|p| icon_rect.contains(p)) { + if sel.as_slice() != [row.id] { + app.run("select.set", json!({"ids": [row.id]})); + } + app.run("view.zoomSelection", json!({})); + } else if !crate::menus::dev_mode_refuses(app, "object.rename") { + app.ui.rename = Some(Rename { id: row.id, start: true }); + } } if resp.secondary_clicked() { if !sel.contains(&row.id) { diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 1911dbbcd..1ce53206b 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-10 · **Change:** minor (the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (M8: a double-click on a layer's icon zooms to it instead of renaming, measured in Figma's web app on 2026-11-12; the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -49,7 +49,7 @@ interaction feel not yet compared. | Expand and collapse: Alt-click opens or closes everything inside; Collapse layers (Alt+L) keeps the way to the selection open | done | Alt-click pinned (the documentation is silent) | | Drag to reorder and into frames, groups and auto layout: insertion line, spring-loaded open, several layers together, Escape cancels | done | several layers dropped together land together (they split apart before); instances and a layer's own children refuse drops | | Eye and padlock: click, or drag across rows to set several in one step; layers in a locked frame show a faint padlock | done | the toggles no longer vanish under the pointer (clicks on them could miss) (a child's padlock can't be toggled while its parent is locked) | -| Rename: double click, F2 / Cmd+R, Tab to the next row; several layers open Rename layers (match, regular expressions, current name and number codes, start value, preview) | done | numbered in stacking order, pinned | +| Rename: double click, F2 / Cmd+R, Tab to the next row; several layers open Rename layers (match, regular expressions, current name and number codes, start value, preview) | done | numbered in stacking order, pinned; a double-click on a row's icon zooms to the layer (selecting it first) and renames nothing, measured in Figma's web app on 2026-11-12 (`a_double_click_on_a_layers_icon_zooms_to_it_instead_of_renaming`) | | Find layers (filter by name) | done | not covered by the documentation | | Pages: add, rename, drag to reorder, duplicate ("Copy of"), delete, dividers (a blank page named with a hyphen) | done | the line between Pages and Layers drags to size the pages list, kept in the preferences; a long list scrolls in its own area and a page dropped outside the visible list stays put (#272) (`layers_behaviour_tests`) | | Assets panel: folders from page, frames and slash names (fold away), search, thumbnails, drag onto the canvas or into frames and auto layout, Alt-drop swap, enabled libraries | done | Shift+I (Quick insert), Alt+2 and View ▸ Panels ▸ Assets open it; the toolbar's Resources button was removed (the left rail's Assets tab and those shortcuts are the ways in) | @@ -217,6 +217,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| +| 2026-11-12 | patch | M8: a double-click on a layer's icon in the Layers panel selects the layer and zooms the canvas to it (`view.zoomSelection`) and starts no rename, as measured in Figma's web app on 2026-11-12; a double-click on the name or elsewhere on the row still renames; the icon's hit area is the rect the row paints the icon in (`a_double_click_on_a_layers_icon_zooms_to_it_instead_of_renaming`), Rename row | | 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start); FigCraft draws it opaque (how Figma treats a translucent fill was not measured); gradient, image and hidden fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | | 2026-11-10 | minor | The Rotation field shows and sets the layer's rotation on the page (its own angle plus its parents' when no ancestor is flipped; with a flipped ancestor FigCraft reads the composed angle, which flips the sign of the layer's own angle, and Figma's behaviour there was not measured), in frames and groups alike, as measured in Figma's web app for rotated, unflipped parents (#2196) | | 2026-11-09 | patch | M3, #2189: the eyedropper picks the colour the canvas shows. It sampled a 1x1 render without the canvas's magnified-image pixels, so on an image magnified past 2x it blended a 1 px line with its neighbours (#3D444D picked as #343B44 beside #151B23), and the pixel it sampled began at the pointer instead of being centred on it. It now matches the canvas when zoomed in; zoomed out it still samples the full-resolution image, not the smaller copy the canvas may show. Test: `eyedropper_image_tests` | From d773ab2985f1d98ff797494a9fcf7412b1210bc4 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 11:42:22 -0500 Subject: [PATCH 198/239] M8: a pointer on the shape's centre gives the most points atan2 of two zeros reads as 180 degrees, so the centre gave 3; it now gives 60, and the test asserts that exactly. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and fixed --- crates/engine/src/canvas/shape_handles.rs | 5 +++++ crates/engine/src/shape_handles_tests.rs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/canvas/shape_handles.rs b/crates/engine/src/canvas/shape_handles.rs index 726f7d011..b286010ba 100644 --- a/crates/engine/src/canvas/shape_handles.rs +++ b/crates/engine/src/canvas/shape_handles.rs @@ -139,6 +139,11 @@ fn count_at(n: &Node, q: Point) -> Option { return None; } let (x, y) = (q.x / rx - 1.0, q.y / ry - 1.0); + // On the centre there is no direction (atan2 of two zeros would read as 180 degrees): treat it + // as no angle, the most points. + if x.hypot(y) < 1e-9 { + return Some(COUNT_MAX); + } let angle = x.atan2(-y).rem_euclid(std::f64::consts::TAU).to_degrees(); let count = (360.0 / angle.max(1e-9)).round(); count.is_finite().then(|| count.clamp(COUNT_MIN, COUNT_MAX)) diff --git a/crates/engine/src/shape_handles_tests.rs b/crates/engine/src/shape_handles_tests.rs index 65220d7a7..0e3a2f211 100644 --- a/crates/engine/src/shape_handles_tests.rs +++ b/crates/engine/src/shape_handles_tests.rs @@ -160,10 +160,10 @@ fn dragging_the_count_handle_sets_the_count_by_the_angle_about_the_centre() { // The readout is the count. let doc = s.doc().unwrap(); assert_eq!(crate::shape_handles::value(doc, poly, ShapeHandle::Count), Some(4.0)); - // The finite guard: a pointer on the centre gives a finite count. + // A pointer on the centre has no direction: it gives the most points. let h = count_handle(&s, poly); drag(&mut s, (h[0], h[1]), (100.0, 100.0), false); - assert!((3..=60).contains(&count_of(&s, poly))); + assert_eq!(count_of(&s, poly), 60, "a pointer on the centre"); } #[test] From cf80dc1afa68afbc10a4ec22096bfb822ae78f99 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 12:48:18 -0500 Subject: [PATCH 199/239] M8: an icon double-click keeps its selection when a modifier is held egui reports a click on a double-click's release too, so the row's queued click ran after the zoom: with Ctrl held, a double-click on an unselected layer's icon toggled it back out of the selection, and Shift could restore a range. The icon branch now drops the queued click. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 queued; Sonnet 5.5 measured and wrote at medium --- crates/ui-egui/src/layers_behaviour_tests.rs | 58 +++++++++++++++----- crates/ui-egui/src/panels/layers.rs | 2 + 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/crates/ui-egui/src/layers_behaviour_tests.rs b/crates/ui-egui/src/layers_behaviour_tests.rs index 611a202d4..0a825bdbb 100644 --- a/crates/ui-egui/src/layers_behaviour_tests.rs +++ b/crates/ui-egui/src/layers_behaviour_tests.rs @@ -842,6 +842,24 @@ fn search_fields_keep_their_text_in_the_middle() { assert!(off < 1.0, "Search assets is {off} points off the middle"); } +/// The centre of `id`'s icon, a top-level row: the row's left edge is the first point from the +/// left at which the pointer is over it, and the icon's centre is 8 (margin) + 4 + 22 points +/// further right. +fn icon_of(u: &mut Ui, id: NodeId) -> Pos2 { + let y = u.row_at(id).y; + let mut left = None; + for x in 0..150 { + let p = Pos2::new(x as f32, y); + u.app.session.ds_mut().unwrap().hover = None; + u.frame(vec![Event::PointerMoved(p)]); + if u.app.session.ds().unwrap().hover == Some(id) { + left = Some(x as f32); + break; + } + } + Pos2::new(left.expect("the row has a left edge") + 34.0, y) +} + /// Measured in Figma's web app, 2026-11-12: a double-click on a layer's icon zooms the canvas to /// the layer and starts no rename (a double-click on the name renames, as before). #[test] @@ -852,20 +870,7 @@ fn a_double_click_on_a_layers_icon_zooms_to_it_instead_of_renaming() { s.execute("select.none", &json!({})).unwrap(); let mut u = Ui::new(s); u.frame(vec![]); - let y = u.row_at(far).y; - // The row's left edge: the first point from the left at which the pointer is over it. At depth - // 0 the icon's centre is 8 (margin) + 4 + 22 points further right. - let mut left = None; - for x in 0..150 { - let p = Pos2::new(x as f32, y); - u.app.session.ds_mut().unwrap().hover = None; - u.frame(vec![Event::PointerMoved(p)]); - if u.app.session.ds().unwrap().hover == Some(far) { - left = Some(x as f32); - break; - } - } - let icon = Pos2::new(left.expect("the row has a left edge") + 34.0, y); + let icon = icon_of(&mut u, far); let view = |u: &Ui| { let v = &u.app.session.ds().unwrap().view; (v.cx, v.cy, v.zoom) @@ -884,3 +889,28 @@ fn a_double_click_on_a_layers_icon_zooms_to_it_instead_of_renaming() { u.app.session.execute("view.zoomSelection", &json!({})).unwrap(); assert_eq!(after, view(&u), "the view frames the layer, as view.zoomSelection does"); } + +/// A double-click's release is also a click on the row; with Ctrl held it must not toggle the layer +/// back out of the selection the zoom just made, nor can Shift restore a range. +#[test] +fn an_icon_double_click_keeps_its_selection_when_a_modifier_is_held() { + let mut s = Session::new(); + rect(&mut s, "near", 0.0, None); + let far = rect(&mut s, "far", 3000.0, None); + s.execute("select.none", &json!({})).unwrap(); + let mut u = Ui::new(s); + u.frame(vec![]); + let icon = icon_of(&mut u, far); + let before = (u.app.session.ds().unwrap().view.cx, u.app.session.ds().unwrap().view.zoom); + for _ in 0..2 { + for pressed in [true, false] { + let e = Event::PointerButton { pos: icon, button: egui::PointerButton::Primary, pressed, modifiers: CMD }; + u.frame_with(vec![Event::PointerMoved(icon), e], CMD); + } + } + u.frame(vec![]); + assert_eq!(u.app.session.selection(), vec![far], "the layer stays selected"); + assert_eq!(u.app.ui.rename, None); + let v = &u.app.session.ds().unwrap().view; + assert_ne!((v.cx, v.zoom), before, "the view frames the layer"); +} diff --git a/crates/ui-egui/src/panels/layers.rs b/crates/ui-egui/src/panels/layers.rs index 9eba7e027..da7454141 100644 --- a/crates/ui-egui/src/panels/layers.rs +++ b/crates/ui-egui/src/panels/layers.rs @@ -1269,6 +1269,8 @@ fn layers(app: &mut FigApp, ui: &mut Ui) { app.run("select.set", json!({"ids": [row.id]})); } app.run("view.zoomSelection", json!({})); + // The release is also a click: it must not toggle or extend the selection. + clicked = None; } else if !crate::menus::dev_mode_refuses(app, "object.rename") { app.ui.rename = Some(Rename { id: row.id, start: true }); } From 6785be8a3e1e67f775009e47f7f383775be8eb30 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 13:43:50 -0500 Subject: [PATCH 200/239] M8: an icon double-click becomes the range anchor A Shift-double-click on a layer's icon leaves only that layer selected, but the range anchor stayed on the layer clicked before, which was no longer selected, so the next Shift-click toggled instead of selecting a range. The icon branch now makes its layer the anchor. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 queued; Sonnet 5.5 measured and wrote at medium --- crates/ui-egui/src/layers_behaviour_tests.rs | 24 ++++++++++++++++++++ crates/ui-egui/src/panels/layers.rs | 2 ++ 2 files changed, 26 insertions(+) diff --git a/crates/ui-egui/src/layers_behaviour_tests.rs b/crates/ui-egui/src/layers_behaviour_tests.rs index 0a825bdbb..93a80d9bd 100644 --- a/crates/ui-egui/src/layers_behaviour_tests.rs +++ b/crates/ui-egui/src/layers_behaviour_tests.rs @@ -914,3 +914,27 @@ fn an_icon_double_click_keeps_its_selection_when_a_modifier_is_held() { let v = &u.app.session.ds().unwrap().view; assert_ne!((v.cx, v.zoom), before, "the view frames the layer"); } + +/// A Shift-double-click on an icon leaves just that layer selected, and it becomes the anchor: the +/// next Shift-click selects the range from it, not a toggle. +#[test] +fn an_icon_double_click_becomes_the_range_anchor() { + let (mut u, [a, b, c, d]) = four(); + u.frame(vec![]); + let a_row = u.row_at(a); + click(&mut u, a_row, Modifiers::NONE); + let icon = icon_of(&mut u, b); + for _ in 0..2 { + for pressed in [true, false] { + let e = Event::PointerButton { pos: icon, button: egui::PointerButton::Primary, pressed, modifiers: SHIFT }; + u.frame_with(vec![Event::PointerMoved(icon), e], SHIFT); + } + } + for _ in 0..30 { + u.frame(vec![]); + } + assert_eq!(u.app.session.selection(), vec![b], "the icon's layer is all that is selected"); + let d_row = u.row_at(d); + click(&mut u, d_row, SHIFT); + assert_eq!(sorted(u.app.session.selection()), sorted(vec![b, c, d]), "the range from the icon's layer"); +} diff --git a/crates/ui-egui/src/panels/layers.rs b/crates/ui-egui/src/panels/layers.rs index da7454141..d4deb034d 100644 --- a/crates/ui-egui/src/panels/layers.rs +++ b/crates/ui-egui/src/panels/layers.rs @@ -1271,6 +1271,8 @@ fn layers(app: &mut FigApp, ui: &mut Ui) { app.run("view.zoomSelection", json!({})); // The release is also a click: it must not toggle or extend the selection. clicked = None; + // The layer is the anchor of the next Shift-click's range. + app.ui.layer_anchor = Some(row.id); } else if !crate::menus::dev_mode_refuses(app, "object.rename") { app.ui.rename = Some(Rename { id: row.id, start: true }); } From 9467d2355bb56b229922c3399d4a4b7f00d6ff5f Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 13:54:12 -0500 Subject: [PATCH 201/239] M10: CSS code export writes several fills as one layered background, top first, as Figma does (#2271) inspect.code wrote one `background` per visible fill, so only the last survived. A non-text layer now gets one `background` with every visible fill as a layer, top fill first (a document's fills run bottom to top), joined with ", ". A solid above another fill is `linear-gradient(0deg, c, c)` since CSS allows a plain colour only as the last layer; the bottom solid stays a plain colour (and keeps its variable token); gradients, images and patterns keep their layers. A single fill is unchanged. Text keeps one `color` per fill. Tailwind emits a layered value as one `[background:...]` class. Native targets are unchanged. Tests: several_fills_are_one_layered_background_top_first, one_solid_fill_stays_a_plain_colour, several_fills_are_one_layered_background_class. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 queued; Opus 5.5 briefed; Sonnet 5.5 measured and wrote at medium --- crates/engine/src/dev/codegen.rs | 38 +++++++++++++++++++++ crates/engine/src/dev/codegen/css.rs | 51 ++++++++++++++++++++++------ crates/engine/src/dev/tailwind.rs | 19 +++++++++++ crates/engine/src/tailwind_tests.rs | 16 +++++++++ docs/dev-mode-parity.md | 5 +-- 5 files changed, 117 insertions(+), 12 deletions(-) diff --git a/crates/engine/src/dev/codegen.rs b/crates/engine/src/dev/codegen.rs index 202f7ef0f..bbb0415de 100644 --- a/crates/engine/src/dev/codegen.rs +++ b/crates/engine/src/dev/codegen.rs @@ -506,6 +506,44 @@ mod tests { assert!(!css.contains("#000000 0%"), "{css}"); } + /// The measured frame: white at the bottom, a 20% gradient above it, 50% black on top. + fn layered_frame(s: &mut Session) -> figcraft_doc::NodeId { + let f = id_of(&s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 200, "height": 120})).unwrap()["id"]).unwrap(); + let mut g = figcraft_color::Paint::gradient(figcraft_color::Gradient::default_for(figcraft_color::GradientKind::Linear, Color::BLACK)); + g.opacity = 0.2; + let mut top = figcraft_color::Paint::solid(Color::BLACK); + top.opacity = 0.5; + s.doc_mut().unwrap().get_mut(f).unwrap().fills = vec![figcraft_color::Paint::solid(Color::WHITE), g, top]; + f + } + + #[test] + fn several_fills_are_one_layered_background_top_first() { + let mut s = Session::new(); + let f = layered_frame(&mut s); + let css = code_for(s.doc().unwrap(), f, CodeLang::Css); + let bg: Vec<&str> = css.lines().filter(|l| l.starts_with("background:")).collect(); + assert_eq!(bg.len(), 1, "{css}"); + let v = bg[0]; + assert!( + v.starts_with( + "background: linear-gradient(0deg, rgba(0, 0, 0, 0.50), rgba(0, 0, 0, 0.50)), linear-gradient(180deg, rgba(0, 0, 0, 0.20) 0%, " + ), + "{v}" + ); + assert!(v.ends_with(", #FFFFFF;"), "{v}"); + } + + #[test] + fn one_solid_fill_stays_a_plain_colour() { + let mut s = Session::new(); + let f = id_of(&s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 200, "height": 100})).unwrap()["id"]).unwrap(); + s.doc_mut().unwrap().get_mut(f).unwrap().fills = vec![figcraft_color::Paint::solid(Color::WHITE)]; + let css = code_for(s.doc().unwrap(), f, CodeLang::Css); + assert!(css.contains("background: #FFFFFF;\n"), "{css}"); + assert!(!css.contains("gradient"), "{css}"); + } + #[test] fn swiftui_and_compose_for_an_auto_layout_card() { let mut s = Session::new(); diff --git a/crates/engine/src/dev/codegen/css.rs b/crates/engine/src/dev/codegen/css.rs index 46f579123..a5e6726a3 100644 --- a/crates/engine/src/dev/codegen/css.rs +++ b/crates/engine/src/dev/codegen/css.rs @@ -160,17 +160,48 @@ pub(crate) fn css_decls(doc: &Document, n: &Node, t: &mut Tokens, hug: (bool, bo put("transform", format!("rotate({}deg)", num(-rot))); put("transform-origin", "top left".into()); } - for (i, p) in n.fills.iter().enumerate().filter(|(_, p)| p.visible) { - match &p.kind { - PaintKind::Solid { color } => { - let key = if matches!(n.kind, NodeKind::Text(_)) { "color" } else { "background" }; - let c = color.with_alpha(color.a * p.opacity).to_css(); - // A variable binds the first paint's colour. - put(key, if i == 0 { tok(doc, n, &["fill"], c, t) } else { c }); + if matches!(n.kind, NodeKind::Text(_)) { + // Text: a solid is the ink (`color`), one per fill, so the last (top) one wins. + for (i, p) in n.fills.iter().enumerate().filter(|(_, p)| p.visible) { + match &p.kind { + PaintKind::Solid { color } => { + let c = color.with_alpha(color.a * p.opacity).to_css(); + // A variable binds the first paint's colour. + put("color", if i == 0 { tok(doc, n, &["fill"], c, t) } else { c }); + } + PaintKind::Gradient(g) => put("background", css_gradient(g, n.width, n.height, p.opacity)), + PaintKind::Image(_) => put("background", "url(image.png) center / cover".into()), + PaintKind::Pattern(_) => put("background", "url(pattern.png) repeat".into()), } - PaintKind::Gradient(g) => put("background", css_gradient(g, n.width, n.height, p.opacity)), - PaintKind::Image(_) => put("background", "url(image.png) center / cover".into()), - PaintKind::Pattern(_) => put("background", "url(pattern.png) repeat".into()), + } + } else { + // One `background` with every visible fill as a layer, top first (a document's fills run + // bottom to top, as the renderer paints them). CSS allows a plain colour only as the last + // layer, so a solid above another fill becomes a one-colour gradient. + let visible: Vec<(usize, &figcraft_color::Paint)> = n.fills.iter().enumerate().filter(|(_, p)| p.visible).collect(); + let layers: Vec = visible + .iter() + .enumerate() + .rev() + .map(|(pos, (i, p))| match &p.kind { + PaintKind::Solid { color } => { + let c = color.with_alpha(color.a * p.opacity).to_css(); + if pos > 0 { + format!("linear-gradient(0deg, {c}, {c})") + } else if *i == 0 { + // A variable binds the first paint's colour. + tok(doc, n, &["fill"], c, t) + } else { + c + } + } + PaintKind::Gradient(g) => css_gradient(g, n.width, n.height, p.opacity), + PaintKind::Image(_) => "url(image.png) center / cover".into(), + PaintKind::Pattern(_) => "url(pattern.png) repeat".into(), + }) + .collect(); + if !layers.is_empty() { + put("background", layers.join(", ")); } } for (key, value) in css_borders(doc, n, t) { diff --git a/crates/engine/src/dev/tailwind.rs b/crates/engine/src/dev/tailwind.rs index a29c0f316..049122787 100644 --- a/crates/engine/src/dev/tailwind.rs +++ b/crates/engine/src/dev/tailwind.rs @@ -105,6 +105,23 @@ fn arb(v: &str) -> String { format!("[{}]", v.trim().replace('_', "\\_").replace(' ', "_")) } +/// Whether `v` has a comma outside any parentheses (a multi-layer `background`). +fn layered(v: &str) -> bool { + let mut depth = 0usize; + v.chars().any(|c| match c { + '(' => { + depth += 1; + false + } + ')' => { + depth = depth.saturating_sub(1); + false + } + ',' => depth == 0, + _ => false, + }) +} + /// The custom property a `var(--name, fallback)` value reads, when that one call is the whole /// value (not `var(--a, 4px) 8px`, four corners of which only the first is a variable). fn var_name(v: &str) -> Option<&str> { @@ -270,6 +287,8 @@ fn decl(key: &str, value: &str) -> Vec<(String, String)> { Ok(o) if ((o * 100.0).round() - o * 100.0).abs() < 1e-9 => one(format!("opacity-{}", num(o * 100.0))), _ => one(util("opacity", "", v, "")), }, + // Several fills are one layered `background`: commas between the layers, outside any call. + ("background", v) if layered(v) => one(format!("[background:{}]", arb(v).trim_matches(['[', ']']))), ("background", v) if v.contains("gradient(") => one(format!("bg-{}", arb(v))), // An image shorthand (`url(…) center / cover`) is a whole `background`, not a bg colour. ("background", v) if v.starts_with("url(") => one(format!("[background:{}]", arb(v).trim_matches(['[', ']']))), diff --git a/crates/engine/src/tailwind_tests.rs b/crates/engine/src/tailwind_tests.rs index 163e3580c..97e891e6b 100644 --- a/crates/engine/src/tailwind_tests.rs +++ b/crates/engine/src/tailwind_tests.rs @@ -353,3 +353,19 @@ fn font_family_with_quote_and_bracket_stays_a_valid_class_token() { assert!(after.starts_with('>') && !attr.contains('\\'), "{out}"); assert!(!inner.is_empty() && !inner.contains(['\\', '"', ']']), "{out}"); } + +#[test] +fn several_fills_are_one_layered_background_class() { + let mut s = Session::new(); + let f = idv(&ex(&mut s, "frame.create", json!({"x": 0, "y": 0, "width": 200, "height": 120}))); + let mut g = + figcraft_color::Paint::gradient(figcraft_color::Gradient::default_for(figcraft_color::GradientKind::Linear, figcraft_color::Color::BLACK)); + g.opacity = 0.2; + let mut top = figcraft_color::Paint::solid(figcraft_color::Color::BLACK); + top.opacity = 0.5; + s.doc_mut().unwrap().get_mut(f).unwrap().fills = vec![figcraft_color::Paint::solid(figcraft_color::Color::WHITE), g, top]; + let out = code(&mut s, f, json!({})); + let class = out.split(['"', ' ']).find(|c| c.starts_with("[background:")).unwrap_or_default(); + assert!(class.starts_with("[background:linear-gradient(0deg,_rgba(0,_0,_0,_0.50),_rgba(0,_0,_0,_0.50)),_linear-gradient(180deg"), "{out}"); + assert!(class.ends_with(",_#FFFFFF]"), "{out}"); +} diff --git a/docs/dev-mode-parity.md b/docs/dev-mode-parity.md index 66ef3a0ae..07e618495 100644 --- a/docs/dev-mode-parity.md +++ b/docs/dev-mode-parity.md @@ -1,6 +1,6 @@ # Dev Mode parity -> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-09 · **Change:** patch (the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the Inspect tab then opens (never toggles away) with the caret in that layer's new-note field, and the engine never writes the note itself (#1840); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; class names transliterate non-ASCII layer names (#1235); measurements kept on the canvas; a read-only layers panel in Dev Mode; earlier: import lines in generated layer trees; compare with any saved version; Dev Mode behaviour suite: an inspect-only canvas, Changed in the ready list, statuses only on frames and sections; plugin panels from the Inspect tab) · **Target:** Figma Design Dev Mode (desktop app 126.10.7) +> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-12 · **Change:** patch (CSS code export writes several fills as one layered `background`, top first, as the incumbent does (#2271): a solid above another fill becomes a one-colour gradient, the bottom solid stays a plain colour, Tailwind gets one `[background:...]` class; the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the Inspect tab then opens (never toggles away) with the caret in that layer's new-note field, and the engine never writes the note itself (#1840); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; class names transliterate non-ASCII layer names (#1235); measurements kept on the canvas; a read-only layers panel in Dev Mode; earlier: import lines in generated layer trees; compare with any saved version; Dev Mode behaviour suite: an inspect-only canvas, Changed in the ready list, statuses only on frames and sections; plugin panels from the Inspect tab) · **Target:** Figma Design Dev Mode (desktop app 126.10.7) **Breadth ~98%, ready ~78% (estimated).** The inspect surface is broad, components connect to the code components of a repository (with their imports, also inside generated layer trees), @@ -13,7 +13,7 @@ repository, third-party integrations. Remaining: 1–2 h. | 2026-11-07 | patch | Naming: the handoff mode is called Developer Mode in the interface, its shortcut row, its toasts, the control channel's refusal, the board refusal, the measurement parameter doc, the `.fig` export note, the CLI help and every catalog (24 languages, translations awaiting native review), since Figma holds a US registration for Dev Mode (7574348); command ids (`view.devMode`, `devMode.*`), preference keys and saved-document fields are unchanged, and the Actions palette still finds the command by the old name | | Dev Mode toggle (Shift+D), Inspect panel | done | the canvas only inspects: presses select, pan and comment but never move, resize, draw or edit text and vectors; menus and shortcuts refuse design edits with a note (Dev Mode's annotations, statuses, dev resources, measurements, code connections and comments still work); a drawing tool chosen in the toolbar goes back to the design. The layers panel only selects and expands (no renaming, reordering, hiding or locking; a double click says why), and the Pages list only opens pages (no adding, renaming, reordering, duplicating or deleting). Files dropped on the canvas aren't imported (a dropped document still opens as a file of its own), and the Assets panel places, swaps and applies nothing, doesn't change Hide when publishing, and doesn't accept library updates or add, remove or swap libraries; each says why | | Properties with their styles and variables; redlines on hover | done | positions from the frame around the layer (groups aren't frames), rotation, radius (CSS corner order), opacity, blend; colours in hex, RGB, CSS, HSL or HSB (`inspect.properties {colorFormat}`, the Inspect tab's Color format) | -| Code: CSS, iOS (SwiftUI), Android (Compose), Flutter | done | plus HTML, React, Vue and Leptos (ours; Leptos: `#[component]` functions with `#[prop]` defaults, variant enums and `view!` markup; Flutter is ours too: a `StatelessWidget` for a component, a widget tree for a layer); components take properties as parameters, instances are calls; CSS in px or rem (`inspect.code {unit, rootFontSize}`), with rotation, blend modes, gradient directions and kinds (linear, radial, conic), text alignment, case and decoration; class names from layer names transliterate non-ASCII scripts into readable ASCII (로그인 화면 → `rogeuin-hwamyeon`, кнопка → `knopka`, über → `uber`; symbols-only names take the node's kind, `.text`), and the 40-character cut lands on a word boundary (#1235) | +| Code: CSS, iOS (SwiftUI), Android (Compose), Flutter | done | plus HTML, React, Vue and Leptos (ours; Leptos: `#[component]` functions with `#[prop]` defaults, variant enums and `view!` markup; Flutter is ours too: a `StatelessWidget` for a component, a widget tree for a layer); components take properties as parameters, instances are calls; CSS in px or rem (`inspect.code {unit, rootFontSize}`), with rotation, blend modes, several fills as one layered `background` (top first), gradient directions and kinds (linear, radial, conic), text alignment, case and decoration; class names from layer names transliterate non-ASCII scripts into readable ASCII (로그인 화면 → `rogeuin-hwamyeon`, кнопка → `knopka`, über → `uber`; symbols-only names take the node's kind, `.text`), and the 40-character cut lands on a word boundary (#1235) | | Assets list with export | done | layers with export settings, icons (small, vector shapes only: SVG) and images (PNG); the icon rule is ours | | Annotations: pinned properties, categories, coloured callouts, filter | done | the Annotation tool (Shift+T, `tool.annotation`) picks a layer by a click or from the selection and opens its note field in the Inspect tab. Figma's placement, cursor and whether the tool stays selected are unmeasured (Developer Mode is paywalled in the web app); staying selected until V or Escape, like the Comment tool, is inferred, and there is no toolbar button or icon yet | | Ready for dev list, statuses, "Changed" after edits | done | the list filters Ready for dev, Changed, Completed or any, and badges changed ones (`inspect.readyForDev {status: changed}`, `changed` per item); only sections and frames at the top of a page or section take a status (others are refused) | @@ -29,6 +29,7 @@ repository, third-party integrations. Remaining: 1–2 h. | Date | Change | Summary | |---|---|---| +| 2026-11-12 | patch | CSS code export (#2271): a layer with several fills wrote one `background` per fill, so only the last survived. It now writes one `background` with every visible fill as a layer, top fill first, comma-separated: a solid above another fill is `linear-gradient(0deg, c, c)` (CSS allows a plain colour only as the last layer), the bottom solid stays a plain colour (with its variable), images and patterns keep their `url(...)` layers. Tailwind output carries the layered value as one `[background:...]` class. Text keeps one `color` per fill. Native targets unchanged. Percentages and hours unchanged | | 2026-11-09 | patch | The Annotation tool (Shift+T, `tool.annotation {id?}`): selects the layer pressed on (or the selection, or `id`) and asks the UI for its note, which the Inspect tab takes in its new-note field; the engine writes nothing itself, and Developer Mode lets the tool through its gates (#1840). Figma's placement, cursor and whether the tool stays selected are unmeasured (Developer Mode is paywalled in the web app); staying selected until V or Escape, like the Comment tool, is inferred, and there is no toolbar button or icon yet | | 2026-10-30 | minor | Gap 16: `figcraft-cli connect publish [--mappings figcraft.connect.json] [--dry-run]` publishes a code repository's mappings to a design file (as the incumbent's Code Connect CLI publishes a repository's mappings): it links each entry's component or set by name, warns about and skips links that don't fit, saves the file in place through the engine's save (or not, with `--dry-run`) and fails when nothing links. Dev Mode breadth (~98%) and ready (~78%) unchanged at this rounding; hours unchanged | | 2026-10-26 | minor | Class names from layer names transliterate non-ASCII scripts (#1235): `class_name` runs names through `deunicode` (new dependency: pure Rust tables, zero deps, BSD-3-Clause), so Korean, Cyrillic, Latin-diacritic and CJK names become readable ASCII classes in HTML/CSS/React/Leptos output, component roots and `data-*` variant attributes (`rogeuin-hwamyeon`, `knopka`, `uber`, `an-niu`; before, every one of them came out `layer-`); symbols-only names take the node's kind (`.text`, `.frame`) instead of `layer-`, and the 40-character cut lands on a word boundary. ASCII-only names are unchanged. `html_codegen_tests` updated (its diacritics expectation improves from `layer-1-n-code-name` to `layer-1-unicode-name`) and extended. Percentages and hours unchanged | From 976e57a205e46da6ae54659943f99d1d8f860321 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 12 Nov 2026 11:01:03 -0800 Subject: [PATCH 202/239] Updates: take craft-update from craft-libs main at e98299546 craft-libs e98299546 includes #923: the check of whether the copy can install itself now runs on the update-check thread instead of in Updater::tick on the UI thread. --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b7990a4ee..37e09b205 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1134,7 +1134,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=6e03f65bf45181db77ba6229716e6624db9eb25b#6e03f65bf45181db77ba6229716e6624db9eb25b" +source = "git+https://github.com/storytold/craft-libs?rev=e98299546f5c5c3c22388d16507f8b5e61a5f280#e98299546f5c5c3c22388d16507f8b5e61a5f280" dependencies = [ "chrono", "dunce", diff --git a/Cargo.toml b/Cargo.toml index 80ca99a27..0d6e387ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-l # pull a second egui family version). craft-window = { git = "https://github.com/storytold/craft-libs", rev = "e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" } # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "6e03f65bf45181db77ba6229716e6624db9eb25b", features = ["egui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "e98299546f5c5c3c22388d16507f8b5e61a5f280", features = ["egui"] } # The suite's font store: exact lookup of a missing font in the pinned Google Fonts and Noto # indexes, and checksum-verified installs into the one folder every Craft app reads (craft-libs). craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" } From b72112ff7809cdf5af7f456a4209d8cfcd151659 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 14:42:55 -0500 Subject: [PATCH 203/239] Clippy 1.100: fix the new needless_bool and unused ExitCode lints CI now installs rustc/clippy 1.100.0, which flags code nobody changed. No behaviour changes. - clippy::needless_bool: crates/ui-egui/src/shortcuts.rs (end of the arrow-key handler), the `if ... { return true; } false` tail becomes the boolean expression itself. - unused_must_use (`test::ExitCode`): apps/figcraft-cli/src/files.rs, three tests that call `run_script(...).unwrap()` and only check the output file; the result is now bound with `let _ =`. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- apps/figcraft-cli/src/files.rs | 6 +++--- crates/ui-egui/src/shortcuts.rs | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/figcraft-cli/src/files.rs b/apps/figcraft-cli/src/files.rs index a7bddeb3b..a2d6265fb 100644 --- a/apps/figcraft-cli/src/files.rs +++ b/apps/figcraft-cli/src/files.rs @@ -670,7 +670,7 @@ mod tests { ) .unwrap(); let out = dir.join("out.figcraft"); - run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(); + let _ = run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(); let mut s = Session::empty(); s.execute("file.open", &json!({"path": out.to_str().unwrap()})).unwrap(); @@ -700,7 +700,7 @@ mod tests { ) .unwrap(); let out = dir.join("out.figcraft"); - run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(); + let _ = run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(); let mut s = Session::empty(); s.execute("file.open", &json!({"path": out.to_str().unwrap()})).unwrap(); @@ -737,7 +737,7 @@ mod tests { .unwrap(); let out = dir.join("out.figcraft"); // The failure is the script's, not the call's: the CLI reports it and exits non-zero. - run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(); + let _ = run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(); assert!(!out.exists(), "a script that failed writes nothing"); std::fs::remove_dir_all(dir).unwrap(); } diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index 3d312387b..1cac67b4b 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -521,10 +521,7 @@ fn key_event(app: &mut FigApp, key: Key, physical: Option, m: Modifiers, re } return true; } - if m.is_none() && !repeat && opacity_digit(app, key, now) { - return true; - } - false + m.is_none() && !repeat && opacity_digit(app, key, now) } /// Keys while a selection box drawn from the keyboard shows (`select.area`, Alt+Space or Ctrl+Space, From cfd6bf5273f1e645a864e387a8b6f1efb254e544 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 16:18:06 -0500 Subject: [PATCH 204/239] M8: Tidy up keeps the order and sizes and evens the gaps, as measured in Figma Measured in Figma's web app on 2026-11-12 (top-level rectangles): a row, a column and a 2 x 3 grid of unequal sizes, eight runs on the gap, and the cases where Tidy up is greyed out (fewer than three layers, overlapping layers). Figma keeps the order, the sizes and the first layer, evens one gap per axis (the most common existing gap, else the mean taken down to a whole number) and tidies a grid by columns. Choices, not measured: the smaller of two equally common gaps, a mean ending in .5 going down, gaps a pixel apart differing, a diagonal being a row, a grid with an empty place, a grid always read by columns, one overlapping pair making it unavailable, auto layout flow children making it unavailable, the 2,000 layer cap, rotated layers by their box, spacing with two layers, and no rounding with Snap to pixel grid off. A selection that is none of a row, a column or a grid keeps the earlier rule unchanged. The Design panel's Tidy up row is greyed out with a tip when unavailable; the command then moves nothing and adds no undo step. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 briefed; Sonnet 5.5 measured and wrote at medium --- crates/engine/src/cmd/arrange.rs | 60 ++---- crates/engine/src/lib.rs | 3 + crates/engine/src/selection.rs | 1 + crates/engine/src/selection/tidy.rs | 260 ++++++++++++++++++++++++++ crates/engine/src/tidy_tests.rs | 279 ++++++++++++++++++++++++++++ crates/ui-egui/locales/en.toml | 1 + crates/ui-egui/src/lib.rs | 2 + crates/ui-egui/src/panels/right.rs | 20 +- crates/ui-egui/src/tidy_tests.rs | 30 +++ docs/ui-parity.md | 4 +- 10 files changed, 610 insertions(+), 50 deletions(-) create mode 100644 crates/engine/src/selection/tidy.rs create mode 100644 crates/engine/src/tidy_tests.rs create mode 100644 crates/ui-egui/src/tidy_tests.rs diff --git a/crates/engine/src/cmd/arrange.rs b/crates/engine/src/cmd/arrange.rs index 88146ea95..43bf7efc5 100644 --- a/crates/engine/src/cmd/arrange.rs +++ b/crates/engine/src/cmd/arrange.rs @@ -223,53 +223,25 @@ fn distribute(s: &mut Session, p: &Value, horizontal: bool) -> Result { ok() } -/// Tidy up: snap the selection into a grid of rows/columns with even spacing. +/// Tidy up: even the gaps of a row, a column or a grid, keeping the order and sizes (see +/// `selection::tidy`). Nothing moves, and no undo step is added, when it is unavailable. fn tidy(s: &mut Session, p: &Value) -> Result { let ids = req_targets("arrange.tidy", s, p)?; + let spacing = num(p, "spacing"); + if spacing.is_some_and(|v| !v.is_finite() || v.abs() > 1_000_000.0) { + return Err(bad("arrange.tidy", "spacing out of range")); + } + let snap = s.ds()?.view.snap_pixel; + let moves = crate::tidy::tidy_moves(s.doc()?, &ids, spacing, snap); + if moves.is_empty() { + return ok(); + } + if moves.iter().any(|(_, dx, dy)| !dx.is_finite() || !dy.is_finite()) { + return Err(bad("arrange.tidy", "non-finite result")); + } let doc = s.doc_mut()?; - let ids = roots(doc, &ids); - let mut items: Vec<(NodeId, Rect)> = ids.iter().filter_map(|i| doc.world_bounds(*i).map(|b| (*i, b))).collect(); - if items.len() < 2 { - return ok(); - } - // Group into rows by vertical centre overlap. - items.sort_by(|a, b| a.1.y0.total_cmp(&b.1.y0)); - let mut rows: Vec> = Vec::new(); - for it in items { - match rows.last_mut() { - Some(row) if row.iter().any(|(_, b)| it.1.center().y < b.y1 && it.1.center().y > b.y0) => row.push(it), - _ => rows.push(vec![it]), - } - } - let all: Vec = rows.iter().flatten().map(|(_, b)| *b).collect(); - let (Some(origin), maxw, maxh) = ( - all.iter().copied().reduce(|a, b| a.union(b)), - all.iter().map(Rect::width).fold(0.0, f64::max), - all.iter().map(Rect::height).fold(0.0, f64::max), - ) else { - return ok(); - }; - let gap = num(p, "spacing").unwrap_or_else(|| { - // Keep the average existing horizontal gap (min 10). - 10f64.max( - rows.iter() - .filter(|r| r.len() > 1) - .map(|r| { - (r.iter().map(|(_, b)| b.x1).fold(f64::MIN, f64::max) - - r.iter().map(|(_, b)| b.x0).fold(f64::MAX, f64::min) - - r.iter().map(|(_, b)| b.width()).sum::()) - / (r.len() - 1) as f64 - }) - .fold(0.0, f64::max), - ) - }); - for (ri, row) in rows.iter_mut().enumerate() { - row.sort_by(|a, b| a.1.x0.total_cmp(&b.1.x0)); - for (ci, (id, b)) in row.iter().enumerate() { - let x = origin.x0 + ci as f64 * (maxw + gap); - let y = origin.y0 + ri as f64 * (maxh + gap); - move_world(doc, *id, x - b.x0, y - b.y0)?; - } + for (id, dx, dy) in moves { + move_world(doc, id, dx, dy)?; } ok() } diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 39ead2e82..fc8ab8c4d 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -77,6 +77,7 @@ pub use selection::rename; pub use selection::selection_colors; pub use selection::selection_reorder; pub use selection::selection_spacing; +pub use selection::tidy; pub use sharing::agent; pub use sharing::background; pub use sharing::branches; @@ -609,6 +610,8 @@ mod textfit_tests; #[cfg(test)] mod theme_pages_tests; #[cfg(test)] +mod tidy_tests; +#[cfg(test)] mod tiff_tests; #[cfg(test)] mod transform_behaviour_tests; diff --git a/crates/engine/src/selection.rs b/crates/engine/src/selection.rs index 08ab6456f..fa901b563 100644 --- a/crates/engine/src/selection.rs +++ b/crates/engine/src/selection.rs @@ -2,3 +2,4 @@ pub mod rename; pub mod selection_colors; pub mod selection_reorder; pub mod selection_spacing; +pub mod tidy; diff --git a/crates/engine/src/selection/tidy.rs b/crates/engine/src/selection/tidy.rs new file mode 100644 index 000000000..a802aeccc --- /dev/null +++ b/crates/engine/src/selection/tidy.rs @@ -0,0 +1,260 @@ +//! Tidy up: the moves that even a selection's gaps the way Figma's web app does. +//! +//! Measured in Figma's web app on 2026-11-12 (top-level rectangles): a row, a column and a 2 x 3 +//! grid of unequal sizes, and eight runs on the gap. Figma keeps the order and the sizes of every +//! layer and keeps the first layer where it is. A row evens its horizontal gaps and keeps every Y, +//! a column the mirror image. The one gap is the most common existing gap, else the mean of the +//! gaps taken down to a whole number. A grid is tidied by columns: each column is as wide as its +//! widest layer, centred where its layers were, the columns are evened, every layer is centred in +//! its column and every column is stacked from the selection's top. Tidy up is greyed out for fewer +//! than three layers and for layers that overlap. +//! +//! Not measured, FigCraft's choices: the smaller of two equally common gaps; a mean ending in .5 +//! going down; gaps a pixel apart being different gaps; a diagonal being a row; a grid with an +//! empty place; a grid always read by columns; one overlapping pair among other layers making it +//! unavailable; layers in an auto layout flow making it unavailable; the 2,000 layer cap; rotated +//! layers counting by their box; an explicit `spacing` taking two layers; no rounding in a grid +//! with Snap to pixel grid off. A selection that is none of a row, a column or a grid keeps the +//! earlier rule (the cells of the largest layer). + +use std::collections::BTreeSet; + +use figcraft_doc::{Document, NodeId}; +use figcraft_geom::Rect; + +use crate::cmd::edit::roots; + +const EPS: f64 = 0.01; +const MAX_LAYERS: usize = 2000; + +type Item = (NodeId, Rect); +type Move = (NodeId, f64, f64); + +/// Whether Tidy up is offered for `ids`: three to 2,000 layers with boxes, none in an auto layout +/// flow, none overlapping another. +pub fn can_tidy(doc: &Document, ids: &[NodeId]) -> bool { + available(doc, ids, 3).is_some() +} + +/// The page-space moves that tidy `ids` (empty when unavailable or when nothing would move). +/// `spacing` sets the gap and lets two layers through; `snap` rounds a grid's column positions to +/// whole pixels. +pub(crate) fn tidy_moves(doc: &Document, ids: &[NodeId], spacing: Option, snap: bool) -> Vec { + let min = if spacing.is_some() { 2 } else { 3 }; + let Some(items) = available(doc, ids, min) else { return Vec::new() }; + let cols = groups(&items, false); + let rows = groups(&items, true); + let moves = if cols.len() == items.len() { + line_moves(&items, false, spacing) + } else if rows.len() == items.len() { + line_moves(&items, true, spacing) + } else if is_grid(&cols, &rows) { + grid_moves(&cols, spacing, snap) + } else { + irregular_moves(items, spacing) + }; + moves.into_iter().filter(|(_, dx, dy)| !(dx.is_finite() && dy.is_finite()) || dx.abs() > 1e-9 || dy.abs() > 1e-9).collect() +} + +fn available(doc: &Document, ids: &[NodeId], min: usize) -> Option> { + let mut seen = BTreeSet::new(); + let ids: Vec = roots(doc, ids).into_iter().filter(|i| seen.insert(*i)).collect(); + if ids.len() < min || ids.len() > MAX_LAYERS { + return None; + } + let mut items = Vec::with_capacity(ids.len()); + for id in ids { + let n = doc.node(id)?; + if n.parent.and_then(|p| doc.node(p)).is_some_and(|p| p.layout.is_some() && !n.child_layout.absolute) { + return None; + } + let b = doc.world_bounds(id)?; + if ![b.x0, b.y0, b.x1, b.y1].into_iter().all(f64::is_finite) { + return None; + } + items.push((id, b)); + } + let overlapping = items.iter().enumerate().any(|(i, a)| items.iter().skip(i + 1).any(|b| overlap(a.1, b.1))); + if overlapping { None } else { Some(items) } +} + +/// Two boxes overlap when they share more than `EPS` on both axes; touching edges do not count. +fn overlap(a: Rect, b: Rect) -> bool { + a.x1.min(b.x1) - a.x0.max(b.x0) > EPS && a.y1.min(b.y1) - a.y0.max(b.y0) > EPS +} + +fn span(b: Rect, vertical: bool) -> (f64, f64) { + if vertical { (b.y0, b.y1) } else { (b.x0, b.x1) } +} + +/// Columns (`vertical` false) or rows: the layers whose ranges on the axis overlap, transitively, +/// in order along the axis. +fn groups(items: &[Item], vertical: bool) -> Vec> { + let mut sorted = items.to_vec(); + sorted.sort_by(|a, b| span(a.1, vertical).0.total_cmp(&span(b.1, vertical).0)); + let mut out: Vec> = Vec::new(); + let mut end = f64::MIN; + for it in sorted { + let (lo, hi) = span(it.1, vertical); + match out.last_mut() { + Some(group) if lo < end - EPS => { + group.push(it); + end = end.max(hi); + } + _ => { + out.push(vec![it]); + end = hi; + } + } + } + out +} + +/// No two layers share both a column and a row. +fn is_grid(cols: &[Vec], rows: &[Vec]) -> bool { + cols.iter().all(|c| rows.iter().all(|r| c.iter().filter(|a| r.iter().any(|b| b.0 == a.0)).count() <= 1)) +} + +/// The one gap an axis is evened to: `spacing`, a single gap, the most common gap, else the mean +/// taken down to a whole number. +fn even_gap(gaps: &[f64], spacing: Option) -> f64 { + if let Some(s) = spacing { + return s; + } + if let [only] = gaps { + return *only; + } + let count = |g: f64| gaps.iter().filter(|o| (**o - g).abs() <= EPS).count(); + let best = gaps.iter().copied().map(|g| (count(g), g)).reduce(|a, b| if b.0 > a.0 || (b.0 == a.0 && b.1 < a.1) { b } else { a }); + match best { + Some((n, g)) if n >= 2 => g, + _ if gaps.is_empty() => 0.0, + _ => (gaps.iter().sum::() / gaps.len() as f64 + 1e-9).floor(), + } +} + +/// A row (`vertical` false) or a column: the first layer stays, each next one follows the last at +/// the even gap, the other axis is untouched. +fn line_moves(items: &[Item], vertical: bool, spacing: Option) -> Vec { + let mut line = items.to_vec(); + line.sort_by(|a, b| span(a.1, vertical).0.total_cmp(&span(b.1, vertical).0)); + let gaps: Vec = line + .windows(2) + .filter_map(|w| match w { + [a, b] => Some(span(b.1, vertical).0 - span(a.1, vertical).1), + _ => None, + }) + .collect(); + let gap = even_gap(&gaps, spacing); + let mut pos = line.first().map_or(0.0, |i| span(i.1, vertical).0); + let mut out = Vec::with_capacity(line.len()); + for (id, b) in line { + let (lo, hi) = span(b, vertical); + let d = pos - lo; + pos += (hi - lo) + gap; + out.push(if vertical { (id, 0.0, d) } else { (id, d, 0.0) }); + } + out +} + +fn snap_to(v: f64, snap: bool) -> f64 { + if snap { (v + 0.5).floor() } else { v } +} + +/// A column box: where it starts and how wide it is (its widest layer, around the middle of the +/// column's X range). +fn column_box(col: &[Item]) -> (f64, f64) { + let lo = col.iter().map(|i| i.1.x0).fold(f64::MAX, f64::min); + let hi = col.iter().map(|i| i.1.x1).fold(f64::MIN, f64::max); + let w = col.iter().map(|i| i.1.width()).fold(0.0, f64::max); + ((lo + hi) / 2.0 - w / 2.0, w) +} + +/// Vertical gaps inside every column, pooled. +fn column_gaps(cols: &[Vec]) -> Vec { + let mut out = Vec::new(); + for col in cols { + let mut c = col.clone(); + c.sort_by(|a, b| a.1.y0.total_cmp(&b.1.y0)); + out.extend(c.windows(2).filter_map(|w| match w { + [a, b] => Some(b.1.y0 - a.1.y1), + _ => None, + })); + } + out +} + +fn grid_moves(cols: &[Vec], spacing: Option, snap: bool) -> Vec { + let boxes: Vec<(f64, f64)> = cols.iter().map(|c| column_box(c)).collect(); + let across: Vec = boxes + .windows(2) + .filter_map(|w| match w { + [a, b] => Some(b.0 - (a.0 + a.1)), + _ => None, + }) + .collect(); + let gx = even_gap(&across, spacing); + let gy = even_gap(&column_gaps(cols), spacing); + let top = cols.iter().flatten().map(|i| i.1.y0).fold(f64::MAX, f64::min); + let mut left = boxes.first().map_or(0.0, |b| snap_to(b.0, snap)); + let mut out = Vec::new(); + for (col, (_, w)) in cols.iter().zip(&boxes) { + let mut c = col.clone(); + c.sort_by(|a, b| a.1.y0.total_cmp(&b.1.y0)); + let mut y = top; + for (id, b) in c { + let x = snap_to(left + (w - b.width()) / 2.0, snap); + out.push((id, x - b.x0, y - b.y0)); + y += b.height() + gy; + } + left += w + gx; + } + out +} + +/// The earlier rule, unchanged: rows by overlapping vertical centres on a grid whose every cell is +/// the largest layer's size, from the union's top left, at the average horizontal gap (at least 10). +fn irregular_moves(mut items: Vec, spacing: Option) -> Vec { + items.sort_by(|a, b| a.1.y0.total_cmp(&b.1.y0)); + let mut rows: Vec> = Vec::new(); + for it in items { + match rows.last_mut() { + Some(row) if row.iter().any(|(_, b)| it.1.center().y < b.y1 && it.1.center().y > b.y0) => row.push(it), + _ => rows.push(vec![it]), + } + } + let all: Vec = rows.iter().flatten().map(|(_, b)| *b).collect(); + let (Some(origin), maxw, maxh) = ( + all.iter().copied().reduce(|a, b| a.union(b)), + all.iter().map(Rect::width).fold(0.0, f64::max), + all.iter().map(Rect::height).fold(0.0, f64::max), + ) else { + return Vec::new(); + }; + let gap = spacing.unwrap_or_else(|| average_gap(&rows)); + let mut out = Vec::new(); + for (ri, row) in rows.iter_mut().enumerate() { + row.sort_by(|a, b| a.1.x0.total_cmp(&b.1.x0)); + for (ci, (id, b)) in row.iter().enumerate() { + let x = origin.x0 + ci as f64 * (maxw + gap); + let y = origin.y0 + ri as f64 * (maxh + gap); + out.push((*id, x - b.x0, y - b.y0)); + } + } + out +} + +/// The average existing horizontal gap of the widest row, at least 10. +fn average_gap(rows: &[Vec]) -> f64 { + 10f64.max( + rows.iter() + .filter(|r| r.len() > 1) + .map(|r| { + (r.iter().map(|(_, b)| b.x1).fold(f64::MIN, f64::max) + - r.iter().map(|(_, b)| b.x0).fold(f64::MAX, f64::min) + - r.iter().map(|(_, b)| b.width()).sum::()) + / (r.len() - 1) as f64 + }) + .fold(0.0, f64::max), + ) +} diff --git a/crates/engine/src/tidy_tests.rs b/crates/engine/src/tidy_tests.rs new file mode 100644 index 000000000..41eff8d2c --- /dev/null +++ b/crates/engine/src/tidy_tests.rs @@ -0,0 +1,279 @@ +//! Tidy up (`arrange.tidy`) against what was measured in Figma's web app on 2026-11-12: a row, a +//! column and a 2 x 3 grid of unequal sizes, eight runs on the gap, and the cases where the menu +//! row is greyed out. Figma keeps the order and sizes, evens one gap per axis and keeps the first +//! layer where it is. Tests whose message says "not measured in Figma" pin FigCraft's own choice. + +use crate::Session; +use figcraft_doc::NodeId; +use serde_json::json; + +fn make(s: &mut Session, x: f64, y: f64, w: f64, h: f64) -> NodeId { + NodeId(s.execute("shape.rectangle", &json!({"x": x, "y": y, "width": w, "height": h})).unwrap()["id"].as_u64().unwrap()) +} +fn xy(s: &Session, id: NodeId) -> (f64, f64) { + let b = s.doc().unwrap().world_bounds(id).unwrap(); + (b.x0, b.y0) +} +fn size(s: &Session, id: NodeId) -> (f64, f64) { + let n = s.doc().unwrap().node(id).unwrap(); + (n.width, n.height) +} +fn tidy(s: &mut Session, ids: &[NodeId]) { + s.execute("arrange.tidy", &json!({"ids": ids})).unwrap(); +} +fn can(s: &Session, ids: &[NodeId]) -> bool { + crate::tidy::can_tidy(s.doc().unwrap(), ids) +} +fn all_xy(s: &Session, ids: &[NodeId]) -> Vec<(f64, f64)> { + ids.iter().map(|i| xy(s, *i)).collect() +} +/// Squares of 50 at Y 0 with the given X values. +fn squares(s: &mut Session, xs: &[f64]) -> Vec { + xs.iter().map(|x| make(s, *x, 0.0, 50.0, 50.0)).collect() +} +fn xs_of(s: &Session, ids: &[NodeId]) -> Vec { + ids.iter().map(|i| xy(s, *i).0).collect() +} + +fn row(s: &mut Session, xs: [f64; 4]) -> Vec { + vec![make(s, xs[0], 0., 50., 30.), make(s, xs[1], 10., 70., 50.), make(s, xs[2], -5., 40., 40.), make(s, xs[3], 8., 60., 20.)] +} +fn grid(s: &mut Session) -> Vec { + vec![ + make(s, 0., 0., 50., 30.), + make(s, 80., 5., 70., 50.), + make(s, 190., -3., 40., 40.), + make(s, 2., 90., 60., 20.), + make(s, 85., 95., 40., 50.), + make(s, 200., 92., 55., 35.), + ] +} + +#[test] +fn a_row_keeps_its_order_sizes_and_y_and_evens_the_gaps() { + let mut s = Session::new(); + let ids = row(&mut s, [0., 80., 190., 260.]); + let before = s.undo_depth(); + tidy(&mut s, &ids); + assert_eq!(all_xy(&s, &ids), vec![(0., 0.), (80., 10.), (180., -5.), (250., 8.)]); + assert_eq!(size(&s, ids[1]), (70., 50.)); + assert_eq!(size(&s, ids[3]), (60., 20.)); + assert_eq!(s.undo_depth().0, before.0 + 1); + s.undo().unwrap(); + assert_eq!(xy(&s, ids[3]), (260., 8.)); +} + +#[test] +fn gaps_that_all_differ_take_their_mean_taken_down() { + let mut s = Session::new(); + let ids = row(&mut s, [0., 130., 220., 305.]); + tidy(&mut s, &ids); + assert_eq!(all_xy(&s, &ids), vec![(0., 0.), (98., 10.), (216., -5.), (304., 8.)]); + // Gaps 30, 40, 21 (the third layer 49 wide, 50 tall). + let mut s = Session::new(); + let ids = + vec![make(&mut s, 0., 0., 50., 30.), make(&mut s, 80., 10., 70., 50.), make(&mut s, 190., -5., 49., 50.), make(&mut s, 260., 8., 60., 20.)]; + tidy(&mut s, &ids); + assert_eq!(xs_of(&s, &ids), vec![0., 80., 180., 259.]); +} + +#[test] +fn a_column_keeps_x_and_evens_the_vertical_gaps() { + let mut s = Session::new(); + let ids = + vec![make(&mut s, 0., 0., 50., 30.), make(&mut s, 8., 60., 70., 50.), make(&mut s, -5., 150., 40., 40.), make(&mut s, 6., 220., 60., 20.)]; + tidy(&mut s, &ids); + assert_eq!(all_xy(&s, &ids), vec![(0., 0.), (8., 60.), (-5., 140.), (6., 210.)]); +} + +#[test] +fn the_gap_is_the_most_common_one_else_the_mean() { + // (X before, widths, X after): cases 1, 2, 3, 4, 5, 7 and 8 of the second run. + let cases: [(&[f64], &[f64], &[f64]); 7] = [ + (&[0., 60., 160.], &[50., 50., 50.], &[0., 80., 160.]), + (&[0., 100., 160.], &[50., 50., 50.], &[0., 80., 160.]), + (&[0., 70., 140.], &[50., 50., 50.], &[0., 70., 140.]), + (&[0., 50., 160.], &[50., 50., 50.], &[0., 80., 160.]), + (&[0., 60., 120., 240.], &[50., 50., 50., 50.], &[0., 60., 120., 180.]), + (&[0., 70., 210.], &[50., 100., 30.], &[0., 80., 210.]), + (&[0., 60., 120., 220., 360.], &[50., 50., 50., 50., 50.], &[0., 60., 120., 180., 240.]), + ]; + for (n, (before, widths, after)) in cases.iter().enumerate() { + let mut s = Session::new(); + let ids: Vec = before.iter().zip(widths.iter()).map(|(x, w)| make(&mut s, *x, 0., *w, 50.)).collect(); + tidy(&mut s, &ids); + assert_eq!(xs_of(&s, &ids), after.to_vec(), "case {n}"); + assert!(xy(&s, ids[0]).1 == 0.0 && xy(&s, ids[1]).1 == 0.0, "case {n}: Y kept"); + } +} + +#[test] +fn a_grid_is_tidied_by_columns() { + let mut s = Session::new(); + let ids = grid(&mut s); + tidy(&mut s, &ids); + assert_eq!(all_xy(&s, &ids), vec![(6., -3.), (93., -3.), (203., -3.), (1., 78.), (108., 98.), (195., 88.)]); + assert_eq!(size(&s, ids[4]), (40., 50.)); +} + +#[test] +fn two_layers_and_overlapping_layers_are_left_alone() { + let mut s = Session::new(); + let two = squares(&mut s, &[0., 87.]); + let before = (all_xy(&s, &two), s.undo_depth()); + tidy(&mut s, &two); + assert_eq!((all_xy(&s, &two), s.undo_depth()), before, "two layers"); + assert!(!can(&s, &two)); + + let mut s = Session::new(); + let tri = vec![make(&mut s, 100., 460., 50., 30.), make(&mut s, 140., 430., 80., 60.), make(&mut s, 130., 400., 30., 90.)]; + let before = (all_xy(&s, &tri), s.undo_depth()); + tidy(&mut s, &tri); + assert_eq!((all_xy(&s, &tri), s.undo_depth()), before, "overlapping triple"); + assert!(!can(&s, &tri)); +} + +#[test] +fn a_tidy_that_moves_nothing_adds_no_undo_step() { + let mut s = Session::new(); + let ids = squares(&mut s, &[0., 70., 140.]); + let before = s.undo_depth(); + tidy(&mut s, &ids); + assert_eq!(s.undo_depth(), before); + assert_eq!(xs_of(&s, &ids), vec![0., 70., 140.]); + assert!(can(&s, &ids)); +} + +#[test] +fn two_equally_common_gaps_give_the_smaller() { + let mut s = Session::new(); + let ids = squares(&mut s, &[0., 60., 120., 220., 320.]); + tidy(&mut s, &ids); + assert_eq!(xs_of(&s, &ids), vec![0., 60., 120., 180., 240.], "not measured in Figma: a tie takes the smaller gap"); +} + +#[test] +fn a_mean_is_taken_down_not_rounded() { + let mut s = Session::new(); + let ids = squares(&mut s, &[0., 60., 135.]); + tidy(&mut s, &ids); + assert_eq!(xs_of(&s, &ids), vec![0., 67., 134.], "not measured in Figma: a mean of 17.5 goes down"); + let mut s = Session::new(); + let ids = squares(&mut s, &[0., 60., 135., 215.]); + tidy(&mut s, &ids); + assert_eq!(xs_of(&s, &ids), vec![0., 71., 142., 213.], "not measured in Figma: a mean of 21.67 goes down"); +} + +#[test] +fn layers_on_a_diagonal_are_a_row() { + let mut s = Session::new(); + let ids = vec![make(&mut s, 0., 0., 50., 50.), make(&mut s, 60., 70., 50., 50.), make(&mut s, 140., 150., 50., 50.)]; + tidy(&mut s, &ids); + assert_eq!(all_xy(&s, &ids), vec![(0., 0.), (70., 70.), (140., 150.)], "not measured in Figma: a diagonal is a row"); +} + +#[test] +fn a_grid_with_an_empty_place_stacks_each_column() { + let mut s = Session::new(); + let ids = vec![ + make(&mut s, 0., 0., 50., 50.), + make(&mut s, 70., 0., 50., 50.), + make(&mut s, 150., 0., 50., 50.), + make(&mut s, 0., 80., 50., 50.), + make(&mut s, 72., 90., 50., 50.), + ]; + tidy(&mut s, &ids); + assert_eq!(all_xy(&s, &ids), vec![(0., 0.), (75., 0.), (150., 0.), (0., 85.), (75., 85.)], "not measured in Figma: an empty place in a grid"); +} + +#[test] +fn one_overlapping_pair_makes_tidy_up_unavailable() { + let mut s = Session::new(); + let ids = squares(&mut s, &[0., 60., 105., 170.]); + let before = (xs_of(&s, &ids), s.undo_depth()); + tidy(&mut s, &ids); + assert_eq!((xs_of(&s, &ids), s.undo_depth()), before, "not measured in Figma: one overlapping pair"); + assert!(!can(&s, &ids), "not measured in Figma: one overlapping pair"); +} + +#[test] +fn layers_in_an_auto_layout_flow_are_left_alone() { + let mut s = Session::new(); + let f = NodeId( + s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 400, "height": 100, "props": {"layout": "horizontal"}})).unwrap()["id"] + .as_u64() + .unwrap(), + ); + let ids: Vec = (0..3) + .map(|_| NodeId(s.execute("shape.rectangle", &json!({"width": 50, "height": 50, "parent": f})).unwrap()["id"].as_u64().unwrap())) + .collect(); + let before = (all_xy(&s, &ids), s.undo_depth()); + tidy(&mut s, &ids); + assert_eq!((all_xy(&s, &ids), s.undo_depth()), before, "not measured in Figma: auto layout flow children"); + assert!(!can(&s, &ids), "not measured in Figma: auto layout flow children"); + for id in &ids { + s.execute("node.set", &json!({"id": id, "props": {"absolute": true}})).unwrap(); + } + for (id, x) in ids.iter().zip([0., 60., 160.]) { + s.execute("node.set", &json!({"id": id, "props": {"x": x, "y": 0}})).unwrap(); + } + assert_eq!(xs_of(&s, &ids), vec![0., 60., 160.]); + assert!(can(&s, &ids)); + tidy(&mut s, &ids); + assert_eq!(xs_of(&s, &ids), vec![0., 80., 160.]); +} + +#[test] +fn an_irregular_selection_keeps_the_earlier_rule() { + let mut s = Session::new(); + let ids = vec![make(&mut s, 0., 0., 200., 30.), make(&mut s, 0., 50., 90., 50.), make(&mut s, 110., 50., 90., 50.)]; + tidy(&mut s, &ids); + assert_eq!(all_xy(&s, &ids), vec![(0., 0.), (0., 70.), (220., 70.)]); +} + +#[test] +fn spacing_sets_the_gap_and_takes_two_layers() { + let mut s = Session::new(); + let ids = squares(&mut s, &[0., 60., 160.]); + s.execute("arrange.tidy", &json!({"ids": ids, "spacing": 12})).unwrap(); + assert_eq!(xs_of(&s, &ids), vec![0., 62., 124.]); + let mut s = Session::new(); + let two = squares(&mut s, &[0., 87.]); + s.execute("arrange.tidy", &json!({"ids": two, "spacing": 12})).unwrap(); + assert_eq!(xs_of(&s, &two), vec![0., 62.]); + assert!(!can(&s, &two)); +} + +#[test] +fn without_pixel_snapping_a_centred_layer_keeps_its_half_pixel() { + let mut s = Session::new(); + s.execute("view.snapPixel", &json!({"on": false})).unwrap(); + let ids = grid(&mut s); + tidy(&mut s, &ids); + assert_eq!( + all_xy(&s, &ids), + vec![(6., -3.), (93., -3.), (202.5, -3.), (1., 78.), (108., 98.), (195., 88.)], + "not measured in Figma: no rounding with Snap to pixel grid off" + ); +} + +#[test] +fn a_rotated_layer_is_tidied_by_its_box() { + let mut s = Session::new(); + let a = make(&mut s, 0., 0., 50., 50.); + let m = make(&mut s, 80., 0., 40., 40.); + let c = make(&mut s, 200., 0., 50., 50.); + s.execute("node.set", &json!({"id": m, "props": {"rotation": 30}})).unwrap(); + let boxes = |s: &Session| -> Vec { [a, m, c].iter().map(|i| s.doc().unwrap().world_bounds(*i).unwrap()).collect() }; + let b = boxes(&s); + let (g1, g2) = (b[1].x0 - b[0].x1, b[2].x0 - b[1].x1); + let want = ((g1 + g2) / 2.0).floor(); + let rot = figcraft_geom::rotation_degrees(s.doc().unwrap().node(m).unwrap().transform); + tidy(&mut s, &[a, m, c]); + let b = boxes(&s); + assert_eq!(b[0].x0, 0.0); + assert!(((b[1].x0 - b[0].x1) - want).abs() < 1e-6); + assert!(((b[2].x0 - b[1].x1) - want).abs() < 1e-6); + let after = figcraft_geom::rotation_degrees(s.doc().unwrap().node(m).unwrap().transform); + assert!((rot - after).abs() < 1e-9, "rotation unchanged"); +} diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index 71e6ff010..91b215f21 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -1622,6 +1622,7 @@ name = "English" "This version can't be read." = "This version can't be read." "This version doesn't have it: all of it is new." = "This version doesn't have it: all of it is new." "Tidy up" = "Tidy up" +"Tidy up needs three or more layers that don't overlap" = "Tidy up needs three or more layers that don't overlap" "Tile" = "Tile" "Tile type" = "Tile type" "Timer" = "Timer" diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 01cfe8e88..3860da3b6 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -274,6 +274,8 @@ mod text_link_tests; #[cfg(test)] mod text_mixed_fill_tests; #[cfg(test)] +mod tidy_tests; +#[cfg(test)] mod titlebar_tests; #[cfg(test)] mod ui_params_tests; diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index 3c64f665c..4a230c07c 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -654,6 +654,11 @@ pub(crate) fn position_values(ctx: &egui::Context, doc: &Arc, sel: &[N }) } +/// Whether the Design panel offers Tidy up for `sel` (three or more layers that don't overlap). +pub(crate) fn tidy_available(ctx: &egui::Context, doc: &Arc, sel: &[NodeId]) -> bool { + crate::selection_cache::cached(ctx, "tidy", doc, sel, &[], || figcraft_engine::tidy::can_tidy(doc, sel)) +} + /// Draw alignment and distribution, X/Y and rotation with flip/rotate controls, the /// absolute-position toggle and frame constraints. fn position_fields(app: &mut FigApp, ui: &mut Ui, doc: &Arc, sel: &[NodeId]) { @@ -695,12 +700,17 @@ fn align_row(app: &mut FigApp, ui: &mut Ui, sel: &[NodeId], can_align: bool, col if sel.len() > 2 { let more = icons::button(ui, Icon::DistributeH, 24.0, false, tr("Distribute and tidy")); menu_popup(&more).show(|ui| { - for (l, c) in [ - (tr("Distribute horizontal spacing"), "distribute.horizontal"), - (tr("Distribute vertical spacing"), "distribute.vertical"), - (tr("Tidy up"), "arrange.tidy"), + let can_tidy = app.session.ds().is_ok_and(|ds| tidy_available(ui.ctx(), &ds.doc, &ids)); + for (l, c, on) in [ + (tr("Distribute horizontal spacing"), "distribute.horizontal", true), + (tr("Distribute vertical spacing"), "distribute.vertical", true), + (tr("Tidy up"), "arrange.tidy", can_tidy), ] { - if menu_item(ui, l, crate::shortcuts::shortcut(c).unwrap_or("")) { + let item = ui.add_enabled_ui(on, |ui| menu_item(ui, l, crate::shortcuts::shortcut(c).unwrap_or(""))); + if !on { + item.response.on_disabled_hover_text(tr("Tidy up needs three or more layers that don't overlap")); + } + if item.inner { app.run(c, json!({"ids": ids})); ui.close(); } diff --git a/crates/ui-egui/src/tidy_tests.rs b/crates/ui-egui/src/tidy_tests.rs new file mode 100644 index 000000000..971b07dac --- /dev/null +++ b/crates/ui-egui/src/tidy_tests.rs @@ -0,0 +1,30 @@ +//! The Design panel's Tidy up row follows the engine's rule (measured in Figma's web app on +//! 2026-11-12): offered for three or more layers that don't overlap, greyed out otherwise. + +use egui::Context; +use figcraft_doc::NodeId; +use figcraft_engine::Session; +use serde_json::json; + +use crate::{FigApp, NoServices}; + +fn rect(s: &mut Session, x: f64, y: f64, w: f64, h: f64) -> NodeId { + NodeId(s.execute("shape.rectangle", &json!({"x": x, "y": y, "width": w, "height": h})).unwrap()["id"].as_u64().unwrap()) +} + +fn available(layers: &[(f64, f64, f64, f64)]) -> bool { + let mut s = Session::new(); + let ids: Vec = layers.iter().map(|(x, y, w, h)| rect(&mut s, *x, *y, *w, *h)).collect(); + s.execute("select.set", &json!({"ids": ids})).unwrap(); + let app = FigApp::new(s, Box::new(NoServices)); + let ctx = Context::default(); + let doc = app.session.ds().unwrap().doc.clone(); + crate::right::tidy_available(&ctx, &doc, &ids) +} + +#[test] +fn tidy_up_is_off_in_the_panel_for_overlapping_layers() { + assert!(available(&[(0., 0., 50., 50.), (80., 0., 50., 50.), (160., 0., 50., 50.)]), "three squares in a row"); + assert!(!available(&[(100., 460., 50., 30.), (140., 430., 80., 60.), (130., 400., 30., 90.)]), "the overlapping triple"); + assert!(!available(&[(0., 0., 50., 50.), (87., 0., 50., 50.)]), "two squares"); +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 1911dbbcd..b37f7ad15 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-10 · **Change:** minor (the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (Tidy up keeps the order and sizes and evens the gaps, as measured in Figma's web app on 2026-11-12, and is greyed out for fewer than three layers and for overlapping layers (M8); the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -83,6 +83,7 @@ interaction feel not yet compared. | Locked layers | done | selectable from the layers panel; no handles, not dragged with the rest of a selection | | Edit ▸ Set default properties: new layers take the selected layer's properties | done | from a shape (any layer but text): new rectangles, ellipses, polygons and stars drawn or clicked with their tools take its fills, strokes and their settings, effects, opacity, blend and corners; from a text layer: new text from the Text tool takes its fills and font (#2028). Silent in the help center on frames, lines and arrows: they keep their own look, as do layers made by commands; the defaults last for the session | | Smart selection spacing | partial | with layers in a row, a column or an aligned grid selected, the Layout section shows horizontal and vertical spacing ("Mixed" until set; typed, scrubbed, fractional and negative) and pink handles in the gaps on the canvas drag them, one undo step, Escape cancels (`arrange.spacing`; sizes, parents and offsets within each track kept; at most 2,000 layers; flow children, locked layers and layers inside instances left out). A ring at each layer's centre drags it to another place in a regular row, column or complete top-left-aligned grid: the others close up and make room around it with the gaps kept, and with Cmd/Ctrl held the two layers swap places instead, previewed live while dragging (`selection_reorder_tests`; no ring on a layer under 16 px on screen). Not covered: reordering irregular grids, and several marked layers moved together. Checked by its author on macOS and in the app on Windows (#402) | +| Tidy up | partial | measured in Figma's web app on 2026-11-12 (a row, a column, a 2 x 3 grid of unequal sizes, eight runs on the gap): the order, the sizes and the other axis are kept and the first layer stays. A row evens its horizontal gaps and a column its vertical gaps to one gap: the most common existing gap, else the mean taken down to a whole number (30, 40, 30 gives 30; 80, 20, 45 gives 48; 10, 10, 50, 90 gives 10; the grid's 60, 40, 55 gives 51). A grid is tidied by columns: a column is as wide as its widest layer around the middle of where its layers were, the first column stays, each layer is centred in its column to a whole pixel with Snap to pixel grid on, and every column is stacked from the selection's top. Unavailable for fewer than three layers and for overlapping layers, as measured: a greyed-out row with a tip in the Design panel's menu, the command moving nothing and adding no undo step. Not measured, FigCraft's choices: the smaller of two equally common gaps; a mean ending in .5 going down; gaps a pixel apart being different gaps; a diagonal being a row; a grid with an empty place (each column is still stacked); a grid always read by columns; one overlapping pair among other layers making it unavailable; layers in an auto layout flow making it unavailable (the frame places them); the 2,000 layer cap; rotated layers counting by their box; an explicit `spacing` setting the gap and taking two layers; no rounding with Snap to pixel grid off. A selection that is none of a row, a column or a grid keeps the earlier rule. Tests: tidy_tests | | Selection colors | partial | the Design panel shows the section from two paint groups (paints sharing a style, a variable and a value count as one group), or from one when a selected layer has children (a frame, group, component or instance), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also offers enabled libraries' published color styles and Create style (`selection.createColorStyle`); no library variables and no new variable from a row (#403) | | Keyboard box selection | done | Alt+Space on macOS, Ctrl+Space on Windows and Linux, or F8 (`select.area`): a box around the selection or in the middle of the view; arrows move it, Cmd/Ctrl+arrows or Shift+arrows size it (Shift with Cmd/Ctrl: farther), Enter selects like a marquee (Shift+Enter toggles, Cmd/Ctrl+Enter nested), Escape closes; Tab while the box shows, or the chord again, switches to pick select: a pink outline on the first selected layer (the page's top layer with nothing selected), Tab and Shift+Tab move it between sibling layers in Layers order, Enter into a frame's top child, Shift+Enter out to the parent, Space selects it, Escape or a press on the canvas ends it; `ui.key` takes the same keys (#1836) | | Selection colors | partial | the Design panel shows the section from two paint groups (paints sharing a style, a variable and a value count as one group), or from one when a selected layer has children (a frame, group, component or instance; a layer without children shows it only with two paint groups, such as a red fill and a blue stroke; one paint group, however many layers share it, hides it), counting the selected layers' own fills and strokes and their descendants' (measured in Figma's web app, 2026-11-09, #2188, on frames, groups and rectangles only; the rule for components and instances is not measured), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also lists each enabled library's published color styles under the library's name (a library that can't be read offers none), and a linked row's menu switches it to another style; a library style is copied in, linked and read-only, in the same undo step (`selection.applyColorStyle` with `library`). Create style on an ordinary row asks for a name (the next free "Color n" first) and makes a style of the row's whole paint, gradients, opacity, blend mode and variables bound to gradient stops included, linked to every fill and stroke the row stands for in one undo step; a name in use keeps the window open (`selection.createColorStyle`). Text ranges with fills of their own take the style's value, without a link. No library variables from there, and no new variable from a row (#403) | @@ -217,6 +218,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| +| 2026-11-12 | minor | M8: Tidy up keeps the order and sizes and evens the gaps, as measured in Figma's web app on 2026-11-12. A row or column evens one gap (the most common one, else the mean taken down) and keeps the other axis, a grid is tidied by columns, and fewer than three layers or overlapping layers grey the row out and move nothing. Measured: those rules and the greyed-out cases; FigCraft's choices: ties, a mean ending in .5, a diagonal, a grid with an empty place, one overlapping pair, auto layout flow children, the 2,000 layer cap, rotated layers, `spacing` with two layers, and no rounding with pixel snapping off. Tests: tidy_tests (a_row_keeps_its_order_sizes_and_y_and_evens_the_gaps, gaps_that_all_differ_take_their_mean_taken_down, a_column_keeps_x_and_evens_the_vertical_gaps, the_gap_is_the_most_common_one_else_the_mean, a_grid_is_tidied_by_columns, two_layers_and_overlapping_layers_are_left_alone, a_tidy_that_moves_nothing_adds_no_undo_step, an_irregular_selection_keeps_the_earlier_rule and the choices). | | 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start); FigCraft draws it opaque (how Figma treats a translucent fill was not measured); gradient, image and hidden fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | | 2026-11-10 | minor | The Rotation field shows and sets the layer's rotation on the page (its own angle plus its parents' when no ancestor is flipped; with a flipped ancestor FigCraft reads the composed angle, which flips the sign of the layer's own angle, and Figma's behaviour there was not measured), in frames and groups alike, as measured in Figma's web app for rotated, unflipped parents (#2196) | | 2026-11-09 | patch | M3, #2189: the eyedropper picks the colour the canvas shows. It sampled a 1x1 render without the canvas's magnified-image pixels, so on an image magnified past 2x it blended a 1 px line with its neighbours (#3D444D picked as #343B44 beside #151B23), and the pixel it sampled began at the pointer instead of being centred on it. It now matches the canvas when zoomed in; zoomed out it still samples the full-resolution image, not the smaller copy the canvas may show. Test: `eyedropper_image_tests` | From d3f7ae902924701ff3e2ce240b8e51dfddc2888b Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 16:32:48 -0500 Subject: [PATCH 205/239] M8: Tidy up rounds the gap, tidies overlapping rows and grids along their longer axis, as measured Third Figma run (web app, 2026-11-12): the mean gap rounds half up (X 0, 60, 135, 215 gives 0, 72, 144, 216; 0, 60, 135 gives 0, 68, 136); a tie between repeated gaps takes the smaller; a row is one row group of layers and may overlap along X, a negative gap counting in the mean (X 0, 60, 105, 170 gives 0, 57, 114, 171); a grid is packed along the axis with more groups (2 x 3 by centred columns, 3 x 2 by centred rows); a diagonal, an irregular layout and layers that all overlap are unavailable. The earlier cell rule is removed. Choices, not measured: a 2 x 2 grid as columns, auto layout flow children unavailable, the 2,000 layer cap, rotated layers by their box, spacing with two layers, no rounding with Snap to pixel grid off. Grid positions along a stack can differ by a pixel from Figma's (it read 52 and 51 for the same mean 51.67). Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 briefed; Sonnet 5.5 measured and wrote at medium --- crates/engine/src/selection/tidy.rs | 212 +++++++++++++--------------- crates/engine/src/tidy_tests.rs | 71 +++++++--- docs/ui-parity.md | 6 +- 3 files changed, 148 insertions(+), 141 deletions(-) diff --git a/crates/engine/src/selection/tidy.rs b/crates/engine/src/selection/tidy.rs index a802aeccc..2450c0dcb 100644 --- a/crates/engine/src/selection/tidy.rs +++ b/crates/engine/src/selection/tidy.rs @@ -1,21 +1,24 @@ //! Tidy up: the moves that even a selection's gaps the way Figma's web app does. //! -//! Measured in Figma's web app on 2026-11-12 (top-level rectangles): a row, a column and a 2 x 3 -//! grid of unequal sizes, and eight runs on the gap. Figma keeps the order and the sizes of every -//! layer and keeps the first layer where it is. A row evens its horizontal gaps and keeps every Y, -//! a column the mirror image. The one gap is the most common existing gap, else the mean of the -//! gaps taken down to a whole number. A grid is tidied by columns: each column is as wide as its -//! widest layer, centred where its layers were, the columns are evened, every layer is centred in -//! its column and every column is stacked from the selection's top. Tidy up is greyed out for fewer -//! than three layers and for layers that overlap. +//! Measured in Figma's web app on 2026-11-12 (top-level rectangles): a row, a column, a 2 x 3 grid +//! and its transpose, and many runs on the gap. Figma keeps the order and the sizes of every layer +//! and keeps the first layer where it is. Rows are the groups of layers whose Y ranges overlap +//! (transitively), columns the groups whose X ranges overlap. A row is one row group of layers +//! side by side: its horizontal gaps are evened and every Y kept; a column is the mirror image. +//! Layers of a row may overlap along X: a negative gap counts in the mean. The one gap is the most +//! common existing gap (the smaller of two equally common ones), else the mean rounded to a whole +//! number, half up. A grid (two or more rows and two or more columns, one layer in every cell) is +//! packed along the axis that has more groups: for 2 rows by 3 columns each column is as wide as +//! its widest layer, centred where its layers were, the columns are evened, every layer is +//! centred in its column and every column is stacked from the selection's top; 3 rows by 2 +//! columns is the mirror image. Tidy up is unavailable for fewer than three layers, for layers all +//! in one row and one column (overlapping each other), for a diagonal and for an irregular layout. //! -//! Not measured, FigCraft's choices: the smaller of two equally common gaps; a mean ending in .5 -//! going down; gaps a pixel apart being different gaps; a diagonal being a row; a grid with an -//! empty place; a grid always read by columns; one overlapping pair among other layers making it -//! unavailable; layers in an auto layout flow making it unavailable; the 2,000 layer cap; rotated -//! layers counting by their box; an explicit `spacing` taking two layers; no rounding in a grid -//! with Snap to pixel grid off. A selection that is none of a row, a column or a grid keeps the -//! earlier rule (the cells of the largest layer). +//! Not measured, FigCraft's choices: a 2 x 2 grid packed as columns; layers in an auto layout flow +//! making it unavailable (the frame places them, and the measurement could not tell this from an +//! irregular layout); the 2,000 layer cap; rotated layers counting by their box; gaps a pixel +//! apart being different gaps; an explicit `spacing` taking two layers; no rounding in a grid with +//! Snap to pixel grid off. use std::collections::BTreeSet; @@ -30,33 +33,34 @@ const MAX_LAYERS: usize = 2000; type Item = (NodeId, Rect); type Move = (NodeId, f64, f64); +/// What a selection is: a row or a column (`vertical`), or a grid packed in units along an axis +/// (`vertical`: the units are rows). +#[derive(Clone, Copy)] +enum Shape { + Line { vertical: bool }, + Grid { vertical: bool }, +} + /// Whether Tidy up is offered for `ids`: three to 2,000 layers with boxes, none in an auto layout -/// flow, none overlapping another. +/// flow, forming a row, a column or a grid. pub fn can_tidy(doc: &Document, ids: &[NodeId]) -> bool { available(doc, ids, 3).is_some() } /// The page-space moves that tidy `ids` (empty when unavailable or when nothing would move). -/// `spacing` sets the gap and lets two layers through; `snap` rounds a grid's column positions to -/// whole pixels. +/// `spacing` sets the gap and lets two layers through; `snap` rounds a grid's positions across its +/// packing axis to whole pixels. pub(crate) fn tidy_moves(doc: &Document, ids: &[NodeId], spacing: Option, snap: bool) -> Vec { let min = if spacing.is_some() { 2 } else { 3 }; - let Some(items) = available(doc, ids, min) else { return Vec::new() }; - let cols = groups(&items, false); - let rows = groups(&items, true); - let moves = if cols.len() == items.len() { - line_moves(&items, false, spacing) - } else if rows.len() == items.len() { - line_moves(&items, true, spacing) - } else if is_grid(&cols, &rows) { - grid_moves(&cols, spacing, snap) - } else { - irregular_moves(items, spacing) + let Some((items, shape)) = available(doc, ids, min) else { return Vec::new() }; + let moves = match shape { + Shape::Line { vertical } => line_moves(&items, vertical, spacing), + Shape::Grid { vertical } => grid_moves(&groups(&items, vertical), vertical, spacing, snap), }; moves.into_iter().filter(|(_, dx, dy)| !(dx.is_finite() && dy.is_finite()) || dx.abs() > 1e-9 || dy.abs() > 1e-9).collect() } -fn available(doc: &Document, ids: &[NodeId], min: usize) -> Option> { +fn available(doc: &Document, ids: &[NodeId], min: usize) -> Option<(Vec, Shape)> { let mut seen = BTreeSet::new(); let ids: Vec = roots(doc, ids).into_iter().filter(|i| seen.insert(*i)).collect(); if ids.len() < min || ids.len() > MAX_LAYERS { @@ -74,13 +78,30 @@ fn available(doc: &Document, ids: &[NodeId], min: usize) -> Option> { } items.push((id, b)); } - let overlapping = items.iter().enumerate().any(|(i, a)| items.iter().skip(i + 1).any(|b| overlap(a.1, b.1))); - if overlapping { None } else { Some(items) } + let shape = classify(&items)?; + Some((items, shape)) } -/// Two boxes overlap when they share more than `EPS` on both axes; touching edges do not count. -fn overlap(a: Rect, b: Rect) -> bool { - a.x1.min(b.x1) - a.x0.max(b.x0) > EPS && a.y1.min(b.y1) - a.y0.max(b.y0) > EPS +/// A row: one row group over two or more column groups (layers sharing a column group overlap). +/// A column: the mirror image. A grid: two or +/// more of each, one layer in every cell, packed along the axis with more groups (columns on a tie). +fn classify(items: &[Item]) -> Option { + let cols = groups(items, false); + let rows = groups(items, true); + match (cols.len(), rows.len()) { + (c, 1) if c >= 2 && cols.iter().all(|g| overlapping(g)) => Some(Shape::Line { vertical: false }), + (1, r) if r >= 2 && rows.iter().all(|g| overlapping(g)) => Some(Shape::Line { vertical: true }), + (c, r) if c >= 2 && r >= 2 && one_per_cell(&cols, &rows) => Some(Shape::Grid { vertical: r > c }), + _ => None, + } +} + +/// Layers that share a group along a row's or column's own axis must overlap each other (50 px +/// squares at X 0, 60, 105, 170: the middle two do), not merely sit in the same band: a header +/// above two layers side by side is irregular. +fn overlapping(group: &[Item]) -> bool { + let both = |a: Rect, b: Rect| a.x1.min(b.x1) - a.x0.max(b.x0) > EPS && a.y1.min(b.y1) - a.y0.max(b.y0) > EPS; + group.iter().enumerate().all(|(i, a)| group.iter().skip(i + 1).all(|b| both(a.1, b.1))) } fn span(b: Rect, vertical: bool) -> (f64, f64) { @@ -110,13 +131,13 @@ fn groups(items: &[Item], vertical: bool) -> Vec> { out } -/// No two layers share both a column and a row. -fn is_grid(cols: &[Vec], rows: &[Vec]) -> bool { - cols.iter().all(|c| rows.iter().all(|r| c.iter().filter(|a| r.iter().any(|b| b.0 == a.0)).count() <= 1)) +/// Every (column, row) cell holds exactly one layer. +fn one_per_cell(cols: &[Vec], rows: &[Vec]) -> bool { + cols.iter().all(|c| rows.iter().all(|r| c.iter().filter(|a| r.iter().any(|b| b.0 == a.0)).count() == 1)) } -/// The one gap an axis is evened to: `spacing`, a single gap, the most common gap, else the mean -/// taken down to a whole number. +/// The one gap an axis is evened to: `spacing`, a single gap, the most common gap (the smaller of +/// two equally common ones), else the mean rounded to a whole number, half up. fn even_gap(gaps: &[f64], spacing: Option) -> f64 { if let Some(s) = spacing { return s; @@ -129,7 +150,7 @@ fn even_gap(gaps: &[f64], spacing: Option) -> f64 { match best { Some((n, g)) if n >= 2 => g, _ if gaps.is_empty() => 0.0, - _ => (gaps.iter().sum::() / gaps.len() as f64 + 1e-9).floor(), + _ => (gaps.iter().sum::() / gaps.len() as f64 + 0.5 + 1e-9).floor(), } } @@ -161,31 +182,34 @@ fn snap_to(v: f64, snap: bool) -> f64 { if snap { (v + 0.5).floor() } else { v } } -/// A column box: where it starts and how wide it is (its widest layer, around the middle of the -/// column's X range). -fn column_box(col: &[Item]) -> (f64, f64) { - let lo = col.iter().map(|i| i.1.x0).fold(f64::MAX, f64::min); - let hi = col.iter().map(|i| i.1.x1).fold(f64::MIN, f64::max); - let w = col.iter().map(|i| i.1.width()).fold(0.0, f64::max); +/// A unit's box on the packing axis: where it starts and how wide it is (its widest layer, around +/// the middle of the unit's range). +fn unit_box(unit: &[Item], vertical: bool) -> (f64, f64) { + let lo = unit.iter().map(|i| span(i.1, vertical).0).fold(f64::MAX, f64::min); + let hi = unit.iter().map(|i| span(i.1, vertical).1).fold(f64::MIN, f64::max); + let w = unit.iter().map(|i| span(i.1, vertical).1 - span(i.1, vertical).0).fold(0.0, f64::max); ((lo + hi) / 2.0 - w / 2.0, w) } -/// Vertical gaps inside every column, pooled. -fn column_gaps(cols: &[Vec]) -> Vec { +/// The gaps inside every unit along the other axis, pooled. +fn unit_gaps(units: &[Vec], vertical: bool) -> Vec { let mut out = Vec::new(); - for col in cols { - let mut c = col.clone(); - c.sort_by(|a, b| a.1.y0.total_cmp(&b.1.y0)); - out.extend(c.windows(2).filter_map(|w| match w { - [a, b] => Some(b.1.y0 - a.1.y1), + for unit in units { + let mut u = unit.clone(); + u.sort_by(|a, b| span(a.1, !vertical).0.total_cmp(&span(b.1, !vertical).0)); + out.extend(u.windows(2).filter_map(|w| match w { + [a, b] => Some(span(b.1, !vertical).0 - span(a.1, !vertical).1), _ => None, })); } out } -fn grid_moves(cols: &[Vec], spacing: Option, snap: bool) -> Vec { - let boxes: Vec<(f64, f64)> = cols.iter().map(|c| column_box(c)).collect(); +/// A grid packed in `units` (columns, or rows when `vertical`): the units are evened around where +/// they were, every layer is centred in its unit and each unit is laid out from the selection's +/// start on the other axis. +fn grid_moves(units: &[Vec], vertical: bool, spacing: Option, snap: bool) -> Vec { + let boxes: Vec<(f64, f64)> = units.iter().map(|u| unit_box(u, vertical)).collect(); let across: Vec = boxes .windows(2) .filter_map(|w| match w { @@ -193,68 +217,24 @@ fn grid_moves(cols: &[Vec], spacing: Option, snap: bool) -> Vec _ => None, }) .collect(); - let gx = even_gap(&across, spacing); - let gy = even_gap(&column_gaps(cols), spacing); - let top = cols.iter().flatten().map(|i| i.1.y0).fold(f64::MAX, f64::min); - let mut left = boxes.first().map_or(0.0, |b| snap_to(b.0, snap)); + let g_units = even_gap(&across, spacing); + let g_within = even_gap(&unit_gaps(units, vertical), spacing); + let start = units.iter().flatten().map(|i| span(i.1, !vertical).0).fold(f64::MAX, f64::min); + let mut at = boxes.first().map_or(0.0, |b| snap_to(b.0, snap)); let mut out = Vec::new(); - for (col, (_, w)) in cols.iter().zip(&boxes) { - let mut c = col.clone(); - c.sort_by(|a, b| a.1.y0.total_cmp(&b.1.y0)); - let mut y = top; - for (id, b) in c { - let x = snap_to(left + (w - b.width()) / 2.0, snap); - out.push((id, x - b.x0, y - b.y0)); - y += b.height() + gy; + for (unit, (_, w)) in units.iter().zip(&boxes) { + let mut u = unit.clone(); + u.sort_by(|a, b| span(a.1, !vertical).0.total_cmp(&span(b.1, !vertical).0)); + let mut pos = start; + for (id, b) in u { + let (lo, hi) = span(b, vertical); + let (lo2, hi2) = span(b, !vertical); + let d_main = snap_to(at + (w - (hi - lo)) / 2.0, snap) - lo; + let d_cross = pos - lo2; + pos += (hi2 - lo2) + g_within; + out.push(if vertical { (id, d_cross, d_main) } else { (id, d_main, d_cross) }); } - left += w + gx; + at += w + g_units; } out } - -/// The earlier rule, unchanged: rows by overlapping vertical centres on a grid whose every cell is -/// the largest layer's size, from the union's top left, at the average horizontal gap (at least 10). -fn irregular_moves(mut items: Vec, spacing: Option) -> Vec { - items.sort_by(|a, b| a.1.y0.total_cmp(&b.1.y0)); - let mut rows: Vec> = Vec::new(); - for it in items { - match rows.last_mut() { - Some(row) if row.iter().any(|(_, b)| it.1.center().y < b.y1 && it.1.center().y > b.y0) => row.push(it), - _ => rows.push(vec![it]), - } - } - let all: Vec = rows.iter().flatten().map(|(_, b)| *b).collect(); - let (Some(origin), maxw, maxh) = ( - all.iter().copied().reduce(|a, b| a.union(b)), - all.iter().map(Rect::width).fold(0.0, f64::max), - all.iter().map(Rect::height).fold(0.0, f64::max), - ) else { - return Vec::new(); - }; - let gap = spacing.unwrap_or_else(|| average_gap(&rows)); - let mut out = Vec::new(); - for (ri, row) in rows.iter_mut().enumerate() { - row.sort_by(|a, b| a.1.x0.total_cmp(&b.1.x0)); - for (ci, (id, b)) in row.iter().enumerate() { - let x = origin.x0 + ci as f64 * (maxw + gap); - let y = origin.y0 + ri as f64 * (maxh + gap); - out.push((*id, x - b.x0, y - b.y0)); - } - } - out -} - -/// The average existing horizontal gap of the widest row, at least 10. -fn average_gap(rows: &[Vec]) -> f64 { - 10f64.max( - rows.iter() - .filter(|r| r.len() > 1) - .map(|r| { - (r.iter().map(|(_, b)| b.x1).fold(f64::MIN, f64::max) - - r.iter().map(|(_, b)| b.x0).fold(f64::MAX, f64::min) - - r.iter().map(|(_, b)| b.width()).sum::()) - / (r.len() - 1) as f64 - }) - .fold(0.0, f64::max), - ) -} diff --git a/crates/engine/src/tidy_tests.rs b/crates/engine/src/tidy_tests.rs index 41eff8d2c..79a349f61 100644 --- a/crates/engine/src/tidy_tests.rs +++ b/crates/engine/src/tidy_tests.rs @@ -107,17 +107,41 @@ fn the_gap_is_the_most_common_one_else_the_mean() { } } +/// Within a pixel: Figma read 52 for the vertical gap in one column and 51 in two (the mean of 60, +/// 40, 55 is 51.67), probably from pixel snapping, so a layer's place along a stack may differ by one. +fn near(got: &[(f64, f64)], want: &[(f64, f64)]) { + assert_eq!(got.len(), want.len()); + for (g, w) in got.iter().zip(want) { + assert!((g.0 - w.0).abs() <= 1.0 && (g.1 - w.1).abs() <= 1.0, "{got:?} vs {want:?}"); + } +} + #[test] fn a_grid_is_tidied_by_columns() { let mut s = Session::new(); let ids = grid(&mut s); tidy(&mut s, &ids); - assert_eq!(all_xy(&s, &ids), vec![(6., -3.), (93., -3.), (203., -3.), (1., 78.), (108., 98.), (195., 88.)]); + near(&all_xy(&s, &ids), &[(6., -3.), (93., -3.), (203., -3.), (1., 79.), (108., 98.), (195., 88.)]); assert_eq!(size(&s, ids[4]), (40., 50.)); } #[test] -fn two_layers_and_overlapping_layers_are_left_alone() { +fn a_transposed_grid_is_tidied_by_rows() { + let mut s = Session::new(); + let ids = vec![ + make(&mut s, 0., 0., 30., 50.), + make(&mut s, 5., 80., 50., 70.), + make(&mut s, -3., 190., 40., 40.), + make(&mut s, 90., 2., 20., 60.), + make(&mut s, 95., 85., 50., 40.), + make(&mut s, 92., 200., 35., 55.), + ]; + tidy(&mut s, &ids); + near(&all_xy(&s, &ids), &[(-3., 6.), (-3., 93.), (-3., 203.), (78., 1.), (98., 108.), (88., 195.)]); +} + +#[test] +fn two_layers_and_a_selection_in_one_cell_are_left_alone() { let mut s = Session::new(); let two = squares(&mut s, &[0., 87.]); let before = (all_xy(&s, &two), s.undo_depth()); @@ -149,31 +173,33 @@ fn two_equally_common_gaps_give_the_smaller() { let mut s = Session::new(); let ids = squares(&mut s, &[0., 60., 120., 220., 320.]); tidy(&mut s, &ids); - assert_eq!(xs_of(&s, &ids), vec![0., 60., 120., 180., 240.], "not measured in Figma: a tie takes the smaller gap"); + assert_eq!(xs_of(&s, &ids), vec![0., 60., 120., 180., 240.]); } #[test] -fn a_mean_is_taken_down_not_rounded() { +fn a_mean_is_rounded_half_up() { let mut s = Session::new(); let ids = squares(&mut s, &[0., 60., 135.]); tidy(&mut s, &ids); - assert_eq!(xs_of(&s, &ids), vec![0., 67., 134.], "not measured in Figma: a mean of 17.5 goes down"); + assert_eq!(xs_of(&s, &ids), vec![0., 68., 136.], "a mean of 17.5 goes up"); let mut s = Session::new(); let ids = squares(&mut s, &[0., 60., 135., 215.]); tidy(&mut s, &ids); - assert_eq!(xs_of(&s, &ids), vec![0., 71., 142., 213.], "not measured in Figma: a mean of 21.67 goes down"); + assert_eq!(xs_of(&s, &ids), vec![0., 72., 144., 216.], "a mean of 21.67 goes to 22"); } #[test] -fn layers_on_a_diagonal_are_a_row() { +fn layers_on_a_diagonal_are_unavailable() { let mut s = Session::new(); let ids = vec![make(&mut s, 0., 0., 50., 50.), make(&mut s, 60., 70., 50., 50.), make(&mut s, 140., 150., 50., 50.)]; + let before = (all_xy(&s, &ids), s.undo_depth()); tidy(&mut s, &ids); - assert_eq!(all_xy(&s, &ids), vec![(0., 0.), (70., 70.), (140., 150.)], "not measured in Figma: a diagonal is a row"); + assert_eq!((all_xy(&s, &ids), s.undo_depth()), before); + assert!(!can(&s, &ids)); } #[test] -fn a_grid_with_an_empty_place_stacks_each_column() { +fn a_grid_with_an_empty_place_is_unavailable() { let mut s = Session::new(); let ids = vec![ make(&mut s, 0., 0., 50., 50.), @@ -182,18 +208,19 @@ fn a_grid_with_an_empty_place_stacks_each_column() { make(&mut s, 0., 80., 50., 50.), make(&mut s, 72., 90., 50., 50.), ]; + let before = (all_xy(&s, &ids), s.undo_depth()); tidy(&mut s, &ids); - assert_eq!(all_xy(&s, &ids), vec![(0., 0.), (75., 0.), (150., 0.), (0., 85.), (75., 85.)], "not measured in Figma: an empty place in a grid"); + assert_eq!((all_xy(&s, &ids), s.undo_depth()), before, "not measured in Figma: an empty place in a grid"); + assert!(!can(&s, &ids), "not measured in Figma: an empty place in a grid"); } #[test] -fn one_overlapping_pair_makes_tidy_up_unavailable() { +fn an_overlapping_pair_in_a_row_is_tidied_and_its_negative_gap_counts() { let mut s = Session::new(); let ids = squares(&mut s, &[0., 60., 105., 170.]); - let before = (xs_of(&s, &ids), s.undo_depth()); + assert!(can(&s, &ids)); tidy(&mut s, &ids); - assert_eq!((xs_of(&s, &ids), s.undo_depth()), before, "not measured in Figma: one overlapping pair"); - assert!(!can(&s, &ids), "not measured in Figma: one overlapping pair"); + assert_eq!(xs_of(&s, &ids), vec![0., 57., 114., 171.], "gaps 10, -5, 15 have the mean 6.67, which gives 7"); } #[test] @@ -224,11 +251,13 @@ fn layers_in_an_auto_layout_flow_are_left_alone() { } #[test] -fn an_irregular_selection_keeps_the_earlier_rule() { +fn an_irregular_selection_is_unavailable() { let mut s = Session::new(); let ids = vec![make(&mut s, 0., 0., 200., 30.), make(&mut s, 0., 50., 90., 50.), make(&mut s, 110., 50., 90., 50.)]; + let before = (all_xy(&s, &ids), s.undo_depth()); tidy(&mut s, &ids); - assert_eq!(all_xy(&s, &ids), vec![(0., 0.), (0., 70.), (220., 70.)]); + assert_eq!((all_xy(&s, &ids), s.undo_depth()), before); + assert!(!can(&s, &ids)); } #[test] @@ -250,11 +279,9 @@ fn without_pixel_snapping_a_centred_layer_keeps_its_half_pixel() { s.execute("view.snapPixel", &json!({"on": false})).unwrap(); let ids = grid(&mut s); tidy(&mut s, &ids); - assert_eq!( - all_xy(&s, &ids), - vec![(6., -3.), (93., -3.), (202.5, -3.), (1., 78.), (108., 98.), (195., 88.)], - "not measured in Figma: no rounding with Snap to pixel grid off" - ); + let got = all_xy(&s, &ids); + assert_eq!(got.get(2).map(|p| p.0), Some(202.5), "not measured in Figma: no rounding with Snap to pixel grid off"); + near(&got, &[(6., -3.), (93., -3.), (202.5, -3.), (1., 79.), (108., 98.), (195., 88.)]); } #[test] @@ -267,7 +294,7 @@ fn a_rotated_layer_is_tidied_by_its_box() { let boxes = |s: &Session| -> Vec { [a, m, c].iter().map(|i| s.doc().unwrap().world_bounds(*i).unwrap()).collect() }; let b = boxes(&s); let (g1, g2) = (b[1].x0 - b[0].x1, b[2].x0 - b[1].x1); - let want = ((g1 + g2) / 2.0).floor(); + let want = ((g1 + g2) / 2.0 + 0.5).floor(); let rot = figcraft_geom::rotation_degrees(s.doc().unwrap().node(m).unwrap().transform); tidy(&mut s, &[a, m, c]); let b = boxes(&s); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index b37f7ad15..4c40b553a 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-12 · **Change:** minor (Tidy up keeps the order and sizes and evens the gaps, as measured in Figma's web app on 2026-11-12, and is greyed out for fewer than three layers and for overlapping layers (M8); the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (Tidy up keeps the order and sizes and evens the gaps, as measured in Figma's web app on 2026-11-12, rounds the gap half up, tidies overlapping rows and packs a grid along its longer axis, and is greyed out for fewer than three layers, a diagonal and an irregular layout (M8); the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -83,7 +83,7 @@ interaction feel not yet compared. | Locked layers | done | selectable from the layers panel; no handles, not dragged with the rest of a selection | | Edit ▸ Set default properties: new layers take the selected layer's properties | done | from a shape (any layer but text): new rectangles, ellipses, polygons and stars drawn or clicked with their tools take its fills, strokes and their settings, effects, opacity, blend and corners; from a text layer: new text from the Text tool takes its fills and font (#2028). Silent in the help center on frames, lines and arrows: they keep their own look, as do layers made by commands; the defaults last for the session | | Smart selection spacing | partial | with layers in a row, a column or an aligned grid selected, the Layout section shows horizontal and vertical spacing ("Mixed" until set; typed, scrubbed, fractional and negative) and pink handles in the gaps on the canvas drag them, one undo step, Escape cancels (`arrange.spacing`; sizes, parents and offsets within each track kept; at most 2,000 layers; flow children, locked layers and layers inside instances left out). A ring at each layer's centre drags it to another place in a regular row, column or complete top-left-aligned grid: the others close up and make room around it with the gaps kept, and with Cmd/Ctrl held the two layers swap places instead, previewed live while dragging (`selection_reorder_tests`; no ring on a layer under 16 px on screen). Not covered: reordering irregular grids, and several marked layers moved together. Checked by its author on macOS and in the app on Windows (#402) | -| Tidy up | partial | measured in Figma's web app on 2026-11-12 (a row, a column, a 2 x 3 grid of unequal sizes, eight runs on the gap): the order, the sizes and the other axis are kept and the first layer stays. A row evens its horizontal gaps and a column its vertical gaps to one gap: the most common existing gap, else the mean taken down to a whole number (30, 40, 30 gives 30; 80, 20, 45 gives 48; 10, 10, 50, 90 gives 10; the grid's 60, 40, 55 gives 51). A grid is tidied by columns: a column is as wide as its widest layer around the middle of where its layers were, the first column stays, each layer is centred in its column to a whole pixel with Snap to pixel grid on, and every column is stacked from the selection's top. Unavailable for fewer than three layers and for overlapping layers, as measured: a greyed-out row with a tip in the Design panel's menu, the command moving nothing and adding no undo step. Not measured, FigCraft's choices: the smaller of two equally common gaps; a mean ending in .5 going down; gaps a pixel apart being different gaps; a diagonal being a row; a grid with an empty place (each column is still stacked); a grid always read by columns; one overlapping pair among other layers making it unavailable; layers in an auto layout flow making it unavailable (the frame places them); the 2,000 layer cap; rotated layers counting by their box; an explicit `spacing` setting the gap and taking two layers; no rounding with Snap to pixel grid off. A selection that is none of a row, a column or a grid keeps the earlier rule. Tests: tidy_tests | +| Tidy up | partial | measured in Figma's web app on 2026-11-12 (a row, a column, a 2 x 3 grid of unequal sizes and its transpose, and many runs on the gap, the unavailable cases among them): the order, the sizes and the other axis are kept and the first layer stays. A row (one group of layers whose Y ranges overlap, side by side) evens its horizontal gaps and a column its vertical gaps to one gap: the most common existing gap (the smaller of two equally common ones), else the mean rounded to a whole number, half up (30, 40, 30 gives 30; 80, 20, 45 gives 48; 10, 10, 50, 90 gives 10; 10, 25 gives 18; 10, 25, 30 gives 22). Layers of a row may overlap along X: the negative gap counts in the mean (50 px squares at X 0, 60, 105, 170, gaps 10, -5, 15, give X 0, 57, 114, 171). A grid (two or more rows and columns, one layer in every cell) is packed along the axis with more groups: a column is as wide as its widest layer around the middle of where its layers were, the first column stays, each layer is centred in its column to a whole pixel with Snap to pixel grid on, and every column is stacked from the selection's top; a grid with more rows than columns is the mirror image (centred rows, laid out left to right). The vertical gap reads 51 or 52 in Figma's own runs (mean 51.67), so FigCraft's positions along a stack can differ by a pixel there. Unavailable, as measured, for fewer than three layers, for layers that all overlap each other (one row and one column), for a diagonal and for an irregular layout: a greyed-out row with a tip in the Design panel's menu, the command moving nothing and adding no undo step. Not measured, FigCraft's choices: a 2 x 2 grid packed as columns; layers in an auto layout flow being unavailable (the frame places them; the measurement could not tell this from an irregular layout); the 2,000 layer cap; rotated layers counting by their box; gaps a pixel apart being different gaps; an explicit `spacing` setting the gap and taking two layers; no rounding with Snap to pixel grid off. Tests: tidy_tests | | Selection colors | partial | the Design panel shows the section from two paint groups (paints sharing a style, a variable and a value count as one group), or from one when a selected layer has children (a frame, group, component or instance), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also offers enabled libraries' published color styles and Create style (`selection.createColorStyle`); no library variables and no new variable from a row (#403) | | Keyboard box selection | done | Alt+Space on macOS, Ctrl+Space on Windows and Linux, or F8 (`select.area`): a box around the selection or in the middle of the view; arrows move it, Cmd/Ctrl+arrows or Shift+arrows size it (Shift with Cmd/Ctrl: farther), Enter selects like a marquee (Shift+Enter toggles, Cmd/Ctrl+Enter nested), Escape closes; Tab while the box shows, or the chord again, switches to pick select: a pink outline on the first selected layer (the page's top layer with nothing selected), Tab and Shift+Tab move it between sibling layers in Layers order, Enter into a frame's top child, Shift+Enter out to the parent, Space selects it, Escape or a press on the canvas ends it; `ui.key` takes the same keys (#1836) | | Selection colors | partial | the Design panel shows the section from two paint groups (paints sharing a style, a variable and a value count as one group), or from one when a selected layer has children (a frame, group, component or instance; a layer without children shows it only with two paint groups, such as a red fill and a blue stroke; one paint group, however many layers share it, hides it), counting the selected layers' own fills and strokes and their descendants' (measured in Figma's web app, 2026-11-09, #2188, on frames, groups and rectangles only; the rule for components and instances is not measured), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also lists each enabled library's published color styles under the library's name (a library that can't be read offers none), and a linked row's menu switches it to another style; a library style is copied in, linked and read-only, in the same undo step (`selection.applyColorStyle` with `library`). Create style on an ordinary row asks for a name (the next free "Color n" first) and makes a style of the row's whole paint, gradients, opacity, blend mode and variables bound to gradient stops included, linked to every fill and stroke the row stands for in one undo step; a name in use keeps the window open (`selection.createColorStyle`). Text ranges with fills of their own take the style's value, without a link. No library variables from there, and no new variable from a row (#403) | @@ -218,7 +218,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| -| 2026-11-12 | minor | M8: Tidy up keeps the order and sizes and evens the gaps, as measured in Figma's web app on 2026-11-12. A row or column evens one gap (the most common one, else the mean taken down) and keeps the other axis, a grid is tidied by columns, and fewer than three layers or overlapping layers grey the row out and move nothing. Measured: those rules and the greyed-out cases; FigCraft's choices: ties, a mean ending in .5, a diagonal, a grid with an empty place, one overlapping pair, auto layout flow children, the 2,000 layer cap, rotated layers, `spacing` with two layers, and no rounding with pixel snapping off. Tests: tidy_tests (a_row_keeps_its_order_sizes_and_y_and_evens_the_gaps, gaps_that_all_differ_take_their_mean_taken_down, a_column_keeps_x_and_evens_the_vertical_gaps, the_gap_is_the_most_common_one_else_the_mean, a_grid_is_tidied_by_columns, two_layers_and_overlapping_layers_are_left_alone, a_tidy_that_moves_nothing_adds_no_undo_step, an_irregular_selection_keeps_the_earlier_rule and the choices). | +| 2026-11-12 | minor | M8: Tidy up keeps the order and sizes and evens the gaps, as measured in Figma's web app on 2026-11-12. A row or column evens one gap (the most common one, the smaller of a tie, else the mean rounded half up) and keeps the other axis, layers of a row may overlap along X, and a grid is packed along the axis with more groups; fewer than three layers, layers that all overlap, a diagonal and an irregular layout grey the row out and move nothing. Measured: those rules and the unavailable cases; FigCraft's choices: a 2 x 2 grid as columns, auto layout flow children, the 2,000 layer cap, rotated layers by their box, `spacing` with two layers, and no rounding with pixel snapping off. Tests: tidy_tests (a_row_keeps_its_order_sizes_and_y_and_evens_the_gaps, gaps_that_all_differ_take_their_mean_taken_down, a_mean_is_rounded_half_up, two_equally_common_gaps_give_the_smaller, an_overlapping_pair_in_a_row_is_tidied_and_its_negative_gap_counts, a_grid_is_tidied_by_columns, a_transposed_grid_is_tidied_by_rows, layers_on_a_diagonal_are_unavailable, an_irregular_selection_is_unavailable and the rest). | | 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start); FigCraft draws it opaque (how Figma treats a translucent fill was not measured); gradient, image and hidden fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | | 2026-11-10 | minor | The Rotation field shows and sets the layer's rotation on the page (its own angle plus its parents' when no ancestor is flipped; with a flipped ancestor FigCraft reads the composed angle, which flips the sign of the layer's own angle, and Figma's behaviour there was not measured), in frames and groups alike, as measured in Figma's web app for rotated, unflipped parents (#2196) | | 2026-11-09 | patch | M3, #2189: the eyedropper picks the colour the canvas shows. It sampled a 1x1 render without the canvas's magnified-image pixels, so on an image magnified past 2x it blended a 1 px line with its neighbours (#3D444D picked as #343B44 beside #151B23), and the pixel it sampled began at the pointer instead of being centred on it. It now matches the canvas when zoomed in; zoomed out it still samples the full-resolution image, not the smaller copy the canvas may show. Test: `eyedropper_image_tests` | From e276b1e4ff989d68451c6772b49a13617ce71398 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 17:04:23 -0500 Subject: [PATCH 206/239] M10: SwiftUI, Compose and Flutter code export writes every colour and gradient fill, in paint order (#2271) Part of #2271. The native targets took ONE colour from a layer (`first_fill`: the bottom visible solid, or a gradient's first stop) and dropped every other fill, so a frame with white, a gradient and 50% black came out as flat white. Now SwiftUI, Compose and Flutter write every visible solid and gradient fill of a frame, group, rectangle or ellipse, in paint order, and a gradient as a gradient. A shared `visible_fills` gives each target the same list (document order, bottom first); each target only formats it. - SwiftUI: chained `.background(...)`, top fill first, since each one goes behind the ones before it. A rectangle or ellipse fills with the bottom paint and lays a copy of the shape over it (`.overlay`) for each paint above, bottom first. - Compose: chained `Modifier.background(...)`, bottom fill first, since each one draws over the ones before it. A linear gradient snaps to one of eight directions (a modifier doesn't know pixels); radial and angular ones sit at the box's centre. - Flutter: a `BoxDecoration` paints one colour or gradient, so the Container keeps the top fill and each fill under it becomes a `DecoratedBox` around the widget, the bottom fill outermost. The drop shadow goes on the outermost box so it never lies over a lower fill. An instance's call is now made once, in `flutter_placed`. A layer with one solid fill gives the same code as before, variable names included (only the paint at index 0, when solid, takes the `fill` variable's name). A lone gradient used to come out as its first stop's colour and is now a gradient. Still not written: image and pattern fills in the native targets, ArkUI (one background and one gradient per component, so a stack needs extra nodes) and text with several fills. Figma's iOS and Android output was not measured: the order follows how each platform paints. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/dev/codegen.rs | 215 ++++++++++++++++++++++- crates/engine/src/dev/codegen/compose.rs | 59 ++++++- crates/engine/src/dev/codegen/flutter.rs | 120 +++++++++++-- crates/engine/src/dev/codegen/swift.rs | 57 ++++-- docs/dev-mode-parity.md | 5 +- 5 files changed, 423 insertions(+), 33 deletions(-) diff --git a/crates/engine/src/dev/codegen.rs b/crates/engine/src/dev/codegen.rs index 202f7ef0f..a7ab9e5ba 100644 --- a/crates/engine/src/dev/codegen.rs +++ b/crates/engine/src/dev/codegen.rs @@ -6,7 +6,7 @@ //! their iOS and Android code syntax in SwiftUI and Compose. The output is a starting point, not a //! pixel-exact translation. -use figcraft_color::{Color, PaintKind}; +use figcraft_color::{Color, Gradient, GradientKind, Paint, PaintKind}; use figcraft_doc::{ ContentAlign, CrossAlign, Document, EffectKind, LayoutMode, LetterSpacing, LineHeight, MainAlign, Node, NodeId, NodeKind, Shadow, Sizing, TextAlignH, TextCase, TextDecoration, Variable, @@ -345,6 +345,35 @@ fn first_fill(n: &Node) -> Option { }) } +/// A layer's visible fills with their place in the document. Document order is bottom first, as +/// the renderer paints them; the index tells a target which paint is the bottom one. +fn visible_fills(n: &Node) -> impl DoubleEndedIterator { + n.fills.iter().enumerate().filter(|(_, p)| p.visible) +} + +/// A gradient's sorted stops as (position, colour), the paint's opacity folded into each colour. +/// A lone stop is written twice (at 1 as well), since Android and Flutter need two colours. +fn gradient_stops(g: &Gradient, opacity: f32) -> Vec<(f64, Color)> { + let mut stops: Vec<(f64, Color)> = g.sorted_stops().iter().map(|s| (f64::from(s.position), s.color.with_alpha(s.color.a * opacity))).collect(); + if let [(_, only)] = stops[..] { + stops.push((1.0, only)); + } + stops +} + +/// A gradient's main axis in pixels on a `w` x `h` box. +fn gradient_axis(g: &Gradient, w: f64, h: f64) -> (f64, f64) { + ((g.to.0 - g.from.0) * w, (g.to.1 - g.from.1) * h) +} + +/// The kind a native target writes: a diamond reads as a radial gradient. +fn native_gradient_kind(g: &Gradient) -> GradientKind { + match g.kind { + GradientKind::Diamond => GradientKind::Radial, + k => k, + } +} + fn stroke_color(n: &Node) -> Option { if !n.has_visible_stroke() { return None; @@ -765,4 +794,188 @@ mod tests { } } } + + /// White, a 20% default linear gradient of black, then 50% black: bottom to top. + fn three_fills() -> Vec { + let mut gradient = figcraft_color::Paint::gradient(figcraft_color::Gradient::default_for(figcraft_color::GradientKind::Linear, Color::BLACK)); + gradient.opacity = 0.2; + let mut top = figcraft_color::Paint::solid(Color::BLACK); + top.opacity = 0.5; + vec![figcraft_color::Paint::solid(Color::WHITE), gradient, top] + } + + /// A 200 x `h` layer of `kind` (`frame`, `rectangle` or `ellipse`, a rectangle with corner + /// radius 8) with exactly `fills`. + fn fill_layer(s: &mut Session, kind: &str, h: f64, fills: Vec) -> NodeId { + let id = match kind { + "frame" => id_of(&s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 200, "height": h})).unwrap()["id"]).unwrap(), + _ => id_of(&s.execute(&format!("shape.{kind}"), &json!({"x": 0, "y": 0, "width": 200, "height": h})).unwrap()["id"]).unwrap(), + }; + if kind == "rectangle" { + s.execute("node.set", &json!({"id": id, "props": {"cornerRadius": 8}})).unwrap(); + } + s.doc_mut().unwrap().get_mut(id).unwrap().fills = fills; + id + } + + fn one_gradient(s: &mut Session, g: figcraft_color::Gradient) -> NodeId { + fill_layer(s, "frame", 120.0, vec![figcraft_color::Paint::gradient(g)]) + } + + const SWIFT_WHITE: &str = "Color(red: 1, green: 1, blue: 1, opacity: 1)"; + const SWIFT_HALF: &str = "Color(red: 0, green: 0, blue: 0, opacity: 0.5)"; + const SWIFT_GRADIENT: &str = "LinearGradient(stops: [Gradient.Stop(color: Color(red: 0, green: 0, blue: 0, opacity: 0.2), location: 0), Gradient.Stop(color: Color(red: 0, green: 0, blue: 0, opacity: 0), location: 1)], startPoint: UnitPoint(x: 0.5, y: 0), endPoint: UnitPoint(x: 0.5, y: 1))"; + + #[test] + fn swiftui_writes_every_fill_top_first() { + let mut s = Session::new(); + let f = fill_layer(&mut s, "frame", 120.0, three_fills()); + let code = code_for(s.doc().unwrap(), f, CodeLang::SwiftUi); + let backgrounds: Vec<&str> = code.lines().map(str::trim).filter(|l| l.starts_with(".background(")).collect(); + let want = [format!(".background({SWIFT_HALF})"), format!(".background({SWIFT_GRADIENT})"), format!(".background({SWIFT_WHITE})")]; + assert_eq!(backgrounds, want.iter().map(String::as_str).collect::>(), "{code}"); + } + + #[test] + fn swiftui_shapes_fill_with_the_bottom_paint_and_overlay_the_rest() { + let mut s = Session::new(); + let r = fill_layer(&mut s, "rectangle", 120.0, three_fills()); + let code = code_for(s.doc().unwrap(), r, CodeLang::SwiftUi); + let mods: Vec<&str> = code.lines().map(str::trim).filter(|l| l.starts_with('.')).collect(); + let want = [ + format!(".fill({SWIFT_WHITE})"), + format!(".overlay(RoundedRectangle(cornerRadius: 8).fill({SWIFT_GRADIENT}))"), + format!(".overlay(RoundedRectangle(cornerRadius: 8).fill({SWIFT_HALF}))"), + ".frame(width: 200, height: 120)".to_string(), + ]; + assert_eq!(mods, want.iter().map(String::as_str).collect::>(), "{code}"); + assert!(!code.contains(".background("), "{code}"); + let mut half = figcraft_color::Paint::solid(Color::BLACK); + half.opacity = 0.5; + let e = fill_layer(&mut s, "ellipse", 120.0, vec![figcraft_color::Paint::solid(Color::WHITE), half]); + let code = code_for(s.doc().unwrap(), e, CodeLang::SwiftUi); + assert!(code.contains(&format!(".overlay(Ellipse().fill({SWIFT_HALF}))")), "{code}"); + } + + #[test] + fn compose_writes_every_fill_bottom_first() { + let mut s = Session::new(); + let f = fill_layer(&mut s, "frame", 120.0, three_fills()); + let code = code_for(s.doc().unwrap(), f, CodeLang::Compose); + let want = "Modifier.size(200.dp, 120.dp).background(Color(0xFFFFFFFF), RectangleShape).background(Brush.linearGradient(0f to Color(0x33000000), 1f to Color(0x00000000), start = Offset(0f, 0f), end = Offset(0f, Float.POSITIVE_INFINITY)), RectangleShape).background(Color(0x80000000), RectangleShape)"; + assert!(code.contains(want), "{code}"); + let r = fill_layer(&mut s, "rectangle", 120.0, three_fills()); + let code = code_for(s.doc().unwrap(), r, CodeLang::Compose); + assert_eq!(code.matches(".background(").count(), 3, "{code}"); + assert_eq!(code.matches(", RoundedCornerShape(8.dp))").count(), 3, "{code}"); + assert!(code.contains(".background(Color(0xFFFFFFFF), RoundedCornerShape(8.dp)).background(Brush."), "{code}"); + } + + #[test] + fn flutter_nests_a_box_per_fill_bottom_outermost() { + let mut s = Session::new(); + let f = fill_layer(&mut s, "frame", 120.0, three_fills()); + let code = code_for(s.doc().unwrap(), f, CodeLang::Flutter); + let want = "DecoratedBox( + decoration: BoxDecoration( + color: Color(0xFFFFFFFF), + ), + child: DecoratedBox( + decoration: BoxDecoration( + gradient: LinearGradient(begin: Alignment(0, -1), end: Alignment(0, 1), colors: [Color(0x33000000), Color(0x00000000)], stops: [0, 1]), + ), + child: Container( + width: 200, + height: 120, + decoration: BoxDecoration( + color: Color(0x80000000), + ), + ) + ) +)"; + assert_eq!(code, want); + } + + #[test] + fn flutter_keeps_the_shadow_under_every_fill() { + let mut s = Session::new(); + let f = fill_layer(&mut s, "frame", 120.0, three_fills()); + s.execute("effect.add", &json!({"ids": [f], "type": "dropShadow"})).unwrap(); + let code = code_for(s.doc().unwrap(), f, CodeLang::Flutter); + assert_eq!(code.matches("boxShadow:").count(), 1, "{code}"); + let (shadow, gradient) = (code.find("boxShadow:").unwrap(), code.find("gradient:").unwrap()); + assert!(shadow < gradient, "the shadow is on the outermost box: {code}"); + let r = fill_layer(&mut s, "rectangle", 120.0, three_fills()); + let code = code_for(s.doc().unwrap(), r, CodeLang::Flutter); + assert_eq!(code.matches("borderRadius: BorderRadius.circular(8)").count(), 3, "{code}"); + } + + #[test] + fn native_gradients_are_written_as_gradients() { + use figcraft_color::{Gradient, GradientKind}; + let mut s = Session::new(); + let radial = one_gradient(&mut s, Gradient::default_for(GradientKind::Radial, Color::BLACK)); + let doc = s.doc().unwrap(); + let sw = code_for(doc, radial, CodeLang::SwiftUi); + assert!(sw.contains("RadialGradient(stops: ["), "{sw}"); + assert!(sw.contains("center: UnitPoint(x: 0.5, y: 0.5), startRadius: 0, endRadius: 60)"), "{sw}"); + let kt = code_for(doc, radial, CodeLang::Compose); + assert!(kt.contains(".background(Brush.radialGradient(0f to Color(0xFF000000), 1f to Color(0x00000000)), RectangleShape)"), "{kt}"); + let dart = code_for(doc, radial, CodeLang::Flutter); + assert!( + dart.contains( + "gradient: RadialGradient(center: Alignment(0, 0), radius: 0.5, colors: [Color(0xFF000000), Color(0x00000000)], stops: [0, 1])" + ), + "{dart}" + ); + let angular = one_gradient(&mut s, Gradient::default_for(GradientKind::Angular, Color::BLACK)); + let doc = s.doc().unwrap(); + assert!(code_for(doc, angular, CodeLang::SwiftUi).contains("angle: .degrees(90))")); + assert!(code_for(doc, angular, CodeLang::Compose).contains("Brush.sweepGradient(")); + assert!(code_for(doc, angular, CodeLang::Flutter).contains("transform: GradientRotation(1.57))")); + // Compose snaps a linear gradient to one of eight directions. + let mut directed = |from: (f64, f64), to: (f64, f64)| { + let mut g = Gradient::default_for(GradientKind::Linear, Color::BLACK); + (g.from, g.to) = (from, to); + let id = one_gradient(&mut s, g); + code_for(s.doc().unwrap(), id, CodeLang::Compose) + }; + let up = directed((0.5, 1.0), (0.5, 0.0)); + assert!(up.contains("start = Offset(0f, Float.POSITIVE_INFINITY), end = Offset(0f, 0f)"), "{up}"); + let right = directed((0.0, 0.5), (1.0, 0.5)); + assert!(right.contains("end = Offset(Float.POSITIVE_INFINITY, 0f)"), "{right}"); + let corner = directed((0.0, 0.0), (1.0, 1.0)); + assert!(corner.contains("end = Offset(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY)"), "{corner}"); + // A single stop is written twice, since a brush needs two colours. + let mut one = Gradient::default_for(GradientKind::Linear, Color::BLACK); + one.stops.truncate(1); + let id = one_gradient(&mut s, one); + let kt = code_for(s.doc().unwrap(), id, CodeLang::Compose); + assert_eq!(kt.matches(" to Color(").count(), 2, "{kt}"); + } + + #[test] + fn one_solid_fill_is_unchanged_in_native_code() { + let mut hidden = figcraft_color::Paint::solid(Color::BLACK); + hidden.visible = false; + let mut s = Session::new(); + for fills in [vec![figcraft_color::Paint::solid(Color::WHITE)], vec![figcraft_color::Paint::solid(Color::WHITE), hidden]] { + let f = fill_layer(&mut s, "frame", 100.0, fills); + let doc = s.doc().unwrap(); + let sw = code_for(doc, f, CodeLang::SwiftUi); + let backgrounds: Vec<&str> = sw.lines().map(str::trim).filter(|l| l.starts_with(".background(")).collect(); + assert_eq!(backgrounds, [format!(".background({SWIFT_WHITE})")], "{sw}"); + assert!(!sw.contains("Gradient"), "{sw}"); + let kt = code_for(doc, f, CodeLang::Compose); + assert!(kt.contains("Modifier.size(200.dp, 100.dp).background(Color(0xFFFFFFFF), RectangleShape))"), "{kt}"); + assert!(!kt.contains("Brush"), "{kt}"); + let dart = code_for(doc, f, CodeLang::Flutter); + assert!( + dart.starts_with("Container(\n width: 200,\n height: 100,\n decoration: BoxDecoration(\n color: Color(0xFFFFFFFF),\n ),\n)"), + "{dart}" + ); + assert!(!dart.contains("DecoratedBox"), "{dart}"); + assert!(code_for(doc, f, CodeLang::ArkUi).contains(".backgroundColor('#FFFFFF')")); + } + } } diff --git a/crates/engine/src/dev/codegen/compose.rs b/crates/engine/src/dev/codegen/compose.rs index c9cbf3ed1..799ba0882 100644 --- a/crates/engine/src/dev/codegen/compose.rs +++ b/crates/engine/src/dev/codegen/compose.rs @@ -1,6 +1,7 @@ use super::swift::one_line; use super::{ - CodeLang, Color, Ctx, LayoutMode, Node, NodeId, NodeKind, PADDING, drop_shadow, first_fill, indent, literal, named, num, radius, stroke_color, + CodeLang, Color, Ctx, GradientKind, LayoutMode, Node, NodeId, NodeKind, PADDING, Paint, PaintKind, drop_shadow, first_fill, gradient_axis, + gradient_stops, indent, literal, named, native_gradient_kind, num, radius, stroke_color, visible_fills, }; use figcraft_doc::Document; @@ -22,14 +23,66 @@ fn bound_dp(doc: &Document, n: &Node, fields: &[&str], value: f64) -> String { bound(doc, n, fields, format!("{}.dp", num(value))) } +/// One end of a linear brush's axis along one direction: `sign` is 0 for none, 1 for with the +/// axis and -1 against it. `Float.POSITIVE_INFINITY` stands for the far edge, which a modifier +/// can't know in pixels. +fn compose_edge(sign: i8) -> (&'static str, &'static str) { + match sign { + 0 => ("0f", "0f"), + s if s > 0 => ("0f", "Float.POSITIVE_INFINITY"), + _ => ("Float.POSITIVE_INFINITY", "0f"), + } +} + +/// A direction's sign: its component counts as none when it is at most tan 22.5 degrees of the other. +fn compose_sign(v: f64, other: f64) -> i8 { + if v.abs() <= 0.4142 * other.abs() { + 0 + } else if v > 0.0 { + 1 + } else { + -1 + } +} + +/// A gradient fill as a Compose `Brush` for a `w` x `h` layer. A linear gradient snaps to the +/// nearest of eight directions; radial and angular ones sit at the box's centre. +fn compose_gradient(g: &figcraft_color::Gradient, w: f64, h: f64, opacity: f32) -> String { + let stops = gradient_stops(g, opacity).into_iter().map(|(at, c)| format!("{}f to {}", num(at), kotlin_color(c))).collect::>().join(", "); + match native_gradient_kind(g) { + GradientKind::Linear => { + let (dx, dy) = gradient_axis(g, w, h); + let (sx, sy) = if dx == 0.0 && dy == 0.0 { (0, 1) } else { (compose_sign(dx, dy), compose_sign(dy, dx)) }; + let ((x0, x1), (y0, y1)) = (compose_edge(sx), compose_edge(sy)); + format!("Brush.linearGradient({stops}, start = Offset({x0}, {y0}), end = Offset({x1}, {y1}))") + } + GradientKind::Angular => format!("Brush.sweepGradient({stops})"), + _ => format!("Brush.radialGradient({stops})"), + } +} + +/// One paint (the one at document index `i`) as the first argument of `background`; `None` for an +/// image or pattern. Only a solid at index 0 takes the `fill` variable's name. +fn compose_paint(doc: &Document, n: &Node, i: usize, p: &Paint) -> Option { + match &p.kind { + PaintKind::Solid { .. } => { + let c = kotlin_color(p.solid_color()?); + Some(if i == 0 { bound(doc, n, &["fill"], c) } else { c }) + } + PaintKind::Gradient(g) => Some(compose_gradient(g, n.width, n.height, p.opacity)), + PaintKind::Image(_) | PaintKind::Pattern(_) => None, + } +} + /// The Modifier chain for a layer (size, shadow, background, border, alpha, padding). fn modifier(doc: &Document, n: &Node, shape: &str, padding: bool) -> String { let mut m = format!("Modifier.size({}, {})", bound_dp(doc, n, &["width"], n.width), bound_dp(doc, n, &["height"], n.height)); if let Some(s) = drop_shadow(n) { m.push_str(&format!(".shadow({}.dp, {shape})", num(s.radius / 2.0))); } - if let Some(c) = first_fill(n) { - m.push_str(&format!(".background({}, {shape})", bound(doc, n, &["fill"], kotlin_color(c)))); + // Each background draws and lets the rest of the chain draw over it: bottom fill first. + for b in visible_fills(n).filter_map(|(i, p)| compose_paint(doc, n, i, p)) { + m.push_str(&format!(".background({b}, {shape})")); } if let Some(c) = stroke_color(n) { m.push_str(&format!( diff --git a/crates/engine/src/dev/codegen/flutter.rs b/crates/engine/src/dev/codegen/flutter.rs index 98f280eaf..f316941a6 100644 --- a/crates/engine/src/dev/codegen/flutter.rs +++ b/crates/engine/src/dev/codegen/flutter.rs @@ -2,8 +2,9 @@ use figcraft_doc::AutoLayout; use super::swift::one_line; use super::{ - CodeLang, CrossAlign, Ctx, LayoutMode, LetterSpacing, LineHeight, MainAlign, Node, NodeId, NodeKind, Param, Sizing, TextAlignH, TextDecoration, - drop_shadow, first_fill, kotlin_color, literal, num, radius, stroke_color, + CodeLang, CrossAlign, Ctx, GradientKind, LayoutMode, LetterSpacing, LineHeight, MainAlign, Node, NodeId, NodeKind, Paint, PaintKind, Param, + Sizing, TextAlignH, TextDecoration, drop_shadow, first_fill, gradient_axis, gradient_stops, kotlin_color, literal, native_gradient_kind, num, + radius, stroke_color, visible_fills, }; // ------------------------------------------------------------------ Flutter (Dart) @@ -74,22 +75,72 @@ fn flutter_padding(n: &Node) -> Option { }) } +/// A gradient's colours and stops, the tail of every Flutter gradient constructor. +fn flutter_colors(g: &figcraft_color::Gradient, opacity: f32) -> String { + let stops = gradient_stops(g, opacity); + let colors = stops.iter().map(|(_, c)| kotlin_color(*c)).collect::>().join(", "); + let at = stops.iter().map(|(at, _)| num(*at)).collect::>().join(", "); + format!("colors: [{colors}], stops: [{at}]") +} + +/// A point of the unit box as Flutter's `Alignment`, which runs from -1 to 1. +fn flutter_alignment(p: (f64, f64)) -> String { + format!("Alignment({}, {})", num(2.0 * p.0 - 1.0), num(2.0 * p.1 - 1.0)) +} + +/// A gradient fill on a layer of `w` x `h` as a Flutter gradient. +fn flutter_gradient(g: &figcraft_color::Gradient, w: f64, h: f64, opacity: f32) -> String { + let (dx, dy) = gradient_axis(g, w, h); + let (tail, from) = (flutter_colors(g, opacity), flutter_alignment(g.from)); + match native_gradient_kind(g) { + GradientKind::Linear => format!("LinearGradient(begin: {from}, end: {}, {tail})", flutter_alignment(g.to)), + GradientKind::Angular => format!("SweepGradient(center: {from}, {tail}, transform: GradientRotation({}))", num(dy.atan2(dx))), + _ => { + // Flutter's radius is a fraction of the box's shorter side. + let (reach, side) = (dx.hypot(dy), w.min(h)); + let radius = if reach > 0.0 && side > 0.0 { reach / side } else { 0.5 }; + format!("RadialGradient(center: {from}, radius: {}, {tail})", num(radius)) + } + } +} + +/// One paint as a `BoxDecoration` part (`color: ...` or `gradient: ...`); `None` for an image or +/// pattern, which no native target writes yet. +fn flutter_paint(n: &Node, p: &Paint) -> Option { + match &p.kind { + PaintKind::Solid { .. } => Some(format!("color: {}", kotlin_color(p.solid_color()?))), + PaintKind::Gradient(g) => Some(format!("gradient: {}", flutter_gradient(g, n.width, n.height, p.opacity))), + PaintKind::Image(_) | PaintKind::Pattern(_) => None, + } +} + +/// Whether a layer is written as a `Container`: the layers with a box to paint. +fn paints_a_box(n: &Node) -> bool { + matches!(n.kind, NodeKind::Ellipse { .. } | NodeKind::Rectangle | NodeKind::Group) || n.kind.is_frame_like() +} + +/// A layer's fills as `BoxDecoration` parts, bottom first. +fn flutter_fill_parts(n: &Node) -> Vec { + visible_fills(n).filter_map(|(_, p)| flutter_paint(n, p)).collect() +} + /// A layer's fill, shape, corner radius, stroke and shadow as a `BoxDecoration`; `None` when it has -/// none of them. `pad` is the indentation of the constructor itself. -fn box_decoration(n: &Node, pad: &str) -> Option { +/// none of them. `pad` is the indentation of the constructor itself; `fill` is the one fill part +/// this decoration paints, and `stroke` and `shadow` say whether it carries those. +fn box_decoration(n: &Node, pad: &str, fill: Option<&str>, stroke: bool, shadow: bool) -> Option { let mut parts: Vec = Vec::new(); - if let Some(c) = first_fill(n) { - parts.push(format!("color: {}", kotlin_color(c))); + if let Some(f) = fill { + parts.push(f.to_string()); } if matches!(n.kind, NodeKind::Ellipse { .. }) { parts.push("shape: BoxShape.circle".into()); } else if radius(n) > 0.0 { parts.push(format!("borderRadius: BorderRadius.circular({})", num(radius(n)))); } - if let Some(c) = stroke_color(n) { + if let Some(c) = stroke_color(n).filter(|_| stroke) { parts.push(format!("border: Border.all(color: {}, width: {})", kotlin_color(c), num(n.stroke.weight))); } - if let Some(s) = drop_shadow(n) { + if let Some(s) = drop_shadow(n).filter(|_| shadow) { parts.push(format!( "boxShadow: [BoxShadow(color: {}, blurRadius: {}, offset: Offset({}, {}))]", kotlin_color(s.color), @@ -105,6 +156,42 @@ fn box_decoration(n: &Node, pad: &str) -> Option { Some(format!("BoxDecoration(\n{}{pad})", parts.iter().map(|p| format!("{inner}{p},\n")).collect::())) } +/// What a `Container` paints itself: its own fill (the top one), and whether it carries the shadow +/// (only when no `DecoratedBox` does). +struct Painted { + fill: Option, + shadow: bool, +} + +/// Opens a `DecoratedBox` for each fill under the top one, the bottom fill outermost, and returns +/// what is left for the `Container`. The outermost box carries the drop shadow: a decoration paints +/// its shadow first, so on the `Container` it would lie over the lower fills. +fn flutter_fill_boxes(n: &Node, depth: &mut usize, close: &mut Vec, out: &mut String) -> Painted { + let mut parts = flutter_fill_parts(n); + let top = parts.pop(); + let shadow = parts.is_empty(); + for (at, part) in parts.iter().enumerate() { + let (pad, inner) = (flutter_indent(*depth), flutter_indent(*depth + 1)); + if close.is_empty() { + out.push_str(&pad); + } + let deco = box_decoration(n, &inner, Some(part), false, at == 0).unwrap_or_default(); + out.push_str(&format!("DecoratedBox(\n{inner}decoration: {deco},\n{inner}child: ")); + close.push(format!("\n{pad})")); + *depth += 1; + } + Painted { fill: top, shadow } +} + +/// The call an instance below the root is (an instance swap parameter is a widget); `None` for +/// every other layer. +fn flutter_call(ctx: &Ctx, n: &Node, depth: usize) -> Option { + match ctx.param(n, "mainComponent").filter(|_| n.id != ctx.root) { + Some(p) => Some(p.ident.clone()), + None => ctx.call(n, CodeLang::Flutter, depth).map(|(code, _)| code), + } +} + /// Flutter for a layer and its subtree at `depth`. A layer a boolean parameter shows sits behind an /// `if (…)`: Dart's lists take conditions, so the element itself carries it. pub(crate) fn flutter(ctx: &Ctx, id: NodeId, depth: usize, out: &mut String, place: Place) { @@ -150,9 +237,13 @@ fn flutter_placed(ctx: &Ctx, n: &Node, depth: usize, out: &mut String, place: Pl close.push(format!("\n{pad})")); depth += 1; } + // An instance is a call, made once: it gets no fill boxes, so this is its final depth. + let call = flutter_call(ctx, n, depth); + let painted = + if call.is_none() && paints_a_box(n) { flutter_fill_boxes(n, &mut depth, &mut close, out) } else { Painted { fill: None, shadow: true } }; // A wrapper leaves its line open ("child: "), so the widget carries no indentation of its own. let mut body = String::new(); - flutter_widget(ctx, n, depth, &mut body); + flutter_widget(ctx, n, depth, call, &painted, &mut body); out.push_str(if close.is_empty() { body.as_str() } else { body.trim_start() }); for c in close.iter().rev() { out.push_str(c); @@ -161,13 +252,8 @@ fn flutter_placed(ctx: &Ctx, n: &Node, depth: usize, out: &mut String, place: Pl /// A layer's own look and its subtree as a Flutter widget at `depth`: a complete expression whose /// closing parenthesis sits at `depth`. -fn flutter_widget(ctx: &Ctx, n: &Node, depth: usize, out: &mut String) { +fn flutter_widget(ctx: &Ctx, n: &Node, depth: usize, call: Option, painted: &Painted, out: &mut String) { let (pad, inner) = (flutter_indent(depth), flutter_indent(depth + 1)); - // Nested instances are calls; an instance swap parameter is a widget. - let call = match ctx.param(n, "mainComponent").filter(|_| n.id != ctx.root) { - Some(p) => Some(p.ident.clone()), - None => ctx.call(n, CodeLang::Flutter, depth).map(|(code, _)| code), - }; if let Some(call) = call { out.push_str(call.trim_end_matches('\n')); return; @@ -216,7 +302,7 @@ fn flutter_widget(ctx: &Ctx, n: &Node, depth: usize, out: &mut String) { } NodeKind::Ellipse { .. } | NodeKind::Rectangle => { out.push_str(&format!("{pad}Container(\n{inner}width: {},\n{inner}height: {},\n", num(n.width), num(n.height))); - if let Some(d) = box_decoration(n, &inner) { + if let Some(d) = box_decoration(n, &inner, painted.fill.as_deref(), true, painted.shadow) { out.push_str(&format!("{inner}decoration: {d},\n")); } out.push_str(&format!("{pad})")); @@ -232,7 +318,7 @@ fn flutter_widget(ctx: &Ctx, n: &Node, depth: usize, out: &mut String) { if !padded_inside && let Some(p) = flutter_padding(n) { out.push_str(&format!("{inner}padding: {p},\n")); } - if let Some(d) = box_decoration(n, &inner) { + if let Some(d) = box_decoration(n, &inner, painted.fill.as_deref(), true, painted.shadow) { out.push_str(&format!("{inner}decoration: {d},\n")); } if children.is_empty() && slot.is_none() { diff --git a/crates/engine/src/dev/codegen/swift.rs b/crates/engine/src/dev/codegen/swift.rs index 99c065a0a..553f4f296 100644 --- a/crates/engine/src/dev/codegen/swift.rs +++ b/crates/engine/src/dev/codegen/swift.rs @@ -1,5 +1,6 @@ use super::{ - CodeLang, Color, Ctx, LayoutMode, Node, NodeId, NodeKind, PADDING, drop_shadow, first_fill, indent, literal, named, num, radius, stroke_color, + CodeLang, Color, Ctx, Document, GradientKind, LayoutMode, Node, NodeId, NodeKind, PADDING, Paint, PaintKind, drop_shadow, first_fill, + gradient_axis, gradient_stops, indent, literal, named, native_gradient_kind, num, radius, stroke_color, visible_fills, }; // ------------------------------------------------------------------ SwiftUI @@ -8,6 +9,47 @@ fn swift_color(c: Color) -> String { format!("Color(red: {}, green: {}, blue: {}, opacity: {})", num(f64::from(c.r)), num(f64::from(c.g)), num(f64::from(c.b)), num(f64::from(c.a))) } +fn swift_point(p: (f64, f64)) -> String { + format!("UnitPoint(x: {}, y: {})", num(p.0), num(p.1)) +} + +/// A gradient fill on a layer of `w` x `h` as a SwiftUI gradient. +fn swift_gradient(g: &figcraft_color::Gradient, w: f64, h: f64, opacity: f32) -> String { + let stops = gradient_stops(g, opacity) + .into_iter() + .map(|(at, c)| format!("Gradient.Stop(color: {}, location: {})", swift_color(c), num(at))) + .collect::>() + .join(", "); + let (dx, dy) = gradient_axis(g, w, h); + match native_gradient_kind(g) { + GradientKind::Linear => format!("LinearGradient(stops: [{stops}], startPoint: {}, endPoint: {})", swift_point(g.from), swift_point(g.to)), + GradientKind::Angular => { + format!("AngularGradient(stops: [{stops}], center: {}, angle: .degrees({}))", swift_point(g.from), num(dy.atan2(dx).to_degrees())) + } + _ => format!("RadialGradient(stops: [{stops}], center: {}, startRadius: 0, endRadius: {})", swift_point(g.from), num(dx.hypot(dy))), + } +} + +/// One paint (the one at document index `i`) as SwiftUI; `None` for an image or pattern, which no +/// native target writes yet. Only a solid at index 0 takes the `fill` variable's name. +fn swift_paint(doc: &Document, n: &Node, i: usize, p: &Paint) -> Option { + match &p.kind { + PaintKind::Solid { .. } => { + let c = swift_color(p.solid_color()?); + Some(if i == 0 { named(doc, n, "iOS", &["fill"], c) } else { c }) + } + PaintKind::Gradient(g) => Some(swift_gradient(g, n.width, n.height, p.opacity)), + PaintKind::Image(_) | PaintKind::Pattern(_) => None, + } +} + +/// The modifiers filling a rectangle or ellipse: the bottom paint fills the `shape`, and each paint +/// above it is a copy of the shape laid over it. +fn swift_shape_fills(doc: &Document, n: &Node, shape: &str) -> Vec { + let paints = visible_fills(n).filter_map(|(i, p)| swift_paint(doc, n, i, p)); + paints.enumerate().map(|(at, c)| if at == 0 { format!(".fill({c})") } else { format!(".overlay({shape}.fill({c}))") }).collect() +} + fn swift_weight(w: u16) -> &'static str { match w { 0..=150 => ".thin", @@ -84,16 +126,12 @@ fn swift_layer(ctx: &Ctx, n: &Node, depth: usize, out: &mut String, extra: &[Str } NodeKind::Ellipse { .. } => { out.push_str(&format!("{pad}Ellipse()\n")); - if let Some(c) = &fill { - mods.push(format!(".fill({c})")); - } + mods.extend(swift_shape_fills(doc, n, "Ellipse()")); mods.push(format!(".frame(width: {w}, height: {h})")); } NodeKind::Rectangle => { out.push_str(&format!("{pad}RoundedRectangle(cornerRadius: {corner})\n")); - if let Some(c) = &fill { - mods.push(format!(".fill({c})")); - } + mods.extend(swift_shape_fills(doc, n, &format!("RoundedRectangle(cornerRadius: {corner})"))); mods.push(format!(".frame(width: {w}, height: {h})")); } k if k.is_frame_like() || matches!(k, NodeKind::Group) => { @@ -142,9 +180,8 @@ fn swift_layer(ctx: &Ctx, n: &Node, depth: usize, out: &mut String, extra: &[Str } } mods.push(format!(".frame(width: {w}, height: {h}, alignment: .topLeading)")); - if let Some(c) = &fill { - mods.push(format!(".background({c})")); - } + // Each background goes behind the ones before it, so the top fill is written first. + mods.extend(visible_fills(n).rev().filter_map(|(i, p)| swift_paint(doc, n, i, p)).map(|c| format!(".background({c})"))); if radius(n) > 0.0 { mods.push(format!(".clipShape(RoundedRectangle(cornerRadius: {corner}))")); } diff --git a/docs/dev-mode-parity.md b/docs/dev-mode-parity.md index 66ef3a0ae..211cd4954 100644 --- a/docs/dev-mode-parity.md +++ b/docs/dev-mode-parity.md @@ -1,6 +1,6 @@ # Dev Mode parity -> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-09 · **Change:** patch (the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the Inspect tab then opens (never toggles away) with the caret in that layer's new-note field, and the engine never writes the note itself (#1840); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; class names transliterate non-ASCII layer names (#1235); measurements kept on the canvas; a read-only layers panel in Dev Mode; earlier: import lines in generated layer trees; compare with any saved version; Dev Mode behaviour suite: an inspect-only canvas, Changed in the ready list, statuses only on frames and sections; plugin panels from the Inspect tab) · **Target:** Figma Design Dev Mode (desktop app 126.10.7) +> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-12 · **Change:** patch (SwiftUI, Compose and Flutter code write every visible colour and gradient fill of a frame, group, rectangle or ellipse in paint order, gradients as gradients, instead of one colour per layer (chained `.background` in SwiftUI, chained `Modifier.background` in Compose, a `DecoratedBox` for each fill under the top one in Flutter); image and pattern fills, ArkUI and text still take one colour (#2271); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the Inspect tab then opens (never toggles away) with the caret in that layer's new-note field, and the engine never writes the note itself (#1840); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; class names transliterate non-ASCII layer names (#1235); measurements kept on the canvas; a read-only layers panel in Dev Mode; earlier: import lines in generated layer trees; compare with any saved version; Dev Mode behaviour suite: an inspect-only canvas, Changed in the ready list, statuses only on frames and sections; plugin panels from the Inspect tab) · **Target:** Figma Design Dev Mode (desktop app 126.10.7) **Breadth ~98%, ready ~78% (estimated).** The inspect surface is broad, components connect to the code components of a repository (with their imports, also inside generated layer trees), @@ -10,10 +10,11 @@ repository, third-party integrations. Remaining: 1–2 h. | Feature | Status | Notes | |---|---|---| +| 2026-11-12 | patch | SwiftUI, Compose and Flutter code export kept one colour per layer (the bottom visible solid, or a gradient's first stop) and dropped every other fill (#2271). Now each writes every visible solid and gradient fill of a frame, group, rectangle or ellipse, in paint order, and a gradient as a gradient. SwiftUI chains `.background(...)` with the top fill first, since each one goes behind the ones before it (a rectangle or ellipse fills with the bottom paint and lays a copy of the shape over it for each paint above). Compose chains `Modifier.background(...)` with the bottom fill first, since each one draws over the ones before it (a linear gradient snaps to eight directions, radial and angular ones sit at the box's centre). Flutter keeps the top fill in the `Container` and wraps each fill under it in a `DecoratedBox`, the bottom fill outermost and the drop shadow on the outermost box. A layer with one solid fill gives the same code as before; a lone gradient is now a gradient, not its first stop's colour. Still not written: image and pattern fills in the native targets, ArkUI (one background and one gradient per component, so a stack needs extra nodes) and text with several fills. The incumbent's iOS and Android output wasn't measured: the order follows how each platform paints. Percentages and hours unchanged | | 2026-11-07 | patch | Naming: the handoff mode is called Developer Mode in the interface, its shortcut row, its toasts, the control channel's refusal, the board refusal, the measurement parameter doc, the `.fig` export note, the CLI help and every catalog (24 languages, translations awaiting native review), since Figma holds a US registration for Dev Mode (7574348); command ids (`view.devMode`, `devMode.*`), preference keys and saved-document fields are unchanged, and the Actions palette still finds the command by the old name | | Dev Mode toggle (Shift+D), Inspect panel | done | the canvas only inspects: presses select, pan and comment but never move, resize, draw or edit text and vectors; menus and shortcuts refuse design edits with a note (Dev Mode's annotations, statuses, dev resources, measurements, code connections and comments still work); a drawing tool chosen in the toolbar goes back to the design. The layers panel only selects and expands (no renaming, reordering, hiding or locking; a double click says why), and the Pages list only opens pages (no adding, renaming, reordering, duplicating or deleting). Files dropped on the canvas aren't imported (a dropped document still opens as a file of its own), and the Assets panel places, swaps and applies nothing, doesn't change Hide when publishing, and doesn't accept library updates or add, remove or swap libraries; each says why | | Properties with their styles and variables; redlines on hover | done | positions from the frame around the layer (groups aren't frames), rotation, radius (CSS corner order), opacity, blend; colours in hex, RGB, CSS, HSL or HSB (`inspect.properties {colorFormat}`, the Inspect tab's Color format) | -| Code: CSS, iOS (SwiftUI), Android (Compose), Flutter | done | plus HTML, React, Vue and Leptos (ours; Leptos: `#[component]` functions with `#[prop]` defaults, variant enums and `view!` markup; Flutter is ours too: a `StatelessWidget` for a component, a widget tree for a layer); components take properties as parameters, instances are calls; CSS in px or rem (`inspect.code {unit, rootFontSize}`), with rotation, blend modes, gradient directions and kinds (linear, radial, conic), text alignment, case and decoration; class names from layer names transliterate non-ASCII scripts into readable ASCII (로그인 화면 → `rogeuin-hwamyeon`, кнопка → `knopka`, über → `uber`; symbols-only names take the node's kind, `.text`), and the 40-character cut lands on a word boundary (#1235) | +| Code: CSS, iOS (SwiftUI), Android (Compose), Flutter | done | plus HTML, React, Vue and Leptos (ours; Leptos: `#[component]` functions with `#[prop]` defaults, variant enums and `view!` markup; Flutter is ours too: a `StatelessWidget` for a component, a widget tree for a layer); components take properties as parameters, instances are calls; CSS in px or rem (`inspect.code {unit, rootFontSize}`), with rotation, blend modes, gradient directions and kinds (linear, radial, conic), text alignment, case and decoration; class names from layer names transliterate non-ASCII scripts into readable ASCII (로그인 화면 → `rogeuin-hwamyeon`, кнопка → `knopka`, über → `uber`; symbols-only names take the node's kind, `.text`), and the 40-character cut lands on a word boundary (#1235); SwiftUI, Compose and Flutter write every colour and gradient fill of a layer in paint order, gradients as gradients (chained `.background` in SwiftUI, top fill first; chained `Modifier.background` in Compose, bottom fill first, a linear gradient snapped to eight directions and radial and angular ones at the box's centre; in Flutter a `DecoratedBox` for each fill under the top one); the native targets don't write image or pattern fills yet, and ArkUI and text still take one colour (#2271) | | Assets list with export | done | layers with export settings, icons (small, vector shapes only: SVG) and images (PNG); the icon rule is ours | | Annotations: pinned properties, categories, coloured callouts, filter | done | the Annotation tool (Shift+T, `tool.annotation`) picks a layer by a click or from the selection and opens its note field in the Inspect tab. Figma's placement, cursor and whether the tool stays selected are unmeasured (Developer Mode is paywalled in the web app); staying selected until V or Escape, like the Comment tool, is inferred, and there is no toolbar button or icon yet | | Ready for dev list, statuses, "Changed" after edits | done | the list filters Ready for dev, Changed, Completed or any, and badges changed ones (`inspect.readyForDev {status: changed}`, `changed` per item); only sections and frames at the top of a page or section take a status (others are refused) | From 02199134b7c3e10ae665de94fb0ca77c0e751487 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 17:38:44 -0500 Subject: [PATCH 207/239] M10: Flutter code writes no spacing beside a space distribution flutter_line skipped `spacing:` when the main-axis alignment string contained "Space", but the strings are MainAxisAlignment.spaceBetween, spaceAround and spaceEvenly (lower-case s), so it never matched and the gap was written on top of the distribution. It now checks the MainAlign value itself. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote; Fable 5.2 spotted it --- crates/engine/src/dev/codegen.rs | 21 +++++++++++++++++++++ crates/engine/src/dev/codegen/flutter.rs | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/dev/codegen.rs b/crates/engine/src/dev/codegen.rs index 202f7ef0f..8d448a334 100644 --- a/crates/engine/src/dev/codegen.rs +++ b/crates/engine/src/dev/codegen.rs @@ -675,6 +675,27 @@ mod tests { assert!(!dart.lines().any(|l| l.trim_start().starts_with("void main()")), "a name never leaves its comment: {dart}"); } + #[test] + fn flutter_writes_no_spacing_for_the_space_distributions() { + // The space distributions spread the children themselves; a `spacing:` beside them would + // add the gap on top. + let mut s = Session::new(); + let row = id_of(&s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 300, "height": 40})).unwrap()["id"]).unwrap(); + s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 50, "height": 20, "parent": row})).unwrap(); + s.execute("shape.rectangle", &json!({"x": 60, "y": 0, "width": 50, "height": 20, "parent": row})).unwrap(); + s.execute("layout.add", &json!({"ids": [row], "direction": "horizontal"})).unwrap(); + for (align, flutter) in [("spaceBetween", "spaceBetween"), ("spaceAround", "spaceAround"), ("spaceEvenly", "spaceEvenly")] { + s.execute("node.set", &json!({"id": row, "props": {"gap": 10, "mainAlign": align}})).unwrap(); + let dart = code_for(s.doc().unwrap(), row, CodeLang::Flutter); + assert!(dart.contains(&format!("mainAxisAlignment: MainAxisAlignment.{flutter},")), "{dart}"); + assert!(!dart.contains("spacing:"), "{align} spreads the children itself: {dart}"); + } + // A packed line keeps its gap. + s.execute("node.set", &json!({"id": row, "props": {"gap": 10, "mainAlign": "center"}})).unwrap(); + let dart = code_for(s.doc().unwrap(), row, CodeLang::Flutter); + assert!(dart.contains("spacing: 10,"), "{dart}"); + } + #[test] fn flutter_expands_and_stretches_fill_children() { let mut s = Session::new(); diff --git a/crates/engine/src/dev/codegen/flutter.rs b/crates/engine/src/dev/codegen/flutter.rs index 98f280eaf..7a144a147 100644 --- a/crates/engine/src/dev/codegen/flutter.rs +++ b/crates/engine/src/dev/codegen/flutter.rs @@ -335,7 +335,7 @@ fn flutter_line(ctx: &Ctx, l: &AutoLayout, flow: &[Placed], slot: Option<&Param> out.push_str(&format!("{inner}textBaseline: TextBaseline.alphabetic,\n")); } // The gap between the children; the space distributions already spread them. - if l.gap > 0.0 && flutter_main_align(l.main_align).is_none_or(|m| !m.contains("Space")) { + if l.gap > 0.0 && !matches!(l.main_align, MainAlign::SpaceBetween | MainAlign::SpaceAround | MainAlign::SpaceEvenly) { out.push_str(&format!("{inner}spacing: {},\n", num(l.gap))); } out.push_str(&format!("{inner}children: [\n")); From 40360c4a2a2b4daec390a1d3a0ce6659adb4c4de Mon Sep 17 00:00:00 2001 From: ".CooCoo" Date: Thu, 12 Nov 2026 16:38:53 -0800 Subject: [PATCH 208/239] Fix main: clippy on Rust 1.100 stops at shortcuts.rs and the CLI script tests (#2316) Rust 1.100 marks `ExitCode` as must-use and extends `needless_bool`, so `cargo clippy --workspace --all-targets -- -D warnings` fails on main: - `crates/ui-egui/src/shortcuts.rs`: the end of `key_event` returns the condition directly instead of `if ... { return true; } false`. - `apps/figcraft-cli/src/files.rs`: three script tests now assert the exit code that `run_script` returns (`SUCCESS` for the two scripts that run, 1 for the script whose step fails) instead of dropping it. --- apps/figcraft-cli/src/files.rs | 6 +++--- crates/ui-egui/src/shortcuts.rs | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/figcraft-cli/src/files.rs b/apps/figcraft-cli/src/files.rs index a7bddeb3b..8f277e304 100644 --- a/apps/figcraft-cli/src/files.rs +++ b/apps/figcraft-cli/src/files.rs @@ -670,7 +670,7 @@ mod tests { ) .unwrap(); let out = dir.join("out.figcraft"); - run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(); + assert_eq!(run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(), ExitCode::SUCCESS); let mut s = Session::empty(); s.execute("file.open", &json!({"path": out.to_str().unwrap()})).unwrap(); @@ -700,7 +700,7 @@ mod tests { ) .unwrap(); let out = dir.join("out.figcraft"); - run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(); + assert_eq!(run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(), ExitCode::SUCCESS); let mut s = Session::empty(); s.execute("file.open", &json!({"path": out.to_str().unwrap()})).unwrap(); @@ -737,7 +737,7 @@ mod tests { .unwrap(); let out = dir.join("out.figcraft"); // The failure is the script's, not the call's: the CLI reports it and exits non-zero. - run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(); + assert_eq!(run_script(script.to_str().unwrap(), None, Some(out.to_str().unwrap())).unwrap(), ExitCode::from(1)); assert!(!out.exists(), "a script that failed writes nothing"); std::fs::remove_dir_all(dir).unwrap(); } diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index 3d312387b..1cac67b4b 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -521,10 +521,7 @@ fn key_event(app: &mut FigApp, key: Key, physical: Option, m: Modifiers, re } return true; } - if m.is_none() && !repeat && opacity_digit(app, key, now) { - return true; - } - false + m.is_none() && !repeat && opacity_digit(app, key, now) } /// Keys while a selection box drawn from the keyboard shows (`select.area`, Alt+Space or Ctrl+Space, From c47de279a765ce9151040f607f89a4b27c155d3d Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Fri, 13 Nov 2026 01:42:15 +0100 Subject: [PATCH 209/239] Keep huge finite values finite in round_to (#2309) Found while testing crates/geom/src/transform.rs:58 (round_to), used by crates/engine/src/automation/inspect.rs:517 (round) Co-authored-by: Claude Haiku 5.5 --- crates/geom/src/tests.rs | 6 ++++++ crates/geom/src/transform.rs | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/geom/src/tests.rs b/crates/geom/src/tests.rs index 019f22b83..897b9cbe6 100644 --- a/crates/geom/src/tests.rs +++ b/crates/geom/src/tests.rs @@ -306,6 +306,12 @@ fn round_to_handles_large_precision_without_changing_finite_values() { assert_eq!(round_to(1.23456, 2), 1.23); } +#[test] +fn round_to_keeps_huge_finite_values_finite() { + assert_eq!(round_to(1e307, 2), 1e307); + assert_eq!(round_to(-1e307, 2), -1e307); +} + #[test] fn reverse_subpaths_preserves_open_and_closed() { let mut open = BezPath::new(); diff --git a/crates/geom/src/transform.rs b/crates/geom/src/transform.rs index 69c6c788d..e0e743cd4 100644 --- a/crates/geom/src/transform.rs +++ b/crates/geom/src/transform.rs @@ -60,6 +60,11 @@ pub fn round_to(v: f64, digits: i32) -> f64 { if v.is_finite() && !f.is_finite() { return v; } - let r = (v * f).round() / f; + let scaled = v * f; + if v.is_finite() && !scaled.is_finite() { + // Too large to have a fractional part at this scale; already whole. + return v; + } + let r = scaled.round() / f; if r == 0.0 { 0.0 } else { r } } From 04a6c76a9b6a749f4826d3ba53d3039e2f8c2ff9 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Fri, 13 Nov 2026 01:42:52 +0100 Subject: [PATCH 210/239] Return an error for non-numeric miterLimit, cornerSmoothing and paragraph props (#2303) Found while testing crates/engine/src/cmd/props.rs:660 (also :710, :984, :985) Co-authored-by: Claude Haiku 5.5 --- crates/engine/src/cmd/props.rs | 14 ++++++++++---- crates/engine/src/shapes_behaviour_tests.rs | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/props.rs b/crates/engine/src/cmd/props.rs index 0e928793e..75889bb53 100644 --- a/crates/engine/src/cmd/props.rs +++ b/crates/engine/src/cmd/props.rs @@ -678,7 +678,7 @@ fn apply_look(cmd: &str, doc: &mut Document, id: NodeId, k: &str, v: &Value) -> "startCap" => doc.get_mut(id)?.stroke.cap_start = enum_of(v).ok_or_else(|| bad(cmd, format!("startCap: {STROKE_CAP_HELP}")))?, "endCap" => doc.get_mut(id)?.stroke.cap_end = enum_of(v).ok_or_else(|| bad(cmd, format!("endCap: {STROKE_CAP_HELP}")))?, "strokeJoin" => doc.get_mut(id)?.stroke.join = enum_of(v).ok_or_else(|| bad(cmd, "strokeJoin: miter|bevel|round"))?, - "miterLimit" => doc.get_mut(id)?.stroke.miter_limit = f64_of(v).unwrap_or(4.0).clamp(1.0, 100.0), + "miterLimit" => doc.get_mut(id)?.stroke.miter_limit = f64_of(v).ok_or_else(|| bad(cmd, "`miterLimit` must be a number"))?.clamp(1.0, 100.0), "miterAngle" => { let deg = f64_of(v).ok_or_else(|| bad(cmd, "`miterAngle` must be degrees"))?; doc.get_mut(id)?.stroke.miter_limit = StrokeProps::miter_limit_for(deg); @@ -728,7 +728,9 @@ fn apply_corners(cmd: &str, doc: &mut Document, id: NodeId, k: &str, v: &Value) *slot = r; } } - "cornerSmoothing" => doc.get_mut(id)?.corners.smoothing = f64_of(v).unwrap_or(0.0).clamp(0.0, 1.0), + "cornerSmoothing" => { + doc.get_mut(id)?.corners.smoothing = f64_of(v).ok_or_else(|| bad(cmd, "`cornerSmoothing` must be a number"))?.clamp(0.0, 1.0) + } "effects" => doc.get_mut(id)?.effects = effects_from(cmd, v)?, "clip" | "clipsContent" => doc.get_mut(id)?.clip = v.as_bool().ok_or_else(|| bad(cmd, "`clip` must be a boolean"))?, "isMask" => doc.get_mut(id)?.is_mask = v.as_bool().ok_or_else(|| bad(cmd, format!("`{k}` must be a boolean")))?, @@ -1002,8 +1004,12 @@ fn apply_text(cmd: &str, doc: &mut Document, id: NodeId, props: &Map text_mut(cmd, doc.get_mut(id)?)?.paragraph_spacing = f64_of(v).unwrap_or(0.0).max(0.0), - "paragraphIndent" => text_mut(cmd, doc.get_mut(id)?)?.paragraph_indent = f64_of(v).unwrap_or(0.0).max(0.0), + "paragraphSpacing" => { + text_mut(cmd, doc.get_mut(id)?)?.paragraph_spacing = f64_of(v).ok_or_else(|| bad(cmd, "`paragraphSpacing` must be a number"))?.max(0.0) + } + "paragraphIndent" => { + text_mut(cmd, doc.get_mut(id)?)?.paragraph_indent = f64_of(v).ok_or_else(|| bad(cmd, "`paragraphIndent` must be a number"))?.max(0.0) + } "listStyle" | "indentation" => { let t = text_mut(cmd, doc.get_mut(id)?)?; let (start, end) = range_of(props, t.char_count()); diff --git a/crates/engine/src/shapes_behaviour_tests.rs b/crates/engine/src/shapes_behaviour_tests.rs index 39cf2c29b..f6611f991 100644 --- a/crates/engine/src/shapes_behaviour_tests.rs +++ b/crates/engine/src/shapes_behaviour_tests.rs @@ -570,3 +570,18 @@ fn outline_stroke_outlines_every_selected_layer() { assert_eq!(s.selection(), ids, "the results are selected"); } } + +#[test] +fn node_set_non_numeric_miter_smoothing_paragraph_is_an_error() { + let mut s = Session::new(); + let r = create(&mut s, "shape.rectangle", json!({"x": 0, "y": 0, "width": 50, "height": 50})); + let t = create(&mut s, "text.create", json!({"text": "Hi", "x": 0, "y": 100})); + ex(&mut s, "node.set", json!({"ids": [r], "props": {"miterLimit": 8, "cornerSmoothing": 0.5}})); + ex(&mut s, "node.set", json!({"ids": [t], "props": {"paragraphSpacing": 6, "paragraphIndent": 4}})); + for (id, key) in [(r, "miterLimit"), (r, "cornerSmoothing"), (t, "paragraphSpacing"), (t, "paragraphIndent")] { + let err = s.execute("node.set", &json!({"ids": [id], "props": {key: "abc"}})).expect_err(key); + assert!(err.to_string().contains("must be a number"), "{key}: {err}"); + } + assert_eq!(node(&s, r).stroke.miter_limit, 8.0); + assert_eq!(node(&s, r).corners.smoothing, 0.5); +} From 832e790ca9be2d19607480ef145b9222de82d558 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Fri, 13 Nov 2026 01:43:25 +0100 Subject: [PATCH 211/239] Accept compact SVG arc flags in svg_path size check (#2299) Found while testing crates/geom/src/lib.rs:57-87 (number_past, called from svg_path at :49) Co-authored-by: Claude Haiku 5.5 --- crates/geom/src/lib.rs | 12 ++++++++++++ crates/geom/tests/svg_arc_flags.rs | 14 ++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 crates/geom/tests/svg_arc_flags.rs diff --git a/crates/geom/src/lib.rs b/crates/geom/src/lib.rs index c415f3b37..4bfbd97cd 100644 --- a/crates/geom/src/lib.rs +++ b/crates/geom/src/lib.rs @@ -63,7 +63,15 @@ fn number_past(d: &str, max: f64) -> bool { big } let (mut cur, mut dot, mut exp) = (String::new(), false, false); + // Whether the command is an arc, and how many numbers it has had: the 4th and 5th of each + // seven are flags, single `0`/`1` characters that may run into the next number unseparated. + let (mut arc, mut idx) = (false, 0usize); for c in d.chars() { + if cur.is_empty() && arc && matches!(idx % 7, 3 | 4) && matches!(c, '0' | '1') { + idx += 1; + (dot, exp) = (false, false); + continue; + } let continues = match c { '0'..='9' => true, '.' => !dot && !exp, @@ -77,9 +85,13 @@ fn number_past(d: &str, max: f64) -> bool { cur.push(c); continue; } + idx += cur.chars().any(|c| c.is_ascii_digit()) as usize; if big(&mut cur, max) { return true; } + if c.is_ascii_alphabetic() { + (arc, idx) = (matches!(c, 'A' | 'a'), 0); + } (dot, exp) = (c == '.', false); if matches!(c, '+' | '-' | '.') { cur.push(c); diff --git a/crates/geom/tests/svg_arc_flags.rs b/crates/geom/tests/svg_arc_flags.rs new file mode 100644 index 000000000..d5130dd69 --- /dev/null +++ b/crates/geom/tests/svg_arc_flags.rs @@ -0,0 +1,14 @@ +use figcraft_geom::svg_path; + +#[test] +fn compact_arc_flags_are_not_part_of_the_next_number() { + let compact = svg_path("M0 0A5 5 0 11999999999 0").expect("compact flags parse"); + let spaced = svg_path("M0 0A5 5 0 1 1 999999999 0").expect("spaced flags parse"); + assert_eq!(compact, spaced); +} + +#[test] +fn a_real_oversized_arc_coordinate_is_still_refused() { + assert!(svg_path("M0 0A5 5 0 112000000000 0").is_err()); + assert!(svg_path("M0 0A5 5 0 1 1 2000000000 0").is_err()); +} From 2408d0aa81208d0c4c7fa65503935a221e385b8d Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 19:43:49 -0500 Subject: [PATCH 212/239] M8: Tab while renaming moves only the rename and wraps from the last layer, as in Figma (#2311) * M8: Tab while renaming the last layer wraps to the first, as in Figma Measured in Figma's web app on 2026-11-12: Tab on the last row of the Layers panel commits the name and opens the first row's rename. FigCraft ended the rename there. Shift+Tab on the first row is unmeasured and unchanged, and Tab still moves the selection with the rename. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 queued; Sonnet 5.5 measured and wrote at medium * M8: Tab while renaming moves the rename, not the selection, as in Figma Measured in Figma's web app (second run, 2026-11-12): while renaming, Tab and Shift+Tab open the next or previous row in edit, and the selection stays on the layer first renamed. FigCraft moved the selection to the renamed row. Tab now moves only the rename field. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 queued; Sonnet 5.5 measured and wrote at medium --------- Co-authored-by: Claude Sonnet 5.5 --- crates/ui-egui/src/layers_rename_tests.rs | 27 ++++++++++++++++++----- crates/ui-egui/src/panels/layers.rs | 10 ++++++--- docs/ui-parity.md | 5 +++-- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/crates/ui-egui/src/layers_rename_tests.rs b/crates/ui-egui/src/layers_rename_tests.rs index c1c229ebd..3589b8145 100644 --- a/crates/ui-egui/src/layers_rename_tests.rs +++ b/crates/ui-egui/src/layers_rename_tests.rs @@ -1,5 +1,5 @@ //! Renaming layers in the layers panel, driven through egui headless: a double-click or Cmd/Ctrl+R -//! starts it, Tab / Shift+Tab commit and go on to the next / previous row (the selection follows), +//! starts it, Tab / Shift+Tab commit and go on to the next / previous row (the selection stays), //! Enter commits and Escape cancels. use egui::{Event, Key, Modifiers}; @@ -66,7 +66,7 @@ fn tab_and_shift_tab_commit_and_rename_the_next_and_previous_rows() { press(&mut u, Key::Tab, Modifiers::NONE); assert_eq!(name(&u, c), "Top"); assert_eq!(renaming(&u), Some(frame), "Tab renames the row below"); - assert_eq!(u.app.session.selection(), vec![frame], "the selection follows the rename"); + assert_eq!(u.app.session.selection(), vec![c], "the selection stays on the first layer"); u.frame(vec![]); // The whole name is selected: typing replaces it. type_text(&mut u, "Box"); @@ -88,16 +88,33 @@ fn tab_and_shift_tab_commit_and_rename_the_next_and_previous_rows() { } #[test] -fn tab_on_the_last_row_commits_and_ends() { - let (mut u, a, _, _, _) = setup(); +fn tab_on_the_last_row_commits_and_wraps_to_the_first() { + // Measured in Figma's web app, 2026-11-12: Tab on the last row commits and opens the first + // row's rename, and the selection stays where it was. + let (mut u, a, _, _, c) = setup(); double_click(&mut u, a); type_text(&mut u, "Bottom"); press(&mut u, Key::Tab, Modifiers::NONE); assert_eq!(name(&u, a), "Bottom"); - assert_eq!(renaming(&u), None); + assert_eq!(renaming(&u), Some(c), "Tab on the last row renames the first"); assert_eq!(u.app.session.selection(), vec![a]); } +#[test] +fn tab_while_renaming_leaves_the_selection_on_the_first_layer() { + // Measured in Figma's web app, 2026-11-12 (second run): Tab and Shift+Tab open the next and + // previous row in edit, and the selection stays on the layer first renamed. + let (mut u, _, frame, _, c) = setup(); + double_click(&mut u, c); + press(&mut u, Key::Tab, Modifiers::NONE); + assert_eq!(renaming(&u), Some(frame), "Tab opens the next row's rename"); + assert_eq!(u.app.session.selection(), vec![c], "the selection stays on the first layer"); + u.frame(vec![]); + press(&mut u, Key::Tab, Modifiers::SHIFT); + assert_eq!(renaming(&u), Some(c), "Shift+Tab opens the previous row's rename"); + assert_eq!(u.app.session.selection(), vec![c], "the selection stays on the first layer"); +} + #[test] fn cmd_r_renames_the_selection_and_opens_its_parents() { // Cmd+R on macOS; Ctrl+R elsewhere, where egui sets both `ctrl` and `command`. On macOS Ctrl diff --git a/crates/ui-egui/src/panels/layers.rs b/crates/ui-egui/src/panels/layers.rs index 1a62a851c..71b9643a8 100644 --- a/crates/ui-egui/src/panels/layers.rs +++ b/crates/ui-egui/src/panels/layers.rs @@ -719,7 +719,7 @@ pub(crate) fn collapse_all(app: &mut FigApp) { app.ui.expanded.extend(ds.selection.iter().flat_map(|s| ds.doc.ancestors(*s)).filter(|a| *a != ds.page)); } -/// Rename `id` in its row, selected (the selection follows a rename that moves with Tab). +/// Rename `id` in its row, selected. fn rename_layer(app: &mut FigApp, id: NodeId) { app.ui.rename = Some(Rename { id, start: true }); if app.session.selection() != [id] { @@ -1127,7 +1127,9 @@ fn layers(app: &mut FigApp, ui: &mut Ui) { scroll_to = Some(i); } else if let Some(back) = crate::widgets::take_tab(ui) { ui.memory_mut(|m| m.surrender_focus(rename_id(rn.id).with("te"))); - rename_next = if back { i.checked_sub(1) } else { Some(i + 1) }.and_then(|j| rows.get(j)).map(|r| r.id); + // Tab on the last row wraps to the first (measured in Figma's web app); Shift+Tab + // on the first row ends the rename (not measured). + rename_next = if back { i.checked_sub(1).and_then(|j| rows.get(j)) } else { rows.get(i + 1).or(rows.first()) }.map(|r| r.id); } rename_row = rows.get(i).map(|r| (i, r.id, r.depth)); } @@ -1364,7 +1366,9 @@ fn layers(app: &mut FigApp, ui: &mut Ui) { app.run("object.rename", json!({"ids": [id], "name": new})); } if let Some(id) = rename_next { - rename_layer(app, id); + // Only the rename moves: the selection stays on the layer first renamed (measured in + // Figma's web app, 2026-11-12). + app.ui.rename = Some(Rename { id, start: true }); } if renaming && app.ui.rename.is_none() { a11y::refocus_row(&mut app.ui.nav); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 1911dbbcd..be54985f0 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-10 · **Change:** minor (the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (M8: Tab while renaming the last layer wraps to the first row, measured in Figma's web app on 2026-11-12; the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -49,7 +49,7 @@ interaction feel not yet compared. | Expand and collapse: Alt-click opens or closes everything inside; Collapse layers (Alt+L) keeps the way to the selection open | done | Alt-click pinned (the documentation is silent) | | Drag to reorder and into frames, groups and auto layout: insertion line, spring-loaded open, several layers together, Escape cancels | done | several layers dropped together land together (they split apart before); instances and a layer's own children refuse drops | | Eye and padlock: click, or drag across rows to set several in one step; layers in a locked frame show a faint padlock | done | the toggles no longer vanish under the pointer (clicks on them could miss) (a child's padlock can't be toggled while its parent is locked) | -| Rename: double click, F2 / Cmd+R, Tab to the next row; several layers open Rename layers (match, regular expressions, current name and number codes, start value, preview) | done | numbered in stacking order, pinned | +| Rename: double click, F2 / Cmd+R, Tab to the next row; several layers open Rename layers (match, regular expressions, current name and number codes, start value, preview) | done | numbered in stacking order, pinned; Tab on the last row wraps to the first row's rename, measured in Figma's web app on 2026-11-12 (`tab_on_the_last_row_commits_and_wraps_to_the_first`); Shift+Tab on the first row ends the rename (not measured); Tab and Shift+Tab move only the rename, the selection stays on the layer first renamed, measured in Figma's web app on 2026-11-12 (`tab_while_renaming_leaves_the_selection_on_the_first_layer`) | | Find layers (filter by name) | done | not covered by the documentation | | Pages: add, rename, drag to reorder, duplicate ("Copy of"), delete, dividers (a blank page named with a hyphen) | done | the line between Pages and Layers drags to size the pages list, kept in the preferences; a long list scrolls in its own area and a page dropped outside the visible list stays put (#272) (`layers_behaviour_tests`) | | Assets panel: folders from page, frames and slash names (fold away), search, thumbnails, drag onto the canvas or into frames and auto layout, Alt-drop swap, enabled libraries | done | Shift+I (Quick insert), Alt+2 and View ▸ Panels ▸ Assets open it; the toolbar's Resources button was removed (the left rail's Assets tab and those shortcuts are the ways in) | @@ -217,6 +217,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| +| 2026-11-12 | patch | M8: Tab while renaming the last layer in the Layers panel commits and opens the first row's rename, as measured in Figma's web app on 2026-11-12 (it ended the rename before); Shift+Tab on the first row is unchanged, not measured; Tab and Shift+Tab now move only the rename and leave the selection on the layer first renamed, as measured in Figma's web app on 2026-11-12 (it followed the rename before) (`tab_on_the_last_row_commits_and_wraps_to_the_first`, `tab_while_renaming_leaves_the_selection_on_the_first_layer`), Rename row | | 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start); FigCraft draws it opaque (how Figma treats a translucent fill was not measured); gradient, image and hidden fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | | 2026-11-10 | minor | The Rotation field shows and sets the layer's rotation on the page (its own angle plus its parents' when no ancestor is flipped; with a flipped ancestor FigCraft reads the composed angle, which flips the sign of the layer's own angle, and Figma's behaviour there was not measured), in frames and groups alike, as measured in Figma's web app for rotated, unflipped parents (#2196) | | 2026-11-09 | patch | M3, #2189: the eyedropper picks the colour the canvas shows. It sampled a 1x1 render without the canvas's magnified-image pixels, so on an image magnified past 2x it blended a 1 px line with its neighbours (#3D444D picked as #343B44 beside #151B23), and the pixel it sampled began at the pointer instead of being centred on it. It now matches the canvas when zoomed in; zoomed out it still samples the full-resolution image, not the smaller copy the canvas may show. Test: `eyedropper_image_tests` | From 3d22c606a7d8efe556e8685f91c3bf83eae4fecd Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 19:44:17 -0500 Subject: [PATCH 213/239] M10: Tailwind mobile merge keeps a max-width both frames share (#2272) (#2296) inspect.code {language: "tailwind", mobile} dropped every mobile max-width and put the desktop one behind lg:, so a fixed-size layer that is the same size on both frames (a 48 x 48 badge) stretched to the full width below 1024 px. A mobile max-width that equals the desktop one is now kept as a plain class, with no lg: copy. A differing max-width still goes fluid on mobile with the desktop cap behind lg:. Tests: the issue's two frames (a 1440 and a 390 page, each with a 48 x 48 badge) keep max-w-[48px] unprefixed, and a page-wide banner still gets its lg: cap only. The slashed-names test gave the CTAs frame the same 342 px on both frames, which the new rule rightly keeps, so its desktop frame is now 600 px wide. docs/mcp.md notes the rule. Model-Effort: Opus 5.5 drove; Fable 5.2 queued; Opus 5.5 briefed; Sonnet 5.5 wrote at medium Co-authored-by: Claude Sonnet 5.5 --- crates/engine/src/dev/tailwind.rs | 3 +- crates/engine/src/tailwind_tests.rs | 50 +++++++++++++++++++++++++++-- docs/mcp.md | 4 ++- 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/dev/tailwind.rs b/crates/engine/src/dev/tailwind.rs index a29c0f316..8c96ac820 100644 --- a/crates/engine/src/dev/tailwind.rs +++ b/crates/engine/src/dev/tailwind.rs @@ -413,10 +413,11 @@ fn zero_padding(sides: [bool; 4]) -> Vec<&'static str> { pub(crate) fn merge(mobile: Option<&[(String, String)]>, desktop: &[(String, String)]) -> Vec { let hidden = [("display".to_string(), "hidden".to_string())]; // A mobile frame's widths are the phone's, not caps: below the breakpoint boxes fill the page. + // Except a cap desktop has too: that is the layer's own size (a badge, an avatar), kept at every width. let fluid: Vec<(String, String)>; let mobile = match mobile { Some(m) => { - fluid = m.iter().filter(|(k, _)| k != "max-width").cloned().collect(); + fluid = m.iter().filter(|(k, c)| k != "max-width" || desktop.iter().any(|(_, d)| d == c)).cloned().collect(); fluid.as_slice() } None => &hidden, diff --git a/crates/engine/src/tailwind_tests.rs b/crates/engine/src/tailwind_tests.rs index 163e3580c..970ecd1ca 100644 --- a/crates/engine/src/tailwind_tests.rs +++ b/crates/engine/src/tailwind_tests.rs @@ -176,7 +176,11 @@ fn slashed_layer_names_and_phone_widths_merge_right() { for (name, width, dir, sizing) in [("Landing", 1440.0, "horizontal", "hug"), ("Landing mobile", 390.0, "vertical", "fill")] { let p = idv(&ex(&mut s, "frame.create", json!({"x": 0, "y": 0, "width": width, "height": 600, "name": name}))); ex(&mut s, "layout.add", json!({"ids": [p], "direction": "vertical"})); - let ctas = idv(&ex(&mut s, "frame.create", json!({"x": 0, "y": 0, "width": 342, "height": 120, "parent": p, "name": "CTAs"}))); + let ctas = idv(&ex( + &mut s, + "frame.create", + json!({"x": 0, "y": 0, "width": if width > 1000.0 { 600.0 } else { 342.0 }, "height": 120, "parent": p, "name": "CTAs"}), + )); ex(&mut s, "layout.add", json!({"ids": [ctas], "direction": dir})); let b = idv(&ex(&mut s, "frame.create", json!({"x": 0, "y": 0, "width": 200, "height": 48, "parent": ctas, "name": "Button/Primary"}))); ex(&mut s, "layout.add", json!({"ids": [b], "direction": "horizontal"})); @@ -190,7 +194,7 @@ fn slashed_layer_names_and_phone_widths_merge_right() { let button = out.lines().find(|l| l.contains("lg:") && l.contains("rounded") || l.contains("self-stretch") && l.contains("flex-row")).unwrap_or_default(); assert!(button.contains("self-stretch") && button.contains("lg:self-auto"), "the slashed name keeps its mobile classes: {out}"); - assert!(!out.contains("max-w-[342px] ") || out.contains("lg:max-w-[342px]"), "no phone-width cap below lg: {out}"); + assert!(!out.contains("max-w-[342px]") && out.contains("lg:max-w-[600px]"), "no phone-width cap below lg: {out}"); assert!(out.contains("Only in the mobile frame") && out.contains("Tag"), "{out}"); let divider = out.lines().filter(|l| l.contains("') && !attr.contains('\\'), "{out}"); assert!(!inner.is_empty() && !inner.contains(['\\', '"', ']']), "{out}"); } + +/// Issue #2272: a desktop `page` 1440 wide and a mobile one 390 wide, each holding a fixed 48 x 48 +/// `badge` and a `banner` that fills the page. +fn badge_frames(s: &mut Session) -> (NodeId, NodeId) { + let mut frames = Vec::new(); + for (width, padding, x) in [(1440.0, 80, 0), (390.0, 24, 1600)] { + let p = idv(&ex( + s, + "frame.create", + json!({"name": "page", "x": x, "y": 0, "width": width, "height": 400, "props": {"layout": "vertical", "padding": padding, "gap": 16}}), + )); + let badge_props = json!({"layout": "horizontal", "sizingH": "fixed", "sizingV": "fixed", "fill": "#E8EEF7"}); + ex(s, "frame.create", json!({"name": "badge", "parent": p, "width": 48, "height": 48, "props": badge_props})); + let inner = width - 2.0 * f64::from(padding); + ex( + s, + "frame.create", + json!({"name": "banner", "parent": p, "width": inner, "height": 40, "props": {"layout": "horizontal", "fill": "#112233"}}), + ); + frames.push(p); + } + (frames[0], frames[1]) +} + +#[test] +fn a_max_width_both_frames_share_stays_unprefixed() { + let mut s = Session::new(); + let (desk, mob) = badge_frames(&mut s); + let out = code(&mut s, desk, json!({"mobile": mob})); + let badge = out.lines().find(|l| l.contains("bg-[#E8EEF7]")).unwrap_or_default(); + assert!(badge.contains("max-w-[48px]") && !badge.contains("lg:max-w-[48px]"), "the badge keeps its cap at every width: {out}"); +} + +#[test] +fn a_max_width_that_differs_still_goes_fluid_on_mobile() { + let mut s = Session::new(); + let (desk, mob) = badge_frames(&mut s); + let out = code(&mut s, desk, json!({"mobile": mob})); + let banner = out.lines().find(|l| l.contains("bg-[#112233]")).unwrap_or_default(); + assert!(banner.contains("lg:max-w-[1280px]"), "the page-wide box is capped from lg: {banner}"); + assert!(!banner.split_whitespace().any(|c| c == "max-w-[1280px]" || c == "max-w-[342px]"), "no phone-width cap below lg: {banner}"); +} diff --git a/docs/mcp.md b/docs/mcp.md index a6c04af07..21dfe8ca9 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -1732,7 +1732,9 @@ permissions: without it nothing is downloaded); `plugin.directory.publish {path `--radius-*`, `--text-*`, `--spacing-*`, `--font-*`; a number's namespace and unit come from what layers bind it to), other modes on `[data-=""]`. With `mobile: ` (the same layer names, mobile layout) the code is mobile first: the mobile frame's classes, the - desktop frame's that differ behind `lg:`, and layers only on desktop `hidden` plus `lg:flex` + desktop frame's that differ behind `lg:` (a mobile `max-width` is dropped as the phone's own width, + unless desktop has the same cap: a fixed-size layer such as a badge keeps `max-w-[48px]` at every + width), and layers only on desktop `hidden` plus `lg:flex` (auto layout frames) or `lg:block` (other layers). - **Component code:** `inspect.code {id, language: react|leptos|vue|swiftui|compose|arkui|flutter}` on a component, a component set or a variant writes the component as a reusable unit: React (TSX) with a props From 8ffa1bfbd177e6546837d0f4c8340c1768ea66e3 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 19:45:10 -0500 Subject: [PATCH 214/239] Docs: one Vector edit mode row after the merges (#2287) Three parallel merges (#2121, #2195, #1875) each left a copy of the Vector edit mode row with its own additions. They are folded into one row: the Point section Mixed X and Y, Flatten baking a point corner radius, and vector edit Copy, Cut and Paste, in the order of the shared text. Nothing dropped. Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium Co-authored-by: Claude Sonnet 5.5 --- docs/ui-parity.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index be54985f0..6c7ef343d 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -97,9 +97,7 @@ interaction feel not yet compared. | Rectangle, ellipse (arc handles and Design panel arc fields), polygon, star, line, arrow; Shift/Alt | done | Alt draws lines from the centre too (`shapes_behaviour_tests`) | | Corner radius handles (inside each corner of a rectangle or frame, a polygon's or star's top point; Alt: one corner), star ratio handle; Count and Ratio fields | done | handles hide under 48 px on screen; no count handle on the canvas (the Count field instead); corner smoothing rounds rectangles and frames only | | Pen: vector networks, branch, close, bend; pencil | done | pen pressure on Windows and from browser styluses only; outside edit mode the Pen closes on its first point, connects to its other points and continues a selected open path from an end point (`vector_multi_behaviour_tests`); Escape ends the path and keeps its layer in edit mode with the pen, so the next path joins the same vector and another Escape leaves edit mode (#760, `pen_end_tests`); Enter or a double-click ends the path (at the double-click's point, added once) and edits the vector with the Move tool, a double-click with the idle pen edits the layer under it, and in edit mode the pen's Enter or double-click takes the Move tool (#1430, `pen_vector_edit_tests`); switching from Design to Prototype or Inspect ends the path and returns to Move (#308) | -| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); the Point section's X and Y show the value the selected points share, or Mixed, and a typed value sets every selected point's own coordinate, in the layer being edited (measured in Figma on 2026-11-08). Not yet: areas of other layers edited at once; the Point section's X and Y over points of several edited layers | -| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a double-click a few pixels off a thin stroke enters edit mode (#646); entering edit mode and picking a region keep the canvas still (#322); a point dropped on another point merges with it, and dropping one end of an open path on the other closes it (a 2-point line's end just moves, #401); Flatten keeps open paths open (#377), and bakes a vector's point corner radius into its path (each rounded point becomes the arc's end points joined by curves, the layer stays a vector and its box fits the real geometry, #2195); paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn; Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). Not yet: areas of other layers edited at once | -| 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); Copy and Cut with points or segments selected take just those (a lone point: the segments touching it) as a vector with the layer's look, at their own place, so a paste outside edit mode is a new layer in place; Cut removes them as Delete does, the path splitting in the same layer with edit mode staying on; Paste while editing adds the clipboard's segments, or a copied shape's or boolean's outline, to the edited network in place with the new points selected, skipping layers with no outline (text, frames, groups; named in `skipped`) and refusing when none has one, as measured in Figma (`vector_clipboard_tests`, #1875). Not yet: areas of other layers edited at once | +| 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), and bakes a vector's point corner radius into its path (each rounded point becomes the arc's end points joined by curves, the layer stays a vector and its box fits the real geometry, #2195); paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn; Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); the Point section's X and Y show the value the selected points share, or Mixed, and a typed value sets every selected point's own coordinate, in the layer being edited (measured in Figma on 2026-11-08); Copy and Cut with points or segments selected take just those (a lone point: the segments touching it) as a vector with the layer's look, at their own place, so a paste outside edit mode is a new layer in place; Cut removes them as Delete does, the path splitting in the same layer with edit mode staying on; Paste while editing adds the clipboard's segments, or a copied shape's or boolean's outline, to the edited network in place with the new points selected, skipping layers with no outline (text, frames, groups; named in `skipped`) and refusing when none has one, as measured in Figma (`vector_clipboard_tests`, #1875). Not yet: areas of other layers edited at once; the Point section's X and Y over points of several edited layers | | Shape builder (Shift+M) on fills, strokes and open paths; variable width (Shift+W), one side with Alt | done | | | Boolean groups: clicked where the result is, double-click or Cmd/Ctrl-click into operands, live results while dragging or editing points, per-operand operations | done | a group past the path operations' caps (250 000 segments, 2 million possible crossings, 4 million segments swept over a fold) draws without its result, with a warning, and Flatten refuses it (#1104); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | | Text: point, auto height, fixed; caret, words, lines, IME | done | Backspace or Delete at the start of a list item takes its marker and keeps its level, the paragraph starting where the item's text did ("delete the counter, but keep the same level of indentation", Create bulleted and numbered lists; `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests`); max lines on auto-width text keep it auto width, hugging up to that many lines and growing with its longest line ("Text resizing is set to auto height or auto width", Explore text properties; `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines`); Alt+Enter while editing opens the link at the caret, web and mail links only (`text.openLink`; "press ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma; `text_link_tests`); the font picker previews a family on the canvas while hovered (no undo step; Escape restores, #653) and Up/Down step through it (#352); a selection highlight after a line break starts at that line's start and an empty last line shows its mark (#665); carets step over whole emoji and accented letters; colour emoji draw from their colour tables (#300); IME composition replayed in tests as macOS sends it, not yet checked on a Mac (#747); CJK words by script run (no dictionary); vertical trim in Type settings; the caret takes the text's solid fill colour, measured in Figma's web app, 2026-11-09; gradient and image fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour, which is white in the dark theme and vanished on the default light page (#2190) (#2156; `caret_tests`); no spell check | From a60cb1a6fa32ea9f242afeb48649a9929ad921ad Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 19:45:48 -0500 Subject: [PATCH 215/239] M7: the Design panel shows the page's variable modes with nothing selected (#2215) (#2312) Pages take a variable mode, set from the Page section of the right sidebar once a local collection has more than one mode. With nothing selected the Page section now shows the same Variable modes section the frames have: a row per multi-mode collection, Auto or one of its modes, one undo step per pick (variable.setMode without layers sets the page's mode). The frame's row drawing is shared, not copied. Model-Effort: Opus 5.5 drove; Fable 5.2 queued; Opus 5.5 briefed; Sonnet 5.5 measured and wrote at medium Co-authored-by: Claude Sonnet 5.5 --- crates/ui-egui/src/lib.rs | 2 + .../ui-egui/src/page_variable_modes_tests.rs | 52 +++++++++++++++++++ crates/ui-egui/src/panels/right.rs | 5 +- crates/ui-egui/src/panels/right/paints.rs | 27 ++++++++-- crates/ui-egui/src/variables_rename_tests.rs | 4 +- docs/components-parity.md | 5 +- 6 files changed, 87 insertions(+), 8 deletions(-) create mode 100644 crates/ui-egui/src/page_variable_modes_tests.rs diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 01cfe8e88..c1f9811a8 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -198,6 +198,8 @@ mod open_issues_tests; #[cfg(test)] mod padding_individual_tests; #[cfg(test)] +mod page_variable_modes_tests; +#[cfg(test)] mod palette_tests; #[cfg(test)] mod panel_remove_tests; diff --git a/crates/ui-egui/src/page_variable_modes_tests.rs b/crates/ui-egui/src/page_variable_modes_tests.rs new file mode 100644 index 000000000..b3dc0be4d --- /dev/null +++ b/crates/ui-egui/src/page_variable_modes_tests.rs @@ -0,0 +1,52 @@ +//! The Design panel's Variable modes section for the page, driven headless: with nothing +//! selected a collection with several modes lists them, as Figma's Page section does. + +use egui::{Event, Modifiers, PointerButton, Pos2}; +use figcraft_engine::Session; +use serde_json::json; + +use crate::layers_drag_tests::Ui; +use crate::live_tests::{flat, text_center}; + +/// A click at `p`, and the frames that follow; what the last frame drew. +fn click(u: &mut Ui, p: Pos2) -> Vec { + for _ in 0..5 { + u.frame(vec![Event::PointerMoved(p)]); + } + let mut shapes = Vec::new(); + for pressed in [Some(true), Some(false)].into_iter().chain(std::iter::repeat_n(None, 20)) { + let events = pressed.map(|pressed| Event::PointerButton { pos: p, button: PointerButton::Primary, pressed, modifiers: Modifiers::NONE }); + shapes = flat(&u.frame_output(events.into_iter().collect()).shapes); + } + shapes +} + +fn scene(modes: &[&str]) -> Ui { + let mut s = Session::new(); + s.execute("variable.createCollection", &json!({"name": "Theme", "modes": modes})).unwrap(); + s.execute("select.set", &json!({"ids": []})).unwrap(); + Ui::new(s) +} + +#[test] +fn with_nothing_selected_the_page_shows_its_variable_modes() { + let mut u = scene(&["Light", "Dark"]); + let shapes = flat(&u.frame_output(vec![]).shapes); + assert!(crate::live_tests::texts(&shapes).iter().any(|(t, ..)| t == crate::i18n::tr("Variable modes")), "the section shows"); + let history = u.app.session.undo_depth().0; + let menu = click(&mut u, text_center(&shapes, "Auto (Light)")); + click(&mut u, text_center(&menu, " Dark")); + let page = u.app.session.page().unwrap(); + let doc = u.app.session.doc().unwrap(); + let coll = doc.variables.collections[0].clone(); + let dark = coll.modes.iter().find(|m| m.name == "Dark").unwrap().id.clone(); + assert_eq!(doc.node(page).unwrap().var_modes.get(&coll.id), Some(&dark)); + assert_eq!(u.app.session.undo_depth().0, history + 1, "one undo step"); +} + +#[test] +fn the_page_section_has_no_variable_modes_without_a_multi_mode_collection() { + let mut u = scene(&["Only"]); + let shapes = flat(&u.frame_output(vec![]).shapes); + assert!(!crate::live_tests::texts(&shapes).iter().any(|(t, ..)| t == crate::i18n::tr("Variable modes"))); +} diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index 3c64f665c..75aa10e0e 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -37,7 +37,7 @@ pub(crate) use menu::menu_row_width; pub(crate) use menu::preview_blend; pub use menu::{blend_menu, context_popup, menu_check, menu_icon_item, menu_item, menu_item_beside_checks, menu_item_with, menu_popup, menu_row}; pub(crate) use menu::{block, menu_row_lit, menu_style, row, row_rect}; -use paints::{appearance, paints, variable_modes}; +use paints::{appearance, page_variable_modes, paints, variable_modes}; pub(crate) use stroke::{CAP_ART_W, cap_art, join_label}; /// Common value of `f` across `ids` (None when mixed or empty). @@ -374,6 +374,9 @@ fn page_section(app: &mut FigApp, ui: &mut Ui, doc: &Document) { } } widgets::separator(ui); + if page_variable_modes(app, ui, doc, page) { + widgets::separator(ui); + } widgets::section_header(ui, tr("Color profile"), &[], false); row(ui, 32.0, |ui| { let resp = widgets::dropdown(ui, doc.color_profile.label(), 140.0, None); diff --git a/crates/ui-egui/src/panels/right/paints.rs b/crates/ui-egui/src/panels/right/paints.rs index df1ca5ee0..99c6ecb3c 100644 --- a/crates/ui-egui/src/panels/right/paints.rs +++ b/crates/ui-egui/src/panels/right/paints.rs @@ -158,6 +158,17 @@ pub(super) fn variable_modes(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: if !crate::selection_cache::every(doc, sel, |n| n.kind.is_frame_like()) { return false; } + mode_section(app, ui, doc, sel, false) +} + +/// The same section for the current page, with nothing selected: Auto there is the collection's +/// default mode, and a pick sets the page's own (`variable.setMode` without layers). +pub(super) fn page_variable_modes(app: &mut FigApp, ui: &mut Ui, doc: &Document, page: NodeId) -> bool { + mode_section(app, ui, doc, &[page], true) +} + +/// The Variable modes section of `sel` (the page when `on_page`): one row per multi-mode collection. +fn mode_section(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId], on_page: bool) -> bool { let libs = crate::variable_ui::libraries(app, doc); let rows = crate::variable_ui::mode_rows(doc, &libs); if rows.is_empty() { @@ -217,7 +228,7 @@ pub(super) fn variable_modes(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: } } if let Some(mode) = pick { - set_variable_mode(app, sel, r, mode); + set_variable_mode(app, if on_page { &[] } else { sel }, r, mode); ui.close(); } }); @@ -227,15 +238,23 @@ pub(super) fn variable_modes(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: true } -/// Set `sel`'s mode of the collection of `row` (`mode` null: Auto). A library collection goes +/// Set `sel`'s mode of the collection of `row` (`mode` null: Auto; no `sel`: the page's). A library collection goes /// through `library.setVariableMode` (copying it in); Auto on one never used here is already so. fn set_variable_mode(app: &mut FigApp, sel: &[NodeId], row: &crate::variable_ui::ModeRow, mode: Value) { match (row.library, row.key, row.local) { (Some((lib, _)), Some(key), _) if !mode.is_null() => { - app.run("library.setVariableMode", json!({"library": lib, "collection": key, "ids": sel, "mode": mode})); + let mut p = json!({"library": lib, "collection": key, "mode": mode}); + if !sel.is_empty() { + p["ids"] = json!(sel); + } + app.run("library.setVariableMode", p); } (_, _, Some(local)) => { - app.run("variable.setMode", json!({"ids": sel, "collection": local, "mode": mode})); + let mut p = json!({"collection": local, "mode": mode}); + if !sel.is_empty() { + p["ids"] = json!(sel); + } + app.run("variable.setMode", p); } _ => {} } diff --git a/crates/ui-egui/src/variables_rename_tests.rs b/crates/ui-egui/src/variables_rename_tests.rs index 0c97a84ea..353be6594 100644 --- a/crates/ui-egui/src/variables_rename_tests.rs +++ b/crates/ui-egui/src/variables_rename_tests.rs @@ -100,7 +100,9 @@ fn a_collection_of_this_file_extends_from_its_context_menu() { u.frame(vec![]); } let shapes = flat(&u.frame_output(vec![]).shapes); - click_with(&mut u, text_center(&shapes, "Theme"), PointerButton::Secondary); + // The window's row: the Design panel's Page section names the collection too (its modes), under it. + let (_, at, size) = crate::live_tests::texts(&shapes).into_iter().rfind(|(t, ..)| t == "Theme").expect("the collection's row"); + click_with(&mut u, at + size / 2.0, PointerButton::Secondary); let menu = flat(&u.frame_output(vec![]).shapes); for item in ["Rename", "Extend collection", "Delete collection"] { assert!(has_text(&menu, item), "{item} in the menu"); diff --git a/docs/components-parity.md b/docs/components-parity.md index c228aa94d..3d4fa7ddf 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-11-07 · **Change:** minor (a text style binds a number variable to its weight (#2174); an instance lists only the properties its variant's layers use and long property names are cut to one line (#2022); with several layers selected the Design panel header's component button offers Create multiple components (#2088); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (pages take a variable mode: with nothing selected the Design panel's Page section shows a Variable modes section, Auto or a mode of each collection that has more than one, as the help center says ("Apply variable mode" in the Page section of the right sidebar) (#2215); a text style binds a number variable to its weight (#2174); an instance lists only the properties its variant's layers use and long property names are cut to one line (#2022); with several layers selected the Design panel header's component button offers Create multiple components (#2088); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; 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 @@ -71,7 +71,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Deleting a bound variable or its collection | done | layers keep their last value and are unbound; aliases to it take its values and colour calculations reading it keep the colour they show | | Code syntax per platform (Web, iOS, Android) | done | generated CSS uses the Web name, SwiftUI the iOS one and Compose the Android one (a variable without one keeps its value there); in the variables JSON; ArkUI and Flutter have no platform of their own and write values | | Bindings: fills, strokes, effects, opacity, padding, gaps, sizes, radius, font family/style, font size/weight, line height, letter spacing, paragraph spacing/indent, text, visibility, layout grids, instance properties | done | type-checked per field, an effect's only where its effect has the field (as in effect styles); glass fields too (light angle, intensity, refraction, depth, dispersion, frost and splay, percentages as the Design panel shows them, a light angle past ±180 turned round); number variables fill text content; the Design panel's font family and font style menus start with Apply variable (string variables), and a bound one shows its variable in place of the menu; a colour variable bound to a solid paint brings its whole colour, alpha included, once (the paint's opacity restarts at 100% on binding, an opacity set while bound multiplies on top; unbinding moves the alpha back into the opacity) | -| Explicit modes per frame, library collections' modes | done | stored variable and collection references resolve by exact id in export, library copies and swaps, imported aliases, alias deletion and cycle checks, Dev Inspect, the library mode picker and prototype playback; a collection or variable named like another's id no longer stands in for it there | +| Explicit modes per frame and per page (Page section), library collections' modes | done | stored variable and collection references resolve by exact id in export, library copies and swaps, imported aliases, alias deletion and cycle checks, Dev Inspect, the library mode picker and prototype playback; a collection or variable named like another's id no longer stands in for it there | | Gradient stops and variant properties bound to variables | done | a stop's binding follows it when earlier stops are removed | | Extended collections | done | this file's collections (Extend collection on a collection's row; following its edits at once, chains included) and library collections, including a library's own extended collections (chains through libraries); overrides per mode with reset; follow library updates, variables new to the library collection being an update of their own; modes inherited. Checked with synthetic libraries only ([gaps](gaps.md) #14) | | Variables import/export (JSON) | done | the REST local variables shape (round-trips; merges by collection, mode and variable name; `variableCollections` and `variables` read under `meta` or at the top level, a warning when no variables are found or fewer than the collections list); CSS custom properties and Dart constants (Flutter) export; a variables file named by path must be a regular file of at most 256 MiB; in the browser the export arrives as a download (import there still needs a file picker) | @@ -82,6 +82,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Date | Change | Summary | |---|---|---| | 2026-11-07 | minor | M3, #2082: Edit variables in the context menu of a selection of several local variables opens the reference's compact editor with two tabs: Details holds only Hide from publishing, Scope the scopes every selected variable's type has (All supported properties and one box per scope; a selection that shares none says so). Each box is checked when all selected variables have it, empty when none, and shows a dash when they differ; a click sets it on all (or clears it when checked on all), each change one `command.batch`, so one undo step. Names, descriptions and code syntax stay single-variable, as in the reference. The Scope: menu entries stay. A tri-state `widgets::checkbox_tri` draws the dash. Tests: `variables_select_tests` (headless UI). Grade unchanged | +| 2026-11-12 | minor | M7, #2215: pages take a variable mode: with nothing selected the Design panel's Page section shows a Variable modes section, Auto or a mode of each collection that has more than one, as the help center says ("Apply variable mode" in the Page section of the right sidebar) (#2215). The same section the frames' Variable modes use (`variable.setMode` without layers sets the page's mode), one undo step per pick. Binding the page background to a variable is not in the reference and is not offered | | 2026-11-10 | minor | M7, #2174: a text style binds a number variable to its weight (`style.bind {field: "fontWeight"}`): the style takes the face nearest the number and sets the `wght` axis, so static and variable fonts both follow; a face-name (string) binding and a weight binding replace each other, and the weight wins in a file carrying both. The style editor's weight menu offers number variables beside string ones. A number bound to a line height is applied in pixels, as the reference tool does, which a test now pins. Numbers unchanged. Tests: `style_vars_tests`, `style_picker::tests`. | | 2026-11-07 | patch | M3, #2088: with two or more layers selected the Design panel header's component button opens a menu with Create component, Create multiple components and Create component set (`component.createSet`, naming measured in Figma), as Figma's does; one layer keeps the plain button. Tests: `create_multiple_menu_tests`, `components_behaviour_tests::create_multiple_components_keeps_names_and_places_and_is_one_undo_step`, `components_behaviour_tests::create_set_*`. Grade unchanged. | | 2026-11-05 | minor | M3, #2002: the Local variables window selects several variables, as the Layers panel selects layers. A click selects one row, Shift+click the range from the anchor through the rows shown, Cmd/Ctrl+click toggles a row, Escape or a click on the empty space below the rows clears; selected rows use the sidebar's selected-row colour. Right-clicking a row that is part of a selection of several offers Delete, Move to group and Scope (all supported properties, hidden from pickers, or only one scope) for the selected local variables, each sent as one `command.batch`, so one undo step; no engine command changed. Renaming and value edits stay single-row. Tests: `variables_select_tests` (headless UI). Grade unchanged | From a4e330774ba34c335ca8099dd7b9a7e582c921a6 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 19:46:25 -0500 Subject: [PATCH 216/239] M6: .fig export writes list spacing, hanging punctuation and lists, and vertical trim (#2305) (#2306) * M6: .fig export writes list spacing, hanging punctuation and lists, and vertical trim (#2305) The export wrote none of a text's list spacing, hanging punctuation, hanging lists or vertical trim, although the import reads all four. It now writes listSpacing, hangingPunctuation, hangingList and leadingTrim, each only when it differs from its default (as Figma saves them), and an instance override back to the default clears the field. The warning narrows to OpenType features, which the import does not read from a .fig. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 briefed; Sonnet 5.5 wrote at medium * M6: test that an instance override back to the default clears it (#2305) Adds a round-trip test for the unset entries: an instance whose text goes back to the defaults must not take the main's list spacing, hanging flags and vertical trim again. Also scopes the comment and the docs row to a design file: a text at the defaults carries none of the four there, and a text style holds none of them. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 briefed; Sonnet 5.5 wrote at medium --------- Co-authored-by: Claude Sonnet 5.5 --- crates/format/src/fig/export.rs | 3 +- crates/format/src/fig/export/common.rs | 3 + crates/format/src/fig/export/shape.rs | 18 +++- crates/format/src/fig/text_paragraph_tests.rs | 89 +++++++++++++++++-- docs/file-format-parity.md | 8 +- 5 files changed, 109 insertions(+), 12 deletions(-) diff --git a/crates/format/src/fig/export.rs b/crates/format/src/fig/export.rs index f00de3606..ac8612b9c 100644 --- a/crates/format/src/fig/export.rs +++ b/crates/format/src/fig/export.rs @@ -100,6 +100,7 @@ enum TextCase ORIGINAL=0 UPPER=1 LOWER=2 TITLE=3 SMALL_CAPS=4 enum TextDecoration NONE=0 UNDERLINE=1 STRIKETHROUGH=2 enum NumberUnits RAW=0 PIXELS=1 PERCENT=2 enum LineType PLAIN=0 ORDERED_LIST=1 UNORDERED_LIST=2 +enum LeadingTrim NONE=0 CAP_HEIGHT=1 enum SourceDirectionality AUTO=0 LTR=1 RTL=2 enum DocumentColorProfile LEGACY=0 SRGB=1 DISPLAY_P3=2 enum EmojiImageSet APPLE=0 NOTO=1 @@ -189,7 +190,7 @@ message GridTrackSizingFunction GridTrackSizingType type=1, float value=2 message GridTrackSize GridTrackSizingFunction minSizing=1, GridTrackSizingFunction maxSizing=2 message GUIDGridTrackSizeMapEntry GUID id=1, GridTrackSize trackSize=2 message GUIDGridTrackSizeMap GUIDGridTrackSizeMapEntry[] entries=1 -message NodeChange GUID guid=1, NodePhase phase=2, ParentIndex parentIndex=3, NodeType type=4, string name=5, bool visible=6, bool locked=7, float opacity=8, BlendMode blendMode=9, Vector size=11, Matrix transform=12, bool mask=16, MaskType maskType=317, float backgroundOpacity=19, bool backgroundEnabled=15, bool internalOnly=142, string description=318, StyleType styleType=163, string sortPosition=320, StyleId styleIdForFill=332, StyleId styleIdForStrokeFill=333, StyleId styleIdForText=334, StyleId styleIdForEffect=335, StyleId styleIdForGrid=336, VariableDataMap variableConsumptionMap=307, VariableModeBySetMap variableModeBySetMap=316, VariableSetMode[] variableSetModes=312, VariableSetID variableSetID=313, VariableResolvedDataType variableResolvedType=314, VariableDataValues variableDataValues=315, VariableScope[] variableScopes=353, DocumentColorProfile documentColorProfile=349, Paint[] fillPaints=38, Paint[] strokePaints=39, float strokeWeight=26, StrokeAlign strokeAlign=29, StrokeJoin strokeJoin=31, StrokeCap strokeCap=30, float[] dashPattern=13, float miterLimit=25, bool borderStrokeWeightsIndependent=299, float borderTopWeight=295, float borderRightWeight=298, float borderBottomWeight=296, float borderLeftWeight=297, Effect[] effects=43, float cornerRadius=20, float cornerSmoothing=160, bool rectangleCornerRadiiIndependent=149, float rectangleTopLeftCornerRadius=145, float rectangleTopRightCornerRadius=146, float rectangleBottomRightCornerRadius=148, float rectangleBottomLeftCornerRadius=147, ConstraintType horizontalConstraint=28, ConstraintType verticalConstraint=37, bool frameMaskDisabled=115, bool resizeToFit=117, bool isStateGroup=225, StateGroupPropertyValueOrder[] stateGroupPropertyValueOrders=238, bool sectionContentsHidden=283, Color backgroundColor=50, StackMode stackMode=105, float stackSpacing=107, float stackCounterSpacing=324, StackWrap stackWrap=323, StackCounterAlignContent stackCounterAlignContent=343, float stackHorizontalPadding=209, float stackVerticalPadding=210, float stackPaddingRight=233, float stackPaddingBottom=234, StackJustify stackPrimaryAlignItems=230, StackAlign stackCounterAlignItems=231, StackSize stackPrimarySizing=229, StackSize stackCounterSizing=221, bool bordersTakeSpace=294, bool stackReverseZIndex=271, float gridColumnGap=438, float gridRowGap=437, GUIDPositionMap gridColumns=436, GUIDPositionMap gridRows=435, GUIDGridTrackSizeMap gridColumnsSizing=474, GUIDGridTrackSizeMap gridRowsSizing=475, float stackChildPrimaryGrow=232, StackCounterAlign stackChildAlignSelf=236, StackPositioning stackPositioning=269, OptionalVector minSize=325, OptionalVector maxSize=326, GUID gridColumnAnchor=440, GUID gridRowAnchor=439, uint gridColumnSpan=442, uint gridRowSpan=441, LayoutGrid[] layoutGrids=47, ExportSettings[] exportSettings=45, TextData textData=42, FontName fontName=41, float fontSize=21, Number lineHeight=40, Number letterSpacing=165, TextCase textCase=34, TextDecoration textDecoration=35, TextAlignHorizontal textAlignHorizontal=32, TextAlignVertical textAlignVertical=33, TextAutoResize textAutoResize=46, TextTruncation textTruncation=280, int maxLines=351, float paragraphSpacing=23, float paragraphIndent=22, Hyperlink hyperlink=223, bool autoRename=14, bool fontVariantCommonLigatures=127, bool fontVariantContextualLigatures=128, string fontVersion=202, uint textUserLayoutVersion=203, uint textExplicitLayoutVersion=396, uint textBidiVersion=279, float textTracking=27, bool textDecorationSkipInk=412, EmojiImageSet emojiImageSet=391, uint styleID=49, Path[] fillGeometry=51, Path[] strokeGeometry=52, VectorData vectorData=48, VectorMirror handleMirroring=44, uint count=10, float starInnerScale=24, ArcData arcData=195, BooleanOperation booleanOperation=36, string symbolDescription=144, VariableWidthPoint[] variableWidthPoints=447, PluginData[] pluginData=204, SymbolData symbolData=113, NodeChange[] derivedSymbolData=125, GUID overriddenSymbolID=143, ComponentPropDef[] componentPropDefs=266, ComponentPropRef[] componentPropRefs=267, ComponentPropAssignment[] componentPropAssignments=268, VariantPropSpec[] variantPropSpecs=483, VariableDataMap parameterConsumptionMap=445, GUIDPath guidPath=111, PrototypeInteraction[] prototypeInteractions=226, PrototypeStartingPoint prototypeStartingPoint=249, ScrollDirection scrollDirection=159, ScrollBehavior scrollBehavior=186, OverlayPositionType overlayPositionType=198, OverlayBackgroundInteraction overlayBackgroundInteraction=200, OverlayBackgroundAppearance overlayBackgroundAppearance=201 +message NodeChange GUID guid=1, NodePhase phase=2, ParentIndex parentIndex=3, NodeType type=4, string name=5, bool visible=6, bool locked=7, float opacity=8, BlendMode blendMode=9, Vector size=11, Matrix transform=12, bool mask=16, MaskType maskType=317, float backgroundOpacity=19, bool backgroundEnabled=15, bool internalOnly=142, string description=318, StyleType styleType=163, string sortPosition=320, StyleId styleIdForFill=332, StyleId styleIdForStrokeFill=333, StyleId styleIdForText=334, StyleId styleIdForEffect=335, StyleId styleIdForGrid=336, VariableDataMap variableConsumptionMap=307, VariableModeBySetMap variableModeBySetMap=316, VariableSetMode[] variableSetModes=312, VariableSetID variableSetID=313, VariableResolvedDataType variableResolvedType=314, VariableDataValues variableDataValues=315, VariableScope[] variableScopes=353, DocumentColorProfile documentColorProfile=349, Paint[] fillPaints=38, Paint[] strokePaints=39, float strokeWeight=26, StrokeAlign strokeAlign=29, StrokeJoin strokeJoin=31, StrokeCap strokeCap=30, float[] dashPattern=13, float miterLimit=25, bool borderStrokeWeightsIndependent=299, float borderTopWeight=295, float borderRightWeight=298, float borderBottomWeight=296, float borderLeftWeight=297, Effect[] effects=43, float cornerRadius=20, float cornerSmoothing=160, bool rectangleCornerRadiiIndependent=149, float rectangleTopLeftCornerRadius=145, float rectangleTopRightCornerRadius=146, float rectangleBottomRightCornerRadius=148, float rectangleBottomLeftCornerRadius=147, ConstraintType horizontalConstraint=28, ConstraintType verticalConstraint=37, bool frameMaskDisabled=115, bool resizeToFit=117, bool isStateGroup=225, StateGroupPropertyValueOrder[] stateGroupPropertyValueOrders=238, bool sectionContentsHidden=283, Color backgroundColor=50, StackMode stackMode=105, float stackSpacing=107, float stackCounterSpacing=324, StackWrap stackWrap=323, StackCounterAlignContent stackCounterAlignContent=343, float stackHorizontalPadding=209, float stackVerticalPadding=210, float stackPaddingRight=233, float stackPaddingBottom=234, StackJustify stackPrimaryAlignItems=230, StackAlign stackCounterAlignItems=231, StackSize stackPrimarySizing=229, StackSize stackCounterSizing=221, bool bordersTakeSpace=294, bool stackReverseZIndex=271, float gridColumnGap=438, float gridRowGap=437, GUIDPositionMap gridColumns=436, GUIDPositionMap gridRows=435, GUIDGridTrackSizeMap gridColumnsSizing=474, GUIDGridTrackSizeMap gridRowsSizing=475, float stackChildPrimaryGrow=232, StackCounterAlign stackChildAlignSelf=236, StackPositioning stackPositioning=269, OptionalVector minSize=325, OptionalVector maxSize=326, GUID gridColumnAnchor=440, GUID gridRowAnchor=439, uint gridColumnSpan=442, uint gridRowSpan=441, LayoutGrid[] layoutGrids=47, ExportSettings[] exportSettings=45, TextData textData=42, FontName fontName=41, float fontSize=21, Number lineHeight=40, Number letterSpacing=165, TextCase textCase=34, TextDecoration textDecoration=35, TextAlignHorizontal textAlignHorizontal=32, TextAlignVertical textAlignVertical=33, TextAutoResize textAutoResize=46, TextTruncation textTruncation=280, int maxLines=351, float paragraphSpacing=23, float paragraphIndent=22, float listSpacing=264, LeadingTrim leadingTrim=322, bool hangingPunctuation=337, bool hangingList=339, Hyperlink hyperlink=223, bool autoRename=14, bool fontVariantCommonLigatures=127, bool fontVariantContextualLigatures=128, string fontVersion=202, uint textUserLayoutVersion=203, uint textExplicitLayoutVersion=396, uint textBidiVersion=279, float textTracking=27, bool textDecorationSkipInk=412, EmojiImageSet emojiImageSet=391, uint styleID=49, Path[] fillGeometry=51, Path[] strokeGeometry=52, VectorData vectorData=48, VectorMirror handleMirroring=44, uint count=10, float starInnerScale=24, ArcData arcData=195, BooleanOperation booleanOperation=36, string symbolDescription=144, VariableWidthPoint[] variableWidthPoints=447, PluginData[] pluginData=204, SymbolData symbolData=113, NodeChange[] derivedSymbolData=125, GUID overriddenSymbolID=143, ComponentPropDef[] componentPropDefs=266, ComponentPropRef[] componentPropRefs=267, ComponentPropAssignment[] componentPropAssignments=268, VariantPropSpec[] variantPropSpecs=483, VariableDataMap parameterConsumptionMap=445, GUIDPath guidPath=111, PrototypeInteraction[] prototypeInteractions=226, PrototypeStartingPoint prototypeStartingPoint=249, ScrollDirection scrollDirection=159, ScrollBehavior scrollBehavior=186, OverlayPositionType overlayPositionType=198, OverlayBackgroundInteraction overlayBackgroundInteraction=200, OverlayBackgroundAppearance overlayBackgroundAppearance=201 struct Blob byte[] bytes message Message MessageType type=1, uint sessionID=2, NodeChange[] nodeChanges=4, Blob[] blobs=6 "; diff --git a/crates/format/src/fig/export/common.rs b/crates/format/src/fig/export/common.rs index ee7293dc9..a28951cf8 100644 --- a/crates/format/src/fig/export/common.rs +++ b/crates/format/src/fig/export/common.rs @@ -195,6 +195,9 @@ fn unset(key: &str) -> Option> { "scrollBehavior" => e("SCROLLS"), "parameterConsumptionMap" => o(vec![("entries", arr(Vec::new()))]), "textTruncation" => e("DISABLED"), + "listSpacing" => fl(0.0), + "leadingTrim" => e("NONE"), + "hangingPunctuation" | "hangingList" => b(false), "hyperlink" => o(vec![("url", s(""))]), _ => return None, }) diff --git a/crates/format/src/fig/export/shape.rs b/crates/format/src/fig/export/shape.rs index bfc2b0224..119777367 100644 --- a/crates/format/src/fig/export/shape.rs +++ b/crates/format/src/fig/export/shape.rs @@ -44,6 +44,20 @@ impl<'d> Exporter<'d> { ("textTracking", fl(0.0)), ("emojiImageSet", e("APPLE")), ]); + // Written only off their defaults: a text at the defaults carries none of these four in a design file saved by + // Figma. A text style holds none of them, so a layer at the defaults has no style value to take on import. + if td.list_spacing != 0.0 { + f.push(("listSpacing", fl(td.list_spacing))); + } + if td.hanging_punctuation { + f.push(("hangingPunctuation", b(true))); + } + if td.hanging_list { + f.push(("hangingList", b(true))); + } + if td.leading_trim == figcraft_doc::LeadingTrim::CapHeight { + f.push(("leadingTrim", e("CAP_HEIGHT"))); + } if td.truncates() { f.push(("textTruncation", e("ENDING"))); } @@ -162,8 +176,8 @@ impl<'d> Exporter<'d> { if td.path.is_some() { self.warn("text on a path was written as plain text"); } - if td.list_spacing != 0.0 || td.hanging_punctuation || td.hanging_list || td.leading_trim != Default::default() || !td.features.is_empty() { - self.warn("list spacing, hanging punctuation, leading trim and OpenType features were left out"); + if !td.features.is_empty() { + self.warn("OpenType features were left out"); } } diff --git a/crates/format/src/fig/text_paragraph_tests.rs b/crates/format/src/fig/text_paragraph_tests.rs index b3f05b055..d1971da07 100644 --- a/crates/format/src/fig/text_paragraph_tests.rs +++ b/crates/format/src/fig/text_paragraph_tests.rs @@ -111,12 +111,69 @@ fn encoded_fig_maps_paragraph_list_fields_through_native_round_trip() { assert!(!text.hanging_list); assert!(!text.hanging_punctuation); assert_eq!(text.leading_trim, figcraft_doc::LeadingTrim::CapHeight); +} - let (_, export_warnings) = export(&inherited, None).unwrap(); - assert!( - export_warnings.iter().any(|warning| warning.contains("list spacing, hanging punctuation, leading trim")), - "existing .fig export loss must remain visible: {export_warnings:?}" - ); +#[test] +fn exported_paragraph_options_survive_a_fig_round_trip() { + let shared = vec![ + ("listSpacing", Kv::Float(18.0)), + ("hangingList", Kv::Bool(false)), + ("hangingPunctuation", Kv::Bool(false)), + ("leadingTrim", Kv::Enum("CAP_HEIGHT")), + ]; + let reset = vec![ + ("listSpacing", Kv::Float(0.0)), + ("hangingList", Kv::Bool(false)), + ("hangingPunctuation", Kv::Bool(false)), + ("leadingTrim", Kv::Enum("NONE")), + ]; + let (inherited, _) = import(¶graph_fig(shared.clone(), vec![]), "Synthetic paragraph options").unwrap(); + let (cleared, _) = import(¶graph_fig(shared, reset), "Synthetic paragraph resets").unwrap(); + // All four off their defaults: the export writes them and the import reads them back. + let mut styled = inherited.clone(); + let id = styled.nodes().find(|node| node.name == "Label").unwrap().id; + if let Some(figcraft_doc::NodeKind::Text(td)) = styled.node_mut(id).map(|node| &mut node.kind) { + td.hanging_punctuation = true; + td.hanging_list = true; + } + let (bytes, export_warnings) = export(&styled, None).unwrap(); + assert!(export_warnings.iter().all(|warning| !warning.contains("list spacing")), "{export_warnings:?}"); + let (back, _) = import(&bytes, "Exported paragraph options").unwrap(); + let text = back.nodes().find(|node| node.name == "Label").unwrap().kind.text().unwrap(); + assert_eq!(text.list_spacing, 18.0); + assert!(text.hanging_list); + assert!(text.hanging_punctuation); + assert_eq!(text.leading_trim, figcraft_doc::LeadingTrim::CapHeight); + + // Everything at its default: nothing is carried over. + let (bytes, export_warnings) = export(&cleared, None).unwrap(); + assert!(export_warnings.iter().all(|warning| !warning.contains("list spacing")), "{export_warnings:?}"); + let (back, _) = import(&bytes, "Exported paragraph defaults").unwrap(); + let text = back.nodes().find(|node| node.name == "Label").unwrap().kind.text().unwrap(); + assert_eq!(text.list_spacing, 0.0); + assert!(!text.hanging_list); + assert!(!text.hanging_punctuation); + assert_eq!(text.leading_trim, figcraft_doc::LeadingTrim::None); + + // OpenType features are still left out, and only a text that has some warns. + let id = styled.nodes().find(|node| node.name == "Label").unwrap().id; + if let Some(figcraft_doc::NodeKind::Text(td)) = styled.node_mut(id).map(|node| &mut node.kind) { + td.features.insert("liga".into(), false); + } + let (_, with_features) = export(&styled, None).unwrap(); + assert!(with_features.iter().any(|warning| warning.contains("OpenType features were left out")), "{with_features:?}"); + let (_, without) = export(&cleared, None).unwrap(); + assert!(without.iter().all(|warning| !warning.contains("OpenType")), "{without:?}"); +} + +#[test] +fn the_schema_numbers_the_paragraph_options() { + let s = super::kiwi::Schema::parse(super::export::SCHEMA).unwrap(); + let def = |n: &str| s.defs.iter().find(|d| d.name == n).unwrap(); + let id = |f: &str| def("NodeChange").fields.iter().find(|x| x.name == f).unwrap().value; + assert_eq!((id("listSpacing"), id("leadingTrim"), id("hangingPunctuation"), id("hangingList")), (264, 322, 337, 339)); + let values: Vec<_> = def("LeadingTrim").fields.iter().map(|x| (x.name.as_str(), x.value)).collect(); + assert_eq!(values, [("NONE", 0), ("CAP_HEIGHT", 1)]); } fn instance_paragraph_fig(overrides: Vec<(&'static str, Kv<'static>)>, nonfinite_spacing: bool) -> Vec { @@ -286,3 +343,25 @@ fn encoded_instance_paragraph_overrides_fall_back_only_when_invalid() { assert!(!text.hanging_punctuation); assert_eq!(text.leading_trim, figcraft_doc::LeadingTrim::CapHeight); } + +#[test] +fn an_instance_layer_set_back_to_the_defaults_survives_a_fig_round_trip() { + // The main's text has all four off their defaults (from its text style); the instance's copy sets them back. + let reset = vec![ + ("listSpacing", Kv::Float(0.0)), + ("hangingList", Kv::Bool(false)), + ("hangingPunctuation", Kv::Bool(false)), + ("leadingTrim", Kv::Enum("NONE")), + ]; + let (doc, _) = import(&instance_paragraph_fig(reset, false), "Synthetic instance paragraph resets").unwrap(); + let (bytes, _) = export(&doc, None).unwrap(); + let (back, _) = import(&bytes, "Exported instance paragraph resets").unwrap(); + let options = |parent: &str| { + let parent = back.nodes().find(|node| node.name == parent).unwrap(); + let text = back.node(*parent.children.first().unwrap()).unwrap().kind.text().unwrap(); + (text.list_spacing, text.hanging_list, text.hanging_punctuation, text.leading_trim) + }; + assert_eq!(options("Main"), (18.0, true, true, figcraft_doc::LeadingTrim::CapHeight)); + // The override row clears each field; without it the instance's text takes the main's values again. + assert_eq!(options("Copy"), (0.0, false, false, figcraft_doc::LeadingTrim::None)); +} diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 56de5f480..2d62d68d5 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-11-10 · **Change:** minor (`.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (`.fig` export writes list spacing, hanging punctuation and lists, and vertical trim (#2305); `.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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 @@ -106,7 +106,7 @@ scales and empty-style clears; they have not been checked in other software. (font, with styles under the names font families give their faces: "SemiBold", "ExtraBold"…, and "Semi Bold" in Inter; size; line height, a share of the font size as a raw multiplier; letter spacing, case, decoration, links), alignment, auto resize, - truncation, paragraph spacing and indent, list types and styled runs with their fills (indexed + truncation, paragraph spacing and indent, list spacing, hanging punctuation and hanging lists, vertical trim, list types and styled runs with their fills (indexed by UTF-16 unit); components (description, boolean, text and instance swap properties and the layers bound to them, with their values also as variable data), component sets (the set holds the definitions, variant properties included with their values in order; each variant has its @@ -141,8 +141,7 @@ scales and empty-style clears; they have not been checked in other software. with the width on both sides when the shape has a fill too), pattern fills, WebP export settings (written as PNG), image adjustments, glass settings other than frost, springs other than Gentle (written as ease out), set-variable, set-variable-mode and conditional actions, scroll-to offsets, text decoration - looks, variable font axes, text on a path, nested list levels, list spacing, hanging punctuation, - leading trim, OpenType features, per-layer operations inside boolean groups, different stroke ends + looks, variable font axes, text on a path, nested list levels, OpenType features, per-layer operations inside boolean groups, different stroke ends on lines, the Dash cap (no public name for it). Not written at all: stroke outlines of dashed and per-side strokes and of inside or outside strokes on polygons, stars and vectors, glyph outlines of text (a reader lays text out with its own fonts), version history and branches. @@ -196,6 +195,7 @@ scales and empty-style clears; they have not been checked in other software. | Date | Change | Summary | |---|---|---| +| 2026-11-12 | minor | M6, #2305: the `.fig` export writes a text's list spacing (`listSpacing`), hanging punctuation (`hangingPunctuation`), hanging lists (`hangingList`) and vertical trim (`leadingTrim`: none or cap height), which the importer already read. A field is written only when it differs from its default (in a design file saved by Figma, a text at the defaults carries none of the four), and an instance override that goes back to the default clears it. The warning narrows to OpenType features, which the importer does not read from a `.fig`. Checked through the importer only, not in other software. | | 2026-11-10 | minor | M4, #2222: a boolean group's corner radius and smoothing are read and written by the `.fig` importer and exporter, and by the REST importer | | 2026-11-07 | patch | Fonts, #2092: a font loaded with `text.loadFont` is the counterpart of a font uploaded to the organization, which Figma's help center ("Manage conflicting fonts") ranks first, ahead of installed fonts and the web fonts. FigCraft chose the first face added for a family and style, so the built-in Inter 4.x kept Regular, SemiBold and Bold after Inter 3.19 was loaded and only Medium refitted. A loaded face now wins over the other faces of its family and style, the latest load over earlier ones; style matching and fallbacks are unchanged, and `refitted` lists the text whose size changes. Installed versus built-in order is not changed here. Test: `fontdb::tests::a_loaded_face_wins_over_the_built_in_one_of_its_family_and_style`. Numbers unchanged. | | 2026-11-08 | minor | M6, #2097 follow-up: per-point vector corner radii take the scale of the row supplying `vectorData`, including nested instance rows; override and derived rows are not scaled twice. Network caching distinguishes the instance scale even when resizing gives two vectors the same final box. Synthetic tests cover missing/unit factors, half/double scale, derived size alone, overridden and derived vector data, nested scale and equal-size cache separation. Layer-radius fallback remains the separate #2115 change. Numbers unchanged. | From 39acc364386af4b0c1a55df2f614e008447661f1 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 19:47:38 -0500 Subject: [PATCH 217/239] Docs: the interactions measured against Figma on 2026-11-08, case by case (#2111) * Docs: the interactions measured against Figma on 2026-11-08, case by case Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at low * Docs: the measured values for snapping, menus and Escape, and what FigCraft did before each fix Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote * Docs: the safe triangle unresolved, the Hug notice fixed in #2099, the variant warning not added (#2111 review) Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote * Docs: partly fixed defined, the test row a match, open questions without repeats, ui-parity's line reworded (#2111 review) Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --------- Co-authored-by: Claude Sonnet 5.5 --- docs/interaction-measurements.md | 189 +++++++++++++++++++++++++++++++ docs/ui-parity.md | 2 +- 2 files changed, 190 insertions(+), 1 deletion(-) create mode 100644 docs/interaction-measurements.md diff --git a/docs/interaction-measurements.md b/docs/interaction-measurements.md new file mode 100644 index 000000000..e71d6f166 --- /dev/null +++ b/docs/interaction-measurements.md @@ -0,0 +1,189 @@ +# Interaction measurements + +> **Last reviewed:** 2026-11-08 · **Last updated:** 2026-11-08 · **Change:** minor (first record of the interactions measured against Figma, case by case) · **Target:** Figma Design web app, measured 2026-11-08 + +On 2026-11-08 a set of interactions was measured in Figma's web app and compared with FigCraft's: modifier keys on move, resize and rotate, arrow keys, zoom steps, auto layout Fill and Hug, instances, components, number field scrubbing, sidebar widths, auto-pan at the viewport edge, copy and paste in vector edit mode, duplicate and paste placement, and text-editing keys. Every measurement used synthetic files, driving the UI and reading the Design and Layers panels (field values, dropdown labels, bounding boxes), or counting pixels on screen where a panel could not show the number. No incumbent screenshots are committed. This complements [ui-parity.md](ui-parity.md) and works on gap 4 in [gaps.md](gaps.md), "Interaction fidelity not compared tool by tool". It is not a full pass: each section lists what was covered, and the open questions at the end list what could not be measured. + +Status values: **matches** (FigCraft already behaved as measured), **fixed in #NNNN (open)** (a mismatch found, with the pull request that fixes it, open when this was written; the pull request carries its tests and CI), **partly fixed in #NNNN (open)** (the same, with what is still missing named), **not measured** (with the reason), **inconclusive**. Error margins are given where the measurement had one. Trust the shapes of the rules more than the last digit of a number. + +## Move, resize and rotate modifiers + +Synthetic pointer sequences on the canvas with modifier flags set. Resize handles were pressed 4 px inside the edge, so absolute resize numbers are about 8 px short per side; the cases were read relatively. + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Shift while moving | locks to the dominant axis (drags of +100,+30 and +100,+90 both gave dy 0); no 45 degree snap | the smaller of dx and dy is zeroed | matches | +| Alt while moving | a copy stays at the original place and the selection moves (layers 1 to 2) | duplicates on drag, re-synced with the Alt key | matches | +| Ctrl while moving | inconclusive: with Ctrl from the start the layer did not move, with Ctrl late in the drag it still snapped; a synthetic Ctrl does not seem to reach Figma as the modifier | Ctrl or Cmd turns snapping off | not measured (synthetic Ctrl is not delivered as a modifier) | +| Shift while resizing | corner (+50,+10) on a 100 by 50 layer keeps the ratio; right edge (+50,0) scales the height too, about the vertical centre | corner by the dominant factor about the opposite corner; edge about the opposite edge's middle | matches | +| Alt while resizing | a right edge grows symmetrically, the centre kept | resizes from the centre | matches | +| Shift and Alt on a corner | proportional, centre kept | both | matches | +| Modifier changed mid-drag | Shift on the second half locks; Shift on then off unlocks again; read fresh on every move | modifiers read on each move | matches | +| Shift while rotating | snaps the absolute angle to multiples of 15 | snapped the change in angle | fixed in #2096 (open) | +| Space while drawing or marquee | not measurable through the browser | not compared | not measured (the browser does not deliver it) | + +## Nudge and arrow pan + +Real keys; pan distances read from screenshots, plus or minus 3 px. + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Arrow keys on a selection | nudge 1 document px, 10 with Shift, at any zoom | same | matches | +| Arrow keys with nothing selected | pan the view: Right about 62 to 64 px (two trials), Shift+Right about 320 px (5 times) | 20 and 200 px (`PAN_STEP_PX`, 10 times) | fixed in #2106 (open) | + +## Zoom steps and fit + +Real keys. The canvas was 1389 by 903 CSS px with the floating bottom toolbar over it. + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Zoom in from 100% | 200, 400, 800, 1600, 3200, 6400, 12800, 25600 (maximum) | same steps (`STEPS` in `cmd/view.rs`) | matches | +| Zoom out from 100% | 50, 25, 13, 6, 3, 2 (minimum) | same | matches | +| Zoom from a typed 150% | in gives 200, out gives 100 (snaps to the list) | same | matches | +| Zoom to fit (Shift+1) | a 100 by 100 layer at 793% (vertical margin about 55 px); a 1000 by 200 layer at 134% (horizontal margin about 24 px each side); not a fixed 64 px margin, and not separated from the toolbar overlay | not changed | inconclusive (the toolbar overlay mixes into the margins) | +| Zoom to selection (Shift+2) | a 10 by 10 layer at 7630%, about 39 px above and about 100 px below (toolbar) | not changed | inconclusive (same overlay) | + +## Snapping and menus + +Measured earlier the same day; recorded here by pull request only. + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Snap threshold | a layer snaps about 4.5 screen px from a guide, at 100% and 200% | snapped at 5 screen px | fixed in #2086 (open) | +| Submenu opening | a submenu opens about 11 ms after its row is hovered; no safe triangle seen | opened after 0.15 s, with a safe triangle | delay fixed in #2093 (open); the safe triangle FigCraft keeps is unresolved (none seen in Figma; asked in #2093) | + +## Auto layout: Fill and Hug + +Values read from the zoomed Design panel's fields and dropdowns, in horizontal rows hugging height unless noted. + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Cross axis: a child set to Fill in a hugging parent | the child stretches to the tallest sibling; the parent stays Hug (child 40 Fill, parent 40 Hug; sibling typed to 60 gives 60 Fill and 60 Hug); no notice | turned the hugging parent Fixed | fixed in #2099 (open) | +| Cross axis: every child set to Fill | when the last non-Fill child is set, toast "Height set to Fixed for Frame 1" and the parent turns Fixed at its current size; typing 80 on the parent gives 80 Fixed with both children 80 Fill | the parent turned Fixed and the child kept its own size | fixed in #2099 (open) | +| Vertical stack hugging width | C (20 by 10) set to W Fill gives C 100 and the parent 100 Hug; D typed to 150 gives C 150, parent 150 Hug; no toast | the parent turned Fixed and the child kept its own size | fixed in #2099 (open) | +| Padding with a stretched child | padding 10 top and bottom, parent H 60 Hug; child H Fill gives 40 (the content box), parent stays 60 Hug | the parent turned Fixed and the child kept its own size | fixed in #2099 (open) | +| Min height on a stretched child | min height 50 gives child 50 Fill and parent 50 Hug (the stretched child's minimum counts toward the hug size) | the parent turned Fixed and the child kept its own size | fixed in #2099 (open) | +| Text sibling | rect H Fill beside two lines of text (Inter 24, line height 32): text 64 Hug, rect 64 Fill, parent 64 Hug; a third line gives 96, 96, 96 Hug | the parent turned Fixed and the child kept its own size | fixed in #2099 (open) | +| Main axis: a Fill child in a hugging parent | the parent turns Fixed (toast "Width set to Fixed for Frame 1", parent 197 Fixed) | the parent becomes fixed | matches | +| Wrap on, Fill height on a child | "Fill container" for height is greyed out on a child of a wrapping row (checked only with the parent hugging height) | not compared | not measured (only the hugging case was checked) | +| Setting a parent to Hug while a child fills along it | the child turns Fixed with the toast `Width set to Fixed for Rectangle 1` (the child's name) | demoted the child silently | fixed in #2099 (open) | + +## Instances + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Main component width and height follow its content | main: horizontal auto layout, W Hug, H Hug (135 by 49); a pasted instance reads the same | instance root sizing did not follow its main | fixed in #2099 (open) | +| A child set to Fill along the main axis | toast "Width set to Fixed for Frame 1"; main W Fixed 135, H Hug; the plain instance turns W Fixed 135 too, H Hug | the instance's own resizing never followed its main | fixed in #2099 (open) | +| Instance with its width overridden to 200 | stays W 200 Fixed through the main's change, H keeps following (Hug) | the instance's own resizing never followed its main | fixed in #2099 (open) | +| Main set back to Hug contents | toast "Width set to Fixed for Rectangle 1"; main 135 Hug; the plain instance back to 135 Hug; the overridden one stays 200 Fixed | the instance's own resizing never followed its main | fixed in #2099 (open) | +| Undo after the Fill change | unreliable in the web app (reverted the child, left the main Fixed) | not compared | inconclusive (not used as evidence) | + +## Components + +Third entry of the sidebar header's component dropdown, several layers selected. + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Create component set on frames named "Primary", "Secondary", "Ghost" | one set named "Component 1"; variants show their bare names; one property "Property 1" with the names as values, in canvas order left to right | no Create component set | fixed in #2095 (open) | +| Frames named "Size=Small", "Size=Large", "Size=Medium" | set "Component 1"; property "Size", values parsed from the names (Layers shows "Small", "Large", "Medium") | no Create component set | fixed in #2095 (open) | +| Three frames all named "Card" | set named "Card"; property "Property 1", every variant "Default"; the panel warns that some variants share property values, with "Select conflicting variants" | no Create component set | partly fixed in #2095 (open): the set and its names; the duplicate-value warning and Select conflicting variants are not added | +| Layout of the new set | no auto layout; the frames stay where they were; the set (purple dashed frame, stroke #8A38F5 inside 1 px, corner radius 5) wraps them with 20 px on every side; the set is selected afterwards; one undo reverts everything | no Create component set | fixed in #2095 (open) | +| Wrap style, caret in one paragraph | Balance re-wraps only that paragraph; with the layer selected the control shows "Mixed" | a wrap style per layer only | fixed in #2094 (open) | +| Wrap style set on the whole layer | Pretty overwrites the paragraph's Balance; editing again, both paragraphs show Pretty | a wrap style per layer only | fixed in #2094 (open) | +| Text style carrying the wrap style | not checked | not compared | not measured (not checked) | + +## Number field scrubbing + +Real drags on the field's label; values read from the input. + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| X from 100 | a 12.2 CSS px drag right gives 106; a 61.2 CSS px drag gives 131; about 0.5 per CSS px, whole numbers | 1 per point, with a speed factor by height | fixed in #2102 (open) | +| Rotation | a 12.2 CSS px drag right on its icon gave -6 degrees (one clean run; direction to confirm) | 1 per point | fixed in #2102 (open) | +| Opacity from 100% | 12.2 CSS px left gives 95% (about 0.4 per px); clamped at 100 going right | 1 per point | fixed in #2102 (open) | +| Shift and Alt rates | synthetic events did not reach the label's handlers | ten times with Shift, a tenth with Alt | not measured (not deliverable through the browser) | +| Pointer lock | not measured | not compared | not measured | + +## Sidebars + +Read with `getBoundingClientRect` at a 1920 CSS px viewport, device pixel ratio 1. + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Left sidebar | default 240, minimum 240, maximum about 450 (451 with the border) | 200 to 480 | fixed in #2103 (open) | +| Right sidebar | default 240 (241 with the border), minimum 240, maximum 500 | 240 to 480 | fixed in #2103 (open) | +| Edge | a double-click resets to the default; the hit zone is a couple of px wide | double-click resets | matches | + +## Auto-pan at the viewport edge + +Synthetic held drags at 100% zoom, pan speeds read from timed holds (0.5, 1.0, 1.5 and 3.0 s, linear in time). + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Moving a layer with the pointer near an edge | 40, 25 and 15 px inside: no pan; 12 px inside about 120 px/s; 8 px about 275 px/s; 2 px 520 to 530 px/s; 30 px outside about 600 px/s | no auto-pan for any drag | fixed in #2104 (open) | +| Fit of the speed | speed = clamp(40 x (15 - d), 0, 600) screen px per second, d = distance inside the edge (negative outside); zone about 14 to 15 px; cap about 600 px/s; no acceleration | n/a | fixed in #2104 (open) | +| Marquee, drawing a rectangle, dragging a prototype connection | the same pan (bottom, left and right edges tested) | none | fixed in #2104 (open) | +| Resize, rotate and other gestures | not measured | not compared | not measured | +| Speed at other zooms | not measured (taken as screen px per second) | not compared | not measured | + +## Vector edit clipboard + +Real keys and clicks, an open pen path A-B-C-D (three segments), vector edit mode entered on it. + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Copy a segment, leave edit mode, paste | a new layer holding only that segment, in place, sized to it | copied the whole layer | fixed in #2105 (open) | +| Copy one point, paste | a new layer holding the segments touching the point, in place | copied the whole layer | fixed in #2105 (open) | +| Cut a segment | removed from the network; the path splits into two subpaths in the same layer; edit mode stays; pasting outside gives a new layer with the cut segment, in place | deleted the segment without copying it | fixed in #2105 (open) | +| Paste while editing the same vector | no new layer; a duplicate of the segment is added to the network in place; the pasted points are selected | did nothing | fixed in #2105 (open) | +| Paste a copied rectangle while editing a vector | the rectangle's outline joins the network in place (four corners selected); no new layer; the bounds grow to include it | did nothing | fixed in #2105 (open) | + +A click on a segment's middle can add a point there in Figma's edit mode (seen once); it did not change the rules above. + +## Duplicate and paste + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Ctrl+D | a copy in place, selected, just above | same | matches | +| Move the copy +100, Ctrl+D | repeats +100 (smart duplicate); a reselect forgets the step | same | matches | +| Alt-drag +100, Ctrl+D | repeats (+200 in total) | same | matches | +| Paste with the original in view | in place on it, selected, just above | same | matches | +| Paste with the original off screen | at the view's centre | same | matches | +| Paste with a frame selected (far away) | inside the frame, at its centre | same | matches | +| Tests for the three paste placement rules | the three rules above | already as measured; no test pinned them | matches (pinned by tests in #2108, open) | +| Ctrl+Shift+V (paste over) | not measured (chord blocked or slow) | paste over at the selection's top-left | not measured (chord blocked or slow) | + +## Selection keys + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Escape with a nested layer selected | one Escape selects nothing, whether the layer was selected on the canvas, from the Layers panel or by Tab | selected the parent first | fixed in #2107 (open) | + +## Text-editing keys + +Defaults for a new text: Inter Regular 12, line height Auto, letter spacing 0%. + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Ctrl+Shift+> and < | font size +1 and -1 (12 to 18 stepped) | step 1 | matches | +| Alt+Shift+> and < | line height +1 and -1 px; from Auto at 12 it starts about 15 (not exact) | from the resolved height, 1 px | matches | +| Alt+> and < | letter spacing +1% and -1% | 1% | matches | +| Ctrl+B, I, U on a selected layer | toggles bold, italic, underline | same | matches | +| Double-click a word while editing | selects the word | same | matches | +| Triple-click | selects the line (paragraph) | same | matches | +| Escape while editing | leaves editing, the layer stays selected | same | matches | +| Ctrl+A while editing | selects all the text | same | matches | + +## Open questions + +| Behaviour | Figma (measured) | FigCraft | Status | +|---|---|---|---| +| Add auto layout (Shift+A) defaults | two 40 by 40 layers side by side: horizontal, gap "Auto", padding 0, W Fixed (140), H Hug (40); the same with a Y offset of 30 drops the offset; stacked: vertical, gap 60 (numeric), W Fixed (40), H Hug (140); a single 40 by 40 layer: new frame, W and H Hug (60), padding 10, gap 10; an existing 300 by 200 frame with two layers: W stays Fixed (300), H becomes Hug (149), gap "Auto", padding 49 | Hug on both axes for a wrapped selection and an inferred gap | inconclusive (inconsistent between cases in Figma itself: the gap is "Auto" in one case and numeric in another, the cross axis Fixed in the vertical case; the inference has more inputs than measured) | + +Also open, as listed in their sections: the zoom-to-fit margins (zoom section, inconclusive because of the toolbar overlay), Space while drawing or dragging a selection box and Ctrl while moving (modifiers section, not measurable from the browser), and the Shift and Alt scrub rates (number field section, not measurable). + +## Revision history + +| Date | Change | Summary | +|---|---|---| +| 2026-11-08 | minor | Created from the 2026-11-08 black-box comparison of FigCraft's interactions with Figma's, with synthetic files and no committed incumbent screenshots | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 6c7ef343d..e928b4c12 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -9,7 +9,7 @@ Nothing here has been compared tool by tool against the running Figma yet; that remaining work (40–60 h, [gaps](gaps.md) #4). **Summary (estimated):** UI/UX fidelity ~58%. Layout and look of UI3 compared side by side (~65%); -interaction feel not yet compared. +interaction feel only partly compared: the interactions measured so far, case by case, are in [interaction-measurements.md](interaction-measurements.md). ## Window and panels From 7b34dbab007461d6befa2eb45ff8eb14f8328328 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Fri, 13 Nov 2026 01:48:30 +0100 Subject: [PATCH 218/239] Keep library links working when the project folder is moved or cloned (#2132) Fixes #2122 Co-authored-by: Claude Opus 5.5 --- apps/figcraft-cli/src/files.rs | 2 +- apps/figcraft-cli/src/perf.rs | 8 +- crates/doc/src/library.rs | 5 ++ crates/engine/src/assets/library.rs | 92 ++++++++++++++++++++- crates/engine/src/assets/library/tests.rs | 54 ++++++++++++ crates/engine/src/cmd/file.rs | 2 +- crates/engine/src/cmd/file/load.rs | 4 +- crates/engine/src/cmd/file/save.rs | 16 +++- crates/engine/src/cmd/library.rs | 8 +- crates/engine/src/components_scale_tests.rs | 8 +- crates/engine/src/doc_list_paths_tests.rs | 2 + crates/engine/src/library_beacon_tests.rs | 2 +- crates/ui-egui/src/library_beacon_tests.rs | 8 +- 13 files changed, 201 insertions(+), 10 deletions(-) diff --git a/apps/figcraft-cli/src/files.rs b/apps/figcraft-cli/src/files.rs index 8f277e304..165057086 100644 --- a/apps/figcraft-cli/src/files.rs +++ b/apps/figcraft-cli/src/files.rs @@ -464,7 +464,7 @@ pub fn run_script(script: &str, input: Option<&str>, out: Option<&str>) -> CliRe refuse_dropping_images_from_script(input.map(|input| (input, input_images_left_out)), ds, out)?; if ext(out) == "figcraft" { // Through the engine, so the version history is kept. - write(out, &figcraft_engine::cmd::file::file_bytes(ds).map_err(|e| CliError::Failed(e.to_string()))?)?; + write(out, &figcraft_engine::cmd::file::file_bytes_at(ds, out).map_err(|e| CliError::Failed(e.to_string()))?)?; } else { write_doc(&ds.doc, ds.page, out)?; } diff --git a/apps/figcraft-cli/src/perf.rs b/apps/figcraft-cli/src/perf.rs index 30c801207..4c34a5027 100644 --- a/apps/figcraft-cli/src/perf.rs +++ b/apps/figcraft-cli/src/perf.rs @@ -508,7 +508,13 @@ fn measure_components(table: &mut Table, col: usize, instances: usize) -> CliRes let lib = figcraft_engine::library::Cache::default().load(&path).map_err(failed)?; let mut doc = Document::new("Consumer"); let m = &lib.manifest; - doc.libraries_mut().enabled.push(figcraft_doc::LibraryLink { id: m.id.clone(), name: m.name.clone(), path: path.clone(), version: m.version }); + doc.libraries_mut().enabled.push(figcraft_doc::LibraryLink { + id: m.id.clone(), + name: m.name.clone(), + path: path.clone(), + version: m.version, + ..Default::default() + }); let map = figcraft_engine::library::import(&mut doc, &lib, &lib_ds.assets(), false).map_err(failed)?; let mut local = lib_ds.remap(&map); local.theme = doc.libraries.collections.iter().find(|r| r.key == lib_ds.theme).map(|r| r.local.clone()).unwrap_or_default(); diff --git a/crates/doc/src/library.rs b/crates/doc/src/library.rs index 9fe1c75b7..719549c96 100644 --- a/crates/doc/src/library.rs +++ b/crates/doc/src/library.rs @@ -152,6 +152,11 @@ pub struct LibraryLink { pub name: String, /// Where the library file is. pub path: String, + /// Where the library file is from the folder of the document that links it ('/'-separated; + /// written on save): followed first when the document is opened, so the link survives moving + /// or cloning the folder that holds both. Empty for server links and older files. + #[serde(skip_serializing_if = "String::is_empty")] + pub relative: String, /// The library version this document last saw (when it was added or its updates accepted). pub version: u64, } diff --git a/crates/engine/src/assets/library.rs b/crates/engine/src/assets/library.rs index d9107ad63..2fb64a26d 100644 --- a/crates/engine/src/assets/library.rs +++ b/crates/engine/src/assets/library.rs @@ -628,6 +628,90 @@ pub fn absolute_path(path: &str) -> String { path.to_string() } +/// `path` with `.` and `..` taken out without asking the file system (`..` at the root stays there). +fn lexical(path: &std::path::Path) -> std::path::PathBuf { + use std::path::Component; + let mut out = std::path::PathBuf::new(); + for c in path.components() { + match c { + Component::CurDir => {} + Component::ParentDir if matches!(out.components().next_back(), Some(Component::Normal(_))) => { + out.pop(); + } + Component::ParentDir if out.has_root() => {} + c => out.push(c), + } + } + out +} + +/// The folder of the document saved at `doc_path`, absolute. +fn doc_folder(doc_path: &str) -> Option { + lexical(std::path::Path::new(&absolute_path(doc_path))).parent().map(std::path::Path::to_path_buf) +} + +/// Library file `lib` from the folder of the document at `doc_path`, '/'-separated; `None` when +/// there is no such path (another drive, say). +fn relative_to(doc_path: &str, lib: &str) -> Option { + use std::path::Component; + let folder = doc_folder(doc_path)?; + let lib = lexical(std::path::Path::new(&absolute_path(lib))); + let (from, to): (Vec<_>, Vec<_>) = (folder.components().collect(), lib.components().collect()); + let same = from.iter().zip(&to).take_while(|(a, b)| a == b).count(); + // Not even the root in common: no relative path leads there. + if same == 0 || !matches!(to.get(same..), Some([_, ..])) { + return None; + } + let up = from.get(same..).unwrap_or_default().iter().map(|_| Some("..")); + let down = to.get(same..).unwrap_or_default().iter().map(|c| match c { + Component::Normal(s) => s.to_str(), + _ => None, + }); + up.chain(down).collect::>>().map(|parts| parts.join("/")) +} + +/// Before saving the document to `doc_path`: each library file link also says where the file is +/// from the document's folder ([`LibraryLink::relative`]). +pub fn relate_links(doc: &mut Document, doc_path: &str) { + if doc.libraries.enabled.is_empty() { + return; + } + for l in &mut doc.libraries_mut().enabled { + l.relative = if crate::library_server::is_server_link(&l.path) { None } else { relative_to(doc_path, &l.path) }.unwrap_or_default(); + } +} + +/// After opening the document at `doc_path`: library file links go by its folder. A library +/// found at its [relative](LibraryLink::relative) place is followed (the folder was moved or +/// cloned), and a relative `path` is taken from the document's folder, not the working directory. +/// The open document keeps only the absolute `path`. +pub fn resolve_links(doc: &mut Document, doc_path: &str) { + if doc.libraries.enabled.iter().all(|l| crate::library_server::is_server_link(&l.path) && l.relative.is_empty()) { + return; + } + let Some(folder) = doc_folder(doc_path) else { return }; + for l in &mut doc.libraries_mut().enabled { + if crate::library_server::is_server_link(&l.path) { + l.relative.clear(); + continue; + } + let moved = Some(l.relative.as_str()).filter(|r| !r.is_empty()).map(|r| lexical(&folder.join(r))); + // Only a place on this computer is looked at (see `Session::fetch_library`). + if let Some(p) = + moved.filter(|p| p.to_str().is_some_and(craft_docpath::is_local) && crate::file_access::metadata(p).is_ok_and(|m| m.is_file())) + { + l.path = p.to_string_lossy().into_owned(); + } else if !l.path.is_empty() + && std::path::Path::new(&l.path).is_relative() + && let Some(p) = lexical(&folder.join(&l.path)).to_str().filter(|p| craft_docpath::is_local(p)) + { + l.path = p.to_string(); + } + // Written again on each save, from `path`. + l.relative.clear(); + } +} + /// The enabled library `key` (its id, name or path). pub fn find_link<'a>(doc: &'a Document, key: &str) -> Option<&'a LibraryLink> { let l = &doc.libraries.enabled; @@ -1257,7 +1341,13 @@ pub fn adopt_pasted(doc: &mut Document, src: &Document, src_path: Option<&str>, if doc.libraries.link(&m.id).is_none() && let Some(path) = src_path { - doc.libraries_mut().enabled.push(LibraryLink { id: m.id.clone(), name: m.name.clone(), path: path.to_string(), version: m.version }); + doc.libraries_mut().enabled.push(LibraryLink { + id: m.id.clone(), + name: m.name.clone(), + path: path.to_string(), + version: m.version, + relative: String::new(), + }); } } } diff --git a/crates/engine/src/assets/library/tests.rs b/crates/engine/src/assets/library/tests.rs index 733c3ba8c..4c329cb5f 100644 --- a/crates/engine/src/assets/library/tests.rs +++ b/crates/engine/src/assets/library/tests.rs @@ -641,3 +641,57 @@ fn a_file_stamp_from_the_moment_it_was_read_does_not_prove_it_unchanged() { assert!(entry(old).still_valid(&Stamp { len: 10, modified: Some(old) })); assert!(!entry(old).still_valid(&Stamp { len: 11, modified: Some(old) })); } + +/// Library `lid` is listed without an error, and `library.updates` reports no errors. +fn link_found(s: &mut Session, lid: &str) { + let list = ex(s, "library.list", json!({})); + let l = list["libraries"].as_array().unwrap().iter().find(|l| l["id"] == lid).unwrap_or_else(|| panic!("{list}")); + assert!(l.get("error").is_none_or(Value::is_null), "{l}"); + let u = ex(s, "library.updates", json!({})); + assert_eq!(u["errors"], json!([]), "{u}"); +} + +/// A library next to the documents that use it stays linked when their folder is moved or cloned; +/// files from before relative links, and relative paths written by hand, keep working too. +#[test] +fn library_links_follow_a_moved_folder() { + let d = dir("moved-folder"); + let (a, b) = (d.join("a"), d.join("b")); + std::fs::create_dir_all(a.join("lib")).unwrap(); + std::fs::create_dir_all(a.join("pages")).unwrap(); + let mut lib = Session::new(); + kit(&mut lib); + let lid = publish_to(&mut lib, &path_str(&a.join("lib").join("kit.figcraft"))); + + let mut s = Session::new(); + ex(&mut s, "file.saveAs", json!({"path": path_str(&a.join("pages").join("Page.figcraft"))})); + ex(&mut s, "library.add", json!({"path": path_str(&a.join("lib").join("kit.figcraft"))})); + ex(&mut s, "library.place", json!({"library": lid, "component": "Card", "x": 0, "y": 0})); + ex(&mut s, "file.save", json!({})); + // The folder moves (or is cloned elsewhere): the library keeps its place next to the page. + std::fs::rename(&a, &b).unwrap(); + let mut moved = Session::empty(); + ex(&mut moved, "file.open", json!({"path": path_str(&b.join("pages").join("Page.figcraft"))})); + link_found(&mut moved, &lid); + + // A file from before relative links: the absolute path is followed. + let old = d.join("old"); + std::fs::create_dir_all(&old).unwrap(); + let mut doc = Document::new("Old"); + let abs = path_str(&b.join("lib").join("kit.figcraft")); + doc.libraries_mut().enabled.push(LibraryLink { id: lid.clone(), name: "Kit".into(), path: abs, version: 1, ..Default::default() }); + std::fs::write(old.join("Old.figcraft"), figcraft_format::save_bytes(&doc, None).unwrap()).unwrap(); + let mut s = Session::empty(); + ex(&mut s, "file.open", json!({"path": path_str(&old.join("Old.figcraft"))})); + link_found(&mut s, &lid); + + // A relative path written by hand goes by the document's folder, not the working directory. + let mut doc = Document::new("Hand"); + let rel = "../lib/kit.figcraft".to_string(); + doc.libraries_mut().enabled.push(LibraryLink { id: lid.clone(), name: "Kit".into(), path: rel, version: 1, ..Default::default() }); + std::fs::write(b.join("pages").join("Hand.figcraft"), figcraft_format::save_bytes(&doc, None).unwrap()).unwrap(); + let mut s = Session::empty(); + ex(&mut s, "file.open", json!({"path": path_str(&b.join("pages").join("Hand.figcraft"))})); + link_found(&mut s, &lid); + let _ = std::fs::remove_dir_all(&d); +} diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rs index 2916d4aac..0c84f3458 100644 --- a/crates/engine/src/cmd/file.rs +++ b/crates/engine/src/cmd/file.rs @@ -41,7 +41,7 @@ use open::append_pages; pub(crate) use open::open; use open::{import, open_recent, revert}; pub(crate) use save::save_ends_preview; -pub use save::{FileSnapshot, file_bytes, thumbnail}; +pub use save::{FileSnapshot, file_bytes, file_bytes_at, thumbnail}; use save::{color_profile, mark_saved, save, save_as}; pub use version::MAX_AUTOSAVES; pub(crate) use version::{add_version, keep_in_history, read_version, unique_id}; diff --git a/crates/engine/src/cmd/file/load.rs b/crates/engine/src/cmd/file/load.rs index ab5ae43e8..d204931ac 100644 --- a/crates/engine/src/cmd/file/load.rs +++ b/crates/engine/src/cmd/file/load.rs @@ -75,7 +75,9 @@ pub fn load_bytes(bytes: &[u8], name_hint: &str) -> Result<(Document, Vec) -> Result<(figcraft_format::Loaded, bool)> { let bytes = read(path)?; let sibling = if variables.is_none() { sibling_variables(path) } else { None }; - load_with(&bytes, path, variables.or(sibling.as_ref()), &rest_images(path)) + let (mut loaded, rest) = load_with(&bytes, path, variables.or(sibling.as_ref()), &rest_images(path))?; + crate::library::resolve_links(&mut loaded.doc, path); + Ok((loaded, rest)) } /// Load from bytes. Returns the document with its notes (repairs of a native file, or import diff --git a/crates/engine/src/cmd/file/save.rs b/crates/engine/src/cmd/file/save.rs index 4b8939c7d..975976537 100644 --- a/crates/engine/src/cmd/file/save.rs +++ b/crates/engine/src/cmd/file/save.rs @@ -42,6 +42,11 @@ pub fn file_bytes(ds: &DocState) -> Result> { FileSnapshot::of(ds).encode() } +/// [`file_bytes`] for the file at `path` (library links are stored relative to its folder too). +pub fn file_bytes_at(ds: &DocState, path: &str) -> Result> { + FileSnapshot::of(ds).encode_at(Some(path)) +} + /// A document's file as it is at one moment, so the slow part of saving it (the thumbnail and the /// encoding) can run on another thread while editing goes on: [`encode`](Self::encode) there, then /// [`save`](Self::save) the bytes back on the session's thread. @@ -73,8 +78,17 @@ impl FileSnapshot { /// The file's bytes: content, thumbnail and version history. pub fn encode(&self) -> Result> { + self.encode_at(self.path.as_deref()) + } + + /// [`encode`](Self::encode) for the file at `path`: library links also say where their + /// files are from its folder. + fn encode_at(&self, path: Option<&str>) -> Result> { let mut doc = (*self.doc).clone(); doc.current_page = Some(self.page); + if let Some(path) = path { + crate::library::relate_links(&mut doc, path); + } let thumb = thumbnail(&doc); figcraft_format::save_bytes_with_history(&doc, thumb.as_deref(), &self.versions, &self.branches) .map_err(|e| EngineError::Other(e.to_string())) @@ -177,7 +191,7 @@ fn save_to(s: &mut Session, path: Option) -> Result { { Arc::make_mut(&mut snapshot.doc).name = file_stem(path); } - let bytes = snapshot.encode()?; + let bytes = snapshot.encode_at(path.as_deref().or(snapshot.path.as_deref()))?; let Some(path) = path else { // The download can still be refused: the caller marks the file saved once it was delivered. let name = format!("{}.figcraft", ds.doc.name); diff --git a/crates/engine/src/cmd/library.rs b/crates/engine/src/cmd/library.rs index 8aeb12d49..d8e2e6893 100644 --- a/crates/engine/src/cmd/library.rs +++ b/crates/engine/src/cmd/library.rs @@ -646,7 +646,13 @@ fn add(s: &mut Session, p: &Value) -> Result { l.path = path.clone(); l.name = m.name.clone(); } - None => libs.enabled.push(LibraryLink { id: m.id.clone(), name: m.name.clone(), path: path.clone(), version: m.version }), + None => libs.enabled.push(LibraryLink { + id: m.id.clone(), + name: m.name.clone(), + path: path.clone(), + version: m.version, + relative: String::new(), + }), } } let mut out = assets_json(&lib); diff --git a/crates/engine/src/components_scale_tests.rs b/crates/engine/src/components_scale_tests.rs index 68465932b..6e527532d 100644 --- a/crates/engine/src/components_scale_tests.rs +++ b/crates/engine/src/components_scale_tests.rs @@ -453,7 +453,13 @@ fn library_setup(path: &str) -> (Session, DesignSystem, Session, DesignSystem, V let lib = crate::library::Cache::default().load(path).unwrap(); let mut doc = Document::new("Consumer"); let m = &lib.manifest; - doc.libraries_mut().enabled.push(LibraryLink { id: m.id.clone(), name: m.name.clone(), path: path.to_string(), version: m.version }); + doc.libraries_mut().enabled.push(LibraryLink { + id: m.id.clone(), + name: m.name.clone(), + path: path.to_string(), + version: m.version, + ..Default::default() + }); let map = crate::library::import(&mut doc, &lib, &ds.assets(), false).unwrap(); let mut local = ds.remap(&map); local.theme = doc.libraries.collections.iter().find(|r| r.key == ds.theme).map(|r| r.local.clone()).unwrap(); diff --git a/crates/engine/src/doc_list_paths_tests.rs b/crates/engine/src/doc_list_paths_tests.rs index 0d73d0736..f6d8dc197 100644 --- a/crates/engine/src/doc_list_paths_tests.rs +++ b/crates/engine/src/doc_list_paths_tests.rs @@ -56,6 +56,7 @@ fn a_plugin_gets_library_names_but_not_their_links() { name: "Kit".into(), path: LINK.into(), version: 3, + ..Default::default() }); let tail = "(call $set_output (i32.const 40000) (call $reply_read (i32.const 40000) (i32.const 20000))) (return (i32.const 0))"; install(&mut s, manifest("org.test.libs", "read", &[]), &script(&[("library.list", json!({}))], OnRefusal::Fail, tail)); @@ -73,6 +74,7 @@ fn a_plugin_gets_a_fixed_message_for_library_update_failures() { name: "Kit".into(), path: LINK.into(), version: 3, + ..Default::default() }); let tail = "(call $set_output (i32.const 40000) (call $reply_read (i32.const 40000) (i32.const 20000))) (return (i32.const 0))"; install(&mut s, manifest("org.test.upd", "read", &[]), &script(&[("library.updates", json!({}))], OnRefusal::Fail, tail)); diff --git a/crates/engine/src/library_beacon_tests.rs b/crates/engine/src/library_beacon_tests.rs index 43629005f..6645e01b1 100644 --- a/crates/engine/src/library_beacon_tests.rs +++ b/crates/engine/src/library_beacon_tests.rs @@ -61,7 +61,7 @@ impl LiveLink for Link { /// A session with `prefs` that opened a file (from disk) whose libraries include [`LINK`]. fn opened(prefs: Prefs, tag: &str) -> (Session, Arc>, std::path::PathBuf) { let mut d = Document::new("Someone else's file"); - d.libraries_mut().enabled.push(LibraryLink { id: "lib".into(), name: "Kit".into(), path: LINK.into(), version: 3 }); + d.libraries_mut().enabled.push(LibraryLink { id: "lib".into(), name: "Kit".into(), path: LINK.into(), version: 3, ..Default::default() }); let path = std::env::temp_dir().join(format!("figcraft-beacon-{}-{tag}.figcraft", std::process::id())); std::fs::write(&path, figcraft_format::save_bytes(&d, None).unwrap()).unwrap(); let mut s = Session::new(); diff --git a/crates/ui-egui/src/library_beacon_tests.rs b/crates/ui-egui/src/library_beacon_tests.rs index e3b001627..3f5949b3e 100644 --- a/crates/ui-egui/src/library_beacon_tests.rs +++ b/crates/ui-egui/src/library_beacon_tests.rs @@ -13,7 +13,13 @@ const LINK: &str = "ws://tracker.example:9/?file=f&token=per-file-secret"; #[test] fn the_assets_panel_checks_an_unknown_library_server_only_when_asked() { let mut s = Session::new(); - s.doc_mut().unwrap().libraries_mut().enabled.push(LibraryLink { id: "lib".into(), name: "Kit".into(), path: LINK.into(), version: 1 }); + s.doc_mut().unwrap().libraries_mut().enabled.push(LibraryLink { + id: "lib".into(), + name: "Kit".into(), + path: LINK.into(), + version: 1, + ..Default::default() + }); let mut u = Ui::new(s); u.app.ui.left_tab = crate::LeftTab::Assets; u.app.ui.libraries = true; From d3688b9e8eb9f25af89dfce726f27a4ad9beba36 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 21:37:55 -0500 Subject: [PATCH 219/239] Docs: the Rename row after the merge with main keeps both changes apart The merge joined main's Tab-while-renaming text and this change's icon double-click text without the closing code span and separator between them. They are two clauses again, and the row says that a double-click on the name or elsewhere on the row still renames. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- docs/ui-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 486dfe06b..7778e9561 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -49,7 +49,7 @@ interaction feel only partly compared: the interactions measured so far, case by | Expand and collapse: Alt-click opens or closes everything inside; Collapse layers (Alt+L) keeps the way to the selection open | done | Alt-click pinned (the documentation is silent) | | Drag to reorder and into frames, groups and auto layout: insertion line, spring-loaded open, several layers together, Escape cancels | done | several layers dropped together land together (they split apart before); instances and a layer's own children refuse drops | | Eye and padlock: click, or drag across rows to set several in one step; layers in a locked frame show a faint padlock | done | the toggles no longer vanish under the pointer (clicks on them could miss) (a child's padlock can't be toggled while its parent is locked) | -| Rename: double click, F2 / Cmd+R, Tab to the next row; several layers open Rename layers (match, regular expressions, current name and number codes, start value, preview) | done | numbered in stacking order, pinned; Tab on the last row wraps to the first row's rename, measured in Figma's web app on 2026-11-12 (`tab_on_the_last_row_commits_and_wraps_to_the_first`); Shift+Tab on the first row ends the rename (not measured); Tab and Shift+Tab move only the rename, the selection stays on the layer first renamed, measured in Figma's web app on 2026-11-12 (`tab_while_renaming_leaves_the_selection_on_the_first_layera double-click on a row's icon zooms to the layer (selecting it first) and renames nothing, measured in Figma's web app on 2026-11-12 (`a_double_click_on_a_layers_icon_zooms_to_it_instead_of_renaming`) | +| Rename: double click, F2 / Cmd+R, Tab to the next row; several layers open Rename layers (match, regular expressions, current name and number codes, start value, preview) | done | numbered in stacking order, pinned; Tab on the last row wraps to the first row's rename, measured in Figma's web app on 2026-11-12 (`tab_on_the_last_row_commits_and_wraps_to_the_first`); Shift+Tab on the first row ends the rename (not measured); Tab and Shift+Tab move only the rename, the selection stays on the layer first renamed, measured in Figma's web app on 2026-11-12 (`tab_while_renaming_leaves_the_selection_on_the_first_layer`); a double-click on a row's icon zooms to the layer (selecting it first) and renames nothing, while a double-click on the name or elsewhere on the row still renames, measured in Figma's web app on 2026-11-12 (`a_double_click_on_a_layers_icon_zooms_to_it_instead_of_renaming`) | | Find layers (filter by name) | done | not covered by the documentation | | Pages: add, rename, drag to reorder, duplicate ("Copy of"), delete, dividers (a blank page named with a hyphen) | done | the line between Pages and Layers drags to size the pages list, kept in the preferences; a long list scrolls in its own area and a page dropped outside the visible list stays put (#272) (`layers_behaviour_tests`) | | Assets panel: folders from page, frames and slash names (fold away), search, thumbnails, drag onto the canvas or into frames and auto layout, Alt-drop swap, enabled libraries | done | Shift+I (Quick insert), Alt+2 and View ▸ Panels ▸ Assets open it; the toolbar's Resources button was removed (the left rail's Assets tab and those shortcuts are the ways in) | From 3cf7385f3d778716cecb12ff16d342fbc582834b Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 22:07:04 -0500 Subject: [PATCH 220/239] Docs: keep one Vector edit mode row (main's, plus this PR's mirror clause) Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- docs/ui-parity.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index df3485f75..b5c81c8c4 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -97,9 +97,7 @@ interaction feel only partly compared: the interactions measured so far, case by | Rectangle, ellipse (arc handles and Design panel arc fields), polygon, star, line, arrow; Shift/Alt | done | Alt draws lines from the centre too (`shapes_behaviour_tests`) | | Corner radius handles (inside each corner of a rectangle or frame, a polygon's or star's top point; Alt: one corner), star ratio handle; Count and Ratio fields | done | handles hide under 48 px on screen; no count handle on the canvas (the Count field instead); corner smoothing rounds rectangles and frames only | | Pen: vector networks, branch, close, bend; pencil | done | pen pressure on Windows and from browser styluses only; outside edit mode the Pen closes on its first point, connects to its other points and continues a selected open path from an end point (`vector_multi_behaviour_tests`); Escape ends the path and keeps its layer in edit mode with the pen, so the next path joins the same vector and another Escape leaves edit mode (#760, `pen_end_tests`); Enter or a double-click ends the path (at the double-click's point, added once) and edits the vector with the Move tool, a double-click with the idle pen edits the layer under it, and in edit mode the pen's Enter or double-click takes the Move tool (#1430, `pen_vector_edit_tests`); switching from Design to Prototype or Inspect ends the path and returns to Move (#308) | -| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a double-click a few pixels off a thin stroke enters edit mode (#646); entering edit mode and picking a region keep the canvas still (#322); a point dropped on another point merges with it, and dropping one end of an open path on the other closes it (a 2-point line's end just moves, #401); Flatten keeps open paths open (#377), and bakes a vector's point corner radius into its path (each rounded point becomes the arc's end points joined by curves, the layer stays a vector and its box fits the real geometry, #2195); paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn; Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); the Point section's X and Y show the value the selected points share, or Mixed, and a typed value sets every selected point's own coordinate, in the layer being edited (measured in Figma on 2026-11-08); Copy and Cut with points or segments selected take just those (a lone point: the segments touching it) as a vector with the layer's look, at their own place, so a paste outside edit mode is a new layer in place; Cut removes them as Delete does, the path splitting in the same layer with edit mode staying on; Paste while editing adds the clipboard's segments, or a copied shape's or boolean's outline, to the edited network in place with the new points selected, skipping layers with no outline (text, frames, groups; named in `skipped`) and refusing when none has one, as measured in Figma (`vector_clipboard_tests`, #1875). Not yet: areas of other layers edited at once; the Point section's X and Y over points of several edited layers; paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn; Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); the Point section's X and Y show the value the selected points share, or Mixed, and a typed value sets every selected point's own coordinate, in the layer being edited (measured in Figma on 2026-11-08). Not yet: areas of other layers edited at once; the Point section's X and Y over points of several edited layersmirror mode on a sharp point turns it smooth by the measured rule (#2110); a double-click a few pixels off a thin stroke enters edit mode (#646); entering edit mode and picking a region keep the canvas still (#322); a point dropped on another point merges with it, and dropping one end of an open path on the other closes it (a 2-point line's end just moves, #401); Flatten keeps open paths open (#377); paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn; Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). Not yet: areas of other layers edited at once | -| 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), and bakes a vector's point corner radius into its path (each rounded point becomes the arc's end points joined by curves, the layer stays a vector and its box fits the real geometry, #2195); paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn; Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875). Not yet: areas of other layers edited at once | -| 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`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); Copy and Cut with points or segments selected take just those (a lone point: the segments touching it) as a vector with the layer's look, at their own place, so a paste outside edit mode is a new layer in place; Cut removes them as Delete does, the path splitting in the same layer with edit mode staying on; Paste while editing adds the clipboard's segments, or a copied shape's or boolean's outline, to the edited network in place with the new points selected, skipping layers with no outline (text, frames, groups; named in `skipped`) and refusing when none has one, as measured in Figma (`vector_clipboard_tests`, #1875). Not yet: areas of other layers edited at once | +| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a mirror mode on a sharp point turns it smooth by the measured rule (#2110); a double-click a few pixels off a thin stroke enters edit mode (#646); entering edit mode and picking a region keep the canvas still (#322); a point dropped on another point merges with it, and dropping one end of an open path on the other closes it (a 2-point line's end just moves, #401); Flatten keeps open paths open (#377), and bakes a vector's point corner radius into its path (each rounded point becomes the arc's end points joined by curves, the layer stays a vector and its box fits the real geometry, #2195); paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn; Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`); a Bend click on a sharp point between two segments curves it (handles along the line between its neighbours, a third of the way to each, `ops::auto_smooth`), on a curved one sharpens it, a drag sets the handles by hand (#1875); with regions selected, the Fill section (its rows and the colour picker) and `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` edit those regions' own fills, the layer's untouched, or the regions named by `regions: [index, ...]`; Copy fill takes the region's paint, the colour picker and its canvas gradient and crop handles edit it (an image from Upload from computer included; a file dropped on the picker goes to the canvas instead), what belongs to the layer (its fill style, a variable bound to its fill, the image crop button) stays off a region's rows, and `fill.pattern` sets the layer's fill (#1875); the Point section's X and Y show the value the selected points share, or Mixed, and a typed value sets every selected point's own coordinate, in the layer being edited (measured in Figma on 2026-11-08); Copy and Cut with points or segments selected take just those (a lone point: the segments touching it) as a vector with the layer's look, at their own place, so a paste outside edit mode is a new layer in place; Cut removes them as Delete does, the path splitting in the same layer with edit mode staying on; Paste while editing adds the clipboard's segments, or a copied shape's or boolean's outline, to the edited network in place with the new points selected, skipping layers with no outline (text, frames, groups; named in `skipped`) and refusing when none has one, as measured in Figma (`vector_clipboard_tests`, #1875). Not yet: areas of other layers edited at once; the Point section's X and Y over points of several edited layers | | Shape builder (Shift+M) on fills, strokes and open paths; variable width (Shift+W), one side with Alt | done | | | Boolean groups: clicked where the result is, double-click or Cmd/Ctrl-click into operands, live results while dragging or editing points, per-operand operations | done | a group past the path operations' caps (250 000 segments, 2 million possible crossings, 4 million segments swept over a fold) draws without its result, with a warning, and Flatten refuses it (#1104); the Design panel's Boolean groups menu leads Union, Subtract, Intersect and Exclude with their own icons, two offset squares with the result filled at reduced alpha (#2003) | | Text: point, auto height, fixed; caret, words, lines, IME | done | Backspace or Delete at the start of a list item takes its marker and keeps its level, the paragraph starting where the item's text did ("delete the counter, but keep the same level of indentation", Create bulleted and numbered lists; `text_tail_tests::list_keys_at_list_items`, text crate `behaviour_tests`); max lines on auto-width text keep it auto width, hugging up to that many lines and growing with its longest line ("Text resizing is set to auto height or auto width", Explore text properties; `text_behaviour_tests::max_lines_on_auto_width_text_keeps_auto_width_and_hugs_that_many_lines`); Alt+Enter while editing opens the link at the caret, web and mail links only (`text.openLink`; "press ⌥Option Return/Alt Enter to activate a focused link", Accessibility at Figma; `text_link_tests`); the font picker previews a family on the canvas while hovered (no undo step; Escape restores, #653) and Up/Down step through it (#352); a selection highlight after a line break starts at that line's start and an empty last line shows its mark (#665); carets step over whole emoji and accented letters; colour emoji draw from their colour tables (#300); IME composition replayed in tests as macOS sends it, not yet checked on a Mac (#747); CJK words by script run (no dictionary); vertical trim in Type settings; the caret takes the text's solid fill colour, measured in Figma's web app, 2026-11-09; gradient and image fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour, which is white in the dark theme and vanished on the default light page (#2190) (#2156; `caret_tests`); no spell check | From 88b63d1eb92b1a83bd6165e523b9ca8b9b903114 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 22:41:39 -0500 Subject: [PATCH 221/239] M6: .fig export writes text on a path (#2323) Text on a path was written as an ordinary text layer under the warning "text on a path was written as plain text", so the path, where the text starts and its side were gone when the file was opened again. It is now written as the format's own layer kind (TEXT_PATH): the first part of its path as a vector network of one open or closed chain with the segment the text starts on marked, the start as that segment's own parameter (textPathStart.tValue, found by inverse arc length) and the side as forward. Vertical alignment is written as top, which is how text on a path draws. More than one line and paths the format can't hold stay plain text, the parts of a path after the first are left out, and text on a path in an instance but not in its main component (or the other way round) is written as the main has it, each with its own warning. The field numbers come from the schema of a synthetic file saved from Figma's web app. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 briefed; Sonnet 5.5 wrote at medium --- crates/format/src/fig/export.rs | 5 +- crates/format/src/fig/export/layer.rs | 17 +- crates/format/src/fig/export/shape.rs | 227 ++++++++++++++++- crates/format/src/fig/text_path_tests.rs | 304 ++++++++++++++++++++++- docs/file-format-parity.md | 7 +- 5 files changed, 550 insertions(+), 10 deletions(-) diff --git a/crates/format/src/fig/export.rs b/crates/format/src/fig/export.rs index ac8612b9c..90bf8ecb2 100644 --- a/crates/format/src/fig/export.rs +++ b/crates/format/src/fig/export.rs @@ -72,7 +72,7 @@ const AUX: u32 = 2; pub(super) const SCHEMA: &str = " enum MessageType JOIN_START=0 NODE_CHANGES=1 enum NodePhase CREATED=0 REMOVED=1 -enum NodeType NONE=0 DOCUMENT=1 CANVAS=2 GROUP=3 FRAME=4 BOOLEAN_OPERATION=5 VECTOR=6 STAR=7 LINE=8 ELLIPSE=9 RECTANGLE=10 REGULAR_POLYGON=11 ROUNDED_RECTANGLE=12 TEXT=13 SLICE=14 SYMBOL=15 INSTANCE=16 SECTION=25 VARIABLE=28 VARIABLE_SET=31 +enum NodeType NONE=0 DOCUMENT=1 CANVAS=2 GROUP=3 FRAME=4 BOOLEAN_OPERATION=5 VECTOR=6 STAR=7 LINE=8 ELLIPSE=9 RECTANGLE=10 REGULAR_POLYGON=11 ROUNDED_RECTANGLE=12 TEXT=13 SLICE=14 SYMBOL=15 INSTANCE=16 SECTION=25 VARIABLE=28 VARIABLE_SET=31 TEXT_PATH=41 enum BlendMode PASS_THROUGH=0 NORMAL=1 DARKEN=2 MULTIPLY=3 LINEAR_BURN=4 COLOR_BURN=5 LIGHTEN=6 SCREEN=7 LINEAR_DODGE=8 COLOR_DODGE=9 OVERLAY=10 SOFT_LIGHT=11 HARD_LIGHT=12 DIFFERENCE=13 EXCLUSION=14 HUE=15 SATURATION=16 COLOR=17 LUMINOSITY=18 enum PaintType SOLID=0 GRADIENT_LINEAR=1 GRADIENT_RADIAL=2 GRADIENT_ANGULAR=3 GRADIENT_DIAMOND=4 IMAGE=5 enum ImageScaleMode STRETCH=0 FIT=1 FILL=2 TILE=3 @@ -151,6 +151,7 @@ message TextLineData LineType lineType=1, int styleId=10, int indentationLevel=2 message TextData string characters=1, uint[] characterStyleIDs=2, NodeChange[] styleOverrideTable=3, TextLineData[] lines=12 message Path WindingRule windingRule=1, uint commandsBlob=2, uint styleID=3 message VectorData uint vectorNetworkBlob=1, Vector normalizedSize=2, NodeChange[] styleOverrideTable=3 +message TextPathStart float tValue=1, bool forward=2 message ArcData float startingAngle=1, float endingAngle=2, float innerRadius=3 message OptionalVector Vector value=1 message LayoutGrid LayoutGridType type=1, Axis axis=2, bool visible=3, int numSections=4, float offset=5, float sectionSize=6, float gutterSize=7, Color color=8, LayoutGridPattern pattern=9, VariableData numSectionsVar=10, VariableData offsetVar=11, VariableData sectionSizeVar=12, VariableData gutterSizeVar=13 @@ -190,7 +191,7 @@ message GridTrackSizingFunction GridTrackSizingType type=1, float value=2 message GridTrackSize GridTrackSizingFunction minSizing=1, GridTrackSizingFunction maxSizing=2 message GUIDGridTrackSizeMapEntry GUID id=1, GridTrackSize trackSize=2 message GUIDGridTrackSizeMap GUIDGridTrackSizeMapEntry[] entries=1 -message NodeChange GUID guid=1, NodePhase phase=2, ParentIndex parentIndex=3, NodeType type=4, string name=5, bool visible=6, bool locked=7, float opacity=8, BlendMode blendMode=9, Vector size=11, Matrix transform=12, bool mask=16, MaskType maskType=317, float backgroundOpacity=19, bool backgroundEnabled=15, bool internalOnly=142, string description=318, StyleType styleType=163, string sortPosition=320, StyleId styleIdForFill=332, StyleId styleIdForStrokeFill=333, StyleId styleIdForText=334, StyleId styleIdForEffect=335, StyleId styleIdForGrid=336, VariableDataMap variableConsumptionMap=307, VariableModeBySetMap variableModeBySetMap=316, VariableSetMode[] variableSetModes=312, VariableSetID variableSetID=313, VariableResolvedDataType variableResolvedType=314, VariableDataValues variableDataValues=315, VariableScope[] variableScopes=353, DocumentColorProfile documentColorProfile=349, Paint[] fillPaints=38, Paint[] strokePaints=39, float strokeWeight=26, StrokeAlign strokeAlign=29, StrokeJoin strokeJoin=31, StrokeCap strokeCap=30, float[] dashPattern=13, float miterLimit=25, bool borderStrokeWeightsIndependent=299, float borderTopWeight=295, float borderRightWeight=298, float borderBottomWeight=296, float borderLeftWeight=297, Effect[] effects=43, float cornerRadius=20, float cornerSmoothing=160, bool rectangleCornerRadiiIndependent=149, float rectangleTopLeftCornerRadius=145, float rectangleTopRightCornerRadius=146, float rectangleBottomRightCornerRadius=148, float rectangleBottomLeftCornerRadius=147, ConstraintType horizontalConstraint=28, ConstraintType verticalConstraint=37, bool frameMaskDisabled=115, bool resizeToFit=117, bool isStateGroup=225, StateGroupPropertyValueOrder[] stateGroupPropertyValueOrders=238, bool sectionContentsHidden=283, Color backgroundColor=50, StackMode stackMode=105, float stackSpacing=107, float stackCounterSpacing=324, StackWrap stackWrap=323, StackCounterAlignContent stackCounterAlignContent=343, float stackHorizontalPadding=209, float stackVerticalPadding=210, float stackPaddingRight=233, float stackPaddingBottom=234, StackJustify stackPrimaryAlignItems=230, StackAlign stackCounterAlignItems=231, StackSize stackPrimarySizing=229, StackSize stackCounterSizing=221, bool bordersTakeSpace=294, bool stackReverseZIndex=271, float gridColumnGap=438, float gridRowGap=437, GUIDPositionMap gridColumns=436, GUIDPositionMap gridRows=435, GUIDGridTrackSizeMap gridColumnsSizing=474, GUIDGridTrackSizeMap gridRowsSizing=475, float stackChildPrimaryGrow=232, StackCounterAlign stackChildAlignSelf=236, StackPositioning stackPositioning=269, OptionalVector minSize=325, OptionalVector maxSize=326, GUID gridColumnAnchor=440, GUID gridRowAnchor=439, uint gridColumnSpan=442, uint gridRowSpan=441, LayoutGrid[] layoutGrids=47, ExportSettings[] exportSettings=45, TextData textData=42, FontName fontName=41, float fontSize=21, Number lineHeight=40, Number letterSpacing=165, TextCase textCase=34, TextDecoration textDecoration=35, TextAlignHorizontal textAlignHorizontal=32, TextAlignVertical textAlignVertical=33, TextAutoResize textAutoResize=46, TextTruncation textTruncation=280, int maxLines=351, float paragraphSpacing=23, float paragraphIndent=22, float listSpacing=264, LeadingTrim leadingTrim=322, bool hangingPunctuation=337, bool hangingList=339, Hyperlink hyperlink=223, bool autoRename=14, bool fontVariantCommonLigatures=127, bool fontVariantContextualLigatures=128, string fontVersion=202, uint textUserLayoutVersion=203, uint textExplicitLayoutVersion=396, uint textBidiVersion=279, float textTracking=27, bool textDecorationSkipInk=412, EmojiImageSet emojiImageSet=391, uint styleID=49, Path[] fillGeometry=51, Path[] strokeGeometry=52, VectorData vectorData=48, VectorMirror handleMirroring=44, uint count=10, float starInnerScale=24, ArcData arcData=195, BooleanOperation booleanOperation=36, string symbolDescription=144, VariableWidthPoint[] variableWidthPoints=447, PluginData[] pluginData=204, SymbolData symbolData=113, NodeChange[] derivedSymbolData=125, GUID overriddenSymbolID=143, ComponentPropDef[] componentPropDefs=266, ComponentPropRef[] componentPropRefs=267, ComponentPropAssignment[] componentPropAssignments=268, VariantPropSpec[] variantPropSpecs=483, VariableDataMap parameterConsumptionMap=445, GUIDPath guidPath=111, PrototypeInteraction[] prototypeInteractions=226, PrototypeStartingPoint prototypeStartingPoint=249, ScrollDirection scrollDirection=159, ScrollBehavior scrollBehavior=186, OverlayPositionType overlayPositionType=198, OverlayBackgroundInteraction overlayBackgroundInteraction=200, OverlayBackgroundAppearance overlayBackgroundAppearance=201 +message NodeChange GUID guid=1, NodePhase phase=2, ParentIndex parentIndex=3, NodeType type=4, string name=5, bool visible=6, bool locked=7, float opacity=8, BlendMode blendMode=9, Vector size=11, Matrix transform=12, bool mask=16, MaskType maskType=317, float backgroundOpacity=19, bool backgroundEnabled=15, bool internalOnly=142, string description=318, StyleType styleType=163, string sortPosition=320, StyleId styleIdForFill=332, StyleId styleIdForStrokeFill=333, StyleId styleIdForText=334, StyleId styleIdForEffect=335, StyleId styleIdForGrid=336, VariableDataMap variableConsumptionMap=307, VariableModeBySetMap variableModeBySetMap=316, VariableSetMode[] variableSetModes=312, VariableSetID variableSetID=313, VariableResolvedDataType variableResolvedType=314, VariableDataValues variableDataValues=315, VariableScope[] variableScopes=353, DocumentColorProfile documentColorProfile=349, Paint[] fillPaints=38, Paint[] strokePaints=39, float strokeWeight=26, StrokeAlign strokeAlign=29, StrokeJoin strokeJoin=31, StrokeCap strokeCap=30, float[] dashPattern=13, float miterLimit=25, bool borderStrokeWeightsIndependent=299, float borderTopWeight=295, float borderRightWeight=298, float borderBottomWeight=296, float borderLeftWeight=297, Effect[] effects=43, float cornerRadius=20, float cornerSmoothing=160, bool rectangleCornerRadiiIndependent=149, float rectangleTopLeftCornerRadius=145, float rectangleTopRightCornerRadius=146, float rectangleBottomRightCornerRadius=148, float rectangleBottomLeftCornerRadius=147, ConstraintType horizontalConstraint=28, ConstraintType verticalConstraint=37, bool frameMaskDisabled=115, bool resizeToFit=117, bool isStateGroup=225, StateGroupPropertyValueOrder[] stateGroupPropertyValueOrders=238, bool sectionContentsHidden=283, Color backgroundColor=50, StackMode stackMode=105, float stackSpacing=107, float stackCounterSpacing=324, StackWrap stackWrap=323, StackCounterAlignContent stackCounterAlignContent=343, float stackHorizontalPadding=209, float stackVerticalPadding=210, float stackPaddingRight=233, float stackPaddingBottom=234, StackJustify stackPrimaryAlignItems=230, StackAlign stackCounterAlignItems=231, StackSize stackPrimarySizing=229, StackSize stackCounterSizing=221, bool bordersTakeSpace=294, bool stackReverseZIndex=271, float gridColumnGap=438, float gridRowGap=437, GUIDPositionMap gridColumns=436, GUIDPositionMap gridRows=435, GUIDGridTrackSizeMap gridColumnsSizing=474, GUIDGridTrackSizeMap gridRowsSizing=475, float stackChildPrimaryGrow=232, StackCounterAlign stackChildAlignSelf=236, StackPositioning stackPositioning=269, OptionalVector minSize=325, OptionalVector maxSize=326, GUID gridColumnAnchor=440, GUID gridRowAnchor=439, uint gridColumnSpan=442, uint gridRowSpan=441, LayoutGrid[] layoutGrids=47, ExportSettings[] exportSettings=45, TextData textData=42, FontName fontName=41, float fontSize=21, Number lineHeight=40, Number letterSpacing=165, TextCase textCase=34, TextDecoration textDecoration=35, TextAlignHorizontal textAlignHorizontal=32, TextAlignVertical textAlignVertical=33, TextAutoResize textAutoResize=46, TextTruncation textTruncation=280, int maxLines=351, float paragraphSpacing=23, float paragraphIndent=22, float listSpacing=264, LeadingTrim leadingTrim=322, bool hangingPunctuation=337, bool hangingList=339, Hyperlink hyperlink=223, bool autoRename=14, bool fontVariantCommonLigatures=127, bool fontVariantContextualLigatures=128, string fontVersion=202, uint textUserLayoutVersion=203, uint textExplicitLayoutVersion=396, uint textBidiVersion=279, float textTracking=27, bool textDecorationSkipInk=412, EmojiImageSet emojiImageSet=391, uint styleID=49, Path[] fillGeometry=51, Path[] strokeGeometry=52, VectorData vectorData=48, TextPathStart textPathStart=432, VectorMirror handleMirroring=44, uint count=10, float starInnerScale=24, ArcData arcData=195, BooleanOperation booleanOperation=36, string symbolDescription=144, VariableWidthPoint[] variableWidthPoints=447, PluginData[] pluginData=204, SymbolData symbolData=113, NodeChange[] derivedSymbolData=125, GUID overriddenSymbolID=143, ComponentPropDef[] componentPropDefs=266, ComponentPropRef[] componentPropRefs=267, ComponentPropAssignment[] componentPropAssignments=268, VariantPropSpec[] variantPropSpecs=483, VariableDataMap parameterConsumptionMap=445, GUIDPath guidPath=111, PrototypeInteraction[] prototypeInteractions=226, PrototypeStartingPoint prototypeStartingPoint=249, ScrollDirection scrollDirection=159, ScrollBehavior scrollBehavior=186, OverlayPositionType overlayPositionType=198, OverlayBackgroundInteraction overlayBackgroundInteraction=200, OverlayBackgroundAppearance overlayBackgroundAppearance=201 struct Blob byte[] bytes message Message MessageType type=1, uint sessionID=2, NodeChange[] nodeChanges=4, Blob[] blobs=6 "; diff --git a/crates/format/src/fig/export/layer.rs b/crates/format/src/fig/export/layer.rs index bebd09059..6a9d0f1a0 100644 --- a/crates/format/src/fig/export/layer.rs +++ b/crates/format/src/fig/export/layer.rs @@ -66,6 +66,11 @@ impl<'d> Exporter<'d> { } _ => None, }; + // A text on a path is its own layer kind, written only when its path fields were built. + let on_path = match &n.kind { + NodeKind::Text(td) => self.text_path(n, td, nested), + _ => None, + }; let ty = match &n.kind { NodeKind::Page { .. } | NodeKind::Frame | NodeKind::Group | NodeKind::ComponentSet { .. } => "FRAME", NodeKind::Instance { .. } if main.is_none() => "FRAME", @@ -76,6 +81,7 @@ impl<'d> Exporter<'d> { NodeKind::Star { .. } => "STAR", NodeKind::Line => "LINE", NodeKind::Vector { .. } => "VECTOR", + NodeKind::Text(_) if on_path.is_some() => "TEXT_PATH", NodeKind::Text(_) => "TEXT", NodeKind::BooleanOp { .. } => "BOOLEAN_OPERATION", NodeKind::Component { .. } => "SYMBOL", @@ -99,7 +105,16 @@ impl<'d> Exporter<'d> { NodeKind::Polygon { count } => f.push(("count", u(*count))), NodeKind::Star { count, inner_ratio } => f.extend([("count", u(*count)), ("starInnerScale", fl(*inner_ratio))]), NodeKind::Vector { network } => self.vector(n, network, f), - NodeKind::Text(td) => self.text(td, &n.fills, f), + NodeKind::Text(td) => { + self.text(td, &n.fills, f); + if let Some(path) = on_path { + // Text on a path has no box to align in: it is written as top, which is how it draws. + if let Some(entry) = f.iter_mut().find(|(k, _)| *k == "textAlignVertical") { + entry.1 = e("TOP"); + } + f.extend(path); + } + } NodeKind::BooleanOp { op } => { let name = match op { BoolOp::Union => "UNION", diff --git a/crates/format/src/fig/export/shape.rs b/crates/format/src/fig/export/shape.rs index 119777367..f298e663f 100644 --- a/crates/format/src/fig/export/shape.rs +++ b/crates/format/src/fig/export/shape.rs @@ -173,9 +173,6 @@ impl<'d> Exporter<'d> { if styles.clone().any(|st| unsupported_decoration_look(st) || !st.variations.is_empty()) { self.warn("text decoration looks and variable font settings were left out"); } - if td.path.is_some() { - self.warn("text on a path was written as plain text"); - } if !td.features.is_empty() { self.warn("OpenType features were left out"); } @@ -374,4 +371,228 @@ impl<'d> Exporter<'d> { self.blobs.insert(bytes, i); Some(i) } + + /// The fields of a text on a path (its start and its path as a vector network), or `None` when the text stays plain text + /// (with the warning that says why). `nested`: for an instance's override row, which follows its main's layer. + pub(super) fn text_path(&mut self, n: &Node, td: &TextData, nested: bool) -> Option { + let doc = self.doc; + let own = text_path_net(td, n.width, n.height); + let main = if nested { n.source.and_then(|s| doc.node(s)) } else { None }; + if let Some(main) = main { + let main_ok = matches!(&main.kind, NodeKind::Text(m) if text_path_net(m, main.width, main.height).is_ok()); + if main_ok != own.is_ok() { + self.warn(TEXT_PATH_INSTANCE); + return None; + } + } + let tp = td.path.as_deref()?; + let made = match own { + Ok(made) => made, + Err(why) => { + self.warn(why); + return None; + } + }; + let Some(index) = self.blob(network::encode(&made.net)) else { + self.warn(TEXT_PATH_CANT); + return None; + }; + if made.later_parts { + self.warn(TEXT_PATH_PARTS); + } + Some(vec![ + ("textPathStart", o(vec![("tValue", fl(made.t)), ("forward", b(!tp.flip))])), + ("vectorData", o(vec![("vectorNetworkBlob", u(index)), ("normalizedSize", xy(n.width, n.height))])), + ]) + } +} + +/// The style id the format gives the segment a text on a path starts on. +const TEXT_PATH_MARK: u32 = 0x01ff_ffff; +const TEXT_PATH_LINES: &str = "text on a path with more than one line was written as plain text"; +const TEXT_PATH_CANT: &str = "text on a path the format can't hold was written as plain text"; +const TEXT_PATH_PARTS: &str = "the parts of a text's path after the first were left out"; +const TEXT_PATH_INSTANCE: &str = + "text on a path in an instance but not in its main component, or the other way round, was written as the main has it"; + +/// A text's path as the format holds it: one chain (or cycle) of a vector network with the +/// segment the text starts on marked, and the start as that segment's own parameter. +struct PathNet { + net: network::Network, + t: f64, + later_parts: bool, +} + +/// The tangent-to-control-point cubic of a network segment, as the import reads it. +fn net_cubic(net: &network::Network, s: &network::Segment) -> Option<(figcraft_doc::geom::kurbo::CubicBez, bool)> { + use figcraft_doc::geom::kurbo::CubicBez; + let (a, b) = (net.vertices.get(s.a)?, net.vertices.get(s.b)?); + let line = s.ta == (0.0, 0.0) && s.tb == (0.0, 0.0); + let cubic = CubicBez::new((a.x, a.y), (a.x + s.ta.0, a.y + s.ta.1), (b.x + s.tb.0, b.y + s.tb.1), (b.x, b.y)); + Some((cubic, line)) +} + +/// The length of a segment, as the import measures it. +fn net_length(net: &network::Network, s: &network::Segment) -> f64 { + use figcraft_doc::geom::kurbo::{Line, ParamCurveArclen}; + match net_cubic(net, s) { + Some((c, true)) => Line::new(c.p0, c.p3).arclen(1e-9), + Some((c, false)) => c.arclen(1e-9), + None => 0.0, + } +} + +/// The part of a path (a move and what follows it) as a chain of the network, and whether it is +/// a cycle; `None` without a segment longer than a billionth. +fn path_chain(part: &[figcraft_doc::geom::kurbo::PathEl]) -> Option<(network::Network, bool)> { + use figcraft_doc::geom::kurbo::{PathEl, Point, QuadBez}; + let r = |x: f64| f64::from(finite(x) as f32); + let rp = |p: Point| (r(p.x), r(p.y)); + let mut net = network::Network::default(); + let mut closed = false; + let mut cur = (0.0, 0.0); + let add = |net: &mut network::Network, c1: Option<(f64, f64)>, c2: Option<(f64, f64)>, end: (f64, f64)| { + let Some(last) = net.vertices.last() else { return }; + let (a, index) = ((last.x, last.y), net.vertices.len() - 1); + let tangent = |c: Option<(f64, f64)>, from: (f64, f64)| c.map_or((0.0, 0.0), |c| (r(c.0 - from.0), r(c.1 - from.1))); + let seg = network::Segment { style: 0, a: index, ta: tangent(c1, a), b: index + 1, tb: tangent(c2, end) }; + net.vertices.push(network::Vertex { style: 0, x: end.0, y: end.1 }); + if net_length(net, &seg) > 1e-9 { + net.segments.push(seg); + } else { + net.vertices.pop(); + } + }; + for el in part { + match el { + PathEl::MoveTo(p) => { + cur = rp(*p); + net.vertices.push(network::Vertex { style: 0, x: cur.0, y: cur.1 }); + } + PathEl::LineTo(p) => { + cur = rp(*p); + add(&mut net, None, None, cur); + } + PathEl::QuadTo(c, p) => { + let q = QuadBez::new(Point::new(cur.0, cur.1), Point::new(r(c.x), r(c.y)), Point::new(r(p.x), r(p.y))).raise(); + cur = rp(*p); + add(&mut net, Some((q.p1.x, q.p1.y)), Some((q.p2.x, q.p2.y)), cur); + } + PathEl::CurveTo(a, b, p) => { + cur = rp(*p); + add(&mut net, Some(rp(*a)), Some(rp(*b)), cur); + } + PathEl::ClosePath => closed = true, + } + } + if net.segments.is_empty() { + return None; + } + let first = net.vertices.first().map(|v| (v.x, v.y))?; + let last = net.vertices.last().map(|v| (v.x, v.y))?; + let near = |p: (f64, f64), q: (f64, f64)| (p.0 - q.0).hypot(p.1 - q.1) <= 1e-6; + let mut cycle = false; + if closed || near(last, first) { + if near(last, first) { + // The last segment ends on the first vertex. A single segment stays an open chain of + // two vertices at one place: the import refuses a segment from a vertex to itself. + if net.segments.len() > 1 { + net.vertices.pop(); + if let Some(s) = net.segments.last_mut() { + s.b = 0; + s.tb = (r(last.0 + s.tb.0 - first.0), r(last.1 + s.tb.1 - first.1)); + cycle = true; + } + } + } else { + net.segments.push(network::Segment { style: 0, a: net.vertices.len() - 1, ta: (0.0, 0.0), b: 0, tb: (0.0, 0.0) }); + cycle = true; + } + } + Some((net, cycle)) +} + +/// A text on a path as the format holds it, or the warning for why it stays plain text. +fn text_path_net(td: &TextData, w: f64, h: f64) -> Result { + use figcraft_doc::geom::kurbo::{ParamCurveArclen, PathEl}; + let Some(tp) = td.path.as_deref() else { return Err(TEXT_PATH_CANT) }; + if td.characters.contains(['\n', '\r']) { + return Err(TEXT_PATH_LINES); + } + let path = tp.path(); + let mut parts: Vec> = Vec::new(); + for el in path.elements() { + if matches!(el, PathEl::MoveTo(_)) { + parts.push(Vec::new()); + } + if let Some(part) = parts.last_mut() { + part.push(*el); + } + } + let mut chains = parts.iter().filter_map(|p| path_chain(p)); + let (mut net, cycle) = chains.next().ok_or(TEXT_PATH_CANT)?; + let later_parts = chains.next().is_some(); + if net.vertices.len() + net.segments.len() > MAX_NETWORK { + return Err(TEXT_PATH_CANT); + } + // The import scales the coordinates by size over normalized size, which are the same number + // here; an axis of no extent holds nothing but zeros. + let size = |x: f64| f64::from(finite(x) as f32); + for (extent, axis) in [(size(w), 0), (size(h), 1)] { + let at = |p: (f64, f64)| if axis == 0 { p.0 } else { p.1 }; + let flat = net.vertices.iter().all(|v| at((v.x, v.y)) == 0.0) && net.segments.iter().all(|s| at(s.ta) == 0.0 && at(s.tb) == 0.0); + if extent < 0.0 || (extent <= 1e-9 && (extent != 0.0 || !flat)) { + return Err(TEXT_PATH_CANT); + } + } + let lengths: Vec = net.segments.iter().map(|s| net_length(&net, s)).collect(); + let total: f64 = lengths.iter().sum(); + if !total.is_finite() || total <= 1e-10 { + return Err(TEXT_PATH_CANT); + } + // The path the import builds from it must be one the text renderer can measure. + let mut shape = figcraft_doc::geom::BezPath::new(); + for (i, s) in net.segments.iter().enumerate() { + let Some((c, line)) = net_cubic(&net, s) else { return Err(TEXT_PATH_CANT) }; + if i == 0 { + shape.move_to(c.p0); + } + if line { + shape.line_to(c.p3); + } else { + shape.curve_to(c.p1, c.p2, c.p3); + } + } + if cycle { + shape.close_path(); + } + let measured = figcraft_doc::geom::measure::polylines(&shape); + if measured.as_ref().and_then(|l| l.first()).is_none_or(|l| l.length() <= 1e-9) { + return Err(TEXT_PATH_CANT); + } + // The start, by length, as a parameter of the segment it falls on. + let start = tp.start(); + let at = (if tp.flip { 1.0 - start } else { start }) * total; + let mut before = 0.0; + let mut k = lengths.len().saturating_sub(1); + for (i, len) in lengths.iter().enumerate() { + if before + len >= at { + k = i; + break; + } + before += len; + } + if k + 1 == lengths.len() && before + lengths[k] < at { + before = total - lengths[k]; + } + let local = (at - before).clamp(0.0, lengths[k]); + let t = match net.segments.get(k).and_then(|s| net_cubic(&net, s)) { + Some((_, true)) | None => local / lengths[k], + Some((c, false)) => c.inv_arclen(local, 1e-9), + }; + let t = if t.is_finite() { t.clamp(0.0, 1.0) } else { 0.0 }; + if let Some(s) = net.segments.get_mut(k) { + s.style = TEXT_PATH_MARK; + } + Ok(PathNet { net, t, later_parts }) } diff --git a/crates/format/src/fig/text_path_tests.rs b/crates/format/src/fig/text_path_tests.rs index 8f7b46f43..0e9d0e0e8 100644 --- a/crates/format/src/fig/text_path_tests.rs +++ b/crates/format/src/fig/text_path_tests.rs @@ -83,8 +83,11 @@ fn blob() -> Vec { } fn canvas() -> Vec { + canvas_of(message(true)) +} + +fn canvas_of(message: Kv<'static>) -> Vec { let schema = super::kiwi::Schema::parse(SCHEMA).unwrap(); - let message = message(true); let message = super::kiwi::encode::message(&schema, schema.find("Message").unwrap(), &message).unwrap(); let mut out = b"fig-kiwi\0\0\0\0".to_vec(); for raw in [super::kiwi::encode::schema(&schema), message] { @@ -262,3 +265,302 @@ fn a_text_on_a_path_in_a_scaled_instance_has_its_path_scaled() { assert_eq!(path_of("Main"), "M0,0 L100,0"); assert_eq!(path_of("Half"), "M0,0 L50,0"); } + +// The `.fig` export writes text on a path. + +use figcraft_doc::geom::kurbo::PathEl; +use figcraft_doc::{Document, NodeId, TextAlignV}; + +const W1: &str = "text on a path with more than one line was written as plain text"; +const W2: &str = "text on a path the format can't hold was written as plain text"; +const W3: &str = "the parts of a text's path after the first were left out"; +const W4: &str = "text on a path in an instance but not in its main component, or the other way round, was written as the main has it"; +const MARK: u32 = 0x01ff_ffff; + +/// What an export wrote: its warnings, the layer records and the blobs. +struct Written { + warnings: Vec, + records: Vec>, + blobs: Vec>, +} + +impl Written { + fn of(doc: &Document) -> (Vec, Written) { + let (bytes, warnings) = super::export(doc, None).unwrap(); + let archive = super::Archive::open(&bytes).unwrap(); + let (schema, message) = super::decode_canvas(&archive.canvas).unwrap(); + let schema: &'static super::kiwi::Schema = Box::leak(Box::new(schema)); + let msg = schema.decode_message(schema.find("Message").unwrap(), &message).unwrap(); + let records = msg.get("nodeChanges").unwrap().list().to_vec(); + let blobs = msg + .get("blobs") + .map(|b| b.list().iter().filter_map(|x| x.get("bytes").and_then(Kv::bytes).map(<[u8]>::to_vec)).collect()) + .unwrap_or_default(); + (bytes, Written { warnings, records, blobs }) + } + + fn record(&self, name: &str) -> &Kv<'static> { + self.records.iter().find(|r| r.get("name").and_then(Kv::str) == Some(name)).unwrap_or_else(|| panic!("no record {name}")) + } + + /// The network in the blob a record's `vectorData` names. + fn network(&self, record: &Kv<'static>) -> super::network::Network { + let i = record.get("vectorData").unwrap().get("vectorNetworkBlob").and_then(Kv::f64).unwrap() as usize; + super::network::decode(self.blobs.get(i).unwrap()).unwrap() + } + + fn warned(&self, text: &str) -> bool { + self.warnings.iter().any(|w| w == text) + } +} + +fn ty<'a>(r: &'a Kv<'static>) -> &'a str { + r.get("type").and_then(Kv::str).unwrap() +} + +fn start_of(r: &Kv<'static>) -> (f64, bool) { + let s = r.get("textPathStart").unwrap_or_else(|| panic!("no textPathStart")); + (s.get("tValue").and_then(Kv::f64).unwrap(), s.get("forward").and_then(Kv::bool).unwrap()) +} + +/// A page holding one text per `(name, characters, d, start, flip, width, height)`. +fn doc_of(texts: &[(&str, &str, &str, f64, bool, f64, f64)]) -> Document { + let mut doc = Document::new("paths"); + let page = doc.first_page().unwrap(); + for (name, chars, d, start, flip, w, h) in texts { + let id = doc.create(page, NodeKind::Text(Default::default()), name, 0.0, 0.0, *w, *h).unwrap(); + let td = doc.node_mut(id).unwrap().kind.text_mut().unwrap(); + td.characters = (*chars).into(); + if !d.is_empty() || !chars.is_empty() { + td.path = Some(Box::new(TextPath { d: (*d).into(), start: *start, flip: *flip })); + } + } + doc +} + +fn text_of<'a>(doc: &'a Document, name: &str) -> &'a figcraft_doc::TextData { + let node = doc.nodes().find(|n| n.name == name).unwrap_or_else(|| panic!("no layer {name}")); + let NodeKind::Text(td) = &node.kind else { panic!("{name} is not text") }; + td +} + +fn elements(d: &str) -> Vec<(char, Vec<(f64, f64)>)> { + figcraft_doc::geom::svg_path(d) + .unwrap() + .elements() + .iter() + .map(|el| match el { + PathEl::MoveTo(p) => ('M', vec![(p.x, p.y)]), + PathEl::LineTo(p) => ('L', vec![(p.x, p.y)]), + PathEl::QuadTo(a, b) => ('Q', vec![(a.x, a.y), (b.x, b.y)]), + PathEl::CurveTo(a, b, c) => ('C', vec![(a.x, a.y), (b.x, b.y), (c.x, c.y)]), + PathEl::ClosePath => ('Z', vec![]), + }) + .collect() +} + +fn same_path(a: &str, b: &str) { + let (x, y) = (elements(a), elements(b)); + assert_eq!(x.len(), y.len(), "{a} / {b}"); + for ((ka, pa), (kb, pb)) in x.iter().zip(&y) { + assert_eq!(ka, kb, "{a} / {b}"); + for (p, q) in pa.iter().zip(pb) { + assert!((p.0 - q.0).abs() < 1e-3 && (p.1 - q.1).abs() < 1e-3, "{a} / {b}"); + } + } +} + +fn no_text_path_warning(warnings: &[String]) { + assert!(!warnings.iter().any(|w| w.contains("text path") || w.contains("text off its path")), "{warnings:?}"); +} + +#[test] +fn a_text_on_a_path_survives_a_fig_export() { + let (doc, _) = super::import(&canvas(), "Text path").unwrap(); + let (bytes, warnings) = super::export(&doc, None).unwrap(); + assert!(!warnings.iter().any(|w| w.contains("text on a path")), "{warnings:?}"); + let (_, w) = Written::of(&doc); + let r = w.record("alpha path"); + assert_eq!(ty(r), "TEXT_PATH"); + assert_eq!(start_of(r), (0.5, true)); + assert_eq!(r.get("textAlignVertical").and_then(Kv::str), Some("TOP")); + let normalized = r.get("vectorData").unwrap().get("normalizedSize").unwrap(); + let size = r.get("size").unwrap(); + for k in ["x", "y"] { + assert_eq!(normalized.get(k).and_then(Kv::f64), size.get(k).and_then(Kv::f64)); + } + assert_eq!((size.get("x").and_then(Kv::f64), size.get("y").and_then(Kv::f64)), (Some(100.0), Some(0.0))); + let net = w.network(r); + assert_eq!(net.vertices.iter().map(|v| (v.x, v.y)).collect::>(), [(0.0, 0.0), (100.0, 0.0)]); + assert_eq!(net.segments.len(), 1); + assert_eq!((net.segments[0].style, net.segments[0].ta, net.segments[0].tb), (MARK, (0.0, 0.0), (0.0, 0.0))); + assert!(net.regions.is_empty()); + let (back, import_warnings) = super::import(&bytes, "Back").unwrap(); + no_text_path_warning(&import_warnings); + let td = text_of(&back, "alpha path"); + assert_eq!(td.path.as_deref(), Some(&TextPath { d: "M0,0 L100,0".into(), start: 0.5, flip: false })); + assert_eq!(td.characters, "alpha"); + assert_eq!((td.runs.len(), td.runs[0].start, td.runs[0].end), (1, 3, 5)); +} + +#[test] +fn the_start_is_written_by_length_from_either_side() { + const CURVE: &str = "M0,82.5 C70,-27.5 230,-27.5 300,82.5 C370,192.5 530,192.5 600,82.5"; + let mut doc = doc_of(&[ + ("far", "alpha", CURVE, 0.7490379757, false, 600.0, 165.0), + ("near", "alpha", CURVE, 0.004744078, false, 600.0, 165.0), + ("flipped", "alpha", "M0,0 L600,0", 0.16013986, true, 600.0, 0.0), + ]); + let page = doc.first_page().unwrap(); + doc.create(page, NodeKind::Text(Default::default()), "plain", 0.0, 0.0, 50.0, 20.0).unwrap(); + let (bytes, w) = Written::of(&doc); + let marked = |name: &str| -> (usize, f64, bool) { + let r = w.record(name); + let net = w.network(r); + let at: Vec = net.segments.iter().enumerate().filter(|(_, s)| s.style == MARK).map(|(i, _)| i).collect(); + assert_eq!(at.len(), 1, "{name}"); + let (t, forward) = start_of(r); + (at[0], t, forward) + }; + let (i, t, forward) = marked("far"); + assert_eq!((i, forward), (1, true)); + assert!((t - 0.49800667).abs() < 1e-5, "{t}"); + let (i, t, forward) = marked("near"); + assert_eq!((i, forward), (0, true)); + assert!((t - 0.0086954795).abs() < 1e-5, "{t}"); + assert!((t - 0.009488156).abs() > 5e-4, "{t}"); + let (i, t, forward) = marked("flipped"); + assert_eq!((i, forward), (0, false)); + assert!((t - 0.83986014).abs() < 1e-6, "{t}"); + let plain = w.record("plain"); + assert_eq!(ty(plain), "TEXT"); + assert!(plain.get("textPathStart").is_none() && plain.get("vectorData").is_none()); + let (back, _) = super::import(&bytes, "Back").unwrap(); + for (name, d, start, flip) in + [("far", CURVE, 0.7490379757, false), ("near", CURVE, 0.004744078, false), ("flipped", "M0,0 L600,0", 0.16013986, true)] + { + let path = text_of(&back, name).path.as_deref().unwrap_or_else(|| panic!("{name} lost its path")); + same_path(&path.d, d); + assert!((path.start - start).abs() < 1e-6, "{name}: {}", path.start); + assert_eq!(path.flip, flip, "{name}"); + } +} + +#[test] +fn a_closed_path_is_written_as_a_cycle() { + let doc = doc_of(&[("square", "alpha", "M0,0 L100,0 L100,100 L0,100 Z", 0.3, false, 100.0, 100.0)]); + let (bytes, w) = Written::of(&doc); + let r = w.record("square"); + let net = w.network(r); + assert_eq!((net.vertices.len(), net.segments.len()), (4, 4)); + assert_eq!(net.segments.iter().map(|s| (s.a, s.b)).collect::>(), [(0, 1), (1, 2), (2, 3), (3, 0)]); + assert_eq!(net.segments.iter().map(|s| s.style).collect::>(), [0, MARK, 0, 0]); + assert!((start_of(r).0 - 0.2).abs() < 1e-6); + let come_back = |bytes: &[u8]| { + let (back, warnings) = super::import(bytes, "Back").unwrap(); + no_text_path_warning(&warnings); + text_of(&back, "square").path.as_deref().unwrap().clone() + }; + let once = come_back(&bytes); + same_path(&once.d, "M100,0 L100,100 L0,100 L0,0 L100,0 Z"); + assert!((once.start - 0.05).abs() < 1e-6, "{}", once.start); + let (back, _) = super::import(&bytes, "Back").unwrap(); + let (again, _) = super::export(&back, None).unwrap(); + let twice = come_back(&again); + same_path(&twice.d, &once.d); + assert!((twice.start - once.start).abs() < 1e-6); + + let open_end = doc_of(&[("tri", "alpha", "M0,0 L100,0 L100,100 L0,0", 0.5, false, 100.0, 100.0)]); + let (_, w) = Written::of(&open_end); + let net = w.network(w.record("tri")); + assert_eq!(net.vertices.len(), 3); + assert_eq!(net.segments.iter().map(|s| (s.a, s.b)).collect::>(), [(0, 1), (1, 2), (2, 0)]); +} + +#[test] +fn paths_the_format_cant_hold_fall_back_with_their_own_warning() { + let plain = |doc: &Document, warning: &str| { + let (bytes, w) = Written::of(doc); + assert!(w.warned(warning), "{:?}", w.warnings); + let r = w.record("t"); + assert_eq!(ty(r), "TEXT"); + assert!(r.get("textPathStart").is_none() && r.get("vectorData").is_none()); + let (back, warnings) = super::import(&bytes, "Back").unwrap(); + assert!(text_of(&back, "t").path.is_none()); + assert!(!warnings.iter().any(|x| x.contains("text path")), "{warnings:?}"); + }; + plain(&doc_of(&[("t", "al\npha", "M0,0 L100,0", 0.5, false, 100.0, 0.0)]), W1); + plain(&doc_of(&[("t", "alpha", "M0,5 L100,5", 0.5, false, 100.0, 0.0)]), W2); + let mut empty = doc_of(&[("t", "alpha", "", 0.5, false, 100.0, 20.0)]); + let id = empty.nodes().find(|n| n.name == "t").unwrap().id; + empty.node_mut(id).unwrap().kind.text_mut().unwrap().path = Some(Box::new(TextPath { d: String::new(), start: 0.5, flip: false })); + plain(&empty, W2); + + // Vertical alignment: written as top, still on its path. + let mut middle = doc_of(&[("t", "alpha", "M0,0 L100,0", 0.5, false, 100.0, 0.0)]); + let id = middle.nodes().find(|n| n.name == "t").unwrap().id; + middle.node_mut(id).unwrap().kind.text_mut().unwrap().align_v = TextAlignV::Middle; + let (bytes, w) = Written::of(&middle); + assert!(!w.warnings.iter().any(|x| x.contains("text on a path")), "{:?}", w.warnings); + assert_eq!(w.record("t").get("textAlignVertical").and_then(Kv::str), Some("TOP")); + let (back, _) = super::import(&bytes, "Back").unwrap(); + assert!(text_of(&back, "t").path.is_some()); + + // Several parts: the first. + let (bytes, w) = Written::of(&doc_of(&[("t", "alpha", "M0,0 L100,0 M0,50 L100,50", 0.5, false, 100.0, 50.0)])); + assert!(w.warned(W3), "{:?}", w.warnings); + let (back, _) = super::import(&bytes, "Back").unwrap(); + let path = text_of(&back, "t").path.as_deref().unwrap(); + same_path(&path.d, "M0,0 L100,0"); + assert!((path.start - 0.5).abs() < 1e-6); + + // A zero-length segment is dropped. + let (bytes, w) = Written::of(&doc_of(&[("t", "alpha", "M0,0 L0,0 L100,0", 0.5, false, 100.0, 0.0)])); + assert!(!w.warnings.iter().any(|x| x.contains("text on a path")), "{:?}", w.warnings); + let (back, _) = super::import(&bytes, "Back").unwrap(); + same_path(&text_of(&back, "t").path.as_deref().unwrap().d, "M0,0 L100,0"); + + // A closed path of one segment. + let (bytes, w) = Written::of(&doc_of(&[("t", "alpha", "M0,0 C100,-100 -100,-100 0,0 Z", 0.5, false, 100.0, 100.0)])); + assert!(!w.warnings.iter().any(|x| x.contains("text on a path")), "{:?}", w.warnings); + let (back, _) = super::import(&bytes, "Back").unwrap(); + let els = elements(&text_of(&back, "t").path.as_deref().unwrap().d); + assert_eq!(els.first().map(|e| e.1[0]), Some((0.0, 0.0))); + let last = els.iter().rev().find(|e| e.0 != 'Z').unwrap(); + assert_eq!(last.1.last().copied(), Some((0.0, 0.0))); +} + +#[test] +fn an_instance_layer_on_a_path_survives_a_fig_export() { + let (doc, _) = super::import(&canvas_of(scaled_instance_message()), "Scaled path").unwrap(); + let (bytes, warnings) = super::export(&doc, None).unwrap(); + assert!(!warnings.iter().any(|w| w.contains("text on a path")), "{warnings:?}"); + let (back, _) = super::import(&bytes, "Back").unwrap(); + let path_of = |doc: &Document, parent: &str| { + let parent = doc.nodes().find(|n| n.name == parent).unwrap(); + let node = doc.node(parent.children[0]).unwrap(); + let NodeKind::Text(text) = &node.kind else { panic!("expected text") }; + text.path.as_deref().map(|p| p.d.clone()) + }; + assert_eq!(path_of(&back, "Main").as_deref(), Some("M0,0 L100,0")); + assert_eq!(path_of(&back, "Half").as_deref(), Some("M0,0 L50,0")); + + // A layer in an instance that isn't on a path where its main's layer is. + let mut cleared = doc; + let half: NodeId = cleared.nodes().find(|n| n.name == "Half").unwrap().children[0]; + cleared.node_mut(half).unwrap().kind.text_mut().unwrap().path = None; + let (_, w) = Written::of(&cleared); + assert!(w.warned(W4), "{:?}", w.warnings); +} + +#[test] +fn the_schema_numbers_text_on_a_path() { + let s = super::kiwi::Schema::parse(super::export::SCHEMA).unwrap(); + let def = |n: &str| s.defs.iter().find(|d| d.name == n).unwrap(); + assert_eq!(def("NodeType").fields.iter().find(|x| x.name == "TEXT_PATH").map(|x| x.value), Some(41)); + assert_eq!(def("NodeChange").fields.iter().find(|x| x.name == "textPathStart").map(|x| x.value), Some(432)); + let start = def("TextPathStart"); + assert!(matches!(start.kind, super::kiwi::Kind::Message)); + let fields: Vec<_> = start.fields.iter().map(|x| (x.name.as_str(), x.value)).collect(); + assert_eq!(fields, [("tValue", 1), ("forward", 2)]); +} diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 2d62d68d5..e14e05eae 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-11-12 · **Change:** minor (`.fig` export writes list spacing, hanging punctuation and lists, and vertical trim (#2305); `.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (`.fig` export writes text on a path (#2323); `.fig` export writes list spacing, hanging punctuation and lists, and vertical trim (#2305); `.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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 @@ -94,7 +94,7 @@ scales and empty-style clears; they have not been checked in other software. - **Written:** pages (name, background); frames, groups, sections, rectangles (as rounded rectangles, with their four radii), ellipses (arcs), polygons, stars, lines, vectors (editable network blobs with per-point corner radius, handle mirroring, caps and joins, plus the outline of - their filled areas), text, boolean groups, slices; the fill outline of frames and shapes and the + their filled areas), text, text on a path (the first part of its path, where the text starts and its side), boolean groups, slices; the fill outline of frames and shapes and the stroke outline of plain strokes (a ring around boxes and whole ellipses, the widened path of other centred strokes); solid, gradient (handles as the paint transform) and image paints (the image bytes, named by their SHA-1, scale mode, @@ -141,7 +141,7 @@ scales and empty-style clears; they have not been checked in other software. with the width on both sides when the shape has a fill too), pattern fills, WebP export settings (written as PNG), image adjustments, glass settings other than frost, springs other than Gentle (written as ease out), set-variable, set-variable-mode and conditional actions, scroll-to offsets, text decoration - looks, variable font axes, text on a path, nested list levels, OpenType features, per-layer operations inside boolean groups, different stroke ends + looks, variable font axes, text on a path with more than one line or on a path the format can't hold (written as plain text), the parts of a text's path after the first, text on a path in an instance but not in its main or the other way round (written as the main has it), nested list levels, OpenType features, per-layer operations inside boolean groups, different stroke ends on lines, the Dash cap (no public name for it). Not written at all: stroke outlines of dashed and per-side strokes and of inside or outside strokes on polygons, stars and vectors, glyph outlines of text (a reader lays text out with its own fonts), version history and branches. @@ -195,6 +195,7 @@ scales and empty-style clears; they have not been checked in other software. | Date | Change | Summary | |---|---|---| +| 2026-11-12 | minor | M6, #2323: the `.fig` export writes text on a path as the format's own layer kind (`TEXT_PATH`): the first part of its path as a vector network of one open or closed chain with the segment the text starts on marked, the start as that segment's own parameter (`textPathStart.tValue`, found by inverse arc length) and the side as `forward`. Vertical alignment is written as top, which is how text on a path draws. The importer already read all of it; a closed path comes back starting at the marked segment, the same curve and start point. Text with more than one line and paths the format can't hold stay plain text, the parts of a path after the first are left out, and text on a path in an instance but not in its main component (or the other way round) is written as the main has it, each with its own warning. The field numbers come from the schema of a synthetic file saved from Figma's web app. Checked through the importer only, not in other software | | 2026-11-12 | minor | M6, #2305: the `.fig` export writes a text's list spacing (`listSpacing`), hanging punctuation (`hangingPunctuation`), hanging lists (`hangingList`) and vertical trim (`leadingTrim`: none or cap height), which the importer already read. A field is written only when it differs from its default (in a design file saved by Figma, a text at the defaults carries none of the four), and an instance override that goes back to the default clears it. The warning narrows to OpenType features, which the importer does not read from a `.fig`. Checked through the importer only, not in other software. | | 2026-11-10 | minor | M4, #2222: a boolean group's corner radius and smoothing are read and written by the `.fig` importer and exporter, and by the REST importer | | 2026-11-07 | patch | Fonts, #2092: a font loaded with `text.loadFont` is the counterpart of a font uploaded to the organization, which Figma's help center ("Manage conflicting fonts") ranks first, ahead of installed fonts and the web fonts. FigCraft chose the first face added for a family and style, so the built-in Inter 4.x kept Regular, SemiBold and Bold after Inter 3.19 was loaded and only Medium refitted. A loaded face now wins over the other faces of its family and style, the latest load over earlier ones; style matching and fallbacks are unchanged, and `refitted` lists the text whose size changes. Installed versus built-in order is not changed here. Test: `fontdb::tests::a_loaded_face_wins_over_the_built_in_one_of_its_family_and_style`. Numbers unchanged. | From a7a9e627215c5185c1e26e63c955c09014a576a1 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Fri, 13 Nov 2026 00:00:02 -0500 Subject: [PATCH 222/239] M8: Tidy up takes a row whose layers overlap in a chain, and raises a negative gap so no layer reaches the one two before it, as in Figma Measured in Figma's web app on 2026-11-13. Co-Authored-By below. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 measured and wrote at medium --- crates/engine/src/selection/tidy.rs | 46 ++++++++++++++++++------ crates/engine/src/tidy_tests.rs | 54 +++++++++++++++++++++++++++++ crates/ui-egui/locales/en.toml | 2 +- crates/ui-egui/src/panels/right.rs | 6 ++-- crates/ui-egui/src/tidy_tests.rs | 2 +- docs/ui-parity.md | 4 +-- 6 files changed, 98 insertions(+), 16 deletions(-) diff --git a/crates/engine/src/selection/tidy.rs b/crates/engine/src/selection/tidy.rs index 2450c0dcb..e5b9ada25 100644 --- a/crates/engine/src/selection/tidy.rs +++ b/crates/engine/src/selection/tidy.rs @@ -5,7 +5,7 @@ //! and keeps the first layer where it is. Rows are the groups of layers whose Y ranges overlap //! (transitively), columns the groups whose X ranges overlap. A row is one row group of layers //! side by side: its horizontal gaps are evened and every Y kept; a column is the mirror image. -//! Layers of a row may overlap along X: a negative gap counts in the mean. The one gap is the most +//! Layers of a row may overlap along X, also in a chain: a negative gap counts in the mean. The one gap is the most //! common existing gap (the smaller of two equally common ones), else the mean rounded to a whole //! number, half up. A grid (two or more rows and two or more columns, one layer in every cell) is //! packed along the axis that has more groups: for 2 rows by 3 columns each column is as wide as @@ -89,19 +89,25 @@ fn classify(items: &[Item]) -> Option { let cols = groups(items, false); let rows = groups(items, true); match (cols.len(), rows.len()) { - (c, 1) if c >= 2 && cols.iter().all(|g| overlapping(g)) => Some(Shape::Line { vertical: false }), - (1, r) if r >= 2 && rows.iter().all(|g| overlapping(g)) => Some(Shape::Line { vertical: true }), + (c, 1) if c >= 2 && cols.iter().all(|g| overlapping(g, false)) => Some(Shape::Line { vertical: false }), + (1, r) if r >= 2 && rows.iter().all(|g| overlapping(g, true)) => Some(Shape::Line { vertical: true }), (c, r) if c >= 2 && r >= 2 && one_per_cell(&cols, &rows) => Some(Shape::Grid { vertical: r > c }), _ => None, } } -/// Layers that share a group along a row's or column's own axis must overlap each other (50 px -/// squares at X 0, 60, 105, 170: the middle two do), not merely sit in the same band: a header -/// above two layers side by side is irregular. -fn overlapping(group: &[Item]) -> bool { - let both = |a: Rect, b: Rect| a.x1.min(b.x1) - a.x0.max(b.x0) > EPS && a.y1.min(b.y1) - a.y0.max(b.y0) > EPS; - group.iter().enumerate().all(|(i, a)| group.iter().skip(i + 1).all(|b| both(a.1, b.1))) +/// Layers that share a group along a row's (`vertical` false) or column's own axis must overlap +/// each other pairwise on the OTHER axis, not merely sit in the same band: a header above two +/// layers side by side is irregular (a row's column group of the header and one of the pair has Y +/// ranges that don't overlap for the pair). The own axis is already covered by `groups`, which +/// chains transitively, so 50 px squares at X 0, 40, 80, 150 are a row although the first and +/// third don't touch. +fn overlapping(group: &[Item], vertical: bool) -> bool { + let across = |a: Rect, b: Rect| { + let (a, b) = (span(a, !vertical), span(b, !vertical)); + a.1.min(b.1) - a.0.max(b.0) > EPS + }; + group.iter().enumerate().all(|(i, a)| group.iter().skip(i + 1).all(|b| across(a.1, b.1))) } fn span(b: Rect, vertical: bool) -> (f64, f64) { @@ -154,6 +160,22 @@ fn even_gap(gaps: &[f64], spacing: Option) -> f64 { } } +/// The even gap of a line of three or more layers, from its derived gap `gap`: raised so that +/// every layer starts strictly after the end of the layer two places before it. With one gap `g`, +/// layer `i + 2` starts at `end(i) + w(i + 1) + 2g`, so `g > -w(i + 1) / 2` for every interior +/// layer, in whole pixels `floor(-w_min / 2) + 1` for the narrowest interior size `w_min`. Measured +/// in Figma's web app on 2026-11-13: interior widths of 10, 20 and 30 among 100s gave -4, -9 and +/// -14, and widths of 100 left the most common gap, -40, alone. Only those three widths were +/// measured; other widths follow the same formula. +fn raise_negative_gap(gap: f64, widths: &[f64]) -> f64 { + let interior = widths.get(1..widths.len().saturating_sub(1)).unwrap_or(&[]); + let w_min = interior.iter().copied().fold(f64::INFINITY, f64::min); + if widths.len() < 3 || !w_min.is_finite() { + return gap; + } + gap.max((-w_min / 2.0).floor() + 1.0) +} + /// A row (`vertical` false) or a column: the first layer stays, each next one follows the last at /// the even gap, the other axis is untouched. fn line_moves(items: &[Item], vertical: bool, spacing: Option) -> Vec { @@ -166,7 +188,11 @@ fn line_moves(items: &[Item], vertical: bool, spacing: Option) -> Vec _ => None, }) .collect(); - let gap = even_gap(&gaps, spacing); + let widths: Vec = line.iter().map(|i| span(i.1, vertical).1 - span(i.1, vertical).0).collect(); + let gap = match spacing { + Some(s) => s, + None => raise_negative_gap(even_gap(&gaps, None), &widths), + }; let mut pos = line.first().map_or(0.0, |i| span(i.1, vertical).0); let mut out = Vec::with_capacity(line.len()); for (id, b) in line { diff --git a/crates/engine/src/tidy_tests.rs b/crates/engine/src/tidy_tests.rs index 79a349f61..69c52e310 100644 --- a/crates/engine/src/tidy_tests.rs +++ b/crates/engine/src/tidy_tests.rs @@ -304,3 +304,57 @@ fn a_rotated_layer_is_tidied_by_its_box() { let after = figcraft_geom::rotation_degrees(s.doc().unwrap().node(m).unwrap().transform); assert!((rot - after).abs() < 1e-9, "rotation unchanged"); } + +/// Rectangles at Y 0, H 50 with the given (X, W) pairs. +fn bars(s: &mut Session, xw: &[(f64, f64)]) -> Vec { + xw.iter().map(|(x, w)| make(s, *x, 0.0, *w, 50.0)).collect() +} + +#[test] +fn a_row_whose_layers_overlap_in_a_chain_is_tidied_at_its_most_common_gap() { + // Measured in Figma's web app on 2026-11-13: gaps -10, -10, 20 give X 0, 40, 80, 120. + let mut s = Session::new(); + let ids = squares(&mut s, &[0., 40., 80., 150.]); + assert!(can(&s, &ids), "the first and third layers don't overlap, the chain still counts as a row"); + tidy(&mut s, &ids); + assert_eq!(xs_of(&s, &ids), vec![0., 40., 80., 120.]); +} + +#[test] +fn a_negative_gap_is_raised_so_no_layer_reaches_the_one_two_before() { + // Measured in Figma's web app on 2026-11-13, X before 0, 80, 200, 260, 400, 460. + let cases: [([f64; 6], [f64; 6]); 4] = [ + ([100., 10., 100., 100., 100., 100.], [0., 96., 102., 198., 294., 390.]), + ([100., 20., 100., 100., 100., 100.], [0., 91., 102., 193., 284., 375.]), + ([100., 30., 100., 100., 100., 100.], [0., 86., 102., 188., 274., 360.]), + ([100., 100., 100., 10., 100., 100.], [0., 96., 192., 288., 294., 390.]), + ]; + for (widths, want) in cases { + let mut s = Session::new(); + let xs = [0., 80., 200., 260., 400., 460.]; + let pairs: Vec<(f64, f64)> = xs.iter().copied().zip(widths).collect(); + let ids = bars(&mut s, &pairs); + tidy(&mut s, &ids); + assert_eq!(xs_of(&s, &ids), want.to_vec(), "widths {widths:?}"); + } +} + +#[test] +fn a_negative_gap_between_equal_widths_is_the_most_common_gap() { + let mut s = Session::new(); + let xs = [0., 80., 200., 260., 400., 460.]; + let pairs: Vec<(f64, f64)> = xs.iter().map(|x| (*x, 100.)).collect(); + let ids = bars(&mut s, &pairs); + tidy(&mut s, &ids); + assert_eq!(xs_of(&s, &ids), vec![0., 60., 120., 180., 240., 300.]); +} + +#[test] +fn an_explicit_spacing_is_not_raised() { + // Not measured in Figma: the Spacing field stays as typed. + let mut s = Session::new(); + let pairs: Vec<(f64, f64)> = [(0., 100.), (80., 10.), (200., 100.)].to_vec(); + let ids = bars(&mut s, &pairs); + s.execute("arrange.tidy", &json!({"ids": ids, "spacing": -40})).unwrap(); + assert_eq!(xs_of(&s, &ids), vec![0., 60., 30.]); +} diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index 91b215f21..ea99e26ab 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -1622,7 +1622,7 @@ name = "English" "This version can't be read." = "This version can't be read." "This version doesn't have it: all of it is new." = "This version doesn't have it: all of it is new." "Tidy up" = "Tidy up" -"Tidy up needs three or more layers that don't overlap" = "Tidy up needs three or more layers that don't overlap" +"Select a row, a column or a full grid of three or more layers, outside an auto layout flow" = "Select a row, a column or a full grid of three or more layers, outside an auto layout flow" "Tile" = "Tile" "Tile type" = "Tile type" "Timer" = "Timer" diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs index f054c5b78..b931d7e63 100644 --- a/crates/ui-egui/src/panels/right.rs +++ b/crates/ui-egui/src/panels/right.rs @@ -657,7 +657,8 @@ pub(crate) fn position_values(ctx: &egui::Context, doc: &Arc, sel: &[N }) } -/// Whether the Design panel offers Tidy up for `sel` (three or more layers that don't overlap). +/// Whether the Design panel offers Tidy up for `sel`: three or more layers forming a row, a column +/// or a full grid, none in an auto layout flow (`can_tidy`). pub(crate) fn tidy_available(ctx: &egui::Context, doc: &Arc, sel: &[NodeId]) -> bool { crate::selection_cache::cached(ctx, "tidy", doc, sel, &[], || figcraft_engine::tidy::can_tidy(doc, sel)) } @@ -711,7 +712,8 @@ fn align_row(app: &mut FigApp, ui: &mut Ui, sel: &[NodeId], can_align: bool, col ] { let item = ui.add_enabled_ui(on, |ui| menu_item(ui, l, crate::shortcuts::shortcut(c).unwrap_or(""))); if !on { - item.response.on_disabled_hover_text(tr("Tidy up needs three or more layers that don't overlap")); + item.response + .on_disabled_hover_text(tr("Select a row, a column or a full grid of three or more layers, outside an auto layout flow")); } if item.inner { app.run(c, json!({"ids": ids})); diff --git a/crates/ui-egui/src/tidy_tests.rs b/crates/ui-egui/src/tidy_tests.rs index 971b07dac..26d0d2146 100644 --- a/crates/ui-egui/src/tidy_tests.rs +++ b/crates/ui-egui/src/tidy_tests.rs @@ -1,5 +1,5 @@ //! The Design panel's Tidy up row follows the engine's rule (measured in Figma's web app on -//! 2026-11-12): offered for three or more layers that don't overlap, greyed out otherwise. +//! 2026-11-12): offered for three or more layers forming a row, a column or a full grid, greyed out otherwise. use egui::Context; use figcraft_doc::NodeId; diff --git a/docs/ui-parity.md b/docs/ui-parity.md index ee547a5b9..af1fdb89b 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -83,7 +83,7 @@ interaction feel only partly compared: the interactions measured so far, case by | Locked layers | done | selectable from the layers panel; no handles, not dragged with the rest of a selection | | Edit ▸ Set default properties: new layers take the selected layer's properties | done | from a shape (any layer but text): new rectangles, ellipses, polygons and stars drawn or clicked with their tools take its fills, strokes and their settings, effects, opacity, blend and corners; from a text layer: new text from the Text tool takes its fills and font (#2028). Silent in the help center on frames, lines and arrows: they keep their own look, as do layers made by commands; the defaults last for the session | | Smart selection spacing | partial | with layers in a row, a column or an aligned grid selected, the Layout section shows horizontal and vertical spacing ("Mixed" until set; typed, scrubbed, fractional and negative) and pink handles in the gaps on the canvas drag them, one undo step, Escape cancels (`arrange.spacing`; sizes, parents and offsets within each track kept; at most 2,000 layers; flow children, locked layers and layers inside instances left out). A ring at each layer's centre drags it to another place in a regular row, column or complete top-left-aligned grid: the others close up and make room around it with the gaps kept, and with Cmd/Ctrl held the two layers swap places instead, previewed live while dragging (`selection_reorder_tests`; no ring on a layer under 16 px on screen). Not covered: reordering irregular grids, and several marked layers moved together. Checked by its author on macOS and in the app on Windows (#402) | -| Tidy up | partial | measured in Figma's web app on 2026-11-12 (a row, a column, a 2 x 3 grid of unequal sizes and its transpose, and many runs on the gap, the unavailable cases among them): the order, the sizes and the other axis are kept and the first layer stays. A row (one group of layers whose Y ranges overlap, side by side) evens its horizontal gaps and a column its vertical gaps to one gap: the most common existing gap (the smaller of two equally common ones), else the mean rounded to a whole number, half up (30, 40, 30 gives 30; 80, 20, 45 gives 48; 10, 10, 50, 90 gives 10; 10, 25 gives 18; 10, 25, 30 gives 22). Layers of a row may overlap along X: the negative gap counts in the mean (50 px squares at X 0, 60, 105, 170, gaps 10, -5, 15, give X 0, 57, 114, 171). A grid (two or more rows and columns, one layer in every cell) is packed along the axis with more groups: a column is as wide as its widest layer around the middle of where its layers were, the first column stays, each layer is centred in its column to a whole pixel with Snap to pixel grid on, and every column is stacked from the selection's top; a grid with more rows than columns is the mirror image (centred rows, laid out left to right). The vertical gap reads 51 or 52 in Figma's own runs (mean 51.67), so FigCraft's positions along a stack can differ by a pixel there. Unavailable, as measured, for fewer than three layers, for layers that all overlap each other (one row and one column), for a diagonal and for an irregular layout: a greyed-out row with a tip in the Design panel's menu, the command moving nothing and adding no undo step. Not measured, FigCraft's choices: a 2 x 2 grid packed as columns; layers in an auto layout flow being unavailable (the frame places them; the measurement could not tell this from an irregular layout); the 2,000 layer cap; rotated layers counting by their box; gaps a pixel apart being different gaps; an explicit `spacing` setting the gap and taking two layers; no rounding with Snap to pixel grid off. Tests: tidy_tests | +| Tidy up | partial | measured in Figma's web app on 2026-11-12 (a row, a column, a 2 x 3 grid of unequal sizes and its transpose, and many runs on the gap, the unavailable cases among them): the order, the sizes and the other axis are kept and the first layer stays. A row (one group of layers whose Y ranges overlap, side by side) evens its horizontal gaps and a column its vertical gaps to one gap: the most common existing gap (the smaller of two equally common ones), else the mean rounded to a whole number, half up (30, 40, 30 gives 30; 80, 20, 45 gives 48; 10, 10, 50, 90 gives 10; 10, 25 gives 18; 10, 25, 30 gives 22). Layers of a row may overlap along X, and overlapping layers in a chain count as a row (the first and third needn't touch): the negative gap counts in the mean (50 px squares at X 0, 60, 105, 170, gaps 10, -5, 15, give X 0, 57, 114, 171; squares at X 0, 40, 80, 150 give 0, 40, 80, 120). Measured in Figma's web app on 2026-11-13: a negative gap is raised so no layer reaches the one two places before it, floor(-w / 2) + 1 for the narrowest interior layer's width w, so 10, 20 and 30 wide interior layers among 100s give -4, -9 and -14 (X 0, 96, 102, 198, 294, 390 for widths 100, 10, 100 x4), while six 100 wide layers keep the most common gap, -40; only those widths were measured, and an explicit `spacing` is not raised. A grid (two or more rows and columns, one layer in every cell) is packed along the axis with more groups: a column is as wide as its widest layer around the middle of where its layers were, the first column stays, each layer is centred in its column to a whole pixel with Snap to pixel grid on, and every column is stacked from the selection's top; a grid with more rows than columns is the mirror image (centred rows, laid out left to right). The vertical gap reads 51 or 52 in Figma's own runs (mean 51.67), so FigCraft's positions along a stack can differ by a pixel there. Unavailable, as measured, for fewer than three layers, for layers that all overlap each other (one row and one column), for a diagonal and for an irregular layout: a greyed-out row with a tip in the Design panel's menu, the command moving nothing and adding no undo step. Not measured, FigCraft's choices: a 2 x 2 grid packed as columns; layers in an auto layout flow being unavailable (the frame places them; the measurement could not tell this from an irregular layout); the 2,000 layer cap; rotated layers counting by their box; gaps a pixel apart being different gaps; an explicit `spacing` setting the gap and taking two layers; no rounding with Snap to pixel grid off. Tests: tidy_tests | | Selection colors | partial | the Design panel shows the section from two paint groups (paints sharing a style, a variable and a value count as one group), or from one when a selected layer has children (a frame, group, component or instance), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also offers enabled libraries' published color styles and Create style (`selection.createColorStyle`); no library variables and no new variable from a row (#403) | | Keyboard box selection | done | Alt+Space on macOS, Ctrl+Space on Windows and Linux, or F8 (`select.area`): a box around the selection or in the middle of the view; arrows move it, Cmd/Ctrl+arrows or Shift+arrows size it (Shift with Cmd/Ctrl: farther), Enter selects like a marquee (Shift+Enter toggles, Cmd/Ctrl+Enter nested), Escape closes; Tab while the box shows, or the chord again, switches to pick select: a pink outline on the first selected layer (the page's top layer with nothing selected), Tab and Shift+Tab move it between sibling layers in Layers order, Enter into a frame's top child, Shift+Enter out to the parent, Space selects it, Escape or a press on the canvas ends it; `ui.key` takes the same keys (#1836) | | Selection colors | partial | the Design panel shows the section from two paint groups (paints sharing a style, a variable and a value count as one group), or from one when a selected layer has children (a frame, group, component or instance; a layer without children shows it only with two paint groups, such as a red fill and a blue stroke; one paint group, however many layers share it, hides it), counting the selected layers' own fills and strokes and their descendants' (measured in Figma's web app, 2026-11-09, #2188, on frames, groups and rectangles only; the rule for components and instances is not measured), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also lists each enabled library's published color styles under the library's name (a library that can't be read offers none), and a linked row's menu switches it to another style; a library style is copied in, linked and read-only, in the same undo step (`selection.applyColorStyle` with `library`). Create style on an ordinary row asks for a name (the next free "Color n" first) and makes a style of the row's whole paint, gradients, opacity, blend mode and variables bound to gradient stops included, linked to every fill and stroke the row stands for in one undo step; a name in use keeps the window open (`selection.createColorStyle`). Text ranges with fills of their own take the style's value, without a link. No library variables from there, and no new variable from a row (#403) | @@ -216,7 +216,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| -| 2026-11-12 | minor | M8: Tidy up keeps the order and sizes and evens the gaps, as measured in Figma's web app on 2026-11-12. A row or column evens one gap (the most common one, the smaller of a tie, else the mean rounded half up) and keeps the other axis, layers of a row may overlap along X, and a grid is packed along the axis with more groups; fewer than three layers, layers that all overlap, a diagonal and an irregular layout grey the row out and move nothing. Measured: those rules and the unavailable cases; FigCraft's choices: a 2 x 2 grid as columns, auto layout flow children, the 2,000 layer cap, rotated layers by their box, `spacing` with two layers, and no rounding with pixel snapping off. Tests: tidy_tests (a_row_keeps_its_order_sizes_and_y_and_evens_the_gaps, gaps_that_all_differ_take_their_mean_taken_down, a_mean_is_rounded_half_up, two_equally_common_gaps_give_the_smaller, an_overlapping_pair_in_a_row_is_tidied_and_its_negative_gap_counts, a_grid_is_tidied_by_columns, a_transposed_grid_is_tidied_by_rows, layers_on_a_diagonal_are_unavailable, an_irregular_selection_is_unavailable and the rest). | +| 2026-11-12 | minor | M8: Tidy up keeps the order and sizes and evens the gaps, as measured in Figma's web app on 2026-11-12. A row or column evens one gap (the most common one, the smaller of a tie, else the mean rounded half up) and keeps the other axis, layers of a row may overlap along X (also in a chain, and a negative gap is raised so no layer reaches the one two before it, measured in Figma's web app on 2026-11-13), and a grid is packed along the axis with more groups; fewer than three layers, layers that all overlap, a diagonal and an irregular layout grey the row out and move nothing. Measured: those rules and the unavailable cases; FigCraft's choices: a 2 x 2 grid as columns, auto layout flow children, the 2,000 layer cap, rotated layers by their box, `spacing` with two layers, and no rounding with pixel snapping off. Tests: tidy_tests (a_row_keeps_its_order_sizes_and_y_and_evens_the_gaps, gaps_that_all_differ_take_their_mean_taken_down, a_mean_is_rounded_half_up, two_equally_common_gaps_give_the_smaller, an_overlapping_pair_in_a_row_is_tidied_and_its_negative_gap_counts, a_grid_is_tidied_by_columns, a_transposed_grid_is_tidied_by_rows, layers_on_a_diagonal_are_unavailable, an_irregular_selection_is_unavailable and the rest). | | 2026-11-12 | patch | M8: Tab while renaming the last layer in the Layers panel commits and opens the first row's rename, as measured in Figma's web app on 2026-11-12 (it ended the rename before); Shift+Tab on the first row is unchanged, not measured; Tab and Shift+Tab now move only the rename and leave the selection on the layer first renamed, as measured in Figma's web app on 2026-11-12 (it followed the rename before) (`tab_on_the_last_row_commits_and_wraps_to_the_first`, `tab_while_renaming_leaves_the_selection_on_the_first_layer`), Rename row | | 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start); FigCraft draws it opaque (how Figma treats a translucent fill was not measured); gradient, image and hidden fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | | 2026-11-10 | minor | The Rotation field shows and sets the layer's rotation on the page (its own angle plus its parents' when no ancestor is flipped; with a flipped ancestor FigCraft reads the composed angle, which flips the sign of the layer's own angle, and Figma's behaviour there was not measured), in frames and groups alike, as measured in Figma's web app for rotated, unflipped parents (#2196) | From a243f0b81dbc237abffd82c320b231dce1001db1 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Fri, 13 Nov 2026 00:11:55 -0500 Subject: [PATCH 223/239] M6: the .fig export keeps a text path's curves exact, and its instance test checks both ways round (#2323) A curve's control points are no longer rounded on their own before their offsets from the end points are taken, so a curve read from a file is written back with the offsets it had. The instance test now reads both cases of the instance warning back. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 reviewed; Sonnet 5.5 wrote at medium --- crates/format/src/fig/export/shape.rs | 4 +- crates/format/src/fig/text_path_tests.rs | 76 ++++++++++++++++++++++-- 2 files changed, 74 insertions(+), 6 deletions(-) diff --git a/crates/format/src/fig/export/shape.rs b/crates/format/src/fig/export/shape.rs index f298e663f..6b70b6c62 100644 --- a/crates/format/src/fig/export/shape.rs +++ b/crates/format/src/fig/export/shape.rs @@ -480,7 +480,9 @@ fn path_chain(part: &[figcraft_doc::geom::kurbo::PathEl]) -> Option<(network::Ne } PathEl::CurveTo(a, b, p) => { cur = rp(*p); - add(&mut net, Some(rp(*a)), Some(rp(*b)), cur); + // The control points are not rounded on their own: the format holds each as its offset from the end + // point, and taken from the point as read that is the offset the file had. + add(&mut net, Some((finite(a.x), finite(a.y))), Some((finite(b.x), finite(b.y))), cur); } PathEl::ClosePath => closed = true, } diff --git a/crates/format/src/fig/text_path_tests.rs b/crates/format/src/fig/text_path_tests.rs index 0e9d0e0e8..154b9015d 100644 --- a/crates/format/src/fig/text_path_tests.rs +++ b/crates/format/src/fig/text_path_tests.rs @@ -545,12 +545,24 @@ fn an_instance_layer_on_a_path_survives_a_fig_export() { assert_eq!(path_of(&back, "Main").as_deref(), Some("M0,0 L100,0")); assert_eq!(path_of(&back, "Half").as_deref(), Some("M0,0 L50,0")); - // A layer in an instance that isn't on a path where its main's layer is. - let mut cleared = doc; - let half: NodeId = cleared.nodes().find(|n| n.name == "Half").unwrap().children[0]; - cleared.node_mut(half).unwrap().kind.text_mut().unwrap().path = None; - let (_, w) = Written::of(&cleared); + // A layer in an instance that isn't on a path where its main's layer is: it comes back on the main's path. + let off = |parent: &str| { + let mut doc = doc.clone(); + let id: NodeId = doc.nodes().find(|n| n.name == parent).unwrap().children[0]; + doc.node_mut(id).unwrap().kind.text_mut().unwrap().path = None; + doc + }; + let (bytes, w) = Written::of(&off("Half")); assert!(w.warned(W4), "{:?}", w.warnings); + let (back, _) = super::import(&bytes, "Back").unwrap(); + assert_eq!(path_of(&back, "Half").as_deref(), Some("M0,0 L50,0")); + + // The other way round: the main's layer is plain text, and so is the instance's. + let (bytes, w) = Written::of(&off("Main")); + assert!(w.warned(W4), "{:?}", w.warnings); + assert_eq!(ty(w.record("arc")), "TEXT"); + let (back, _) = super::import(&bytes, "Back").unwrap(); + assert_eq!((path_of(&back, "Main"), path_of(&back, "Half")), (None, None)); } #[test] @@ -564,3 +576,57 @@ fn the_schema_numbers_text_on_a_path() { let fields: Vec<_> = start.fields.iter().map(|x| (x.name.as_str(), x.value)).collect(); assert_eq!(fields, [("tValue", 1), ("forward", 2)]); } + +/// A text on a path of two curves whose coordinates 32-bit floats hold while their control points (a point plus its +/// tangent) need more digits, as the curves of a saved file do. +fn uneven_curve_canvas() -> Vec { + let mut blob = Vec::new(); + let u32le = |out: &mut Vec, n: u32| out.extend_from_slice(&n.to_le_bytes()); + let f32le = |out: &mut Vec, n: f32| out.extend_from_slice(&n.to_le_bytes()); + for n in [3, 2, 0] { + u32le(&mut blob, n); + } + for (x, y) in [(0.1, 82.3), (300.7, 82.9), (600.3, 81.7)] { + u32le(&mut blob, 0); + f32le(&mut blob, x); + f32le(&mut blob, y); + } + for (style, a, ta, b, tb) in [(0, 0, (70.7, -110.3), 1, (-70.9, -110.1)), (MARK, 1, (70.3, 110.7), 2, (-70.1, 110.9))] { + u32le(&mut blob, style); + u32le(&mut blob, a); + f32le(&mut blob, ta.0); + f32le(&mut blob, ta.1); + u32le(&mut blob, b); + f32le(&mut blob, tb.0); + f32le(&mut blob, tb.1); + } + let identity = o(vec![("m00", f(1.0)), ("m01", f(0.0)), ("m02", f(0.0)), ("m10", f(0.0)), ("m11", f(1.0)), ("m12", f(0.0))]); + let text = node( + 2, + Some(1), + "TEXT_PATH", + vec![ + ("name", s("curve")), + ("size", point(600.5, 221.25)), + ("transform", identity), + ("textData", o(vec![("characters", s("alpha"))])), + ("fontSize", f(24.0)), + ("fontName", o(vec![("family", s("Inter")), ("style", s("Regular"))])), + ("textPathStart", o(vec![("tValue", f(0.4)), ("forward", Kv::Bool(true))])), + ("vectorData", o(vec![("vectorNetworkBlob", u(0)), ("normalizedSize", point(600.5, 221.25))])), + ], + ); + let nodes = vec![node(0, None, "DOCUMENT", vec![]), node(1, Some(0), "CANVAS", vec![]), text]; + canvas_of(o(vec![("nodeChanges", a(nodes)), ("blobs", a(vec![o(vec![("bytes", Kv::Bytes(blob))])]))])) +} + +#[test] +fn a_curve_read_from_a_file_is_written_back_as_it_was() { + let (doc, _) = super::import(&uneven_curve_canvas(), "Curve").unwrap(); + let read = text_of(&doc, "curve").path.as_deref().unwrap().clone(); + let (bytes, _) = super::export(&doc, None).unwrap(); + let (back, warnings) = super::import(&bytes, "Back").unwrap(); + no_text_path_warning(&warnings); + // The file holds a control point as its offset from the end point: taken from the point as read, it is the same offset. + assert_eq!(text_of(&back, "curve").path.as_deref(), Some(&read)); +} From fc90078333c77f85af38513734efcf9ffb38903f Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Fri, 13 Nov 2026 00:36:40 -0500 Subject: [PATCH 224/239] Docs: Tidy up keeps the first layer and the other axis for a row or a column, not a grid The row's opening said the first layer and the other axis are always kept, but a grid centres each layer in its column and can move it on both axes. The claim is now limited to rows and columns; the order and sizes are kept for all three. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- docs/ui-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index af1fdb89b..77686fb2b 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -83,7 +83,7 @@ interaction feel only partly compared: the interactions measured so far, case by | Locked layers | done | selectable from the layers panel; no handles, not dragged with the rest of a selection | | Edit ▸ Set default properties: new layers take the selected layer's properties | done | from a shape (any layer but text): new rectangles, ellipses, polygons and stars drawn or clicked with their tools take its fills, strokes and their settings, effects, opacity, blend and corners; from a text layer: new text from the Text tool takes its fills and font (#2028). Silent in the help center on frames, lines and arrows: they keep their own look, as do layers made by commands; the defaults last for the session | | Smart selection spacing | partial | with layers in a row, a column or an aligned grid selected, the Layout section shows horizontal and vertical spacing ("Mixed" until set; typed, scrubbed, fractional and negative) and pink handles in the gaps on the canvas drag them, one undo step, Escape cancels (`arrange.spacing`; sizes, parents and offsets within each track kept; at most 2,000 layers; flow children, locked layers and layers inside instances left out). A ring at each layer's centre drags it to another place in a regular row, column or complete top-left-aligned grid: the others close up and make room around it with the gaps kept, and with Cmd/Ctrl held the two layers swap places instead, previewed live while dragging (`selection_reorder_tests`; no ring on a layer under 16 px on screen). Not covered: reordering irregular grids, and several marked layers moved together. Checked by its author on macOS and in the app on Windows (#402) | -| Tidy up | partial | measured in Figma's web app on 2026-11-12 (a row, a column, a 2 x 3 grid of unequal sizes and its transpose, and many runs on the gap, the unavailable cases among them): the order, the sizes and the other axis are kept and the first layer stays. A row (one group of layers whose Y ranges overlap, side by side) evens its horizontal gaps and a column its vertical gaps to one gap: the most common existing gap (the smaller of two equally common ones), else the mean rounded to a whole number, half up (30, 40, 30 gives 30; 80, 20, 45 gives 48; 10, 10, 50, 90 gives 10; 10, 25 gives 18; 10, 25, 30 gives 22). Layers of a row may overlap along X, and overlapping layers in a chain count as a row (the first and third needn't touch): the negative gap counts in the mean (50 px squares at X 0, 60, 105, 170, gaps 10, -5, 15, give X 0, 57, 114, 171; squares at X 0, 40, 80, 150 give 0, 40, 80, 120). Measured in Figma's web app on 2026-11-13: a negative gap is raised so no layer reaches the one two places before it, floor(-w / 2) + 1 for the narrowest interior layer's width w, so 10, 20 and 30 wide interior layers among 100s give -4, -9 and -14 (X 0, 96, 102, 198, 294, 390 for widths 100, 10, 100 x4), while six 100 wide layers keep the most common gap, -40; only those widths were measured, and an explicit `spacing` is not raised. A grid (two or more rows and columns, one layer in every cell) is packed along the axis with more groups: a column is as wide as its widest layer around the middle of where its layers were, the first column stays, each layer is centred in its column to a whole pixel with Snap to pixel grid on, and every column is stacked from the selection's top; a grid with more rows than columns is the mirror image (centred rows, laid out left to right). The vertical gap reads 51 or 52 in Figma's own runs (mean 51.67), so FigCraft's positions along a stack can differ by a pixel there. Unavailable, as measured, for fewer than three layers, for layers that all overlap each other (one row and one column), for a diagonal and for an irregular layout: a greyed-out row with a tip in the Design panel's menu, the command moving nothing and adding no undo step. Not measured, FigCraft's choices: a 2 x 2 grid packed as columns; layers in an auto layout flow being unavailable (the frame places them; the measurement could not tell this from an irregular layout); the 2,000 layer cap; rotated layers counting by their box; gaps a pixel apart being different gaps; an explicit `spacing` setting the gap and taking two layers; no rounding with Snap to pixel grid off. Tests: tidy_tests | +| Tidy up | partial | measured in Figma's web app on 2026-11-12 (a row, a column, a 2 x 3 grid of unequal sizes and its transpose, and many runs on the gap, the unavailable cases among them): the order and the sizes are kept; in a row or a column the first layer also stays and the other axis is untouched (a grid can move a layer on both axes, as below). A row (one group of layers whose Y ranges overlap, side by side) evens its horizontal gaps and a column its vertical gaps to one gap: the most common existing gap (the smaller of two equally common ones), else the mean rounded to a whole number, half up (30, 40, 30 gives 30; 80, 20, 45 gives 48; 10, 10, 50, 90 gives 10; 10, 25 gives 18; 10, 25, 30 gives 22). Layers of a row may overlap along X, and overlapping layers in a chain count as a row (the first and third needn't touch): the negative gap counts in the mean (50 px squares at X 0, 60, 105, 170, gaps 10, -5, 15, give X 0, 57, 114, 171; squares at X 0, 40, 80, 150 give 0, 40, 80, 120). Measured in Figma's web app on 2026-11-13: a negative gap is raised so no layer reaches the one two places before it, floor(-w / 2) + 1 for the narrowest interior layer's width w, so 10, 20 and 30 wide interior layers among 100s give -4, -9 and -14 (X 0, 96, 102, 198, 294, 390 for widths 100, 10, 100 x4), while six layers 100 wide keep the most common gap, -40; only those widths were measured, and an explicit `spacing` is not raised. A grid (two or more rows and columns, one layer in every cell) is packed along the axis with more groups: a column is as wide as its widest layer around the middle of where its layers were, the first column stays, each layer is centred in its column to a whole pixel with Snap to pixel grid on, and every column is stacked from the selection's top; a grid with more rows than columns is the mirror image (centred rows, laid out left to right). The vertical gap reads 51 or 52 in Figma's own runs (mean 51.67), so FigCraft's positions along a stack can differ by a pixel there. Unavailable, as measured, for fewer than three layers, for layers that all overlap each other (one row and one column), for a diagonal and for an irregular layout: a greyed-out row with a tip in the Design panel's menu, the command moving nothing and adding no undo step. Not measured, FigCraft's choices: a 2 x 2 grid packed as columns; layers in an auto layout flow being unavailable (the frame places them; the measurement could not tell this from an irregular layout); the 2,000 layer cap; rotated layers counting by their box; gaps a pixel apart being different gaps; an explicit `spacing` setting the gap and taking two layers; no rounding with Snap to pixel grid off. Tests: tidy_tests | | Selection colors | partial | the Design panel shows the section from two paint groups (paints sharing a style, a variable and a value count as one group), or from one when a selected layer has children (a frame, group, component or instance), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also offers enabled libraries' published color styles and Create style (`selection.createColorStyle`); no library variables and no new variable from a row (#403) | | Keyboard box selection | done | Alt+Space on macOS, Ctrl+Space on Windows and Linux, or F8 (`select.area`): a box around the selection or in the middle of the view; arrows move it, Cmd/Ctrl+arrows or Shift+arrows size it (Shift with Cmd/Ctrl: farther), Enter selects like a marquee (Shift+Enter toggles, Cmd/Ctrl+Enter nested), Escape closes; Tab while the box shows, or the chord again, switches to pick select: a pink outline on the first selected layer (the page's top layer with nothing selected), Tab and Shift+Tab move it between sibling layers in Layers order, Enter into a frame's top child, Shift+Enter out to the parent, Space selects it, Escape or a press on the canvas ends it; `ui.key` takes the same keys (#1836) | | Selection colors | partial | the Design panel shows the section from two paint groups (paints sharing a style, a variable and a value count as one group), or from one when a selected layer has children (a frame, group, component or instance; a layer without children shows it only with two paint groups, such as a red fill and a blue stroke; one paint group, however many layers share it, hides it), counting the selected layers' own fills and strokes and their descendants' (measured in Figma's web app, 2026-11-09, #2188, on frames, groups and rectangles only; the rule for components and instances is not measured), and lists their solid and gradient paints (children and text ranges included; hidden paints, masks, images, patterns and boolean operands left out; styles and variables listed apart): editing a colour changes every matching fill and stroke in one undo step, a row selects the layers that use it or applies a color style or color variable of the document, and a row linked to a style or variable detaches it, keeping the color (`selection.colors`, `selection.setPaint`, `selection.applyColorStyle`, `selection.bindColorVariable`, `selection.detachColor`, `selection.selectColor`). A row's Styles menu also lists each enabled library's published color styles under the library's name (a library that can't be read offers none), and a linked row's menu switches it to another style; a library style is copied in, linked and read-only, in the same undo step (`selection.applyColorStyle` with `library`). Create style on an ordinary row asks for a name (the next free "Color n" first) and makes a style of the row's whole paint, gradients, opacity, blend mode and variables bound to gradient stops included, linked to every fill and stroke the row stands for in one undo step; a name in use keeps the window open (`selection.createColorStyle`). Text ranges with fills of their own take the style's value, without a link. No library variables from there, and no new variable from a row (#403) | From e0e57dd42a65bc2d42874e3cb459075806225a08 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Fri, 13 Nov 2026 00:45:11 -0500 Subject: [PATCH 225/239] M12: a mind map in a section or frame without a place is centred on the view board.mindMap's default x and y came from the view's centre, which is on the page, but x and y are the root's place in its parent: under a section at (1000, 500) the map landed 1000 right and 500 down of the view's centre. The default now takes the centre through the parent's inverse world transform (a parent that can't be inverted gives a non-finite centre, which the coordinate check refuses). Explicit x and y stay parent-local. Tests: two in board_mindmap_tests (a section; a frame turned 30 degrees, with a given place carried through the frame). Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/board_mindmap_tests.rs | 38 +++++++++++++++++++++++ crates/engine/src/boards/board/mindmap.rs | 8 +++-- docs/mcp.md | 2 +- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/board_mindmap_tests.rs b/crates/engine/src/board_mindmap_tests.rs index 19bb459ae..fa717b8eb 100644 --- a/crates/engine/src/board_mindmap_tests.rs +++ b/crates/engine/src/board_mindmap_tests.rs @@ -383,3 +383,41 @@ fn the_caps_refuse_what_is_too_far_and_cut_what_is_too_long() { assert_eq!(text_data(&s, id(&out, "id")).characters.chars().count(), 500); assert_eq!(text_data(&s, id(&out["children"][0], "id")).characters.chars().count(), 500); } + +/// Where a node's own origin (the place `x`/`y` name) is on the page. +fn origin(s: &Session, n: NodeId) -> Point { + s.doc().unwrap().world_transform(n) * Point::new(0.0, 0.0) +} + +#[test] +fn a_mind_map_in_a_section_without_a_place_is_centred_on_the_view() { + let mut s = board(); + let (vx, vy) = { + let v = &s.ds().unwrap().view; + (v.cx, v.cy) + }; + let sec = id(&s.execute("node.create", &json!({"type": "section", "x": 1000, "y": 500, "width": 4000, "height": 4000})).unwrap(), "id"); + let out = s.execute("board.mindMap", &json!({"parent": sec})).unwrap(); + let c = origin(&s, id(&out, "id")); + assert!(same(c.x, vx) && same(c.y, vy), "the root's place {c:?} is the view's centre ({vx}, {vy})"); +} + +#[test] +fn a_mind_map_in_a_turned_frame_without_a_place_is_centred_on_the_view_and_a_given_place_is_the_frames() { + let mut s = board(); + let (vx, vy) = { + let v = &s.ds().unwrap().view; + (v.cx, v.cy) + }; + let fr = id(&s.execute("node.create", &json!({"type": "frame", "x": 300, "y": 200, "width": 2000, "height": 2000})).unwrap(), "id"); + s.execute("node.set", &json!({"id": fr, "props": {"rotation": 30}})).unwrap(); + let out = s.execute("board.mindMap", &json!({"parent": fr})).unwrap(); + let c = origin(&s, id(&out, "id")); + assert!(same(c.x, vx) && same(c.y, vy), "the root's place {c:?} is the view's centre ({vx}, {vy})"); + + // A given place is the frame's own, as on the page: (10, 20) of the frame, carried through it. + let given = id(&s.execute("board.mindMap", &json!({"parent": fr, "x": 10, "y": 20})).unwrap(), "id"); + let want = s.doc().unwrap().world_transform(fr) * Point::new(10.0, 20.0); + let got = origin(&s, given); + assert!(same(got.x, want.x) && same(got.y, want.y), "{got:?} against {want:?}"); +} diff --git a/crates/engine/src/boards/board/mindmap.rs b/crates/engine/src/boards/board/mindmap.rs index 5e2cff1ce..656a3fa14 100644 --- a/crates/engine/src/boards/board/mindmap.rs +++ b/crates/engine/src/boards/board/mindmap.rs @@ -168,9 +168,13 @@ pub(super) fn mind_map_cmd(s: &mut Session, p: &Value) -> Result { let cmd = "board.mindMap"; require(s, cmd)?; let parent = parent_of(cmd, s, p)?; + // The view's centre is on the page, and `x`/`y` are in the parent: a map in a section or frame + // takes the centre in that parent's coordinates (a parent that can't be inverted gives a + // non-finite centre, which `coord` refuses). let (vx, vy) = { - let v = &s.ds()?.view; - (v.cx, v.cy) + let ds = s.ds()?; + let c = ds.doc.world_transform(parent).inverse() * figcraft_geom::Point::new(ds.view.cx, ds.view.cy); + (c.x, c.y) }; let (x, y) = (coord(cmd, p, "x", vx)?, coord(cmd, p, "y", vy)?); let texts = starters(cmd, p)?; diff --git a/docs/mcp.md b/docs/mcp.md index 21dfe8ca9..8d03540ba 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -498,7 +498,7 @@ one undo step and returns the ids it made: in the app does both). - `board.mindMap {x?, y?, text?, children?, parent?, edit?}` → `{id, text, children: [{id, text, connector}]}`: a mind map: a first node (`mindNode`, bold 24, no box; `text` defaults to `Topic`, `x`/`y` to the - middle of the view) with up to 20 `children` (texts; default `Idea 1`, `Idea 2`, `Idea 3`) + view's centre, in the parent's coordinates) with up to 20 `children` (texts; default `Idea 1`, `Idea 2`, `Idea 3`) on its right, each joined to it by a curved branch (a connector with `branch: true`: stroke 4, `#757575`, round caps). The map lays itself out: children stand in one column 88 units right of the widest node of their parent's column, 48 apart, centred on their parent; a node is its text, From c74bcd0b0ecb6df317771fbbfecc07657c0d6236 Mon Sep 17 00:00:00 2001 From: Denis Gomes <6731020+denisg0mes@users.noreply.github.com> Date: Fri, 13 Nov 2026 01:41:48 -0500 Subject: [PATCH 226/239] M1: Paste over selection puts the copies just above the selected layer Shift+Cmd/Ctrl+V pasted into the selected layer's parent at its top-left, but appended the copies, so they went to the top of the parent's layers whatever was selected. In an auto layout frame that put them at the end of the flow, away from the layer they were pasted over. They now go just above the selected layer, in the copied order: in the Layers panel the row above it, in an auto layout frame the item after it. A section pasted over a layer in a frame still goes on the page, on top of its layers, as before. Paste to replace already kept the replaced layer's place. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/edit/clipboard.rs | 14 +++++++++++--- crates/engine/src/tests.rs | 18 ++++++++++++++++++ docs/ui-parity.md | 3 ++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/edit/clipboard.rs b/crates/engine/src/cmd/edit/clipboard.rs index a04bfcb5c..dbf4ec180 100644 --- a/crates/engine/src/cmd/edit/clipboard.rs +++ b/crates/engine/src/cmd/edit/clipboard.rs @@ -329,14 +329,22 @@ pub(super) fn paste_over(s: &mut Session, _p: &Value) -> Result { let sel = s.selection(); let page = s.page()?; let doc = s.doc()?; - let (parent, at) = match sel.first() { + let (parent, at, above) = match sel.first() { Some(i) => { let parent = doc.node(*i).and_then(|n| n.parent).unwrap_or(page); - (parent, doc.world_bounds(*i).map(|b| (b.x0, b.y0))) + (parent, doc.world_bounds(*i).map(|b| (b.x0, b.y0)), doc.index_in_parent(*i).map(|ix| ix + 1)) } - None => (page, None), + None => (page, None, None), }; let ids = paste_into(s, parent, at)?; + if let Some(above) = above { + let doc = s.doc_mut()?; + for (k, i) in + ids.iter().filter(|i| doc.node(**i).is_some_and(|n| n.parent == Some(parent))).copied().collect::>().into_iter().enumerate() + { + doc.reorder(i, above + k)?; + } + } s.set_selection(ids.clone()); Ok(json!({"ids": ids})) } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index e983d6064..2862f3541 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -345,6 +345,24 @@ fn copy_paste_and_duplicate() { assert_eq!(d["ids"].as_array().unwrap().len(), 1); } +#[test] +fn paste_over_puts_the_copies_just_above_the_selected_layer() { + let mut s = sess(); + let frame = id(&s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 200, "height": 200})).unwrap()); + let layer = + |s: &mut Session, x: f64| id(&s.execute("shape.rectangle", &json!({"x": x, "y": 10, "width": 10, "height": 10, "parent": frame})).unwrap()); + let (a, b, c) = (layer(&mut s, 10.0), layer(&mut s, 30.0), layer(&mut s, 50.0)); + let kids = |s: &Session| s.doc().unwrap().node(frame).unwrap().children.clone(); + assert_eq!(kids(&s), vec![a, b, c]); + s.execute("edit.copy", &json!({"ids": [b, c]})).unwrap(); + s.set_selection(vec![a]); + let pasted: Vec = s.execute("edit.pasteOver", &json!({})).unwrap()["ids"].as_array().unwrap().iter().filter_map(params::id_of).collect(); + assert_eq!(pasted.len(), 2); + assert_eq!(kids(&s), vec![a, pasted[0], pasted[1], b, c], "in the selected layer's frame, just above it, in the copied order"); + assert_eq!(s.doc().unwrap().world_bounds(pasted[0]).unwrap().x0, 10.0, "at the selected layer's position"); + assert_eq!(s.selection(), pasted); +} + #[test] fn boolean_and_flatten() { let mut s = sess(); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index e928b4c12..f5215a134 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-10 · **Change:** minor (M8: Tab while renaming the last layer wraps to the first row, measured in Figma's web app on 2026-11-12; the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-13 · **Change:** minor (M1: Paste over selection puts the pasted layers just above the selected layer; M8: Tab while renaming the last layer wraps to the first row, measured in Figma's web app on 2026-11-12; the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -215,6 +215,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| +| 2026-11-13 | patch | M1: Shift+Cmd/Ctrl+V (Paste over selection) puts the pasted layers just above the selected layer, in its parent and in the copied order, at its position; they went to the top of the parent's layers, so in an auto layout frame they ended the flow instead of following the selected layer. | | 2026-11-12 | patch | M8: Tab while renaming the last layer in the Layers panel commits and opens the first row's rename, as measured in Figma's web app on 2026-11-12 (it ended the rename before); Shift+Tab on the first row is unchanged, not measured; Tab and Shift+Tab now move only the rename and leave the selection on the layer first renamed, as measured in Figma's web app on 2026-11-12 (it followed the rename before) (`tab_on_the_last_row_commits_and_wraps_to_the_first`, `tab_while_renaming_leaves_the_selection_on_the_first_layer`), Rename row | | 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start); FigCraft draws it opaque (how Figma treats a translucent fill was not measured); gradient, image and hidden fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | | 2026-11-10 | minor | The Rotation field shows and sets the layer's rotation on the page (its own angle plus its parents' when no ancestor is flipped; with a flipped ancestor FigCraft reads the composed angle, which flips the sign of the layer's own angle, and Figma's behaviour there was not measured), in frames and groups alike, as measured in Figma's web app for rotated, unflipped parents (#2196) | From 1a68ded58138d36a7d4fd0dcc79c6de76aeaf564 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Fri, 13 Nov 2026 01:43:34 -0500 Subject: [PATCH 227/239] M8: Tidy up keeps the second layer after a narrow first one when the gap is negative raise_negative_gap raised a negative gap from the interior widths only, so a first layer narrower than the gap's size let the second start before it (widths 10, 100 x5 at X 0, 80, 200, 260, 400, 460: the modal -40 gave X 0, -30, 30, ...). The second must start after the first, g > -w(0), in whole pixels floor(-w(0)) + 1. Figma kept the order in every measured run; a narrow first layer was not measured, so this bound keeps the order rather than follow a reading. Test: tidy_tests::a_narrow_first_layer_still_keeps_the_second_after_it. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/engine/src/selection/tidy.rs | 9 +++++++-- crates/engine/src/tidy_tests.rs | 13 +++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/selection/tidy.rs b/crates/engine/src/selection/tidy.rs index e5b9ada25..4a940e940 100644 --- a/crates/engine/src/selection/tidy.rs +++ b/crates/engine/src/selection/tidy.rs @@ -167,13 +167,18 @@ fn even_gap(gaps: &[f64], spacing: Option) -> f64 { /// in Figma's web app on 2026-11-13: interior widths of 10, 20 and 30 among 100s gave -4, -9 and /// -14, and widths of 100 left the most common gap, -40, alone. Only those three widths were /// measured; other widths follow the same formula. +/// +/// The first layer has no layer two places before it, but the second must still start after it: +/// `g > -w(0)`, in whole pixels `floor(-w(0)) + 1`. Figma kept the order in every run; a narrow +/// first layer was not measured, so this bound keeps that order rather than following a reading. fn raise_negative_gap(gap: f64, widths: &[f64]) -> f64 { let interior = widths.get(1..widths.len().saturating_sub(1)).unwrap_or(&[]); let w_min = interior.iter().copied().fold(f64::INFINITY, f64::min); - if widths.len() < 3 || !w_min.is_finite() { + let Some(first) = widths.first().copied() else { return gap }; + if widths.len() < 3 || !w_min.is_finite() || !first.is_finite() { return gap; } - gap.max((-w_min / 2.0).floor() + 1.0) + gap.max((-w_min / 2.0).floor() + 1.0).max((-first).floor() + 1.0) } /// A row (`vertical` false) or a column: the first layer stays, each next one follows the last at diff --git a/crates/engine/src/tidy_tests.rs b/crates/engine/src/tidy_tests.rs index 69c52e310..6f6034b78 100644 --- a/crates/engine/src/tidy_tests.rs +++ b/crates/engine/src/tidy_tests.rs @@ -339,6 +339,19 @@ fn a_negative_gap_is_raised_so_no_layer_reaches_the_one_two_before() { } } +#[test] +fn a_narrow_first_layer_still_keeps_the_second_after_it() { + // Not measured in Figma (it kept the order in every run): the modal gap -40 would start the + // second layer at -30, before a 10 wide first layer, so the gap is raised to -9. + let mut s = Session::new(); + let xs = [0., 80., 200., 260., 400., 460.]; + let widths = [10., 100., 100., 100., 100., 100.]; + let pairs: Vec<(f64, f64)> = xs.iter().copied().zip(widths).collect(); + let ids = bars(&mut s, &pairs); + tidy(&mut s, &ids); + assert_eq!(xs_of(&s, &ids), vec![0., 1., 92., 183., 274., 365.]); +} + #[test] fn a_negative_gap_between_equal_widths_is_the_most_common_gap() { let mut s = Session::new(); From fb9df220b1e609cf995c6baab337f5be08b67a82 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Fri, 13 Nov 2026 03:34:55 -0500 Subject: [PATCH 228/239] M6: .fig export writes a page's prototype background (#2326) (#2328) * M6: .fig export writes a page's prototype background (#2326) The export writes a page's prototype background as prototypeBackgroundColor (field 141, a plain colour) when it differs from the default, as Figma does for a page whose background was set. The device-settings warning now fires only for the device, rotation, colour, custom size and responsive settings. Measured on a synthetic file saved from Figma's web app. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 measured and wrote at medium * M6: the .fig export writes a prototype background opaque and warns for its opacity, and its tests read the written record (#2326) The colour is written with alpha 1, as the measured record has it and as the import reads it, and a background that isn't opaque warns that its opacity was left out. The tests now read the written record, and each device setting alone is checked. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.2 reviewed; Sonnet 5.5 wrote at medium * M6: the .fig export writes every page's prototype background, so Figma shows the same colour (#2326) A page at FigCraft's default background used to write no field, so Figma showed its own default instead. Every page now writes its colour, opaque. The test for a default page reads the written record and the import. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --------- Co-authored-by: Claude Sonnet 5.5 --- crates/format/src/fig.rs | 2 + crates/format/src/fig/export.rs | 2 +- crates/format/src/fig/export/layer.rs | 10 +- .../format/src/fig/proto_background_tests.rs | 113 ++++++++++++++++++ docs/file-format-parity.md | 7 +- 5 files changed, 129 insertions(+), 5 deletions(-) create mode 100644 crates/format/src/fig/proto_background_tests.rs diff --git a/crates/format/src/fig.rs b/crates/format/src/fig.rs index 24268da3c..6b3d4efb2 100644 --- a/crates/format/src/fig.rs +++ b/crates/format/src/fig.rs @@ -38,6 +38,8 @@ mod paste_style_tests; #[cfg(test)] mod prop_value_tests; #[cfg(test)] +mod proto_background_tests; +#[cfg(test)] mod scale_factor_tests; #[cfg(test)] mod slot_tests; diff --git a/crates/format/src/fig/export.rs b/crates/format/src/fig/export.rs index ac8612b9c..be0c902cf 100644 --- a/crates/format/src/fig/export.rs +++ b/crates/format/src/fig/export.rs @@ -190,7 +190,7 @@ message GridTrackSizingFunction GridTrackSizingType type=1, float value=2 message GridTrackSize GridTrackSizingFunction minSizing=1, GridTrackSizingFunction maxSizing=2 message GUIDGridTrackSizeMapEntry GUID id=1, GridTrackSize trackSize=2 message GUIDGridTrackSizeMap GUIDGridTrackSizeMapEntry[] entries=1 -message NodeChange GUID guid=1, NodePhase phase=2, ParentIndex parentIndex=3, NodeType type=4, string name=5, bool visible=6, bool locked=7, float opacity=8, BlendMode blendMode=9, Vector size=11, Matrix transform=12, bool mask=16, MaskType maskType=317, float backgroundOpacity=19, bool backgroundEnabled=15, bool internalOnly=142, string description=318, StyleType styleType=163, string sortPosition=320, StyleId styleIdForFill=332, StyleId styleIdForStrokeFill=333, StyleId styleIdForText=334, StyleId styleIdForEffect=335, StyleId styleIdForGrid=336, VariableDataMap variableConsumptionMap=307, VariableModeBySetMap variableModeBySetMap=316, VariableSetMode[] variableSetModes=312, VariableSetID variableSetID=313, VariableResolvedDataType variableResolvedType=314, VariableDataValues variableDataValues=315, VariableScope[] variableScopes=353, DocumentColorProfile documentColorProfile=349, Paint[] fillPaints=38, Paint[] strokePaints=39, float strokeWeight=26, StrokeAlign strokeAlign=29, StrokeJoin strokeJoin=31, StrokeCap strokeCap=30, float[] dashPattern=13, float miterLimit=25, bool borderStrokeWeightsIndependent=299, float borderTopWeight=295, float borderRightWeight=298, float borderBottomWeight=296, float borderLeftWeight=297, Effect[] effects=43, float cornerRadius=20, float cornerSmoothing=160, bool rectangleCornerRadiiIndependent=149, float rectangleTopLeftCornerRadius=145, float rectangleTopRightCornerRadius=146, float rectangleBottomRightCornerRadius=148, float rectangleBottomLeftCornerRadius=147, ConstraintType horizontalConstraint=28, ConstraintType verticalConstraint=37, bool frameMaskDisabled=115, bool resizeToFit=117, bool isStateGroup=225, StateGroupPropertyValueOrder[] stateGroupPropertyValueOrders=238, bool sectionContentsHidden=283, Color backgroundColor=50, StackMode stackMode=105, float stackSpacing=107, float stackCounterSpacing=324, StackWrap stackWrap=323, StackCounterAlignContent stackCounterAlignContent=343, float stackHorizontalPadding=209, float stackVerticalPadding=210, float stackPaddingRight=233, float stackPaddingBottom=234, StackJustify stackPrimaryAlignItems=230, StackAlign stackCounterAlignItems=231, StackSize stackPrimarySizing=229, StackSize stackCounterSizing=221, bool bordersTakeSpace=294, bool stackReverseZIndex=271, float gridColumnGap=438, float gridRowGap=437, GUIDPositionMap gridColumns=436, GUIDPositionMap gridRows=435, GUIDGridTrackSizeMap gridColumnsSizing=474, GUIDGridTrackSizeMap gridRowsSizing=475, float stackChildPrimaryGrow=232, StackCounterAlign stackChildAlignSelf=236, StackPositioning stackPositioning=269, OptionalVector minSize=325, OptionalVector maxSize=326, GUID gridColumnAnchor=440, GUID gridRowAnchor=439, uint gridColumnSpan=442, uint gridRowSpan=441, LayoutGrid[] layoutGrids=47, ExportSettings[] exportSettings=45, TextData textData=42, FontName fontName=41, float fontSize=21, Number lineHeight=40, Number letterSpacing=165, TextCase textCase=34, TextDecoration textDecoration=35, TextAlignHorizontal textAlignHorizontal=32, TextAlignVertical textAlignVertical=33, TextAutoResize textAutoResize=46, TextTruncation textTruncation=280, int maxLines=351, float paragraphSpacing=23, float paragraphIndent=22, float listSpacing=264, LeadingTrim leadingTrim=322, bool hangingPunctuation=337, bool hangingList=339, Hyperlink hyperlink=223, bool autoRename=14, bool fontVariantCommonLigatures=127, bool fontVariantContextualLigatures=128, string fontVersion=202, uint textUserLayoutVersion=203, uint textExplicitLayoutVersion=396, uint textBidiVersion=279, float textTracking=27, bool textDecorationSkipInk=412, EmojiImageSet emojiImageSet=391, uint styleID=49, Path[] fillGeometry=51, Path[] strokeGeometry=52, VectorData vectorData=48, VectorMirror handleMirroring=44, uint count=10, float starInnerScale=24, ArcData arcData=195, BooleanOperation booleanOperation=36, string symbolDescription=144, VariableWidthPoint[] variableWidthPoints=447, PluginData[] pluginData=204, SymbolData symbolData=113, NodeChange[] derivedSymbolData=125, GUID overriddenSymbolID=143, ComponentPropDef[] componentPropDefs=266, ComponentPropRef[] componentPropRefs=267, ComponentPropAssignment[] componentPropAssignments=268, VariantPropSpec[] variantPropSpecs=483, VariableDataMap parameterConsumptionMap=445, GUIDPath guidPath=111, PrototypeInteraction[] prototypeInteractions=226, PrototypeStartingPoint prototypeStartingPoint=249, ScrollDirection scrollDirection=159, ScrollBehavior scrollBehavior=186, OverlayPositionType overlayPositionType=198, OverlayBackgroundInteraction overlayBackgroundInteraction=200, OverlayBackgroundAppearance overlayBackgroundAppearance=201 +message NodeChange GUID guid=1, NodePhase phase=2, ParentIndex parentIndex=3, NodeType type=4, string name=5, bool visible=6, bool locked=7, float opacity=8, BlendMode blendMode=9, Vector size=11, Matrix transform=12, bool mask=16, MaskType maskType=317, float backgroundOpacity=19, bool backgroundEnabled=15, bool internalOnly=142, string description=318, StyleType styleType=163, string sortPosition=320, StyleId styleIdForFill=332, StyleId styleIdForStrokeFill=333, StyleId styleIdForText=334, StyleId styleIdForEffect=335, StyleId styleIdForGrid=336, VariableDataMap variableConsumptionMap=307, VariableModeBySetMap variableModeBySetMap=316, VariableSetMode[] variableSetModes=312, VariableSetID variableSetID=313, VariableResolvedDataType variableResolvedType=314, VariableDataValues variableDataValues=315, VariableScope[] variableScopes=353, DocumentColorProfile documentColorProfile=349, Paint[] fillPaints=38, Paint[] strokePaints=39, float strokeWeight=26, StrokeAlign strokeAlign=29, StrokeJoin strokeJoin=31, StrokeCap strokeCap=30, float[] dashPattern=13, float miterLimit=25, bool borderStrokeWeightsIndependent=299, float borderTopWeight=295, float borderRightWeight=298, float borderBottomWeight=296, float borderLeftWeight=297, Effect[] effects=43, float cornerRadius=20, float cornerSmoothing=160, bool rectangleCornerRadiiIndependent=149, float rectangleTopLeftCornerRadius=145, float rectangleTopRightCornerRadius=146, float rectangleBottomRightCornerRadius=148, float rectangleBottomLeftCornerRadius=147, ConstraintType horizontalConstraint=28, ConstraintType verticalConstraint=37, bool frameMaskDisabled=115, bool resizeToFit=117, bool isStateGroup=225, StateGroupPropertyValueOrder[] stateGroupPropertyValueOrders=238, bool sectionContentsHidden=283, Color backgroundColor=50, StackMode stackMode=105, float stackSpacing=107, float stackCounterSpacing=324, StackWrap stackWrap=323, StackCounterAlignContent stackCounterAlignContent=343, float stackHorizontalPadding=209, float stackVerticalPadding=210, float stackPaddingRight=233, float stackPaddingBottom=234, StackJustify stackPrimaryAlignItems=230, StackAlign stackCounterAlignItems=231, StackSize stackPrimarySizing=229, StackSize stackCounterSizing=221, bool bordersTakeSpace=294, bool stackReverseZIndex=271, float gridColumnGap=438, float gridRowGap=437, GUIDPositionMap gridColumns=436, GUIDPositionMap gridRows=435, GUIDGridTrackSizeMap gridColumnsSizing=474, GUIDGridTrackSizeMap gridRowsSizing=475, float stackChildPrimaryGrow=232, StackCounterAlign stackChildAlignSelf=236, StackPositioning stackPositioning=269, OptionalVector minSize=325, OptionalVector maxSize=326, GUID gridColumnAnchor=440, GUID gridRowAnchor=439, uint gridColumnSpan=442, uint gridRowSpan=441, LayoutGrid[] layoutGrids=47, ExportSettings[] exportSettings=45, TextData textData=42, FontName fontName=41, float fontSize=21, Number lineHeight=40, Number letterSpacing=165, TextCase textCase=34, TextDecoration textDecoration=35, TextAlignHorizontal textAlignHorizontal=32, TextAlignVertical textAlignVertical=33, TextAutoResize textAutoResize=46, TextTruncation textTruncation=280, int maxLines=351, float paragraphSpacing=23, float paragraphIndent=22, float listSpacing=264, LeadingTrim leadingTrim=322, bool hangingPunctuation=337, bool hangingList=339, Hyperlink hyperlink=223, bool autoRename=14, bool fontVariantCommonLigatures=127, bool fontVariantContextualLigatures=128, string fontVersion=202, uint textUserLayoutVersion=203, uint textExplicitLayoutVersion=396, uint textBidiVersion=279, float textTracking=27, bool textDecorationSkipInk=412, EmojiImageSet emojiImageSet=391, uint styleID=49, Path[] fillGeometry=51, Path[] strokeGeometry=52, VectorData vectorData=48, VectorMirror handleMirroring=44, uint count=10, float starInnerScale=24, ArcData arcData=195, BooleanOperation booleanOperation=36, string symbolDescription=144, VariableWidthPoint[] variableWidthPoints=447, PluginData[] pluginData=204, SymbolData symbolData=113, NodeChange[] derivedSymbolData=125, GUID overriddenSymbolID=143, ComponentPropDef[] componentPropDefs=266, ComponentPropRef[] componentPropRefs=267, ComponentPropAssignment[] componentPropAssignments=268, VariantPropSpec[] variantPropSpecs=483, VariableDataMap parameterConsumptionMap=445, GUIDPath guidPath=111, PrototypeInteraction[] prototypeInteractions=226, PrototypeStartingPoint prototypeStartingPoint=249, ScrollDirection scrollDirection=159, ScrollBehavior scrollBehavior=186, OverlayPositionType overlayPositionType=198, OverlayBackgroundInteraction overlayBackgroundInteraction=200, OverlayBackgroundAppearance overlayBackgroundAppearance=201, Color prototypeBackgroundColor=141 struct Blob byte[] bytes message Message MessageType type=1, uint sessionID=2, NodeChange[] nodeChanges=4, Blob[] blobs=6 "; diff --git a/crates/format/src/fig/export/layer.rs b/crates/format/src/fig/export/layer.rs index bebd09059..201246648 100644 --- a/crates/format/src/fig/export/layer.rs +++ b/crates/format/src/fig/export/layer.rs @@ -26,7 +26,15 @@ impl<'d> Exporter<'d> { if !n.guides.is_empty() { self.warn("ruler guides were left out"); } - if *prototype != Default::default() { + let defaults = figcraft_doc::proto::PrototypeSettings::default(); + // Every page writes its colour, so Figma shows the same one (a page without the field shows Figma's own default). + // The colour is written opaque: the record measured has alpha 1, and the import reads the colour as opaque and + // an alpha of 0 as no background. + f.push(("prototypeBackgroundColor", color(prototype.background.with_alpha(1.0)))); + if prototype.background.a < 1.0 { + self.warn("a prototype background's opacity was left out"); + } + if (figcraft_doc::proto::PrototypeSettings { background: defaults.background, ..prototype.clone() }) != defaults { self.warn("prototype device settings were left out"); } self.modes(n, &mut f); diff --git a/crates/format/src/fig/proto_background_tests.rs b/crates/format/src/fig/proto_background_tests.rs new file mode 100644 index 000000000..eec5171a7 --- /dev/null +++ b/crates/format/src/fig/proto_background_tests.rs @@ -0,0 +1,113 @@ +//! A page's prototype background in `.fig` exports. + +use figcraft_doc::color::Color; +use figcraft_doc::proto::{DeviceRotation, PrototypeSettings}; +use figcraft_doc::{Document, NodeKind}; + +use super::kiwi::Kv; +use super::{Archive, decode_canvas, export, import}; + +fn blue() -> Color { + Color::from_rgb8_const(0x33, 0x66, 0x99) +} + +/// The background of the first page, and its device, after exporting and importing `doc`. +fn back(doc: &Document) -> (Color, String, Vec) { + let (bytes, warnings) = export(doc, None).unwrap(); + let (imported, _) = import(&bytes, "x").unwrap(); + let page = imported.first_page().and_then(|p| imported.node(p)).unwrap(); + let NodeKind::Page { prototype, .. } = &page.kind else { panic!("not a page") }; + (prototype.background, prototype.device.clone(), warnings) +} + +/// The `prototypeBackgroundColor` (r, g, b, a) in the record the export writes for the page of `doc`. +fn written(doc: &Document) -> Option<[f32; 4]> { + let (bytes, _) = export(doc, None).unwrap(); + let archive = Archive::open(&bytes).unwrap(); + let (schema, message) = decode_canvas(&archive.canvas).unwrap(); + let msg = schema.decode_message(schema.find("Message").unwrap(), &message).unwrap(); + let page = msg.get("nodeChanges").unwrap().list().iter().find(|n| n.get("type").and_then(Kv::str) == Some("CANVAS")).unwrap(); + page.get("prototypeBackgroundColor").map(|c| ["r", "g", "b", "a"].map(|k| c.get(k).and_then(Kv::f64).unwrap() as f32)) +} + +fn with_prototype(set: impl FnOnce(&mut figcraft_doc::proto::PrototypeSettings)) -> Document { + let mut doc = Document::new("t"); + let page = doc.first_page().unwrap(); + if let Some(NodeKind::Page { prototype, .. }) = doc.node_mut(page).map(|n| &mut n.kind) { + set(prototype); + } + doc +} + +#[test] +fn a_pages_prototype_background_survives_a_fig_export() { + let doc = with_prototype(|p| p.background = blue()); + assert_eq!(written(&doc), Some([blue().r, blue().g, blue().b, 1.0])); + let (background, _, warnings) = back(&doc); + assert_eq!(background, blue()); + assert!(warnings.iter().all(|w| !w.contains("prototype")), "{warnings:?}"); +} + +#[test] +fn a_page_with_a_device_keeps_its_background_and_warns_for_the_device() { + let doc = with_prototype(|p| { + p.background = blue(); + p.device = "iPhone 17".into(); + }); + let (background, _, warnings) = back(&doc); + assert_eq!(background.to_hex(), blue().to_hex()); + assert!(warnings.iter().any(|w| w.contains("prototype device settings were left out")), "{warnings:?}"); +} + +#[test] +fn a_default_page_writes_its_prototype_background_so_figma_shows_the_same_colour() { + let doc = with_prototype(|_| {}); + let default = PrototypeSettings::default().background; + assert_eq!(default.to_hex(), "1E1E1E"); + assert_eq!(written(&doc), Some([default.r, default.g, default.b, 1.0])); + let (background, _, warnings) = back(&doc); + assert_eq!(background, default); + assert!(warnings.iter().all(|w| !w.contains("prototype")), "{warnings:?}"); +} + +#[test] +fn the_schema_numbers_the_prototype_background() { + let s = super::kiwi::Schema::parse(super::export::SCHEMA).unwrap(); + let def = |n: &str| s.defs.iter().find(|d| d.name == n).unwrap(); + let id = |f: &str| def("NodeChange").fields.iter().find(|x| x.name == f).unwrap().value; + assert_eq!(id("prototypeBackgroundColor"), 141); +} + +#[test] +fn each_device_setting_alone_warns_and_keeps_the_default_background() { + let settings: [fn(&mut PrototypeSettings); 5] = [ + |p| p.device = "iPhone 17".into(), + |p| p.rotation = DeviceRotation::Landscape, + |p| p.color = "White".into(), + |p| p.custom_size = [320.0, 480.0], + |p| p.responsive = true, + ]; + for (i, set) in settings.into_iter().enumerate() { + let doc = with_prototype(set); + let default = PrototypeSettings::default().background; + assert_eq!(written(&doc), Some([default.r, default.g, default.b, 1.0]), "setting {i}"); + let (_, _, warnings) = back(&doc); + assert!(warnings.iter().any(|w| w == "prototype device settings were left out"), "setting {i}: {warnings:?}"); + } +} + +#[test] +fn a_prototype_background_is_written_opaque() { + // The import reads an alpha of 0 as no background, and any other alpha as 1. + for alpha in [0.0, 0.5] { + let doc = with_prototype(|p| p.background = blue().with_alpha(alpha)); + assert_eq!(written(&doc), Some([blue().r, blue().g, blue().b, 1.0]), "alpha {alpha}"); + let (background, _, warnings) = back(&doc); + assert_eq!(background, blue(), "alpha {alpha}"); + assert!(warnings.iter().any(|w| w == "a prototype background's opacity was left out"), "alpha {alpha}: {warnings:?}"); + } + // The default colour is written opaque too. + let doc = with_prototype(|p| p.background = p.background.with_alpha(0.5)); + let default = PrototypeSettings::default().background; + assert_eq!(written(&doc), Some([default.r, default.g, default.b, 1.0])); +} diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 2d62d68d5..df9cdae3b 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-11-12 · **Change:** minor (`.fig` export writes list spacing, hanging punctuation and lists, and vertical trim (#2305); `.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-13 · **Change:** minor (`.fig` export writes a page's prototype background (#2326); `.fig` export writes list spacing, hanging punctuation and lists, and vertical trim (#2305); `.fig` import and export read and write a boolean group's corner radius and smoothing (#2222); `.jam` import: stickies come in as native board stickies (#1808); `.fig` import scales per-point vector corner radii with the row that supplies their network and keeps different instance scales separate in the network cache (#2097); `.fig` export preserves scaled-instance lengths reset to their unscaled main values, including nested linked-style overrides (#2097); `.fig` import: the layers of an instance scaled with the Scale tool draw at its scale factor, not at their main's lengths (#2091); a color profile per PNG, JPG and WebP export setting (Same as file, sRGB or Display P3), the pixels converted; a `.jam` connector end with an `AUTO` or `CENTER` magnet leaves the side facing the other end, not the side its stale saved point named (#1909); a FigJam elbow connector saved with its path (`connectorControlPoints`) keeps it on import, as a board connector reshaped by hand does, instead of being routed again (#1910); JPG exports take a quality, 1 to 100 with 90 the default, and embed the file's colour profile when it is sRGB too (#2004); 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 @@ -91,7 +91,7 @@ an inherited style link keep their own values and the link; stale copies on the still yield to the style. These cases have synthetic export/import regressions, including nested scales and empty-style clears; they have not been checked in other software. -- **Written:** pages (name, background); frames, groups, sections, rectangles (as rounded +- **Written:** pages (name, background, prototype background as an opaque colour, for every page); frames, groups, sections, rectangles (as rounded rectangles, with their four radii), ellipses (arcs), polygons, stars, lines, vectors (editable network blobs with per-point corner radius, handle mirroring, caps and joins, plus the outline of their filled areas), text, boolean groups, slices; the fill outline of frames and shapes and the @@ -136,7 +136,7 @@ scales and empty-style clears; they have not been checked in other software. text (written as values), variables' publishing, code syntax and inheritance settings, extended collections (written as collections of their own), comments, Developer Mode annotations, statuses, resources, measurements and code links, plugin data, ruler - guides, prototype device settings, slot properties and slot content, brush + guides, a page's prototype device settings (device, rotation, colour, custom size, responsive), the opacity of a page's prototype background (written opaque), slot properties and slot content, brush strokes (written plain), strokes wider on one side of their path (written as filled outlines, or with the width on both sides when the shape has a fill too), pattern fills, WebP export settings (written as PNG), image adjustments, glass settings other than frost, springs other than Gentle (written as ease @@ -195,6 +195,7 @@ scales and empty-style clears; they have not been checked in other software. | Date | Change | Summary | |---|---|---| +| 2026-11-13 | minor | M6, #2326: `.fig` export writes a page's prototype background (the file's `prototypeBackgroundColor`, field 141, a plain colour, written for every page, so Figma shows the same colour and not its own default for a page at FigCraft's default), measured on a synthetic file saved from Figma's web app. The colour is written opaque, as that file has it and as the importer reads it; a background that isn't opaque gets a warning for its opacity. The device warning now fires only for the page's device settings (device, rotation, colour, custom size, responsive), which stay left out. Checked through the importer only, not in other software. Numbers unchanged. | | 2026-11-12 | minor | M6, #2305: the `.fig` export writes a text's list spacing (`listSpacing`), hanging punctuation (`hangingPunctuation`), hanging lists (`hangingList`) and vertical trim (`leadingTrim`: none or cap height), which the importer already read. A field is written only when it differs from its default (in a design file saved by Figma, a text at the defaults carries none of the four), and an instance override that goes back to the default clears it. The warning narrows to OpenType features, which the importer does not read from a `.fig`. Checked through the importer only, not in other software. | | 2026-11-10 | minor | M4, #2222: a boolean group's corner radius and smoothing are read and written by the `.fig` importer and exporter, and by the REST importer | | 2026-11-07 | patch | Fonts, #2092: a font loaded with `text.loadFont` is the counterpart of a font uploaded to the organization, which Figma's help center ("Manage conflicting fonts") ranks first, ahead of installed fonts and the web fonts. FigCraft chose the first face added for a family and style, so the built-in Inter 4.x kept Regular, SemiBold and Bold after Inter 3.19 was loaded and only Medium refitted. A loaded face now wins over the other faces of its family and style, the latest load over earlier ones; style matching and fallbacks are unchanged, and `refitted` lists the text whose size changes. Installed versus built-in order is not changed here. Test: `fontdb::tests::a_loaded_face_wins_over_the_built_in_one_of_its_family_and_style`. Numbers unchanged. | From bdf6ff92235f6ae20e9a1c6a4d7f075a2fdb65e7 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Fri, 13 Nov 2026 05:38:36 -0500 Subject: [PATCH 229/239] M8: after Crop is chosen in the image fill's menu, a drag on the image crops it, and no internal gesture message shows (#2307) With the colour picker open on an image fill in Crop mode, a press on the layer closed the picker, and closing it committed the drag as a plain move: the whole layer moved instead of the picture inside it. The picker now treats a crop drag as its own control, as it does the open gradient's handles (#1852), so the press doesn't close it and the drag moves the crop. A drag whose gesture something else committed under the held button went on calling the engine's preview, whose "no gesture in progress" error reached the canvas as a message. That error is now its own EngineError::NoGesture, which the canvas drops: the drag it belonged to is over, and it says nothing to the user. Tests: crop_image_tests::crop_from_the_colour_picker_then_a_drag_on_the_image_moves_the_crop_not_the_layer (failed before: the crop didn't move) and a_drag_whose_gesture_was_committed_under_the_button_shows_no_message (failed before: "no gesture in progress"). Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and finished; Sonnet 5.5 wrote at medium (cut off by an API error) --- crates/engine/src/error.rs | 4 ++ crates/engine/src/session/undo.rs | 2 +- crates/ui-egui/src/canvas/handles.rs | 7 ++++ crates/ui-egui/src/canvas/input.rs | 6 ++- crates/ui-egui/src/crop_image_tests.rs | 50 +++++++++++++++++++++++ crates/ui-egui/src/widgets/colorpicker.rs | 3 +- docs/ui-parity.md | 3 +- 7 files changed, 71 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/error.rs b/crates/engine/src/error.rs index 7f26258f1..e3f4e79e9 100644 --- a/crates/engine/src/error.rs +++ b/crates/engine/src/error.rs @@ -14,6 +14,10 @@ pub enum EngineError { NoNode(NodeId), #[error("{0}")] Other(String), + /// A preview was asked for with no gesture open (something committed it under a held button). + /// Not for the user: the canvas drops it, as the drag it belonged to is over. + #[error("no gesture in progress")] + NoGesture, /// A command run in the background sent a request to a server and runs again with the answer /// ([`background`]); never returned to other callers. #[error("waiting for the server")] diff --git a/crates/engine/src/session/undo.rs b/crates/engine/src/session/undo.rs index 14fdfe5b9..7c234ec76 100644 --- a/crates/engine/src/session/undo.rs +++ b/crates/engine/src/session/undo.rs @@ -65,7 +65,7 @@ impl Session { /// Replace the document with `f(snapshot)` for a live preview during a gesture. pub fn preview(&mut self, f: impl FnOnce(&mut Document, &mut Vec) -> Result<()>) -> Result<()> { let ds = self.ds_mut()?; - let Some(it) = ds.interaction.clone() else { return Err(EngineError::Other("no gesture in progress".into())) }; + let Some(it) = ds.interaction.clone() else { return Err(EngineError::NoGesture) }; let mut doc = (*it.doc).clone(); let mut sel = it.selection.clone(); // What the gesture changes on the selected layers is an explicit edit. diff --git a/crates/ui-egui/src/canvas/handles.rs b/crates/ui-egui/src/canvas/handles.rs index 491189eda..39019140d 100644 --- a/crates/ui-egui/src/canvas/handles.rs +++ b/crates/ui-egui/src/canvas/handles.rs @@ -206,6 +206,13 @@ pub fn gradient_dragging(ctx: &egui::Context) -> bool { matches!(ctx.data(|d| d.get_temp::(drag_id())), Some(Drag::Gradient { .. })) } +/// Whether the open image fill's crop (its handles, or a drag on the image) is being dragged, the +/// press that starts it included: the open colour picker holds that paint in Crop mode, so the +/// press is its own control, not one outside it that would close it and commit the drag (#2307). +pub fn crop_dragging(ctx: &egui::Context) -> bool { + matches!(ctx.data(|d| d.get_temp::(drag_id())), Some(Drag::Crop { .. })) +} + /// Whether the document has a gesture open: a handle drag edits only inside its own. fn gesture_open(app: &FigApp) -> bool { app.session.ds().is_ok_and(|d| d.interaction.is_some()) diff --git a/crates/ui-egui/src/canvas/input.rs b/crates/ui-egui/src/canvas/input.rs index b4cff10aa..e02aa0cb3 100644 --- a/crates/ui-egui/src/canvas/input.rs +++ b/crates/ui-egui/src/canvas/input.rs @@ -398,7 +398,11 @@ fn send(app: &mut FigApp, kind: PointerKind, pos: Pos2, m: &egui::Modifiers) { app.canvas.pressure = None; } app.canvas.last_pointer = Some(Point::new(ev.x, ev.y)); - if let Err(e) = app.session.pointer(&ev) { + // A gesture something else committed under the held button (a colour picker closing on this + // press) leaves the rest of its drag with nothing to edit: that is not worth saying. + if let Err(e) = app.session.pointer(&ev) + && !matches!(e, figcraft_engine::EngineError::NoGesture) + { app.toast(e.to_string()); } app.canvas.last_hover = hover.then(|| HoverKey::of(app, ev)); diff --git a/crates/ui-egui/src/crop_image_tests.rs b/crates/ui-egui/src/crop_image_tests.rs index 68ed04a81..05435d856 100644 --- a/crates/ui-egui/src/crop_image_tests.rs +++ b/crates/ui-egui/src/crop_image_tests.rs @@ -194,6 +194,56 @@ fn crop_chosen_in_the_colour_picker_enters_crop_mode() { assert!((scaled[0] - after[0] * 5.0 / 6.0).abs() < 1e-6 && (scaled[3] - after[3] * 5.0 / 6.0).abs() < 1e-6, "{after:?} -> {scaled:?}"); } +/// The reporter's sequence (#2307): the colour picker open on an image fill held in Crop mode +/// (Crop chosen in its mode dropdown, or reopened on a fill that already is), then a press on the +/// layer and a drag. The drag moves the picture inside the layer (its crop), not the layer, the +/// press doesn't close the picker under it, and no internal gesture message reaches the user. +#[test] +fn crop_from_the_colour_picker_then_a_drag_on_the_image_moves_the_crop_not_the_layer() { + let (mut u, layer, _) = setup(); + u.app.ui.picker = Some(crate::colorpicker::PickerTarget::Paint { fills: true, index: 0, ids: vec![layer] }); + for _ in 0..4 { + u.frame(vec![]); + } + choose_mode(&mut u, "Fill", "Crop"); + // Crop mode on the canvas ended (a click away from the image); the picker opens on the Crop fill. + u.app.ui.crop = None; + u.app.ui.picker = Some(crate::colorpicker::PickerTarget::Paint { fills: true, index: 0, ids: vec![layer] }); + for _ in 0..4 { + u.frame(vec![]); + } + let (_, Some(before)) = mode(&u, layer) else { panic!("a crop") }; + let at = u.app.session.doc().unwrap().node(layer).unwrap().transform.as_coeffs(); + let from = u.app.to_screen(100.0, 50.0); + u.drag_to(from, from + vec2(30.0, 10.0)); + u.frame(vec![]); + u.button(from + vec2(30.0, 10.0), false); + let n = u.app.session.doc().unwrap().node(layer).unwrap().clone(); + assert_eq!(n.transform.as_coeffs(), at, "the layer stays where it is"); + assert_eq!((n.width, n.height), (200.0, 100.0), "and keeps its size"); + let (m, Some(after)) = mode(&u, layer) else { panic!("a crop") }; + assert_eq!(m, ImageScaleMode::Crop); + assert_ne!(after, before, "the drag moved the picture inside the layer"); + assert_eq!(u.app.session.selection(), vec![layer]); + assert!(u.app.ui.toast.as_ref().is_none_or(|(t, _)| !t.contains("gesture")), "no internal gesture message: {:?}", u.app.ui.toast); +} + +/// A drag the colour picker's close committed under the held button (a press on a layer closing +/// the picker) leaves the rest of its drag with no gesture: that says nothing to the user. +#[test] +fn a_drag_whose_gesture_was_committed_under_the_button_shows_no_message() { + let (mut u, layer, _) = setup(); + u.app.run("select.set", json!({"ids": [layer]})); + let from = u.app.to_screen(100.0, 50.0); + u.button(from, true); + u.app.session.commit_interaction().unwrap(); + for k in 1..=10 { + u.frame(vec![Event::PointerMoved(from + vec2(3.0, 1.0) * k as f32)]); + } + u.button(from + vec2(30.0, 10.0), false); + assert!(u.app.ui.toast.is_none(), "no message: {:?}", u.app.ui.toast); +} + /// The first paint, an image, of `id`'s fills (`fills`) or strokes, or of region `region` of a vector. fn image_at(u: &Ui, id: NodeId, fills: bool, region: Option) -> figcraft_color::ImagePaint { let n = u.app.session.doc().unwrap().node(id).unwrap(); diff --git a/crates/ui-egui/src/widgets/colorpicker.rs b/crates/ui-egui/src/widgets/colorpicker.rs index 6aa0c4915..662e4ba24 100644 --- a/crates/ui-egui/src/widgets/colorpicker.rs +++ b/crates/ui-egui/src/widgets/colorpicker.rs @@ -1041,7 +1041,8 @@ pub fn show(app: &mut FigApp, ctx: &egui::Context) { let picking = app.session.tool.pick_only || app.session.tool.picked.is_some(); // Nor may a press on the open gradient's handles or stops on the canvas: they are this picker's // controls, and the canvas took the press before the picker drew (#1852). - let own = picking || crate::handles::gradient_dragging(ctx); + // Nor may one on the crop of an image paint held in Crop mode (#2307). + let own = picking || crate::handles::gradient_dragging(ctx) || crate::handles::crop_dragging(ctx); pop = pop.close_on_outside(!own); // Only the opening control is held out: any other sidebar or canvas press dismisses it. let mut held: Vec = app.ui.picker_button.into_iter().collect(); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index e928b4c12..c10c88f82 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-10 · **Change:** minor (M8: Tab while renaming the last layer wraps to the first row, measured in Figma's web app on 2026-11-12; the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-13 · **Change:** minor (after Crop is chosen in the image fill's colour picker, a drag on the image crops it instead of moving the layer, and no internal gesture message shows (#2307); M8: Tab while renaming the last layer wraps to the first row, measured in Figma's web app on 2026-11-12; the text caret takes the text's solid fill colour (#2156); the Rotation field shows and sets the rotation on the page, in frames and groups, through node.set absoluteRotation (#2196); the eyedropper picks a magnified image's pixel under the pointer, not a blend with its neighbours (#2189); Selection colors shows from one distinct colour when a selected layer has children, and from two otherwise, measured in Figma's web app on 2026-11-09 on a frame, a group and plain rectangles; the crosshair of the shape and Text tools is drawn dark with a white edge, so it shows on a white frame whatever the system's pointer style (#2198); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); the Point section's X and Y in vector edit mode show Mixed and set every selected point of the layer being edited, as in Figma; Preferences ▸ Invert zoom direction reverses wheel zoom, pinch unchanged (#2145); Shift while rotating lands on absolute multiples of 15°, measured in Figma; Flatten bakes a vector's point corner radius into its path (#2195); a click on a fill, stroke or effect row's grip or background highlights it, Cmd/Ctrl+C copies that paint or effect and Cmd/Ctrl+V pastes it onto the selected layers, as the help center's Copy and paste properties between layers says (#1494); wrap style per paragraph and in text styles (#1827); the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the marquee follows Figma's measured rules: a partly covered frame or section gives the layers in it the marquee touches, a rotated shape is touched by its outline, a drag from inside a frame selects that frame only when the marquee also takes another top-level frame (then whole) (`marquee_behaviour_tests`); copy, cut and paste in vector edit mode act on the selected points and segments (#1875); M8, #2146: K focuses the Scale tool's factor field with its text selected, so K, 2, Enter scales the selection by two about the panel's origin (FigCraft's starts at the top left; Figma's grid starts at the centre, left for a follow-up because the origin also sets where a handle drag pivots, which is not measured) in one undo step, after which the tool returns to Move with the selection kept; Escape in the field closes it with the tool back on Move and nothing changed (measured in Figma's web app, 2026-11-09; `pressing_k_focuses_the_scale_field_with_its_text_selected`, `k_two_enter_scales_the_selection_by_two`, `escape_in_the_scale_field_closes_it_and_changes_nothing`); the main menu and its submenus stay inside the window, moving up to fit and scrolling when taller (#2217); locked layers ignore the arrow keys and a locked parent's children can't be locked on their own (#1560); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys, drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status: @@ -215,6 +215,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged | Date | Change | Summary | |---|---|---| +| 2026-11-13 | patch | M8, #2307: with Crop chosen in an image fill's colour picker, a press and drag on the image moved the whole layer: the press closed the picker, which committed the crop as a plain move. The picker now treats a crop drag as its own control (as it does the open gradient's handles, #1852), so the drag moves the picture inside the layer. A drag whose gesture something else committed under the held button no longer shows the engine's internal "no gesture in progress" as a message (`EngineError::NoGesture`, dropped by the canvas). Tests: `crop_image_tests::crop_from_the_colour_picker_then_a_drag_on_the_image_moves_the_crop_not_the_layer`, `a_drag_whose_gesture_was_committed_under_the_button_shows_no_message`. | | 2026-11-12 | patch | M8: Tab while renaming the last layer in the Layers panel commits and opens the first row's rename, as measured in Figma's web app on 2026-11-12 (it ended the rename before); Shift+Tab on the first row is unchanged, not measured; Tab and Shift+Tab now move only the rename and leave the selection on the layer first renamed, as measured in Figma's web app on 2026-11-12 (it followed the rename before) (`tab_on_the_last_row_commits_and_wraps_to_the_first`, `tab_while_renaming_leaves_the_selection_on_the_first_layer`), Rename row | | 2026-11-09 | patch | M3, #2156: the text caret takes the text's solid fill colour (red text, red caret; light grey on a dark frame, light grey, one colour and no inversion), measured in Figma's web app: the fill of the character before the caret (the first one's at the start); FigCraft draws it opaque (how Figma treats a translucent fill was not measured); gradient, image and hidden fills (not measured) give a black caret on a light surface and a white one on a dark one (the nearest layer around the text whose top visible fill is a solid at least half opaque as drawn, counting layer opacity, else the page; a layer whose top fill is a gradient or an image is passed over), not the interface's text colour (white in the dark theme, invisible on the default light page, #2190). Width and height unchanged; collaborators' carets unchanged. Tests: `caret_tests` | | 2026-11-10 | minor | The Rotation field shows and sets the layer's rotation on the page (its own angle plus its parents' when no ancestor is flipped; with a flipped ancestor FigCraft reads the composed angle, which flips the sign of the layer's own angle, and Figma's behaviour there was not measured), in frames and groups alike, as measured in Figma's web app for rotated, unflipped parents (#2196) | From 193c3a3591685fd95ad1ff60d23fe00bfbbd4319 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Fri, 13 Nov 2026 05:40:27 -0500 Subject: [PATCH 230/239] M6: the .fig export names the case of a multi-line instance text on its main's text path (#2323) An override can't take its layer off the main component's text path, so an instance text of more than one line, whose main is on a path, stays on that path in the file. The export warned the general instance mismatch for it. It now says exactly that case: "an instance's text of more than one line stays on its main component's text path in the file, as an override can't take it off". FigCraft's own import reads such a layer as plain text. The docs' Left out list names the case. Co-Authored-By: Claude Opus 5.5 Model-Effort: Opus 5.5 drove and wrote --- crates/format/src/fig/export/shape.rs | 8 +++++++- crates/format/src/fig/text_path_tests.rs | 11 +++++++++++ docs/file-format-parity.md | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/crates/format/src/fig/export/shape.rs b/crates/format/src/fig/export/shape.rs index 6b70b6c62..9ef7b2077 100644 --- a/crates/format/src/fig/export/shape.rs +++ b/crates/format/src/fig/export/shape.rs @@ -381,7 +381,11 @@ impl<'d> Exporter<'d> { if let Some(main) = main { let main_ok = matches!(&main.kind, NodeKind::Text(m) if text_path_net(m, main.width, main.height).is_ok()); if main_ok != own.is_ok() { - self.warn(TEXT_PATH_INSTANCE); + // An override can't take its layer off the main's path. So an instance text of + // more than one line, on a main that is on a path, stays on that path in the file: + // say so rather than the general mismatch (FigCraft's import reads it as plain text). + let lines = main_ok && matches!(own, Err(TEXT_PATH_LINES)); + self.warn(if lines { TEXT_PATH_INSTANCE_LINES } else { TEXT_PATH_INSTANCE }); return None; } } @@ -414,6 +418,8 @@ const TEXT_PATH_CANT: &str = "text on a path the format can't hold was written a const TEXT_PATH_PARTS: &str = "the parts of a text's path after the first were left out"; const TEXT_PATH_INSTANCE: &str = "text on a path in an instance but not in its main component, or the other way round, was written as the main has it"; +const TEXT_PATH_INSTANCE_LINES: &str = + "an instance's text of more than one line stays on its main component's text path in the file, as an override can't take it off"; /// A text's path as the format holds it: one chain (or cycle) of a vector network with the /// segment the text starts on marked, and the start as that segment's own parameter. diff --git a/crates/format/src/fig/text_path_tests.rs b/crates/format/src/fig/text_path_tests.rs index 154b9015d..ec1e20bdd 100644 --- a/crates/format/src/fig/text_path_tests.rs +++ b/crates/format/src/fig/text_path_tests.rs @@ -275,6 +275,8 @@ const W1: &str = "text on a path with more than one line was written as plain te const W2: &str = "text on a path the format can't hold was written as plain text"; const W3: &str = "the parts of a text's path after the first were left out"; const W4: &str = "text on a path in an instance but not in its main component, or the other way round, was written as the main has it"; +const W4_LINES: &str = + "an instance's text of more than one line stays on its main component's text path in the file, as an override can't take it off"; const MARK: u32 = 0x01ff_ffff; /// What an export wrote: its warnings, the layer records and the blobs. @@ -557,6 +559,15 @@ fn an_instance_layer_on_a_path_survives_a_fig_export() { let (back, _) = super::import(&bytes, "Back").unwrap(); assert_eq!(path_of(&back, "Half").as_deref(), Some("M0,0 L50,0")); + // An instance's text of two lines on a main that is on a path: the override can't leave the + // path, so the warning names that case, not the general mismatch. + let mut two = doc.clone(); + let id: NodeId = two.nodes().find(|n| n.name == "Half").unwrap().children[0]; + two.node_mut(id).unwrap().kind.text_mut().unwrap().characters = "al\npha".into(); + let (_, w) = Written::of(&two); + assert!(w.warned(W4_LINES), "{:?}", w.warnings); + assert!(!w.warned(W4), "{:?}", w.warnings); + // The other way round: the main's layer is plain text, and so is the instance's. let (bytes, w) = Written::of(&off("Main")); assert!(w.warned(W4), "{:?}", w.warnings); diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 47bab36b7..2dc0e240b 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -141,7 +141,7 @@ scales and empty-style clears; they have not been checked in other software. with the width on both sides when the shape has a fill too), pattern fills, WebP export settings (written as PNG), image adjustments, glass settings other than frost, springs other than Gentle (written as ease out), set-variable, set-variable-mode and conditional actions, scroll-to offsets, text decoration - looks, variable font axes, text on a path with more than one line or on a path the format can't hold (written as plain text), the parts of a text's path after the first, text on a path in an instance but not in its main or the other way round (written as the main has it), nested list levels, OpenType features, per-layer operations inside boolean groups, different stroke ends + looks, variable font axes, text on a path with more than one line or on a path the format can't hold (written as plain text), the parts of a text's path after the first, text on a path in an instance but not in its main or the other way round (written as the main has it), an instance's text of more than one line on a main on a path (it stays on that path, as an override can't take it off), nested list levels, OpenType features, per-layer operations inside boolean groups, different stroke ends on lines, the Dash cap (no public name for it). Not written at all: stroke outlines of dashed and per-side strokes and of inside or outside strokes on polygons, stars and vectors, glyph outlines of text (a reader lays text out with its own fonts), version history and branches. From af26ce1a6b814956b72fb0a5ced034b908aa1629 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 12:17:21 +0000 Subject: [PATCH 231/239] ci: provide pinned test data to Sonar coverage --- .github/workflows/sonarcloud.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index e78fe1ea3..32b0507f6 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -16,6 +16,11 @@ concurrency: jobs: sonarcloud: - # Tracked at @main so org-wide CI improvements propagate without PR churn. - uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main + # Pin the coverage setup that checks out this repo's pinned craft-i18n data. + uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@20ebee3cb1eef69f886b98d566aa07552ee0196f + with: + # The shared coverage archive's shards omit the CLI executable used by integration tests. + # Run this repository's suite in one instrumented job and provide its pinned test data. + shards: 1 + fonts-ref: 37827adc41fd165f9a9234ac40f94dbad353aa69 secrets: inherit From eb660e776ef4d9de5e22300ea85a268c876de76e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 13:03:44 +0000 Subject: [PATCH 232/239] ci: use shared instrumented test failure gate --- .github/workflows/sonarcloud.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 32b0507f6..50616c871 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -17,7 +17,7 @@ concurrency: jobs: sonarcloud: # Pin the coverage setup that checks out this repo's pinned craft-i18n data. - uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@20ebee3cb1eef69f886b98d566aa07552ee0196f + uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@ea24c9c24e1997238334182160f60e602e5bce32 with: # The shared coverage archive's shards omit the CLI executable used by integration tests. # Run this repository's suite in one instrumented job and provide its pinned test data. From 4084642c450869b607a4619b815ceaf43587229a Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 13:24:26 +0000 Subject: [PATCH 233/239] ci: exclude pinned fonts from Sonar scan --- sonar-project.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sonar-project.properties b/sonar-project.properties index 5f58f42ae..7bd9e8ce6 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,6 +1,9 @@ sonar.projectKey=storytold_figcraft sonar.organization=storytold +# Pinned integration-test fonts are data, not source code for analysis. +sonar.exclusions=craft-fonts/** + # S4790 (weak hash): a .fig file names each image by the SHA-1 of its bytes (20 bytes, the only # length readers accept). It is an identifier the format fixes, not a security choice. sonar.issue.ignore.multicriteria=fig_image_sha1 From 34ccbc83b6c0e4c7b1b777a5cadaa6f28a780bdc Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 14:57:10 +0000 Subject: [PATCH 234/239] ci: prefetch dependencies before Sonar coverage --- .github/workflows/sonarcloud.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 50616c871..a8872386f 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -16,8 +16,8 @@ concurrency: jobs: sonarcloud: - # Pin the coverage setup that checks out this repo's pinned craft-i18n data. - uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@ea24c9c24e1997238334182160f60e602e5bce32 + # Pin the coverage setup that provisions test data and fetches locked dependencies before offline metadata tests. + uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@5008f8cd1b011b35eed223a7d058d7a8e9075ef6 with: # The shared coverage archive's shards omit the CLI executable used by integration tests. # Run this repository's suite in one instrumented job and provide its pinned test data. From d5cdba8d3b7f5270f918f398cb9b2be2a668e44e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 15:56:31 +0000 Subject: [PATCH 235/239] Isolate concurrent font integration tests --- apps/figcraft-cli/tests/it/fonts.rs | 25 ++++++++++++++++++++++--- crates/text/src/fontdb_tests.rs | 14 ++++++++++++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/apps/figcraft-cli/tests/it/fonts.rs b/apps/figcraft-cli/tests/it/fonts.rs index 998665c48..a42fd9ce5 100644 --- a/apps/figcraft-cli/tests/it/fonts.rs +++ b/apps/figcraft-cli/tests/it/fonts.rs @@ -2,15 +2,21 @@ //! `--no-system-fonts` or `FIGCRAFT_NO_SYSTEM_FONTS=1` opts out. use std::process::Command; +use std::sync::atomic::{AtomicU64, Ordering}; use serde_json::{Value, json}; /// The result of one `figcraft-cli run` step (script file `name`); `opt_out` sets the environment /// variable. fn run_one(name: &str, step: Value, args: &[&str], opt_out: bool) -> Value { + static NEXT_SCRIPT: AtomicU64 = AtomicU64::new(0); let d = std::env::temp_dir().join(format!("figcraft-cli-fonts-{}", std::process::id())); std::fs::create_dir_all(&d).unwrap(); - let script = d.join(format!("{name}.json")); + // Tests in this binary run concurrently. `sketch_imports_keep_to_no_system_fonts` also calls + // `families`, so a shared `families.json` could be truncated while another child reads it; + // an empty script is valid and makes the CLI exit successfully without printing result JSON. + let sequence = NEXT_SCRIPT.fetch_add(1, Ordering::Relaxed); + let script = d.join(format!("{name}-{sequence}.json")); std::fs::write(&script, json!([step]).to_string()).unwrap(); let mut cmd = Command::new(env!("CARGO_BIN_EXE_figcraft-cli")); cmd.arg("run").arg(&script).args(args); @@ -20,8 +26,21 @@ fn run_one(name: &str, step: Value, args: &[&str], opt_out: bool) -> Value { cmd.env_remove("FIGCRAFT_NO_SYSTEM_FONTS"); } let out = cmd.output().unwrap(); - assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr)); - let line: Value = serde_json::from_slice(&out.stdout).unwrap(); + assert!( + out.status.success(), + "{name}: CLI status {:?}; stdout={:?}; stderr={}", + out.status.code(), + String::from_utf8_lossy(&out.stdout), + String::from_utf8_lossy(&out.stderr), + ); + let line: Value = serde_json::from_slice(&out.stdout).unwrap_or_else(|error| { + panic!( + "{name} {:?}: CLI returned success without JSON: {error}; stdout={:?}; stderr={}", + args, + String::from_utf8_lossy(&out.stdout), + String::from_utf8_lossy(&out.stderr), + ) + }); line["result"].clone() } diff --git a/crates/text/src/fontdb_tests.rs b/crates/text/src/fontdb_tests.rs index a3dd15396..bf459fe06 100644 --- a/crates/text/src/fontdb_tests.rs +++ b/crates/text/src/fontdb_tests.rs @@ -376,9 +376,19 @@ fn font_bytes_load_into_the_db() { let families = load_font_bytes(f.bytes.to_vec()); assert_eq!(families.len(), 1); assert!(families.iter().all(|f| has_family(f))); - let faces = db().read().unwrap().face_count(); + // The global face count can grow here when another test finishes the concurrent system + // font scan. Count explicitly loaded faces from this family so the idempotency assertion + // stays isolated from unrelated installed fonts. + let loaded_faces = || { + let db = db().read().unwrap(); + families + .iter() + .map(|family| db.faces.iter().filter(|face| face.loaded > 0 && face.family.eq_ignore_ascii_case(family)).count()) + .collect::>() + }; + let faces = loaded_faces(); assert_eq!(load_font_bytes(f.bytes.to_vec()), families); - assert_eq!(db().read().unwrap().face_count(), faces); + assert_eq!(loaded_faces(), faces); } } From 7644de9f810c6570e8d87d7bb54478fb0fc1730a Mon Sep 17 00:00:00 2001 From: Zinadin Zidan Date: Sat, 14 Nov 2026 02:36:36 +0600 Subject: [PATCH 236/239] Variables: renaming a group to a path with / nests it (#2353) Renaming a group in the Local variables window replaced every slash in the typed name with a hyphen, so "Palette/Orange" gave a flat Palette-Orange group and there was no way to move a group under a new parent. The typed path now replaces the group's last part, so a slash nests the group as in Figma: Orange/100 becomes Palette/Orange/100 and the sidebar shows Orange under Palette. Each part is trimmed and empty parts are dropped; a name that comes out empty or unchanged does nothing. The renames go deepest name first, so a group moved into its own new subgroup (Orange to Orange/Warm) never collides with a variable that is still to move. A rename onto a variable name that stays is refused by variable.update and the batch rolls back; it stays one undo step. --- crates/ui-egui/src/dialogs/variables_panel.rs | 82 ++++++++++++++++--- crates/ui-egui/src/variables_select_tests.rs | 79 ++++++++++++++++++ docs/components-parity.md | 3 +- 3 files changed, 152 insertions(+), 12 deletions(-) diff --git a/crates/ui-egui/src/dialogs/variables_panel.rs b/crates/ui-egui/src/dialogs/variables_panel.rs index 067d54ea9..21889fe29 100644 --- a/crates/ui-egui/src/dialogs/variables_panel.rs +++ b/crates/ui-egui/src/dialogs/variables_panel.rs @@ -594,23 +594,40 @@ fn group_rows(app: &mut FigApp, ui: &mut Ui, view: &View, coll: &Collection, st: } } -/// Rename the last part of group `g` of a collection (its variables `members`) to `new`: every -/// variable under it moves along (one undo step). -fn rename_group(app: &mut FigApp, members: &[&Variable], g: &str, new: &str, st: &mut Editor) { - let new = new.trim().replace('/', "-"); +/// What renaming group `g` (of the variables `members`) to `new` does: the group's new path and +/// each moved variable's (id, new name). `new` replaces the group's last part; a `/` in it nests +/// the group, as in Figma ("Palette/Orange" puts it in a group Palette, made if there is none). +/// Each part is trimmed and empty parts are dropped. The renames come deepest name first, so a +/// variable moving into the group's own new path ("Orange" to "Orange/Warm") never takes a name +/// another moved variable still holds. None when nothing changes. +fn group_renames(members: &[&Variable], g: &str, new: &str) -> Option<(String, Vec<(String, String)>)> { + let new = new.split('/').map(str::trim).filter(|p| !p.is_empty()).collect::>().join("/"); if new.is_empty() { - return; + return None; } let renamed = match g.rsplit_once('/') { Some((parent, _)) => format!("{parent}/{new}"), None => new, }; + if renamed == g { + return None; + } + let prefix = format!("{g}/"); + let mut moved: Vec<(&Variable, &str)> = members.iter().filter_map(|v| Some((*v, v.name.strip_prefix(&prefix)?))).collect(); + // A longer name can only be one a shorter one moves to: rename those out of the way first. + moved.sort_by_key(|(_, rest)| std::cmp::Reverse(rest.len())); + Some((renamed.clone(), moved.into_iter().map(|(v, rest)| (v.id.clone(), format!("{renamed}/{rest}"))).collect())) +} + +/// Rename group `g` of a collection (its variables `members`) to `new` (see [`group_renames`]): +/// every variable under it moves along, in one undo step. +fn rename_group(app: &mut FigApp, members: &[&Variable], g: &str, new: &str, st: &mut Editor) { + let Some((renamed, moves)) = group_renames(members, g, new) else { + return; + }; + let steps: Vec = + moves.iter().map(|(id, name)| json!({"command": "variable.update", "params": {"variable": id, "name": name}})).collect(); let prefix = format!("{g}/"); - let steps: Vec = members - .iter() - .filter(|v| v.name.starts_with(&prefix)) - .map(|v| json!({"command": "variable.update", "params": {"variable": v.id, "name": format!("{renamed}/{}", &v.name[prefix.len()..])}})) - .collect(); if app.run("command.batch", json!({"label": "Rename group", "commands": steps})).is_some() && st.group.as_deref().is_some_and(|s| s == g || s.starts_with(&prefix)) { @@ -1308,7 +1325,7 @@ fn bulk_details(app: &mut FigApp, ctx: &Context, vars: &Variables, st: &mut Edit #[cfg(test)] mod tests { - use super::{groups, tri}; + use super::{group_renames, groups, tri}; #[test] fn tri_is_checked_empty_or_mixed() { @@ -1330,4 +1347,47 @@ mod tests { assert_eq!(groups(names.into_iter()), ["color", "color/brand", "space"]); assert!(groups(["a", "b"].into_iter()).is_empty()); } + + /// The renames of group `g` among `names` (numbers in one collection) typed as `new`, by name. + fn renames(names: &[&str], g: &str, new: &str) -> Option<(String, Vec<(String, String)>)> { + let mut s = figcraft_engine::Session::new(); + s.execute("variable.createCollection", &serde_json::json!({"name": "Theme"})).unwrap(); + for n in names { + s.execute("variable.create", &serde_json::json!({"collection": "Theme", "name": n, "type": "number", "value": 1})).unwrap(); + } + let vars = &s.doc().unwrap().variables.variables; + let members: Vec<_> = vars.iter().collect(); + let (renamed, moves) = group_renames(&members, g, new)?; + let by_name = |id: &str| vars.iter().find(|v| v.id == id).unwrap().name.clone(); + Some((renamed, moves.into_iter().map(|(id, n)| (by_name(&id), n)).collect())) + } + + #[test] + fn a_slash_in_a_group_rename_nests_the_group_keeping_its_parent() { + let pair = |a: &str, b: &str| (a.to_string(), b.to_string()); + assert_eq!( + renames(&["Orange/100", "Orange/200", "Blue/100"], "Orange", "Palette/Orange"), + Some(("Palette/Orange".into(), vec![pair("Orange/100", "Palette/Orange/100"), pair("Orange/200", "Palette/Orange/200")])) + ); + assert_eq!( + renames(&["a/b/x"], "a/b", " / Warm // c / "), + Some(("a/Warm/c".into(), vec![pair("a/b/x", "a/Warm/c/x")])), + "parts are trimmed, empty parts dropped, and the parent stays" + ); + } + + #[test] + fn a_group_rename_to_nothing_or_to_itself_does_nothing() { + for new in ["", " ", "/", " / // ", "Orange", " Orange ", "/Orange/"] { + assert_eq!(renames(&["Orange/100"], "Orange", new), None, "{new:?}"); + } + assert_eq!(renames(&["a/b/x"], "a/b", "b/"), None); + } + + #[test] + fn a_group_moved_into_its_own_subgroup_renames_the_deeper_names_first() { + let (_, moves) = renames(&["Orange/100", "Orange/Warm/100"], "Orange", "Orange/Warm").unwrap(); + let order: Vec<&str> = moves.iter().map(|(old, _)| old.as_str()).collect(); + assert_eq!(order, ["Orange/Warm/100", "Orange/100"]); + } } diff --git a/crates/ui-egui/src/variables_select_tests.rs b/crates/ui-egui/src/variables_select_tests.rs index 3b32dc49d..c2b699eb8 100644 --- a/crates/ui-egui/src/variables_select_tests.rs +++ b/crates/ui-egui/src/variables_select_tests.rs @@ -332,6 +332,85 @@ fn a_second_duplicate_group_takes_the_next_free_name() { assert_eq!(n.len(), 6); } +/// A collection with the variables `names` (numbers). +fn named_window(names: &[&str]) -> Ui { + let mut s = Session::new(); + s.execute("variable.createCollection", &json!({"name": "Theme"})).unwrap(); + for n in names { + s.execute("variable.create", &json!({"collection": "Theme", "name": n, "type": "number", "value": 1})).unwrap(); + } + let mut u = Ui::new(s); + u.app.ui.variables = Some(Default::default()); + for _ in 0..10 { + u.frame(vec![]); + } + u +} + +/// Right-click the group row `name`, choose Rename group, type `to` and press Enter. +fn rename_group(u: &mut Ui, name: &str, to: &str) { + let p = row(u, name); + click(u, p, PointerButton::Secondary, Modifiers::NONE); + let menu = flat(&u.frame_output(vec![]).shapes); + click(u, text_center(&menu, "Rename group"), PointerButton::Primary, Modifiers::NONE); + u.frame(vec![Event::Text(to.into())]); + for pressed in [true, false] { + u.frame(vec![Event::Key { key: Key::Enter, physical_key: None, pressed, repeat: false, modifiers: Modifiers::NONE }]); + } + for _ in 0..5 { + u.frame(vec![]); + } +} + +fn sorted_names(u: &Ui) -> Vec { + let mut n = names(u); + n.sort(); + n +} + +#[test] +fn renaming_a_group_with_a_slash_nests_it_in_a_new_parent_group_in_one_undo_step() { + let mut u = named_window(&["Orange/100", "Orange/200", "Blue/100"]); + let before = u.app.session.undo_labels(100).len(); + rename_group(&mut u, "Orange", "Palette/Orange"); + assert!(u.app.ui.last_error.is_none(), "{:?}", u.app.ui.last_error); + assert_eq!(sorted_names(&u), ["Blue/100", "Palette/Orange/100", "Palette/Orange/200"]); + assert_eq!(u.app.session.undo_labels(100).len(), before + 1, "one undo step"); + assert_eq!(u.app.session.undo_labels(1), ["Rename group"]); + // The sidebar lists Palette with Orange indented under it. + let shapes = flat(&u.frame_output(vec![]).shapes); + let (parent, child) = (text_center(&shapes, "Palette"), text_center(&shapes, "Orange")); + assert!(child.y > parent.y && child.x > parent.x, "Orange is indented under Palette: {parent:?} {child:?}"); + assert!(!has_text(&shapes, "Palette-Orange")); + u.app.session.undo().unwrap(); + assert_eq!(sorted_names(&u), ["Blue/100", "Orange/100", "Orange/200"]); +} + +#[test] +fn a_nested_groups_new_path_stays_in_its_parent_and_drops_empty_parts() { + let mut u = named_window(&["Palette/Orange/100", "Palette/Orange/200"]); + rename_group(&mut u, "Orange", " /Warm // Orange / "); + assert!(u.app.ui.last_error.is_none(), "{:?}", u.app.ui.last_error); + assert_eq!(sorted_names(&u), ["Palette/Warm/Orange/100", "Palette/Warm/Orange/200"]); +} + +#[test] +fn renaming_a_group_into_its_own_new_subgroup_moves_the_deeper_names_first() { + // Orange/100 takes Orange/Warm/100, which itself moves on to Orange/Warm/Warm/100. + let mut u = named_window(&["Orange/100", "Orange/Warm/100"]); + rename_group(&mut u, "Orange", "Orange/Warm"); + assert!(u.app.ui.last_error.is_none(), "{:?}", u.app.ui.last_error); + assert_eq!(sorted_names(&u), ["Orange/Warm/100", "Orange/Warm/Warm/100"]); +} + +#[test] +fn a_group_rename_onto_a_variable_name_that_stays_changes_nothing() { + let mut u = named_window(&["Orange/100", "Orange/200", "Palette/Orange/100"]); + rename_group(&mut u, "Orange", "Palette/Orange"); + assert!(u.app.ui.last_error.as_deref().is_some_and(|e| e.contains("Palette/Orange/100")), "{:?}", u.app.ui.last_error); + assert_eq!(sorted_names(&u), ["Orange/100", "Orange/200", "Palette/Orange/100"]); +} + fn open_edit_variables(u: &mut Ui) -> Vec { let menu = select_three_and_open_menu(u); assert!(has_text(&menu, "Edit variables"), "the bulk menu offers Edit variables"); diff --git a/docs/components-parity.md b/docs/components-parity.md index 3d23800b0..8b7219b81 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-11-12 · **Change:** minor (a group's context menu in the Local variables window has Duplicate group, a copy named after it plus " 2" holding a copy of every variable, in one undo step (#2084); pages take a variable mode: with nothing selected the Design panel's Page section shows a Variable modes section, Auto or a mode of each collection that has more than one, as the help center says ("Apply variable mode" in the Page section of the right sidebar) (#2215); a text style binds a number variable to its weight (#2174); an instance lists only the properties its variant's layers use and long property names are cut to one line (#2022); with several layers selected the Design panel header's component button offers Create multiple components (#2088); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; 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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-14 · **Change:** minor (renaming a variable group to a path with `/` nests it under a parent group instead of turning the slash into a hyphen (#2353); a group's context menu in the Local variables window has Duplicate group, a copy named after it plus " 2" holding a copy of every variable, in one undo step (#2084); pages take a variable mode: with nothing selected the Design panel's Page section shows a Variable modes section, Auto or a mode of each collection that has more than one, as the help center says ("Apply variable mode" in the Page section of the right sidebar) (#2215); a text style binds a number variable to its weight (#2174); an instance lists only the properties its variant's layers use and long property names are cut to one line (#2022); with several layers selected the Design panel header's component button offers Create multiple components (#2088); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; 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 @@ -81,6 +81,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Date | Change | Summary | |---|---|---| +| 2026-11-14 | patch | M3, #2353: renaming a group in the Local variables window to a path with `/` nests it, as in Figma: `Orange` renamed to `Palette/Orange` moves its variables to `Palette/Orange/100`… and the sidebar shows Orange indented under a new Palette group, where the slash used to become a hyphen (`Palette-Orange`). The typed path replaces the group's last part (a nested group stays in its parent), each part is trimmed and empty parts are dropped; a rename onto a variable name that stays is refused with nothing changed, and it is one undo step. Tests: `variables_select_tests::renaming_a_group_with_a_slash_nests_it_in_a_new_parent_group_in_one_undo_step` and the group rename tests beside it, `variables_panel::tests`. Grade unchanged. | | 2026-11-07 | minor | M3, #2084: a group's context menu in the Local variables window has Duplicate group (after Rename group, before Delete group). It adds a group named after the original plus " 2" (the next free number when taken: " 3"), whose variables are copies of the originals with the same leaf names, values in every mode, description, scopes, hidden-from-publishing and code syntax, each sent as `variable.duplicate` plus a rename in one `command.batch` labelled Duplicate group, so one undo step. Measured in the incumbent with one mode; an alias to a variable of the same group keeps pointing at the original. Ungroup is not built. Tests: `variables_select_tests` (headless UI). Grade unchanged | | 2026-11-07 | minor | M3, #2082: Edit variables in the context menu of a selection of several local variables opens the reference's compact editor with two tabs: Details holds only Hide from publishing, Scope the scopes every selected variable's type has (All supported properties and one box per scope; a selection that shares none says so). Each box is checked when all selected variables have it, empty when none, and shows a dash when they differ; a click sets it on all (or clears it when checked on all), each change one `command.batch`, so one undo step. Names, descriptions and code syntax stay single-variable, as in the reference. The Scope: menu entries stay. A tri-state `widgets::checkbox_tri` draws the dash. Tests: `variables_select_tests` (headless UI). Grade unchanged | | 2026-11-12 | minor | M7, #2215: pages take a variable mode: with nothing selected the Design panel's Page section shows a Variable modes section, Auto or a mode of each collection that has more than one, as the help center says ("Apply variable mode" in the Page section of the right sidebar) (#2215). The same section the frames' Variable modes use (`variable.setMode` without layers sets the page's mode), one undo step per pick. Binding the page background to a variable is not in the reference and is not offered | From 70aeeee941a20cf232c883fd2369da5fd8c1cddb Mon Sep 17 00:00:00 2001 From: Zinadin Zidan Date: Sat, 14 Nov 2026 04:05:13 +0600 Subject: [PATCH 237/239] Variables: test that a refused group rename undoes the moves already made (#2353) The collision test's two moves had names of the same length, so the first one already collided and nothing was left to undo. With the existing name on the second move, the first moves, the second collides, and the test checks that the batch puts the first one back. --- crates/ui-egui/src/variables_select_tests.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/variables_select_tests.rs b/crates/ui-egui/src/variables_select_tests.rs index c2b699eb8..2d5bd3342 100644 --- a/crates/ui-egui/src/variables_select_tests.rs +++ b/crates/ui-egui/src/variables_select_tests.rs @@ -405,10 +405,11 @@ fn renaming_a_group_into_its_own_new_subgroup_moves_the_deeper_names_first() { #[test] fn a_group_rename_onto_a_variable_name_that_stays_changes_nothing() { - let mut u = named_window(&["Orange/100", "Orange/200", "Palette/Orange/100"]); + // Orange/100 moves first; Orange/200 then collides, and the move already made is undone. + let mut u = named_window(&["Orange/100", "Orange/200", "Palette/Orange/200"]); rename_group(&mut u, "Orange", "Palette/Orange"); - assert!(u.app.ui.last_error.as_deref().is_some_and(|e| e.contains("Palette/Orange/100")), "{:?}", u.app.ui.last_error); - assert_eq!(sorted_names(&u), ["Orange/100", "Orange/200", "Palette/Orange/100"]); + assert!(u.app.ui.last_error.as_deref().is_some_and(|e| e.contains("Palette/Orange/200")), "{:?}", u.app.ui.last_error); + assert_eq!(sorted_names(&u), ["Orange/100", "Orange/200", "Palette/Orange/200"]); } fn open_edit_variables(u: &mut Ui) -> Vec { From 92d0ffdc62828a02dadacc6bd0817af436a806df Mon Sep 17 00:00:00 2001 From: Zinadin Zidan Date: Sat, 14 Nov 2026 04:31:08 +0600 Subject: [PATCH 238/239] Variables: fix the move order in the group rename collision test (#2353) Both moves had names of the same length, so which one ran first came from the order of the variables. The first one now has a longer name, which the longest-first order always moves first, so the second one always collides after a move that has to be undone. --- crates/ui-egui/src/variables_select_tests.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/variables_select_tests.rs b/crates/ui-egui/src/variables_select_tests.rs index 2d5bd3342..bcc41463d 100644 --- a/crates/ui-egui/src/variables_select_tests.rs +++ b/crates/ui-egui/src/variables_select_tests.rs @@ -405,11 +405,12 @@ fn renaming_a_group_into_its_own_new_subgroup_moves_the_deeper_names_first() { #[test] fn a_group_rename_onto_a_variable_name_that_stays_changes_nothing() { - // Orange/100 moves first; Orange/200 then collides, and the move already made is undone. - let mut u = named_window(&["Orange/100", "Orange/200", "Palette/Orange/200"]); + // The longer name moves first, whatever the order of the variables: Orange/1000 moves, then + // Orange/200 collides, and the move already made is undone. + let mut u = named_window(&["Orange/1000", "Orange/200", "Palette/Orange/200"]); rename_group(&mut u, "Orange", "Palette/Orange"); assert!(u.app.ui.last_error.as_deref().is_some_and(|e| e.contains("Palette/Orange/200")), "{:?}", u.app.ui.last_error); - assert_eq!(sorted_names(&u), ["Orange/100", "Orange/200", "Palette/Orange/200"]); + assert_eq!(sorted_names(&u), ["Orange/1000", "Orange/200", "Palette/Orange/200"]); } fn open_edit_variables(u: &mut Ui) -> Vec { From 56061c42f1bcd2208182b98b4a55f80058ad3b4c Mon Sep 17 00:00:00 2001 From: FredApps Date: Sat, 14 Nov 2026 21:46:38 +0100 Subject: [PATCH 239/239] Release: FigCraft v0.19.0 --- Cargo.lock | 44 ++++++++++++++++++++++---------------------- Cargo.toml | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 37e09b205..cb1fdf9d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1785,7 +1785,7 @@ checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" [[package]] name = "figcraft" -version = "0.18.1" +version = "0.19.0" dependencies = [ "arboard", "craft-menu", @@ -1818,7 +1818,7 @@ dependencies = [ [[package]] name = "figcraft-cli" -version = "0.18.1" +version = "0.19.0" dependencies = [ "clap", "clap_complete", @@ -1836,7 +1836,7 @@ dependencies = [ [[package]] name = "figcraft-collab" -version = "0.18.1" +version = "0.19.0" dependencies = [ "base64 0.22.1", "chrono", @@ -1854,7 +1854,7 @@ dependencies = [ [[package]] name = "figcraft-collab-net" -version = "0.18.1" +version = "0.19.0" dependencies = [ "base64 0.22.1", "figcraft-collab", @@ -1877,7 +1877,7 @@ dependencies = [ [[package]] name = "figcraft-color" -version = "0.18.1" +version = "0.19.0" dependencies = [ "kurbo", "serde", @@ -1886,7 +1886,7 @@ dependencies = [ [[package]] name = "figcraft-doc" -version = "0.18.1" +version = "0.19.0" dependencies = [ "figcraft-color", "figcraft-geom", @@ -1899,7 +1899,7 @@ dependencies = [ [[package]] name = "figcraft-engine" -version = "0.18.1" +version = "0.19.0" dependencies = [ "base64 0.22.1", "craft-docpath", @@ -1933,7 +1933,7 @@ dependencies = [ [[package]] name = "figcraft-format" -version = "0.18.1" +version = "0.19.0" dependencies = [ "figcraft-doc", "figcraft-layout", @@ -1950,7 +1950,7 @@ dependencies = [ [[package]] name = "figcraft-geom" -version = "0.18.1" +version = "0.19.0" dependencies = [ "kurbo", "serde", @@ -1958,7 +1958,7 @@ dependencies = [ [[package]] name = "figcraft-layout" -version = "0.18.1" +version = "0.19.0" dependencies = [ "figcraft-doc", "figcraft-geom", @@ -1966,7 +1966,7 @@ dependencies = [ [[package]] name = "figcraft-mcp" -version = "0.18.1" +version = "0.19.0" dependencies = [ "base64 0.22.1", "figcraft-collab-net", @@ -1982,7 +1982,7 @@ dependencies = [ [[package]] name = "figcraft-pathops" -version = "0.18.1" +version = "0.19.0" dependencies = [ "figcraft-doc", "figcraft-geom", @@ -1991,7 +1991,7 @@ dependencies = [ [[package]] name = "figcraft-pdf" -version = "0.18.1" +version = "0.19.0" dependencies = [ "figcraft-color", "figcraft-doc", @@ -2008,7 +2008,7 @@ dependencies = [ [[package]] name = "figcraft-plugin" -version = "0.18.1" +version = "0.19.0" dependencies = [ "figcraft-color", "serde", @@ -2021,7 +2021,7 @@ dependencies = [ [[package]] name = "figcraft-render" -version = "0.18.1" +version = "0.19.0" dependencies = [ "crc32fast", "figcraft-color", @@ -2040,7 +2040,7 @@ dependencies = [ [[package]] name = "figcraft-server" -version = "0.18.1" +version = "0.19.0" dependencies = [ "chrono", "crc32fast", @@ -2065,7 +2065,7 @@ dependencies = [ [[package]] name = "figcraft-svg" -version = "0.18.1" +version = "0.19.0" dependencies = [ "base64 0.22.1", "figcraft-color", @@ -2081,7 +2081,7 @@ dependencies = [ [[package]] name = "figcraft-text" -version = "0.18.1" +version = "0.19.0" dependencies = [ "core-text", "craft-font-catalog", @@ -2099,7 +2099,7 @@ dependencies = [ [[package]] name = "figcraft-ui-egui" -version = "0.18.1" +version = "0.19.0" dependencies = [ "base64 0.22.1", "chrono", @@ -2127,7 +2127,7 @@ dependencies = [ [[package]] name = "figcraft-vectordrawable" -version = "0.18.1" +version = "0.19.0" dependencies = [ "figcraft-color", "figcraft-doc", @@ -2141,7 +2141,7 @@ dependencies = [ [[package]] name = "figcraft-web" -version = "0.18.1" +version = "0.19.0" dependencies = [ "base64 0.22.1", "craft-web-api", @@ -6764,7 +6764,7 @@ checksum = "9440ea3e5aeabb0ac63af70daf835274065238cdd0cec83418f417eae38bacee" [[package]] name = "xtask" -version = "0.18.1" +version = "0.19.0" dependencies = [ "figcraft-engine", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 0d6e387ad..e83b9cf00 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.18.1" +version = "0.19.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.95"