Commit Graph
1556 Commits
Author SHA1 Message Date
.CooCoo 9bdfcf7347 Merge pull request #10925 from dotCooCoo/fix/anchor-tools-type-on-path
Fix #10862: anchor tools and Pen + Alt edit the path of type on a path
2026-12-05 04:25:59 -08:00
dotCooCoo 402ff3024e Fix #10902: PDF spot images and image masks keep their fill overprint
PDF import read overprint for paths and text only, so an image in a
Separation space or an image mask drawn under /op true opened knocking
out, and a separations export of the document lost the ink beneath it.
The interpreter reports the graphics state's overprint before each
image; the importer now keeps the fill's on the image's colorize paint,
as the .ai reader does.

- Each draw of an image takes the state of that draw, so one XObject
  drawn twice can overprint once and knock out once.
- A process color overprinting in mode 0 gives the same warning as a
  path does.
- A page whose paths can't be counted drops the paths' overprint and
  keeps the images'.
- An isolated group holding an overprinting image stays isolated.
- Images read inside pattern cells, soft masks and type 3 glyphs knock
  out, as paths there do.
2026-12-04 23:48:23 -08:00
dotCooCoo eb320aefbb Fix #10862: anchor tools and Pen + Alt edit the path of type on a path
The Anchor Point tool, the Add and Delete Anchor Point tools, Pen + Alt
and the Pen's Auto Add/Delete only picked anchors of plain paths, and
the path.* anchor commands refused type on a path ("object #N is not a
path"), so dragging an anchor of type on a path's path did not pull
handles out, as it does on a path.

- The tools pick the anchors and segments of selected type on a path
  outside perspective, and draw its anchors and handles; Scissors still
  does not cut it.
- path.convertAnchor, path.reshapeSegment, path.setHandle,
  path.moveAnchor, path.insertAnchor and path.removeAnchor edit the
  type's path in document space through its transform; the type lays
  out again and its brackets keep their fractions of the path.
  path.removeAnchor refuses to leave it fewer than two anchors.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-12-04 23:43:12 -08:00
.CooCoo 48488547af Merge pull request #10856 from dotCooCoo/fix/live-corners-keep-straightened-radius
Live Corners: a straightened corner rounds again when a later move bends it
2026-12-04 17:59:11 -08:00
.CooCoo e24c62bf75 Merge pull request #10836 from dotCooCoo/fix/preview-new-id-lookups
Lookups: previews find an object added since the press without walking the tree
2026-12-04 14:20:07 -08:00
dotCooCoo de2a7a958b Live Corners: a pixel-grid snap converts relative radii as an anchor move does
With relative rounding, a move that bent a straightened corner converted
its stored radius to a fraction of the bent corner's maximum. When the
pixel-grid snap then straightened the corner again, the radius stayed in
those units, so the move changed the radius and recorded an undo step
although no anchor moved, and the corner rounded at the wrong size when
bent later. The snap of a path with Live Corners now converts the radii
of corners it straightens or bends, with the same rule as an anchor
edit, and a move the snap takes back counts as no change when the radii
differ only by rounding.

The help of object.setLiveShape, path.moveAnchor and path.moveAnchors
and docs/mcp.md now say that a straightened corner keeps its radius and
the path stays live.
2026-12-04 12:59:02 -08:00
dotCooCoo ab55c77d89 Live Corners: a straightened corner keeps its radius through a change of radius mode 2026-12-04 12:04:00 -08:00
dotCooCoo 1406dc8604 Live Corners: a straightened corner rounds again when a later move bends it
Moving the anchor of a path's only rounded corner into a straight line kept
its radius, but the next anchor move found no corner drawn with an arc and
edited the drawn path instead, dropping the live shape and its radius.
edit_corner_anchors now decides on the stored radii, so the corner rounds
again once a move bends it.
2026-12-04 11:29:52 -08:00
.CooCoo d742a49341 Merge pull request #10793 from dotCooCoo/fix/font-size-draft-target
Type: an unfinished Font Size value stays with the text it was typed for
2026-12-04 10:15:25 -08:00
.CooCoo ddff0adfbf Merge pull request #10747 from dotCooCoo/feat/live-star-points
Shapes: stars stay live with an editable point count
2026-12-04 08:12:18 -08:00
.CooCoo a9ba1b3134 Merge pull request #10742 from dotCooCoo/fix/live-corners-anchor-edits
Live Corners: corners stay live after anchor moves
2026-12-04 07:12:48 -08:00
dotCooCoo 4fa03c1e22 Tests: node finds an added object without copying its index path
copies_that_add_an_object_find_it_without_walking_again now also checks
that Document::node, in each of the 20 copies, reads the kept path for
the added object in place instead of copying it.
2026-12-04 06:25:52 -08:00
dotCooCoo 177d0c6700 Shapes: a whole star stays live whatever its pie angles hold
A whole star draws every point, so its pie angles no longer stop it
from being stored as a live star. Angles configured on any whole shape
are stored with it, so a later arc mode change uses them.

A corner list longer than the old corner count drops its entries past
the last corner before it is spread, so the corners a new point or
side count adds are sharp and keep the default kind.
2026-12-04 05:56:09 -08:00
dotCooCoo 8a136e25ce Lookups: previews find an object added since the press without walking the tree
Every preview of a drag starts again from the document as it was at the
press. Its lookup cache does not hold the object the drag adds (a Pencil
or Pen path, a shape), so each lookup of that object walked the whole
tree, about twice per preview, and the cache was rebuilt only in the
preview's own copy.

The cache now keeps, beside its table, the index path a walk found for an
id the table does not have. Every copy that shares the table reads it and
checks it against its own tree before using it, as it does the table's
paths, so later previews find the new object at that path. Repeated
nodes_in_order calls for such an id count toward a rebuild of the table,
and remove and move_node take the parent and the index from one lookup.
2026-12-04 02:35:23 -08:00
dotCooCoo b3f5c22633 Shapes: a live star keeps a small ratio and its corners through edits
A live star whose ratio is below 0.01, which object.setLiveShape takes,
lost its inner radius and its live shape when addon.shapes.configure
changed another value: the stored ratio was clamped to 0.01 when the
star was drawn and no longer counted as live. Any ratio from 0 to 1 now
draws and stays live as it is.

A corner list shorter than the star's or polygon's corners counted as
one shared radius, so a new point or side count gave the missing corners
the first corner's radius. The missing corners now stay sharp.

A ratio that changes which corners a rounded star cuts is now an error
with radius or kind in the same call, as points is, since the corners
selected before it no longer name the same corners. The anchor selection
is dropped by the same check.
2026-12-04 01:01:51 -08:00
dotCooCoo 20a5b6eb50 Merge main into fix/doc-tests-unsafe-code 2026-12-03 19:53:53 -08:00
dotCooCoo bebaebdbe4 Type: an unfinished Font Size value stays with the text it was typed for
The Font Size field of the Control bar and the Contextual Task Bar kept a
value typed and not yet committed when other text with the same size was
selected, and the next Enter applied it there: 3+ typed for one text
object, then 1 and Enter with another selected, gave the second one 4 pt.

The field now passes an edit target to NumberField::edit_target: the
document, its File > Revert count, its Undo and Redo restore count (after
which a node id can name another object), and the text text.setStyle
changes (format_target): the range or story the Type tool has selected,
the whole edited text at a caret, else the selected stories. When it
changes, the field drops the unfinished value.

The range is clamped to the text, so Select All over characters that are
already selected keeps the value, and a range over the whole text counts
as a caret, which also changes the whole text. While Real-time Drawing off leaves
typing unapplied, the range is the Type tool's own offsets clamped to the
length the text has with that typing, so a range reaching into it is
another range than the applied text it starts in, and keeping the typing
keeps the value. In a threaded frame, where keeping the typing can reflow
text from the other frames, the offsets are not clamped.

SymbolPart derives Hash so the target can hold it.
2026-12-03 12:50:25 -08:00
dotCooCoo cb284a53c0 Shapes: saves for older versions write a live star as its path
A save for format versions 1 to 3 wrote `live: {shape: "star"}`, which
those versions' readers reject, so the file did not open there. These
saves now drop the live star and keep the outline it draws as a plain
path, in the layers, symbols, graph designs, patterns, opacity masks
and brush definitions. The current version keeps the star live.
2026-12-03 10:24:15 -08:00
dotCooCoo 9c11c47f75 Doc tests: unsafe code is denied in doc tests too
Rustdoc builds each doc test as its own crate, without the workspace's
`unsafe_code = "deny"` and without a library's `#![forbid(unsafe_code)]`,
so a doc test holding an `unsafe` block passed `cargo test --doc`.

- Every library root now carries `#![doc(test(attr(forbid(unsafe_code))))]`,
  or `deny` in cad, eps and metafile, which rely on the workspace lint.
- `cargo xtask layers` reports a library whose doc tests are missing the
  attribute, or use `deny` where the library forbids unsafe code.
- AGENTS.md names the rule next to the `unsafe` allowlist.
2026-12-03 09:51:28 -08:00
dotCooCoo c1efe27ff7 Merge main into fix/blend-round-corners 2026-12-03 09:09:26 -08:00
dotCooCoo 5eb3adea28 Live Corners: selection and key anchor follow every recut
The selected anchors and the key anchor of a path with rounded Live
Corners now follow its corners whenever the anchors as drawn change:
after a move recuts the corners, and after the pixel-grid snap of a
pixel-aligned path cuts them again. Before, the snap's recut left the
selection on the old indices, and the key anchor was never remapped.

- A move of selected anchors that the pixel-grid snap puts back where
  it was leaves the document unchanged and records no undo step.
- object.move and object.transform params text describe the recut of
  the uncut corners when they move direct-selected anchors.
2026-12-03 09:05:16 -08:00
dotCooCoo 5aadf6c616 Shapes: stars stay live with an editable point count
A star drawn with the Star tool, shape.star or addon.shapes.star was a
plain path, so its point count could not change after it was drawn.

- LiveShape::Star keeps the outer and inner radii, the point count
  (2 to 1000, clamped when read from a file) and Live Corners' radii and
  kinds. Its corners keep the radius they shared through a new count.
- object.setLiveShape takes `points` (2 to 1000) and `ratio` (inner
  radius over outer radius, above 0 and up to 1), one undo step each and
  none when nothing changes. A new layout drops the star's selected
  anchors and segments; `points` with `radius` or `kind` is an error.
- The side widget shows on a live star and sets 3 to 20 points.
- Star Properties in the Transform panel and the Properties panel's
  Transform section have a Points field with a 3 to 20 slider and a
  Ratio field.
- Shape Tools' configure keeps a whole star live.

Fixes #4339
2026-12-03 08:54:44 -08:00
dotCooCoo de8cb948ea Live Corners: corners stay live after anchor moves
Moving an anchor of a path with rounded corners (Direct Selection drag,
arrow keys, path.moveAnchor, path.moveAnchors) threw away the live shape
and left the arcs as plain anchors, so the corner widgets disappeared.

The move now goes to the anchor of the uncut outline the drawn anchor
comes from, and the corners are cut again at their radii and kinds. A
live rectangle or polygon becomes a path with live corners. When the
recut changes the anchor layout, the selection is remapped through the
uncut outline and selected segments are cleared.

A path still becomes plain when it has no rounded corner, when a live
rectangle is sheared or scaled unevenly, when an arrow-key nudge bends or
holds curved segments, or for a transform other than a move.

Part of #10545.
2026-12-03 07:45:26 -08:00
.CooCoo 4f0d45d555 Merge pull request #10444 from dotCooCoo/fix/web-image-paste-speed
Paste: a bitmap copied in another app is not encoded and decoded again
2026-12-03 07:25:43 -08:00
.CooCoo 83f980389b Merge pull request #10200 from dotCooCoo/fix/empty-press-hit-once
Selection: a press that hits nothing checks only masked selected art for a way to click it
2026-12-03 07:20:03 -08:00
dotCooCoo 988a9b9193 Blend: test that unlike corner kinds keep the path route and steps keep the fill rule
Keys whose corner kinds differ blend anchor by anchor, and the last step
is the second key's outline. Steps between live rectangles keep the fill
rule of the key they are nearer and stay live rectangles.
2026-12-03 07:02:16 -08:00
dotCooCoo 3537d1bb60 Blend: live rectangle steps need keys with no scale left in their transforms
Live rectangle steps keep the first key's rotation and reflection. A
key whose transform still held a scale could pass the comparison with
a large scale on one axis hiding a difference on the other, and Align
to Path then folded that scale into each step, so its corners changed
shape along the spine. Only keys whose transforms are a rotation or a
reflection, the same for both, now take the live rectangle route; the
rest keep anchor matching.
2026-12-03 06:47:40 -08:00
dotCooCoo b4580f9fb9 Blend: steps between rounded rectangles keep round corners
Steps between two live rectangles were made by matching the keys'
anchors and moving each anchor and handle in a straight line. When the
keys' corners had different anchor layouts (a sharp rectangle and a
rounded one, or radii too large for one key), the steps' corners came
out as skewed curves, and every step lost its live rectangle.

