Commit Graph
148 Commits
Author SHA1 Message Date
.CooCoo a15bd42649 Merge pull request #10834 from dotCooCoo/fix/remove-all-image-frame-clip
Scripts: pathItems.removeAll keeps a clipping path that still holds an image
2026-12-04 22:30:41 -08:00
dotCooCoo 5d2050f665 Merge main into fix/scoped-remove-all-walk 2026-12-04 18:26:41 -08:00
dotCooCoo b63ed69db5 Merge main into fix/remove-all-image-frame-clip 2026-12-04 18:18:32 -08:00
dotCooCoo 22b169a905 Scripts: a group's pathItems.removeAll() walks only the group
removeAll() on a layer's or group's pathItems walked every object in the
document to check clipping paths, even when the collection was empty or
held two paths. It now walks the container's own objects, or, when the
container sits in the clipping path of a clipping group, the subtree of
the highest such clipping path and the group it clips. An empty
collection walks nothing. The document's own pathItems.removeAll() still
checks every object.

A scoped removeAll() now also throws when a path id in the list resolves
to an object outside the container, which a damaged file with repeated
ids can cause, instead of deleting that other object.

The walk came in with #9288 ("Scripts: paths, path points and colors
for scripts").
2026-12-04 17:29:42 -08:00
dotCooCoo a4b2e4fe36 Scripts: remove the unused empty-path closed set
Setting `closed` on a path with no points gives it an empty closed
subpath, so the path's own data keeps the setting. The separate set of
empty paths, its key, its cleanup after commands and its copy in the
command trail were no longer written to by anything. `closed` and
`setEntirePath` now read the closed state from the subpaths only.
2026-12-04 16:52:48 -08:00
dotCooCoo b7820f07e9 Merge branch 'fix/remove-all-image-frame-clip' of github.com:dotCooCoo/vectorcraft into fix/remove-all-image-frame-clip 2026-12-04 16:34:43 -08:00
dotCooCoo f6de56e490 Scripts: pathItems.removeAll measures an effect's clip region under its fill rule
When a live geometry effect reshapes what stays in a clipping path,
removeAll() now measures the area that outline fills under its fill
rule, with overlaps resolved, instead of the area of each subpath. An
image whose Transform effect adds a copy reflected onto itself fills
nothing under nonzero, so deleting the other paths now throws and
deletes nothing. A frame that an effect scales to a thin strip still
counts as a clipping region.
2026-12-04 16:34:29 -08:00
dotCooCoo 96e66b5e8d Merge main into feat/scripts-api-d5-swatches-symbols 2026-12-04 16:27:43 -08:00
dotCooCoo 1d836fa24b Merge main into fix/remove-all-image-frame-clip
# Conflicts:
#	crates/engine/src/script/dom/paths.rs
#	docs/target-app-parity.md
2026-12-04 15:55:48 -08:00
dotCooCoo 7dc78396e0 Merge main into feat/scripts-api-d5-swatches-symbols 2026-12-04 15:11:24 -08:00
dotCooCoo 49186cb426 Merge main into feat/scripts-api-layer-path-items 2026-12-04 12:28:26 -08:00
dotCooCoo 07fb4c17ed Merge main into fix/remove-all-image-frame-clip 2026-12-04 12:23:45 -08:00
.CooCoo 4db38b885e Merge pull request #9300 from dotCooCoo/feat/scripts-show-color-picker
Scripts: app.showColorPicker asks for a color
2026-12-04 11:42:06 -08:00
dotCooCoo b28b7b11b7 Merge main into fix/remove-all-image-frame-clip
# Conflicts:
#	docs/target-app-parity.md
2026-12-04 09:32:54 -08:00
dotCooCoo 07c33b9f2a Scripts: pathItems.removeAll judges a kept clipping region by its live effects
The check that an image or placed-document frame still encloses an area
now measures each subpath from its own first point, so a tiny frame far
from the origin is not lost to roundoff and a collapsed frame is not
counted through roundoff.

