mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-17 22:33:08 +00:00
Merge fix/issue-8047 into fix/issue-8047-group-marquee
This commit is contained in:
@@ -204,14 +204,14 @@ enum DistanceTo {
|
||||
}
|
||||
|
||||
/// Distance Guides: with Smart Guides and Smart Guides → Invoke Distance Guides on, something
|
||||
/// selected and Alt held (`m`), the object under `p` unless it is selected, or over no object the
|
||||
/// artboard `p` is on.
|
||||
/// selected and Alt held (`m`), the object under `p` unless it or selected art inside it is under
|
||||
/// `p` ([`selected_under`]), or over no object the artboard `p` is on.
|
||||
fn distance_target(cx: &ToolContext, p: Point, m: Mods) -> Option<DistanceTo> {
|
||||
if !(cx.smart_guides && cx.distance_guides && m.alt) || cx.selection.objects.is_empty() {
|
||||
return None;
|
||||
}
|
||||
match hit_test(cx.doc, p, cx.selection_hit_options()).map(|h| h.top_object(cx.isolation)) {
|
||||
Some(id) => (!cx.selection.contains(id)).then_some(DistanceTo::Object(id)),
|
||||
match hit_test(cx.doc, p, cx.selection_hit_options()).map(|h| (h.top_object(cx.isolation), h)) {
|
||||
Some((id, h)) => selected_under(cx, &h, id).is_none().then_some(DistanceTo::Object(id)),
|
||||
None => cx.doc.artboard_at(p).map(DistanceTo::Artboard),
|
||||
}
|
||||
}
|
||||
@@ -1347,16 +1347,17 @@ fn selected_under(cx: &ToolContext, h: &Hit, top: NodeId) -> Option<NodeId> {
|
||||
below.iter().copied().chain(std::iter::once(h.leaf)).find(|id| whole(*id))
|
||||
}
|
||||
|
||||
/// A Shift-press on `top` (hit by `h`): a Shift-click takes a selected object out of the selection
|
||||
/// when it is released, and a Shift-drag moves the selection, constrained. On an object of the
|
||||
/// A Shift-press on `top` (hit by `h`): a Shift-click takes a selected object, or the selected art
|
||||
/// inside it that the press lands on ([`selected_under`]), out of the selection when it is
|
||||
/// released, and a Shift-drag moves the selection, constrained. On an object of the
|
||||
/// Global Edit that is highlighted, the release leaves that object out of the edit instead, and a
|
||||
/// drag selects `top` when it starts. Returns the object to deselect and the object to leave out
|
||||
/// on release (with `top`); adds to `out` the action that selects `top` at once.
|
||||
fn shift_press(cx: &ToolContext, h: &Hit, top: NodeId, out: &mut Vec<Action>) -> (Option<NodeId>, Option<(NodeId, NodeId)>) {
|
||||
if let Some(member) = global_edit_member(cx, h) {
|
||||
(None, Some((member, top)))
|
||||
} else if cx.selection.contains(top) {
|
||||
(Some(top), None)
|
||||
} else if let Some(picked) = selected_under(cx, h, top) {
|
||||
(Some(picked), None)
|
||||
} else {
|
||||
out.push(Action::Exec("select.toggle".into(), json!({ "id": top.0 })));
|
||||
(None, None)
|
||||
|
||||
@@ -2694,6 +2694,22 @@ fn a_press_on_a_selected_member_of_a_group_moves_the_selected_members() {
|
||||
assert!(!is_select(&down), "{picked:?}: {down:?}");
|
||||
let drag = t.pointer(&c, &ev(PointerKind::Drag, 145.0, 125.0));
|
||||
assert!(drag.iter().any(|a| matches!(a, Action::Preview(c, _) if c == "object.transform")), "{picked:?}: {drag:?}");
|
||||
// Shift: a drag moves the selected members, constrained, and a click takes the member
|
||||
// pressed (or the selected group holding it) out of the selection, not the outer group.
|
||||
let shift = |kind, x, y| ev(kind, x, y).with_mods(Mods { shift: true, ..Mods::default() });
|
||||
let mut t = SelectionTool::default();
|
||||
let down = t.pointer(&c, &shift(PointerKind::Down, 125.0, 125.0));
|
||||
assert!(!is_select(&down), "Shift, {picked:?}: {down:?}");
|
||||
let drag = t.pointer(&c, &shift(PointerKind::Drag, 145.0, 125.0));
|
||||
assert!(drag.iter().any(|a| matches!(a, Action::Preview(c, _) if c == "object.transform")), "Shift, {picked:?}: {drag:?}");
|
||||
let mut t = SelectionTool::default();
|
||||
t.pointer(&c, &shift(PointerKind::Down, 125.0, 125.0));
|
||||
let up = t.pointer(&c, &shift(PointerKind::Up, 125.0, 125.0));
|
||||
assert_eq!(up, vec![Action::Exec("select.toggle".into(), json!({"id": picked[0].0}))], "Shift-click, {picked:?}");
|
||||
// Alt over a selected member measures no Distance Guides to the group holding it.
|
||||
let mut t = SelectionTool::default();
|
||||
t.pointer(&c, &alt(PointerKind::Move, 125.0, 125.0));
|
||||
assert!(distances(&t, &c).0.is_empty(), "Alt over a selected member, {picked:?}");
|
||||
}
|
||||
// A member that is not selected: the press selects the outermost group.
|
||||
let mut s = Selection::default();
|
||||
|
||||
@@ -1148,6 +1148,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
A Direct Selection marquee over part of a segment, with neither of its anchors inside, selects that segment as a click on it does (Shift toggles it), as [Selecting objects](http://web.archive.org/web/20211230015528/https://helpx.adobe.com/illustrator/using/selecting-objects.html) describes (#4654).
|
||||
To find those segments, the marquee skips each segment whose anchors and handles all lie past one side of it and tests only the rest exactly, without building a path for each segment. It selects the same segments as before, and a marquee over a path of many anchors finishes sooner.
|
||||
With the Selection or Group Selection tool, pressing E while dragging a marquee makes the marquee select only the objects that lie entirely inside it. Pressing E again switches the marquee back to its default selection.
|
||||
With members of a group selected whole (with Group Selection, for example), a Selection-tool press on one of them keeps the selection: the pointer shows Move, a drag moves only the selected members (Shift constrains it), a Shift-click takes the pressed member out of the selection, and Alt over it shows no Distance Guides. A press on a member that is not selected, or only partly selected, still selects the outermost group ([Select objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/select-objects/select-objects.html)). Test: `select::tests::a_press_on_a_selected_member_of_a_group_moves_the_selected_members`.
|
||||
The Lasso picks anchor points only on art a click can pick, and the Add Anchor Point, Delete Anchor Point, Anchor Point and Scissors tools pick anchor points and segments only on the selected paths and on art a click can pick: not on a Shaper Group's original shapes outside Construction mode, and in isolation mode only inside the isolated group or object. Smart Guides and Snap to Point do not snap to a Shaper Group's original shapes, and the reference point of the transform tools snaps to one only when it is selected, or under the pointer in Construction mode.
|
||||
Enclosing Lasso provides whole-object enclosure selection under Object › Plug-ins and its own heading in All Tools. It has no default shortcut or Basic toolbar slot. It follows path curves and keeps partially enclosed objects out, including objects crossing a concave part of the loop. Ordinary group members can be selected individually; compound paths remain whole. This is a VectorCraft addition; scores and estimates are unchanged.
|
||||
Polygonal Lasso selects anchor points (and gradient mesh points) inside a straight-edged loop, with the Lasso's rule for which points are inside, and is listed under Object › Plug-ins and under its own heading in All Tools. It has no default shortcut or Basic toolbar slot. Each click sets a vertex. A double-click, Enter or a click on the first vertex closes the loop, Backspace or Delete removes the last vertex, Escape drops the loop, and Shift keeps the next segment to 45° steps. Shift or Alt held at the first click adds to or subtracts from the selection. This is a VectorCraft addition; scores and estimates are unchanged.
|
||||
|
||||
Reference in New Issue
Block a user