Commit Graph
11 Commits
Author SHA1 Message Date
dotCooCoo cc52bf5042 Merge main into feat/field-x-multiply 2026-11-18 06:26:33 -08:00
BFlat 84c21a8b36 Merge pull request #8519 from dotCooCoo/perf/proxy-mixed-index-paths
Color: the Fill and Stroke proxies find the selected objects through the id cache
2026-11-18 13:52:56 +07:00
dotCooCoo a166087f55 Fields: test a product through a length param and keep upstream's doc text
- `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.
2026-11-17 22:36:30 -08:00
dotCooCoo 9ffca655cd Fields: count x signs in the Unit Converter's limit too
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.
2026-11-17 21:15:25 -08:00
dotCooCoo 0602c437da Color: the Fill and Stroke proxies find the selected objects through the id cache
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
2026-11-17 19:02:15 -08:00
dotCooCoo 51d09113f7 Fields: x multiplies in value fields, as * does
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.
2026-11-17 17:05:56 -08:00
dotCooCoo b029a20c2b Blend: selected blends, envelopes and meshes are found along one path per object
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.
2026-11-17 15:58:02 -08:00
dotCooCoo 8dfbe54db6 Units: a very long expression reads as nothing instead of overflowing the stack
Unit::parse took one level of recursion per + - * / sign, so a text such
as "1+1+...+1" with 200,000 terms overflowed the stack and aborted the
process. Every number field, parse_number and every command parameter read
as a length went through it.

Text with more than 128 + - * / signs now reads as nothing; text with 128
or fewer reads as before. docs/mcp.md states the limit for length strings.
The test a_very_long_expression_reads_as_nothing aborted with a stack
overflow before the change.
2026-11-14 16:26:09 -08:00
Taha-Mahmoodi 1b5d11ef4b Units: Preferences › East Asian Type reads, with Q and Ha units (#394)
Squashed from #4845 onto main.
2026-11-02 14:36:08 +07:00
NetterSilverandClaude Haiku 5.5 d0e1a045c1 Show 0.00 instead of -0.00 in Unit::readout for tiny negatives
Found while testing crates/doc/src/units.rs:163-165 (readout)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 19:43:17 +07:00
aiongg 371c93ffe5 refactor(doc): move tests_*.rs to tests/<topic>.rs 2026-10-26 18:26:53 +00:00