When a live geometry effect, such as an Offset Path inset, would leave
no clipping region once the paths are deleted, removeAll() now throws and
deletes nothing. The preflight copies only the members that hold a path
being deleted.
2026-12-04 09:32:28 -08:00
dotCooCoo 1ae7a5d5cb Merge main into feat/scripts-api-layer-path-items 2026-12-04 08:00:07 -08:00
dotCooCoo 516b7eb321 Merge main into feat/scripts-api-d5-swatches-symbols 2026-12-04 07:56:23 -08:00
dotCooCoo 761f99fc5a Scripts: pathItems.removeAll keeps a clipping path that still holds an image
The document's pathItems.removeAll() refused to delete paths from a group
that is a clipping path when an image or placed document stayed inside
that group, although the image's frame still clips. It now counts the frame
of a visible image or placed document as clipping geometry when the frame
encloses an area, as Node::clip_shapes does, and still refuses when the
frame is collapsed to a line.
2026-12-04 06:49:26 -08:00
dotCooCoo d5a54ccffa Merge main into feat/scripts-api-layer-path-items 2026-12-04 02:57:25 -08:00
dotCooCoo 232b9e1597 Merge main into feat/scripts-show-color-picker 2026-12-04 01:13:39 -08:00
dotCooCoo 69afdf9194 Merge main into feat/scripts-api-layer-path-items 2026-12-04 01:01:08 -08:00
dotCooCoo c62ddb2b33 Merge main into fix/script-paths-locked-layer 2026-12-04 00:43:34 -08:00
dotCooCoo fa8d7dbe1d Merge main into fix/doc-pathitems-removeall-clipping 2026-12-03 11:43:15 -08:00
dotCooCoo 8245421df6 Merge main into fix/script-paths-locked-layer 2026-12-03 11:27:43 -08:00
dotCooCoo 8e23837867 Merge main into feat/scripts-api-layer-path-items 2026-12-03 11:15:06 -08:00
dotCooCoo 78a3861135 Merge main into feat/scripts-api-d5-swatches-symbols 2026-12-03 11:13:42 -08:00
dotCooCoo 6100517eab Merge main into feat/scripts-show-color-picker 2026-12-03 11:12:25 -08:00
.CooCoo 6ec7bdd244 Merge pull request #10696 from dotCooCoo/fix/global-edit-stale-points
Scripts: path points of other Global Edit members go stale when Global Edit changes them
2026-12-03 10:46:39 -08:00
dotCooCoo d027865eea Merge main into fix/script-paths-locked-layer 2026-12-03 10:44:44 -08:00
dotCooCoo be47572304 Merge main into fix/doc-pathitems-removeall-clipping 2026-12-03 09:36:45 -08:00
dotCooCoo 5ff65970f9 Merge main into fix/global-edit-stale-points 2026-12-03 08:56:53 -08:00
.CooCoo d91cf654b3 Merge pull request #10699 from dotCooCoo/fix/script-point-undo-selection
Scripts: undoing a point write selects the anchors it dropped again
2026-12-03 08:48:47 -08:00
.CooCoo fff1c92179 Merge pull request #10682 from dotCooCoo/fix/script-point-scan-charged
Scripts: the look for changed path points after each command is charged
2026-12-03 08:22:32 -08:00
dotCooCoo 06fc659299 Scripts: empty paths scale their strokes and refuse a compound's pattern
resize and transform with changeLineWidths equal to the scale now scale the
strokes, dashes and effects of a path with no anchors, as they do for a path
with anchors. A member with no anchors of a compound path or compound shape
that shows a pattern is refused when the call transforms patterns, as a path
with a pattern of its own is.

node.move's description and docs/mcp.md now say that a compound path on a
locked artboard takes a path while it is new art there and still selected.
2026-12-03 04:19:34 -08:00
dotCooCoo fc9d77032f Scripts: pathItems.removeAll counts a list marker as a clip outline
The document's pathItems.removeAll() skipped text whose characters are
all whitespace before laying it out, so a numbered paragraph holding a
single space did not count, although its number clips. The deletion was
then refused while the mask would still clip.

- Whitespace-only text is laid out like other text.
- Text is laid out only inside a mask that loses a path, so documents
  with text outside such masks do no layout for the check.
- A test covers a mask left with only a list number.
- docs/mcp.md says blank text without a list marker does not count.
2026-12-03 03:19:03 -08:00
dotCooCoo 7e8c6bae5c Merge main into feat/scripts-api-layer-path-items 2026-12-03 02:24:07 -08:00
dotCooCoo 4bbfb2d4af Scripts: pathItems.removeAll counts only type that draws glyphs as a clip outline
The document's pathItems.removeAll() counted any visible text object as
geometry that keeps a clipping mask clipping. Blank type and area type too
short for its first line lay out no glyphs, so the clip renderer clips by
nothing for them; deleting the mask's last path then hid the clipped art.

- Text counts only when it is visible and its layout gives glyph outlines.
- A clipping group nested in the mask counts only its first member.
- Hidden objects and members of hidden groups do not count.
- Tests cover blank, overset, hidden and nested-clipped type, and type
  with glyphs that still allows the delete.
