Merge pull request #6909 from dotCooCoo/feat/align-artboards

Align: the Align panel aligns and distributes the selected artboards
This commit is contained in:
BFlat
2026-11-13 06:11:32 +07:00
committed by GitHub
15 changed files with 873 additions and 50 deletions
+48 -1
View File
@@ -5033,6 +5033,12 @@ the Align To choice, and while there is a key object or a key guide they send th
`spacing`. Edit › Keyboard Shortcuts lists them under Align, with no default shortcut, and
`shortcuts.set {id, shortcut}` gives one a shortcut.
With the Artboard tool chosen, the same buttons and UI commands, and the Control bar's Align and Distribute buttons,
run `artboard.align`, `artboard.distribute` and `artboard.distributeSpacing` on the artboards the tool has selected.
Align To then offers Align to Selection and Align to Artboard. Align to Artboard sends `to: "artboard"`, which keeps the
tool's active artboard in place, and the Distribute buttons then send the Distribute Spacing value as `spacing`. Align
to Selection sends `to: "selection"`. The Distribute buttons need two or more selected artboards.
Edit › Keyboard Shortcuts and `shortcuts.list` leave out a command with no default shortcut when a key press cannot
run it: no item of the menu bar runs it, it opens no dialog when run without params, and it is one of these:
@@ -5955,7 +5961,48 @@ artboard it names is locked. When no artboard changes, the command records no un
`scaleArt` scales the art with each artboard and defaults to the Artboard tool's Scale Artwork with Artboard option.
`patterns` and `lockedAndHidden` work as they do on `artboard.setProps`.
When a call to `artboard.duplicate`, `artboard.copy`, `artboard.cut`, `artboard.rename` or `artboard.switchOrientation`
Align and distribute artboards ([Align and distribute artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/organize-manage-artboards/align-and-distribute-artboards.html)):
three commands move whole artboards, by default those the Artboard tool has selected, else its active one. Each takes
`index? | indices?`, `to?: "selection"|"artboard"`, `artboard?: n`, `moveArt?`, `patterns?` and `lockedAndHidden?`, and
returns `{moved: [index…]}`.
- `artboard.align {horizontal?: "left"|"center"|"right", vertical?: "top"|"center"|"bottom"}` moves each artboard until
the named edge or center is on that edge or center of the bounds of all the artboards named. One of the two
directions is needed, and both can be given.
- `artboard.distribute {horizontal? | vertical?, spacing?}` spaces the named edges or centers evenly between the first
and the last artboard along the axis, which stay where they are. It needs three or more artboards.
- `artboard.distributeSpacing {axis?: "horizontal"|"vertical", spacing?}` makes the gaps between the artboards along
the axis equal. The first and the last artboard stay where they are. It needs three or more artboards, and `axis`
defaults to `"horizontal"`.
`to: "artboard"` aligns to artboard `artboard`, which stays where it is. `artboard` defaults to the Artboard tool's
active artboard. For `artboard.align` it can be an artboard that is not being aligned. The two Distribute commands
space the artboards as they do without it and then move them together so that artboard `artboard`, when it is one of
them, stays where it is. With `to: "artboard"` and `spacing`, `artboard.distribute` places the edges or centers
`spacing` points apart, outward from that artboard in their order, and `artboard.distributeSpacing` leaves a gap of
`spacing` points between neighbors; two artboards are enough, a negative `spacing` overlaps them, and an `artboard`
that is not one of the artboards distributed fails with `no such artboard`. Without `to: "artboard"`, `spacing` is not
used. These rules for `to`, `artboard` and `spacing` are VectorCraft's own.
When a call with `to: "artboard"` names no `artboard`, its journal entry records the active artboard it used as
`activeArtboard`. A replay of the journal aligns to that artboard, and a recorded action leaves the value out and
aligns to the artboard that is active when it plays. An `artboard` the call names stays in the action.
`moveArt` moves the art fully inside each artboard with it and defaults to the Artboard tool's Move Artwork with
Artboard option. `patterns` and `lockedAndHidden` work as they do on `artboard.move`. An artboard's own guides move
with it. A locked artboard stays where it is: it still counts in the bounds and keeps its place in the order, and a
call fails with `the artboard is locked` when every artboard it names is locked. That rule is VectorCraft's own. Each
command is one undo step, and records none when no artboard moves (fewer artboards than it needs included). A direction,
`to`, `axis`, `artboard`, `spacing` or switch with a value outside the ones listed is an error, and nothing changes.
A `spacing` that would move an artboard past the edge of the canvas fails with
`result would exceed the canvas (coordinates out of range)`, and nothing changes.
```json
{"name":"run_command","arguments":{"command":"artboard.distributeSpacing","params":{"indices":[0,1,2],"to":"artboard","artboard":0,"spacing":20}}}
```
When a call to `artboard.duplicate`, `artboard.copy`, `artboard.cut`, `artboard.rename`, `artboard.switchOrientation`,
`artboard.align`, `artboard.distribute` or `artboard.distributeSpacing`
names no artboard, its journal entry records the artboards it acted on as `selectedArtboards`. A replay of the journal
acts on those artboards, and a recorded action leaves the value out and acts on the selection when it plays.
+1
View File
@@ -198,6 +198,7 @@ tools, never checked side by side) isn't captured row by row.
| Distribute ruler guides: the Distribute Objects and Distribute Spacing buttons space the selected guides across the axis with the selected objects, as items with no size; two or more guides selected alone are enough | done | #1597 in part; guides alone: select them, choose Align to Artboard and click Horizontal (Vertical) Distribute Center for equal columns (rows) ([public forum answer, 2017](https://community.adobe.com/questions-652/illustrator-equal-guides-822924)); with objects: a guide on each artboard edge, included in the selection, keeps the outermost lines there ([public forum answer, 2025](https://www.signs101.com/threads/is-there-a-way-to-distribute-shapes-like-this-in-illustrator.179556/)); a guide has no width, so the three options of an axis are the same for it; guides along the axis stay |
| Ruler guides align to a key object: a click on an object selected with guides makes it the key (one object is enough); Align moves the selected guides to its edge or centre (vertical guides to left, centre or right, horizontal ones to top, centre or bottom) and the key stays put | done | #2143; aligning to the selection or the artboard leaves guides alone |
| Align panel menu › Align to Glyph Bounds › Point Text and Area Text (checked while on): Align and Distribute measure point type or area type by the ink of its glyphs instead of its em box or frame | done | #4231; `alignGlyphBoundsPoint`, `alignGlyphBoundsArea` ([Align text](https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/align-text.html)); `tests::glyphbounds`, `panels::align::tests::align_to_glyph_bounds_toggles_point_and_area_text`; the Character and Properties panels' Align to Glyph Bounds controls are not done |
| Align and distribute artboards: with the Artboard tool chosen, the Align panel's Align Objects, Distribute Objects and Distribute Spacing buttons, and the Control bar's, move the selected artboards with the art inside them (Move Artwork with Artboard) | done | `artboard.align`, `artboard.distribute`, `artboard.distributeSpacing` ([Align and distribute artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/organize-manage-artboards/align-and-distribute-artboards.html)); VectorCraft's own rules: Align to Artboard keeps the active artboard in place and sends the Distribute Spacing value, Align to Key Object is off, a locked artboard stays where it is; `cmd::artboardalign::tests`, `panels::align::tests::the_align_buttons_align_the_selected_artboards` |
| A marquee selects the objects whose paths it touches (anchors or segments): drawn inside a filled shape, over a background, it leaves that shape (Preview and Outline) | done | #1103 |
| Click a segment independently of its endpoint anchors; only its direction handles show | done | #1278: hollow endpoint squares, selected edge emphasized; headless egui checked |
| Drag a curved segment to bend it, a straight one to move its anchors | done | |