Steps between two live rectangles with the same corner kinds and the
same rotation, reflection and shear are now live rectangles whose
width, height, position and corner radii lie between the keys'. Each
key's radii are the radii it draws, so a stored radius too large for
its rectangle counts as the largest that fits. A start anchor given for
either key, and every other pair, keep anchor matching.

Fixes #10707
2026-12-03 06:42:11 -08:00
dotCooCoo 47a8bcde18 Merge main into feat/scripts-api-d8b-tracing 2026-12-02 02:46:39 -08:00
.CooCoo 68b01f3a5d Merge pull request #10480 from dotCooCoo/fix/wrap-sources-no-copies
Text Wrap: Make's no-type warning checks the wrap objects without copying their shapes
2026-12-02 02:02:39 -08:00
dotCooCoo 4bcdc5d77c Merge main into feat/scripts-api-d8b-tracing 2026-12-02 01:26:36 -08:00
dotCooCoo beeeacafe5 Tests: text and doc tests check what the code returns, not only that it is there
Tests in vectorcraft-text and vectorcraft-doc that could pass on an empty
result, or that only checked a result exists, now assert the values:

- Blend: gradient steps assert their stop count before checking each
  stop's swatch, tint and plates; the odd dash blended to solid asserts
  the whole pattern; a copied step asserts its members.
