This commit is contained in:
bflatastic
2026-11-19 01:26:09 +07:00
38 changed files with 469 additions and 13 deletions
+38 -1
View File
@@ -214,6 +214,25 @@ fn spine_points_param(p: &Value, cmd: &str) -> Result<Vec<usize>> {
list.iter().map(|i| i.as_u64().and_then(|i| usize::try_from(i).ok()).ok_or_else(wrong)).collect()
}
/// Whether linking handle `out` of spine point `index` at `q` would leave the blend's spine as it
/// is (false when the blend or the point is not there, for the edit to report it).
fn spine_link_unchanged(s: &Session, p: &Value, cmd: &str, index: usize, out: bool, q: Point) -> Result<bool> {
let id = match crate::cmd::object_param(p, "id", cmd)? {
Some(id) => Some(id),
None => selected_of(s, is_blend).first().copied(),
};
let d = &s.doc()?.doc;
let Some(NodeKind::Blend { children, spec }) = id.and_then(|id| d.node(id)).map(|n| &n.kind) else { return Ok(false) };
let Some((path, _)) = live::pin_spine(children, spec) else { return Ok(false) };
Ok(path.subpaths.first().is_some_and(|sp| {
sp.anchors.get(index).is_some_and(|a| {
let mut linked = *a;
linked.link_handle(out, q, sp.has_segment(index, !out));
linked == *a
})
}))
}
pub(super) fn spine_move_anchor(s: &mut Session, p: &Value) -> Result<Value> {
const C: &str = "object.blend.spine.moveAnchor";
let index = index_param(p, "anchor", C)?;
@@ -225,15 +244,33 @@ pub(super) fn spine_move_anchor(s: &mut Session, p: &Value) -> Result<Value> {
Some(_) => return Err(bad(C, "handle must be in or out")),
};
let independent = switch_or(p, "independent", false, C)?;
let link = switch_or(p, "link", false, C)?;
let with = spine_points_param(p, C)?;
// Any `with`, even an empty list, asks to move points, which a handle drag doesn't.
if handle.is_some() && p.get("with").is_some_and(|v| !v.is_null()) {
return Err(bad(C, "`with` moves points, not a handle"));
}
if link && independent {
return Err(bad(C, "`link` and `independent` cannot both be true"));
}
if link && handle.is_none() {
return Err(bad(C, "`link` places a handle: give `handle`"));
}
if link && let Some(out) = handle {
// A spine point the linked handles would leave as it is records no undo step.
if spine_link_unchanged(s, p, C, index, out, q)? {
return ok();
}
}
edit_spine(s, p, C, "Reshape Spine", |sp, anchors, keys| {
let pull_out = handle.is_some_and(|out| sp.has_segment(index, !out));
let a = sp.anchors.get_mut(index).ok_or_else(|| bad(C, "no such spine point"))?;
if let Some(out) = handle {
a.set_handle(out, q, independent);
if link {
a.link_handle(out, q, pull_out);
} else {
a.set_handle(out, q, independent);
}
return Ok(());
}
let delta = q - a.p;
+1 -1
View File
@@ -99,7 +99,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Move Spine Point",
[],
None,
"{id? (default: the selected blend), anchor: index, x, y, with?: [index…], handle?: in|out, independent?: bool} move a point of the blend's spine (its handles along), and the points `with` names by as much, or with `handle` place that handle's end at (x, y) (a smooth point keeps the other handle in line unless `independent`). A key object sitting on a moved point moves with it. The first edit turns the straight spine into a path",
"{id? (default: the selected blend), anchor: index, x, y, with?: [index…], handle?: in|out, independent?: bool, link?: bool} move a point of the blend's spine (its handles along), and the points `with` names by as much, or with `handle` place that handle's end at (x, y) (a smooth point keeps the other handle in line unless `independent`; `link` makes the point smooth with the other handle in line at its own length, a retracted one pulled out to the moved handle's length where a segment leaves the point on its side; `link` needs `handle` and cannot go with `independent`). A key object sitting on a moved point moves with it. The first edit turns the straight spine into a path",
has_doc,
spine_move_anchor
),
+40 -1
View File
@@ -50,7 +50,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Move Direction Handle",
[],
None,
"{id, subpath?, anchor, which: \"in\"|\"out\", x, y, independent?: bool}",
"{id, subpath?, anchor, which: \"in\"|\"out\", x, y, independent?: bool, link?: bool} move a direction handle; independent moves only that side and makes the anchor a corner; link makes the anchor smooth with the other handle in line at its own length (a retracted one is pulled out to the moved handle's length where a segment leaves the anchor on its side); link and independent cannot both be true; both default false",
has_doc,
set_handle
),
@@ -457,6 +457,9 @@ fn set_handle(s: &mut Session, p: &Value) -> Result<Value> {
let ai = index_opt(p, "anchor", "path.setHandle")?.ok_or_else(|| bad("path.setHandle", "missing anchor"))?;
let out = str_param(p, "which") != Some("in");
let pos = Point::new(f64_req(p, "x", "path.setHandle")?, f64_req(p, "y", "path.setHandle")?);
if switch_or(p, "link", false, "path.setHandle")? {
return link_handle(s, p, id, si, ai, out, pos);
}
let independent = switch_or(p, "independent", false, "path.setHandle")?;
// A handle already there, on an anchor already of the kind it would get, changes nothing and
// records no undo step. The handle is compared directly: `set_handle` would recompute the
@@ -476,6 +479,42 @@ fn set_handle(s: &mut Session, p: &Value) -> Result<Value> {
ok()
}
/// `path.setHandle` with `link` (the Anchor Point tool's Alt-drag on a handle): the handle goes to
/// (x, y) and the anchor becomes smooth, its other handle turned in line at its own length. A
/// retracted other handle is pulled out to the moved handle's length when a segment leaves the
/// anchor on its side, and stays retracted at an open end. An anchor the edit would leave as it
/// is records no undo step.
fn link_handle(s: &mut Session, p: &Value, id: NodeId, si: usize, ai: usize, out: bool, pos: Point) -> Result<Value> {
const C: &str = "path.setHandle";
if switch_or(p, "independent", false, C)? {
return Err(bad(C, "`link` and `independent` cannot both be true"));
}
if !(pos.x.abs() < 1e9 && pos.y.abs() < 1e9) {
return Err(bad(C, "x and y must be finite"));
}
if s.script_running() {
return Err(EngineError::Busy);
}
let unchanged = s.doc()?.doc.node(id).and_then(|n| n.path_data()).and_then(|pd| pd.subpaths.get(si)).is_some_and(|sp| {
sp.anchors.get(ai).is_some_and(|a| {
let mut linked = *a;
linked.link_handle(out, pos, sp.has_segment(ai, !out));
linked == *a
})
});
if unchanged {
return ok();
}
s.edit("Reshape", |d, _| {
let sp = path_mut(d, id)?.subpaths.get_mut(si).ok_or_else(|| EngineError::Other("no such anchor".into()))?;
let pull_out = sp.has_segment(ai, !out);
let a = sp.anchors.get_mut(ai).ok_or_else(|| EngineError::Other("no such anchor".into()))?;
a.link_handle(out, pos, pull_out);
Ok(())
})?;
ok()
}
/// `path.moveAnchor`: one anchor to (x, y), its handles keeping their offsets (the Anchor Point
/// tool's Shift-drag).
fn move_anchor(s: &mut Session, p: &Value) -> Result<Value> {
@@ -176,3 +176,61 @@ fn a_handle_already_in_place_on_a_smooth_anchor_records_no_undo_step() {
.unwrap();
assert_eq!(undo_steps(&s), 1);
}
/// `path.setHandle` with `link` makes a corner smooth: the other handle turns in line at its own
/// length, a retracted one is pulled out to the moved handle's length where a segment leaves the
/// anchor on its side and stays retracted at an open end. A handle already in place on a corner
/// still links; a request that changes nothing records no undo step; `link` that is not a boolean
/// or goes with `independent` is refused.
#[test]
fn a_linked_handle_makes_the_anchor_smooth() {
let (mut s, id) = long_path(100);
let p = anchor(&s, id, 5).p;
let corner = Anchor { p, h_in: p + Vec2::new(-6.0, 8.0), h_out: p + Vec2::new(3.0, 0.0), kind: AnchorKind::Corner };
let path = Arc::make_mut(&mut s.doc_mut().unwrap().doc).node_mut(id).unwrap().path_data_mut().unwrap();
path.subpaths[0].anchors[5] = corner;
let link = |x: f64, y: f64, ai: usize| json!({"id": id.0, "anchor": ai, "which": "out", "x": x, "y": y, "link": true});
let near = |a: Point, b: Point| a.distance(b) < 1e-9;
// The out handle stays where it is; the corner becomes smooth, the in handle turned opposite it.
s.execute("path.setHandle", &link(corner.h_out.x, corner.h_out.y, 5)).unwrap();
assert_eq!(undo_steps(&s), 1);
let a = anchor(&s, id, 5);
assert_eq!((a.kind, a.h_out), (AnchorKind::Smooth, corner.h_out));
assert!(near(a.h_in, p + Vec2::new(-10.0, 0.0)), "{a:?}");
// Moved: the in handle keeps its length of 10.
let to = p + Vec2::new(4.0, 3.0);
s.execute("path.setHandle", &link(to.x, to.y, 5)).unwrap();
assert_eq!(undo_steps(&s), 2);
let a = anchor(&s, id, 5);
assert!(a.kind == AnchorKind::Smooth && a.h_out == to && near(a.h_in, p + Vec2::new(-8.0, -6.0)), "{a:?}");
// The same request again changes nothing.
s.execute("path.setHandle", &link(to.x, to.y, 5)).unwrap();
assert_eq!(undo_steps(&s), 2);
// A retracted in handle on an inner anchor is pulled out; at the open start it stays retracted.
let q = anchor(&s, id, 7).p;
s.execute("path.setHandle", &link(q.x, q.y + 5.0, 7)).unwrap();
let a = anchor(&s, id, 7);
assert!(a.kind == AnchorKind::Smooth && near(a.h_in, q + Vec2::new(0.0, -5.0)), "{a:?}");
let q = anchor(&s, id, 0).p;
s.execute("path.setHandle", &link(q.x, q.y + 5.0, 0)).unwrap();
let a = anchor(&s, id, 0);
assert!(a.kind == AnchorKind::Smooth && a.h_in == q && a.h_out == q + Vec2::new(0.0, 5.0), "{a:?}");
let before = s.doc().unwrap().doc.clone();
let undo = undo_steps(&s);
for bad in [
json!({"id": id.0, "anchor": 5, "which": "out", "x": 0, "y": 0, "link": "yes"}),
json!({"id": id.0, "anchor": 5, "which": "out", "x": 0, "y": 0, "link": 1}),
json!({"id": id.0, "anchor": 5, "which": "out", "x": 0, "y": 0, "link": true, "independent": true}),
json!({"id": id.0, "anchor": 5, "which": "out", "x": 0, "y": 0, "link": true, "independent": "no"}),
json!({"id": id.0, "anchor": 100, "which": "out", "x": 0, "y": 0, "link": true}),
json!({"id": id.0, "anchor": 7, "which": "out", "x": 1.7e308, "y": 1.7e308, "link": true}),
json!({"id": id.0, "anchor": 7, "which": "out", "x": 0, "y": -1e9, "link": true}),
] {
assert!(s.execute("path.setHandle", &bad).is_err(), "{bad}");
}
assert!(s.doc().unwrap().doc == before, "a refused request changed the document");
assert_eq!(undo_steps(&s), undo);
}
+32
View File
@@ -431,3 +431,35 @@ fn a_spine_segment_bends_with_perpendicular_handles() {
use vectorcraft_geom::kurbo::ParamCurve;
assert!(sp.segment(0).eval(0.5).distance(Point::new(55.0, 45.0)) < 1e-9, "{sp:?}");
}
/// `link` with `handle` makes a spine point smooth, the other handle in line opposite the moved
/// one, without moving the keys; the same request again records no undo step, and `link` that is
/// not a boolean, goes with `independent` or comes without `handle` is refused.
#[test]
fn a_linked_spine_handle_makes_the_point_smooth() {
let mut s = session();
let (_, _, g) = blend(&mut s);
s.execute("object.blend.spine.addAnchor", &json!({"x": 55, "y": 5})).unwrap();
let undo = |s: &Session| s.doc().unwrap().history.undo.len();
let link = json!({"anchor": 1, "handle": "out", "x": 75, "y": 25, "link": true});
s.execute("object.blend.spine.moveAnchor", &link).unwrap();
let a = spec(&s, g).spine.unwrap().subpaths[0].anchors[1];
assert_eq!((a.kind, a.h_out), (vectorcraft_geom::AnchorKind::Smooth, Point::new(75.0, 25.0)));
let (din, dout) = (a.h_in - a.p, a.h_out - a.p);
assert!(din.hypot() > 1e-6 && (din.normalize() + dout.normalize()).hypot() < 1e-9, "{a:?}");
let st = steps(&s, g);
assert_eq!((center(&st[0]), center(&st[2])), (Point::new(5.0, 5.0), Point::new(105.0, 5.0)), "the keys stay put");
let done = undo(&s);
s.execute("object.blend.spine.moveAnchor", &link).unwrap();
assert_eq!(undo(&s), done, "an unchanged spine recorded an undo step");
let before = spec(&s, g);
for bad in [
json!({"anchor": 1, "handle": "out", "x": 75, "y": 25, "link": "yes"}),
json!({"anchor": 1, "handle": "out", "x": 75, "y": 25, "link": true, "independent": true}),
json!({"anchor": 1, "x": 75, "y": 25, "link": true}),
] {
assert!(s.execute("object.blend.spine.moveAnchor", &bad).is_err(), "{bad}");
}
assert_eq!(spec(&s, g), before);
assert_eq!(undo(&s), done);
}
+121 -1
View File
@@ -158,10 +158,56 @@ impl Anchor {
let dir = p - pos;
let l = dir.hypot();
if l > 1e-9 {
*other = p + dir * (len / l);
let turned = p + dir * (len / l);
if turned.is_finite() {
*other = turned;
} else {
// Long handles overflow the squares above: measure with `f64::hypot` and scale
// the unit direction, leaving the handle where it is if that is not finite.
let (v, l) = (*other - p, dir.x.hypot(dir.y));
let turned = p + (dir / l) * v.x.hypot(v.y);
if turned.is_finite() {
*other = turned;
}
}
}
}
}
/// Place the end of the outgoing (`out`) or incoming handle at `pos` and make the anchor smooth:
/// the other handle turns to lie in line with it on the far side of the anchor, at its own
/// length. A retracted other handle is pulled out to the moved handle's length when `pull_out`
/// and stays retracted otherwise. A handle placed on the anchor, or where the turned handle's
/// end would not be a finite point, gives no direction: it is placed, and the other handle and
/// the anchor's kind stay as they are.
pub fn link_handle(&mut self, out: bool, pos: Point, pull_out: bool) {
let p = self.p;
let (moved, other) = if out { (&mut self.h_out, &mut self.h_in) } else { (&mut self.h_in, &mut self.h_out) };
*moved = pos;
// `f64::hypot` keeps long handles from overflowing the square of their length.
let dir = p - pos;
let l = dir.x.hypot(dir.y);
if !(l > EPS && l.is_finite()) {
return;
}
let v = *other - p;
let len = v.x.hypot(v.y);
let len = if len > EPS {
len
} else if pull_out {
l
} else {
0.0
};
if len > 0.0 {
// The unit direction first, so a short handle does not overflow the scale factor.
let turned = p + (dir / l) * len;
if !turned.is_finite() {
return;
}
*other = turned;
}
self.kind = AnchorKind::Smooth;
}
/// Swap handles (used when reversing path direction).
pub fn reversed(&self) -> Self {
Self { p: self.p, h_in: self.h_out, h_out: self.h_in, kind: self.kind }
@@ -280,6 +326,11 @@ impl SubPath {
pub fn polyline(points: &[Point], closed: bool) -> Self {
Self { anchors: points.iter().map(|&p| Anchor::corner(p)).collect(), closed }
}
/// Whether anchor `ai` has a segment on its outgoing (`out`) or incoming side.
pub fn has_segment(&self, ai: usize, out: bool) -> bool {
let n = self.anchors.len();
ai < n && n > 1 && (self.closed || if out { ai + 1 < n } else { ai > 0 })
}
/// Number of segments (a closed path has one more, back to the start).
pub fn segment_count(&self) -> usize {
let n = self.anchors.len();
@@ -1103,4 +1154,73 @@ mod tests {
let back: PathData = serde_json::from_str(&s).unwrap();
assert_eq!(p, back);
}
/// `link_handle` makes a corner smooth: the other handle turns onto the far side of the anchor
/// at its own length; a retracted one is pulled out to the moved handle's length only when
/// asked, and a handle placed on the anchor changes nothing else.
#[test]
fn link_handle_makes_a_corner_smooth_keeping_the_other_length() {
let p = Point::new(10.0, 10.0);
let mut a = Anchor { p, h_in: Point::new(10.0, 0.0), h_out: Point::new(13.0, 10.0), kind: AnchorKind::Corner };
a.link_handle(true, Point::new(14.0, 13.0), false);
assert_eq!(a.kind, AnchorKind::Smooth);
assert_eq!(a.h_out, Point::new(14.0, 13.0));
// The in handle keeps its length of 10, opposite the out handle's direction (4, 3) / 5.
assert!(a.h_in.distance(Point::new(2.0, 4.0)) < 1e-9, "{:?}", a.h_in);
let retracted = Anchor { p, h_in: p, h_out: Point::new(13.0, 10.0), kind: AnchorKind::Corner };
let mut pulled = retracted;
pulled.link_handle(true, Point::new(13.0, 14.0), true);
assert_eq!((pulled.kind, pulled.h_in), (AnchorKind::Smooth, Point::new(7.0, 6.0)));
let mut kept = retracted;
kept.link_handle(true, Point::new(13.0, 14.0), false);
assert_eq!((kept.kind, kept.h_in), (AnchorKind::Smooth, p));
let mut on_anchor = Anchor { p, h_in: Point::new(10.0, 0.0), h_out: Point::new(13.0, 10.0), kind: AnchorKind::Corner };
on_anchor.link_handle(false, p, true);
assert_eq!(on_anchor, Anchor { p, h_in: p, h_out: Point::new(13.0, 10.0), kind: AnchorKind::Corner });
// A handle so far away that its distance overflows leaves the other handle finite.
let far = Point::new(1.7e308, 1.7e308);
let mut overflow = retracted;
overflow.link_handle(true, far, true);
assert_eq!(overflow, Anchor { p, h_in: p, h_out: far, kind: AnchorKind::Corner });
// A very long other handle turned by a very short one stays finite, at its own length.
let mut long = Anchor { p: Point::ZERO, h_in: Point::new(1e308, 0.0), h_out: Point::ZERO, kind: AnchorKind::Corner };
long.link_handle(true, Point::new(0.0, 1e-8), false);
assert_eq!((long.kind, long.h_in), (AnchorKind::Smooth, Point::new(0.0, -1e308)));
// One whose turned end would leave the finite range is left where it is.
let edge = Point::new(-1.5e308, 0.0);
let mut beyond = Anchor { p: edge, h_in: Point::new(1.5e308, 0.0), h_out: edge, kind: AnchorKind::Corner };
beyond.link_handle(true, Point::new(-1.5e308 + 1e300, 0.0), false);
assert_eq!((beyond.kind, beyond.h_in), (AnchorKind::Corner, Point::new(1.5e308, 0.0)));
}
/// `set_handle` on a smooth anchor turns a very long other handle without overflowing, and
/// leaves it where it is when its turned end would not be a finite point.
#[test]
fn set_handle_on_a_smooth_anchor_keeps_long_handles_finite() {
let mut long = Anchor { p: Point::ZERO, h_in: Point::new(-1e308, 0.0), h_out: Point::new(1.0, 0.0), kind: AnchorKind::Smooth };
long.set_handle(true, Point::new(0.0, 1e-8), false);
assert_eq!(long.h_in, Point::new(0.0, -1e308));
let edge = Point::new(-1.5e308, 0.0);
let mut beyond = Anchor { p: edge, h_in: Point::new(-1.6e308, 0.0), h_out: Point::new(1.5e308, 0.0), kind: AnchorKind::Smooth };
beyond.set_handle(false, Point::new(-1.5e308 + 1e300, 0.0), false);
assert_eq!(beyond.h_out, Point::new(1.5e308, 0.0));
}
/// `has_segment` sees a segment on each side of an inner anchor, none past an open path's ends,
/// and both sides on a closed path of two anchors or more.
#[test]
fn has_segment_follows_the_open_ends() {
let pts = [Point::ZERO, Point::new(10.0, 0.0), Point::new(10.0, 10.0)];
let open = SubPath::polyline(&pts, false);
assert!(!open.has_segment(0, false) && open.has_segment(0, true));
assert!(open.has_segment(1, false) && open.has_segment(1, true));
assert!(open.has_segment(2, false) && !open.has_segment(2, true));
assert!(!open.has_segment(3, false));
let closed = SubPath::polyline(&pts, true);
assert!(closed.has_segment(0, false) && closed.has_segment(2, true));
assert!(!SubPath::polyline(&pts[..1], true).has_segment(0, true));
}
}
+27 -4
View File
@@ -4,7 +4,8 @@
//! Delete: click an anchor to remove it, re-fitting the neighbouring curve (Alt = add).
//! Anchor Point: click a smooth anchor → corner; drag an anchor → pull out smooth handles; click a
//! handle end → retract that handle only (#2267); drag a handle → move it independently (Shift: at
//! 45° steps round its anchor); drag a segment → reshape the curve, a selected blend's spine's too,
//! 45° steps round its anchor; Alt: link it with the opposite handle, the anchor made smooth, except
//! when the Pen lends the tool); drag a segment → reshape the curve, a selected blend's spine's too,
//! straight or curved (#1111; Shift: its handles at right angles to the line between its anchors,
//! at one length). Shift held at the press on an anchor moves it instead, handles and all (Shift
//! still held: at 45° steps from where it was). Space held during a convert- or handle-drag moves
@@ -103,6 +104,9 @@ pub struct AnchorTool {
measure: Option<(Point, f64, f64)>,
/// While Space is held during a convert/handle drag, the shape gesture to return to.
space_resume: Option<SpaceResume>,
/// Lent by the Pen for its Alt gestures: Alt-dragging a handle moves it independently, as
/// without Alt, instead of linking it with the opposite handle.
lent: bool,
}
impl AnchorTool {
@@ -113,7 +117,20 @@ impl AnchorTool {
"scissors" => "scissors",
_ => "addAnchor",
};
Self { id, state: State::Idle, guides: vec![], snap: HandleSnap::default(), measure: None, space_resume: None }
Self { id, state: State::Idle, guides: vec![], snap: HandleSnap::default(), measure: None, space_resume: None, lent: false }
}
/// The Anchor Point tool as the Pen lends it with Alt held: an Alt-drag on a handle moves only
/// that handle.
pub(crate) fn lent_by_pen() -> Self {
Self { lent: true, ..Self::new("anchorPoint") }
}
/// The handle-drag params: Alt held on the chosen Anchor Point tool links the handle with the
/// opposite one, making the anchor smooth; otherwise the handle moves independently.
fn handle_mode(&self, mut params: serde_json::Value, alt: bool) -> serde_json::Value {
params[if alt && !self.lent { "link" } else { "independent" }] = json!(true);
params
}
fn anchor_pos(cx: &ToolContext, id: NodeId, si: usize, ai: usize) -> Option<Point> {
@@ -458,7 +475,10 @@ impl Tool for AnchorTool {
};
Action::Preview(
"object.blend.spine.moveAnchor".into(),
json!({"id": id.0, "anchor": ai, "handle": if out { "out" } else { "in" }, "x": q.x, "y": q.y, "independent": true}),
self.handle_mode(
json!({"id": id.0, "anchor": ai, "handle": if out { "out" } else { "in" }, "x": q.x, "y": q.y}),
ev.mods.alt,
),
)
}
State::Handle { id, si, ai, out, .. } => {
@@ -466,7 +486,10 @@ impl Tool for AnchorTool {
self.guides = guides;
Action::Preview(
"path.setHandle".into(),
json!({"id": id.0, "subpath": si, "anchor": ai, "which": if out { "out" } else { "in" }, "x": q.x, "y": q.y, "independent": true}),
self.handle_mode(
json!({"id": id.0, "subpath": si, "anchor": ai, "which": if out { "out" } else { "in" }, "x": q.x, "y": q.y}),
ev.mods.alt,
),
)
}
State::Reshape { id, seg, t, start, spine: true, .. } => Action::Preview(
+85
View File
@@ -610,3 +610,88 @@ fn anchor_point_shift_drag_honors_measurement_labels() {
assert!(t.overlays(&on).iter().any(|o| matches!(o, Overlay::Measure { text, .. } if text == &want)));
assert!(!t.overlays(&off).iter().any(|o| matches!(o, Overlay::Measure { .. })));
}
/// Alt held while dragging a handle links it with the opposite handle (`link`), making the
/// anchor smooth; without Alt the handle moves on its own. Shift with Alt keeps the 45° steps, an
/// Alt-click still retracts the handle, and Escape cancels the linking drag. The Pen, lending the
/// tool for its Alt gestures, keeps moving the handle on its own.
#[test]
fn anchor_point_alt_drag_links_a_handle_with_the_opposite_one() {
let (mut d, _) = doc_with_rect();
let l = d.layers[0].id;
let id = d.alloc_id();
let mut sp = vectorcraft_geom::SubPath::polyline(&[Point::new(100.0, 300.0), Point::new(200.0, 300.0), Point::new(300.0, 300.0)], false);
// A corner: handles at (240, 320) and (170, 320), not in line.
sp.anchors[1] = Anchor::with_handles(Point::new(200.0, 300.0), Point::new(170.0, 320.0), Point::new(240.0, 320.0));
let path = vectorcraft_geom::PathData::single(sp);
d.insert(Some(l), 1, vectorcraft_doc::Node::path(id, path, vectorcraft_doc::Appearance::default_art())).unwrap();
let mut s = Selection::default();
s.set([id]);
let p = paint();
let cx = cx(&d, &s, &p);
let alt = Mods { alt: true, ..Mods::default() };
let drag = |t: &mut AnchorTool, mods: Mods, x: f64, y: f64| {
t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 240.0, 320.0).with_mods(mods));
t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, x, y).with_mods(mods))
};
let set = |x: f64, y: f64, key: &str| {
let mut params = json!({"id": id.0, "subpath": 0, "anchor": 1, "which": "out", "x": x, "y": y});
params[key] = json!(true);
Action::Preview("path.setHandle".into(), params)
};
let mut t = AnchorTool::new("anchorPoint");
assert_eq!(drag(&mut t, alt, 250.0, 340.0), vec![Action::Begin("Reshape".into()), set(250.0, 340.0, "link")]);
assert_eq!(t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 250.0, 340.0).with_mods(alt)), vec![Action::Commit]);
// Without Alt the handle moves on its own, as before.
assert_eq!(drag(&mut t, Mods::default(), 250.0, 340.0), vec![Action::Begin("Reshape".into()), set(250.0, 340.0, "independent")]);
t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 250.0, 340.0));
// Shift with Alt: the linked handle stays at 45° steps round its anchor.
let shift_alt = Mods { shift: true, alt: true, ..Mods::default() };
let a = drag(&mut t, shift_alt, 250.0, 345.0);
let Some(Action::Preview(c, args)) = a.get(1) else { panic!("{a:?}") };
assert_eq!((c.as_str(), &args["link"], args.get("independent")), ("path.setHandle", &json!(true), None));
let (dx, dy) = (args["x"].as_f64().unwrap_or(f64::NAN) - 200.0, args["y"].as_f64().unwrap_or(f64::NAN) - 300.0);
assert!(dx > 0.0 && (dx - dy).abs() < 1e-6, "{args}");
t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 250.0, 345.0));
// An Alt-click on the handle retracts it, as a click without Alt does.
t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 240.0, 320.0).with_mods(alt));
assert_eq!(
t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 240.0, 320.0).with_mods(alt)),
vec![Action::Exec(
"path.setHandle".into(),
json!({"id": id.0, "subpath": 0, "anchor": 1, "which": "out", "x": 200.0, "y": 300.0, "independent": true})
)]
);
// Escape cancels the linking drag; its release does nothing.
drag(&mut t, alt, 250.0, 340.0);
assert_eq!(t.key(&cx, ToolKey::Escape, Mods::default()), vec![Action::Cancel]);
assert!(t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 250.0, 340.0).with_mods(alt)).is_empty());
// Lent by the Pen, Alt-drag moves the handle on its own.
let mut lent = AnchorTool::lent_by_pen();
assert_eq!(drag(&mut lent, alt, 250.0, 340.0), vec![Action::Begin("Reshape".into()), set(250.0, 340.0, "independent")]);
}
/// Alt-dragging a selected blend's spine handle links it with the opposite one.
#[test]
fn anchor_point_alt_drag_links_a_blend_spine_handle() {
let (d, id, sel) = blend_spine_doc(true);
let p = paint();
let c = cx(&d, &sel, &p);
let alt = Mods { alt: true, ..Mods::default() };
let mut tool = AnchorTool::new("anchorPoint");
tool.pointer(&c, &PointerEvent::new(PointerKind::Down, 190.0, 330.0).with_mods(alt));
let actions = tool.pointer(&c, &PointerEvent::new(PointerKind::Drag, 190.0, 350.0).with_mods(alt));
assert_eq!(
actions.get(1),
Some(&Action::Preview(
"object.blend.spine.moveAnchor".into(),
json!({"id": id.0, "anchor": 1, "handle": "out", "x": 190.0, "y": 350.0, "link": true})
))
);
assert_eq!(tool.pointer(&c, &PointerEvent::new(PointerKind::Up, 190.0, 350.0).with_mods(alt)), vec![Action::Commit]);
}
+1 -1
View File
@@ -631,7 +631,7 @@ impl PenTool {
if !alt_converts(cx, ev.pos, ev.mods) {
return None;
}
let mut t = AnchorTool::new("anchorPoint");
let mut t = AnchorTool::lent_by_pen();
let acts = t.pointer(cx, ev);
if !t.busy() {
return None;
+2
View File
@@ -4867,6 +4867,8 @@ axis Both И двете
@msg no such spine point няма такава точка от оста
@msg `with` must be a list of at most 10000 spine point indexes `with` трябва да е списък с най-много 10000 индекса на точки от оста
@msg `with` moves points, not a handle `with` мести точки, не дръжка
@msg `link` and `independent` cannot both be true `link` и `independent` не могат и двата да са true
@msg `link` places a handle: give `handle` `link` поставя дръжка: задайте `handle`
@msg no such spine segment няма такъв сегмент от оста
@msg no such subpath няма такъв подпът
@msg no such user library няма такава потребителска библиотека
Can't render this file because it is too large.
+2
View File
@@ -5284,6 +5284,8 @@ imageTrace Outline Obris
@msg no such spine point nema takve tačke kičme
@msg `with` must be a list of at most 10000 spine point indexes `with` mora biti lista od najviše 10000 indeksa tačaka kičme
@msg `with` moves points, not a handle `with` pomjera tačke, ne ručicu
@msg `link` and `independent` cannot both be true `link` i `independent` ne mogu oba biti true
@msg `link` places a handle: give `handle` `link` postavlja ručicu: navedite `handle`
@msg no such spine segment nema takvog segmenta kičme
@msg no such subpath nema takve podputanje
@msg no such user library nema takve korisničke biblioteke
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -6722,6 +6722,8 @@ liquify-list-end {0}, {1} {0} i {1}
@msg no such spine point no existeix aquest punt de l’espina
@msg `with` must be a list of at most 10000 spine point indexes `with` ha de ser una llista d’un màxim de 10000 índexs de punts de l’espina
@msg `with` moves points, not a handle `with` mou punts, no una nansa
@msg `link` and `independent` cannot both be true `link` i `independent` no poden ser true alhora
@msg `link` places a handle: give `handle` `link` col·loca una nansa: indiqueu `handle`
@msg no such spine segment no existeix aquest segment de l’espina
@msg no such subpath no existeix aquest subtraçat
@msg no such user library no existeix aquesta biblioteca d’usuari
Can't render this file because it is too large.
+2
View File
@@ -5602,6 +5602,8 @@ liquify-list-end {0}, {1} {0} a {1}
@msg no such spine point takový bod páteře neexistuje
@msg `with` must be a list of at most 10000 spine point indexes `with` musí být seznam nejvýše 10000 indexů bodů páteře
@msg `with` moves points, not a handle `with` posouvá body, ne táhlo
@msg `link` and `independent` cannot both be true `link` a `independent` nemohou být zároveň true
@msg `link` places a handle: give `handle` `link` umisťuje táhlo: zadejte `handle`
@msg no such spine segment takový segment páteře neexistuje
@msg no such subpath taková dílčí cesta neexistuje
@msg no such user library taková uživatelská knihovna neexistuje
Can't render this file because it is too large.
+2
View File
@@ -295,6 +295,8 @@ liquify-list-end {0}, {1} {0} og {1}
@msg no such spine point intet sådant rygradpunkt
@msg `with` must be a list of at most 10000 spine point indexes `with` skal være en liste med højst 10000 rygradpunktindekser
@msg `with` moves points, not a handle `with` flytter punkter, ikke et håndtag
@msg `link` and `independent` cannot both be true `link` og `independent` kan ikke begge være true
@msg `link` places a handle: give `handle` `link` placerer et håndtag: angiv `handle`
@msg no such spine segment intet sådant rygradsegment
@msg node {_1} is on a locked artboard node {_1} ligger på en låst tegneflade
@msg not a blend ikke en blanding
Can't render this file because it is too large.
+2
View File
@@ -5198,6 +5198,8 @@ liquify-list-end {0}, {1} {0} und {1}
@msg no such spine point kein solcher Achsenpunkt
@msg `with` must be a list of at most 10000 spine point indexes `with` muss eine Liste von höchstens 10000 Achsenpunkt-Indizes sein
@msg `with` moves points, not a handle `with` verschiebt Punkte, keinen Griff
@msg `link` and `independent` cannot both be true `link` und `independent` können nicht beide true sein
@msg `link` places a handle: give `handle` `link` platziert einen Griff: geben Sie `handle` an
@msg no such spine segment kein solches Achsensegment
@msg no such subpath kein solcher Teilpfad
@msg no such user library keine solche Benutzerbibliothek
Can't render this file because it is too large.
+2
View File
@@ -5254,6 +5254,8 @@ digits Malayalam Μαλαγιάλαμ
@msg no such spine point δεν υπάρχει τέτοιο σημείο κεντρικής καμπύλης
@msg `with` must be a list of at most 10000 spine point indexes το `with` πρέπει να είναι λίστα με έως 10000 δείκτες σημείων κεντρικής καμπύλης
@msg `with` moves points, not a handle το `with` μετακινεί σημεία, όχι λαβή
@msg `link` and `independent` cannot both be true Τα `link` και `independent` δεν μπορούν να είναι και τα δύο true
@msg `link` places a handle: give `handle` το `link` τοποθετεί μια λαβή: δώστε `handle`
@msg no such spine segment δεν υπάρχει τέτοιο τμήμα κεντρικής καμπύλης
@msg no such subpath δεν υπάρχει τέτοια υποδιαδρομή
@msg no such user library δεν υπάρχει τέτοια βιβλιοθήκη χρήστη
Can't render this file because it is too large.
+2
View File
@@ -5309,6 +5309,8 @@ liquify-list-end {0}, {1} {0}, {1}
@msg no such spine point no existe ese punto del eje
@msg `with` must be a list of at most 10000 spine point indexes `with` debe ser una lista de como máximo 10000 índices de puntos del eje
@msg `with` moves points, not a handle `with` mueve puntos, no un manejador
@msg `link` and `independent` cannot both be true `link` y `independent` no pueden ser true a la vez
@msg `link` places a handle: give `handle` `link` coloca un manejador: indique `handle`
@msg no such spine segment no existe ese segmento del eje
@msg no such subpath no existe ese subtrazado
@msg no such user library no existe esa biblioteca de usuario
Can't render this file because it is too large.
+2
View File
@@ -5520,6 +5520,8 @@ liquify-list-end {0}, {1} {0} ja {1}
@msg no such spine point selkärangan pistettä ei ole
@msg `with` must be a list of at most 10000 spine point indexes `with`-arvon on oltava luettelo, jossa on enintään 10000 selkärangan pisteen indeksiä
@msg `with` moves points, not a handle `with` siirtää pisteitä, ei kahvaa
@msg `link` and `independent` cannot both be true `link` ja `independent` eivät voi olla molemmat true
@msg `link` places a handle: give `handle` `link` sijoittaa kahvan: anna `handle`
@msg no such spine segment selkärangan segmenttiä ei ole
@msg no such subpath alipolkua ei ole
@msg no such user library käyttäjäkirjastoa ei ole
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -5268,6 +5268,8 @@ liquify-list-end {0}, {1} {0} et {1}
@msg no such spine point point de la dorsale inexistant
@msg `with` must be a list of at most 10000 spine point indexes `with` doit être une liste d’au plus 10000 indices de points de la dorsale
@msg `with` moves points, not a handle `with` déplace des points, pas une poignée
@msg `link` and `independent` cannot both be true `link` et `independent` ne peuvent pas valoir true tous les deux
@msg `link` places a handle: give `handle` `link` place une poignée : indiquez `handle`
@msg no such spine segment segment de la dorsale inexistant
@msg no such subpath sous-tracé inexistant
@msg no such user library bibliothèque utilisateur inexistante
Can't render this file because it is too large.
+2
View File
@@ -6960,6 +6960,8 @@ antiAlias Sharp शार्प
@msg `version`, `description` or `author` is too long `version`, `description` या `author` बहुत लंबा है
@msg `warnings` must be a list of strings `warnings` स्ट्रिंग की एक सूची होना चाहिए
@msg `with` moves points, not a handle `with` पॉइंट मूव करता है, हैंडल नहीं
@msg `link` and `independent` cannot both be true `link` और `independent` दोनों true नहीं हो सकते
@msg `link` places a handle: give `handle` `link` एक हैंडल रखता है: `handle` दें
@msg `with` must be a list of at most 10000 spine point indexes `with` में अधिकतम 10000 स्पाइन पॉइंट इंडेक्स की लिस्ट होनी चाहिए
@msg a {_1} series can't go in a {_2} graph एक {_1} श्रृंखला एक {_2} ग्राफ में नहीं जा सकती
@msg a {width}×{height} screenshot's byte count overflows {width}×{height} स्क्रीनशॉट की बाइट संख्या सीमा से बाहर है
Can't render this file because it is too large.
+2
View File
@@ -5982,6 +5982,8 @@ liquify-list-end {0}, {1} {0} és {1}
@msg no such spine point nincs ilyen gerincpont
@msg `with` must be a list of at most 10000 spine point indexes `with`: legfeljebb 10000 gerincpont-indexből álló lista kell
@msg `with` moves points, not a handle `with` pontokat mozgat, nem fogantyút
@msg `link` and `independent` cannot both be true `link` és `independent` nem lehet egyszerre true
@msg `link` places a handle: give `handle` `link` fogantyút helyez el: adja meg a `handle` értéket
@msg no such spine segment nincs ilyen gerincszakasz
@msg no such subpath nincs ilyen részútvonal
@msg no such user library nincs ilyen felhasználói könyvtár
Can't render this file because it is too large.
+2
View File
@@ -5335,6 +5335,8 @@ liquify-list-end {0}, {1} {0} e {1}
@msg no such spine point punto della dorsale inesistente
@msg `with` must be a list of at most 10000 spine point indexes `with` deve essere un elenco di al massimo 10000 indici di punti della dorsale
@msg `with` moves points, not a handle `with` sposta punti, non una maniglia
@msg `link` and `independent` cannot both be true `link` e `independent` non possono essere entrambi true
@msg `link` places a handle: give `handle` `link` posiziona una maniglia: indica `handle`
@msg no such spine segment segmento della dorsale inesistente
@msg no such subpath sottotracciato inesistente
@msg no such user library libreria utente inesistente
Can't render this file because it is too large.
+2
View File
@@ -4886,6 +4886,8 @@ variable-list-end {0}, {1} {0}、{1}
@msg no such spine point 指定されたスパインポイントが見つかりません
@msg `with` must be a list of at most 10000 spine point indexes `with` には最大 10000 個のスパインポイントのインデックスのリストを指定してください
@msg `with` moves points, not a handle `with` はポイントを移動します。ハンドルには使えません
@msg `link` and `independent` cannot both be true `link` と `independent` を同時に true にすることはできません
@msg `link` places a handle: give `handle` `link` はハンドルを配置します:`handle` を指定してください
@msg no such spine segment 指定されたスパインセグメントが見つかりません
@msg no such subpath 指定されたサブパスが見つかりません
@msg object {id} is not a path オブジェクト {id} はパスではありません
Can't render this file because it is too large.
+2
View File
@@ -8913,6 +8913,8 @@ liquify-list-end {0}, {1} {0} და {1}
@msg no such spine point ხერხემლის ასეთი წერტილი არ არსებობს
@msg `with` must be a list of at most 10000 spine point indexes `with` უნდა იყოს ხერხემლის წერტილების არაუმეტეს 10000 ინდექსის სია
@msg `with` moves points, not a handle `with` წერტილებს გადაადგილებს და არა სახელურს
@msg `link` and `independent` cannot both be true `link` და `independent` ერთდროულად ვერ იქნება true
@msg `link` places a handle: give `handle` `link` სახელურს ათავსებს: მიუთითეთ `handle`
@msg no such spine segment ხერხემლის ასეთი სეგმენტი არ არსებობს
@msg not a blend ეს გადასვლა არ არის
@msg only http, https and mailto URLs open in the browser, not “{url}” ბრაუზერში მხოლოდ http, https და mailto URL-ები იხსნება და არა „{url}“
Can't render this file because it is too large.
+2
View File
@@ -4815,6 +4815,8 @@ variable-list-end {0}, {1} {0} 및 {1}
@msg no such spine point 해당 스파인 포인트가 없습니다
@msg `with` must be a list of at most 10000 spine point indexes `with`는 스파인 포인트 인덱스 최대 10000개의 목록이어야 합니다
@msg `with` moves points, not a handle `with`는 포인트를 이동하며 핸들에는 쓸 수 없습니다
@msg `link` and `independent` cannot both be true `link`와 `independent`를 동시에 true로 지정할 수 없습니다
@msg `link` places a handle: give `handle` `link`는 핸들을 배치합니다. `handle`을 지정하십시오
@msg no such spine segment 해당 스파인 세그먼트가 없습니다
@msg no such subpath 해당 하위 패스가 없습니다
@msg object {id} is not a path 개체 {id}은(는) 패스가 아닙니다
Can't render this file because it is too large.
+2
View File
@@ -8954,6 +8954,8 @@ swatch Bright Violet Felviolet
@msg no such spine point dat aspunt bestaat niet
@msg `with` must be a list of at most 10000 spine point indexes `with` moet een lijst van hoogstens 10000 aspuntindexen zijn
@msg `with` moves points, not a handle `with` verplaatst punten, geen handgreep
@msg `link` and `independent` cannot both be true `link` en `independent` kunnen niet allebei true zijn
@msg `link` places a handle: give `handle` `link` plaatst een handgreep: geef `handle` op
@msg no such spine segment dat assegment bestaat niet
@msg not a blend geen vermenging
@msg select a blend or give `id` selecteer een vermenging of geef `id` op
Can't render this file because it is too large.
+2
View File
@@ -5419,6 +5419,8 @@ liquify-list-end {0}, {1} {0} i {1}
@msg no such spine point brak takiego punktu grzbietu
@msg `with` must be a list of at most 10000 spine point indexes `with` musi być listą co najwyżej 10000 indeksów punktów grzbietu
@msg `with` moves points, not a handle `with` przesuwa punkty, nie uchwyt
@msg `link` and `independent` cannot both be true `link` i `independent` nie mogą mieć jednocześnie wartości true
@msg `link` places a handle: give `handle` `link` umieszcza uchwyt: podaj `handle`
@msg no such spine segment brak takiego segmentu grzbietu
@msg no such subpath brak takiej ścieżki podrzędnej
@msg no such user library brak takiej biblioteki użytkownika
Can't render this file because it is too large.
+2
View File
@@ -4565,6 +4565,8 @@ axis Both Ambos
@msg no such spine point ponto da coluna inexistente
@msg `with` must be a list of at most 10000 spine point indexes `with` deve ser uma lista de no máximo 10000 índices de pontos da coluna
@msg `with` moves points, not a handle `with` move pontos, não uma alça
@msg `link` and `independent` cannot both be true `link` e `independent` não podem ser true ao mesmo tempo
@msg `link` places a handle: give `handle` `link` posiciona uma alça: informe `handle`
@msg no such spine segment segmento da coluna inexistente
@msg no such subpath subtraçado inexistente
@msg no such user library biblioteca do usuário inexistente
Can't render this file because it is too large.
+2
View File
@@ -5330,6 +5330,8 @@ liquify-list-end {0}, {1} {0} и {1}
@msg no such spine point такой точки остова нет
@msg `with` must be a list of at most 10000 spine point indexes `with` должен быть списком не более чем из 10000 индексов точек остова
@msg `with` moves points, not a handle `with` перемещает точки, а не маркер
@msg `link` and `independent` cannot both be true `link` и `independent` не могут одновременно быть true
@msg `link` places a handle: give `handle` `link` размещает маркер: укажите `handle`
@msg no such spine segment такого сегмента остова нет
@msg no such subpath такого вложенного контура нет
@msg no such user library такой пользовательской библиотеки нет
Can't render this file because it is too large.
+2
View File
@@ -5194,6 +5194,8 @@ liquify-list-end {0}, {1} {0} och {1}
@msg no such spine point ryggradspunkten finns inte
@msg `with` must be a list of at most 10000 spine point indexes `with` måste vara en lista med högst 10000 ryggradspunktsindex
@msg `with` moves points, not a handle `with` flyttar punkter, inte ett handtag
@msg `link` and `independent` cannot both be true `link` och `independent` kan inte båda vara true
@msg `link` places a handle: give `handle` `link` placerar ett handtag: ange `handle`
@msg no such spine segment ryggradssegmentet finns inte
@msg no such subpath delbanan finns inte
@msg no such user library användarbiblioteket finns inte
Can't render this file because it is too large.
+2
View File
@@ -6692,6 +6692,8 @@ theme Appearance Görünüm
@msg no such spine point böyle bir omurga noktası yok
@msg `with` must be a list of at most 10000 spine point indexes `with` en fazla 10000 omurga noktası dizininden oluşan bir liste olmalıdır
@msg `with` moves points, not a handle `with` noktaları taşır, tutamacı değil
@msg `link` and `independent` cannot both be true `link` ve `independent` aynı anda true olamaz
@msg `link` places a handle: give `handle` `link` bir tutamaç yerleştirir: `handle` verin
@msg no such spine segment böyle bir omurga segmenti yok
@msg not a blend bir karışım değil
@msg select a blend or give `id` bir karışım seçin veya `id` belirtin
Can't render this file because it is too large.
+2
View File
@@ -5319,6 +5319,8 @@ liquify-list-end {0}, {1} {0} і {1}
@msg no such spine point такої точки осі немає
@msg `with` must be a list of at most 10000 spine point indexes `with` має бути списком щонайбільше з 10000 індексів точок осі
@msg `with` moves points, not a handle `with` переміщує точки, а не маркер
@msg `link` and `independent` cannot both be true `link` і `independent` не можуть одночасно бути true
@msg `link` places a handle: give `handle` `link` розміщує маркер: укажіть `handle`
@msg no such spine segment такого сегмента осі немає
@msg no such subpath такого вкладеного контуру немає
@msg no such user library такої користувацької бібліотеки немає
Can't render this file because it is too large.
+2
View File
@@ -5678,6 +5678,8 @@ liquify-list-end {0}, {1} {0} và {1}
@msg no such spine point không có điểm trục như vậy
@msg `with` must be a list of at most 10000 spine point indexes `with` phải là danh sách tối đa 10000 chỉ số điểm trục
@msg `with` moves points, not a handle `with` di chuyển các điểm, không phải tay nắm
@msg `link` and `independent` cannot both be true `link` và `independent` không thể cùng là true
@msg `link` places a handle: give `handle` `link` đặt một tay nắm: hãy cho `handle`
@msg no such spine segment không có đoạn trục như vậy
@msg no such subpath không có nhánh con như vậy
@msg no such user library không có thư viện người dùng như vậy
Can't render this file because it is too large.
+2
View File
@@ -2157,6 +2157,8 @@ file-filter Templates 模板
@msg no such spine point 没有此脊线点
@msg `with` must be a list of at most 10000 spine point indexes `with` 必须是最多 10000 个脊线点索引的列表
@msg `with` moves points, not a handle `with` 移动的是点,不是手柄
@msg `link` and `independent` cannot both be true `link` 和 `independent` 不能同时为 true
@msg `link` places a handle: give `handle` `link` 用于放置手柄:请提供 `handle`
@msg no such spine segment 没有此脊线线段
@msg a key object sits on that point 该点上有关键对象
@msg a spine keeps at least two points 脊线至少保留两个点
Can't render this file because it is too large.
+2
View File
@@ -3488,6 +3488,8 @@ liquify-list-end {0}, {1} {0}和{1}
@msg no such spine point 沒有這個脊線點
@msg `with` must be a list of at most 10000 spine point indexes `with` 必須是最多 10000 個脊線點索引的清單
@msg `with` moves points, not a handle `with` 移動的是點,不是控制把手
@msg `link` and `independent` cannot both be true `link` 和 `independent` 不能同時為 true
@msg `link` places a handle: give `handle` `link` 用於放置控制把手:請提供 `handle`
@msg no such spine segment 沒有這個脊線線段
@msg a key object sits on that point 該點上有關鍵物件
@msg a spine keeps at least two points 脊線至少要保留兩個點
Can't render this file because it is too large.
+12 -3
View File
@@ -2237,7 +2237,7 @@ naming the key, and leave the document and its undo history as they were: `opaci
The blend and envelope commands refuse a string, a number or another value that is not true or false with
`` `smooth` must be true or false ``, naming the key, and leave the document, its undo history and the options new
blends and envelopes start with as they were: `smooth` in `object.blend.make` and `object.blend.options`;
`independent` in `object.blend.spine.moveAnchor`; `perpendicular` in `object.blend.spine.reshapeSegment`; `horizontal`
`independent` and `link` in `object.blend.spine.moveAnchor`; `perpendicular` in `object.blend.spine.reshapeSegment`; `horizontal`
in `object.envelope.makeWithWarp`, `resetWithWarp` and `options`, also when an `orientation` is given; `maintainShape`
in `object.envelope.resetWithMesh`; `antiAlias`, `distortAppearance`, `distortLinearGradients` and
`distortPatternFills` in `object.envelope.options`; and `editing` in `object.envelope.editContents`. A null is read as
@@ -6415,7 +6415,8 @@ on the cut paths ([the help page](https://helpx.adobe.com/illustrator/desktop/dr
VectorCraft's own rules: every stroke row is reset, hidden ones included; a path of several subpaths has one appearance,
so a cut in one subpath centers the strokes of its other subpaths too, closed ones included; a cut member of a compound
path centers the compound path's strokes; strokes already centered are left as they are. The Pen with Alt
held over a selected path's handle, anchor or segment works as the Anchor Point tool. `press_key` Escape between two
held over a selected path's handle, anchor or segment works as the Anchor Point tool, except that an Alt-drag on a
handle still moves that handle alone. `press_key` Escape between two
`pointer_gesture` calls of an Anchor Point drag cancels it: the path goes back and no undo step is added. `path.reshapeSegment {id,
subpath?, segment, t, dx, dy, perpendicular?}` (a segment dragged with Direct Selection or the Anchor Point tool) moves the segment's
point at `t` by `dx`, `dy`: a smooth anchor at either end stays smooth, its other handle turning with the moved one.
@@ -6434,6 +6435,14 @@ is not a whole number of 0 or more, such as 1.5, -1 or "1" ("`subpath` must be a
an `anchor` or `segment` in the same way. The document does not change and no undo step is recorded.
`path.moveAnchor` to the point the anchor is at, and `path.setHandle` to the point the handle is at on an anchor that
keeps its kind, leave the document as it is and record no undo step.
`path.setHandle` with `link: true` (the Anchor Point tool's Alt-drag on a handle) places the handle and makes the
anchor smooth: the other handle turns to lie in line on the far side of the anchor and keeps its length. A retracted
other handle is pulled out to the placed handle's length when a segment leaves the anchor on its side, and stays
retracted at an end of an open path. A handle placed on its anchor gives no direction, so only that handle moves. A
request that leaves the anchor as it is records no undo step, and `link: true` with `independent: true` is refused
("`link` and `independent` cannot both be true"), as is an x or y of 1e9 pt or more in size with `link: true`
("x and y must be finite"). `object.blend.spine.moveAnchor` takes `link` with `handle` in the
same way for a blend's spine point; without `handle` it is refused. These rules are VectorCraft's own.
`path.insertAnchor` keeps the direct-selected anchors and selected segments of the path on the same points: those
after the new anchor on its subpath are numbered one higher, and a selected segment that the new anchor splits stays
selected as its two halves, with the new anchor as an end of both that moves with them. Undo restores the path and
@@ -6551,7 +6560,7 @@ Left out or null, `width` is 8 pt. The range is VectorCraft's own value.
These commands refuse a string, a number or another value that is not true or false with
`` `closed` must be true or false ``, naming the key; the document does not change and no undo step is recorded:
`independent` in `path.close` and `path.setHandle`; `patterns` in `path.moveAnchors`; `closed`, `keepSelected` and
`independent` in `path.close` and `path.setHandle`; `link` in `path.setHandle`; `patterns` in `path.moveAnchors`; `closed`, `keepSelected` and
`fill` in `path.freehand` (and in `brush.freehand`); `closed` and the `corner` of a point in `path.curvature`; `corner`
in `path.curvatureEdit`; `perpendicular` in `path.reshapeSegment`; and `keepSelected`, `mergeOnlySelection` and
`merge` in `path.blob`. A null is read as a key left out.
+1
View File
@@ -1397,6 +1397,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
View › Hide Edges hides the Live Corners widgets, the bounding box and the type widget, and the selection tools then do not answer a press on them or change the cursor over them.
- **Polygon side widget:** a selected live polygon shows a small diamond beside the middle of the right side of its bounding box, with the Selection tool and with the Rectangle, Rounded Rectangle, Ellipse, Polygon and Star tools, while the bounding box and the edges are shown. Dragging the widget sets the polygon's side count, from 3 to 11, as [the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/add-or-remove-sides-from-polygons.html) describes; typed counts in the Transform panel and `object.setLiveShape` still go from 3 to 1000. A drag down adds one side and a drag up removes one for every 12 screen pixels along the box's own vertical axis, and the pointer shows the count while measurement labels are on. A polygon of more than 11 sides keeps its count until the drag goes up, which gives it 11. The drag sends `object.setLiveShape {sides}`, so the polygon keeps its center, radius and rotation; the release adds one undo step when the count changed and none when it ends where it began, and Escape puts the count back. The widget's look and place, the drag direction, the step and the rule for more than 11 sides are VectorCraft's own (`crates/tools/src/sidewidget.rs`).
- **Blend spine Anchor Point tool (#2544):** on a selected blend, dragging a spine corner makes symmetric Smooth handles; the tool displays and picks existing spine handles when switched to, drags one independently or retracts it on click, and clicking a point with handles retracts both. The spine is edited live without moving its key objects. Windows native canvas checks and screenshots reviewed: symmetric and independent handles, corner/retraction, Shift constraints and perpendicular reshaping, tool switching, key preservation, Undo/Redo, save/reopen, hidden handles and overlapping Path/Blend priority (PR #2643). Behaviour reference: [public path-editing documentation](https://helpx.adobe.com/illustrator/using/adjust-path-segments.html).
- **Anchor Point tool, Alt-drag on a handle:** with the Anchor Point tool chosen, dragging a direction handle with Alt (Option) held links it with the opposite handle and makes the anchor smooth, on a path and on a selected blend's spine, as [the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/create-smooth-paths-with-the-smooth-tool.html) describes; a drag without Alt still moves one handle on its own (`path.setHandle` and `object.blend.spine.moveAnchor` with `link`). VectorCraft's own rules: the opposite handle keeps its length; a retracted one is pulled out to the dragged handle's length where a segment leaves the anchor on its side and stays retracted at an open end; Shift with Alt keeps the 45° steps; an Alt-click still retracts the handle; the Pen with Alt keeps moving a handle on its own. Tests: `anchor_point_alt_drag_links_*` in `crates/tools/src/draw2/anchor/tests.rs`, `a_linked_handle_makes_the_anchor_smooth` in `crates/engine/src/tests/anchor_edit_work.rs`, `a_linked_spine_handle_makes_the_point_smooth` in `crates/engine/src/tests/blendspine.rs`.
- **Blend spine points by marquee:** with Direct Selection, a marquee picks the spine points inside it on a selected blend, the topmost one when several are selected, and the picked points drag together as Shift-clicked ones do; Shift-marquee adds points or takes picked ones away, a plain marquee around none of them drops the picks, and Escape during the marquee keeps them. Unselected, locked and hidden blends are skipped. The spine's points are anchor points edited with Direct Selection ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/modify-spine-of-blended-objects.html)), and a boundary drag with the tool selects anchor points ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/select-anchor-points-in-paths.html)); the rules for selected, topmost and Shift are VectorCraft's own (`crates/tools/src/direct/tests.rs`, `marquee_picks_selected_blend_spine_points_which_drag_together`, `shift_marquee_toggles_selected_blend_spine_points`, `marquee_skips_unselected_locked_and_hidden_blend_spines`, `escape_cancels_a_marquee_and_keeps_the_picked_spine_points`).
When no selected object is a blend, the selected-spine checks of Direct Selection's hover, press and marquee, the Anchor Point tool and the Pen return at once instead of building every blend's spine first; on 20,000 paths and 200 blends with one path selected, 500 checks took 24 µs instead of 336 ms, and the results are the same (`the_selected_spine_check_builds_no_spine_without_a_selected_blend`, `the_selected_spine_check_matches_a_filter_of_every_spine`; `selected_spine_check_timing` times it).
- **Blend steps of brushed strokes:** the steps interpolate the pen pressure, tilt, bearing and rotation recorded with the Paintbrush, so a Calligraphic, Scatter or Art brush that varies with the pen changes gradually from one key to the next. A key without a recording counts as half pressure, half tilt and 0°, as brushes read it, and angles turn the shorter way round. When the blend starts a key's path at another anchor (an open path run from its end, a closed one turned to another start), the key's recordings, width profile, arrowheads, dashes and a gradient along or across the stroke turn with the path. Different brushes still switch halfway (VectorCraft's own rule; strokes blend their options, as [Blended objects overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/blended-objects-overview.html) describes; `crates/doc/src/blend.rs`, `pen_pressure_tilt_and_angles_interpolate_for_brushes`, `stroke_profiles_turn_with_a_key_path_started_elsewhere`, `stroke_gradients_and_dashes_turn_with_a_key_path_started_elsewhere`).
+1 -1
View File
@@ -204,7 +204,7 @@ tools, never checked side by side) isn't captured row by row.
| Blend spine Anchor Point conversion and handle editing (#2544) | implemented | symmetric handles, independent drag/retraction, visible-handle policy and selection/stacking covered by tool and engine regressions; Windows native canvas checks and screenshots reviewed in PR #2643 |
| Blend Replace Spine, move and Undo redraw (#5179) | CPU regression-tested | Renderer damage bounds include keys and steps rotated along a curved spine. Both original straight and curved CPU regressions pass, checking full-frame agreement and that every changed pixel lies inside the advertised redraw area. |
| Several blend spine points picked and dragged together (#5285) | done | with Direct Selection, Shift-click picks more points of a selected blend's spine or takes one away, as on a path; dragging any picked point moves them all, and the key objects on them, in one undo step (`object.blend.spine.moveAnchor {with}`); a marquee picks the spine points inside it on the topmost selected blend, and with Shift adds or takes them away |
| Add/Delete/Anchor Point tools; Anchor Point tool drags segments to reshape | done | #2267: a click on a handle end retracts that handle and leaves the anchor a corner with the other one; Shift held at the press on an anchor moves it, handles and all (Shift kept down: at 45° steps) instead of pulling out handles |
| Add/Delete/Anchor Point tools; Anchor Point tool drags segments to reshape | done | #2267: a click on a handle end retracts that handle and leaves the anchor a corner with the other one; Shift held at the press on an anchor moves it, handles and all (Shift kept down: at 45° steps) instead of pulling out handles; Alt held while dragging a handle links it with the opposite handle and makes the anchor smooth, on a blend's spine too |
| Pencil: Fidelity, Keep selected, Alt to Smooth, edit selected paths, close by proximity | done | Fidelity is in screen pixels, the same at any zoom, and goes down to 0.01 px in the dialog and the tool, which sends `path.freehand` the value in points at the current zoom (#5729; the Smooth tool keeps 0.05 pt); its slider runs across the Tool Options row on a logarithmic rail from 0.01 to 20 px, the field shows hundredths, and the slider's and the field's arrow keys step hundredths up to 0.1 px, tenths up to 1 px and whole pixels above (Shift ×10) (#3328); Alt key toggles to Smooth Tool (#2001); Shift held at the press draws a straight line at 45° steps from the Constrain Angle, and Alt held at the press (with Alt key toggles to Smooth Tool off) a straight line at any angle (#3799), with a straight-line cursor (a short level line) while Shift or Alt is held before the press, and a path-continuation cursor (a short rising line) over an end of a selected open path, where the stroke continues the path, freehand or straight, and while a continuing stroke ends near an open end of another selected path it connects to; Edit Selected Paths continues a selected path from an end and, from a stroke that starts and ends on a selected path, redraws the section between (the shorter way round a closed path, #2850); with Keep selected (Pencil and Paintbrush, on by default) on, a stroke selects the path it draws or continues and replaces the earlier selection, and off a new stroke leaves nothing selected, the earlier selection included, while a continued or redrawn path is deselected and the rest of the selection stays; a filled Pencil path keeps a stroke of None (#1804, part of #1679); while a freehand stroke is drawn back to within Close Paths When Ends Are Within of its start, or a stroke continuing a selected path (a straight line too) to within it of that path's other end, the Pencil and the Paintbrush show the closing cursor, and a release there closes the path; a Pencil stroke from an end of one selected open path to an end of another connects the two into one path |
| Drop Shadow, Outer Glow and Inner Glow: Opacity, the offsets, Blur and Darkness have spinner arrows that step by one (a unit for distances), repeat when held and stop at the fields' ends (#5367, #5368) | done | dialogs::effect test drop_shadow_and_outer_glow_fields_have_spinner_arrows; other effect dialogs' number fields still have none |
| Effect dialogs' colour fields: a swatch beside the hex follows typed values, and a double-click opens the Color Picker over the dialog, whose OK fills it and Cancel comes back unchanged (#5365) | done | dialogs::effect tests outer_glow_colour_swatch_opens_the_color_picker and drop_shadow_colour_swatch_opens_the_color_picker (Drop Shadow's Color, #5364); the picker previews nothing itself, the effect dialog previews the returned colour |