New art and type took the graphic style picked with nothing selected by
its name, so in another document they were linked to a style of the same
name there, and took its isolate and knockout. The template now records
the document the style came from, and new art elsewhere takes the look
without the link.
New area type that text wrap moves as it is made (an Auto Size frame
below a wrap object grows) had the template's placed gradients fitted to
the frame before the reflow. Both ways of making type now let text wrap
reflow it first and fit the gradients to the frame it ends with; type
whose bounds do not change keeps its placement.
The docs name text.create as the command whose type takes the template,
state that Type on a Path and Area Type keep the default appearance, and
note that a color given to text.create keeps the characters' fill under
Override Character Color.
With New Art Has Basic Appearance off and a basic graphic style picked
with nothing selected, only the first new type took the style. New type
was never linked to the style, so the next one inherited an unlinked
basic look and came out plain.
New type made with a graphic style's look now takes the style's opacity
and blend mode and is linked to it, as graphicStyle.apply does for type.
Other new type keeps its own opacity and blend mode.
text.create gave new type an empty appearance whatever new art's
template held, so type made with the Type tools ignored New Art Has
Basic Appearance off and a graphic style picked with nothing selected.
New type now takes the template's fills, strokes and effects when the
template is more than one plain fill and stroke or comes from a graphic
style. With Override Character Color on, its characters lose the fill
and stroke the template paints, as when a style is applied to type; a
color given to text.create keeps the characters' fill. With the option
on and no style picked, new type is unchanged. Type keeps its own
opacity and blend mode, as before.
Docs: docs/mcp.md (New art), docs/target-app-parity.md.
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
Main took its own host class engine, member descriptions for reflect, a
topmost-first pageItems order, revert-aware handles and the New Document
More Settings rework. The merge keeps main's versions of crates/js and
crates/ui-egui/src/dialogs/new_document.rs and moves the branch onto them:
- The layers, groups, compound paths and artboards members carry their
reflect types, and Layer gains toString. The Layer class from layers.rs
replaces main's name-only Layer class.
- Layer, Layers, Artboard and container collection handles carry the
document's revert count, so they go stale after File > Revert as page
items do (a layer then throws "Stale page item", as main's tests expect).
- A layer's or group's pageItems and the GroupItems and CompoundPathItems
collections read names, index and toString as the document's pageItems
does on main.
- controlBounds keeps the branch's rule (anchors and handles of shown
paths, a clip group's clipping path only) and main's zeros for an empty
object.
- areaText and pathText into a layer or group keep main's threading.
- group.clipped is refused on a locked artboard, a compound path keeps
itself when its pathItems are cleared, a path in a locked layer is not
converted into a layer's textFrames, layers.removeAll refuses more rows
than layer.delete takes, and a path moved into a pixel-aligned compound
path is snapped.
- A compound path's pathItems read the typename PageItems, the class they
are, and the TextFrames reflect types name a TextFrame from index and any
type from parent.
Tests whose rule main changed now assert main's rule: pageItems and
textFrames list topmost first, an empty selection is an empty list, a
segment-only path is restored with no anchors (the objects stay selected,
order not asserted), and the members not available yet are swatches, not
views or layers. The branch's tests of its own host class engine in
crates/js were dropped with that engine, since main's implementation
replaces it.
Scripted shapes record the layer they were drawn on, so replay does not
draw them behind other art or inside an isolated group. Paint edits on
objects keep the new-art defaults on replay, and a solid new-art color
copied to a path keeps its color model. An anchor picked next to a
selected segment stays selected and is listed by selectedPathPoints.
closed set on an empty path applies to its first points. Text fillColor
and strokeColor reflect as Color. Saved file.new steps keep the old row
rounding.
Ports the PathItem, color and text members to main's reflected member form (name, HostMember, MemberInfo), and builds the text paint members on main's TextFrame members.
The Three-Point Arc tool gets two options in its Tool Options:
- Join to Open Path Ends (`join`, off by default; J switches it while
the ends are placed): an end placed within 5 screen points of an end
of an open path lands on it, and the arc is joined to that path. The
path keeps its look and, when one end joins, its direction. With both
ends on open path ends the two paths become one, or the path closes
when both are its own ends. It is one undo step.
- Snap Where the Arc Continues a Path (`tangentSnap`, on by default): in
direction mode, when the direction line starts on an end of an open
path, a third point near the line along which the arc carries the
path on, the same way or turned back, snaps onto it, and the tool
shows the line dashed.
`shape.threePointArc` takes `join: true` for the same join; it picks a
path in the selection first, then the front one, and in isolation mode
only paths inside the isolated group.
New Document moved to the framework dialog on main. Its More Settings
keeps a preset's rows as before: Columns shows the columns the rows give,
and a new layout or column count replaces the rows.
Layer.textFrames and GroupItem.textFrames threw "not available yet".
They now give a TextFrames collection with the members of the
document's: length, [i], index, getByName, add, pointText, areaText,
pathText and removeAll. It lists the type directly in the layer or
group, topmost first, as the layer's other collections do, and new type
goes on top of the layer's or group's contents whatever the current
layer. A hidden or locked layer or group throws and changes nothing.
text.create takes a parent: a shown, unlocked layer or group that the
new type goes on top of, whatever the drawing mode. Area type and type
on a path are moved there with node.move in the same step.
Docs: docs/mcp.md, docs/target-app-parity.md.
Document.pathItems lists a document's paths and makes empty paths,
rectangles, rounded rectangles, ellipses, polygons and stars with the
parameter order and defaults of the PathItems help page. A PathItem
reads and changes its points, closed state, fill rule, area, length,
fill and stroke colors, stroke options and overprint, and translates,
rotates and resizes. PathPoints and PathPoint read and set each
point's anchor, handles and type. RGBColor, CMYKColor, GrayColor,
LabColor and NoColor make colors; a gradient, spot or pattern paint
reads as GradientColor, SpotColor or PatternColor.
Each change runs an existing command (path.create, the shape.*
commands, path.setAnchors, path.close, path.setFillRule,
paint.setFill, paint.setStroke, stroke.set, object.setOverprint,
object.move, object.rotate, object.scale) inside the run's one undo
step, and puts back the selection and the paint for new art. A value
that changes nothing runs no command; a bad value throws and changes
nothing.
path.setAnchors now makes an anchor a corner when it is given
`smooth: false`; before, the key was ignored and handles in line made
it smooth.
Double-clicking the Curvature Circle tool opens Curvature Circle Tool
Options (`tool.options {tool: "curvatureCircle"}`, dialog
`curvatureCircleOptions`). OK sets the options with `tool.setOption`,
and the preferences keep them:
- Snap Tolerance (`snapTolerance`, 1 to 40 screen points, 5) is how
near a path pulls the pointer; Smart Guides' Snapping Tolerance
applies when it is larger.
- Snap with Smart Guides Off (`snapWithoutGuides`) unchecked keeps the
reach within Selection & Anchor Display's Tolerance while Smart
Guides are off.
- Annotate Radius (`annotateRadius`) unchecked hides the radius label.
- Anchors at Standard Positions (`standardAnchors`) unchecked draws a
path with an anchor where the circle touches the path and one every
90 degrees from there (`shape.curvatureCircle {anchors: "touch"}`).
- Use the Radius of Circular Arcs (`constantRadius`) unchecked gives
the cubic's own curvature on the cubic of a circular arc too
(`shape.curvatureCircle {constantRadius: false}`).
The range, the default and the Snap with Smart Guides Off rule are
VectorCraft's own. Every switch is on by default, so the tool draws as
before until an option is changed. The canvas check measures the path
drawn, whose cubics reach a little past the circle when its anchors
are where it touches.
shape.flare took the rings' end point only when both x2 and y2 were
numbers. Given one of them alone, it dropped it and placed the end point
from pathLength and direction instead. It now refuses the call with
"missing number `y2`" (or `x2`), as shape.editFlare already does, draws
nothing and adds no undo step. With neither, or both null, pathLength
and direction still place the end point.
Saved flare settings that hold only one of x2 and y2 are no longer read
as an editable flare; the group stays as art.
Docs: params text, docs/mcp.md, docs/target-app-parity.md.
- tool.setOption accepts fromCenter again: the Circle tool implements
check_option, which the shared option check now calls for every tool.
- A drag from the first point that comes back within 2 screen points of
the press draws the circle the tool shows. A drag to no circle draws
nothing and leaves no point pending.
- shape.circleThroughPoints refuses a circle whose opposite edges round
to the same number at its coordinates, and the tool no longer shows
such a circle. The error is translated in every complete-message
catalog.
- An option set during a press (tool.setOption, the Control bar) is kept
when the press is dropped, with the options that write reset.
shape.curvatureCircle's description and docs/mcp.md now say a smooth mark only overrides the corner test when both handles are pulled out and no segment of no length lies before the anchor. The tool and docs/mcp.md say the pointer reaches the drawn circles again once another tool is chosen.
After a click, the circle the tool drew is selected and on top, so the
next hover or click near the point it touches snapped to that circle
instead of the path. The pointer now passes over the circles the tool
drew until an edit, Undo or Redo is made outside the tool.
- An anchor marked smooth is a corner when its handles turn by 90° or
more; the params text and docs/mcp.md now say so instead of "turn
back the way they came".
- Tests cover a second click after a draw, in the tool and through the
session, and a marked-smooth anchor with square handles.
At a corner anchor the tool now shows "Corner" instead of "Cusp", and
`shape.curvatureCircle` returns "the path has a corner there, so it has
no single curvature".
- A closed subpath whose only segment with length loops back to its
start (a teardrop) has a corner at its tip, from both ends of the loop.
- An anchor marked smooth whose out handle points back along its in
handle is a corner.
- The guide error and the new corner error have rows in the 24 catalogs
that translate every message.
- A test covers a Smart Guides snapping tolerance larger than 5 screen
points, with Smart Guides off and on.
The Curvature Circle tool, after the Circle tool in the Ellipse tool's
flyout, draws the circle that touches a path at a point and bends as the
path bends there, with shape.curvatureCircle. The pointer snaps to the
nearest path that is not a guide within 5 screen points, or within the
Smart Guides snapping tolerance when that is larger, and the tool shows
the circle as a dashed outline (solid once it is more than 50,000 screen
points around), its center, a line from the center to the point it
touches and, with Measurement Labels on, its radius. A click draws the
circle in one undo step, on the side the path bends toward; Shift held at
the press puts it on the other side. A press dragged 2 screen points or
more, or canceled with Escape, draws nothing.
A segment that is the usual cubic of a circular arc of 90° or less gives
a circle with the arc's own radius, shown with an asterisk, so a click on
a circle drawn with the Ellipse tool draws that circle. On a straight
segment, at a cusp or a corner anchor, or where the circle would reach
past the canvas, the pointer shows "Straight segment", "Cusp" or "Circle
too large", and a click draws nothing. An anchor is a corner when the
segments meet there at more than half a degree and it is not marked
smooth; segments of no length between them are passed over. The tool's
icon is new and drawn for VectorCraft.
shape.curvatureCircle takes the path, subpath, segment, t and convex, and
returns the circle's center and radius and whether the radius is an
arc's own. A guide is refused.
draw2::candidate_paths skips the selected paths with a hash set, so it
takes time linear in the number of paths on each pointer move.
Part of #7178.
Double-clicking the Circle tool, or `tool.options {tool: "circle"}`, opens
Circle Tool Options. Show Center, Show Radii and Show Diameter switch the
center cross, the radius lines and the diameter label the tool shows while
a circle is drawn, and Color sets the color of the cross and the lines
(red, blue, magenta, green, black or gray). With Anchors at Standard
Positions off, the circle's anchors are at the points it was drawn
through, plus evenly spaced anchors between them so that no curve turns
more than a quarter of the circle. With Third Point by Dragging off, a
second click places the second point and a third click draws the circle
through the three; a double-click on the second point draws the circle on
the two. Every option is on by default, and the options are kept with the
preferences.
`shape.circleThroughPoints` takes `anchors: "standard"|"points"`.
`tool.setOption` rejects a value the Circle tool's options do not take.
With From Center on (a Control bar checkbox, or the tool option
fromCenter), the Circle tool's first point is the circle's center and
its outline passes through the second point, which follows the pointer.
A drag from the center, or a click on the center and a click on the
outline, draws the circle. The second point snaps to Smart Guides and
anchor points as the tool's other points do, so a circle centered on one
corner of a rectangle can pass exactly through the opposite corner, with
the diagonal as its radius. Shift keeps the second point at 45° steps
from the center, and Alt rounds the diameter to the rulers' ticks. A
second click on the center places nothing. The setting in force when
the first point is placed applies to that circle, and the setting is
saved with the preferences. Each circle is one undo step.
shape.circleThroughPoints takes center: [x, y] with one point in points
and draws the circle at the center through that point. A point on the
center, and coordinates whose distance overflows, are refused with their
own messages. tool.setOption refuses a fromCenter that is not true or
false and any other Circle tool option; both errors are translated.
Requested by Auriga on the community Discord. Part of #7178.
New type started in [Normal Character Style]'s fill only and always used the
default font and size. It now takes the style's font, style, size and other
character attributes too, so redefining that style in a New Document profile
sets the default font of the profile's documents. A font, style, size or
color given to text.create still wins.
Part of #8350
The Three-Point Arc tool, after the Arc tool in the Line Segment tool's
group, places two ends by a drag or two clicks, then a third point. The
arc passes through the third point, or with Third Point Sets Direction on
it leaves the first end heading toward it, or with Alt arrives at the
second end along the line from it. The setting is in the tool's Tool
Options (a double-click on the tool), and ] switches it while drawing.
The tool previews the arc, its center and radius, and shows "Arc too
large" where no arc fits.
shape.threePointArc {start, end, through | toward, at?} draws the open
arc in one undo step and refuses points with no arc, malformed points,
both or neither of through and toward, an at other than start or end,
and an at given with through.
Part of #7178.
The Circle tool, in the Ellipse tool's flyout, draws a circle with
shape.circleThroughPoints. A drag from one point to another, or a click
on each, draws the circle with the two points as the ends of a diameter.
A click on a first point, then a press on a second point dragged to a
third, draws the circle through the three. Shift keeps the second point
at 45° steps from the first. For a circle on two points, Alt rounds the
diameter to the nearest ruler tick at the current zoom in the General
unit. Each point snaps to Smart Guides. Until the release the tool shows
the circle as a dashed outline (solid once it is more than 50,000 screen
points around), a cross at its center, a line from the center to each
point and, with Measurement Labels on, the diameter by the pointer.
Three different points on one line, or a circle past the canvas, show
"Circle too large" by the pointer instead, and the release draws
nothing. Escape, a dropped press, and an edit, Undo or Redo made outside
the tool drop the first point. A second press within 3 screen points of
the first point, or one that snaps to it, places nothing when let go
there, and draws the circle on the diameter it drags out when dragged.
Each circle is one undo step. The tool's icon is new and drawn for
VectorCraft.
shape.circleThroughPoints also takes two points, or two selected anchor
points, as the ends of a diameter. Its two errors about the number of
points now say "two or three", in every catalog that translates them.
Part of #7178.