- Symbols: limiting depth keeps every symbol; a stroke override on type
  keeps the run it styles.
- File fonts: an extreme descent clamps to the lowest table value and
  the Windows descent still fits.
- Invert wrap on a tangled shape asserts the line still meets it.
- Bidi, ligature carets, Thai and whitespace fallback: the glyph and
  line counts are asserted, Hebrew points stay in their letters'
  clusters, and every character of an isolate test has a glyph.
- Glyph categories, trace views, compound shape modes and digit
  systems check written-out ids instead of a round trip over every
  value.

Removed joins_on_a_circle_are_measured, which printed measurements and
asserted nothing, and chord_placement_leaves_the_join_gap_above_the_baseline,
which checked arithmetic done in the test itself;
joined_glyphs_meet_on_a_curved_path covers joined type on a curve.
2026-12-01 17:25:24 -08:00
dotCooCoo 6de89eece9 Merge main into feat/scripts-api-d8b-tracing 2026-12-01 09:00:59 -08:00
dotCooCoo c683302d4e Text Wrap: Make's no-type warning checks the wrap objects without copying their shapes
Make Text Wrap called wrap_sources to learn whether a new wrap object
sits above area type, which copied every wrap shape of every area text
object in the document into text space and threw the copies away.
wrap_source_objects gives the same text objects and wrap objects without
making those copies, and Make uses it.
2026-12-01 09:00:09 -08:00
dotCooCoo a992850228 Merge main into feat/color-randomly
# Conflicts:
#	crates/mcp/src/ui_catalog.rs
#	crates/ui-egui/src/menus/ui_commands.rs
2026-12-01 06:26:48 -08:00
dotCooCoo 0632cbee81 Merge main into feat/scripts-api-d8b-tracing 2026-12-01 03:41:15 -08:00
dotCooCoo ea828714fb Paste: a bitmap copied in another app is not encoded and decoded again
A paste of a picture copied in a browser or another app read the
clipboard's pixels, encoded them as PNG, then decoded that PNG again to
check it before keeping it. The paste now encodes the pixels once for the
document and keeps the pixels it already has as the decoded image the
canvas draws, so the read decodes nothing.

