Commit Graph
7 Commits
Author SHA1 Message Date
dotCooCoo 99a04b9a78 Scripts: transforms keep path strokes within 1000 points and take empty paths
`resize` and `transform` with `changeLineWidths` at the transformation's own
scale scaled a path's strokes past the 1000-point limit that other line
widths enforce, and could store a NaN weight for a scale too large for a
number. Every stroke layer the transformation scales is now checked against
the limit with the factor the transformation applies.

`rotate`, `resize` and `transform` threw "the object has no bounds" on a
path without points whenever the call named or defaulted to a point of the
bounds. Such a path now takes the transformation about the origin, or the
first artboard's bottom-left corner for `Transformation.DOCUMENTORIGIN`,
so its linked mask, strokes, effects and patterns still transform.

Both faults came in with #9295.
2026-12-02 17:52:07 -08:00
dotCooCoo 75d4c949d2 Scripts: transform scales a compound member's stroke, and the warning confirm is known by its origin
- PageItem.transform with changeLineWidths at the matrix's own scale sets
  the stroke weight of a path whose paint the compound holds, as resize
  does.
  resize and transform set that weight by the scale itself, and an explicit
  100 keeps the weights even for a scale within the tolerance of 100%.
- A changeLineWidths of 0 no longer matches a tiny scale; a positive value
  is compared with the scale relative to its size.
- translate refuses an offset past the canvas only when the call moves the
  object or a pattern it uses; a non-finite offset is still refused.
- Number conversion of preference text no longer trims U+0085, as
  JavaScript does not.
- A real preference changes between 0 and -0: values are compared by their
  bits in the setter and when the run's keys are merged.
- A clipboard.importSvg whose result cannot reach the script puts the
  clipboard back.
- Moving an object works out its index without copying the list of its
  siblings.
- The app's question before the external script warning turns off is known
  by the confirm the app opened, not by its text, so a script's confirm
  with the same text answers Yes through automation and is not translated.
- docs: only calls that move or reshape the object run
  object.transform, and transform sets a compound member's stroke.
2026-11-29 23:14:06 -08:00
dotCooCoo ea8951536d Scripts: resize scales a compound member's stroke and refuses negative line widths
A path inside a compound path or compound shape takes its visible stroke from the compound, so resize with changeLineWidths sets the compound's stroke weight through stroke.set, in the same savepoint as the transform. A negative changeLineWidths throws. The PathItem progress line now says paths take the page item transforms.
2026-11-29 18:39:36 -08:00
dotCooCoo c0eb5b898b Merge main into feat/scripts-pageitem-transforms
PathItem now takes PageItem's translate, rotate and resize: main's PathItem versions are removed, and resize on a path keeps main's changeLineWidths percent for the stroke weight. Hidden objects are refused, and an identity transform of an empty path checks its Transformation value and does nothing.
2026-11-29 17:19:24 -08:00
dotCooCoo 20f06e9586 Scripts: transforms measure clipped art against the canvas and keep tiny moves
A transform of a clipping group or clipped layer now measures each object
inside it against the canvas limit, as the native file's canvas check does,
so a clipped object cannot be moved past the canvas while its clipping path
stays inside. A pure move is applied as a translation, so a move far smaller
than the pivot's coordinates still moves the object, and a transform that
changes nothing is not measured.

The transform tests build the 30 x 40 pt rectangle on top, since pageItems
lists art topmost first, and the tests from main that named rotate as a
member not available yet, the overprint preview error and the preset title
limit follow main's current behavior.
2026-11-28 21:37:43 -08:00
dotCooCoo 8330a6d8f0 Scripts: transforms keep stroke-only and tiny changes, and edits keep the current layer
- translate, rotate, resize and transform: a move of any size other than 0
  runs; a changeLineWidths scale with changePositions false throws an error
  that says it is not available yet instead of changing nothing; the scale a
  matrix gives for changeLineWidths is taken past the range of a number; a
  transformation whose bounds reach past the canvas is kept when the
  transformed object itself stays inside it.
- An edit of a page item puts back the current layer that selecting the item
  changed (layer.setCurrent), and an edit whose selection cannot be put back
  is undone with it.
- addDocument starts from the built-in preset of the profile's category, not a
  saved preset with the same name (file.new and file.newPresets.save take
  presetCategory), and refuses previewMode OverprintPreview before it makes a
  document.
- The values assigned to a run's DocumentPresets hold at most 64 MiB.
- zOrder leaves out the ruler guides at the top of a layer when it checks
  whether the item is already at the front.
- concatenateMatrix rounds a sum next to the largest number once, and
  getRealPreference rounds a 0x, 0o or 0b number once.
- On Windows, the check that a New Document profile or recovery lock is still
  the file that was opened does not follow a link at its path.
- JavaScript: new on a host constructor that gives a value other than an
  object throws a TypeError, and an array method on a host object that takes
  a class with an indexer during the call visits the rest of its elements.
2026-11-27 18:53:14 -08:00
dotCooCoo 35e27e2224 Scripts: PageItem translate, rotate, resize and transform move and reshape objects
A page item's translate(deltaX, deltaY, ...), rotate(angle, ...),
resize(scaleX, scaleY, ...) and transform(matrix, ...) run
object.transform on the object inside the run's transaction, so the run
keeps one undo step and the selection stays as it was. Offsets, angles
and matrices have Y up, rotate, resize and transform act about the
center of the geometric bounds or a Transformation point, and
positions, patterns, gradients and line widths follow their arguments.
Locked art, art on a locked artboard, a scale of 0, a singular matrix
and a result past the canvas throw an error and change nothing, and a
call that changes nothing runs no command.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-25 01:56:17 -08:00