mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-29 01:34:29 +01:00
Merge pull request #9859 from dotCooCoo/fix/direct-click-keeps-group
Direct Selection: a press on a member of a selected group keeps the group
This commit is contained in:
3 files changed
+197
-34
No files matched your search
+91
-34
@@ -18,6 +18,10 @@
|
||||
//! the drag makes it select only the objects entirely inside it, whole.
|
||||
//! In isolation mode both pick only the isolated object and what is inside it: anchors, segments,
|
||||
//! paths and groups outside it stay put.
|
||||
//! An object inside a selected group counts as selected whole: a click on its fill keeps the group
|
||||
//! selected, a drag from its fill or one of its anchors moves the group whole, and a click on an
|
||||
//! anchor or a segment selects that anchor or segment alone. With Group Selection a click there
|
||||
//! adds the next group up, if any.
|
||||
//! Both move objects selected as a whole as the Selection tool does, snapping alike. When the
|
||||
//! selection also holds direct-selected anchors or segments, a drag from an object moves those
|
||||
//! anchors and the objects selected whole, as an anchor drag does, and while Alt is held it
|
||||
@@ -53,7 +57,7 @@
|
||||
//! moves its anchors.
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::collections::{BTreeMap, BTreeSet, HashSet};
|
||||
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_doc::hit::{Hit, HitKind, compound_part_at, hit_test, selected_hidden_at, symbol_part_at, symbol_part_outline_in_view};
|
||||
@@ -559,12 +563,14 @@ fn line_end_leave(cx: &ToolContext, grab: Point) -> Option<Leave> {
|
||||
/// objects behind it (#3405).
|
||||
fn hit_anchor(cx: &ToolContext, p: Point, tol: f64) -> Option<(NodeId, usize, usize, Point)> {
|
||||
let mut owners = anchor_owners(cx, |n| matches!(n.kind, NodeKind::Path { .. }) || is_area_type(n) || is_path_type(n));
|
||||
owners.sort_by_key(|id| !cx.selection.contains(*id));
|
||||
// The members of a selected group count as selected.
|
||||
let selected = in_selection_all(cx);
|
||||
owners.sort_by_key(|id| !selected.contains(id));
|
||||
|
||||
// 1. Check selected objects first. Selected objects are NEVER occluded (#1508).
|
||||
let mut unselected_idx = owners.len();
|
||||
for (i, &id) in owners.iter().enumerate() {
|
||||
if !cx.selection.contains(id) {
|
||||
if !selected.contains(&id) {
|
||||
unselected_idx = i;
|
||||
break;
|
||||
}
|
||||
@@ -624,9 +630,22 @@ pub fn over_selected_part(cx: &ToolContext, p: Point) -> bool {
|
||||
if spines.iter().any(|(_, path)| path.anchors().any(|(_, _, a)| a.p.distance(p) <= tol)) || spine_segment_in(&spines, p, seg_tol).is_some() {
|
||||
return true;
|
||||
}
|
||||
// The editable paths' control bounds are listed once per document state and selection; a
|
||||
// hover measures only the paths whose bounds it is near.
|
||||
let boxes = crate::select::selected_part_boxes(cx, || {
|
||||
selected_part_boxes(cx).iter().any(|&(id, b)| {
|
||||
b.inflate(tol, tol).contains(p)
|
||||
&& cx.doc.node(id).and_then(editable_path).is_some_and(|pd| {
|
||||
#[cfg(test)]
|
||||
MEASURED_PARTS.set(MEASURED_PARTS.get() + 1);
|
||||
nearest_anchor(&pd, p, tol, None).is_some()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/// The editable paths of the selected objects and inside them (a selected group's members), with
|
||||
/// their control bounds, topmost first across the whole document: the order [`hit_anchor`] tries
|
||||
/// them in. The list is made once per document state and selection; a hover measures only the
|
||||
/// paths whose bounds it is near.
|
||||
fn selected_part_boxes(cx: &ToolContext) -> std::sync::Arc<[(NodeId, vectorcraft_geom::Rect)]> {
|
||||
crate::select::selected_part_boxes(cx, || {
|
||||
let editable = cx.doc.editable();
|
||||
let mut v = vec![];
|
||||
for root in cx.selection.objects.iter().filter_map(|&id| cx.doc.node(id)) {
|
||||
@@ -638,15 +657,21 @@ pub fn over_selected_part(cx: &ToolContext, p: Point) -> bool {
|
||||
}
|
||||
});
|
||||
}
|
||||
// The paint order of every node, a Shaper Group's original shapes included (isolation can
|
||||
// select them); the topmost path comes first.
|
||||
fn walk_all(n: &Node, order: &mut std::collections::HashMap<NodeId, usize>) {
|
||||
let i = order.len();
|
||||
order.insert(n.id, i);
|
||||
for c in n.children().into_iter().flatten() {
|
||||
walk_all(c, order);
|
||||
}
|
||||
}
|
||||
let mut order = std::collections::HashMap::new();
|
||||
for l in &cx.doc.layers {
|
||||
walk_all(l, &mut order);
|
||||
}
|
||||
v.sort_by_key(|(id, _)| std::cmp::Reverse(order.get(id).copied()));
|
||||
v.into()
|
||||
});
|
||||
boxes.iter().any(|&(id, b)| {
|
||||
b.inflate(tol, tol).contains(p)
|
||||
&& cx.doc.node(id).and_then(editable_path).is_some_and(|pd| {
|
||||
#[cfg(test)]
|
||||
MEASURED_PARTS.set(MEASURED_PARTS.get() + 1);
|
||||
nearest_anchor(&pd, p, tol, None).is_some()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -823,13 +848,37 @@ struct SegmentHit {
|
||||
fn next_group(cx: &ToolContext, ancestry: &[NodeId]) -> Option<NodeId> {
|
||||
// Skip the layer and its sublayers: they are not objects.
|
||||
let layers = ancestry.iter().take_while(|id| cx.doc.node(**id).is_some_and(Node::is_layer)).count().max(1);
|
||||
ancestry
|
||||
let chain: Vec<NodeId> = ancestry
|
||||
.iter()
|
||||
.skip(layers)
|
||||
.rev()
|
||||
.copied()
|
||||
.take_while(|id| in_scope(cx.doc, cx.isolation, *id) && !cx.doc.node(*id).is_some_and(Node::is_layer))
|
||||
.find(|id| !cx.selection.contains(*id))
|
||||
.collect();
|
||||
// The groups inside a selected group are selected with it: the next one is above the outermost
|
||||
// selected one.
|
||||
let outermost = chain.iter().rposition(|id| cx.selection.contains(*id));
|
||||
chain.get(outermost.map_or(0, |i| i + 1)).copied()
|
||||
}
|
||||
|
||||
/// Is `id` selected as an object: itself, or inside a selected group or other selected object? A
|
||||
/// press on a member of a selected group keeps the group selected, and a drag moves the group
|
||||
/// whole, as for a path that is itself selected.
|
||||
fn in_selection(cx: &ToolContext, id: NodeId) -> bool {
|
||||
!cx.selection.objects.is_empty()
|
||||
&& (cx.selection.contains(id) || cx.doc.ancestry(id).is_some_and(|a| a.iter().any(|x| cx.selection.contains(*x))))
|
||||
}
|
||||
|
||||
/// The selected objects and the objects inside them that Direct Selection may pick: the objects
|
||||
/// among those [`walk_pickable`] visits that [`in_selection`] accepts.
|
||||
fn in_selection_all(cx: &ToolContext) -> HashSet<NodeId> {
|
||||
let mut set = HashSet::new();
|
||||
for root in cx.selection.objects.iter().filter_map(|&id| cx.doc.node(id)) {
|
||||
walk_pickable_from(root, &mut |n| {
|
||||
set.insert(n.id);
|
||||
});
|
||||
}
|
||||
set
|
||||
}
|
||||
|
||||
/// Is an object of instance `id`'s art selected ([`vectorcraft_doc::Selection::symbol_part`]),
|
||||
@@ -1332,7 +1381,7 @@ impl DirectSelectionTool {
|
||||
// anchors on mouse over finds them: walking every path on each hover is too slow.
|
||||
let hit = hit_test(cx.doc, p, cx.selection_hit_options());
|
||||
if let Some((id, _)) = hovered_anchor_with_hit(cx, p, hit.as_ref()) {
|
||||
return Some(if cx.selection.contains(id) { Cursor::DirectAnchorSelected } else { Cursor::DirectAnchor });
|
||||
return Some(if in_selection(cx, id) { Cursor::DirectAnchorSelected } else { Cursor::DirectAnchor });
|
||||
}
|
||||
if hit_frame_edge(cx, p, tol).is_some() {
|
||||
return None;
|
||||
@@ -1344,7 +1393,7 @@ impl DirectSelectionTool {
|
||||
return None;
|
||||
}
|
||||
let h = hit?;
|
||||
let whole = cx.selection.contains(h.leaf) && cx.selection.partial(h.leaf).is_none();
|
||||
let whole = in_selection(cx, h.leaf) && cx.selection.partial(h.leaf).is_none();
|
||||
let curved = matches!(h.kind, HitKind::Stroke | HitKind::Outline) && segment_at(cx, h.leaf, p).is_some_and(|s| s.curved);
|
||||
(!whole && curved).then_some(Cursor::ReshapeSegment)
|
||||
}
|
||||
@@ -1360,7 +1409,11 @@ fn hovered_anchor(cx: &ToolContext, p: Point) -> Option<(NodeId, Point)> {
|
||||
fn hovered_anchor_with_hit(cx: &ToolContext, p: Point, hit: Option<&Hit>) -> Option<(NodeId, Point)> {
|
||||
let tol = cx.point_tol();
|
||||
let under = hit.map(|h| cx.doc.node(h.leaf).and_then(|n| compound_part_at(n, p, tol)).unwrap_or(h.leaf));
|
||||
cx.selection.objects.iter().copied().filter(|id| in_scope(cx.doc, cx.isolation, *id)).chain(under).find_map(|id| {
|
||||
// The paths inside a selected group come before an object above them, as a press takes them
|
||||
// ([`hit_anchor`]).
|
||||
let selected = if cx.selection.objects.is_empty() { None } else { Some(selected_part_boxes(cx)) };
|
||||
let near = selected.iter().flat_map(|boxes| boxes.iter()).filter(|(_, b)| b.inflate(tol, tol).contains(p)).map(|&(id, _)| id);
|
||||
near.filter(|id| in_scope(cx.doc, cx.isolation, *id)).chain(under).find_map(|id| {
|
||||
let path = cx.doc.node(id).and_then(editable_path)?;
|
||||
nearest_anchor(&path, p, tol, None).map(|(.., a)| (id, a))
|
||||
})
|
||||
@@ -1481,7 +1534,9 @@ impl DirectSelectionTool {
|
||||
h.ancestry.push(part);
|
||||
h.leaf = part;
|
||||
}
|
||||
let target = if cx.selection.contains(h.leaf) { next_group(cx, &h.ancestry).unwrap_or(h.leaf) } else { h.leaf };
|
||||
// On an object selected itself or inside a selected group, a click adds the next group up,
|
||||
// and keeps the selection when the outermost group is selected already.
|
||||
let inside = in_selection(cx, h.leaf);
|
||||
let mut deselect = None;
|
||||
let mut out = vec![];
|
||||
if ev.mods.shift {
|
||||
@@ -1490,15 +1545,13 @@ impl DirectSelectionTool {
|
||||
if cx.selection.contains(h.leaf) {
|
||||
deselect = Some(h.leaf);
|
||||
} else {
|
||||
out.push(Action::Exec("select.toggle".into(), json!({"id": target.0})));
|
||||
}
|
||||
} else if !cx.selection.contains(target) {
|
||||
if cx.selection.contains(h.leaf) {
|
||||
// A completed click climbs the group; a drag moves only the selected art.
|
||||
self.click_group = Some(target);
|
||||
} else {
|
||||
out.push(Action::Exec("select.set".into(), json!({"ids": [target.0]})));
|
||||
out.push(Action::Exec("select.toggle".into(), json!({"id": h.leaf.0})));
|
||||
}
|
||||
} else if !inside {
|
||||
out.push(Action::Exec("select.set".into(), json!({"ids": [h.leaf.0]})));
|
||||
} else if let Some(target) = next_group(cx, &h.ancestry) {
|
||||
// A completed click climbs the group; a drag moves only the selected art.
|
||||
self.click_group = Some(target);
|
||||
}
|
||||
self.state = Self::move_object(cx, &h, p, deselect);
|
||||
out
|
||||
@@ -1539,15 +1592,16 @@ impl DirectSelectionTool {
|
||||
// already selected whole, an Alt-click adds the next enclosing group on release.
|
||||
if ev.mods.alt {
|
||||
self.state = State::MoveObject { start: p, grab: Some(grab), hold: grab, edge: false, began: false, deselect: None };
|
||||
let whole = cx.selection.contains(id) && cx.selection.partial(id).is_none();
|
||||
let whole = in_selection(cx, id) && cx.selection.partial(id).is_none();
|
||||
if whole && !ev.mods.shift {
|
||||
self.click_group = cx.doc.ancestry(id).and_then(|a| next_group(cx, &a));
|
||||
}
|
||||
return if whole { vec![] } else { vec![Action::Exec("select.set".into(), json!({"ids": [id.0]}))] };
|
||||
}
|
||||
// A path with all its anchors selected is stored whole (no partial entry).
|
||||
// A path with all its anchors selected is stored whole (no partial entry), and so is each
|
||||
// path inside a selected group.
|
||||
let already =
|
||||
cx.selection.contains(id) && !cx.selection.segments.contains_key(&id) && cx.selection.partial(id).is_none_or(|s| s.contains(&(si, ai)));
|
||||
in_selection(cx, id) && !cx.selection.segments.contains_key(&id) && cx.selection.partial(id).is_none_or(|s| s.contains(&(si, ai)));
|
||||
// Paths all selected whole move as objects, held by this anchor, so Alt can turn
|
||||
// the copy on and off during the drag as with the Selection tool.
|
||||
self.state = if already && cx.selection.anchors.is_empty() {
|
||||
@@ -1625,7 +1679,7 @@ impl DirectSelectionTool {
|
||||
// A segment pick keeps its endpoints available for movement without selecting
|
||||
// the anchors themselves. Dragging reshapes a curve, else moves it. Alt picks
|
||||
// the whole path (and Alt-drag copies it), as with Group Selection.
|
||||
let whole = cx.selection.contains(h.leaf) && cx.selection.partial(h.leaf).is_none() && !part_picked(cx, h.leaf);
|
||||
let whole = in_selection(cx, h.leaf) && cx.selection.partial(h.leaf).is_none() && !part_picked(cx, h.leaf);
|
||||
if !ev.mods.alt
|
||||
&& matches!(h.kind, HitKind::Stroke | HitKind::Outline)
|
||||
&& let Some(s) = segment_at(cx, h.leaf, p)
|
||||
@@ -1661,7 +1715,8 @@ impl DirectSelectionTool {
|
||||
return vec![Action::Exec("select.toggle".into(), json!({"id": h.leaf.0}))];
|
||||
}
|
||||
self.frame.clear();
|
||||
if !cx.selection.contains(h.leaf) || cx.selection.partial(h.leaf).is_some() || part_picked(cx, h.leaf) {
|
||||
// A press inside a selected group keeps the group: a drag moves it whole.
|
||||
if !whole {
|
||||
return vec![Action::Exec("select.set".into(), json!({"ids": [h.leaf.0]}))];
|
||||
}
|
||||
vec![]
|
||||
@@ -1869,7 +1924,9 @@ impl DirectSelectionTool {
|
||||
(true, ..) => vec![Action::Commit],
|
||||
(false, Some(id), _, _) => vec![Action::Exec("select.toggle".into(), json!({"id": id.0}))],
|
||||
(false, None, Some((id, si, ai)), _) => {
|
||||
if has_multiple_selected_anchors(cx) {
|
||||
// The key anchor is on a path selected itself (`select.key`); a click on an anchor of
|
||||
// a path inside a selected group selects that anchor alone.
|
||||
if cx.selection.contains(id) && has_multiple_selected_anchors(cx) {
|
||||
if cx.selection.key_anchor == Some((id, (si, ai))) {
|
||||
vec![Action::Exec("select.key".into(), json!({}))]
|
||||
} else {
|
||||
|
||||
@@ -1306,6 +1306,83 @@ fn group_selection_distinguishes_selected_leaf_drags_from_clicks() {
|
||||
assert!(t.pointer(&context, &PointerEvent::new(PointerKind::Up, 150.0, 150.0)).is_empty());
|
||||
}
|
||||
|
||||
/// A path inside a selected group counts as selected whole. With Direct Selection a click on its
|
||||
/// fill keeps the group, a drag from its fill or an anchor moves the group whole, and a click on an
|
||||
/// anchor selects that anchor alone; its anchors show the selected-anchor cursor and an object
|
||||
/// above the group does not take a press on one. With Group Selection a click adds the next group
|
||||
/// up and keeps the selection at the outermost one, and a drag moves the selection.
|
||||
#[test]
|
||||
fn a_press_inside_a_selected_group_keeps_the_group() {
|
||||
let (mut d, inside, _, inner, outer) = nested_group_doc();
|
||||
let p = paint();
|
||||
let mut s = Selection::default();
|
||||
s.set([outer]);
|
||||
let moves = |a: &[Action]| matches!(a, [Action::Begin(n), Action::Preview(c, _)] if n == "Move" && c == "object.transform");
|
||||
for group in [false, true] {
|
||||
let c = cx(&d, &s, &p);
|
||||
let mut t = DirectSelectionTool::new(group);
|
||||
let down = PointerEvent::new(PointerKind::Down, 150.0, 150.0);
|
||||
assert!(t.pointer(&c, &down).is_empty(), "a press on the fill (group: {group})");
|
||||
assert!(t.pointer(&c, &PointerEvent::new(PointerKind::Up, 150.0, 150.0)).is_empty(), "a click on the fill (group: {group})");
|
||||
assert!(t.pointer(&c, &down).is_empty());
|
||||
let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 180.0, 165.0));
|
||||
assert!(moves(&a), "a drag from the fill (group: {group}): {a:?}");
|
||||
assert_eq!(t.pointer(&c, &PointerEvent::new(PointerKind::Up, 180.0, 165.0)), vec![Action::Commit]);
|
||||
}
|
||||
let c = cx(&d, &s, &p);
|
||||
let mut t = DirectSelectionTool::new(false);
|
||||
let corner = PointerEvent::new(PointerKind::Down, 100.0, 100.0);
|
||||
assert!(t.pointer(&c, &corner).is_empty(), "a press on an anchor");
|
||||
let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 130.0, 115.0));
|
||||
assert!(moves(&a), "a drag from an anchor: {a:?}");
|
||||
t.pointer(&c, &PointerEvent::new(PointerKind::Up, 130.0, 115.0));
|
||||
t.pointer(&c, &corner);
|
||||
assert_eq!(
|
||||
t.pointer(&c, &PointerEvent::new(PointerKind::Up, 100.0, 100.0)),
|
||||
vec![Action::Exec("select.anchors".into(), json!({"id": inside.0, "anchors": [[0, 0]], "mode": "set"}))],
|
||||
"a click on an anchor"
|
||||
);
|
||||
assert_eq!(DirectSelectionTool::new(false).cursor(&c, Point::new(100.0, 100.0), Mods::default()), Cursor::DirectAnchorSelected);
|
||||
let mut t = DirectSelectionTool::new(false);
|
||||
assert!(t.pointer(&c, &PointerEvent::new(PointerKind::Down, 150.0, 100.0)).is_empty(), "a press on a segment");
|
||||
let a = t.pointer(&c, &PointerEvent::new(PointerKind::Up, 150.0, 100.0));
|
||||
assert!(matches!(a.as_slice(), [Action::Exec(c, v)] if c == "select.segments" && v["id"] == inside.0), "a click on a segment: {a:?}");
|
||||
// Group Selection climbs from a selected inner group to the group around it.
|
||||
let mut climb = Selection::default();
|
||||
climb.set([inner]);
|
||||
let c = cx(&d, &climb, &p);
|
||||
let mut t = DirectSelectionTool::new(true);
|
||||
assert!(t.pointer(&c, &PointerEvent::new(PointerKind::Down, 150.0, 150.0)).is_empty());
|
||||
assert_eq!(t.pointer(&c, &PointerEvent::new(PointerKind::Up, 150.0, 150.0)), vec![Action::Exec("select.add".into(), json!({"ids": [outer.0]}))]);
|
||||
// With two anchors of a path beside the group selected too, the click still selects the anchor
|
||||
// alone: the key anchor is on a path selected itself.
|
||||
let l = d.layers[0].id;
|
||||
let beside = d.alloc_id();
|
||||
let rect = vectorcraft_geom::shapes::rectangle(Rect::new(420.0, 420.0, 480.0, 480.0));
|
||||
d.insert(Some(l), usize::MAX, vectorcraft_doc::Node::path(beside, rect, vectorcraft_doc::Appearance::default_art())).unwrap();
|
||||
let mut mixed = Selection::default();
|
||||
mixed.set([outer, beside]);
|
||||
mixed.anchors.insert(beside, BTreeSet::from([(0, 0), (0, 1)]));
|
||||
let c = cx(&d, &mixed, &p);
|
||||
let mut t = DirectSelectionTool::new(false);
|
||||
assert!(t.pointer(&c, &corner).is_empty());
|
||||
assert_eq!(
|
||||
t.pointer(&c, &PointerEvent::new(PointerKind::Up, 100.0, 100.0)),
|
||||
vec![Action::Exec("select.anchors".into(), json!({"id": inside.0, "anchors": [[0, 0]], "mode": "set"}))],
|
||||
"a click on an anchor with anchors of {beside:?} selected"
|
||||
);
|
||||
// An opaque object above the group, over the anchor.
|
||||
let cover = d.alloc_id();
|
||||
let rect = vectorcraft_geom::shapes::rectangle(Rect::new(50.0, 50.0, 250.0, 250.0));
|
||||
d.insert(Some(l), usize::MAX, vectorcraft_doc::Node::path(cover, rect, vectorcraft_doc::Appearance::default_art())).unwrap();
|
||||
let c = cx(&d, &s, &p);
|
||||
let mut t = DirectSelectionTool::new(false);
|
||||
assert_eq!(hovered_anchor(&c, Point::new(100.0, 100.0)), Some((inside, Point::new(100.0, 100.0))), "the anchor under {cover:?} is highlighted");
|
||||
assert_eq!(t.cursor(&c, Point::new(100.0, 100.0), Mods::default()), Cursor::DirectAnchorSelected);
|
||||
assert!(t.pointer(&c, &corner).is_empty(), "a press on an anchor under {cover:?}");
|
||||
assert!(moves(&t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 130.0, 115.0))));
|
||||
}
|
||||
|
||||
/// Isolation mode: a marquee and an anchor click take the path inside the isolated group and
|
||||
/// leave the path beside it. Group Selection stops at the isolated group instead of adding
|
||||
/// the group around it.
|
||||
@@ -3002,3 +3079,31 @@ fn select_behind_is_measured_once_for_a_point() {
|
||||
assert!(crate::select::selects_behind_at(&c, at));
|
||||
assert_eq!(MEASURED_PARTS.get() - before, 1, "measured for the first ask only");
|
||||
}
|
||||
|
||||
/// With two selected groups whose anchors sit on the same point, the highlighted anchor is the one
|
||||
/// a press takes: the front group's, whatever order the groups were selected in.
|
||||
#[test]
|
||||
fn the_highlighted_anchor_of_two_selected_groups_is_the_one_a_press_takes() {
|
||||
let mut d = vectorcraft_doc::Document::new(500.0, 500.0);
|
||||
let l = d.layers[0].id;
|
||||
let (back_path, back, front_path, front) = (d.alloc_id(), d.alloc_id(), d.alloc_id(), d.alloc_id());
|
||||
let path = |id, x| {
|
||||
std::sync::Arc::new(vectorcraft_doc::Node::path(
|
||||
id,
|
||||
vectorcraft_geom::shapes::rectangle(Rect::new(x, x, x + 100.0, x + 100.0)),
|
||||
vectorcraft_doc::Appearance::default_art(),
|
||||
))
|
||||
};
|
||||
d.insert(Some(l), 0, vectorcraft_doc::Node::group(back, vec![path(back_path, 100.0)])).unwrap();
|
||||
d.insert(Some(l), usize::MAX, vectorcraft_doc::Node::group(front, vec![path(front_path, 100.0)])).unwrap();
|
||||
let p = paint();
|
||||
let corner = Point::new(100.0, 100.0);
|
||||
for order in [[back, front], [front, back]] {
|
||||
let mut s = Selection::default();
|
||||
s.set(order);
|
||||
let c = cx(&d, &s, &p);
|
||||
let pressed = hit_anchor(&c, corner, c.point_tol()).map(|(id, ..)| id);
|
||||
assert_eq!(pressed, Some(front_path), "a press takes the front anchor (selected {order:?})");
|
||||
assert_eq!(hovered_anchor(&c, corner), Some((front_path, corner)), "the front anchor is highlighted (selected {order:?})");
|
||||
}
|
||||
}
|
||||
@@ -852,6 +852,7 @@ since 2026-10-01.
|
||||
- **Existing-guide Escape cancellation (G1):** Escape clears a pending guide press or drag through Selection and Direct/Group Selection, cancelling a begun preview. Eight app-input regressions cover both axes, move/copy, temporary selection-tool borrowing from idle Pen, preselected-guide document/interaction-start selection and Undo/Redo/saved-state preservation, later on-canvas motion/release, Shift-press cancellation, and ordinary-release/Enter/idle controls. Historical focused checks on `8ab574b7` recorded five expected RED failures with three passing controls, then all eight GREEN tests and the Direct Selection Escape control passed. All nine also passed in current full CI. A full CI retry on the five-unit combined source at `a0671777` passed all seven stages with 6,613 test outcomes on 2026-10-14. An earlier full-CI run on the identical source panicked in the randomized `ai_mutated_save_never_panics` test; the cause remains unresolved. This five-fix batch does not claim to repair that failure. The original 1280×960 headless app capture from `b076025a` was reviewed for one vertical Selection guide after Escape; source review found its scene unchanged on `a0671777`. Scores and hours unchanged.
|
||||
- **Escape in more tool drags:** Escape during an Anchor Point drag, a Mesh tool drag, a Direct Selection drag of a mesh point, a corner widget or the brackets of type on a path, or a Shape Builder drag cancels it: the art goes back to how the press found it, no undo step is added, the release does nothing, and the tool stays chosen. Escape during a Measure tool drag brings back the measurement before it. Regression tests: `escape_cancels_*` in `draw2/anchor/tests.rs`, `meshedit.rs`, `direct/tests.rs`, `builder/tests.rs` and `xform/measure.rs`, and `escape_cancels_an_anchor_point_mesh_shape_builder_or_measure_drag` in `tests/toolescape.rs`.
|
||||
- **Shift-click on corner widgets (#5188):** with Direct Selection, when every corner of a path is selected (the path selected whole), a Shift-click on a corner widget picks that corner alone, so the next drag rounds just it. The other corners' widgets then hide; a Shift-click on another corner's anchor adds that corner and shows its widget, and a Shift-click on a showing widget deselects its corner. Adding a corner by Shift-clicking its widget while it is hidden stays open (#1232). Corner widgets are chosen by clicking one and Shift-clicking the others ([Logos By Nick, rounded corners in Illustrator](https://logosbynick.com/?p=15787)). Test: `corners::tests::a_shift_click_on_a_widget_of_a_whole_path_picks_its_corner`.
|
||||
- **A press inside a selected group** (VectorCraft's own rule): with Direct Selection, a path inside a selected group counts as selected whole. A click on its fill keeps the group selected, a drag from its fill or one of its anchors moves the group whole, and a click on an anchor or a segment selects it alone. The path's anchors show the selected-anchor cursor and highlight, and an object above the group does not take a press on one. Group Selection adds the group above the outermost selected one. This also applies to the Cmd/Ctrl press the Selection tool lends Direct Selection. Test: `direct::tests::a_press_inside_a_selected_group_keeps_the_group`.
|
||||
- **TIFF in screen and asset export:** both format menus expose the existing TIFF encoder and Format Settings. Headless UI regressions choose TIFF and check scaled dimensions, artboard selection, filenames, encoding options, saved settings and collected-asset output. Public reference: [Export for Screens](https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/export-for-screens.html), updated 2026-09-28, lists TIFF for both artboards and assets. Adobe staff [confirmed support in 30.2.1](https://illustrator.uservoice.com/forums/333657-illustrator-desktop-feature-requests/suggestions/49081034-add-tiff-format-into-export-for-screens-assets-d) on 2026-02-19; the older 2025 Collect assets guide omits TIFF.
|
||||
- **Lossy WebP with a Quality setting:** WebP Options has a Compression menu (Lossless, Lossy) and a Quality slider from 0 to 100 that is enabled for Lossy. Lossy writes a `VP8 ` WebP file, with an `ALPH` chunk that keeps the alpha exactly when some pixels are not opaque. `document.export`, `document.serialize` and Export for Screens take `lossless: false` with `quality` (default 90, VectorCraft's own value), in a format row or in `settings.webp`; Format Settings for WebP keeps both. Lossless stays the default, and a quality above 100 or one that is not a whole number is refused. Public reference: [export file format options](https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/export-file-format-options-in-illustrator.html) describes Lossless and Lossy WebP and a Quality setting for Lossy (`webp_is_lossless_by_default_and_lossy_when_asked`, `lossy_webp_keeps_translucent_pixels`, `webp_quality_out_of_its_range_is_refused` in `crates/engine/src/cmd/fileio/tests_text.rs`, `webp_options_choose_lossless_or_lossy_at_a_quality`).
|
||||
- **Export for Screens of the selected artboards:** while the Artboard tool is in use, File › Export › Export for Screens… (`file.exportForScreens`) opens with the artboards the tool has selected checked on its Artboards tab, and Export Artboard writes only those. Shift-clicks on the canvas, or Shift- or Ctrl/Cmd-clicks on the Artboards panel's rows, select several. The other fields show the settings the document last exported with. With another tool in use, the dialog takes its artboard choice from those settings too. Public reference: [Export selected artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/organize-manage-artboards/export-artboards.html).
|
||||
|
||||
Reference in new issue
Block a user