decode::decodes counts the images decode_image decodes on a thread, and
the new test checks that such a paste decodes none.
2026-12-01 02:42:07 -08:00
dotCooCoo d0cf7f09ec Tests: format tests check exact values instead of wide tolerances
The PDF, EPS, SVG mesh, metafile hatch and distorted-image tests now
assert the values the input gives: the Letter page a page without area
falls back to, the H glyph's box from its font metrics, the middle gray
of each mesh piece, the 8 of 64 hatch pixels, and the bounds of the
placement taken at the image's center.
2026-12-01 02:05:29 -08:00
dotCooCoo eadf345932 Merge main into feat/color-randomly 2026-12-01 01:04:32 -08:00
dotCooCoo 795bef8b29 Scripts: retrace refuses a tracing that holds artwork its trace did not make
imageTrace.make records the ids of the objects it made in the tracing's
trace settings as `made`, and copying the tracing records the ids of their
copies. Tracing again through the scripting API throws, with nothing
changed, when the tracing holds any other object, whether it was added in
this run, an earlier run or by a command. A tracing saved without `made`
is checked only for objects added in the same run, as before.
2026-11-30 17:54:54 -08:00
dotCooCoo 7310a8eb4f Dimension: Alt whole-path measure takes the outside of the stroke with Use Preview Bounds off too
With Alt held, the Dimension tool's box over a path and the dimension of
the whole path it places now reach the outside of the path's strokes
whether Use Preview Bounds is on or off. Before, they did so only with
Use Preview Bounds on, and with it off they went through the outermost
points of the path.

