From the review of #2732:
- A segment is on the outline when the fill lies on one side of it, in the fill or outside it
when on both or neither. The loops alone don't say: a loop inside another that turns the
same way bounds nothing under the non-zero rule, and was stroked as outline.
- An inside stroke cut every line in the fill by the fill. Now only what shows past the
outline around a point where such a line ends on it: a line that goes through the fill
keeps its parts outside, and one close to the edge its whole stroke.
- A segment's middle comes from its own curve, not from a copy of the network.
- The stroke cache's key takes in the segments and the points' places: the loops name
segments by number, and two networks can have the same path with other numbers.
A network with a line across its fill (or a tail leaving it) was stroked at twice the
weight and cut by the stroke path read as a fill: such a line came out twice as thick as
the outline or not at all. The outline is now aligned as asked for and the other segments
are stroked on their centre.
The device-scale detail drawn over a tall frame's capped texture waited
out only a fling, a drag and the wheel. A zoom, a window resize, a move
to a display of another scale or any other change of the view rendered a
new detail, up to 16.8 million pixels on the UI thread, on every frame it
changed. Any change of the page area in view or of its pixel scale from
one frame to the next now counts as motion: the capped texture shows
alone meanwhile, and a frame is asked for so the detail for the still
view is rendered next.
The desktop app and figcraft-cli trusted only the compiled-in public
roots and FIGCRAFT_CA_FILE, so a server behind a proxy with a private
authority needed that variable on every computer. They now also add the
authorities in the operating system's certificate store, unless
FIGCRAFT_NO_SYSTEM_ROOTS is set. Certificates are still always
verified.
A whiteboard file's connectors came in as loose vectors, so moving a
shape left them behind. On a whiteboard the mapper's adapter now writes
a board connector on each connector drawn as one line on the page: its
ends name the layers it joins (a named magnet is that side, an automatic
one the side facing the other end, an end without a magnet keeps its
point on the layer) or a free page point, with its routing. The REST
importer makes the vector a native board connector once every layer is
in, so the board routes it again when what it joins moves. The import
report counts only the connectors that stayed vectors. Labelled
connectors, connectors inside frames and connectors in design files are
unchanged.
Text in a family that isn't installed drew in the default face (Inter,
Helvetica... in Regular) whatever the family and style, so code set in
Menlo came out proportional and SF Pro Bold came out regular. A small
table now picks an installed stand-in of similar design and width for
the common UI and code families, in the style asked. The family stays
reported as missing.
Unlinking the copied styles for a paste into another file cleared
cornerStyle too, which then failed as a bad value: it is a value
(round, chamfer, concave), not a link. Both paths now share one check.
An edit that turned another layer Fixed (a child set to Fill turning its
hugging parent Fixed, a frame set to Hug turning the children that filled
it Fixed) only showed the canvas notice, so a script got no hint why a
frame stopped growing. node.set now lists each such layer in `warnings`
with its id, name, key and old sizing.
A variant grown or moved past a component set that clips and has no auto
layout keeps being cut off (the set is sized only when variants are
combined or added). node.set now names such a variant in `warnings` and
points at layout.add on the set.
Changing a stroke weight, corner radius or any other value by scrubbing
its field left the selection's frame and handles over the layer, so the
result couldn't be judged without deselecting. While a field is scrubbed
(the shared widgets::scrub gesture, used by every number field and the
typography icons) the canvas now hides the selection's frame, handles
and size label, as it already did while the colour picker is used, and
draws them again once the drag is let go. A press without a drag leaves
them.
An ignored release test that builds a 120k-layer file over 15 pages and
times the server's welcome, Client::join and the engine opening it
through live_poll, for the delta catch-up and the full snapshot:
cargo test --release -p figcraft-engine --lib join_timings -- --ignored --nocapture
It runs natively, where the web heap's page-by-page growth doesn't
happen, so it times decode and apply work only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On wasm32-unknown-unknown, Rust's allocator (dlmalloc) grows the memory
one 64 KiB page at a time whenever it runs out, and the browser changes
the protection of the whole memory at each grow. The reporter's
121k-layer join made about 20,400 grows and spent 176 s of a 3-minute
freeze in them on Windows.
Memory dlmalloc got is reused once freed and never given back, so
allocating one large block and freeing it at once leaves that much free
room, for one grow. heap::keep_ahead does this whenever the memory grew
since its last call: half the heap again, at most 256 MiB at a time.
It acts only while a snapshot is read: a heap::reading() guard is held
by the delta snapshot decode, by unpacking a packed welcome and by
Replica::from_snapshot, and dropped on every exit path. Inside that
window it runs between delta records and vectors, between changes in
Replica::apply, and for each JSON value read from a full snapshot. The
same hooks run for live batches, where they return at once. Off wasm32
they always return at once. All of it is safe code: a fallible
reservation, then black_box so the optimizer keeps the allocation.
Measured with Client::join on an encoded 120k-layer welcome, in a
standalone wasm32 module under Node on macOS (three runs each, same
window). The shipped figcraft-web build, Chrome and Windows were not
measured:
- delta catch-up: 607-616 ms -> 433-449 ms; the memory grew twice
between hook calls, each followed by one reservation (the baseline
grew by 3,800 pages, at most one grow each); peak memory 241 -> 308 MiB
- full-snapshot catch-up (an older server): 3.6-3.9 s before the previous
commit, 1.27 s after it, 407-417 ms with this one; 4 reservations;
peak memory 455 -> 674 MiB against the previous commit (722 MiB
before both)
The extra peak memory is the room reserved ahead and not used.
This covers the allocations inside the decode and apply. Opening the tab,
the first layout and the first paint run outside every hook and were not
measured.
--initial-memory doesn't help: with the std that Rust 1.96 links, a probe
still grew page by page above a 256 MiB initial memory.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replica::from_snapshot borrowed the changes and cloned the whole
Vec<Change> before applying it, because the review-settings clamp
rewrites some of them in place. Every caller already owns the snapshot
(Client::join, the rejoin path, Server::restore), so it now takes the
Vec by value: a large file's snapshot is no longer copied and then
dropped twice on the way in. The server's publish path still borrows
and copies explicitly.
In a wasm32 build joining a 120k-layer file through the full-snapshot
catch-up (what an older server sends), this cut peak memory from 722 MiB
to 455 MiB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>