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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Document::node went through index_path, which copied the node's index
path out of the lookup cache into a new Vec, walked the tree to check it,
and walked it again to return the node. The menus' states call it for
every selected object in many of their checks, so a rebuild of the menu
states with 10,000 objects selected made hundreds of thousands of copies.
node now follows the place the cache has for the id once, without a
copy. When the cache has no single place for it, the path is deeper than
32 levels, or the node there no longer has the id, it looks the node up
as index_path does.
vectorcraft_doc::path_copies counts the paths the cache copies out, for
the new test.
The box an envelope maps from measures a group or layer that holds type
member by member, so that type is measured by its glyph outlines. In that
walk the container's own strokes still grew every member's box by
Appearance::outset(), the farthest a miter-joined stroke can reach. A
10 pt stroke of the group's own round a square next to type reached 50 pt
past the square instead of the 5 pt it paints.
The walk now measures the container's strokes, scaled into the envelope's
frame, along each member as the group's visual box does: paths and
compound paths along their shapes (Node::painted_by_container), groups
holding type member by member, and nothing round hidden members and
guides. Type, clip groups and compound shapes keep their box grown by the
strokes' reach, with their own strokes scaled into the frame.
expand_to took in the target without checking that it is editable, so a
locked or hidden object inside a selected group replaced the group with
its contents. It now leaves the selection unchanged for such a target.
select.anchors with mode toggle decided whether a path was selected whole
from the rest of the selection, so after a Shift-click had opened a group,
a Shift-click on an anchor of another path in it selected only that
anchor. A toggle on a group member now decides it from the member's own
selection; paths directly on a layer keep the existing rule.
A group's or layer's visual box grew by Appearance::outset(), the farthest
any of its strokes can reach from any path. For a miter-joined stroke that
is the miter limit times half the weight, so a 10 pt stroke of the group's
own round a square measured 50 pt past it instead of the 5 pt it paints.
The container's own strokes are now measured along each member path and
compound path, at any depth in its groups, as a path measures its own
strokes (Appearance::stroked_bounds). They add nothing round hidden members,
guides, images and symbol instances, which they do not paint, and grow the
box of other members (type, clip groups, live objects) by their reach as
before. visual_of_members keeps the old growth for callers that have only
boxes at hand.
The box of a group measured in a turned frame (Node::bounds_in) and
object.setBounds with Use Preview Bounds, which measures plain groups member
by member and symbol art object by object, measure a group's own strokes the
same way, so the size setBounds gives matches the visual box. There, too,
the strokes stop at hidden members and guides, and setBounds measures a
compound shape as one object, as its visual box takes it. A group's
own beveled or mitered stroke along a path with slanted segments now counts
as a slanted stroke corner (Node::has_slanted_stroke_corners), so setBounds
measures such a group as drawn when it sizes it out of proportion.