Every dimension of a whole path the tool places now records
`"preview": true` in its extent source. Dimensions saved without it keep
measuring between the outermost points, and `dimension.create` still
defaults `preview` to false.
2026-11-30 07:49:50 -08:00
dotCooCoo ab9d347209 Selection: a press that hits nothing checks only masked selected art for a way to click it
When a press with the Selection, Direct Selection or Group Selection tool
hits no object, `selected_hidden_at` looks for a selected object whose art
a clipping mask hides under the pointer. It worked out how a click reaches
each selected object (`path_options`, which searches every parent's
children for the next node) before checking whether any mask hides it, and
then discarded the result for every object no mask hides. It now checks
the mask first and works out the click path only for masked art. With
3,000 selected squares and no clip, a press beside them made 3,000
`path_options` calls and now makes none. The objects found are unchanged.
2026-11-29 23:03:56 -08:00
.CooCoo ff60b8078d Merge pull request #10132 from dotCooCoo/fix/speed-object-move-large-doc
Performance: an edit skips unchanged objects without reading them
2026-11-29 18:21:16 -08:00
dotCooCoo 5fccf73431 Color Effects: Randomize Fill Colors colors compound marks in a graph series
A compound path or live compound shape directly in a graph series group now
takes a color. Generated column, marker and legend swatch copies carry a new
graph_design_art flag and keep their design's fill; in documents saved before
the flag, a compound in a series whose assigned design is itself a compound is
still treated as design art. Paths a user groups inside a series keep their
fills, as for paint.setFill. Nested members resolve to the outermost compound
in one walk of the ancestry, and series membership is looked up once per run.
2026-11-29 18:02:26 -08:00
dotCooCoo aaa54f1307 Performance: an edit skips unchanged objects without reading them
After every edit, the pixel grid, color mask, Objects on Path, Shaper and
symbol instance passes, and the inline graphics refresh, pair each object
with its counterpart from before the edit. Each pass read both objects to
compare their ids before it found that they were the same node, so moving
one object in a layer of 20,000 objects read all of them in four passes.
The color mask pass is new since v0.24.1, and object.move became slower
than in that release.

