Direct Selection: optional preference interpolates curve handles when an anchor moves

The new General preference Interpolate Control Points When Moving
Anchors (`interpolateControlPoints`, off by default) is the default of a
new `interpolate` param of path.moveAnchors (a Direct Selection drag),
object.nudge (the arrow keys), object.move, object.transform and
object.transformAgain. With it on, a move of direct-selected anchors
re-maps both handles of each segment with one moved end by the turn,
uniform scale and move that take the segment's old ends to its new
ends, so a segment between two corner anchors keeps its shape relative
to its ends.

- A segment with both ends moved, or with its ends at the same place
  before or after the move, moves as it does with the preference off.
  Only an exact move re-maps handles; any other transform of the anchors
  is applied as before.
- A smooth anchor keeps its handles in line: its re-mapped handle takes
  the new length and stays in line with the other handle, and when both
  of its handles were re-mapped they point along the mean of their
  directions. When the two point the same way, both move with the
  anchor as with the preference off.
- The value used joins the command's journal entry and Transform
  Again's options, so a replay or a repeat re-maps the handles alike
  whatever the preference is then. A non-boolean value is an error.
- A retracted handle stays retracted, each drag or nudge is one undo
  step, and a nudge of 0 still records none. Align and Distribute, and
  the anchors of type paths and area type frames, move as before.

With the preference off, moves give the same result as before. The
label has a row in every catalog. The hook in transform_anchors follows
the patch bentschener attached to #7832; the handle math differs.

Fixes #7832

Docs: docs/mcp.md, docs/target-app-parity.md.

Co-authored-by: bentschener <353895224+bentschener@users.noreply.github.com>
This commit is contained in:
dotCooCoo
2026-11-15 22:26:18 -08:00
co-authored by bentschener
parent 26c137334b
commit 49a9a0f4cb
38 changed files with 644 additions and 20 deletions
+4 -4
View File
@@ -16,7 +16,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Transform",
[],
None,
"{matrix: [a,b,c,d,e,f], copy?: bool, ids?, strokes?: bool, corners?: bool, typeAreas?: bool, anchors?: bool, objects?: bool (Transform Objects, default true; false: the art stays and, with patterns, only its pattern tiles transform), patterns?: bool (Transform Patterns: pattern fills and strokes transform with the art; default: prefs transformPatternTiles), releaseOutside?: bool} apply an affine to the selection (or ids); anchors (without ids or copy): paths with anchors selected with Direct Selection have only those anchors and their handles transformed, as the Transform tools and object.move/rotate/scale/reflect/shear do (default: the whole objects); strokes/corners: Scale Strokes & Effects / Scale Corners (default: the preferences); typeAreas: area type among them (not type inside a group) reshapes its frame by the matrix and its text reflows at its size, as a bounding-box handle drag does (default: the type transforms too); releaseOutside (without copy or anchors): a Shaper Group's original shape that ends wholly outside the bounds the group's original shapes had before takes shaper.releaseSource in the same undo step, named Remove from Shaper Group, as the Selection tool's moves in Construction mode do",
"{matrix: [a,b,c,d,e,f], copy?: bool, ids?, strokes?: bool, corners?: bool, typeAreas?: bool, anchors?: bool, objects?: bool (Transform Objects, default true; false: the art stays and, with patterns, only its pattern tiles transform), patterns?: bool (Transform Patterns: pattern fills and strokes transform with the art; default: prefs transformPatternTiles), releaseOutside?: bool, interpolate?: bool (with anchors and a matrix that only moves them: the handles of each segment with one moved end are re-mapped, as path.moveAnchors's; default: prefs interpolateControlPoints)} apply an affine to the selection (or ids); anchors (without ids or copy): paths with anchors selected with Direct Selection have only those anchors and their handles transformed, as the Transform tools and object.move/rotate/scale/reflect/shear do (default: the whole objects); strokes/corners: Scale Strokes & Effects / Scale Corners (default: the preferences); typeAreas: area type among them (not type inside a group) reshapes its frame by the matrix and its text reflows at its size, as a bounding-box handle drag does (default: the type transforms too); releaseOutside (without copy or anchors): a Shaper Group's original shape that ends wholly outside the bounds the group's original shapes had before takes shaper.releaseSource in the same undo step, named Remove from Shaper Group, as the Selection tool's moves in Construction mode do",
has_doc,
transform
),
@@ -25,7 +25,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Move…",
["Object", "Transform"],
Some("Cmd+Shift+M"),
"{ids?: [id…] (selected first; default: the selection), dx, dy, copy?, objects?: bool (Transform Objects, default true; false: the art stays and, with patterns, only its pattern tiles transform), patterns?: bool (Transform Patterns: pattern fills and strokes transform with the art; default: prefs transformPatternTiles), typeAreas?: bool (area type: the frame is reshaped and the text reflows at its size)}. With anchors selected with Direct Selection (and no copy), only those anchors and their handles transform, about the centre of their own box.",
"{ids?: [id…] (selected first; default: the selection), dx, dy, copy?, objects?: bool (Transform Objects, default true; false: the art stays and, with patterns, only its pattern tiles transform), patterns?: bool (Transform Patterns: pattern fills and strokes transform with the art; default: prefs transformPatternTiles), typeAreas?: bool (area type: the frame is reshaped and the text reflows at its size), interpolate?: bool (as path.moveAnchors's; default: prefs interpolateControlPoints)}. With anchors selected with Direct Selection (and no copy), only those anchors and their handles transform, about the centre of their own box.",
has_selection_or_guides,
move_cmd
),
@@ -70,7 +70,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Transform Again",
["Object", "Transform"],
Some("Cmd+D"),
"{copy?, strokes?, corners?, patterns?, typeAreas?: bool (as object.transform's; default: the value the transform it repeats used, else object.transform's default)} the last transform's matrix on the selection (after a perspective move or scale: that plane-space transform, without these params)",
"{copy?, strokes?, corners?, patterns?, typeAreas?, interpolate?: bool (as object.transform's; default: the value the transform it repeats used, else object.transform's default)} the last transform's matrix on the selection (after a perspective move or scale: that plane-space transform, without these params)",
has_selection,
transform_again
),
@@ -79,7 +79,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Nudge",
[],
None,
"{dx: -1|0|1, dy: -1|0|1, big?: bool (×10), copy?: bool, patterns?: bool (Transform Patterns: pattern fills and strokes transform with the objects that move whole; default: prefs transformPatternTiles), typeAreas?: bool (area type: the frame is reshaped and the text reflows at its size), objects?: bool (Transform Objects, as object.move)} arrow-key nudge by the keyboard increment (the selected anchors, else objects, along the x and y axes turned by the constrainAngle preference; else ruler guides, along the page axes)",
"{dx: -1|0|1, dy: -1|0|1, big?: bool (×10), copy?: bool, patterns?: bool (Transform Patterns: pattern fills and strokes transform with the objects that move whole; default: prefs transformPatternTiles), typeAreas?: bool (area type: the frame is reshaped and the text reflows at its size), objects?: bool (Transform Objects, as object.move), interpolate?: bool (as path.moveAnchors's; default: prefs interpolateControlPoints)} arrow-key nudge by the keyboard increment (the selected anchors, else objects, along the x and y axes turned by the constrainAngle preference; else ruler guides, along the page axes)",
has_selection_or_guides,
nudge
),
+14 -4
View File
@@ -125,9 +125,14 @@ fn apply_transform_moving_guides(
let d = &s.doc()?.doc;
let paths = d.index_paths(ids.iter().copied());
let none = paths.is_empty() && !has_guides;
// A move of direct-selected anchors may re-map the handles beside them (`interpolate`).
let mut interpolate = None;
let ids = if anchors && objects && !copy && !s.doc()?.selection.anchors.is_empty() {
if c[..4] == [1.0, 0.0, 0.0, 1.0] {
interpolate = Some(crate::cmd::path::interpolates_handles(s, p, label)?);
}
if xf != Affine::IDENTITY {
crate::cmd::path::transform_anchors(s, label, xf, sc)?;
crate::cmd::path::transform_anchors(s, label, xf, sc, interpolate.unwrap_or(false))?;
}
ids
} else if none || (!copy && xf == Affine::IDENTITY) {
@@ -195,6 +200,9 @@ fn apply_transform_moving_guides(
options["strokes"] = json!(sc.strokes);
options["corners"] = json!(!sc.keep_corners);
}
if let Some(on) = interpolate {
options["interpolate"] = json!(on);
}
st.last_transform = Some(LastTransform::Matrix(xf, options));
st.last_perspective = None;
}
@@ -248,7 +256,7 @@ fn resize_type_area(n: &mut Node, xf: Affine) -> bool {
pub(super) fn transform(s: &mut Session, p: &Value) -> Result<Value> {
check_switches(p, &TRANSFORM_SWITCHES, "object.transform")?;
check_switches(p, &["anchors", "releaseOutside"], "object.transform")?;
check_switches(p, &["anchors", "releaseOutside", "interpolate"], "object.transform")?;
let m = matrix_param(p, "matrix").ok_or_else(|| bad("object.transform", "missing matrix [a,b,c,d,e,f]"))?;
// An object selected in a symbol instance's art stays where the symbol puts it: the selection
// is left as it is, and the reply's warning goes to the status bar.
@@ -292,6 +300,7 @@ pub(super) fn transform(s: &mut Session, p: &Value) -> Result<Value> {
pub(super) fn move_cmd(s: &mut Session, p: &Value) -> Result<Value> {
check_numbers(p, &["dx", "dy"], "object.move")?;
check_switches(p, &TRANSFORM_SWITCHES, "object.move")?;
check_switches(p, &["interpolate"], "object.move")?;
let ids = selected_roots_to_transform(s)?;
apply_transform(s, "Move", ids, Affine::translate((f64_or(p, "dx", 0.0), f64_or(p, "dy", 0.0))), p, true)
}
@@ -311,7 +320,7 @@ pub(crate) fn along_constrain_angle(dx: f64, dy: f64, deg: f64) -> (f64, f64) {
pub(super) fn nudge(s: &mut Session, p: &Value) -> Result<Value> {
check_numbers(p, &["dx", "dy"], "object.nudge")?;
check_switches(p, &TRANSFORM_SWITCHES, "object.nudge")?;
check_switches(p, &["big"], "object.nudge")?;
check_switches(p, &["big", "interpolate"], "object.nudge")?;
let k = s.prefs.keyboard_increment * if bool_or(p, "big", false) { 10.0 } else { 1.0 };
let (dx, dy) = (f64_or(p, "dx", 0.0) * k, f64_or(p, "dy", 0.0) * k);
// Guides keep to the page's axes; art and anchors move along the constrain angle's.
@@ -322,7 +331,7 @@ pub(super) fn nudge(s: &mut Session, p: &Value) -> Result<Value> {
if dx == 0.0 && dy == 0.0 {
return ok();
}
return crate::cmd::path::move_anchors(s, &json!({ "dx": dx, "dy": dy, "patterns": p.get("patterns") }));
return crate::cmd::path::move_anchors(s, &json!({ "dx": dx, "dy": dy, "patterns": p.get("patterns"), "interpolate": p.get("interpolate") }));
}
if s.doc()?.selection.is_empty() {
let copy = bool_or(p, "copy", false);
@@ -430,6 +439,7 @@ pub(super) fn shear(s: &mut Session, p: &Value) -> Result<Value> {
/// Each is repeated by running it again (its transform is per object, about each one's bounds).
pub(super) fn transform_again(s: &mut Session, p: &Value) -> Result<Value> {
check_switches(p, &TRANSFORM_SWITCHES, "object.transformAgain")?;
check_switches(p, &["interpolate"], "object.transformAgain")?;
if let Some(again) = s.doc()?.last_perspective.clone() {
return crate::cmd::distortcmds::transform_again(s, &again);
}
+149 -10
View File
@@ -1,10 +1,10 @@
//! Path editing commands (used by the Pen and Direct Selection tools and Object → Path).
use std::collections::BTreeSet;
use std::collections::{BTreeMap, BTreeSet};
use std::sync::Arc;
use serde_json::{Value, json};
use vectorcraft_doc::{Document, Node, NodeId, NodeKind, Scaling, Selection};
use vectorcraft_doc::{AnchorRef, Document, Node, NodeId, NodeKind, Scaling, Selection};
use vectorcraft_geom::{Anchor, AnchorKind, Anchors, PathData, Point, SubPath, Vec2};
use super::create::anchor_from_json;
@@ -41,7 +41,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Move Anchors",
[],
None,
"{dx, dy, patterns?: bool (Transform Patterns: pattern fills and strokes transform with the objects that move whole; default: prefs transformPatternTiles)} move direct-selected anchors (whole paths if fully selected); refused while an object of a symbol instance's art is selected",
"{dx, dy, patterns?: bool (Transform Patterns: pattern fills and strokes transform with the objects that move whole; default: prefs transformPatternTiles), interpolate?: bool (Interpolate Control Points: the handles of each segment with one moved end are re-mapped by the turn, scale and move that take its old ends to its new ends; default: prefs interpolateControlPoints)} move direct-selected anchors (whole paths if fully selected); refused while an object of a symbol instance's art is selected",
has_selection,
move_anchors
),
@@ -245,28 +245,41 @@ fn close(s: &mut Session, p: &Value) -> Result<Value> {
pub(crate) fn move_anchors(s: &mut Session, p: &Value) -> Result<Value> {
let d = Vec2::new(number_or(p, "dx", 0.0, "path.moveAnchors")?, number_or(p, "dy", 0.0, "path.moveAnchors")?);
check_switches(p, &["patterns"], "path.moveAnchors")?;
check_switches(p, &["patterns", "interpolate"], "path.moveAnchors")?;
// An object selected in a symbol instance's art stays where the symbol puts it.
super::edit::refuse_symbol_part(s)?;
// Objects selected whole move as objects, and their pattern tiles move with them when
// `patterns` (default: General › Transform Pattern Tiles) is on.
let whole = s.doc()?.selection.whole();
let sc = Scaling { patterns: super::object::transform_patterns(s, p, &whole)?, ..Scaling::default() };
transform_anchors(s, "Move", vectorcraft_geom::Affine::translate(d), sc)?;
let interpolate = interpolates_handles(s, p, "path.moveAnchors")?;
transform_anchors(s, "Move", vectorcraft_geom::Affine::translate(d), sc, interpolate)?;
// Transform Again repeats a move that moved something; a drag records it when it commits.
let st = s.doc_mut()?;
if st.interaction.is_none() && (d.x != 0.0 || d.y != 0.0) {
let options = json!({ "copy": false, "patterns": sc.patterns });
let options = json!({ "copy": false, "patterns": sc.patterns, "interpolate": interpolate });
st.last_transform = Some(crate::LastTransform::Matrix(vectorcraft_geom::Affine::translate(d), options));
st.last_perspective = None;
}
ok()
}
/// Interpolate Control Points: does a move of direct-selected anchors re-map the handles of the
/// segments beside them (`interpolate` param, else General › Interpolate Control Points When
/// Moving Anchors)? Noted in the journal, so a replay re-maps them alike whatever the preference
/// is then.
pub(crate) fn interpolates_handles(s: &mut Session, p: &Value, cmd: &str) -> Result<bool> {
let on = switch_or(p, "interpolate", s.prefs.interpolate_control_points, cmd)?;
s.note_journal("interpolate", json!(on));
Ok(on)
}
/// Apply `xf` to the direct-selected anchors, their handles with them, and (with `sc`) to the
/// objects selected whole (those with no entry in the selection's `anchors`). An object inside
/// another selected object, such as a path in a selected group, moves once, with that object.
pub(crate) fn transform_anchors(s: &mut Session, label: &str, xf: vectorcraft_geom::Affine, sc: Scaling) -> Result<()> {
/// When `xf` is a move and `interpolate` is on, the handles of each segment with one moved end
/// are re-mapped ([`move_interpolating_handles`]).
pub(crate) fn transform_anchors(s: &mut Session, label: &str, xf: vectorcraft_geom::Affine, sc: Scaling, interpolate: bool) -> Result<()> {
let sel = s.doc()?.selection.clone();
let ids = super::edit::outermost(&s.doc()?.doc, sel.objects.clone());
let c = xf.as_coeffs();
@@ -277,9 +290,15 @@ pub(crate) fn transform_anchors(s: &mut Session, label: &str, xf: vectorcraft_ge
match sel.anchors.get(id) {
Some(set) => {
let path = path_mut(doc, *id)?;
for &(si, ai) in set {
if let Some(a) = path.anchor_mut(si, ai) {
*a = a.transform(xf);
// Only an exact move takes the interpolating path: a near-identity scale or
// turn still transforms the anchors as asked.
if interpolate && c[..4] == [1.0, 0.0, 0.0, 1.0] {
move_interpolating_handles(path, set, delta);
} else {
for &(si, ai) in set {
if let Some(a) = path.anchor_mut(si, ai) {
*a = a.transform(xf);
}
}
}
// A pixel-aligned path, or the pixel-aligned compound path that holds it, snaps
@@ -307,6 +326,126 @@ pub(crate) fn transform_anchors(s: &mut Session, label: &str, xf: vectorcraft_ge
})
}
/// Move the anchors `set` of `path` by `d`, their handles with them, then re-map the two handles
/// of each segment with exactly one moved end by the map that takes the segment's old ends to its
/// new ends: a turn, a uniform scale and a move. Between two corner anchors the segment keeps its
/// shape relative to its ends. A segment with both ends moved, or with its ends at the same place
/// before or after the move, moves as it does without the preference. A smooth anchor keeps its
/// two handles in line ([`line_up_handles`]).
fn move_interpolating_handles(path: &mut PathData, set: &BTreeSet<AnchorRef>, d: Vec2) {
// (subpath, anchor, outgoing handle?, new position)
let mut placed: Vec<(usize, usize, bool, Point)> = Vec::new();
if d != Vec2::ZERO {
// Only the segments beside a moved anchor can have one moved end: (subpath, first anchor).
let mut segments: BTreeSet<AnchorRef> = BTreeSet::new();
for &(si, ai) in set {
let Some(sp) = path.subpaths.get(si) else { continue };
let n = sp.anchors.len();
if ai >= n || n < 2 {
continue;
}
if ai > 0 || sp.closed {
segments.insert((si, (ai + n - 1) % n));
}
if ai + 1 < n || sp.closed {
segments.insert((si, ai));
}
}
for (si, from) in segments {
let Some(sp) = path.subpaths.get(si) else { continue };
let to = (from + 1) % sp.anchors.len().max(1);
let (moved_from, moved_to) = (set.contains(&(si, from)), set.contains(&(si, to)));
if moved_from == moved_to {
continue;
}
let (Some(a), Some(b)) = (sp.anchors.get(from), sp.anchors.get(to)) else { continue };
let old = b.p - a.p;
let len2 = old.hypot2();
if len2 <= 1e-12 || !len2.is_finite() {
continue;
}
let start = if moved_from { a.p + d } else { a.p };
let end = if moved_to { b.p + d } else { b.p };
let new = end - start;
// A move that puts the two ends at the same place would collapse both handles onto
// them, past recovering by moving back.
if new.hypot2() <= 1e-12 {
continue;
}
// `new / old` as complex numbers: the turn and scale between the two chords.
let (re, im) = ((new.x * old.x + new.y * old.y) / len2, (new.y * old.x - new.x * old.y) / len2);
let map = |h: Point| {
let v = h - a.p;
start + Vec2::new(v.x * re - v.y * im, v.x * im + v.y * re)
};
let (h_out, h_in) = (map(a.h_out), map(b.h_in));
if h_out.is_finite() && h_in.is_finite() {
placed.push((si, from, true, h_out));
placed.push((si, to, false, h_in));
}
}
}
for &(si, ai) in set {
if let Some(a) = path.anchor_mut(si, ai) {
a.translate(d);
}
}
// For each anchor with a re-mapped handle: its handles as the plain move left them, and which
// of them (outgoing, incoming) were re-mapped.
let mut touched: BTreeMap<AnchorRef, (Point, Point, bool, bool)> = BTreeMap::new();
for &(si, ai, out, pos) in &placed {
if let Some(a) = path.anchor_mut(si, ai) {
let e = touched.entry((si, ai)).or_insert((a.h_out, a.h_in, false, false));
if out {
a.h_out = pos;
e.2 = true;
} else {
a.h_in = pos;
e.3 = true;
}
}
}
for ((si, ai), (rigid_out, rigid_in, out, inn)) in touched {
let Some(a) = path.anchor_mut(si, ai) else { continue };
if a.kind == AnchorKind::Smooth && !line_up_handles(a, out, inn) {
a.h_out = rigid_out;
a.h_in = rigid_in;
}
}
}
/// Put the handles of the smooth anchor `a` back in line after [`move_interpolating_handles`]
/// re-mapped its outgoing handle (`out`), its incoming handle (`inn`) or both. A re-mapped handle
/// turns to point away from the other handle, at its own new length; when both were re-mapped,
/// both point along the mean of their directions. A retracted handle is left as it is. False when
/// both were re-mapped to point the same way, which has no mean direction: the caller then moves
/// both handles with the anchor.
fn line_up_handles(a: &mut Anchor, out: bool, inn: bool) -> bool {
let (v_out, v_in) = (a.h_out - a.p, a.h_in - a.p);
let (l_out, l_in) = (v_out.hypot(), v_in.hypot());
if l_out <= 0.0 || l_in <= 0.0 || !l_out.is_finite() || !l_in.is_finite() {
return true;
}
let dir = match (out, inn) {
(true, true) => v_out / l_out - v_in / l_in,
(true, false) => -v_in / l_in,
(false, true) => v_out / l_out,
(false, false) => return true,
};
let l = dir.hypot();
if l <= 1e-12 || !l.is_finite() {
return false;
}
let dir = dir / l;
if out {
a.h_out = a.p + dir * l_out;
}
if inn {
a.h_in = a.p - dir * l_in;
}
true
}
fn set_handle(s: &mut Session, p: &Value) -> Result<Value> {
let id = object_param(p, "id", "path.setHandle")?.ok_or_else(|| bad("path.setHandle", "missing id"))?;
let si = usize_opt(p, "subpath", "path.setHandle")?.unwrap_or(0);
+1
View File
@@ -139,6 +139,7 @@ pub const PREF_SPECS: &[PrefSpec] = &[
p!("cornerRadius", "General", "", "Corner Radius", len(0.0, 1296.0, General)),
p!("pasteOffset", "General", "", "Paste Offset", len(0.0, 1296.0, General)),
p!("disableAutoAddDelete", "General", "Options", "Disable Auto Add/Delete", bool),
p!("interpolateControlPoints", "General", "Options", "Interpolate Control Points When Moving Anchors", bool),
p!("usePreciseCursors", "General", "Options", "Use Precise Cursors", bool),
p!("showToolTips", "General", "Options", "Show Tool Tips", bool),
p!("showExternalScriptWarning", "General", "Options", "Show External Script Warning", bool),
+7
View File
@@ -29,6 +29,12 @@ pub struct Prefs {
pub constrain_angle: f64,
pub corner_radius: f64,
pub disable_auto_add_delete: bool,
/// General › Interpolate Control Points When Moving Anchors: the default of the `interpolate`
/// param of the commands that move direct-selected anchors (a Direct Selection drag, the arrow
/// keys, Move, Transform Again). On, the handles of each segment with one moved end are
/// re-mapped by the turn, scale and move that take its old ends to its new ends. Off (the
/// default), the handles of a moved anchor move with it and the other handles stay.
pub interpolate_control_points: bool,
pub use_precise_cursors: bool,
pub show_tool_tips: bool,
/// Other Script… warns before it runs a chosen script.
@@ -393,6 +399,7 @@ impl Default for Prefs {
constrain_angle: 0.0,
corner_radius: 12.0,
disable_auto_add_delete: false,
interpolate_control_points: false,
use_precise_cursors: false,
show_tool_tips: true,
show_external_script_warning: true,
+4 -2
View File
@@ -422,8 +422,10 @@ impl Session {
// selected): Transform Again moves the selected anchors and the objects selected whole
// by the same distance. A drag that ends where it began leaves the last transform.
let mut options = serde_json::json!({ "copy": false });
if let Some(patterns) = preview.1.get("patterns") {
options["patterns"] = patterns.clone();
for key in ["patterns", "interpolate"] {
if let Some(v) = preview.1.get(key) {
options[key] = v.clone();
}
}
st.last_transform = Some(LastTransform::Matrix(vectorcraft_geom::Affine::translate(moved), options));
st.last_perspective = None;
+1
View File
@@ -84,6 +84,7 @@ mod history_mem;
mod ids_without_selection;
mod inline;
mod interactivity;
mod interpolate_handles;
mod intertwine;
mod journal;
mod keyanchor;
@@ -0,0 +1,422 @@
//! #7832: General › Interpolate Control Points When Moving Anchors (`interpolateControlPoints`).
//! With it on, a Direct Selection drag or an arrow-key nudge of selected anchors re-maps the
//! handles of each segment with one moved end, so the segment keeps its shape relative to its
//! ends. Off (the default), the handles of a moved anchor move with it and the others stay.
use serde_json::json;
use vectorcraft_geom::{Anchor, PathData, Point};
use vectorcraft_tools::{PointerEvent, PointerKind};
use super::history;
use crate::*;
fn session() -> Session {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 800, "height": 600})).unwrap();
s
}
fn interpolate(s: &mut Session, on: bool) {
s.execute("prefs.set", &json!({"key": "interpolateControlPoints", "value": on})).unwrap();
}
fn path_of(s: &Session, id: NodeId) -> PathData {
s.doc().unwrap().doc.node(id).unwrap().path_data().unwrap().clone()
}
fn anchor(s: &Session, id: NodeId, ai: usize) -> Anchor {
path_of(s, id).subpaths[0].anchors[ai]
}
fn create(s: &mut Session, anchors: serde_json::Value) -> NodeId {
NodeId(s.execute("path.create", &json!({ "anchors": anchors })).unwrap()["id"].as_u64().unwrap())
}
/// A curve from (100, 100) to (300, 100) whose handles lie on its chord.
fn curve(s: &mut Session) -> NodeId {
create(s, json!([{"x": 100, "y": 100, "out": [150, 100]}, {"x": 300, "y": 100, "in": [250, 100]}]))
}
fn select(s: &mut Session, id: NodeId, anchors: serde_json::Value) {
s.execute("select.anchors", &json!({"id": id.0, "anchors": anchors, "mode": "set"})).unwrap();
}
/// A Direct Selection click on (`x`, `y`), then a drag from there to (`to_x`, `to_y`).
fn drag(s: &mut Session, (x, y): (f64, f64), (to_x, to_y): (f64, f64)) {
let v = ViewInfo { smart_guides: false, ..ViewInfo::default() };
s.select_tool("directSelection", v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Down, x, y), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Up, x, y), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Down, x, y), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Drag, (x + to_x) / 2.0, (y + to_y) / 2.0), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Drag, to_x, to_y), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Up, to_x, to_y), v).unwrap();
}
#[test]
fn the_preference_is_off_by_default_and_the_handles_then_move_rigidly() {
let mut s = session();
assert!(!s.prefs.interpolate_control_points);
let id = curve(&mut s);
select(&mut s, id, json!([[0, 0]]));
s.execute("object.nudge", &json!({"dx": 20, "dy": 8})).unwrap();
let (a, b) = (anchor(&s, id, 0), anchor(&s, id, 1));
assert_eq!(a.p, Point::new(120.0, 108.0));
assert_eq!(a.h_out, Point::new(170.0, 108.0), "the moved anchor's handle moves with it");
assert_eq!(b.h_in, Point::new(250.0, 100.0), "the other end's handle stays");
}
#[test]
fn a_nudge_with_the_preference_on_re_maps_both_handles_of_the_segment() {
let mut s = session();
interpolate(&mut s, true);
let id = curve(&mut s);
select(&mut s, id, json!([[0, 0]]));
let before = history(&s).0;
s.execute("object.nudge", &json!({"dx": 20, "dy": 8})).unwrap();
assert_eq!(history(&s).0, before + 1, "one undo step");
let (a, b) = (anchor(&s, id, 0), anchor(&s, id, 1));
// The chord goes from (200, 0) to (180, -8): a scale by 0.9 and a turn, so the handles a
// quarter of the way from each end stay on the new chord, a quarter of the way along it.
assert_eq!(a.p, Point::new(120.0, 108.0));
assert_eq!(a.h_in, a.p, "a retracted handle stays retracted");
assert_eq!(a.h_out, Point::new(165.0, 106.0));
assert_eq!(b.p, Point::new(300.0, 100.0));
assert_eq!(b.h_in, Point::new(255.0, 102.0));
assert_eq!(b.h_out, b.p);
}
#[test]
fn a_direct_selection_drag_with_the_preference_on_re_maps_the_handles_in_one_undo_step() {
let mut s = session();
interpolate(&mut s, true);
let id = curve(&mut s);
let original = path_of(&s, id);
drag(&mut s, (100.0, 100.0), (120.0, 108.0));
let (a, b) = (anchor(&s, id, 0), anchor(&s, id, 1));
assert_eq!(a.p, Point::new(120.0, 108.0));
assert_eq!(a.h_out, Point::new(165.0, 106.0));
assert_eq!(b.h_in, Point::new(255.0, 102.0));
// One undo step puts the path back as it was before the drag.
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(path_of(&s, id), original);
}
#[test]
fn a_direct_selection_drag_with_the_preference_off_keeps_the_rigid_move() {
let mut s = session();
let id = curve(&mut s);
drag(&mut s, (100.0, 100.0), (120.0, 108.0));
let (a, b) = (anchor(&s, id, 0), anchor(&s, id, 1));
assert_eq!(a.h_out, Point::new(170.0, 108.0));
assert_eq!(b.h_in, Point::new(250.0, 100.0));
}
#[test]
fn a_segment_with_both_ends_moved_moves_rigidly() {
let mut s = session();
interpolate(&mut s, true);
let id = create(
&mut s,
json!([
{"x": 100, "y": 100, "out": [150, 60]},
{"x": 300, "y": 100, "in": [250, 60], "out": [350, 150]},
{"x": 500, "y": 100, "in": [450, 140]},
]),
);
select(&mut s, id, json!([[0, 0], [0, 1]]));
s.execute("object.nudge", &json!({"dx": 10, "dy": 5})).unwrap();
let (a, b, c) = (anchor(&s, id, 0), anchor(&s, id, 1), anchor(&s, id, 2));
assert_eq!((a.p, a.h_out), (Point::new(110.0, 105.0), Point::new(160.0, 65.0)));
assert_eq!((b.p, b.h_in), (Point::new(310.0, 105.0), Point::new(260.0, 65.0)));
// The segment to the unmoved third anchor is re-mapped: its chord goes from (200, 0) to
// (190, -5), a scale by 0.95 with a turn of -0.025 per unit.
close(b.h_out, Point::new(358.75, 151.25));
close(c.h_in, Point::new(453.5, 139.25));
assert_eq!(c.p, Point::new(500.0, 100.0));
}
fn close(p: Point, q: Point) {
assert!((p.x - q.x).abs() < 1e-9 && (p.y - q.y).abs() < 1e-9, "{p:?} is not {q:?}");
}
/// A closed square from (100, 100) to (300, 300) whose handles lie on its sides, a quarter of
/// the way along.
fn square(s: &mut Session) -> NodeId {
let anchors = json!([
{"x": 100, "y": 100, "in": [100, 150], "out": [150, 100]},
{"x": 300, "y": 100, "in": [250, 100], "out": [300, 150]},
{"x": 300, "y": 300, "in": [300, 250], "out": [250, 300]},
{"x": 100, "y": 300, "in": [150, 300], "out": [100, 250]},
]);
NodeId(s.execute("path.create", &json!({ "anchors": anchors, "closed": true })).unwrap()["id"].as_u64().unwrap())
}
#[test]
fn moving_the_first_anchor_of_a_closed_path_re_maps_the_closing_segment_too() {
let mut s = session();
interpolate(&mut s, true);
let id = square(&mut s);
select(&mut s, id, json!([[0, 0]]));
s.execute("object.nudge", &json!({"dx": 0, "dy": -200})).unwrap();
let (a, b, c, d) = (anchor(&s, id, 0), anchor(&s, id, 1), anchor(&s, id, 2), anchor(&s, id, 3));
assert_eq!(a.p, Point::new(100.0, -100.0));
// The segment to the second anchor: its chord goes from (200, 0) to (200, 200).
close(a.h_out, Point::new(150.0, -50.0));
close(b.h_in, Point::new(250.0, 50.0));
// The closing segment from the fourth anchor: its chord goes from (0, -200) to (0, -400).
close(d.h_out, Point::new(100.0, 200.0));
close(a.h_in, Point::new(100.0, 0.0));
// The segment between the third and fourth anchors is not beside the moved anchor.
assert_eq!((c.h_out, d.h_in), (Point::new(250.0, 300.0), Point::new(150.0, 300.0)));
assert_eq!((b.h_out, c.h_in), (Point::new(300.0, 150.0), Point::new(300.0, 250.0)));
}
#[test]
fn moving_the_last_anchor_of_an_open_path_re_maps_only_the_segment_before_it() {
let mut s = session();
interpolate(&mut s, true);
let id = create(
&mut s,
json!([
{"x": 100, "y": 100, "out": [150, 100]},
{"x": 300, "y": 100, "in": [250, 100], "out": [350, 50]},
{"x": 500, "y": 100, "in": [450, 100], "out": [550, 50]},
]),
);
select(&mut s, id, json!([[0, 2]]));
s.execute("object.nudge", &json!({"dx": 0, "dy": 200})).unwrap();
let (a, b, c) = (anchor(&s, id, 0), anchor(&s, id, 1), anchor(&s, id, 2));
assert_eq!(c.p, Point::new(500.0, 300.0));
// The chord from the second (corner) anchor goes from (200, 0) to (200, 200).
close(b.h_out, Point::new(400.0, 100.0));
close(c.h_in, Point::new(450.0, 250.0));
// The last anchor's own outgoing handle leads to no segment and moves with it.
assert_eq!(c.h_out, Point::new(550.0, 250.0));
assert_eq!((a.h_out, b.h_in), (Point::new(150.0, 100.0), Point::new(250.0, 100.0)));
}
#[test]
fn move_and_transform_of_anchors_re_map_the_handles_in_one_undo_step() {
for (cmd, params) in [("object.move", json!({"dx": 20, "dy": 8})), ("object.transform", json!({"matrix": [1, 0, 0, 1, 20, 8], "anchors": true}))]
{
let mut s = session();
interpolate(&mut s, true);
let id = curve(&mut s);
select(&mut s, id, json!([[0, 0]]));
let (before, original) = (history(&s).0, path_of(&s, id));
s.execute(cmd, &params).unwrap();
assert_eq!(history(&s).0, before + 1, "{cmd}: one undo step");
let (a, b) = (anchor(&s, id, 0), anchor(&s, id, 1));
assert_eq!(a.p, Point::new(120.0, 108.0), "{cmd}");
close(a.h_out, Point::new(165.0, 106.0));
close(b.h_in, Point::new(255.0, 102.0));
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(path_of(&s, id), original, "{cmd}: undone");
}
}
#[test]
fn the_interpolate_param_overrides_the_preference_and_rejects_other_values() {
for (pref, param, re_mapped) in [(true, false, false), (false, true, true)] {
let mut s = session();
interpolate(&mut s, pref);
let id = curve(&mut s);
select(&mut s, id, json!([[0, 0]]));
s.execute("path.moveAnchors", &json!({"dx": 20, "dy": 8, "interpolate": param})).unwrap();
let b = anchor(&s, id, 1);
assert_eq!(b.h_in != Point::new(250.0, 100.0), re_mapped, "pref {pref}, param {param}: {:?}", b.h_in);
}
let mut s = session();
let id = curve(&mut s);
select(&mut s, id, json!([[0, 0]]));
let original = path_of(&s, id);
for (cmd, params) in [
("path.moveAnchors", json!({"dx": 1, "dy": 0, "interpolate": "yes"})),
("object.nudge", json!({"dx": 1, "dy": 0, "interpolate": "yes"})),
("object.move", json!({"dx": 1, "dy": 0, "interpolate": "yes"})),
("object.transform", json!({"matrix": [1, 0, 0, 1, 1, 0], "anchors": true, "interpolate": 1})),
("object.transformAgain", json!({"interpolate": "yes"})),
] {
let e = s.execute(cmd, &params).unwrap_err().to_string();
assert!(e.contains("`interpolate` must be true or false"), "{cmd}: {e}");
}
assert_eq!(path_of(&s, id), original);
}
#[test]
fn a_replayed_move_re_maps_the_handles_as_it_did_whatever_the_preference_is_then() {
let mut s = session();
interpolate(&mut s, true);
let id = curve(&mut s);
select(&mut s, id, json!([[0, 0]]));
let start = s.journal.len();
s.execute("object.nudge", &json!({"dx": 20, "dy": 8})).unwrap();
let moved = path_of(&s, id);
let (cmd, params) = s.journal.since(start).last().cloned().unwrap();
assert_eq!(params["interpolate"], json!(true), "{cmd}: journaled");
// Undo, turn the preference off and play the journal entry again.
s.execute("edit.undo", &json!({})).unwrap();
interpolate(&mut s, false);
select(&mut s, id, json!([[0, 0]]));
s.replay(&cmd, &params).unwrap();
assert_eq!(path_of(&s, id), moved);
}
#[test]
fn transform_again_keeps_the_setting_its_move_used() {
let mut s = session();
interpolate(&mut s, true);
let id = curve(&mut s);
select(&mut s, id, json!([[0, 0]]));
s.execute("object.nudge", &json!({"dx": 20, "dy": 8})).unwrap();
interpolate(&mut s, false);
s.execute("object.transformAgain", &json!({})).unwrap();
let mut t = session();
interpolate(&mut t, true);
let other = curve(&mut t);
select(&mut t, other, json!([[0, 0]]));
t.execute("object.nudge", &json!({"dx": 20, "dy": 8})).unwrap();
t.execute("object.nudge", &json!({"dx": 20, "dy": 8})).unwrap();
assert_eq!(path_of(&s, id), path_of(&t, other));
}
#[test]
fn a_segment_whose_ends_are_at_the_same_place_moves_rigidly() {
let mut s = session();
interpolate(&mut s, true);
let id = create(&mut s, json!([{"x": 100, "y": 100, "out": [150, 50]}, {"x": 100, "y": 100, "in": [50, 150]}]));
select(&mut s, id, json!([[0, 0]]));
s.execute("object.nudge", &json!({"dx": 10, "dy": 0})).unwrap();
let (a, b) = (anchor(&s, id, 0), anchor(&s, id, 1));
assert_eq!((a.p, a.h_out), (Point::new(110.0, 100.0), Point::new(160.0, 50.0)));
assert_eq!((b.p, b.h_in), (Point::new(100.0, 100.0), Point::new(50.0, 150.0)));
}
#[test]
fn a_move_onto_the_other_end_moves_the_handles_rigidly() {
let mut s = session();
interpolate(&mut s, true);
let id = curve(&mut s);
select(&mut s, id, json!([[0, 0]]));
s.execute("object.nudge", &json!({"dx": 200, "dy": 0})).unwrap();
let (a, b) = (anchor(&s, id, 0), anchor(&s, id, 1));
assert_eq!((a.p, a.h_out), (Point::new(300.0, 100.0), Point::new(350.0, 100.0)));
assert_eq!(b.h_in, Point::new(250.0, 100.0));
}
#[test]
fn a_nudge_of_zero_with_the_preference_on_records_no_undo_step() {
let mut s = session();
interpolate(&mut s, true);
let id = curve(&mut s);
select(&mut s, id, json!([[0, 0]]));
let (before, original) = (history(&s), path_of(&s, id));
s.execute("object.nudge", &json!({"dx": 0, "dy": 0})).unwrap();
assert_eq!(history(&s), before);
assert_eq!(path_of(&s, id), original);
}
#[test]
fn a_smooth_anchor_keeps_its_handles_in_line() {
let mut s = session();
interpolate(&mut s, true);
let id = create(
&mut s,
json!([
{"x": 100, "y": 100, "out": [150, 100]},
{"x": 300, "y": 100, "in": [250, 100], "out": [350, 100], "smooth": true},
{"x": 500, "y": 100, "in": [450, 100]},
]),
);
select(&mut s, id, json!([[0, 0]]));
s.execute("object.nudge", &json!({"dx": 0, "dy": -100})).unwrap();
let b = anchor(&s, id, 1);
assert_eq!(b.p, Point::new(300.0, 100.0));
// The segment to the third anchor did not move, so its handle stays where it was.
assert_eq!(b.h_out, Point::new(350.0, 100.0));
// The incoming handle grows with the chord from the moved anchor (from 200 to 100√5) and
// turns back in line with the outgoing one.
assert_eq!(b.h_in.y, 100.0, "in line: {:?}", b.h_in);
assert!((300.0 - b.h_in.x - 25.0 * 5f64.sqrt()).abs() < 1e-9, "{:?}", b.h_in);
}
#[test]
fn transform_again_repeats_a_move_with_the_handles_re_mapped() {
let twice = |again: bool| {
let mut s = session();
interpolate(&mut s, true);
let id = curve(&mut s);
select(&mut s, id, json!([[0, 0]]));
s.execute("object.nudge", &json!({"dx": 20, "dy": 8})).unwrap();
if again {
s.execute("object.transformAgain", &json!({})).unwrap();
} else {
s.execute("object.nudge", &json!({"dx": 20, "dy": 8})).unwrap();
}
path_of(&s, id)
};
let (repeated, nudged) = (twice(true), twice(false));
assert_eq!(repeated.subpaths[0].anchors[0].p, Point::new(140.0, 116.0));
assert_eq!(repeated, nudged);
}
#[test]
fn a_transform_that_scales_by_a_hair_still_scales_the_anchors() {
let mut s = session();
interpolate(&mut s, true);
let id = curve(&mut s);
select(&mut s, id, json!([[0, 0]]));
let k = 1.000_000_000_5;
s.execute("object.transform", &json!({"matrix": [k, 0, 0, 1, 0, 0], "anchors": true})).unwrap();
let a = anchor(&s, id, 0);
assert_eq!(a.p, Point::new(100.0 * k, 100.0));
assert_eq!(a.h_out, Point::new(150.0 * k, 100.0));
}
#[test]
fn a_smooth_anchor_whose_re_mapped_handles_point_the_same_way_moves_them_with_it() {
let mut s = session();
interpolate(&mut s, true);
let id = create(
&mut s,
json!([
{"x": 100, "y": 100, "out": [150, 100]},
{"x": 300, "y": 100, "in": [250, 100], "out": [350, 100], "smooth": true},
{"x": 500, "y": 100, "in": [450, 100]},
]),
);
select(&mut s, id, json!([[0, 1]]));
s.execute("object.nudge", &json!({"dx": 300, "dy": 0})).unwrap();
// Both chords re-map their handle to the left of the anchor, which has no direction between
// them: both handles move with the anchor, as with the preference off.
let b = anchor(&s, id, 1);
assert_eq!(b.p, Point::new(600.0, 100.0));
assert_eq!(b.h_out, Point::new(650.0, 100.0));
assert_eq!(b.h_in, Point::new(550.0, 100.0));
}
#[test]
fn a_smooth_anchor_between_two_re_mapped_segments_keeps_its_handles_in_line() {
let mut s = session();
interpolate(&mut s, true);
let id = create(
&mut s,
json!([
{"x": 100, "y": 100, "out": [150, 100]},
{"x": 300, "y": 100, "in": [250, 100], "out": [350, 100], "smooth": true},
{"x": 500, "y": 100, "in": [450, 100]},
]),
);
select(&mut s, id, json!([[0, 1]]));
s.execute("object.nudge", &json!({"dx": 0, "dy": -100})).unwrap();
let b = anchor(&s, id, 1);
let (v_in, v_out) = (b.h_in - b.p, b.h_out - b.p);
assert_eq!(b.p, Point::new(300.0, 0.0));
// The two chords turn by the same angle in opposite directions, so the handles point along
// the mean of the two: across, at the length each chord gives them.
assert!(v_in.cross(v_out).abs() < 1e-9, "the handles stay in line: {:?} {:?}", b.h_in, b.h_out);
assert!(v_in.dot(v_out) < 0.0, "on opposite sides of the anchor");
assert!(v_out.y.abs() < 1e-9 && v_out.x > 0.0, "{:?}", b.h_out);
assert!((v_out.hypot() - 25.0 * 5f64.sqrt()).abs() < 1e-9 && (v_in.hypot() - 25.0 * 5f64.sqrt()).abs() < 1e-9);
}
+1
View File
@@ -830,6 +830,7 @@ font-technology Variable Променливи
Direct Selection Tool Инструмент „Директен избор“
Direction Handles Маркери за посока
Disable Auto Add/Delete Изключване на автоматично добавяне/изтриване
Interpolate Control Points When Moving Anchors Интерполиране на маркерите за посока при преместване на опорни точки
Disable Opacity Mask Изключване на маска за непрозрачност
Discard Отхвърляне
Discard Empty Type Отхвърляне на празен текст
Can't render this file because it is too large.
+1
View File
@@ -3875,6 +3875,7 @@ theme Appearance Izgled
Data Recovery Oporavak podataka
Default Language Zadani jezik
Disable Auto Add/Delete Onemogući automatsko dodavanje/brisanje
Interpolate Control Points When Moving Anchors Interpoliraj ručke smjera pri pomjeranju sidrenih tačaka
Display All Blacks Accurately Prikaži sve crne tačno
Display All Blacks as Rich Black Prikaži sve crne kao bogatu crnu
Display Bitmaps as Anti-aliased Images in Pixel Preview Prikaži bitmape kao slike sa zaglađenim ivicama u pregledu piksela
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -1229,6 +1229,7 @@ antiAlias Sharp Nítid
Direction: Direcció:
Directives Directrius
Disable Auto Add/Delete Desactiva l’addició i la supressió automàtiques
Interpolate Control Points When Moving Anchors Interpola les manetes de direcció en moure punts d’ancoratge
Disable Opacity Mask Desactiva la màscara d’opacitat
Discard Descarta
Discard Empty Type Descarta el text buit
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3978,6 +3978,7 @@ theme Appearance Motiv
Data Recovery Obnovení dat
Default Language Výchozí jazyk
Disable Auto Add/Delete Vypnout automatické přidávání/odstraňování
Interpolate Control Points When Moving Anchors Interpolovat směrové úchyty při přesouvání kotevních bodů
Display All Blacks Accurately Zobrazovat všechny černé přesně
Display All Blacks as Rich Black Zobrazovat všechny černé jako sytou černou
Display Bitmaps as Anti-aliased Images in Pixel Preview Zobrazovat bitmapy v náhledu obrazových bodů vyhlazené
Can't render this file because it is too large.
+1
View File
@@ -6373,6 +6373,7 @@ theme Appearance Udseende
Data Recovery Datgendannelse
Default Language Standardsprog
Disable Auto Add/Delete Deaktivér automatisk tilføjelse/sletning
Interpolate Control Points When Moving Anchors Interpolér retningshåndtag ved flytning af ankerpunkter
Display All Blacks Accurately Vis alle sorte nøjagtigt
Display All Blacks as Rich Black Vis alle sorte som rich black
Display Bitmaps as Anti-aliased Images in Pixel Preview Vis bitmaps som antialiaserede billeder i pixelforhåndsvisning
Can't render this file because it is too large.
+1
View File
@@ -831,6 +831,7 @@ font-technology Variable Variabel
Direct Selection Tool Direktauswahl-Werkzeug
Direction Handles Richtungsgriffe
Disable Auto Add/Delete Automatisches Hinzufügen/Löschen deaktivieren
Interpolate Control Points When Moving Anchors Richtungsgriffe beim Verschieben von Ankerpunkten interpolieren
Disable Opacity Mask Deckkraftmaske deaktivieren
Discard Verwerfen
Preserve Beibehalten
Can't render this file because it is too large.
+1
View File
@@ -811,6 +811,7 @@ font-technology Variable Μεταβλητές
Direct Selection Tool Άμεση επιλογή (Direct Selection Tool)
Direction Handles Λαβές κατεύθυνσης
Disable Auto Add/Delete Απενεργοποίηση αυτόματης προσθήκης/διαγραφής
Interpolate Control Points When Moving Anchors Παρεμβολή λαβών κατεύθυνσης κατά τη μετακίνηση σημείων αγκύρωσης
Disable Opacity Mask Απενεργοποίηση μάσκας αδιαφάνειας
Discard Απόρριψη
Discard Empty Type Απόρριψη κενού κειμένου
Can't render this file because it is too large.
+1
View File
@@ -852,6 +852,7 @@ font-technology Variable Variables
Direct Selection Tool Herramienta Selección directa
Direction Handles Manejadores de dirección
Disable Auto Add/Delete Desactivar agregar/eliminar automático
Interpolate Control Points When Moving Anchors Interpolar manejadores de dirección al mover puntos de ancla
Disable Opacity Mask Desactivar máscara de opacidad
Discard Descartar
Discard Empty Type Descartar texto vacío
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3916,6 +3916,7 @@ theme Appearance Ulkoasu
Data Recovery Tietojen palautus
Default Language Oletuskieli
Disable Auto Add/Delete Poista automaattinen lisäys/poisto käytöstä
Interpolate Control Points When Moving Anchors Interpoloi suuntakahvat siirrettäessä ankkuripisteitä
Display All Blacks Accurately Näytä kaikki mustat tarkasti
Display All Blacks as Rich Black Näytä kaikki mustat syvämustina
Display Bitmaps as Anti-aliased Images in Pixel Preview Näytä bittikartat reunanpehmennettyinä kuvina pikseliesikatselussa
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -855,6 +855,7 @@ font-technology Variable Variables
Direct Selection Tool Outil Sélection directe
Direction Handles Poignées de direction
Disable Auto Add/Delete Désactiver l’ajout/suppression automatique
Interpolate Control Points When Moving Anchors Interpoler les poignées de direction lors du déplacement des points d’ancrage
Disable Opacity Mask Désactiver le masque d’opacité
Discard Ignorer
Discard Empty Type Supprimer le texte vide
Can't render this file because it is too large.
+1
View File
@@ -982,6 +982,7 @@
Direction: દિશા:
Directives નિર્દેશો
Disable Auto Add/Delete ઑટો ઍડ/ડિલીટ બંધ કરો
Interpolate Control Points When Moving Anchors એન્કર બિંદુઓ ખસેડતી વખતે દિશા હેન્ડલ્સ ઇન્ટરપોલેટ કરો
Disable Opacity Mask ઓપેસિટી માસ્ક બંધ કરો
Disable and Continue બંધ કરો અને ચાલુ રાખો
Disabled plug-ins બંધ કરેલા પ્લગ-ઇન્સ
Can't render this file because it contains an unexpected character in line 72 and column 5.
+1
View File
@@ -1389,6 +1389,7 @@ antiAlias Sharp शार्प
Direction: दिशा:
Directives निर्देश
Disable Auto Add/Delete ऑटो जोड़ना/हटाना अक्षम करें
Interpolate Control Points When Moving Anchors एंकर पॉइंट खिसकाते समय निर्देशन हैंडल इंटरपोलेट करें
Disable Opacity Mask ओपेसिटी मास्क अक्षम करें
Discard डिस्कर्ड
Discard Empty Type खाली टाइप हटाएँ
Can't render this file because it is too large.
+1
View File
@@ -1100,6 +1100,7 @@ font-technology Variable Változó
Direction Handles Iránykezelő fogantyúk
Direction: Irány:
Disable Auto Add/Delete Automatikus hozzáadás és törlés kikapcsolása
Interpolate Control Points When Moving Anchors Iránykezelő fogantyúk interpolálása horgonypontok mozgatásakor
Disable Opacity Mask Átlátszósági maszk kikapcsolása
Discard Elvetés
Discard Empty Type Üres szöveg elvetése
Can't render this file because it is too large.
+1
View File
@@ -3652,6 +3652,7 @@ theme Appearance Tampilan
Data Recovery Pemulihan data
Default Language Bahasa standar
Disable Auto Add/Delete Nonaktifkan tambah/hapus otomatis
Interpolate Control Points When Moving Anchors Interpolasikan gagang arah saat memindahkan titik jangkar
Display All Blacks Accurately Tampilkan semua warna hitam secara akurat
Display All Blacks as Rich Black Tampilkan semua warna hitam sebagai rich black
Display Bitmaps as Anti-aliased Images in Pixel Preview Tampilkan bitmap sebagai gambar anti-alias dalam pratinjau piksel
Can't render this file because it contains an unexpected character in line 2488 and column 5.
+1
View File
@@ -852,6 +852,7 @@ font-technology Variable Variabili
Direct Selection Tool Strumento Selezione diretta
Direction Handles Maniglie di direzione
Disable Auto Add/Delete Disattiva aggiunta/eliminazione automatica
Interpolate Control Points When Moving Anchors Interpola le maniglie di direzione durante lo spostamento dei punti di ancoraggio
Disable Opacity Mask Disattiva maschera di opacità
Discard Scarta
Preserve Mantieni
Can't render this file because it is too large.
+1
View File
@@ -1532,6 +1532,7 @@ antiAlias Sharp シャープ
Dimensions 寸法
Direct Selection Tool ダイレクト選択ツール
Disable Auto Add/Delete 自動追加/削除機能を使用しない
Interpolate Control Points When Moving Anchors アンカーポイントの移動時に方向線ハンドルを補間
Disable Opacity Mask 不透明マスクを無効にする
Discard 破棄
Preserve 保持
Can't render this file because it is too large.
+1
View File
@@ -5630,6 +5630,7 @@ theme Appearance იერსახე
Data Recovery მონაცემების აღდგენა
Default Language ნაგულისხმევი ენა
Disable Auto Add/Delete ავტომატური დამატება/წაშლის გამორთვა
Interpolate Control Points When Moving Anchors სახელურების ინტერპოლაცია საყრდენი წერტილების გადაადგილებისას
Display All Blacks Accurately ყველა შავის ზუსტად ჩვენება
Display All Blacks as Rich Black ყველა შავის მდიდარ შავად ჩვენება
Display Bitmaps as Anti-aliased Images in Pixel Preview პიქსელურ ნახვაში ბიტმაპების ანტიალიასინგიან გამოსახულებებად ჩვენება
Can't render this file because it is too large.
+1
View File
@@ -1522,6 +1522,7 @@ antiAlias Sharp 날카롭게
Dimensions 치수
Direct Selection Tool 직접 선택 도구
Disable Auto Add/Delete 자동 추가/삭제 사용 안 함
Interpolate Control Points When Moving Anchors 앵커 포인트 이동 시 방향 핸들 보간
Disable Opacity Mask 불투명 마스크 사용 안 함
Discard 삭제
Preserve 보존
Can't render this file because it is too large.
+1
View File
@@ -4267,6 +4267,7 @@ theme Appearance Vormgeving
Data Recovery Gegevensherstel
Default Language Standaardtaal
Disable Auto Add/Delete Automatisch toevoegen/verwijderen uitschakelen
Interpolate Control Points When Moving Anchors Richtingsgrepen interpoleren bij het verplaatsen van ankerpunten
Display All Blacks Accurately Alle zwarttinten nauwkeurig weergeven
Display All Blacks as Rich Black Alle zwarttinten weergeven als rijk zwart
Display Bitmaps as Anti-aliased Images in Pixel Preview Bitmaps in pixelvoorbeeld weergeven als afbeeldingen met antialiasing
Can't render this file because it is too large.
+1
View File
@@ -3855,6 +3855,7 @@ theme Appearance Wygląd
Data Recovery Odzyskiwanie danych
Default Language Język domyślny
Disable Auto Add/Delete Wyłącz automatyczne dodawanie/usuwanie
Interpolate Control Points When Moving Anchors Interpoluj uchwyty kierunkowe podczas przesuwania punktów kontrolnych
Display All Blacks Accurately Wyświetlaj wszystkie czernie dokładnie
Display All Blacks as Rich Black Wyświetlaj wszystkie czernie jako czerń głęboką
Display Bitmaps as Anti-aliased Images in Pixel Preview Wyświetlaj bitmapy wygładzone w podglądzie pikseli
Can't render this file because it is too large.
+1
View File
@@ -764,6 +764,7 @@ antiAlias Sharp Nítido
Direct Selection Tool Ferramenta Seleção Direta
Direction Handles Alças de Direção
Disable Auto Add/Delete Desativar Adicionar/Excluir Automático
Interpolate Control Points When Moving Anchors Interpolar Alças de Direção ao Mover Pontos de Ancoragem
Disable Opacity Mask Desativar Máscara de Opacidade
Discard Descartar
Discard Empty Type Descartar Texto Vazio
Can't render this file because it is too large.
+1
View File
@@ -850,6 +850,7 @@ font-technology Variable Вариативные
Direct Selection Tool Инструмент «Прямое выделение»
Direction Handles Маркеры направления
Disable Auto Add/Delete Отключить авто-добавление/удаление
Interpolate Control Points When Moving Anchors Интерполировать маркеры направления при перемещении опорных точек
Disable Opacity Mask Отключить непрозрачную маску
Discard Отменить
Discard Empty Type Отменить пустой текст
Can't render this file because it is too large.
+1
View File
@@ -839,6 +839,7 @@ font-technology Variable Variabla
Direct Selection Tool Direktmarkeringsverktyg
Direction Handles Riktningshandtag
Disable Auto Add/Delete Inaktivera Lägg till/radera automatiskt
Interpolate Control Points When Moving Anchors Interpolera riktningshandtag vid flyttning av ankarpunkter
Disable Opacity Mask Inaktivera opacitetsmask
Discard Släng
Discard Empty Type Släng tom text
Can't render this file because it is too large.
+1
View File
@@ -831,6 +831,7 @@ font-technology Variable Değişken
Direct Selection Tool Doğrudan Seçim Aracı
Direction Handles Yön Kolları
Disable Auto Add/Delete Otomatik Ekleme/Silmeyi Devre Dışı Bırak
Interpolate Control Points When Moving Anchors Bağlantı Noktalarını Taşırken Yön Kollarını Enterpole Et
Disable Opacity Mask Opaklık Maskesini Devre Dışı Bırak
Discard At
Discard Empty Type Boş Türü At
Can't render this file because it is too large.
+1
View File
@@ -846,6 +846,7 @@ font-technology Variable Варіативні
Direct Selection Tool Інструмент «Пряме виділення»
Direction Handles Маркери напряму
Disable Auto Add/Delete Вимкнути авто-додавання/видалення
Interpolate Control Points When Moving Anchors Інтерполювати маркери напряму під час переміщення опорних точок
Disable Opacity Mask Вимкнути маску непрозорості
Discard Відкинути
Preserve Зберігати
Can't render this file because it is too large.
+1
View File
@@ -992,6 +992,7 @@ font-technology Variable Biến thiên
Direction Handles Tay nắm hướng
Direction: Hướng:
Disable Auto Add/Delete Tắt tự động thêm/xóa
Interpolate Control Points When Moving Anchors Nội suy tay nắm hướng khi di chuyển điểm neo
Disable Opacity Mask Tắt mặt nạ độ mờ
Discard Loại bỏ
Preserve Bảo lưu
Can't render this file because it contains an unexpected character in line 205 and column 5.
+1
View File
@@ -793,6 +793,7 @@ antiAlias Sharp 锐利
Direct Selection Tool 直接选择工具
Direction Handles 方向手柄
Disable Auto Add/Delete 禁用自动添加/删除锚点
Interpolate Control Points When Moving Anchors 移动锚点时插值方向手柄
Disable Opacity Mask 禁用不透明度蒙版
Discard 不存储
Discard Empty Type 丢弃空文字
Can't render this file because it is too large.
+1
View File
@@ -814,6 +814,7 @@ font-technology Variable 可變
Direct Selection Tool 直接選取工具
Direction Handles 控制把手
Disable Auto Add/Delete 停用自動增加/刪除
Interpolate Control Points When Moving Anchors 移動錨點時內插控制把手
Disable Opacity Mask 停用不透明度遮色片
Discard 捨棄
Preserve 保留
Can't render this file because it is too large.
+13
View File
@@ -6744,6 +6744,19 @@ The Selection & Anchor Display and General preferences apply to `pointer_gesture
- `showHandlesMultipleAnchors` (on by default): off, Direct Selection (and the Anchor Point tool, and the Pen with Alt)
shows and drags direction handles only while a single anchor is selected. On, the handles of the direct-selected
anchors, or of every anchor of a path selected as a whole, show and drag. `handleStyle` (`solid`, `hollow`, `large`) draws their ends (desktop app).
- `interpolateControlPoints` (General › Interpolate Control Points When Moving Anchors, off by default): the default of
the `interpolate` param of `path.moveAnchors` (a Direct Selection drag), `object.nudge` (the arrow keys),
`object.move`, `object.transform` and `object.transformAgain`. It applies when they move direct-selected anchors
without turning or scaling them; `object.setBounds` and `guide.move` follow the preference when they move anchors.
On, both handles of each segment with one moved end are re-mapped by the turn, uniform scale and move that take the
segment's old ends to its new ends, so a segment between two corner anchors keeps its shape relative to its ends. A
segment with both ends moved, or with its ends at the same place before or after the move, moves as it does with the
preference off. A smooth anchor keeps its handles in line: its re-mapped handle takes the new length and stays in
line with the other handle, and when both of its handles were re-mapped they point along the mean of their
directions. When the two point the same way, both move with the anchor as with the preference off. A retracted
handle stays retracted. The value used joins the command's journal entry and Transform Again's options. Align and
Distribute, and the anchors of type paths and area type frames (`text.reshapePath`, `text.reshapeArea`), move as
before. Off, the handles of a moved anchor move with it and the other handles stay where they are.
- `hideCornerWidgetAbove` (177° by default): corners wider than this show no Live Corners widget (a rectangle's right
angles hide below 90°).
- `transformPatternTiles` (off by default): the default of the transforms' `patterns` param (`object.transform`,
+1
View File
@@ -1213,6 +1213,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Pen:** Alt pressed in the middle of dragging out an anchor splits its handles and keeps the curve already shaped into it (only the outgoing handle follows the pointer); Space held while dragging out an anchor moves it, handles and all. A press on the first anchor of the path being drawn closes it whatever the drag then does: the drag shapes the closing curve and the release closes the path wherever it ends (#501). The first anchor's incoming handle mirrors the pointer, and a click leaves it retracted and the anchor a corner. Its outgoing handle stays where it is on a corner, so the first segment keeps its shape, and on a smooth anchor it turns to stay in line at its own length; Alt makes the anchor a corner and leaves the outgoing handle where it was when Alt went down. The Smart Pen's closing drag does the same (fixes #6634; `path.close`'s `in` and `out`; behavior reference: [draw with the Pen, Curvature, or Pencil tool](https://web.archive.org/web/20220614224656/https://helpx.adobe.com/illustrator/using/drawing-pen-curvature-or-pencil.html), where a click or drag on the first anchor closes the path and Alt breaks the pairing of the closing anchor's handles; which handles the drag sets are our choices). Space held during the Pen's closing drag moves the first anchor, handles and all, as that page also describes (`path.close`'s `at`). Clicking the last anchor of the path being drawn retracts its outgoing handle (convert cursor), and dragging from it pulls out a new one on its own. Auto Add/Delete: over a selected path, a click on a segment adds an anchor and a click on an anchor deletes it (add and delete cursors); Shift held, or Preferences › General › Disable Auto Add/Delete, starts a new path instead. Alt held over a handle end or an anchor of a selected path (the one being drawn too) works as the Anchor Point tool, with its convert cursor: dragging a handle moves it alone, clicking a smooth anchor makes it a corner, dragging an anchor pulls out new symmetric handles, dragging a segment reshapes it; drawing then goes on. Cmd (Ctrl) held drags with the selection tool chosen last, Direct Selection until one is (handles, anchors and segments of the path being drawn or another), and the Pen then goes on drawing its path while that stays selected; the pointer shows that tool's while Cmd is held. The same holds for agents (`pointer_gesture` with `mods.cmd`), as the borrowing now lives in the engine (#494). A drag's preview (the Pen's, the Anchor Point tool's, Direct Selection's handles and anchors) follows every position the pointer is seen at (#834): the canvas sends the tool a drag whenever the pointer's document position differs from the last one it sent, not only when egui's frame delta is non-zero (zero when a compositor coalesces motion and in the frame the pointer comes back into the window after leaving it), and a move that arrives in the release's own frame shapes the preview before the release commits it, once the press has dragged. With the Pen, a press that moves under 3 screen pixels is a click (a corner without handles), and a Precise Cursors command toggles the existing preference and can take a shortcut (#1663).
- **Direct Selection (#1278):** clicking a segment picks its connection, with hollow endpoint anchors and only that curve's direction handles. Delete leaves the neighboring curves and appearance intact, opens/splits contours in one undo step, and another Delete removes the remaining selected path. A whole-path drag and deliberate anchor selection keep their existing behavior; egui frames and native control/art checked, OS mouse/visual QA pending. Where anchors of overlapping objects coincide, a click or drag takes the anchor of the selected object, also when another object lies over it (#1509, fixes #1508). Delete removes every selected anchor of a closed path (it used to remove the wrong ones), removes objects selected whole along with the selected anchors of others, and keeps the remainder selected so a second Delete removes it (#1674). In isolation mode Direct Selection and Group Selection pick only inside the isolated object (#1666). Escape cancels a Direct Selection drag (#1803, #1743). Double-clicking type (including type nested inside a group) switches to the Type tool and puts the caret at the clicked character.
With Direct Selection and Group Selection, a drag that starts on an object while the selection also holds direct-selected anchors or segments moves those anchors and the objects selected whole in one undo step (`path.moveAnchors`), as a drag of a selected anchor does, and the other anchors of a partly selected path stay in place. While Alt is held during the drag, it copies the selected objects instead (`object.transform`). When direct-selected anchors are moved or transformed together with objects selected whole (such a drag, an anchor drag, an arrow key, or Move, Rotate, Scale, Reflect and Shear without a copy), a path inside a selected group is transformed once, with the group.
VectorCraft's own preference General › Interpolate Control Points When Moving Anchors (`interpolateControlPoints`, off by default, fixes #7832): on, a Direct Selection drag, an arrow-key nudge, a Move or a Transform Again of selected anchors re-maps both handles of each segment with one moved end by the turn, uniform scale and move that take its old ends to its new ends, so a segment between corner anchors keeps its shape; a segment with both ends moved, or with its ends at the same place before or after the move, moves rigidly, and a smooth anchor keeps its handles in line. The commands take an `interpolate` param that defaults to the preference, and the value used joins the journal and Transform Again. Each drag or nudge is one undo step (`a_nudge_with_the_preference_on_re_maps_both_handles_of_the_segment`, `a_direct_selection_drag_with_the_preference_on_re_maps_the_handles_in_one_undo_step`, `a_smooth_anchor_keeps_its_handles_in_line`).
A path segment with a control point whose x or y is infinite or larger in size than `f64::MAX / 16` is measured by its control points, so its bounds hold the whole curve and the canvas check refuses an edit that leaves such a path selected (`path.create` included).
With Direct Selection, the Pen and the anchor tools, a group, compound path or clip group selected whole shows the anchors of its paths filled, as a path selected whole does; the direction handles still show only on a path that is selected itself. Public references: [Adjust anchor point, handle, and bounding box display size](https://web.archive.org/web/20251114182206/https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/learn-drawing-basics/adjust-anchor-point-handle-and-bounding-box-display-size.html) and [Drawing basics](https://web.archive.org/web/20231130064834/https://helpx.adobe.com/illustrator/using/drawing-basics.html) (archived copies).
When the Add Anchor Point tool, the Pen's Auto Add, the Smart Pen's Alt-click on a segment or Alt-click with the Scissors adds an anchor to a path with direct-selected anchors or segments (`path.insertAnchor`), the same points stay selected: the anchors and segments after the new anchor are numbered one higher, and a selected segment that the new anchor splits stays selected as its two halves.