Smooth: Smooth Tool Options' Smoothness sets how strongly a drag smooths

Smooth Tool Options gets a Smoothness setting under Fidelity, from 0% to
100%, where a higher value leaves a smoother path, as the help page
describes the setting:
https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=164

- path.smoothRegion takes an optional `smoothness` (0 to 100, 50 when
  left out). It scales the spread of the averaging done before the
  refit in proportion: none at 0, today's spread at 50, twice it at
  100. A value outside 0 to 100 is an error and changes nothing.
- The Smooth tool keeps the option with its preferences and sends it
  with each drag; Alt smoothing with the Pencil, Paintbrush and Blob
  Brush uses it, as it already uses the Smooth tool's Fidelity.
  tool.setOption refuses a value outside 0 to 100.
- The default and the way the percentage scales the smoothing are
  VectorCraft's own; the default keeps today's strength.

Docs: docs/mcp.md, docs/target-app-parity.md.
This commit is contained in:
dotCooCoo committed 2026-11-21 01:09:50 -08:00
1 parent 9fff48d88f
commit 2389cdfd7f
40 files changed
+303 -25

No files matched your search

+1 -1
View File
@@ -120,7 +120,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Smooth",
[],
None,
"{points: [[x,y]…] (pen values after x and y are checked as path.freehand checks them and do not change the smoothing), radius?: pt (12), fidelity?: pt (2.5; kept within 0.000078125 and about 3195, the Smooth tool's 0.05 to 100 px at the highest and the lowest zoom: the tool sends its Fidelity in screen pixels divided by the zoom)} smooth selected paths near the drag, keeping a corner where the path turns by more than 57.5° at the anchor and over radius and twice radius on either side → {ids, before, after}",
"{points: [[x,y]…] (pen values after x and y are checked as path.freehand checks them and do not change the smoothing), radius?: pt (12), fidelity?: pt (2.5; kept within 0.000078125 and about 3195, the Smooth tool's 0.05 to 100 px at the highest and the lowest zoom: the tool sends its Fidelity in screen pixels divided by the zoom), smoothness?: % (50; 0 to 100, an error outside it: how far along the path each point is averaged before the refit, in proportion: none at 0, twice as far as at 50 at 100)} smooth selected paths near the drag, keeping a corner where the path turns by more than 57.5° at the anchor and over radius and twice radius on either side → {ids, before, after}",
has_selection,
smooth_region
),
+15 -5
View File
@@ -2,17 +2,23 @@ use vectorcraft_pathops::addons::pathtools as pt;
use super::common::{dist_to_polyline, ids_json, path_mut, path_of, points_param, poly_bounds, subpath_len, target_paths};
use super::{
Anchor, BezPath, CubicBez, NodeId, ParamCurve, ParamCurveNearest, PathData, Point, Rect, Result, Session, SimplifyOptions, SubPath, Value, json,
number_or, po,
Anchor, BezPath, CubicBez, NodeId, ParamCurve, ParamCurveNearest, PathData, Point, Rect, Result, Session, SimplifyOptions, SubPath, Value, bad,
json, number_or, po,
};
// ---------- Smooth ----------
/// The spread (points) of the Gaussian the Smooth tool smooths a path along its length with before
/// refitting it, as a share of the tool's reach: a third, so each point is averaged with the stretch
/// of path within the reach on either side of it. VectorCraft's own value.
/// refitting it at the default Smoothness ([`SMOOTH_SMOOTHNESS`]), as a share of the tool's reach: a
/// third, so each point is averaged with the stretch of path within the reach on either side of it.
/// The spread grows in proportion to the Smoothness, from none at 0% to twice this at 100%.
/// VectorCraft's own value.
const SMOOTH_SPREAD: f64 = 1.0 / 3.0;
/// The Smoothness (percent) `path.smoothRegion` smooths with when the drag leaves it out. VectorCraft's
/// own value.
const SMOOTH_SMOOTHNESS: f64 = 50.0;
/// The degrees by which a path must turn at an anchor, and over the tool's reach and twice its reach
/// on either side of it, for the Smooth tool to keep the anchor as a corner ([`smooth_corners`]): a
/// turn of more than 57.5°, an angle inside the corner of less than 122.5°. VectorCraft's own value,
@@ -735,7 +741,11 @@ pub(super) fn smooth_region(s: &mut Session, p: &Value) -> Result<Value> {
let pts = points_param(p, "points", C)?;
let radius = number_or(p, "radius", 12.0, C)?.max(0.0);
let tol = number_or(p, "fidelity", 2.5, C)?.clamp(vectorcraft_tools::draw2::SMOOTH_MIN_TOLERANCE, vectorcraft_tools::draw2::SMOOTH_MAX_TOLERANCE);
let sigma = radius * SMOOTH_SPREAD;
let smoothness = number_or(p, "smoothness", SMOOTH_SMOOTHNESS, C)?;
if !(0.0..=100.0).contains(&smoothness) {
return Err(bad(C, "`smoothness` must be from 0 to 100"));
}
let sigma = radius * SMOOTH_SPREAD * smoothness / SMOOTH_SMOOTHNESS;
let st = s.doc()?;
let mut plan = vec![];
let (mut before, mut after) = (0, 0);
+60 -1
View File
@@ -1794,6 +1794,64 @@ fn smooth_region_refits_at_the_tolerance_sent_at_any_zoom() {
}
}
/// A line from (100, 200) to (400, 200) jagged by up to 6 pt either way, the same every time.
fn jagged_line_anchors() -> Vec<serde_json::Value> {
let mut seed = 7u64;
(0..=60)
.map(|i| {
seed = seed.wrapping_mul(6364136223846793005).wrapping_add(1442695040888963407);
let noise = ((seed >> 11) as f64 / (1u64 << 53) as f64) * 2.0 - 1.0;
json!({"x": 100.0 + f64::from(i) * 5.0, "y": 200.0 + 6.0 * noise})
})
.collect()
}
/// The path a `path.smoothRegion` drag along [`jagged_line_anchors`] leaves with `smoothness` (left
/// out for null), and the mean distance of its points from the line y = 200.
fn smoothed_jagged_line(smoothness: serde_json::Value) -> (PathData, f64) {
let mut s = session();
let id = smooth_test_path(&mut s, &jagged_line_anchors(), false);
let drag: Vec<_> = (0..=64).map(|i| json!([90.0 + f64::from(i) * 5.0, 200.0])).collect();
s.execute("path.smoothRegion", &json!({"points": drag, "radius": 12, "fidelity": 2.5, "smoothness": smoothness})).unwrap();
let p = path(&s, id);
let samples = smooth_test_samples(&p);
let off = samples.iter().map(|q| (q.y - 200.0).abs()).sum::<f64>() / samples.len() as f64;
(p, off)
}
/// Smooth Tool Options' Smoothness: the higher it is, the smoother the path a drag leaves, from
/// 0% to 100%. Left out, a drag smooths at 50%.
#[test]
fn a_higher_smoothness_leaves_a_smoother_path() {
let original = {
let mut s = session();
let id = smooth_test_path(&mut s, &jagged_line_anchors(), false);
let samples = smooth_test_samples(&path(&s, id));
samples.iter().map(|q| (q.y - 200.0).abs()).sum::<f64>() / samples.len() as f64
};
let offs: Vec<f64> = [0.0, 25.0, 50.0, 75.0, 100.0].iter().map(|&x| smoothed_jagged_line(json!(x)).1).collect();
assert!(offs[0] < original, "even 0% refits within Fidelity: {offs:?}, {original} before");
assert!(offs.windows(2).all(|w| w[1] < w[0]), "each step up smooths more: {offs:?}");
assert_eq!(smoothed_jagged_line(json!(null)).0, smoothed_jagged_line(json!(50)).0, "left out is 50%");
}
/// `path.smoothRegion` refuses a Smoothness outside 0% to 100% and changes nothing.
#[test]
fn smooth_region_refuses_a_smoothness_outside_0_to_100() {
let mut s = session();
let id = smooth_test_path(&mut s, &jagged_line_anchors(), false);
let drag = json!({"points": [[90, 200], [250, 200], [410, 200]], "radius": 12, "fidelity": 2.5});
for x in [json!(-1), json!(-0.001), json!(100.5), json!(101), json!(1e300)] {
refuses_with(&mut s, "path.smoothRegion", &with(&drag, json!({"smoothness": x})), "`smoothness` must be from 0 to 100");
}
for x in [json!(0), json!(100)] {
let before = path(&s, id);
s.execute("path.smoothRegion", &with(&drag, json!({"smoothness": x}))).unwrap_or_else(|e| panic!("smoothness {x}: {e}"));
assert_ne!(path(&s, id), before, "smoothness {x} smoothed nothing");
s.execute("edit.undo", &json!({})).unwrap();
}
}
/// A drag of the Smooth tool along a line jagged by up to 6 pt leaves no corner between a curve and
/// a line: every anchor between the path's ends turns by at most 1°.
#[test]
@@ -3314,7 +3372,7 @@ fn path_eraser_width_outside_its_range_is_refused() {
}
/// The Eraser, Path Eraser, Smooth, Join and Blob Brush commands refuse a size, angle, roundness,
/// width, radius, fidelity or tolerance given as text or as another value that is not a number, and change
/// width, radius, fidelity, smoothness or tolerance given as text or as another value that is not a number, and change
/// nothing; null is read as the key left out.
#[test]
fn drawing_commands_refuse_a_size_given_as_text() {
@@ -3329,6 +3387,7 @@ fn drawing_commands_refuse_a_size_given_as_text() {
("path.eraseSegments", "width"),
("path.smoothRegion", "radius"),
("path.smoothRegion", "fidelity"),
("path.smoothRegion", "smoothness"),
("path.joinScrub", "tolerance"),
("path.blob", "size"),
("path.blob", "fidelity"),
+48
View File
@@ -473,6 +473,54 @@ fn alt_smoothing_takes_the_smooth_tools_fidelity() {
}
}
/// The Smoothness an Alt smoothing drag sends with `path.smoothRegion` on a selected path.
fn alt_smoothness(s: &mut Session) -> Option<f64> {
use vectorcraft_tools::Action;
let mods = Mods { alt: true, ..Default::default() };
let mut last = vec![];
for (kind, x, y) in [(PointerKind::Down, 50.0, 150.0), (PointerKind::Drag, 150.0, 150.0), (PointerKind::Up, 250.0, 160.0)] {
let ev = PointerEvent { mods, ..PointerEvent::new(kind, x, y) };
last = s.with_tool_cx(ViewInfo::default(), |t, cx| t.pointer(cx, &ev));
}
last.iter().find_map(|a| match a {
Action::Exec(c, v) if c == "path.smoothRegion" => v["smoothness"].as_f64(),
_ => None,
})
}
/// Smooth Tool Options' Smoothness is kept with the preferences (50% until it is set), and Alt
/// smoothing with the Pencil, Paintbrush and Blob Brush uses it. A Smoothness outside 0 to 100 is
/// an error that sets nothing.
#[test]
fn the_smooth_tools_smoothness_is_kept_and_alt_smoothing_takes_it() {
let mut s = session();
s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 100, "height": 100})).unwrap();
select(&mut s, "smooth");
assert_eq!(s.tool_options()["smoothness"], json!(50.0));
for bad in [json!(-1), json!(100.5), json!("30"), json!(null)] {
let e = s.set_tool_option_cmd(&json!({"key": "smoothness", "value": bad})).unwrap_err();
assert_eq!(e, "tool `smooth`: `smoothness` must be a number from 0 to 100", "{bad}");
}
assert_eq!(s.tool_options()["smoothness"], json!(50.0));
s.set_tool_option("smoothness", &json!(80));
assert_eq!(s.prefs.tool_settings["smooth"]["smoothness"], json!(80.0));
for id in ["pencil", "paintbrush", "blobBrush"] {
select(&mut s, id);
if id == "pencil" {
s.set_tool_option("altSmooth", &json!(true));
}
assert_eq!(alt_smoothness(&mut s), Some(80.0), "{id}");
assert!(s.tool_options().get("smoothness").is_none(), "{id} has no Smoothness of its own");
}
s.set_tool_option_cmd(&json!({"tool": "smooth", "key": "smoothness", "value": 10})).unwrap();
assert_eq!(alt_smoothness(&mut s), Some(10.0), "the Blob Brush takes the new Smoothness");
let saved = serde_json::to_string(&s.prefs).unwrap();
let mut next = session();
next.apply_prefs(serde_json::from_str(&saved).unwrap());
select(&mut next, "smooth");
assert_eq!(next.tool_options()["smoothness"], json!(10.0));
}
/// `tool.setOption` with a value of the wrong type, a number out of range, an unknown value or an
/// option the tool doesn't have is an error naming the tool and the option. Nothing is set, also
/// when another option given with it is good, and nothing is saved or recorded for undo.
+8 -3
View File
@@ -374,12 +374,17 @@ impl Session {
}
}
}
// Alt switches the Pencil, Paintbrush or Blob Brush to Smooth, using Smooth Tool Options' Fidelity.
// Alt switches the Pencil, Paintbrush or Blob Brush to Smooth, using Smooth Tool Options' Fidelity
// and Smoothness.
if matches!(t.id(), "pencil" | "paintbrush" | "blobBrush")
&& wanted("smooth")
&& let Some(v) = prefs.tool_settings.get("smooth").and_then(|s| s.get("fidelity"))
&& let Some(saved) = prefs.tool_settings.get("smooth")
{
t.set_option("smoothFidelity", v);
for (key, alt) in [("fidelity", "smoothFidelity"), ("smoothness", "smoothSmoothness")] {
if let Some(v) = saved.get(key) {
t.set_option(alt, v);
}
}
}
}
+22 -6
View File
@@ -85,6 +85,9 @@ const BAND_WORK_PER_CALL: usize = 20_000;
const PREVIEW_FIDELITY_PX: f64 = 0.5;
/// The Smooth tool's Fidelity (screen pixels) until Smooth Tool Options sets another.
const SMOOTH_FIDELITY: f64 = 2.5;
/// The Smooth tool's Smoothness (percent) until Smooth Tool Options sets another: the strength
/// `path.smoothRegion` smooths with when a drag leaves it out. VectorCraft's own value.
const SMOOTH_SMOOTHNESS: f64 = 50.0;
/// How far the pointer goes from the press point, in screen pixels, before a Shift-drag of the
/// Eraser takes the 45° step it lies nearest to.
const ERASER_SHIFT_PX: f64 = 3.0;
@@ -168,6 +171,11 @@ pub struct GestureTool {
/// The Smooth tool's Fidelity (screen pixels), used when Alt switches the Pencil, Paintbrush or
/// Blob Brush to Smooth. The engine sets it from Smooth Tool Options (`smoothFidelity`).
smooth_fidelity: f64,
/// Smooth Tool Options' Smoothness (percent, 0 to 100): how strongly a Smooth drag smooths the
/// path before it is refitted. The Smooth tool's own (`smoothness`), and for the Pencil,
/// Paintbrush and Blob Brush the one an Alt smoothing drag uses, which the engine sets from
/// Smooth Tool Options (`smoothSmoothness`).
smoothness: f64,
/// Active drag is smoothing with the Pencil, Paintbrush or Blob Brush (Alt held).
smoothing: bool,
/// The pointer has moved from the press point, by any distance (a move too short to add a
@@ -893,6 +901,7 @@ impl GestureTool {
live_preview: true,
live_fit: true,
smooth_fidelity: SMOOTH_FIDELITY,
smoothness: SMOOTH_SMOOTHNESS,
smoothing: false,
moved: false,
marquee: false,
@@ -1556,7 +1565,7 @@ impl GestureTool {
if pts.len() >= 2 && has_selected_smooth_path(cx) {
return vec![Action::Exec(
"path.smoothRegion".into(),
json!({"points": points_json(pts), "radius": radius, "fidelity": cx.tol(self.smooth_fidelity)}),
json!({"points": points_json(pts), "radius": radius, "fidelity": cx.tol(self.smooth_fidelity), "smoothness": self.smoothness}),
)];
}
return vec![];
@@ -1621,7 +1630,7 @@ impl GestureTool {
"smooth" if pts.len() >= 2 && has_selected_smooth_path(cx) => {
vec![Action::Exec(
"path.smoothRegion".into(),
json!({"points": points_json(pts), "radius": radius, "fidelity": cx.tol(self.fidelity)}),
json!({"points": points_json(pts), "radius": radius, "fidelity": cx.tol(self.fidelity), "smoothness": self.smoothness}),
)]
}
"pathEraser" if has_sel => vec![Action::Exec("path.eraseSegments".into(), json!({"points": points_json(pts), "width": cx.tol(8.0)}))],
@@ -2054,7 +2063,7 @@ impl Tool for GestureTool {
"closeWithin": self.close_within
})
}
"smooth" => json!({"fidelity": self.fidelity}),
"smooth" => json!({"fidelity": self.fidelity, "smoothness": self.smoothness}),
"blobBrush" => {
json!({
"fidelity": self.fidelity,
@@ -2107,6 +2116,11 @@ impl Tool for GestureTool {
"smoothFidelity" if matches!(self.id, "pencil" | "paintbrush" | "blobBrush") => {
self.smooth_fidelity = v.as_f64().unwrap_or(self.smooth_fidelity).clamp(super::min_fidelity("smooth"), 100.0)
}
// A value that is not a number from 0 to 100 leaves the Smoothness as it is.
"smoothness" if self.id == "smooth" => self.smoothness = v.as_f64().filter(|n| (0.0..=100.0).contains(n)).unwrap_or(self.smoothness),
"smoothSmoothness" if matches!(self.id, "pencil" | "paintbrush" | "blobBrush") => {
self.smoothness = v.as_f64().filter(|n| (0.0..=100.0).contains(n)).unwrap_or(self.smoothness)
}
"keepSelected" => self.keep_selected = v.as_bool().unwrap_or(self.keep_selected),
"mergeOnlySelection" => self.merge_only_selection = v.as_bool().unwrap_or(self.merge_only_selection),
"editWithin" => self.edit_within = v.as_f64().unwrap_or(self.edit_within).clamp(0.0, 100.0),
@@ -2114,17 +2128,19 @@ impl Tool for GestureTool {
_ => {}
}
}
/// The options the tool shows ([`Self::options`]), and the Smooth tool's Fidelity that the
/// Pencil, Paintbrush and Blob Brush smooth with while Alt is held (`smoothFidelity`).
/// The options the tool shows ([`Self::options`]), and the Smooth tool's Fidelity and Smoothness
/// that the Pencil, Paintbrush and Blob Brush smooth with while Alt is held (`smoothFidelity`,
/// `smoothSmoothness`).
fn check_option(&self, key: &str, v: &Value) -> Result<(), String> {
use crate::option_check as c;
let smooth_store = key == "smoothFidelity" && matches!(self.id, "pencil" | "paintbrush" | "blobBrush");
let smooth_store = matches!(key, "smoothFidelity" | "smoothSmoothness") && matches!(self.id, "pencil" | "paintbrush" | "blobBrush");
if !smooth_store && self.options().get(key).is_none() {
return Err(c::unknown(key));
}
match key {
"fidelity" => c::number(key, v, super::min_fidelity(self.id), 100.0),
"smoothFidelity" => c::number(key, v, super::min_fidelity("smooth"), 100.0),
"smoothness" | "smoothSmoothness" => c::number(key, v, 0.0, 100.0),
"size" => c::number(key, v, 0.1, 1000.0),
"sizeVariation" => c::number(key, v, 0.0, 1000.0),
"angle" => c::number(key, v, -180.0, 180.0),
+48 -1
View File
@@ -651,7 +651,10 @@ fn blob_brush_alt_switches_to_the_smooth_tool() {
let acts = drag_held(&mut t, &cx, &stroke, alt);
assert!(acts[..acts.len() - 1].iter().all(|a| a.is_empty()), "{acts:?}");
let v = smoothed(&acts).unwrap_or_else(|| panic!("{acts:?}"));
assert_eq!(v, json!({"points": [[50.0, 150.0], [150.0, 150.0], [250.0, 160.0]], "radius": cx.tol(12.0), "fidelity": cx.tol(SMOOTH_FIDELITY)}));
assert_eq!(
v,
json!({"points": [[50.0, 150.0], [150.0, 150.0], [250.0, 160.0]], "radius": cx.tol(12.0), "fidelity": cx.tol(SMOOTH_FIDELITY), "smoothness": SMOOTH_SMOOTHNESS})
);
// Mid-drag the cursor stays the Smooth tool's when Alt is let go, and the line is thin with
// no length label.
t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 50.0, 150.0).with_mods(alt));
@@ -1674,6 +1677,50 @@ fn alt_smoothing_uses_the_smooth_tools_fidelity() {
}
}
/// The Smooth tool sends Smooth Tool Options' Smoothness (50% until it is set) with each drag, and
/// an Alt smoothing drag with the Pencil, Paintbrush or Blob Brush sends the one the engine gives it
/// (`smoothSmoothness`). A value that is not a number from 0 to 100 is refused and sets nothing.
#[test]
fn smooth_drags_send_the_smoothness() {
let (d, id) = doc_with_rect();
let mut s = Selection::default();
s.set([id]);
let p = paint();
let mut cx = cx(&d, &s, &p);
cx.smart_guides = false;
let pts = [(50.0, 150.0), (150.0, 150.0), (250.0, 160.0)];
let smoothness = |acts: &[Vec<Action>]| match acts.last().and_then(|a| a.first()) {
Some(Action::Exec(c, v)) if c == "path.smoothRegion" => v["smoothness"].as_f64(),
a => panic!("expected path.smoothRegion, got: {a:?}"),
};
let mut t = GestureTool::new("smooth");
assert_eq!(t.options()["smoothness"], json!(50.0));
assert_eq!(smoothness(&drag(&mut t, &cx, &pts, Mods::default())), Some(50.0));
for bad in [json!(-1), json!(100.5), json!("30"), json!(true)] {
assert_eq!(t.check_option("smoothness", &bad), Err("`smoothness` must be a number from 0 to 100".into()), "{bad}");
t.set_option("smoothness", &bad);
assert_eq!(t.options()["smoothness"], json!(50.0), "{bad}");
}
for ok in [0.0, 75.0, 100.0] {
assert_eq!(t.check_option("smoothness", &json!(ok)), Ok(()));
t.set_option("smoothness", &json!(ok));
assert_eq!(smoothness(&drag(&mut t, &cx, &pts, Mods::default())), Some(ok));
}
let alt = Mods { alt: true, ..Default::default() };
for (id, alt_smooth) in [("pencil", true), ("blobBrush", false), ("paintbrush", false)] {
let mut t = GestureTool::new(id);
t.set_option("altSmooth", &json!(alt_smooth));
assert_eq!(smoothness(&drag_held(&mut t, &cx, &pts, alt)), Some(50.0), "{id}");
assert_eq!(t.check_option("smoothSmoothness", &json!(101)), Err("`smoothSmoothness` must be a number from 0 to 100".into()), "{id}");
t.set_option("smoothSmoothness", &json!(101));
t.set_option("smoothness", &json!(20.0));
assert_eq!(smoothness(&drag_held(&mut t, &cx, &pts, alt)), Some(50.0), "{id}: only smoothSmoothness sets it");
t.set_option("smoothSmoothness", &json!(20.0));
assert_eq!(smoothness(&drag_held(&mut t, &cx, &pts, alt)), Some(20.0), "{id}");
assert!(t.options().get("smoothness").is_none() && t.options().get("smoothSmoothness").is_none(), "{id}");
}
}
/// The Smooth tool's Fidelity is in screen pixels: the Smooth tool and an Alt smoothing drag with
/// the Pencil, Paintbrush or Blob Brush send it in points at Fidelity / zoom, so a drag smooths as
/// much on screen at any zoom.
+1 -1
View File
@@ -63,7 +63,7 @@ const ROWS: &[Row] = &[
// Pencil Tool Options' Alt key toggles to Smooth Tool, Live preview and Live curve fitting (the
// Paintbrush has none of them).
(&["pencil"], None, &["altSmooth", "livePreview", "liveFit"]),
(&["smooth"], None, &["fidelity"]),
(&["smooth"], None, &["fidelity", "smoothness"]),
(&["blobBrush", "eraser"], None, &["size", "sizeMode", "sizeVariation"]),
(&["blobBrush"], None, &["fidelity", "keepSelected", "mergeOnlySelection"]),
// Eraser Tool Options' tip shape.
+29 -2
View File
@@ -4,7 +4,7 @@
//! (Live curve fitting, on: its preview fits the stroke while it is drawn).
//!
//! Fields: `tool`; `fidelity` (screen pixels for the Pencil, Paintbrush and Smooth, points for the
//! Blob Brush), `fill` (Pencil and
//! Blob Brush), `smoothness` (percent, 0 to 100; Smooth), `fill` (Pencil and
//! Paintbrush), `keepSelected` (Pencil, Paintbrush and Blob Brush), `mergeOnlySelection` (Blob
//! Brush), `closeWithin` and `editWithin` (screen pixels, 0 turns it off; Pencil and Paintbrush),
//! `angle` (degrees) and `roundness` (percent; Blob Brush and Eraser), `livePreview` (Pencil: the stroke shows
@@ -35,8 +35,9 @@ pub(super) const SPEC: DialogSpec = DialogSpec { heading, body, confirm, min_wid
pub const TOOLS: [&str; 5] = ["pencil", "paintbrush", "smooth", "blobBrush", "eraser"];
/// The options the dialog edits, in the order it shows them (a tool has those it reports).
const KEYS: [&str; 18] = [
const KEYS: [&str; 19] = [
"fidelity",
"smoothness",
"angle",
"angleMode",
"angleVariation",
@@ -259,11 +260,37 @@ fn fidelity(ui: &mut egui::Ui, d: &mut Dialog) {
});
}
/// The Smooth tool's Smoothness rows: the label on a line of its own, then a slider from 0% to 100%
/// across the row with the field at its end, both in whole percent.
fn smoothness(ui: &mut egui::Ui, d: &mut Dialog) {
let t = Tokens::get(ui.ctx());
let v = d.f64("smoothness", 50.0);
let rail_w = label_w(ui);
let mut new = None;
ui.label(egui::RichText::new(tl!("Smoothness:")).size(12.5).color(t.text));
ui.horizontal(|ui| {
let (shown, at) = (widgets::SliderValue::field(v, 0.0..=100.0, "%", 0), (v / 100.0) as f32);
let (x, _, keyed) =
widgets::color_slider_stepped(ui, "freehand-smoothness", tl!("Smoothness:"), Some(shown), at, rail_w, &|_| t.input_border);
new = x.map(|x| (f64::from(x.clamp(0.0, 1.0)) * 100.0).round()).or(keyed);
if let Some(x) = widgets::range_field(ui, "freehand-smoothness-field", v, 0.0..=100.0, "%", 0, FIELD_W) {
new = Some(x);
}
});
if let Some(n) = new.filter(|n| *n != v) {
d.fields.insert("smoothness".into(), json!(n));
}
}
fn body(_app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
if d.fields.contains_key("fidelity") {
fidelity(ui, d);
ui.add_space(10.0);
}
if d.fields.contains_key("smoothness") {
smoothness(ui, d);
ui.add_space(10.0);
}
let eraser = d.fields.contains_key("angleMode");
if eraser {
// The Eraser: Angle, Roundness and Size each with every variation mode.
+30 -2
View File
@@ -46,6 +46,34 @@ fn a_refused_fidelity_keeps_the_dialog_open() {
assert_eq!(app.session.tool_options_of("smooth")["fidelity"], json!(5.0));
}
/// Smooth Tool Options shows Smoothness under Fidelity, at 50% until it is set, and OK sets it; a
/// Smoothness the tool refuses keeps the dialog open with nothing set. The other freehand tools have
/// no Smoothness.
#[test]
fn smooth_tool_options_set_the_smoothness() {
let mut app = app();
app.run("tool.options", json!({"tool": "smooth"})).unwrap();
let text = painted(&mut app);
assert!(text.contains("Smoothness:") && text.contains("50%"), "{text}");
assert!(text.find("Fidelity:") < text.find("Smoothness:"), "{text}");
app.ui.dialog.as_mut().unwrap().fields.insert("smoothness".into(), json!(120));
let e = super::super::confirm(&mut app).unwrap_err();
assert_eq!(e, "tool `smooth`: `smoothness` must be a number from 0 to 100");
assert!(app.ui.dialog.is_some(), "the dialog stays open");
assert_eq!(app.session.tool_options_of("smooth")["smoothness"], json!(50.0));
app.ui.dialog.as_mut().unwrap().fields.insert("smoothness".into(), json!(30));
super::super::confirm(&mut app).unwrap();
assert!(app.ui.dialog.is_none());
assert_eq!(app.session.tool_options_of("smooth")["smoothness"], json!(30.0));
app.run("tool.options", json!({"tool": "smooth"})).unwrap();
assert!(painted(&mut app).contains("30%"));
for tool in ["pencil", "paintbrush", "blobBrush", "eraser"] {
app.run("tool.options", json!({"tool": tool})).unwrap();
let text = painted(&mut app);
assert!(!text.contains("Smoothness:"), "{tool}: {text}");
}
}
#[test]
fn the_tip_preview_is_as_flat_as_the_tip_the_brush_draws() {
for roundness in [-5.0, 0.0, 0.05, 0.1, 1.0, 50.0, 100.0, 120.0] {
@@ -186,8 +214,8 @@ fn each_tool_shows_its_options_and_ok_sets_them() {
let pb_text = painted(&mut app);
assert!(pb_text.contains("Paintbrush Tool Options"));
assert!(!pb_text.contains("Alt key toggles to Smooth Tool") && !pb_text.contains("Live preview"), "{pb_text}");
// Smooth has Fidelity only, the Eraser Size only, and the Blob Brush Fidelity, Size, Keep selected and Merge only
// with selection.
// Smooth has Fidelity and Smoothness only, the Eraser Size only, and the Blob Brush Fidelity, Size, Keep selected
// and Merge only with selection.
app.run("tool.options", json!({"tool": "smooth"})).unwrap();
let text = painted(&mut app);
assert!(text.contains("Smooth Tool Options") && text.contains("Fidelity:"), "{text}");
+1
View File
@@ -1277,6 +1277,7 @@ font-technology Variable Променливи
Feet & Inches Футове и инчове
Fewer <tspan> Elements По-малко <tspan> елемента
Fidelity: Точност:
Smoothness: Гладкост:
Figure Space Цифрово разстояние
Figure: Фигура:
# Artwork drag between document tabs.
Can't render this file because it is too large.
+1
View File
@@ -2812,6 +2812,7 @@ digits Malayalam Malajalam
Close paths when ends are within: Zatvori putanje kad su krajevi unutar:
Edit selected paths within: Uređuj odabrane putanje unutar:
Fidelity: Vjernost:
Smoothness: Glatkoća:
Fill new strokes Ispunjavaj nove poteze
Alt key toggles to Smooth Tool Tipka Alt prebacuje na alat za zaglađivanje
Live curve fitting Uklapanje krivulje uživo
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -1812,6 +1812,7 @@ digits Malayalam Malaiàlam
Feet & Inches Peus i polzades
Fewer <tspan> Elements Menys elements <tspan>
Fidelity: Fidelitat:
Smoothness: Suavitat:
Figure Space Espai de xifra
Figure: Xifra:
File Fitxer
Can't render this file because it is too large.
+1
View File
@@ -2895,6 +2895,7 @@ digits Malayalam Malajálamské
Close paths when ends are within: Uzavřít cesty, když jsou konce do:
Edit selected paths within: Upravovat vybrané cesty do:
Fidelity: Věrnost:
Smoothness: Vyhlazení:
Fill new strokes Vyplňovat nové tahy
Alt key toggles to Smooth Tool Klávesa Alt přepíná na nástroj Vyhlazení
Live curve fitting Průběžné prokládání křivky
Can't render this file because it is too large.
+1
View File
@@ -5435,6 +5435,7 @@ digits Malayalam Malayalam
Close paths when ends are within: Luk stier, når enderne er inden for:
Edit selected paths within: Redigér markerede stier inden for:
Fidelity: Præcision:
Smoothness: Glatthed:
Fill new strokes Udfyld nye konturer
Alt key toggles to Smooth Tool Alt-tasten skifter til Udglatningsværktøj
Live curve fitting Kurvetilpasning undervejs
Can't render this file because it is too large.
+1
View File
@@ -1308,6 +1308,7 @@ font-technology Variable Variabel
Feet & Inches Fuß und Zoll
Fewer <tspan> Elements Weniger <tspan>-Elemente
Fidelity: Genauigkeit:
Smoothness: Glättung:
Figure Space Ziffernleerzeichen
Figure: Ziffern:
# Artwork drag between document tabs.
Can't render this file because it is too large.
+1
View File
@@ -1264,6 +1264,7 @@ font-technology Variable Μεταβλητές
Feet & Inches Πόδια και ίντσες
Fewer <tspan> Elements Λιγότερα στοιχεία <tspan>
Fidelity: Πιστότητα:
Smoothness: Ομαλότητα:
Figure Space Κενό ψηφίου
Figure: Σχήμα:
# Artwork drag between document tabs.
Can't render this file because it is too large.
+1
View File
@@ -1332,6 +1332,7 @@ font-technology Variable Variables
Feet & Inches Pies y pulgadas
Fewer <tspan> Elements Menos elementos <tspan>
Fidelity: Fidelidad:
Smoothness: Suavizado:
Figure Space Espacio de cifra
Figure: Cifras:
# Artwork drag between document tabs.
Can't render this file because it is too large.
+1
View File
@@ -2848,6 +2848,7 @@ digits Malayalam Malajalam
Close paths when ends are within: Sulje polut, kun päät ovat etäisyydellä:
Edit selected paths within: Muokkaa valittuja polkuja etäisyydellä:
Fidelity: Tarkkuus:
Smoothness: Pehmeys:
Fill new strokes Täytä uudet viivat
Alt key toggles to Smooth Tool Alt-näppäin vaihtaa Tasoitustyökaluun
Live curve fitting Käyrän sovitus piirrettäessä
Can't render this file because it is too large.
+1
View File
@@ -1323,6 +1323,7 @@ font-technology Variable Variables
Feet & Inches Pieds et pouces
Fewer <tspan> Elements Moins d’éléments <tspan>
Fidelity: Fidélité :
Smoothness: Lissage :
Figure Space Espace numérique
Figure: Chiffres :
# Artwork drag between document tabs.
Can't render this file because it is too large.
+1
View File
@@ -1449,6 +1449,7 @@
Feet & Inches ફૂટ અને ઇંચ
Fewer <tspan> Elements ઓછા <tspan> ઘટકો
Fidelity: ફિડેલિટી:
Smoothness: સરળતા:
Figure Space ફિગર સ્પેસ
Figure: ફિગર:
File ફાઇલ
Can't render this file because it contains an unexpected character in line 72 and column 5.
+1
View File
@@ -2257,6 +2257,7 @@ arrowhead Feather पंख
Feet & Inches पैर & इंच
Fewer <tspan> Elements कम <tspan> एलिमेंट
Fidelity: सटीकता:
Smoothness: चिकनापन:
Figure Space अंक-स्पेस
Figure: आकृति:
File फ़ाइल
Can't render this file because it is too large.
+1
View File
@@ -1662,6 +1662,7 @@ digits Malayalam Malajálam
Feet & Inches Láb és hüvelyk
Fewer <tspan> Elements Kevesebb <tspan> elem
Fidelity: Pontosság:
Smoothness: Simaság:
Figure Space Számjegyszóköz
Figure: Számjegyek:
# Artwork drag between document tabs.
Can't render this file because it is too large.
+1
View File
@@ -3307,6 +3307,7 @@ digits Malayalam Malayalam
Close paths when ends are within: Tutup jalur bila ujungnya berada dalam jarak:
Edit selected paths within: Edit jalur terpilih dalam jarak:
Fidelity: Fidelitas:
Smoothness: Kehalusan:
Fill new strokes Isi stroke baru
Alt key toggles to Smooth Tool Tombol Alt beralih ke Alat penghalus
Live curve fitting Penyesuaian kurva langsung
Can't render this file because it is too large.
+1
View File
@@ -1345,6 +1345,7 @@ font-technology Variable Variabili
Feet & Inches Piedi e pollici
Fewer <tspan> Elements Meno elementi <tspan>
Fidelity: Fedeltà:
Smoothness: Uniformità:
Figure Space Spazio cifra
Figure: Cifre:
# Artwork drag between document tabs.
Can't render this file because it is too large.
+1
View File
@@ -1974,6 +1974,7 @@ antiAlias Sharp シャープ
Feet & Inches フィート・インチ
Fewer <tspan> Elements <tspan>要素を減らす
Fidelity: 精度:
Smoothness: 滑らかさ:
Figure: 数字:
File Format: ファイル形式:
File Formats ファイル形式
Can't render this file because it is too large.
+1
View File
@@ -4797,6 +4797,7 @@ digits Malayalam მალაიალამური
Close paths when ends are within: ტრაექტორიების შეკვრა, როცა ბოლოები ახლოსაა:
Edit selected paths within: მონიშნული ტრაექტორიების რედაქტირება მანძილზე:
Fidelity: სიზუსტე:
Smoothness: სიგლუვე:
Fill new strokes ახალი შემოხაზვების შევსება
The document has no colour swatches. დოკუმენტს ფერის ნიმუშები არ აქვს.
Style Name: სტილის სახელი:
Can't render this file because it is too large.
+1
View File
@@ -1964,6 +1964,7 @@ antiAlias Sharp 날카롭게
Feet & Inches 피트 및 인치
Fewer <tspan> Elements <tspan> 요소 줄이기
Fidelity: 정확도:
Smoothness: 부드러움:
Figure: 그림:
File Format: 파일 형식:
File Formats 파일 형식
Can't render this file because it is too large.
+1
View File
@@ -3301,6 +3301,7 @@ digits Malayalam Malayalam
Close paths when ends are within: Paden sluiten wanneer de einden binnen:
Edit selected paths within: Geselecteerde paden bewerken binnen:
Fidelity: Nauwkeurigheid:
Smoothness: Gladheid:
Fill new strokes Nieuwe lijnen vullen
Alt key toggles to Smooth Tool Alt-toets schakelt over naar Gladmaken-gereedschap
Live curve fitting Curve aanpassen tijdens het tekenen
Can't render this file because it is too large.
+1
View File
@@ -2810,6 +2810,7 @@ digits Malayalam Malajalam
Close paths when ends are within: Zamykaj ścieżki, gdy końce są w odległości:
Edit selected paths within: Edytuj zaznaczone ścieżki w odległości:
Fidelity: Wierność:
Smoothness: Gładkość:
Fill new strokes Wypełniaj nowe pociągnięcia
Alt key toggles to Smooth Tool Klawisz Alt przełącza na narzędzie Wygładzanie
Live curve fitting Dopasowywanie krzywej podczas rysowania
Can't render this file because it is too large.
+1
View File
@@ -1218,6 +1218,7 @@ antiAlias Sharp Nítido
Feet & Inches Pés e Polegadas
Fewer <tspan> Elements Menos Elementos <tspan>
Fidelity: Fidelidade:
Smoothness: Suavização:
Figure Space Espaço de Figura
Figure: Figura:
# Artwork drag between document tabs.
Can't render this file because it is too large.
+1
View File
@@ -1330,6 +1330,7 @@ font-technology Variable Вариативные
Feet & Inches Футы и дюймы
Fewer <tspan> Elements Меньше элементов <tspan>
Fidelity: Точность:
Smoothness: Сглаживание:
Figure Space Цифровая шпация
Figure: Цифры:
# Artwork drag between document tabs.
Can't render this file because it is too large.
+1
View File
@@ -1298,6 +1298,7 @@ font-technology Variable Variabla
Feet & Inches Fot och tum
Fewer <tspan> Elements Färre <tspan>-element
Fidelity: Återgivning:
Smoothness: Mjukhet:
Figure Space Siffermellanrum
Figure: Figur:
# Artwork drag between document tabs.
Can't render this file because it is too large.
+1
View File
@@ -1298,6 +1298,7 @@ font-technology Variable Değişken
Feet & Inches Fit ve İnç
Fewer <tspan> Elements Daha az <tspan> Öğesi
Fidelity: Sadakat:
Smoothness: Pürüzsüzlük:
Figure Space Şekil Alanı
Figure: Şekil:
File Dosya
Can't render this file because it is too large.
+1
View File
@@ -1339,6 +1339,7 @@ font-technology Variable Варіативні
Feet & Inches Фути та дюйми
Fewer <tspan> Elements Менше елементів <tspan>
Fidelity: Точність:
Smoothness: Згладжування:
Figure Space Цифрова шпація
Figure: Цифри:
# Artwork drag between document tabs.
Can't render this file because it is too large.
+1
View File
@@ -1547,6 +1547,7 @@ digits Malayalam Malayalam
Feet & Inches Feet và Inch
Fewer <tspan> Elements Ít phần tử <tspan> hơn
Fidelity: Độ trung thực:
Smoothness: Độ mịn:
Figure Space Khoảng trắng chữ số
Figure: Chữ số:
# Artwork drag between document tabs.
Can't render this file because it is too large.
+1
View File
@@ -1274,6 +1274,7 @@ antiAlias Sharp 锐利
Feet & Inches 英尺和英寸
Fewer <tspan> Elements 更少的 <tspan> 元素
Fidelity: 精确度:
Smoothness: 平滑度:
Figure Space 数字空格
Figure: 数字:
# Artwork drag between document tabs.
Can't render this file because it is too large.
+1
View File
@@ -1309,6 +1309,7 @@ font-technology Variable 可變
Feet & Inches 英呎與英吋
Fewer <tspan> Elements 減少 <tspan> 元素
Fidelity: 精確度:
Smoothness: 平滑度:
Figure Space 數字空格
Figure: 數字:
# Artwork drag between document tabs.
Can't render this file because it is too large.
+12 -3
View File
@@ -7042,7 +7042,7 @@ in `path.convertAnchor`; `t` in `path.insertAnchor`; `fidelity` and the `within`
`brush.freehand`, which runs it); `size`, `sizeVariation`, `angle`, `angleVariation`, `roundness` and
`roundnessVariation` in `path.eraseRegion`;
`size`, `sizeVariation`, `angle`, `roundness` and `fidelity` in `path.blob`; `width` in `path.eraseSegments`;
`radius` and `fidelity` in `path.smoothRegion`; `tolerance` in `path.joinScrub`; `dx` and `dy` in `path.moveAnchors`;
`radius`, `fidelity` and `smoothness` in `path.smoothRegion`; `tolerance` in `path.joinScrub`; `dx` and `dy` in `path.moveAnchors`;
and `dx`, `dy`, `tol` and `radius` in `path.reshape`. A null is read as a key left out. `path.convertAnchor` refuses
an `x` without a `y`, or a `y` without an `x`, with "x and y must be given together". `path.freehand`,
`path.curvature`, `path.knife`, `path.eraseRegion`, `path.eraseSegments`, `path.smoothRegion`, `path.joinScrub` and
@@ -7171,6 +7171,14 @@ own, and the corner keeps its place and the directions the path arrives and leav
`fidelity`. A call that changes no anchor returns `{ids: [], before: 0, after: 0}` and adds no undo step. The 57.5°
threshold is VectorCraft's own value.
`path.smoothRegion`'s `smoothness` (0 to 100, 50 when left out) sets how strongly the path is smoothed before it is
refitted within `fidelity`: each point is averaged with the stretch of path around it, over a stretch that grows in
proportion to `smoothness`, so a higher value leaves a smoother path. At 0 the path is only refitted within
`fidelity`, and 100 averages over twice the stretch that 50 does. A `smoothness` outside 0 to 100 is refused with
"`smoothness` must be from 0 to 100" and changes nothing. The default and the way the percentage scales the smoothing
are VectorCraft's own. The Smooth tool sends its Smooth Tool Options' Smoothness (`tool.setOption {tool: "smooth",
key: "smoothness"}`, 0 to 100, 50 by default) with each drag.
In the desktop app, Object › Path › Smooth, the canvas context menu's Smooth… (listed while the selection holds a
path) and the Contextual Task Bar's Smooth (with a path selected whole with the Direct Selection tool) open the
slider (`ui.menuDialog {command: "object.path.smooth"}`, dialog `smoothSlider` with field `level`) at the
@@ -13481,8 +13489,9 @@ The second call returns the error ``tool `smooth`: `fidelity` must be a number f
The Pencil's, the Paintbrush's and the Smooth tool's `fidelity` is in screen pixels: the tools send `path.freehand` and
`path.smoothRegion` the option divided by the zoom, so a stroke keeps as many points and a Smooth drag smooths as much
at any zoom. The Smooth tool's `fidelity` (0.05 to 100 px, 2.5 by default) is also the one an Alt smoothing drag with
the Pencil, Paintbrush or Blob Brush uses. The Blob Brush's `fidelity` is in points.
at any zoom. The Smooth tool's `fidelity` (0.05 to 100 px, 2.5 by default) and `smoothness` (0 to 100, 50 by default)
are also the ones an Alt smoothing drag with the Pencil, Paintbrush or Blob Brush uses. The Blob Brush's `fidelity` is
in points.
`tool.options {tool}` opens what double-clicking the tool's button opens (its params doc lists every tool), in the
desktop app. The Flare tool's are its Flare Tool Options (dialog `flareOptions`): `diameter` and `pathLength` (pt),
+1
View File
@@ -1432,6 +1432,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
Curvature point markers are circular, with no direction handles. While drawing, its own point feedback replaces generic selection markers; existing paths use the selection overlay, including partial selections and Hide Edges. Anchor Size applies, and Direct Selection and Pen retain their handles. The real egui-frame regressions in `crates/ui-egui/src/canvas.rs` verify marker positions, counts and unchanged documents (#1236, in part); the existing-path interpolation request remains open. The curve through the points (`curvature_spline` in `crates/tools/src/draw2.rs`) makes each stretch of three points follow the circle through them: a smooth point's handles lie along that circle's tangent, each `chord / (3 cos²(α/2))` long (α between handle and chord, capped at 90°), and the ends of an open path mirror their neighbour's tangent in their chord, so a J or a U curves evenly, a turn tighter than 30° comes to a point, and uneven spacing doesn't loop; the rubber band, a dragged or inserted point and `path.convertAnchor` to smooth use the same rule, while the Pencil's fitting keeps its own; `tests/draw2.rs` checks that the rubber band is the path the click makes (#1236, in part). The Smooth tool smooths only the stretch of path under the drag (#1547, fixes #1512). A path the Smooth tool changes stays selected whole, and the anchor points and segments selected on it with Direct Selection are deselected. Selected paths the drag does not change keep their selected anchors, and undo restores the earlier selection (`tests/draw2.rs`, `smoothing_a_path_drops_its_direct_selected_anchors`). While the Smooth tool drags with a path selected that it can smooth, a dashed outline shows the band it smooths: everything within its radius of the drag (12 screen pixels, VectorCraft's own value), round at both ends; Alt smoothing with the Pencil, Paintbrush and Blob Brush shows the same band.
While Alt is held during a Paintbrush stroke or before a press with no path selected that the Smooth tool can act on, the Paintbrush shows a closing cursor (a crosshair with a ring), and so does the Pencil with Alt key toggles to Smooth Tool off when Alt is pressed after the drag starts; releasing the mouse button with Alt still held closes the path. Before a Paintbrush press with such a path selected, Alt shows the Smooth cursor, and holding Alt at the press smooths that path with the Smooth tool's radius and Smooth Tool Options' Fidelity. A Pencil drag started with Shift or Alt held draws a straight line instead, which stays open.
Smooth Tool Options' Fidelity is in pixels, as [the help page](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=79) gives it: the Smooth tool, and an Alt smoothing drag with the Pencil, Paintbrush or Blob Brush, refits the path at Fidelity divided by the zoom, so a drag smooths a path as much on screen at 25 % as at 800 %. Reading the pixels as screen pixels is VectorCraft's own rule, as for the Pencil and the Paintbrush (#5729); the range (0.05 to 100 px) and the default (2.5 px) are VectorCraft's own values, and a saved Fidelity keeps its number (`crates/tools/src/draw2/gesture/tests.rs` test `smooth_fidelity_is_in_screen_pixels_at_any_zoom`, `crates/engine/src/tests/draw2.rs` test `smooth_region_refits_at_the_tolerance_sent_at_any_zoom`).
Smooth Tool Options has Smoothness under Fidelity, from 0% to 100%, where a higher value gives a smoother path, as [the help page](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=164) describes the setting: the Smooth tool, and an Alt smoothing drag with the Pencil, Paintbrush or Blob Brush, sends it as `path.smoothRegion`'s `smoothness`, and a Smoothness outside 0 to 100 is an error in `tool.setOption` and `path.smoothRegion`. The default (50%) and the way the percentage scales the smoothing (none before the refit at 0%, twice the default's stretch at 100%) are VectorCraft's own (`crates/engine/src/tests/draw2.rs` test `a_higher_smoothness_leaves_a_smoother_path`, `crates/engine/src/tests/toolsettings.rs` test `the_smooth_tools_smoothness_is_kept_and_alt_smoothing_takes_it`).
With Shift held at the press, the Pencil draws a straight line from the press point to the pointer at 45° steps from the Constrain Angle, as [Draw straight lines with the Pencil tool](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-straight-lines-with-the-pencil-tool.html) describes; pressed on an end of a selected open path, the line continues the path from that end (part of #3799). With Option/Alt held at the press and Alt key toggles to Smooth Tool off, the Pencil draws a straight line at any angle, and it stays open when Alt is still held at the release; Shift and Alt together keep the 45° steps (#3799). While Shift or Alt is held before the press, the Pencil shows a straight-line cursor (a crosshair with a short level line), as the page describes. Over an end of a selected open path, where the stroke continues the path, freehand or as a straight line, it shows a path-continuation cursor (a crosshair with a short line rising to the right), as [Extend paths with the Pencil tool](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/extend-paths-with-the-pencil-tool.html) describes, and again while a continuing stroke ends near an open end of another selected path, where the release connects the two ([Connect two paths with the Pencil tool](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/connect-two-paths-with-the-pencil-tool.html)). A continuing stroke, a straight line too, that ends within Close Paths When Ends Are Within of the path's other end shows the closing cursor, and the release closes the path; Alt held at the release closes a continuing freehand stroke too (a straight line stays open, as above).
- **Shapes:** all shape tools (including Flare) and the line, arc, spiral and grid tools. Space held while dragging out a shape, line, arc, spiral or grid moves it at its current size. While a grid is dragged out, Up/Down change its rows (concentric dividers) and Left/Right its columns (radial dividers). A click with a grid tool asks for the size, the divider counts and the grid options (#1377, in part): a skew for each set of dividers, Use Outside Rectangle As Frame or Create Compound Path From Ellipses, and Fill Grid; they are parameters of `shape.rectangularGrid` and `shape.polarGrid`, stay as the tool's options and apply to drags too. A shape just drawn stays adjustable with its tool: its Live Shape widgets drag, a press on its centre point (Show Center) moves the selection with the Selection tool's move arrow, snapping and Alt copy, and a press in the rotate zone just outside a bounding-box corner turns it about the centre with the Selection tool's rotate cursor (#5477; tests `a_shape_tool_moves_the_selection_by_its_centre_point_and_turns_it_from_a_corner` and, through the engine, `shapetools.rs`). A drag on one of its eight bounding-box handles scales it as the Selection tool's handles do, with their cursors and snapping, instead of drawing a new shape from the handle. A shape tool takes a press as a handle's only on the drawn handle square (VectorCraft's own rule: 3 screen points from its centre along each axis at the default Anchor Size, a half point more or less per step; the Selection tool takes 5), so a press just beside a handle still draws (tests `a_shape_tool_scales_the_selection_by_its_bounding_box_handles`, `a_shape_tool_draws_from_a_press_just_beside_a_handle` and `a_shape_tool_scales_the_shape_just_drawn_by_its_bounding_box_handle`). With such a tool, a double-click on a corner widget of a selected live rectangle or polygon shows and selects the Transform panel, and the tool, the selection and the document stay as they were (test `a_double_click_on_a_corner_widget_shows_the_transform_panel`). The curve a skew percentage follows and the direction of the radial skew are our own (the public documentation gives neither), and the dialogs have no reference point locator. An ellipse's Pie Start and End Angle and Invert Pie (Transform and Properties panels' Ellipse Properties, `object.setLiveShape {pieStart, pieEnd, invertPie}`) cut it as a pie (#812). With the bounding box showing, the Selection tool shows a selected ellipse's two pie widgets just outside it; dragging one sets its angle in one undo step and double-clicking one makes the ellipse whole again. A live polygon's Polygon Properties there: side count, angle, corner type and radius, radius, side length and Make Sides Equal once an uneven scale has made its sides differ (`object.setLiveShape {sides, polygonAngle, polygonRadius, sideLength, makeSidesEqual}`, part of #812); a star is a plain path, as in Illustrator. The Flare Tool Options last as the tool's options: the next flare dragged out uses them, a click's dialog shows them and double-clicking the tool opens them (part of #812).
- **Shapes:** all shape tools (including Flare) and the line, arc, spiral and grid tools. Space held while dragging out a shape, line, arc, spiral or grid moves it at its current size. The Flare tool's center drag turns the rays by 0.1 radian at each drag update in which the pointer's document y grows, and back by as much at each one in which it falls, Shift held keeps their turn, and Space held during either of its drags moves the flare. While a grid is dragged out, Up/Down change its rows (concentric dividers) and Left/Right its columns (radial dividers). A click with a grid tool asks for the size, the divider counts and the grid options (#1377, in part): a skew for each set of dividers, Use Outside Rectangle As Frame or Create Compound Path From Ellipses, and Fill Grid; they are parameters of `shape.rectangularGrid` and `shape.polarGrid`, stay as the tool's options and apply to drags too. The curve a skew percentage follows and the direction of the radial skew are our own (the public documentation gives neither), and the dialogs have no reference point locator. An ellipse's Pie Start and End Angle and Invert Pie (Transform and Properties panels' Ellipse Properties, `object.setLiveShape {pieStart, pieEnd, invertPie}`) cut it as a pie (#812). With the bounding box showing, the Selection tool shows a selected ellipse's two pie widgets just outside it; dragging one sets its angle in one undo step and double-clicking one makes the ellipse whole again. A live polygon's Polygon Properties there: side count, angle, corner type and radius, radius, side length and Make Sides Equal once an uneven scale has made its sides differ (`object.setLiveShape {sides, polygonAngle, polygonRadius, sideLength, makeSidesEqual}`, part of #812); a star is a plain path, as in Illustrator. The Flare Tool Options last as the tool's options: the next flare dragged out uses them, a click's dialog shows them and double-clicking the tool opens them (part of #812).