The new vectorcraft_doc::changed_nodes does the pairing for all six. An
object that is the same node at the same position is skipped by a pointer
comparison; only changed and new objects are looked up by id.

object.move of one rectangle in a document of 20,000 objects, release
build, median CPU time of 2,000 moves: main 1.25 ms, this change 1.08 ms,
v0.24.1 1.06 ms. The passes' share of the move went from about 30% to 5%
in a profile.
2026-11-29 13:03:07 -08:00
dotCooCoo dd8c06017b Merge main into fix/hit-cull-reach-plain-paths 2026-11-29 11:41:18 -08:00
.CooCoo 1772dfcce3 Merge pull request #10107 from dotCooCoo/fix/control-bounds-flat-walk
Performance: paths keep their control-point box, so a hover reads no anchors
2026-11-29 11:26:32 -08:00
dotCooCoo 65ebc72ec4 Performance: a hover reads each plain path's effects once
The culling box of every path a click or hover passes asked whether the
path draws geometry effects by reading its effects twice: once on the
path itself, and again in the walk of the path and what it holds, which
starts at the path. The walk alone now answers, so a hover over many
plain paths reads half as much.

The walk also stops at the first object with an effect, for drawn art
and for a clipping path's region, instead of visiting every member of a
large compound path or group after the answer is known.
2026-11-29 11:22:27 -08:00
dotCooCoo c10d62d027 Performance: paths keep their control-point box, so a hover reads no anchors
Hit walks measure every path's culling box with PathData::control_bounds,
which read every anchor of the path on every call. Since anchors are kept
in shared chunks, that read follows two more pointers per path and goes
through the chunked iterator, so each node of a hover or cursor walk cost
about twice what it did before the chunks.

Each subpath's anchor list now keeps the box round its points and handles
once it is measured (Anchors::control_bounds), and every change to the
list clears it. A copy of the list keeps the box too. control_bounds
unions the subpaths' boxes, with the same result as before.

- anchors.rs: control_bounds reads the anchors once until they change,
  counted by measured_control_anchors; each change to the list clears it.
- Tests count the anchors read: a list reads them once across calls and
  copies, again after each kind of change, and a hover past 100 squares
  reads none after the first.
2026-11-29 10:19:29 -08:00
dotCooCoo 9aa6f7cdae Selection: a click or hover that hits nothing walks the document once
A hit test for the selection tools first walks the document without
looking inside unfilled closed paths, and when that finds nothing it
walked the whole document again to look inside them. With the pointer
resting over empty pasteboard that doubled the hit walks on every
frame.

The first walk now notes whether an unfilled closed path holds the
point, and the second walk runs only when one does. Select Behind
(objects_at) and Direct Selection in a dynamic symbol's art
(symbol_part_at) skip their second pass the same way. Hit tests that
do not look inside unfilled paths measure no interiors.
2026-11-29 09:45:21 -08:00