library.swap re-pointed style links and variable bindings only on layers
outside the read-only library copies. A copy the swap keeps (no match in
the other library, or another library's component using the swapped
style) kept the old style and variable, so instances placed after the
swap showed the old colours. The copies' own layers are re-pointed too.
Figma's REST API names a text's feature toggles style.opentypeFlags; the
importer looked for openTypeFlags, so features in real files (SF Pro's
SS16 large symbols on an iOS kit's back chevron) were dropped. The old
spelling is still read.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012eBDgsvRwsSRpWeWrzabVY
The reference tool's exports draw an image shown smaller than its pixels
as the area average under each device pixel, at its exact (fractional)
position: a 1254 px illustration at 265 px now matches pixel for pixel.
FigCraft sampled it bicubically at pixel centres, aliasing edges and
thin lines. Straight images scaled down along both axes are resampled
onto the device grid (crate::resample) on the canvas and in exports, so
both still agree; others keep the pattern sampling.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012eBDgsvRwsSRpWeWrzabVY
The reference tool's exports (and absoluteRenderBounds) take a drop
shadow as far as its blur radius, and leave out a layer without any
visible paint, effect or children. FigCraft framed shadows at three
standard deviations (1.5 x radius) and counted empty placeholders, so a
glass button exported 92 px instead of 76 and an illustration with an
empty 1448 px box exported at that size. Canvas culling keeps the full
reach; only Document::world_export_bounds frames this way.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012eBDgsvRwsSRpWeWrzabVY
The reference tool's saved layouts (derivedTextData) keep a pixel line
height's pitch exactly (22.5, 18.4) and round the self-sizing box's
total up to a whole pixel; only Auto and percentage line heights come
out whole. FigCraft rounded every line height, so a 22.5 px paragraph
drifted half a pixel per line.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012eBDgsvRwsSRpWeWrzabVY
A design kit's Light/Dark components switch variant through a `Mode`
string variable bound to the variant property. Imports dropped that:
dark screens showed the light variants.
- REST import reads boundVariables.componentProperties (variant, text
and boolean properties) as componentProperties/<name> bindings.
- An opened REST or .fig file settles them: each bound instance shows
the variant the variable names in its mode, outer instances first,
keeping its own overrides and the ones the mains around it make.
- A text reads a property its instance sets even when the variant set
lists it under another id (imported library copies do).
.fig needs craft-libs craft-fig with the RESOLVE_VARIANT mapping (local
commit edcc9d6d3). On a real-world iOS kit file: dark alerts 28%/20% and
the dark keyboard 38% differing pixels -> 2%, 1.4%, 1.7%.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012eBDgsvRwsSRpWeWrzabVY
Checked against renders of a synthetic file (9 scenes, each now under
0.2% differing pixels):
- a layer in a blend mode of its own (Normal included) blends its fills
among themselves only, then lays them over the canvas as one, with or
without effects;
- a pass-through frame's fills blend with the backdrop also when it has
drop or inner shadows (it drew as an isolated layer);
- drop shadows blend among themselves, then lie under the layer as one;
- inner shadows blend with the fills under them by their own mode;
- plus lighter adds premultiplied colours, alpha as source-over.
Found on iOS kit buttons imported from a .fig, which drew mid grey
instead of near white.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012eBDgsvRwsSRpWeWrzabVY
Figma sets a variable font's optical size to the text size (within the
axis), also for a named style; FigCraft keeps the named instance's (SF
Pro's is 28, its display cut), so imported SF Pro text at text sizes
came out about 14% narrower than in Figma. The .fig, paste and REST
imports now carry the size as the text's opsz value, as the .sketch
import already did (shared pass optical_size_follows_text_size).
Rule from the glyph advances Figma saves in derivedTextData, in a
real-world file and in a synthetic one saved from Figma's web app; Figma's
Inter has no optical size axis and keeps its advances at every size.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012eBDgsvRwsSRpWeWrzabVY
* M6: restore full JPEG export chroma
* M6: check the JPEG matte away from the painted edge
* docs: keep the parity header's change level and describe the JPG chroma fix
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: FredApps <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
A photo filling the width of a row (Fill container across, a fixed
height, its image cropped to the layer) was squashed when it went into
a row with a different amount of room: pasted next to a 516 pt column
instead of an 804 pt one it became 1092 by 969.15 instead of 804 by
969.15, and the cropped image stretched with it. Locking the aspect
ratio didn't help, because auto layout never read constrain_proportions.
flow_items now records the cross-per-main ratio of a child whose aspect
ratio is locked, which fills exactly one axis and is fixed on the other
(text excluded, and rotated layers too: layout reads a turned layer's
bounding box, whose ratio isn't the layer's own). Wherever the layout
sizes such a child on its filled axis (resize_fill_main_item, the
single-line cross fill before the lines are measured, and the stretch
across a hugging line), the fixed side follows at that ratio, within
its min and max; a filled side of zero leaves the fixed side as it is
rather than shrink the layer to nothing. Without the lock the fixed
side stays fixed, as before. Wrapping lines and grids are unchanged.
Figma never squashes a pasted image, lock or not. So a pasted layer
whose image is cropped to it (the one image mode that stretches with the
layer; Fill and Fit refit the image), landing in an auto layout frame
where it fills one axis and is fixed on the other, gets its aspect
ratio locked, and the layout above keeps its proportions. That includes
the instance a main component copied in its own file pastes as. Other
pasted layers keep their lock as copied.
The zoom-in rule compared each request with the last full render, but
the canvas replaces its image with every preview it is handed. A zoom out
that showed its preview and was reversed before refining was measured from
the obsolete full image: after a 1x render, a 0.25x preview (0.0625 pixels
per unit) and a 2x request, the 2x preview was suppressed although the
screen held an image eight times less dense, and the late preview too.
Renders now records the image it hands over: a preview, a full render and,
in the browser, a full render shown while it is drawn again (Refined::Shown).
The watchdog's late preview is followed by its request's refined image,
which the render thread records, so it needs no record of its own.
previews_cover_the_view_for_any_zoom_and_density asked for previews in a
row with nothing refined between, so a preview inside the one before at its
zoom is now rightly suppressed; it restores its full render before each.
Reported by FredApps in review.
When renders from scratch take longer than about a frame, every new zoom
got a coarse preview first (#312), with a quarter of the pixels each way.
After a zoom out that is right: the old image, re-projected, covers a small
part of the view. After a zoom in it covers all of it, and enlarged up to
4x it is at least as sharp as the preview. During a pinch or a held zoom
each step also dropped its refined image as soon as the next step's request
came, so the canvas stayed coarse until the zoom stopped.
Now a zoom in to at most PREVIEW_FACTOR times the image last shown, inside
the area that image covers, gets no preview, up front or from the watchdog:
the image on screen stands in until the refined one comes. Zoom outs, other
pages and files, larger zoom ins and zooms to an area the image doesn't
cover still get previews. The browser's banded renders take the same rule,
measured from the last image finished rather than one still being drawn.
The previews' doc comments in render_worker.rs and zoom_preview_tests.rs
still say "a new zoom"; they now hold for zoom outs and large zoom ins.
Measured in the app on a page of 11 000 layers and 237 images (M4 Max),
39 zoom steps from 10% to 200%, read through `ui.inspect`: before, 5 of
them showed a preview; with this change none did, each showed the refined
image, and full renders at those zooms took 5-14 ms.
Copy link to selection (edit.copyLink, Edit > Copy as) had no key. Figma
copies a link to the selection with Cmd+L; Figma's keyboard shortcut
articles don't list it, so the binding is pinned in the parity table
(58 undocumented bindings). With nothing selected it copies nothing, as
the menu item does.
The presenter kept its 32 pt padding at Actual size (100%) as well as at
Fit. A frame made at the window's size then had 64 pt less room than its
own width and height and panned both ways. In Figma a frame shown at
100% reaches the edges and only what is bigger than the window pans.
Actual size now takes the whole area; Fit keeps the padding and still
never goes above 100%. Frames smaller than the window stay centred, and
a frame bigger than the window starts centred across at its top as
before, now from the window's edge. The doc comment on layout() says
so.
Test: a_frame_the_size_of_the_window_shows_at_100_percent_without_panning
(a 1440x820 frame in the 1440x820 presenter; with the padding it panned
64 pt each way). presenter_scales_by_its_options_and_pans_what_overflows
now expects the 100% pan range without the padding.
- Export refuses to write over a connect file it can't read (not JSON, not an object, or over
4 MB) instead of replacing it with this design's links alone.
- Import skips an entry whose `values` is malformed, with a warning, instead of replacing the
component's link with one that maps nothing.
- `{Property ? "a" : "b"}` reads the design's value, so mapping Off to `inactive` doesn't make the
condition true.
- A `values` key that is only a parameter name (`state` for State) is reported as unknown, since
the mapping is read by property name and it would do nothing.
`inspect.designContext` wrote a component's links through `camel`, which renames keys at every
depth, so a mapped design value such as `extra_large` came out as `extraLarge`. Its components and
the code it gives each connected layer now use Code Connect's own link JSON: value names stay as
written, and the code carries the link's `source` and `notes`. Export also sorts its links once,
after merging the file's other links.
A link can say where the code component lives (`source`, a path inside the
repository), what a property's design values are called in code (`values`:
{"State": {"Hover": "hovered"}} renders `hovered`; a value without an entry
keeps its design name) and `notes`, through codeConnect.set, the connect file
and Inspect ▸ Connect to code (a Source file field and a row per variant
value). The fields are skipped when empty, so existing files and exports don't
change.
codeConnect.list and the MCP tool component_mappings say which code
component each design component is: import line, name, ready snippet,
properties and variants, and with a repository root whether each source file
is there. sync_mappings imports or exports a repository's connect file.
codeConnect.export {path} keeps the file's other top-level keys and the links
of components this design doesn't have, so several designs can share one file.
The engine draws superscript and subscript (#1868), but nothing in the
interface set them. Details now starts with Position: None, Superscript
or Subscript for the selected text layers, through text.setFeatures
(choosing one clears the other), showing the layers' current position
and none when they differ. Raising a range of characters on its own
needs per-run features and is left for later.
Shift did nothing with the Pencil: the stroke stayed freehand, while the
Line tool and the Pen keep theirs to 45° steps. pencil_add, shared by the
drag and the release, now keeps one straight segment from where the
stroke started to the pointer at the nearest 45° step while Shift is
held (the Marker and Highlighter too); a Shift-click without a move still
draws nothing.
In a right-to-left UI language the rows inside the panels run from the
right as well: the shared Design panel row (right::block), section
headers, tight_end, sub-labels, checkboxes, radios, disclosures and the
selection header, and the layers and pages lists (indent, disclosure,
icon and name from the right, eye and padlock on the left). Names and
rename fields align to their start.
Hand-placed layouts stay written left to right and are mirrored inside
their row with widgets::flip_x / flip_rect, so an English window takes
the same code path unchanged. Inside a control nothing turns round.
A layers list made wider than the panel by a long name (#1904)
mirrors across its whole width, so it starts scrolled to its right
end, where its rows start (stick_to_right, with a scroll state per
direction so a language switch doesn't leave it at the left end).
The Assets panel, version history, Dev Mode's layouts, the colour
picker, the toolbar, the tab bar and the home screen stay left to right.
Gap 5 had two copies of its "Missing" paragraph, left by merges: one
now.
#2468 moved SVG import onto craft_svg::tree::parse, which runs the size,
entity, attribute and nesting checks itself, but left FigCraft's own
scanners (too_wide, too_deep, nesting) and import/budget.rs unused and
import.rs unformatted: main failed cargo fmt, clippy -D warnings and the
svg tests, which still passed budget::Limits to import_within.
The dead code goes; budget_tests use craft-svg's tree::Limits (bytes,
embedded_bytes, embedded_depth) and its error texts, and hostile_tests
check attribute width with craft_svg::guard::too_wide at the default
limits and the nesting refusal at craft-svg's 256 levels.