Skip to content

A fully selected component can be the alignment key - #1906

Open
turtwig wants to merge 2 commits into
storytold:mainfrom
turtwig:fix/align-key-object
Open

turtwig wants to merge 2 commits into
storytold:mainfrom
turtwig:fix/align-key-object

Conversation

@turtwig

@turtwig turtwig commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What and why

A Selection-tool click on a direct-selected component of a group or compound path selected the container. select.key refused a compound-path member, and a path with only some anchors selected could still be the key. Align of that member moved the whole compound. With anchor points selected, Align to the key object used the points' own bounds, so the key object's anchors moved with them.

A click on a fully selected component of an unselected group or compound path now makes that component the key and leaves the container unselected. A path with only some anchors selected cannot be a key, and dropping an anchor clears one. Align moves that component on its own. Selected anchors move to the key object's edge, including points that lie past it, and the key keeps its shape. A click on an unselected member in front of a selected one still selects the compound.

How it was tested

a_click_keeps_a_direct_selected_component_as_the_key covers a click on a direct-selected group member and compound member, and a click on a selected member behind an unselected one.

a_click_on_a_partly_selected_path_does_not_make_it_the_key covers a partial anchor selection.

select_key_requires_the_whole_object and select_key_rejects_ids_it_cannot_use_and_keeps_the_key cover select.key for a whole component, a partial path, and a member whose compound is not selected.

a_direct_selected_compound_member_aligns_on_its_own, aligning_anchors_to_a_key_object_does_not_distort_it, and aligning_anchors_uses_the_key_objects_edge cover Align of the component and of anchors onto the key's edge.

cargo xtask ci passed: fmt, clippy, test, assets, brands, layers, wasm.

Checklist

  • cargo xtask ci passes (fmt, clippy, tests, assets, brands, layers, wasm).
  • No panics in shipped code: no unwrap(), expect(), panic!, unreachable!, todo! or
    unimplemented! outside tests, and no unchecked indexing on data from files, parameters or
    messages. Errors are returned as Result and shown to the user
    (why and how).
  • Clean-room: nothing copied from Adobe products or GPL/AGPL code (AGENTS.md).
  • Every new asset has a row in ASSETS.md.

A Selection-tool click on a component of an unselected group or compound path makes that component the key when every anchor is selected, and does not select the container. A path with only some anchors selected cannot be the key, and dropping an anchor clears one. Align moves that component on its own. Selected anchors move to the key object's edge, including points that lie past it, and the key keeps its shape.

@Messhias Messhias left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fully selected component can be the alignment key; partial anchors cannot. Checklist ci is ticked.

…change.

Those two files are back to the branch point, so the pull request no longer rewrites them and main's copies merge through.
@bflatastic

Copy link
Copy Markdown
Member

Thanks @turtwig, this is careful work and the tests cover each case well.

I'm holding it for the project owner rather than merging. The reference app's public documentation of key objects (Align and distribute objects) covers a second Selection-tool click on a selected object, and a key anchor as the last anchor point selected with the Direct Selection tool. It doesn't say that a Selection-tool click on a direct-selected member of a group or compound path makes that member the key and drops the container from the selection, or that selected anchors align to a key object's edge. Those changes alter what a click selects, so whether VectorCraft works this way is the owner's call.

If you'd like to chat with us, our Discord is at https://discord.gg/artcraft.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants