* SVG export: preserve document unit in viewBox and width/height (#864)
When exporting SVG documents with physical units (mm, cm, in, pc), emit
the physical unit suffix on the root <svg width=... height=...>
attributes while keeping viewBox numbers and inner coordinates in 1:1 points
per SVG 1.1 coords §7.10. This avoids the 75% scaling mismatch when opening
drawings in external tools such as Inkscape or LightBurn, and preserves
the document unit setting across save/open round trips. Unitless documents
(points, pixels) continue to emit unitless dimensions.
Tested via export_physical_units_writes_unit_suffixes in vectorcraft-svg
and full round-trip svg_round_trip_preserves_document_units in vectorcraft-engine.
Ran cargo xtask ci (fmt, clippy, tests, xtask gates).
* SVG export: preserve nonzero width and viewBox on extreme small dimensions
A transform no longer leaves locked guide paths in place: a guide in a
group moves with its group again, as on main. Keeping them put made
Align, Transform Each, the pixel-grid snap and Objects on Path measure or
place art the transform did not move. Scaling::keep_guides and its
engine wiring and test are removed.
The marquee rule now covers the rest of the selection side, while guides
are locked or hidden:
- the guide rule goes down the walk as an explicit Rules value instead
of a thread-local guard;
- an Enclosing Lasso loop does not take a compound path for its guide
contours;
- an enclosing marquee measures a group without its guide paths
(Node::without_guides);
- Direct Selection's marquee takes no anchor or crossed segment of a
guide path.
Docs: the Guides area row, its evidence entry and the M1 row describe
the marquee behaviour; status lines and revision rows say a guide in a
group still moves with it.
While guides were locked, a guide path inside a group was still touched by
a selection marquee, so the marquee selected the group and moving the
group moved the guide (#8538). Clicks already skip guides (#3074).
- hit: marquee_in_view and enclosure_candidates take skip_guides; the
Selection, Direct Selection, Group Selection and Enclosing Lasso tools
pass !cx.guides, and the marquee then touches no guide path at any depth.
- doc: Scaling::keep_guides leaves the guide paths among a group's,
layer's or Intertwine group's children in place, as a ruler guide in a
transformed layer already stays.
- engine: transforms (apply_transform), Transform Each and Align and
Distribute set it while Lock Guides is on; a copy takes a copy of the
guide with the copied art and leaves the original.
Fixes#8538
The writer passed no language to craft-pdf, so exported and printed
PDFs had no /Lang and accessibility checkers failed primary-language.
Writer::new now passes the BCP 47 tag of the Document Setup language
(new vectorcraft_doc::setup::language_tag, en-US by default) through
write::Writer::new_with_language, which writes the catalog's /Lang and
the XMP dc:language. A language with no tag writes none. /MarkInfo is
left for tagged PDF (#3643).
- `Unit::parse` keeps main's paragraph about units after `*` and `/` as it
was; the new `x` paragraph follows it, and the limit line names the
signs it counts again.
- `object.path.offsetPath` takes `"0.05x2 in"` (0.1 in), which it refused
before; `"0x10"` reads as 0 pt. docs/mcp.md states both.
A marquee across the shapes that the geometry effects of a symbol
instance's active fill or stroke paint outside its box now selects the
instance, as a click there does. An image is likewise touched where its
own fills and strokes paint outside its frame. Outline mode keeps the
box alone.
The Arrow Style dropdown in Dimension Tool Options and in the Properties
panel's Dimension section showed only the names Filled, Open, Tick and
None. Each style now shows its arrowhead at the end of a short line
before its name, in the open list and in the closed field, drawn with
the Stroke panel's arrowhead previews. The four styles and their saved
values are unchanged.
ArrowStyle::arrowhead holds the style-to-arrowhead mapping, so the
dimension line and the preview use the same head.
dropdown_icon_names_sized takes an icon size that is not square.
Part of #8049.
addon.units.convert reads its value through Unit::parse, so after the
merge of main it takes x, X and × as multiplication signs as well. Its
128-sign limit counted only + - * /. The new
vectorcraft_doc::arithmetic_signs counts each multiplication sign as a
*, and both Unit::parse and the converter use it.
- The converter's params text and docs/mcp.md list the signs.
- Tests cover 2pX3 and 2p×3 (6 picas), 8.5x11 in (refused before, now
93.5 in) and the converter's reading and limit.
- The test message says "millimeters", and the doc comments wrap at
the file's width.
DocState::proxy_mixed, which decides whether the Fill and Stroke proxies
show "?", walked every node of the document to find the selected
objects, even with one object selected. The Tools panel proxies, the
paint chips and the task bar ask for it on every frame whose revision
changed, which includes each frame of a drag preview, and new art asks
for it after a selection change.
Document::nodes_in_order finds every node with one of the given ids in
tree order. When the id cache holds each id once at a path that still
checks out, it reads the nodes along those paths; otherwise, and for a
selection of an eighth of the document or more, it walks the tree once,
as before. Unlike Document::index_paths it returns every node with a
repeated id, so a damaged file that repeats an id keeps the question
marks it had. proxy_mixed now gathers the selected objects through it.
Tests compare the result with a copy of the old walk for one object,
different fills and strokes, a group, a group with one of its objects,
two layers, a hidden object, Appearance items, picked gradient mesh
points beside another object, ids not in the document and a repeated id
with different paints, with the cache built and dropped, and for 200
random selections. A cost test shows that with one object selected only
that object is read and the tree is not walked. Document tests compare
nodes_in_order with a walk.
The gain shows on large documents. On 50,000 rectangles in 500 groups
on 5 layers (release build on Linux, thread CPU time, median of seven
alternating runs of both versions in one process; an ignored test,
proxy_mixed_timing, times them):
Selection old new
1 object 995 us under 5 us
2 objects, different fills 810 us under 5 us
a group of 100 875 us 5 us
all 500 groups 3,615 us 2,575 us
all 50,000 objects 4,075 us 3,470 us
Value fields and length strings read `x`, `X` and `×` as a
multiplication sign: `10x2` is 20, `2x3 mm` is 6 mm and `3cmx50%` is
1.5 cm. A lowercase `x` right after a `p` stays the `px` unit, so
`2px x 3` is 6 px and `2px3` is not read. The change is in
`Unit::parse` and `parse_number`, so every field that reads its text
through them takes it. Each sign counts toward the 128-sign limit,
which is checked before the text is copied.
Docs: docs/mcp.md, docs/ui-parity.md, docs/target-app-parity.md.
The Blend panel, the Object › Blend, Envelope Distort and Gradient Mesh
menu items and their commands looked up every ancestor of each selected
object by id to find its nearest blend, envelope or mesh, and dropped
repeats with a linear scan. They now read the object's cached place in
the tree once, test the nodes on that path, and keep a set of the ones
already listed. The checks of whether one is selected stop at the first
selected object that has one. An id that the lookup cache does not
place on that path (a repeated id, or a cache older than the tree) is
still looked up by id, so the results, their order and the errors are
the same. Explicit ids given to the live commands drop nested ones with
a set as well.
With Select All of 102,200 objects (100,000 rectangles, 2,000 blends and
200 envelopes), a release build took a median of 16.5 ms of thread CPU
time for the Blend check before and 0.5 ms after.