- docs/mcp.md states the rule.
2026-12-03 02:17:57 -08:00
dotCooCoo 4ada69770b Scripts: pathItems.removeAll deletes a clipping path when visible text still clips
A group that clips by a mask holding a path and a text object keeps
clipping by the text's outlines after the path is deleted, so
Document.pathItems.removeAll() no longer refuses that case. Hidden
text and hidden subgroups do not clip, so a mask left with only those
still refuses. docs/mcp.md describes the rule.
2026-12-03 00:34:07 -08:00
dotCooCoo 7a480a7524 Scripts: new paths skip a locked or hidden active layer
Document.pathItems.add() and the shape creators passed the active layer
as onLayer even when it was locked or hidden, so path.create refused it
and the script threw, while textFrames.add() and the app's own creation
commands put the new art on the topmost shown, unlocked layer. The path
creators now choose that layer the same way. While an opacity mask,
pattern or symbol is being edited, they use that edit's layer, and a
locked or hidden editing layer still throws. When every layer is locked
or hidden, the call throws and makes no path.

The creators came in with #9304.
2026-12-02 23:31:52 -08:00
dotCooCoo aeb11d6809 Merge main into feat/scripts-api-layer-path-items 2026-12-02 23:30:42 -08:00
dotCooCoo f4ee5e7be3 Scripts: match the point write's undo step after the switch to its document
Making a background document active can measure its type again and replace the document, so the undo step is now found by the document read after the switch. A test covers a background document whose text is measured again.
2026-12-02 23:26:40 -08:00
dotCooCoo 85d9759773 Merge main into fix/doc-pathitems-removeall-clipping 2026-12-02 22:49:14 -08:00
dotCooCoo ced550ebef Scripts: path points of other Global Edit members go stale when Global Edit changes them
While Global Edit is on, an object model edit of one member (or a move
of a group that holds it) is given to the other members, but the check
that marks read PathPoint handles stale only looked at the edited
object's own subtree. A script that read a point of another member kept
a valid handle after the edit, even when an undo then put the member
back. The check now also looks at each Global Edit member, or the
outermost Objects on Path group that holds it, and skips subtrees the
command left as they were. The stale-point check came in with #9288.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-12-02 22:34:57 -08:00
dotCooCoo 13488c3103 Scripts: document pathItems.removeAll refuses to delete a clipping path
Document.pathItems.removeAll() deleted every path of the document even when
one was the clipping path of a group or layer that keeps other objects, so
the next object became the clipping path. The scoped collections already
refuse this. The document's collection now runs the same check before
anything is deleted, and also refuses when it would empty a compound path or
group that clips other objects. edit.clear removes an emptied compound path
and keeps an emptied group, and the check follows it.

The fault came with #9041, which added Document.pathItems.
2026-12-02 22:10:09 -08:00
dotCooCoo 4bed43a4e8 Scripts: undoing a point write selects the anchors it dropped again
Writing a script's point changes drops the selected anchors and segments
that the new points no longer have before it runs path.setAnchors, so the
undo step of the edit kept the trimmed selection. Undoing the edit, with
app.undo() in the run or Edit > Undo after it, put the points back but
left them unselected. The step now keeps the selection from before the
trim.

The trim was added in #9304.
2026-12-02 21:54:23 -08:00
dotCooCoo e62b425aa9 Merge main into feat/scripts-api-d5-swatches-symbols 2026-12-02 21:51:58 -08:00
dotCooCoo 74e7109026 Scripts: the look for changed path points after each command is charged
After a script reads a path's points, each command makes the run look
through the changed layers and groups of the document for those paths.
That look was not counted toward the script's operation budget, so a
loop of commands on a large layer did unbounded work. It now charges the
objects it looks at, as the layer scans in layers.rs do.

- The look pairs each object with the one of the same id under the same
  parent now, and lists the document once for a group that moved, so no
  object is searched for through the whole document.
- A document none of whose read paths remain is no longer looked at.

The look was added in #9288.
2026-12-02 21:28:43 -08:00
dotCooCoo 1c64f808ba Scripts: list the paths again after an edit inside a Shaper group
An edit to a Shaper source regenerates the group's paths. When the
regeneration drops a generated path and makes none, the document's next
id does not change, so the kept list of pathItems still held the removed
path. Edits to a path inside a Shaper group no longer keep the list.
2026-12-02 21:26:35 -08:00
dotCooCoo 8696df27f6 Merge main into feat/scripts-show-color-picker 2026-12-02 21:09:03 -08:00
dotCooCoo b81ede3532 Scripts: pathItems.removeAll keeps clipping paths; empty paths refuse stroke-only scaling
- pathItems.removeAll() now throws and deletes nothing when it would delete
  the clipping path of a group or layer that keeps other objects, as
  pageItems.removeAll() does. The check is shared with the art collections,
  and the document's collection counts compound paths that edit.clear
  empties and deletes.
- rotate, resize and transform check changeLineWidths at the
  transformation's own scale with changePositions false before the early
  return for a path with no points, so an empty path is refused as one with
  bounds is instead of having its stroke weight set.
- docs/mcp.md describes both.
2026-12-02 20:54:39 -08:00