Merge pull request #8724 from storytold/train/carry8455

Tools: a Three-Point Arc tool draws an arc between two ends and a third point (#8455)
This commit is contained in:
BFlat authored and GitHub committed 2026-11-19 22:22:16 +07:00
commit 4170a620a2
49 files changed
+1629 -2

No files matched your search

+1
View File
@@ -115,6 +115,7 @@ Generated-in-code art is original and has no file to list. This covers the defau
| `assets/icons/dc-anchor-smooth.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/icons/dc-appearance.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/icons/dc-arc.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/icons/dc-arc-three-point.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | The Three-Point Arc tool: an arc through its two ends and a third point |
| `assets/icons/dc-arrow-down.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/icons/dc-arrow-extend.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/icons/dc-arrow-fill.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | The Selection and Direct Selection arrows' fill, painted black or white under their outline |
+1
View File
@@ -162,6 +162,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap
- 2026-11-17: Tangent Circle Tool joins the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools, and the All Tools drawer): click a path segment, then another, to draw the circle tangent to the first where it was clicked that touches the second; Shift uses the tool's radius and a drag from the second segment sets the radius (Shift in round steps, Cmd/Ctrl slowly), the circle then touching the first segment anywhere along it. The circle shows with its center and radii before the click, one undo step (`tangentCircle`). A VectorCraft addition: headline numbers unchanged.
- 2026-11-18: Common Tangents also takes a point (a path of one anchor) and a convex closed path: the lines from the point that touch the path, and the line from the point to the path's center if asked; a point on the outline gets the one tangent there, and a point inside gets none, with a message (#7846). A VectorCraft addition: headline numbers unchanged.
- 2026-11-15: With Smart Guides and Snap to Tangent on, a Line Segment drag pressed on one convex curved path and dragged near another lands on a common tangent of the two: both ends move to where the line touches the paths, each labeled "tangent" (#7845). A VectorCraft addition: headline numbers unchanged.
- 2026-11-17: Three-Point Arc tool, in the Line Segment tool's group after the Arc tool: two ends placed by a drag or two clicks, then a third point the open circular arc passes through, or with Third Point Sets Direction (Tool Options, or `]` while drawing) the direction the arc leaves an end in; it previews the arc, its center and, with Measurement Labels on, its radius, and draws it in one undo step (`shape.threePointArc`). Points with no arc are refused with a message. A VectorCraft addition: headline numbers unchanged.
- 2026-11-15: Smooth Bridge joins the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): two selected circles become one closed outline joined by two concave arcs that touch both circles, so every anchor is smooth; the arcs' radius is a percentage of the smaller circle's radius (1 to 1000%, 100% by default), and Keep Originals adds the outline above the circles instead of replacing them. A dialog with Preview, one undo step (`addon.pathtools.bridge`). A VectorCraft addition: headline numbers unchanged.
- 2026-11-18: Smooth Bridge also joins three or more circles: every two whose outlines are within Reach (10 pt by default) are joined, the bridges that connect become one shape each, and a circle bridged to no other stays as it is (at most 2000 circles); with Constant Gap the arcs' radius is the smaller circle's radius plus a gap (#8030). A VectorCraft addition: headline numbers unchanged.
- 2026-11-03: Text Tweaker, the first tool of the Type Tools add-on (Object › Plug-ins › Type Tools): one character attribute (size, baseline shift, rotation, horizontal or vertical scale, tracking, leading or stroke weight) goes letter by letter from a start value to an end value along a straight ramp, an ease, a bow, a spike or at random with a seed, set as the Character panel sets it, while the text stays live; a dialog with Preview, one undo step (`addon.type.textTweaker`, #4924). A VectorCraft addition: headline numbers unchanged.
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4 18 A8.67 8.67 0 1 1 20 18"/><circle cx="4" cy="18" r="1.6"/><circle cx="12" cy="6" r="1.6"/><circle cx="20" cy="18" r="1.6"/></svg>

After

Width:  |  Height:  |  Size: 327 B

+53
View File
@@ -105,6 +105,15 @@ pub fn specs() -> Vec<CommandSpec> {
has_doc,
arc
),
cmd!(
"shape.threePointArc",
"Three-Point Arc",
[],
None,
"{start: [x, y], end: [x, y], through?: [x, y], toward?: [x, y], at?: \"start\"|\"end\" (default \"start\"; only with `toward`)} → {id, cx, cy, radius, sweep}: an open circular arc from `start` to `end` in the current stroke (black when it is none) with no fill, its ends exactly at the two points (not pixel-aligned). With `through`, the arc passes through that point, an anchor of the path; with `toward`, it leaves the end `at` names heading toward that point (its tangent there). Give exactly one of `through` and `toward`; `at` with `through` is an error. `sweep` is the arc's turn in degrees, positive clockwise on the page. Two points that are the same, three on one line, or an arc reaching past the canvas are an error, and nothing is drawn",
has_doc,
three_point_arc
),
cmd!(
"shape.rectangularGrid",
"Rectangular Grid",
@@ -680,6 +689,50 @@ fn arc(s: &mut Session, p: &Value) -> Result<Value> {
insert_look_turned(s, "Arc", path_kind(path, None), look, None, true, bbox_angle, true)
}
/// An open circular arc from `start` to `end` ([`shapes::CircularArc`]): through `through`, or
/// leaving the end `at` names toward `toward`. One undo step, named as an Arc tool drag is.
fn three_point_arc(s: &mut Session, p: &Value) -> Result<Value> {
const C: &str = "shape.threePointArc";
let point = |key: &str| finite_numbers::<2>(&p[key]).map(|[x, y]| Point::new(x, y)).ok_or_else(|| bad(C, format!("`{key}` must be [x, y]")));
let (start, end) = (point("start")?, point("end")?);
let from_end = match p.get("at") {
None => false,
Some(Value::String(v)) if v == "start" || v == "end" => v == "end",
Some(_) => return Err(bad(C, "`at` must be \"start\" or \"end\"")),
};
// The arc, and the point it passes through (an anchor of the path, so the path meets it exactly).
let (arc, via) = match (p.get("through"), p.get("toward")) {
(Some(_), None) if p.get("at").is_some() => return Err(bad(C, "give `at` only with `toward`")),
(Some(_), None) => {
let through = point("through")?;
(shapes::CircularArc::through(start, end, through), Some(through))
}
(None, Some(_)) if from_end => {
let toward = point("toward")?;
(shapes::CircularArc::arriving(start, end, end - toward), None)
}
(None, Some(_)) => {
let toward = point("toward")?;
(shapes::CircularArc::leaving(start, toward - start, end), None)
}
_ => return Err(bad(C, "give exactly one of `through` and `toward`")),
};
let arc = arc.ok_or_else(|| bad(C, "no arc fits these points: two are the same or all three lie on one line"))?;
let path = via.map_or_else(|| arc.to_path(), |v| arc.to_path_via(v));
let look = s.new_art_look(
vectorcraft_color::Paint::None,
if s.paint.stroke.is_none() { vectorcraft_color::Paint::solid(vectorcraft_color::Color::BLACK) } else { s.paint.stroke.clone() },
s.paint.stroke_width.max(0.1),
);
// Not pixel-aligned: the ends stay on the given points.
let mut out = insert_look_turned(s, "Arc", path_kind(path, None), look, None, true, 0.0, false)?;
out["cx"] = json!(arc.center.x);
out["cy"] = json!(arc.center.y);
out["radius"] = json!(arc.radius);
out["sweep"] = json!(arc.sweep.to_degrees());
Ok(out)
}
/// The grid `paths` (bottom first) as one selected group in the new-art stroke, filled with the
/// current fill when `fill`; a path of several subpaths becomes a compound path of them. The group
/// and its members get the bounding-box angle `bbox_angle` (a grid drawn along a Constrain Angle).
@@ -572,6 +572,7 @@ pub(super) const ALLOWED: &[&str] = &[
"shape.rectangularGrid",
"shape.spiral",
"shape.star",
"shape.threePointArc",
"shapeBuilder.merge",
"shapeBuilder.regions",
"shaper.expand",
+1
View File
@@ -208,6 +208,7 @@ mod targeting;
mod textcombos;
mod textedit;
pub(super) mod textimport;
mod three_point_arc;
mod tileedge;
mod tints;
mod toolsettings;
+220
View File
@@ -0,0 +1,220 @@
//! `shape.threePointArc`: an open circular arc between two ends, through a third point or
//! leaving an end toward it, and the Three-Point Arc tool's clicks that run it.
use serde_json::{Value, json};
use vectorcraft_doc::{Node, NodeKind};
use vectorcraft_geom::Point;
use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey};
use crate::*;
const C: &str = "shape.threePointArc";
fn session() -> Session {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap();
s
}
fn node(s: &Session, id: NodeId) -> Node {
s.doc().unwrap().doc.node(id).unwrap().clone()
}
fn undo_len(s: &Session) -> usize {
s.doc().unwrap().history.undo.len()
}
fn object_count(s: &Session) -> usize {
let mut n = 0;
s.doc().unwrap().doc.walk(|_| n += 1);
n
}
fn id_of(v: &Value) -> NodeId {
NodeId(v["id"].as_u64().unwrap())
}
/// The largest distance of `points` from the path of `id`.
fn farthest_from_path(s: &Session, id: NodeId, points: &[Point]) -> f64 {
let n = node(s, id);
let path = n.path_data().unwrap();
points.iter().map(|p| path.nearest(*p).unwrap().4).fold(0.0, f64::max)
}
/// The arc from (0, 0) to (80, 0) through (40, -40) is the upper half of the circle about
/// (40, 0) with radius 40: an open path from one end to the other, through the third point, with
/// no fill and a stroke, selected, and one undo step.
#[test]
fn the_arc_through_a_third_point_is_an_open_path_and_one_undo_step() {
let mut s = session();
let undo = undo_len(&s);
let out = s.execute(C, &json!({"start": [0, 0], "end": [80, 0], "through": [40, -40]})).unwrap();
assert_eq!((out["cx"].as_f64(), out["cy"].as_f64(), out["radius"].as_f64()), (Some(40.0), Some(0.0), Some(40.0)), "{out}");
// From (0, 0) over the top to (80, 0): clockwise on the page.
assert!((out["sweep"].as_f64().unwrap() - 180.0).abs() < 1e-9, "{out}");
let id = id_of(&out);
let n = node(&s, id);
let NodeKind::Path { path, live: None, .. } = &n.kind else { panic!("not a plain path: {:?}", n.kind) };
let sp = &path.subpaths[0];
assert!(!sp.closed && path.subpaths.len() == 1);
assert_eq!((sp.anchors.first().map(|a| a.p), sp.anchors.last().map(|a| a.p)), (Some(Point::ORIGIN), Some(Point::new(80.0, 0.0))));
assert!(farthest_from_path(&s, id, &[Point::new(40.0, -40.0)]) < 1e-9);
assert!(n.appearance.fill_paint().is_none(), "no fill");
assert!(!n.appearance.stroke_paint().is_none(), "a stroke");
assert_eq!(s.doc().unwrap().selection.objects, [id]);
assert_eq!(undo_len(&s), undo + 1);
s.execute("edit.undo", &json!({})).unwrap();
assert!(s.doc().unwrap().doc.node(id).is_none());
// A third point between the quarter turns is an anchor too, so the path meets it exactly.
let via = Point::new(1000.0 * 20f64.to_radians().cos(), 1000.0 * 20f64.to_radians().sin());
let out = s.execute(C, &json!({"start": [1000, 0], "end": [0, 1000], "through": [via.x, via.y]})).unwrap();
let id = id_of(&out);
assert!(node(&s, id).path_data().unwrap().subpaths[0].anchors.iter().any(|a| a.p == via));
assert!(farthest_from_path(&s, id, &[via]) < 1e-9);
}
/// With `toward`, the arc leaves `start` heading at the point (its first handle points there),
/// or with `at: "end"` arrives at `end` along the line from the point to `end` (run backward, the
/// arc leaves `end` heading at the point).
#[test]
fn the_arc_toward_a_point_has_that_tangent_at_its_end() {
let mut s = session();
let out = s.execute(C, &json!({"start": [0, 0], "end": [80, 0], "toward": [30, -30]})).unwrap();
let n = node(&s, id_of(&out));
let first = n.path_data().unwrap().subpaths[0].anchors[0];
let d = (first.h_out - first.p).normalize();
assert!((d.dot(vectorcraft_geom::Vec2::new(1.0, -1.0).normalize()) - 1.0).abs() < 1e-12, "{d:?}");
// A quarter turn's tangent: the center is at (40, 40) and the radius √3200.
assert!((out["radius"].as_f64().unwrap() - 3200f64.sqrt()).abs() < 1e-9, "{out}");
let out = s.execute(C, &json!({"start": [0, 0], "end": [80, 0], "toward": [50, -30], "at": "end"})).unwrap();
let n = node(&s, id_of(&out));
let last = *n.path_data().unwrap().subpaths[0].anchors.last().unwrap();
let d = (last.p - last.h_in).normalize();
assert!((d.dot(vectorcraft_geom::Vec2::new(1.0, 1.0).normalize()) - 1.0).abs() < 1e-12, "{d:?}");
// The direction from the start and from the end mirror each other.
assert!((out["cx"].as_f64().unwrap() - 40.0).abs() < 1e-9 && (out["cy"].as_f64().unwrap() - 40.0).abs() < 1e-9, "{out}");
}
/// Points that are the same, a third point on the line through the ends, and an arc reaching past
/// the canvas are refused with a message; nothing is drawn and no undo step is added.
#[test]
fn points_with_no_arc_are_refused() {
let mut s = session();
let (undo, count) = (undo_len(&s), object_count(&s));
for p in [
json!({"start": [0, 0], "end": [0, 0], "through": [10, 10]}),
json!({"start": [0, 0], "end": [80, 0], "through": [40, 0]}),
json!({"start": [0, 0], "end": [80, 0], "through": [120, 0]}),
json!({"start": [0, 0], "end": [80, 0], "through": [80, 0]}),
json!({"start": [0, 0], "end": [80, 0], "toward": [0, 0]}),
json!({"start": [0, 0], "end": [80, 0], "toward": [-50, 0]}),
json!({"start": [0, 0], "end": [80, 0], "toward": [40, 0], "at": "end"}),
json!({"start": [0, 0], "end": [0, 0], "toward": [10, 10]}),
] {
let e = s.execute(C, &p).unwrap_err().to_string();
assert!(e.contains("no arc fits these points"), "{p}: {e}");
}
// Nearly in line beyond the end: the circle's center is about 1.2·10⁷ pt down the page, and the
// arc goes round the far side of it.
let far = json!({"start": [0, 0], "end": [80, 0], "through": [200, 0.001]});
let e = s.execute(C, &far).unwrap_err().to_string();
assert!(e.contains("result would exceed the canvas"), "{e}");
assert_eq!((undo_len(&s), object_count(&s)), (undo, count));
}
/// Missing or malformed points, both or neither of `through` and `toward`, an `at` that is not
/// "start" or "end", and an `at` with `through` are errors; nothing is drawn.
#[test]
fn malformed_params_are_refused() {
let mut s = session();
let count = object_count(&s);
for (p, want) in [
(json!({"end": [80, 0], "through": [40, 40]}), "`start` must be [x, y]"),
(json!({"start": [0, 0], "end": [80], "through": [40, 40]}), "`end` must be [x, y]"),
(json!({"start": [0, 0], "end": [80, 0], "through": [40, "a"]}), "`through` must be [x, y]"),
(json!({"start": [0, 0], "end": [80, 0], "through": null}), "`through` must be [x, y]"),
(json!({"start": [0, 0], "end": [80, 0], "toward": [10, 0, 0]}), "`toward` must be [x, y]"),
(json!({"start": [0, 0], "end": [80, 0]}), "give exactly one of `through` and `toward`"),
(json!({"start": [0, 0], "end": [80, 0], "through": [40, 40], "toward": [0, 40]}), "give exactly one of `through` and `toward`"),
(json!({"start": [0, 0], "end": [80, 0], "toward": [0, 40], "at": "middle"}), "`at` must be \"start\" or \"end\""),
(json!({"start": [0, 0], "end": [80, 0], "toward": [0, 40], "at": null}), "`at` must be \"start\" or \"end\""),
(json!({"start": [0, 0], "end": [80, 0], "through": [40, 40], "at": "end"}), "give `at` only with `toward`"),
(json!({"start": [0, 0], "end": [80, 0], "through": [40, 40], "at": "start"}), "give `at` only with `toward`"),
] {
let e = s.execute(C, &p).unwrap_err().to_string();
assert!(e.contains(want), "{p}: {e}");
}
assert_eq!(object_count(&s), count);
}
/// With Align New Objects to Pixel Grid on, the ends stay on the given points.
#[test]
fn the_arc_is_not_moved_onto_the_pixel_grid() {
let mut s = session();
s.execute("document.setup", &json!({"alignNewObjectsToPixelGrid": true})).unwrap();
let id = id_of(&s.execute(C, &json!({"start": [0.3, 0.2], "end": [80.6, 0.1], "through": [40.4, -39.7]})).unwrap());
let n = node(&s, id);
let sp = &n.path_data().unwrap().subpaths[0];
assert_eq!(sp.anchors.first().map(|a| a.p), Some(Point::new(0.3, 0.2)));
assert_eq!(sp.anchors.last().map(|a| a.p), Some(Point::new(80.6, 0.1)));
assert!(!n.extras().pixel_aligned);
}
fn view() -> ViewInfo {
ViewInfo { smart_guides: false, ..ViewInfo::default() }
}
fn click(s: &mut Session, x: f64, y: f64) {
for k in [PointerKind::Down, PointerKind::Up] {
s.pointer(&PointerEvent::new(k, x, y).with_mods(Mods::default()), view()).unwrap();
}
}
/// With the Three-Point Arc tool, three clicks draw the arc in one undo step; `]` before the third
/// click makes the third point give the direction instead. Escape drops the ends.
#[test]
fn three_clicks_with_the_tool_draw_the_arc() {
let mut s = session();
s.select_tool("threePointArc", view()).unwrap();
let (undo, count) = (undo_len(&s), object_count(&s));
click(&mut s, 100.0, 200.0);
click(&mut s, 180.0, 200.0);
assert_eq!((undo_len(&s), object_count(&s)), (undo, count), "two ends draw nothing yet");
click(&mut s, 140.0, 160.0);
assert_eq!(undo_len(&s), undo + 1);
let id = *s.doc().unwrap().selection.objects.first().unwrap();
assert!(farthest_from_path(&s, id, &[Point::new(100.0, 200.0), Point::new(140.0, 160.0), Point::new(180.0, 200.0)]) < 1e-9);
// Escape after the ends: the next clicks start afresh.
click(&mut s, 0.0, 0.0);
click(&mut s, 10.0, 300.0);
s.tool_key(ToolKey::Escape, Mods::default(), view()).unwrap();
click(&mut s, 100.0, 300.0);
click(&mut s, 180.0, 300.0);
s.tool_key(ToolKey::BracketRight, Mods::default(), view()).unwrap();
let undo = undo_len(&s);
// Straight up from the first end: the upper half circle about (140, 300).
click(&mut s, 100.0, 250.0);
assert_eq!(undo_len(&s), undo + 1);
let id = *s.doc().unwrap().selection.objects.first().unwrap();
assert!(farthest_from_path(&s, id, &[Point::new(140.0, 260.0)]) < 1e-9);
}
/// `tool.setOption` (the Tool Options dialog's Save) sets the tool's `direction` option, and
/// refuses a value that is not true or false, or an option the tool doesn't have.
#[test]
fn set_option_sets_the_direction_and_refuses_bad_values() {
let mut s = session();
for on in [true, false] {
let set = s.set_tool_option_cmd(&json!({"tool": "threePointArc", "values": {"direction": on}})).unwrap();
assert_eq!(set["direction"], json!(on));
assert_eq!(s.tool_options_of("threePointArc")["direction"], json!(on));
}
let cases = [
(json!({"tool": "threePointArc", "key": "direction", "value": "yes"}), "tool `threePointArc`: `direction` must be true or false"),
(json!({"tool": "threePointArc", "key": "bogus", "value": true}), "tool `threePointArc`: unknown option `bogus`"),
];
for (p, want) in cases {
assert_eq!(s.set_tool_option_cmd(&p).unwrap_err(), want, "{p}");
}
assert_eq!(s.tool_options_of("threePointArc")["direction"], json!(false));
}
+275
View File
@@ -570,6 +570,143 @@ pub fn arc(a: Point, b: Point, slope: f64, closed: bool, _base_along_x: bool) ->
PathData::single(SubPath::new(anchors, closed))
}
/// A circular arc from `start` to `end`: its circle's `center` and `radius`, and the turn from
/// `start` to `end` about the center in radians, positive the way the angle `atan2(y, x)` grows
/// (clockwise on the y-down page). The turn is never 0 and never a whole turn.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CircularArc {
pub start: Point,
pub end: Point,
pub center: Point,
pub radius: f64,
pub sweep: f64,
}
impl CircularArc {
/// The arc from `start` to `end` that passes through `through`. `None` when two of the points
/// are the same or the three lie on one line ([`circle_through`]).
pub fn through(start: Point, end: Point, through: Point) -> Option<Self> {
let (center, radius) = circle_through(start, end, through)?;
let angle = |p: Point| (p.y - center.y).atan2(p.x - center.x);
let a = angle(start);
let to_end = (angle(end) - a).rem_euclid(TAU);
let to_through = (angle(through) - a).rem_euclid(TAU);
// The turn that goes past `through` on its way to `end`.
let sweep = if to_through < to_end { to_end } else { to_end - TAU };
Self::checked(start, end, center, radius, sweep)
}
/// The arc that leaves `start` heading along `direction` (its tangent there) and ends at
/// `end`. `None` when `start` and `end` are the same, `direction` is zero, or `end` lies on the
/// line through `start` along `direction` (no circle touches that line at `start` and passes
/// through `end`). The same test as [`circle_through`] decides that: twice the area of the
/// triangle `start`, `end` and `start + direction` scaled to the chord's length is at most
/// 10⁻¹⁰ of the chord's length squared.
pub fn leaving(start: Point, direction: Vec2, end: Point) -> Option<Self> {
let len = direction.hypot();
let chord = end - start;
let c2 = chord.hypot2();
if !(len.is_finite() && len > 0.0 && c2.is_finite() && c2 > 0.0) {
return None;
}
let t = direction / len;
// Twice the triangle's area with the tangent as long as the chord.
let cross = t.cross(chord);
if cross.is_nan() || (cross * c2.sqrt()).abs() <= 1e-10 * c2 {
return None;
}
// The center lies on the normal at `start` on the side `end` is: `start + n * s` with
// `|n * s - chord| = |s|`, so `s = |chord|² / (2 n·chord)`.
let n = Vec2::new(-t.y, t.x);
let s = c2 / (2.0 * n.dot(chord));
let center = start + n * s;
let radius = s.abs();
let angle = |p: Point| (p.y - center.y).atan2(p.x - center.x);
let a = angle(start);
let to_end = (angle(end) - a).rem_euclid(TAU);
// Leaving along `t`: the turn grows when `t` points the way the angle grows at `start`.
let grows = Vec2::new(-(start.y - center.y), start.x - center.x).dot(t) > 0.0;
let sweep = if grows { to_end } else { to_end - TAU };
Self::checked(start, end, center, radius, sweep)
}
/// The arc that ends at `end` arriving along `direction` and starts at `start`: [`Self::leaving`]
/// from `end` back along `-direction`, turned round.
pub fn arriving(start: Point, end: Point, direction: Vec2) -> Option<Self> {
let back = Self::leaving(end, -direction, start)?;
Some(Self { start, end, center: back.center, radius: back.radius, sweep: -back.sweep })
}
fn checked(start: Point, end: Point, center: Point, radius: f64, sweep: f64) -> Option<Self> {
let ok = center.is_finite() && radius.is_finite() && radius > 0.0 && sweep.is_finite() && sweep != 0.0 && sweep.abs() < TAU;
ok.then_some(Self { start, end, center, radius, sweep })
}
/// The point at `t` (0 at `start`, 1 at `end`) along the arc.
pub fn at(&self, t: f64) -> Point {
let a = (self.start.y - self.center.y).atan2(self.start.x - self.center.x) + self.sweep * t;
Point::new(self.center.x + self.radius * a.cos(), self.center.y + self.radius * a.sin())
}
/// The open path of the arc: an anchor at `start`, at `end`, and between them as many smooth
/// anchors, evenly spaced, as keep each cubic piece to a quarter turn at most. The ends are the
/// given points exactly.
pub fn to_path(&self) -> PathData {
let quarter = std::f64::consts::FRAC_PI_2;
// A quarter turn and a hair more is still one piece.
let pieces = ((self.sweep.abs() / quarter) - 1e-9).ceil().clamp(1.0, 4.0) as u32;
let step = self.sweep / f64::from(pieces);
// The handle length of a cubic that follows a circle through the turn `step`, per unit
// of radius; negative when the arc runs the other way.
let k = 4.0 / 3.0 * (step / 4.0).tan();
let a0 = (self.start.y - self.center.y).atan2(self.start.x - self.center.x);
let mut anchors = Vec::with_capacity(pieces as usize + 1);
for i in 0..=pieces {
let a = a0 + step * f64::from(i);
let p = if i == 0 {
self.start
} else if i == pieces {
self.end
} else {
Point::new(self.center.x + self.radius * a.cos(), self.center.y + self.radius * a.sin())
};
// The handle along the tangent the way the arc runs.
let d = Vec2::new(-a.sin(), a.cos()) * (self.radius * k);
let h_in = if i == 0 { p } else { p - d };
let h_out = if i == pieces { p } else { p + d };
let kind = if i == 0 || i == pieces { AnchorKind::Corner } else { AnchorKind::Smooth };
anchors.push(Anchor { p, h_in, h_out, kind });
}
PathData::single(SubPath::new(anchors, false))
}
/// [`Self::to_path`] with a smooth anchor at `via`, a point on the arc such as the one
/// [`Self::through`] passes through, so the path passes through it exactly: the arc to `via`
/// and the arc on from it, each cut into quarter turns at most. A `via` at an end, or off the
/// stretch between the ends, gives [`Self::to_path`].
pub fn to_path_via(&self, via: Point) -> PathData {
let angle = |p: Point| (p.y - self.center.y).atan2(p.x - self.center.x);
let turn = (angle(via) - angle(self.start)).rem_euclid(TAU);
// The turn from `start` to `via` the way the arc runs.
let to_via = if self.sweep > 0.0 { turn } else { turn - TAU };
let share = to_via / self.sweep;
if !(share > 0.0 && share < 1.0) || via == self.start || via == self.end {
return self.to_path();
}
let first = Self { end: via, sweep: to_via, ..*self }.to_path();
let second = Self { start: via, sweep: self.sweep - to_via, ..*self }.to_path();
let (Some(a), Some(b)) = (first.subpaths.into_iter().next(), second.subpaths.into_iter().next()) else { return self.to_path() };
let mut anchors: Vec<Anchor> = a.anchors.iter().copied().collect();
let mut rest = b.anchors.iter().copied();
if let (Some(joint), Some(next)) = (anchors.last_mut(), rest.next()) {
joint.h_out = next.h_out;
joint.kind = AnchorKind::Smooth;
}
anchors.extend(rest);
PathData::single(SubPath::new(anchors, false))
}
}
/// Logarithmic spiral with decay per full wind (`segments` quarter turns).
pub fn spiral(center: Point, radius: f64, decay_percent: f64, segments: u32, clockwise: bool) -> PathData {
let decay = (decay_percent / 100.0).clamp(0.05, 0.9999);
@@ -846,6 +983,144 @@ mod tests {
assert!(c.distance(Point::new(4.0, 3.0) + far) < 1e-6 && (radius - 5.0).abs() < 1e-6, "{c:?} {radius}");
}
/// Every point of `path`'s cubics lies on the arc's circle (to 3·10⁻⁴ of the radius, the
/// quarter-turn cubic's error), and the path runs from the arc's start to its end.
fn assert_on_circle(arc: &CircularArc) {
use kurbo::ParamCurve;
let path = arc.to_path();
let sp = &path.subpaths[0];
assert!(!sp.closed);
assert_eq!(sp.anchors.first().map(|a| a.p), Some(arc.start));
assert_eq!(sp.anchors.last().map(|a| a.p), Some(arc.end));
for seg in path.to_bezpath().segments() {
for i in 0..=8 {
let p = seg.eval(f64::from(i) / 8.0);
assert!((p.distance(arc.center) - arc.radius).abs() <= 3e-4 * arc.radius, "{p:?} off the circle");
}
}
}
/// The arc through a third point: from (0, 0) to (8, 0) through (4, -2) (above the chord on the
/// page) bulges up; through (4, 2) it bulges down; each has the circle through the three points
/// and goes past the third point. Through (4, 10) it is the larger part of its circle.
#[test]
fn the_arc_through_a_point_passes_through_it() {
let (a, b) = (Point::ORIGIN, Point::new(8.0, 0.0));
for (c, major) in
[(Point::new(4.0, -2.0), false), (Point::new(4.0, 2.0), false), (Point::new(4.0, 10.0), true), (Point::new(-1.0, -3.0), true)]
{
let arc = CircularArc::through(a, b, c).unwrap();
let (center, radius) = circle_through(a, b, c).unwrap();
assert!(arc.center.distance(center) < 1e-12 && (arc.radius - radius).abs() < 1e-12);
assert_eq!(arc.sweep.abs() > PI, major, "{c:?}: {}", arc.sweep);
// The third point is on the arc: some point along it is the third point.
let nearest = (0..=10_000).map(|i| arc.at(f64::from(i) / 10_000.0).distance(c)).fold(f64::INFINITY, f64::min);
assert!(nearest < 0.01, "{c:?}: {nearest}");
assert!(arc.at(0.0).distance(a) < 1e-12 && arc.at(1.0).distance(b) < 1e-9);
assert_on_circle(&arc);
}
// A half circle: two pieces, its middle anchor at the third point.
let arc = CircularArc::through(a, b, Point::new(4.0, -4.0)).unwrap();
let path = arc.to_path();
assert_eq!(path.subpaths[0].anchors.len(), 3);
assert!(path.subpaths[0].anchors[1].p.distance(Point::new(4.0, -4.0)) < 1e-12);
assert_eq!(path.subpaths[0].anchors[1].kind, AnchorKind::Smooth);
// Almost a whole circle: four pieces.
let arc = CircularArc::through(a, Point::new(0.0, 0.01), Point::new(8.0, 0.0)).unwrap();
assert_eq!(arc.to_path().subpaths[0].anchors.len(), 5);
assert_on_circle(&arc);
}
/// With an anchor at the third point, the path passes through it exactly, whichever way the
/// arc runs, even where one cubic would miss it (a quarter turn of radius 1000 misses a point
/// 20° along by about 0.27). Each part keeps to a quarter turn, the anchor there is smooth, and
/// a point at an end leaves the path as `to_path` makes it.
#[test]
fn the_path_via_the_third_point_passes_through_it_exactly() {
let center = Point::new(0.0, 0.0);
let on = |deg: f64| Point::new(1000.0 * deg.to_radians().cos(), 1000.0 * deg.to_radians().sin());
for (a, b, c) in [(0.0, 90.0, 20.0), (90.0, 0.0, 20.0), (0.0, 300.0, 170.0), (300.0, 0.0, 10.0)] {
let arc = CircularArc::through(on(a), on(b), on(c)).unwrap();
assert!(arc.center.distance(center) < 1e-6);
let path = arc.to_path_via(on(c));
let sp = &path.subpaths[0];
let joint = sp.anchors.iter().find(|x| x.p == on(c)).expect("an anchor at the third point");
assert_eq!(joint.kind, AnchorKind::Smooth);
assert_eq!((sp.anchors.first().map(|x| x.p), sp.anchors.last().map(|x| x.p)), (Some(arc.start), Some(arc.end)));
// No piece turns more than a quarter turn.
let points: Vec<Point> = sp.anchors.iter().map(|x| x.p).collect();
for w in points.windows(2) {
let (u, v) = (w[0] - arc.center, w[1] - arc.center);
assert!(u.cross(v).atan2(u.dot(v)).abs() <= std::f64::consts::FRAC_PI_2 + 1e-9, "{a} {b} {c}");
}
use kurbo::ParamCurve;
for seg in path.to_bezpath().segments() {
for i in 0..=8 {
let p = seg.eval(f64::from(i) / 8.0);
assert!((p.distance(arc.center) - arc.radius).abs() <= 0.3, "{p:?} off the circle");
}
}
}
// A third point a hair from an end is still an anchor.
let near = Point::new(1000.0, 0.0000005);
let arc = CircularArc::through(on(0.0), on(90.0), near).unwrap();
assert!(arc.to_path_via(near).subpaths[0].anchors.iter().any(|x| x.p == near));
let arc = CircularArc::through(on(0.0), on(90.0), on(20.0)).unwrap();
assert_eq!(arc.to_path_via(on(0.0)), arc.to_path());
assert_eq!(arc.to_path_via(on(180.0)), arc.to_path());
}
/// The arc that leaves its start along a direction: from (0, 0) heading up the page (-y) to
/// (8, 0) is the upper half circle about (4, 0); heading down, the lower one. Its tangent at the
/// start is the direction, and arriving at the end mirrors it.
#[test]
fn the_arc_leaving_along_a_direction_has_that_tangent() {
let (a, b) = (Point::ORIGIN, Point::new(8.0, 0.0));
let up = CircularArc::leaving(a, Vec2::new(0.0, -3.0), b).unwrap();
assert!(up.center.distance(Point::new(4.0, 0.0)) < 1e-12 && (up.radius - 4.0).abs() < 1e-12);
assert!(up.at(0.5).distance(Point::new(4.0, -4.0)) < 1e-9, "{:?}", up.at(0.5));
let down = CircularArc::leaving(a, Vec2::new(0.0, 3.0), b).unwrap();
assert!(down.at(0.5).distance(Point::new(4.0, 4.0)) < 1e-9, "{:?}", down.at(0.5));
// Leaving at 45° up and right: a quarter circle, tangent along the direction.
for d in [Vec2::new(1.0, -1.0), Vec2::new(1.0, 1.0), Vec2::new(-1.0, -0.2), Vec2::new(-1.0, 3.0)] {
let arc = CircularArc::leaving(a, d, b).unwrap();
let first = &arc.to_path().subpaths[0].anchors[0];
let tangent = first.h_out - first.p;
assert!((tangent.normalize().dot(d.normalize()) - 1.0).abs() < 1e-12, "{d:?}: {tangent:?}");
assert_on_circle(&arc);
// Arriving along a direction at the end: the tangent into the end is the direction.
let arc = CircularArc::arriving(a, b, d).unwrap();
let last = arc.to_path().subpaths[0].anchors.last().copied().unwrap();
let tangent = last.p - last.h_in;
assert!((tangent.normalize().dot(d.normalize()) - 1.0).abs() < 1e-12, "{d:?}: {tangent:?}");
assert_eq!((arc.start, arc.end), (a, b));
assert_on_circle(&arc);
}
}
/// No arc for points that are the same, a third point on the chord's line, a zero or not
/// finite direction, or a direction along the chord's line.
#[test]
fn degenerate_points_give_no_arc() {
let (a, b) = (Point::new(1.0, 2.0), Point::new(5.0, 7.0));
assert_eq!(CircularArc::through(a, a, b), None);
assert_eq!(CircularArc::through(a, b, b), None);
assert_eq!(CircularArc::through(a, b, a.midpoint(b)), None);
assert_eq!(CircularArc::through(a, b, a + (b - a) * 3.0), None);
assert_eq!(CircularArc::through(a, b, Point::new(f64::INFINITY, 0.0)), None);
assert_eq!(CircularArc::leaving(a, Vec2::new(1.0, 0.0), a), None);
assert_eq!(CircularArc::leaving(a, Vec2::ZERO, b), None);
assert_eq!(CircularArc::leaving(a, Vec2::new(f64::NAN, 1.0), b), None);
assert_eq!(CircularArc::leaving(a, b - a, b), None);
assert_eq!(CircularArc::leaving(a, a - b, b), None);
assert_eq!(CircularArc::arriving(a, b, b - a), None);
// Off the line by 10⁻⁴ over a chord of 2000 still makes an arc.
let (p, q) = (Point::new(-1000.0, 0.0), Point::new(1000.0, 0.0));
assert!(CircularArc::leaving(p, Vec2::new(2000.0, 1e-4), q).is_some());
// Off the line by 10⁻¹² of the chord is in line: no arc, rather than a circle 10¹² chords wide.
assert_eq!(CircularArc::leaving(p, Vec2::new(1.0, 1e-12), q), None);
}
/// Two points that are the same, or three on one line, give no circle.
#[test]
fn coincident_or_collinear_points_give_no_circle() {
+1
View File
@@ -49,6 +49,7 @@ pub const TOOL_GROUPS: &[&[ToolInfo]] = &[
&[
t("lineSegment", "Line Segment Tool", Some("\\"), "tool-line"),
t("arc", "Arc Tool", None, "tool-arc"),
t(crate::three_point_arc::ID, "Three-Point Arc Tool", None, "tool-three-point-arc"),
t("spiral", "Spiral Tool", None, "tool-spiral"),
t("rectangularGrid", "Rectangular Grid Tool", None, "tool-rect-grid"),
t("polarGrid", "Polar Grid Tool", None, "tool-polar-grid"),
+2
View File
@@ -48,6 +48,7 @@ pub mod sidewidget;
pub mod slice;
pub mod symbolism;
pub mod text;
pub mod three_point_arc;
pub mod touchtype;
pub mod trace_split;
pub mod typewidget;
@@ -392,6 +393,7 @@ pub fn create(id: &str) -> Box<dyn Tool> {
quickpen::ID => Box::new(quickpen::QuickPenTool::default()),
// Not in the toolbar: `file.place.queue` loads it.
"place" => Box::new(place::PlaceTool::default()),
three_point_arc::ID => Box::new(three_point_arc::ThreePointArcTool::default()),
other => symbolism::create(other)
.or_else(|| builder::create(other))
.or_else(|| draw2::create(other))
+1
View File
@@ -48,6 +48,7 @@ const ROWS: &[Row] = &[
(&["mirrorCut"], None, &["axis", "keep"]),
(&["puppetWarp"], None, &["showMesh", "expand"]),
(&["arc"], None, &["closed", "lengthX", "lengthY", "reference", "baseAlong", "slope", "fillArc"]),
(&[crate::three_point_arc::ID], None, &["direction"]),
(&["spiral"], None, &["decay", "segments", "clockwise"]),
// The grids' Tool Options: the dividers and switches the drag uses, the Default Size and
// Reference Point a click's dialog opens with.
+337
View File
@@ -0,0 +1,337 @@
//! The Three-Point Arc tool draws an open circular arc between two ends it is given
//! (`shape.threePointArc`).
//!
//! The ends come first: a drag from one to the other, or a click on each. Shift keeps the second
//! end at 45° steps from the first (from General › Constrain Angle). A third point then shapes the
//! arc, placed by a click or by a press dragged to it: the arc passes through it, or, with the
//! `direction` option on, the arc leaves the first end heading toward it (Alt: the arc arrives at
//! the second end along the line from that end to the point, and Shift keeps the line at 45°
//! steps). `direction` is set in the tool's Tool Options and kept with the preferences; `]` (with
//! or without Shift) switches it while the ends are placed. Every point snaps to Smart Guides.
//! Until the third point is placed, the tool shows the arc as a dashed outline with its ends, its
//! center as a small cross, the direction line in direction mode and, with Measurement Labels on,
//! the radius by the pointer. Where no arc fits (the third point lies on the line through the
//! ends) or the arc would reach past the canvas, the tool shows "Arc too large" by the pointer
//! (nothing while the pointer is on an end) and a click there draws nothing. The arc is one undo
//! step. Escape, a press dropped part way, and an edit, Undo or Redo made outside the tool drop
//! the ends; a second click on the first end (a double-click) places nothing.
use serde_json::{Value, json};
use vectorcraft_doc::MAX_COORD;
use vectorcraft_geom::shapes::CircularArc;
use vectorcraft_geom::{PathData, Point, Vec2};
use crate::guides::{DrawSnap, Leave};
use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, ToolContext, ToolKey};
pub const ID: &str = "threePointArc";
/// How far (screen points) the pointer travels from a press before the press counts as a drag.
const DRAG_PX: f64 = 2.0;
/// Half the length (screen points) of each arm of the cross at the arc's center.
const CROSS_PX: f64 = 4.0;
/// How near (screen points) the first end a second click counts as a click on it.
const REACH_PX: f64 = 3.0;
/// The label the tool shows by the pointer where no arc fits.
pub const TOO_LARGE: &str = "Arc too large";
/// The press in progress.
#[derive(Clone, Copy, Debug, PartialEq)]
enum Press {
/// The first end, placed at `at` by a press at `from` (before snapping): a release after a
/// drag places the second end there. The drag is measured from `from`.
Start { at: Point, from: Point, dragged: bool },
/// The second end, pressed after a click placed the first: the release places it.
End,
/// The third point, pressed once both ends are placed: the release draws the arc.
Third,
}
#[derive(Default)]
pub struct ThreePointArcTool {
snap: DrawSnap,
/// The third point gives the arc's direction at an end instead of a point it passes through.
direction: bool,
start: Option<Point>,
end: Option<Point>,
press: Option<Press>,
/// Where the pointer is, snapped: the point the next press or release places.
pointer: Option<Point>,
/// Alt was held at the last pointer event: in direction mode, the direction is at the second end.
at_end: bool,
/// Where the pointer was at its last event, pressed or hovering, before snapping, and the keys
/// held then.
raw: Option<(Point, Mods)>,
}
/// The arc from `start` to `end` shaped by `third`, as `shape.threePointArc` draws it: through
/// `third`, or with `direction`, heading toward `third` from `start` (or, with `at_end`, arriving
/// at `end` along the line from `end` to `third`). None where no arc fits or the arc would reach
/// past the canvas. With it, the path the command draws.
pub fn arc_of(start: Point, end: Point, third: Point, direction: bool, at_end: bool) -> Option<(CircularArc, PathData)> {
let (arc, path) = match (direction, at_end) {
(false, _) => CircularArc::through(start, end, third).map(|arc| (arc, arc.to_path_via(third))),
(true, false) => CircularArc::leaving(start, third - start, end).map(|arc| (arc, arc.to_path())),
(true, true) => CircularArc::arriving(start, end, end - third).map(|arc| (arc, arc.to_path())),
}?;
// The curve is measured, not its handles, which can reach past the canvas while the curve stays
// inside, as the document's own range check measures a path.
let inside = |x: f64, y: f64| x.abs() <= MAX_COORD && y.abs() <= MAX_COORD;
let on_canvas = path.bounds().is_some_and(|r| inside(r.x0, r.y0) && inside(r.x1, r.y1));
on_canvas.then_some((arc, path))
}
/// The command the tool runs for the arc from `start` to `end` shaped by `third`.
fn command(start: Point, end: Point, third: Point, direction: bool, at_end: bool) -> (String, Value) {
let pair = |p: Point| json!([p.x, p.y]);
let params = if direction {
json!({ "start": pair(start), "end": pair(end), "toward": pair(third), "at": if at_end { "end" } else { "start" } })
} else {
json!({ "start": pair(start), "end": pair(end), "through": pair(third) })
};
("shape.threePointArc".into(), params)
}
impl ThreePointArcTool {
fn clear(&mut self) {
self.start = None;
self.end = None;
self.press = None;
self.pointer = None;
self.snap.clear();
}
/// How the point being placed keeps to the points before it: the second end to the first, and
/// in direction mode the third point to the end its direction line starts from.
fn leave(&self, cx: &ToolContext, mods: Mods) -> Option<Leave> {
match (self.start, self.end) {
(Some(a), None) => Some(Leave::segment(cx, a, mods.shift)),
(Some(a), Some(b)) if self.direction => Some(Leave::segment(cx, if mods.alt { b } else { a }, mods.shift)),
_ => None,
}
}
/// The pressed pointer moved to `ev`, or Shift or Alt changed: the point being placed follows
/// it. A change of keys alone does not make the press a drag.
fn follow(&mut self, cx: &ToolContext, ev: &PointerEvent) {
let moved = self.raw.is_none_or(|(p, _)| p != ev.pos);
self.raw = Some((ev.pos, ev.mods));
match &mut self.press {
Some(Press::Start { at, from, dragged }) => {
*dragged |= moved && ev.pos.distance(*from) >= cx.tol(DRAG_PX);
let leave = Leave::segment(cx, *at, ev.mods.shift);
self.pointer = Some(self.snap.drag(cx, ev.pos, Some(&leave)));
}
Some(Press::End | Press::Third) => {
let leave = self.leave(cx, ev.mods);
self.pointer = Some(self.snap.drag(cx, ev.pos, leave.as_ref()));
}
None => {}
}
}
/// The arc as the tool shows it now, and its path: both ends placed and the pointer on a point
/// that fits.
fn arc(&self) -> Option<(CircularArc, PathData)> {
arc_of(self.start?, self.end?, self.pointer?, self.direction, self.at_end)
}
}
impl Tool for ThreePointArcTool {
fn id(&self) -> &'static str {
ID
}
fn pointer(&mut self, cx: &ToolContext, ev: &PointerEvent) -> Vec<Action> {
if !ev.pos.is_finite() {
return vec![];
}
if self.end.is_some() {
self.at_end = ev.mods.alt;
}
match ev.kind {
PointerKind::Move => {
self.raw = Some((ev.pos, ev.mods));
let leave = self.leave(cx, ev.mods);
self.pointer = Some(self.snap.hover(cx, ev.pos, &[], leave.as_ref()));
vec![]
}
PointerKind::Down => {
self.raw = Some((ev.pos, ev.mods));
let leave = self.leave(cx, ev.mods);
match (self.start, self.end) {
(None, _) => {
let at = self.snap.press(cx, ev.pos, &[], None);
self.start = Some(at);
self.press = Some(Press::Start { at, from: ev.pos, dragged: false });
self.pointer = Some(at);
}
(Some(a), None) => {
let at = self.snap.press(cx, ev.pos, &[], leave.as_ref());
// The second click of a double-click lands on the first end.
if at.distance(a) <= cx.tol(REACH_PX) {
self.press = None;
return vec![];
}
self.press = Some(Press::End);
self.pointer = Some(at);
}
(Some(_), Some(_)) => {
self.pointer = Some(self.snap.press(cx, ev.pos, &[], leave.as_ref()));
self.press = Some(Press::Third);
}
}
vec![]
}
PointerKind::Drag => {
self.follow(cx, ev);
vec![]
}
PointerKind::Up => {
// A release away from the last drag event places the point where it is let go, and
// a release with Shift or Alt changed places it as those keys keep it.
let same = self.raw.is_some_and(|(p, m)| p == ev.pos && (m.shift, m.alt) == (ev.mods.shift, ev.mods.alt));
if self.press.is_some() && !same {
self.follow(cx, ev);
}
match (self.press.take(), self.start, self.pointer) {
(Some(Press::Start { at, dragged: true, .. }), _, Some(b)) if b.distance(at) >= cx.tol(DRAG_PX) => self.end = Some(b),
(Some(Press::End), Some(a), Some(b)) if b.distance(a) > cx.tol(REACH_PX) => self.end = Some(b),
(Some(Press::Third), Some(a), Some(c)) => {
let Some(b) = self.end else { return vec![] };
// Where no arc fits, nothing is drawn and the ends stay for another try.
if self.arc().is_none() {
self.snap.clear();
return vec![];
}
let (name, params) = command(a, b, c, self.direction, self.at_end);
self.clear();
return vec![Action::Exec(name, params)];
}
_ => {}
}
// A placed end: the guides of the press go.
self.snap.clear();
vec![]
}
PointerKind::DoubleClick | PointerKind::TripleClick => vec![],
}
}
fn key(&mut self, cx: &ToolContext, key: ToolKey, _mods: Mods) -> Vec<Action> {
match key {
ToolKey::Escape => self.clear(),
ToolKey::BracketRight if self.start.is_some() => {
self.direction = !self.direction;
// A press in progress: the point being placed keeps to the new mode.
// A hovering pointer: the third point it shows keeps to the new mode too.
match (self.press, self.raw) {
(Some(_), Some((p, mods))) => self.follow(cx, &PointerEvent::new(PointerKind::Drag, p.x, p.y).with_mods(mods)),
(None, Some((p, mods))) if self.end.is_some() && self.pointer.is_some() => {
let leave = self.leave(cx, mods);
self.pointer = Some(self.snap.hover(cx, p, &[], leave.as_ref()));
}
_ => {}
}
}
_ => {}
}
vec![]
}
fn claims_key(&self, _cx: &ToolContext, key: ToolKey) -> bool {
matches!(key, ToolKey::Escape | ToolKey::BracketRight) && self.start.is_some()
}
/// An end placed: Escape drops it.
fn ends_on_escape(&self, _cx: &ToolContext) -> bool {
self.start.is_some()
}
fn busy(&self) -> bool {
self.start.is_some()
}
/// A dropped press (a second finger, a canceled touch) drops the ends placed so far.
fn drop_press(&mut self, _cx: &ToolContext) -> Vec<Action> {
self.clear();
vec![]
}
fn deactivate(&mut self, _cx: &ToolContext) -> Vec<Action> {
self.clear();
vec![]
}
fn hover_ended(&mut self, _cx: &ToolContext) {
if self.press.is_none() {
self.pointer = None;
self.snap.clear();
}
}
/// An edit, Undo or Redo made outside the tool, or another document, drops the ends.
fn history_moved(&mut self) {
self.clear();
}
fn overlays(&self, cx: &ToolContext) -> Vec<Overlay> {
let mut o = self.snap.guides().to_vec();
let color = crate::draw2::FEEDBACK;
match (self.start, self.end, self.pointer) {
// Placing the second end: the chord so far.
(Some(a), None, Some(b)) if b != a => o.push(Overlay::Line { a, b, color, dashed: true }),
(Some(a), Some(b), Some(p)) => {
if self.direction {
o.push(Overlay::Line { a: if self.at_end { b } else { a }, b: p, color, dashed: false });
}
match self.arc() {
Some((arc, path)) => {
o.push(Overlay::Path { path: path.to_bezpath(), color, width: 1.0, dashed: true });
let (c, arm) = (arc.center, cx.tol(CROSS_PX));
o.push(Overlay::Line { a: c - Vec2::new(arm, 0.0), b: c + Vec2::new(arm, 0.0), color, dashed: false });
o.push(Overlay::Line { a: c - Vec2::new(0.0, arm), b: c + Vec2::new(0.0, arm), color, dashed: false });
if cx.measurement_labels {
o.push(Overlay::Measure { p, text: format!("R: {}", cx.len(arc.radius)) });
}
}
// A pointer on an end gives no third point yet, so no label.
None if p.distance(a) <= cx.tol(REACH_PX) || p.distance(b) <= cx.tol(REACH_PX) => {}
None => o.push(Overlay::Label { p, text: TOO_LARGE.into(), color }),
}
}
_ => {}
}
for p in self.start.iter().chain(self.end.iter()) {
o.push(Overlay::Anchor { p: *p, color, filled: true, size: 6.0 });
}
o
}
fn cursor(&self, _cx: &ToolContext, _p: Point, _mods: Mods) -> Cursor {
Cursor::Crosshair
}
fn options(&self) -> Value {
json!({ "direction": self.direction })
}
fn set_option(&mut self, key: &str, value: &Value) {
if key == "direction"
&& let Some(on) = value.as_bool()
{
self.direction = on;
}
}
fn check_option(&self, key: &str, v: &Value) -> Result<(), String> {
use crate::option_check as c;
match key {
"direction" => c::boolean(key, v),
_ => Err(c::unknown(key)),
}
}
}
#[cfg(test)]
mod tests;
+388
View File
@@ -0,0 +1,388 @@
use super::*;
use crate::testutil::*;
use vectorcraft_doc::Selection;
use vectorcraft_geom::Rect;
fn ev(kind: PointerKind, (x, y): (f64, f64), mods: Mods) -> PointerEvent {
PointerEvent::new(kind, x, y).with_mods(mods)
}
fn click_with(t: &mut ThreePointArcTool, cx: &ToolContext, p: (f64, f64), mods: Mods) -> Vec<Action> {
let mut acts = t.pointer(cx, &ev(PointerKind::Down, p, mods));
acts.extend(t.pointer(cx, &ev(PointerKind::Up, p, mods)));
acts
}
fn click(t: &mut ThreePointArcTool, cx: &ToolContext, p: (f64, f64)) -> Vec<Action> {
click_with(t, cx, p, Mods::default())
}
fn hover(t: &mut ThreePointArcTool, cx: &ToolContext, p: (f64, f64), mods: Mods) {
assert!(t.pointer(cx, &ev(PointerKind::Move, p, mods)).is_empty());
}
/// A press at `from`, dragged through `path` and let go at its last point.
fn drag(t: &mut ThreePointArcTool, cx: &ToolContext, from: (f64, f64), path: &[(f64, f64)], mods: Mods) -> Vec<Action> {
let mut acts = t.pointer(cx, &ev(PointerKind::Down, from, mods));
for p in path {
acts.extend(t.pointer(cx, &ev(PointerKind::Drag, *p, mods)));
}
let end = path.last().copied().unwrap_or(from);
acts.extend(t.pointer(cx, &ev(PointerKind::Up, end, mods)));
acts
}
fn through(start: (f64, f64), end: (f64, f64), via: (f64, f64)) -> Vec<Action> {
let pair = |(x, y): (f64, f64)| json!([x, y]);
vec![Action::Exec("shape.threePointArc".into(), json!({ "start": pair(start), "end": pair(end), "through": pair(via) }))]
}
fn toward(start: (f64, f64), end: (f64, f64), to: (f64, f64), at: &str) -> Vec<Action> {
let pair = |(x, y): (f64, f64)| json!([x, y]);
vec![Action::Exec("shape.threePointArc".into(), json!({ "start": pair(start), "end": pair(end), "toward": pair(to), "at": at }))]
}
/// The dashed arc the tool shows: its bounding box.
fn preview(o: &[Overlay]) -> Option<Rect> {
o.iter().find_map(|o| match o {
Overlay::Path { path, dashed: true, .. } => Some(vectorcraft_geom::Shape::bounding_box(path)),
_ => None,
})
}
fn too_large(o: &[Overlay]) -> bool {
o.iter().any(|o| matches!(o, Overlay::Label { text, .. } if text == TOO_LARGE))
}
/// A drag places the two ends; a click on a third point then draws the arc through it. Until
/// then, nothing is drawn.
#[test]
fn a_drag_and_a_click_draw_the_arc_through_the_third_point() {
let (d, _) = doc_with_rect();
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = ThreePointArcTool::default();
assert!(drag(&mut t, &cx, (300.0, 300.0), &[(340.0, 300.0), (380.0, 300.0)], Mods::default()).is_empty());
assert!(t.busy() && t.ends_on_escape(&cx));
assert_eq!(click(&mut t, &cx, (340.0, 260.0)), through((300.0, 300.0), (380.0, 300.0), (340.0, 260.0)));
assert!(!t.busy() && t.overlays(&cx).is_empty(), "the tool starts afresh");
}
/// Two clicks place the ends. Between the second click and the third, the tool shows the arc
/// through the pointer (a half circle here, bulging up the page), its center cross and its
/// radius; the third click draws it.
#[test]
fn three_clicks_draw_the_arc_and_the_tool_shows_it_on_the_way() {
let (d, _) = doc_with_rect();
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = ThreePointArcTool::default();
assert!(click(&mut t, &cx, (300.0, 300.0)).is_empty());
hover(&mut t, &cx, (380.0, 300.0), Mods::default());
assert!(t.overlays(&cx).iter().any(|o| matches!(o, Overlay::Line { dashed: true, .. })), "the chord so far");
assert!(click(&mut t, &cx, (380.0, 300.0)).is_empty());
hover(&mut t, &cx, (340.0, 260.0), Mods::default());
let o = t.overlays(&cx);
let b = preview(&o).expect("the arc");
assert!((b.x0 - 300.0).abs() < 0.1 && (b.x1 - 380.0).abs() < 0.1 && (b.y0 - 260.0).abs() < 0.1 && (b.y1 - 300.0).abs() < 1e-9, "{b:?}");
let radius = format!("R: {}", cx.len(40.0));
assert!(o.iter().any(|o| matches!(o, Overlay::Measure { text, .. } if *text == radius)), "{o:?}");
// The center cross at (340, 300).
assert!(o.iter().any(|o| matches!(o, Overlay::Line { a, b, dashed: false, .. } if a.midpoint(*b).distance(Point::new(340.0, 300.0)) < 1e-9)));
let quiet = ToolContext { measurement_labels: false, ..cx };
assert!(!t.overlays(&quiet).iter().any(|o| matches!(o, Overlay::Measure { .. })));
assert_eq!(click(&mut t, &cx, (340.0, 260.0)), through((300.0, 300.0), (380.0, 300.0), (340.0, 260.0)));
}
/// A third point on the line through the ends, an arc reaching past the canvas, or a third point
/// on an end gives no arc: a click draws nothing and keeps the ends, and a click on a point that
/// fits then draws the arc. The tool shows "Arc too large" by the pointer, except on an end.
#[test]
fn a_third_point_in_line_with_the_ends_draws_nothing() {
let (d, _) = doc_with_rect();
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = ThreePointArcTool::default();
drag(&mut t, &cx, (300.0, 300.0), &[(380.0, 300.0)], Mods::default());
// Nearly in line beyond the end: the circle's center is about 1.2·10⁷ pt away.
for (bad, label) in [((420.0, 300.0), true), ((250.0, 300.0), true), ((340.0, 300.0), true), ((500.0, 300.001), true), ((380.0, 300.0), false)] {
hover(&mut t, &cx, bad, Mods::default());
let o = t.overlays(&cx);
assert!(too_large(&o) == label && preview(&o).is_none(), "{bad:?}: {o:?}");
assert!(click(&mut t, &cx, bad).is_empty(), "{bad:?}");
assert!(t.busy());
}
assert_eq!(click(&mut t, &cx, (340.0, 340.0)), through((300.0, 300.0), (380.0, 300.0), (340.0, 340.0)));
}
/// An arc near the canvas edge fits while its curve stays inside, even where a handle reaches past
/// the edge, and gives no arc once the curve reaches past it.
#[test]
fn an_arc_near_the_canvas_edge_is_measured_by_its_curve() {
// A 60° arc of radius 1000 whose rightmost point is `edge`: the handles at its ends reach about
// 45 pt further right.
let arc = |edge: f64| {
let (r, c) = (1000.0, edge - 1000.0);
let (dx, dy) = (r * 30f64.to_radians().cos(), r * 30f64.to_radians().sin());
let start = Point::new(c + dx, -dy);
let end = Point::new(c + dx, dy);
arc_of(start, end, start + Vec2::new(0.5, 3f64.sqrt() / 2.0) * 100.0, true, false)
};
let Some((_, path)) = arc(MAX_COORD - 1.0) else { panic!("an arc inside the canvas fits") };
assert!(path.control_bounds().is_some_and(|r| r.x1 > MAX_COORD), "a handle reaches past the edge");
assert!(path.bounds().is_some_and(|r| r.x1 <= MAX_COORD && (r.x1 - (MAX_COORD - 1.0)).abs() < 1e-6));
assert!(arc(MAX_COORD + 1.0).is_none(), "an arc reaching past the canvas does not fit");
}
/// In direction mode, Shift keeps the direction line at 45° steps from the end it starts at.
#[test]
fn shift_keeps_the_direction_at_45_degree_steps() {
let (d, _) = doc_with_rect();
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = ThreePointArcTool::default();
t.set_option("direction", &json!(true));
drag(&mut t, &cx, (300.0, 300.0), &[(380.0, 300.0)], Mods::default());
let shift = Mods { shift: true, ..Mods::default() };
let acts = click_with(&mut t, &cx, (303.0, 250.0), shift);
let [Action::Exec(_, params)] = acts.as_slice() else { panic!("{acts:?}") };
assert!(params["toward"][0].as_f64().is_some_and(|x| (x - 300.0).abs() < 1e-9), "{params}");
// With Alt, from the second end.
drag(&mut t, &cx, (300.0, 300.0), &[(380.0, 300.0)], Mods::default());
let both = Mods { shift: true, alt: true, ..Mods::default() };
let acts = click_with(&mut t, &cx, (383.0, 250.0), both);
let [Action::Exec(_, params)] = acts.as_slice() else { panic!("{acts:?}") };
assert!(params["toward"][0].as_f64().is_some_and(|x| (x - 380.0).abs() < 1e-9) && params["at"] == "end", "{params}");
}
/// With the `direction` option, the third point gives the direction the arc leaves its first
/// end in, and the tool shows the line from that end to the pointer. Alt moves the direction to
/// the second end. `]` switches the option while the ends are placed, and only then.
#[test]
fn in_direction_mode_the_third_point_sets_the_tangent_at_an_end() {
let (d, _) = doc_with_rect();
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = ThreePointArcTool::default();
assert!(!t.claims_key(&cx, ToolKey::BracketRight), "no ends: ] is left to the app");
t.key(&cx, ToolKey::BracketRight, Mods::default());
assert_eq!(t.options(), json!({ "direction": false }));
drag(&mut t, &cx, (300.0, 300.0), &[(380.0, 300.0)], Mods::default());
assert!(t.claims_key(&cx, ToolKey::BracketRight));
t.key(&cx, ToolKey::BracketRight, Mods::default());
assert_eq!(t.options(), json!({ "direction": true }));
// Straight up the page from (300, 300): the upper half circle about (340, 300).
hover(&mut t, &cx, (300.0, 250.0), Mods::default());
let o = t.overlays(&cx);
let b = preview(&o).expect("the arc");
assert!((b.y0 - 260.0).abs() < 0.1 && (b.y1 - 300.0).abs() < 1e-9, "{b:?}");
// The direction line: solid, from the end it starts at.
let line = |o: &[Overlay], from: Point| o.iter().any(|o| matches!(o, Overlay::Line { a, dashed: false, .. } if *a == from));
assert!(line(&o, Point::new(300.0, 300.0)), "{o:?}");
assert_eq!(click(&mut t, &cx, (300.0, 250.0)), toward((300.0, 300.0), (380.0, 300.0), (300.0, 250.0), "start"));
// Alt: the direction line starts at the second end.
t.set_option("direction", &json!(true));
drag(&mut t, &cx, (300.0, 300.0), &[(380.0, 300.0)], Mods::default());
let alt = Mods { alt: true, ..Mods::default() };
hover(&mut t, &cx, (380.0, 250.0), alt);
assert!(line(&t.overlays(&cx), Point::new(380.0, 300.0)));
assert!(preview(&t.overlays(&cx)).is_some());
assert_eq!(click_with(&mut t, &cx, (380.0, 250.0), alt), toward((300.0, 300.0), (380.0, 300.0), (380.0, 250.0), "end"));
// ] switches back to passing through the third point.
drag(&mut t, &cx, (300.0, 300.0), &[(380.0, 300.0)], Mods::default());
t.key(&cx, ToolKey::BracketRight, Mods::default());
assert_eq!(click(&mut t, &cx, (340.0, 260.0)), through((300.0, 300.0), (380.0, 300.0), (340.0, 260.0)));
}
/// The `direction` option takes a bool; anything else leaves it as it was.
#[test]
fn the_direction_option_takes_a_bool() {
let mut t = ThreePointArcTool::default();
t.set_option("direction", &json!(true));
for v in [json!("false"), json!(0), json!(null)] {
t.set_option("direction", &v);
assert_eq!(t.options(), json!({ "direction": true }), "{v}");
}
t.set_option("direction", &json!(false));
assert_eq!(t.options(), json!({ "direction": false }));
}
/// `]` pressed while the third point is held down places the point as the new mode keeps it: the
/// point Shift kept on the direction line goes back to where the pointer is, and the other way.
#[test]
fn bracket_during_a_press_places_the_third_point_in_the_new_mode() {
let (d, _) = doc_with_rect();
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = ThreePointArcTool::default();
let shift = Mods { shift: true, ..Mods::default() };
t.set_option("direction", &json!(true));
drag(&mut t, &cx, (300.0, 300.0), &[(380.0, 300.0)], Mods::default());
t.pointer(&cx, &ev(PointerKind::Down, (303.0, 250.0), shift));
t.key(&cx, ToolKey::BracketRight, Mods::default());
assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, (303.0, 250.0), shift)), through((300.0, 300.0), (380.0, 300.0), (303.0, 250.0)));
// Through mode first, switched to direction mode during the press: Shift keeps the line upright.
drag(&mut t, &cx, (300.0, 300.0), &[(380.0, 300.0)], Mods::default());
t.pointer(&cx, &ev(PointerKind::Down, (303.0, 250.0), shift));
t.key(&cx, ToolKey::BracketRight, Mods::default());
let acts = t.pointer(&cx, &ev(PointerKind::Up, (303.0, 250.0), shift));
let [Action::Exec(_, params)] = acts.as_slice() else { panic!("{acts:?}") };
assert!(params["toward"][0].as_f64().is_some_and(|x| (x - 300.0).abs() < 1e-9) && params["at"] == "start", "{params}");
}
/// `]` pressed while the pointer hovers moves the third point the tool shows to where the new mode
/// keeps it, so the arc shown is the arc a click there draws.
#[test]
fn bracket_while_hovering_shows_the_third_point_in_the_new_mode() {
let (d, _) = doc_with_rect();
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = ThreePointArcTool::default();
let shift = Mods { shift: true, ..Mods::default() };
drag(&mut t, &cx, (300.0, 300.0), &[(380.0, 300.0)], Mods::default());
hover(&mut t, &cx, (303.0, 250.0), shift);
t.key(&cx, ToolKey::BracketRight, Mods::default());
// The direction line from the first end: Shift keeps it upright.
let start = Point::new(300.0, 300.0);
let line = t.overlays(&cx).into_iter().find_map(|o| match o {
Overlay::Line { a, b, dashed: false, .. } if a == start => Some(b),
_ => None,
});
assert!(line.is_some_and(|b| (b.x - 300.0).abs() < 1e-9), "{line:?}");
let acts = click_with(&mut t, &cx, (303.0, 250.0), shift);
let [Action::Exec(_, params)] = acts.as_slice() else { panic!("{acts:?}") };
assert!(params["toward"][0].as_f64().is_some_and(|x| (x - 300.0).abs() < 1e-9), "{params}");
// Back to through mode while hovering: the point goes back to the pointer.
drag(&mut t, &cx, (300.0, 300.0), &[(380.0, 300.0)], Mods::default());
hover(&mut t, &cx, (303.0, 250.0), shift);
assert!(t.pointer.is_some_and(|q| (q.x - 300.0).abs() < 1e-9), "{:?}", t.pointer);
t.key(&cx, ToolKey::BracketRight, Mods::default());
assert_eq!(t.pointer, Some(Point::new(303.0, 250.0)));
assert_eq!(click_with(&mut t, &cx, (303.0, 250.0), shift), through((300.0, 300.0), (380.0, 300.0), (303.0, 250.0)));
}
/// With Snap to Point, a first press that snaps to the rectangle's corner, 1.5 pt from the
/// pointer, and moves 1.9 pt before it is let go is a click: the drag is measured from the press,
/// not from the corner, so only the first end is placed.
#[test]
fn a_short_move_from_a_snapped_press_is_not_a_drag() {
let (d, _) = doc_with_rect();
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, snap_to_point: true, ..cx(&d, &s, &p) };
let mut t = ThreePointArcTool::default();
t.pointer(&cx, &ev(PointerKind::Down, (201.5, 200.0), Mods::default()));
t.pointer(&cx, &ev(PointerKind::Drag, (203.4, 200.0), Mods::default()));
t.pointer(&cx, &ev(PointerKind::Up, (203.4, 200.0), Mods::default()));
assert_eq!((t.start, t.end), (Some(Point::new(200.0, 200.0)), None));
}
/// A release away from the last drag event places the point where the pointer is let go, for
/// the second end and for the third point.
#[test]
fn a_point_is_placed_where_the_press_is_let_go() {
let (d, _) = doc_with_rect();
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = ThreePointArcTool::default();
let none = Mods::default();
t.pointer(&cx, &ev(PointerKind::Down, (300.0, 300.0), none));
t.pointer(&cx, &ev(PointerKind::Drag, (340.0, 300.0), none));
t.pointer(&cx, &ev(PointerKind::Up, (380.0, 300.0), none));
assert_eq!(t.end, Some(Point::new(380.0, 300.0)));
t.pointer(&cx, &ev(PointerKind::Down, (340.0, 250.0), none));
assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, (340.0, 260.0), none)), through((300.0, 300.0), (380.0, 300.0), (340.0, 260.0)));
// A press that only moves when it is let go still counts as a drag for the ends.
t.pointer(&cx, &ev(PointerKind::Down, (300.0, 300.0), none));
t.pointer(&cx, &ev(PointerKind::Up, (380.0, 300.0), none));
assert_eq!(t.end, Some(Point::new(380.0, 300.0)));
}
/// A release with Shift or Alt changed since the press places the point as the keys at the
/// release keep it, even where the pointer did not move.
#[test]
fn a_release_places_the_point_with_the_keys_held_then() {
let (d, _) = doc_with_rect();
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = ThreePointArcTool::default();
let (none, shift) = (Mods::default(), Mods { shift: true, ..Mods::default() });
// The second end: pressed without Shift, let go with it.
click(&mut t, &cx, (300.0, 300.0));
t.pointer(&cx, &ev(PointerKind::Down, (380.0, 306.0), none));
t.pointer(&cx, &ev(PointerKind::Up, (380.0, 306.0), shift));
assert_eq!(t.end.map(|e| e.y), Some(300.0), "{:?}", t.end);
// The third point in direction mode: pressed with Shift, let go with Shift and Alt, so the
// direction line keeps to 45° steps from the second end.
t.set_option("direction", &json!(true));
let both = Mods { alt: true, ..shift };
t.pointer(&cx, &ev(PointerKind::Down, (303.0, 250.0), shift));
let acts = t.pointer(&cx, &ev(PointerKind::Up, (303.0, 250.0), both));
let [Action::Exec(_, params)] = acts.as_slice() else { panic!("{acts:?}") };
let at = |key: &str, i: usize| params[key][i].as_f64().unwrap_or(f64::NAN);
let (dx, dy) = (at("toward", 0) - at("end", 0), at("toward", 1) - at("end", 1));
assert!(params["at"] == "end" && (dx.abs() - dy.abs()).abs() < 1e-9, "{params}");
}
/// A first click that snaps to the rectangle's corner, 3 pt from the pointer, and is let go with
/// Shift changed places only the first end: a change of keys alone is not a drag.
#[test]
fn a_click_let_go_with_shift_changed_is_not_a_drag() {
let (d, _) = doc_with_rect();
let (s, p) = (Selection::default(), paint());
let cx = cx(&d, &s, &p);
let g = Point::new(200.0, 200.0);
let off = (203.0, 201.0);
let mut t = ThreePointArcTool::default();
t.pointer(&cx, &ev(PointerKind::Down, off, Mods::default()));
t.pointer(&cx, &ev(PointerKind::Up, off, Mods { shift: true, ..Mods::default() }));
assert_eq!((t.start, t.end), (Some(g), None));
}
/// Shift keeps the second end at 45° steps from the first.
#[test]
fn shift_keeps_the_second_end_at_45_degree_steps() {
let (d, _) = doc_with_rect();
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = ThreePointArcTool::default();
let shift = Mods { shift: true, ..Mods::default() };
drag(&mut t, &cx, (300.0, 300.0), &[(340.0, 303.0), (380.0, 306.0)], shift);
assert_eq!(t.end.map(|e| e.y), Some(300.0), "{:?}", t.end);
}
/// Escape, an edit made outside the tool and a dropped press drop the ends; a second click on
/// the first end (a double-click) places nothing.
#[test]
fn escape_history_and_a_double_click_drop_or_keep_the_ends() {
let (d, _) = doc_with_rect();
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = ThreePointArcTool::default();
click(&mut t, &cx, (300.0, 300.0));
assert!(t.claims_key(&cx, ToolKey::Escape));
t.key(&cx, ToolKey::Escape, Mods::default());
assert!(!t.busy() && !t.claims_key(&cx, ToolKey::Escape));
click(&mut t, &cx, (300.0, 300.0));
assert!(click(&mut t, &cx, (300.5, 300.0)).is_empty());
assert_eq!((t.start, t.end), (Some(Point::new(300.0, 300.0)), None), "the double-click's second click places nothing");
click(&mut t, &cx, (380.0, 300.0));
t.history_moved();
assert!(!t.busy());
drag(&mut t, &cx, (300.0, 300.0), &[(380.0, 300.0)], Mods::default());
t.drop_press(&cx);
assert!(!t.busy() && t.overlays(&cx).is_empty());
}
/// The catalog lists the tool in the Line Segment tool's group, after the Arc tool, with no
/// default shortcut, and `create` makes it.
#[test]
fn the_tool_is_in_the_line_segment_group_after_the_arc_tool() {
let group = crate::TOOL_GROUPS.iter().find(|g| g.iter().any(|t| t.id == ID)).expect("in a toolbar group");
let ids: Vec<_> = group.iter().map(|t| t.id).collect();
let arc = ids.iter().position(|id| *id == "arc").expect("the Arc tool's group");
assert_eq!(ids.first(), Some(&"lineSegment"));
assert_eq!(ids.get(arc + 1), Some(&ID));
let info = crate::tool_info(ID).expect("catalogued");
assert_eq!((info.label, info.shortcut), ("Three-Point Arc Tool", None));
assert_eq!(crate::create(ID).id(), ID);
}
+2
View File
@@ -150,6 +150,7 @@ mod text_export;
pub mod text_import;
mod three_d_classic;
pub(crate) mod three_d_materials;
pub mod three_point_arc_options;
mod tiff_bmp_tga;
pub mod tile_edge_color;
mod tools;
@@ -471,6 +472,7 @@ registry! {
FreehandOptions: [freehand::KIND] => freehand::SPEC,
ShapeBuilderOptions: [shape_builder_options::KIND] => shape_builder_options::SPEC,
ObjectsOnPathOptions: [objects_on_path_options::KIND] => objects_on_path_options::SPEC,
ThreePointArcOptions: [three_point_arc_options::KIND] => three_point_arc_options::SPEC,
FlareOptions: [flare_options::KIND] => flare_options::SPEC,
SymbolOptions: [symbol_options::KIND] => symbol_options::SPEC,
DeleteSymbol: [symbol_delete::KIND] => symbol_delete::SPEC,
@@ -0,0 +1,84 @@
//! Three-Point Arc Tool Options (double-click the Three-Point Arc tool, or `tool.options`):
//! Third Point Sets Direction, the tool's `direction` option. With it on, the third point gives the
//! direction the arc leaves an end in; with it off, the arc passes through the third point. OK
//! sets it with `tool.setOption {tool: "threePointArc", values: {direction}}`; it lasts across
//! tool switches and is saved with the preferences. `]` also switches it while an arc is drawn.
use serde_json::{Map, Value, json};
use vectorcraft_tools::three_point_arc::ID as TOOL;
use super::{DialogSpec, run_and_close};
use crate::state::Dialog;
use crate::{VectorcraftApp, widgets};
/// The dialog kind of Three-Point Arc Tool Options.
pub const KIND: &str = "threePointArcOptions";
pub(super) const SPEC: DialogSpec = DialogSpec { heading, body, confirm, min_width: 280.0, ..DialogSpec::FORM };
fn heading(_: &Dialog) -> String {
let label = vectorcraft_tools::tool_info(TOOL).map_or("", |t| t.label);
crate::i18n::fmt(tl!("{tool} Options"), &[("tool", tl!(label))])
}
/// Open the tool's options with their current values.
pub fn open(app: &mut VectorcraftApp) -> Value {
let on = app.session.tool_options_of(TOOL).get("direction").and_then(Value::as_bool).unwrap_or(false);
let mut fields = Map::new();
fields.insert("direction".into(), json!(on));
app.ui.dialog = Some(Dialog { kind: KIND.into(), fields });
json!({ "dialog": KIND })
}
fn body(_app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
let on = d.bool("direction");
if widgets::check(ui, tl!("Third Point Sets Direction"), on, true) {
d.fields.insert("direction".into(), json!(!on));
}
false
}
/// OK: set the tool's `direction`.
fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
run_and_close(app, "tool.setOption", json!({ "tool": TOOL, "values": { "direction": d.bool("direction") } }))
}
#[cfg(test)]
mod tests {
use super::*;
use vectorcraft_engine::Session;
fn app() -> VectorcraftApp {
let mut app = VectorcraftApp::new(Session::new(), Default::default());
app.run("file.new", json!({"width": 400, "height": 400})).unwrap();
app
}
/// The labels the open dialog paints.
fn painted(app: &mut VectorcraftApp) -> String {
crate::tests_labels::painted_text(app, |app, ui| super::super::show(app, ui.ctx()))
}
#[test]
fn double_clicking_the_tool_opens_its_options_and_ok_sets_the_direction() {
let mut app = app();
assert_eq!(app.session.tool_options_of(TOOL)["direction"], json!(false));
let r = app.run("tool.options", json!({"tool": TOOL})).unwrap();
assert_eq!(r["dialog"], json!(KIND));
let text = painted(&mut app);
for label in ["Three-Point Arc Tool Options", "Third Point Sets Direction", "OK", "Cancel"] {
assert!(text.contains(label), "{label} in {text}");
}
let d = app.ui.dialog.as_mut().unwrap();
assert!(!d.bool("direction"));
d.fields.insert("direction".into(), json!(true));
super::super::confirm(&mut app).unwrap();
assert!(app.ui.dialog.is_none());
assert_eq!(app.session.tool_options_of(TOOL)["direction"], json!(true));
// It lasts while another tool is chosen, and the dialog opens on it again.
app.select_tool(TOOL);
app.select_tool("selection");
app.run("tool.options", json!({"tool": TOOL})).unwrap();
assert!(app.ui.dialog.as_ref().unwrap().bool("direction"));
}
}
+8
View File
@@ -224,6 +224,10 @@ font-technology Variable Променливи
Arc Дъга
Arc Lower… Дъга надолу…
Arc Tool Инструмент „Дъга“
Three-Point Arc Tool Инструмент „Дъга през три точки“
Three-Point Arc Дъга през три точки
Arc too large Дъгата е твърде голяма
Third Point Sets Direction Третата точка задава посоката
Arc Upper… Дъга нагоре…
Arch… Извиване…
Arc… Дъга…
@@ -7882,6 +7886,10 @@ breakText Glyphs Глифи
@msg A joint does not close by {gap} pt. Една връзка не се затваря с {gap} pt.
@msg Two panels pass through each other. Два панела минават един през друг.
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer трябва да е "singleLine", "everyLine", "standardSingleLine" или "standardEveryLine"
@msg `at` must be "start" or "end" `at` трябва да е "start" или "end"
@msg give exactly one of `through` and `toward` посочете точно едно от `through` и `toward`
@msg no arc fits these points: two are the same or all three lie on one line няма дъга през тези точки: две съвпадат или и трите лежат на една права
@msg give `at` only with `toward` задайте `at` само заедно с `toward`
Engraving Гравюра
Fine Hatching Фино щриховане
Dense Hatching Гъсто щриховане
Can't render this file because it is too large.
+8
View File
@@ -1506,6 +1506,10 @@ lighting Light Svjetlo
Add Anchor Point Tool Alat za dodavanje sidrene tačke
Anchor Point Tool Alat sidrena tačka
Arc Tool Alat luk
Three-Point Arc Tool Alat luk kroz tri tačke
Three-Point Arc Luk kroz tri tačke
Arc too large Luk je prevelik
Third Point Sets Direction Treća tačka određuje smjer
Area Graph Tool Alat za površinski grafikon
Area Type Tool Alat za tekst u području
Artboard Tool Alat radna ploča
@@ -7937,6 +7941,10 @@ shape Open Otvoren
@msg A joint does not close by {gap} pt. Spoj se ne zatvara za {gap} pt.
@msg Two panels pass through each other. Dva panela prolaze jedan kroz drugi.
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer mora biti "singleLine", "everyLine", "standardSingleLine" ili "standardEveryLine"
@msg `at` must be "start" or "end" `at` mora biti "start" ili "end"
@msg give exactly one of `through` and `toward` navedite tačno jedno od `through` i `toward`
@msg no arc fits these points: two are the same or all three lie on one line nijedan luk ne odgovara ovim tačkama: dvije su iste ili sve tri leže na jednoj pravoj
@msg give `at` only with `toward` navedite `at` samo uz `toward`
Engraving Gravura
Fine Hatching Fino šrafiranje
Dense Hatching Gusto šrafiranje
Can't render this file because it contains an unexpected character in line 2 and column 73.
+8
View File
@@ -345,6 +345,10 @@ antiAlias Sharp Nítid
Arc Lower… Arc inferior…
Arc Segment Tool Options Opcions de l’eina de segment d’arc
Arc Tool Eina d’arc
Three-Point Arc Tool Eina d’arc per tres punts
Three-Point Arc Arc per tres punts
Arc too large Arc massa gran
Third Point Sets Direction El tercer punt indica la direcció
Arc Upper… Arc superior…
Arch… Arqueja…
Arc… Arc…
@@ -6799,6 +6803,10 @@ liquify-list-end {0}, {1} {0} i {1}
@msg a guide has no curvature circle una guia no té cercle de curvatura
@msg the circle that matches the path there would reach past the canvas el cercle que coincideix amb el traçat en aquest punt sortiria del llenç
@msg no circle passes through these points: two are the same or all three lie on one line cap cercle no passa per aquests punts: dos són iguals o tots tres són en una mateixa recta
@msg `at` must be "start" or "end" `at` ha de ser "start" o "end"
@msg give exactly one of `through` and `toward` indiqueu exactament un de `through` i `toward`
@msg no arc fits these points: two are the same or all three lie on one line cap arc no s’ajusta a aquests punts: dos són iguals o tots tres són en una mateixa recta
@msg give `at` only with `toward` indiqueu `at` només amb `toward`
@msg no app to open files here aquí no hi ha cap aplicació per obrir fitxers
@msg no artboard no hi ha tauler
@msg no artboard {i} (0-based; the document has {_1}) no hi ha el tauler {i} (basat en 0; el document en té {_1})
Can't render this file because it is too large.
+8
View File
@@ -1531,6 +1531,10 @@ lighting Light Světlo
Add Anchor Point Tool Nástroj Přidat kotevní bod
Anchor Point Tool Nástroj Kotevní bod
Arc Tool Nástroj Oblouk
Three-Point Arc Tool Nástroj Oblouk třemi body
Three-Point Arc Oblouk třemi body
Arc too large Oblouk je příliš velký
Third Point Sets Direction Třetí bod určuje směr
Area Graph Tool Nástroj Plošný graf
Area Type Tool Nástroj Text v oblasti
Artboard Tool Nástroj Pracovní plocha
@@ -5685,6 +5689,10 @@ liquify-list-end {0}, {1} {0} a {1}
@msg a guide has no curvature circle vodítko nemá kružnici křivosti
@msg the circle that matches the path there would reach past the canvas kružnice odpovídající cestě v tomto místě by přesáhla plátno
@msg no circle passes through these points: two are the same or all three lie on one line těmito body neprochází žádná kružnice: dva jsou stejné nebo všechny tři leží na jedné přímce
@msg `at` must be "start" or "end" `at` musí být "start" nebo "end"
@msg give exactly one of `through` and `toward` zadejte právě jeden z parametrů `through` a `toward`
@msg no arc fits these points: two are the same or all three lie on one line těmto bodům neodpovídá žádný oblouk: dva jsou stejné nebo všechny tři leží na jedné přímce
@msg give `at` only with `toward` parametr `at` zadejte jen s `toward`
@msg no app to open files here zde chybí aplikace pro otevírání souborů
@msg no artboard žádná pracovní plocha
@msg no artboard {i} (0-based; the document has {_1}) pracovní plocha {i} neexistuje (číslováno od 0; dokument jich má {_1})
Can't render this file because it is too large.
+8
View File
@@ -4184,6 +4184,10 @@ lighting Light Lys
Add Anchor Point Tool Tilføj ankerpunkt-værktøj
Anchor Point Tool Ankerpunktværktøj
Arc Tool Bueværktøj
Three-Point Arc Tool Værktøj til bue gennem tre punkter
Three-Point Arc Bue gennem tre punkter
Arc too large Buen er for stor
Third Point Sets Direction Tredje punkt angiver retningen
Area Graph Tool Områdediagramværktøj
Area Type Tool Områdetekstværktøj
Artboard Tool Tegnebrætværktøj
@@ -7881,6 +7885,10 @@ imageTrace Outline Kontur
@msg a guide has no curvature circle en hjælpelinje har ingen krumningscirkel
@msg the circle that matches the path there would reach past the canvas cirklen, der passer til kurven der, ville gå ud over lærredet
@msg no circle passes through these points: two are the same or all three lie on one line ingen cirkel går gennem disse punkter: to er ens, eller alle tre ligger på én linje
@msg `at` must be "start" or "end" `at` skal være "start" eller "end"
@msg give exactly one of `through` and `toward` angiv præcis én af `through` og `toward`
@msg no arc fits these points: two are the same or all three lie on one line ingen bue passer til disse punkter: to er ens, eller alle tre ligger på én linje
@msg give `at` only with `toward` angiv kun `at` sammen med `toward`
@msg no app to open files here ingen app til at åbne filer her
@msg no artboard ingen tegneflade
@msg no artboard {i} (0-based; the document has {_1}) ingen tegneflade {i} (0-baseret; dokumentet har {_1})
Can't render this file because it is too large.
+8
View File
@@ -215,6 +215,10 @@ font-technology Variable Variabel
Arc Bogen
Arc Lower… Bogen unten…
Arc Tool Bogen-Werkzeug
Three-Point Arc Tool Dreipunkt-Bogen-Werkzeug
Three-Point Arc Dreipunkt-Bogen
Arc too large Bogen zu groß
Third Point Sets Direction Dritter Punkt gibt die Richtung an
Arc Upper… Bogen oben…
Arch… Torbogen…
Arc… Bogen…
@@ -5261,6 +5265,10 @@ liquify-list-end {0}, {1} {0} und {1}
@msg a guide has no curvature circle eine Hilfslinie hat keinen Krümmungskreis
@msg the circle that matches the path there would reach past the canvas der Kreis, der dort zum Pfad passt, würde über die Arbeitsfläche hinausreichen
@msg no circle passes through these points: two are the same or all three lie on one line durch diese Punkte verläuft kein Kreis: zwei sind gleich oder alle drei liegen auf einer Linie
@msg `at` must be "start" or "end" `at` muss „start“ oder „end“ sein
@msg give exactly one of `through` and `toward` geben Sie genau eines von `through` und `toward` an
@msg no arc fits these points: two are the same or all three lie on one line zu diesen Punkten passt kein Bogen: zwei sind gleich oder alle drei liegen auf einer Linie
@msg give `at` only with `toward` geben Sie `at` nur zusammen mit `toward` an
@msg no app to open files here hier gibt es keine App zum Öffnen von Dateien
@msg no artboard keine Zeichenfläche
@msg no artboard {i} (0-based; the document has {_1}) keine Zeichenfläche {i} (Zählung ab 0; das Dokument hat {_1})
Can't render this file because it is too large.
+8
View File
@@ -217,6 +217,10 @@ font-technology Variable Μεταβλητές
Arc Τόξο
Arc Lower… Κάτω τόξο…
Arc Tool Τόξο (Arc Tool)
Three-Point Arc Tool Εργαλείο τόξου τριών σημείων
Three-Point Arc Τόξο τριών σημείων
Arc too large Το τόξο είναι πολύ μεγάλο
Third Point Sets Direction Το τρίτο σημείο ορίζει την κατεύθυνση
Arc Upper… Πάνω τόξο…
Arch… Αψίδα…
Arc… Τόξο…
@@ -5322,6 +5326,10 @@ digits Malayalam Μαλαγιάλαμ
@msg a guide has no curvature circle ένας οδηγός δεν έχει κύκλο καμπυλότητας
@msg the circle that matches the path there would reach past the canvas ο κύκλος που ταιριάζει με τη διαδρομή εκεί θα υπερέβαινε τον καμβά
@msg no circle passes through these points: two are the same or all three lie on one line κανένας κύκλος δεν περνά από αυτά τα σημεία: δύο είναι ίδια ή και τα τρία βρίσκονται σε μία ευθεία
@msg `at` must be "start" or "end" το `at` πρέπει να είναι "start" ή "end"
@msg give exactly one of `through` and `toward` δώστε ακριβώς ένα από τα `through` και `toward`
@msg no arc fits these points: two are the same or all three lie on one line κανένα τόξο δεν ταιριάζει σε αυτά τα σημεία: δύο είναι ίδια ή και τα τρία βρίσκονται σε μία ευθεία
@msg give `at` only with `toward` δώστε το `at` μόνο μαζί με το `toward`
@msg no app to open files here δεν υπάρχει εφαρμογή για άνοιγμα αρχείων εδώ
@msg no artboard δεν υπάρχει πίνακας σχεδίασης
@msg no artboard {i} (0-based; the document has {_1}) δεν υπάρχει πίνακας σχεδίασης {i} (αρίθμηση από 0· το έγγραφο περιέχει {_1})
Can't render this file because it is too large.
+8
View File
@@ -238,6 +238,10 @@ font-technology Variable Variables
Arc Arco
Arc Lower… Arco inferior…
Arc Tool Herramienta Arco
Three-Point Arc Tool Herramienta Arco por tres puntos
Three-Point Arc Arco por tres puntos
Arc too large Arco demasiado grande
Third Point Sets Direction El tercer punto indica la dirección
Arc Upper… Arco superior…
Arch… Arcada…
Arc… Arco…
@@ -5373,6 +5377,10 @@ liquify-list-end {0}, {1} {0}, {1}
@msg a guide has no curvature circle una guía no tiene círculo de curvatura
@msg the circle that matches the path there would reach past the canvas el círculo que coincide con el trazado en ese punto excedería el lienzo
@msg no circle passes through these points: two are the same or all three lie on one line ningún círculo pasa por estos puntos: dos son iguales o los tres están en una misma línea
@msg `at` must be "start" or "end" `at` debe ser "start" o "end"
@msg give exactly one of `through` and `toward` indique exactamente uno de `through` y `toward`
@msg no arc fits these points: two are the same or all three lie on one line ningún arco se ajusta a estos puntos: dos son iguales o los tres están en una misma línea
@msg give `at` only with `toward` indique `at` solo junto con `toward`
@msg no app to open files here aquí no hay ninguna aplicación para abrir archivos
@msg no artboard no hay mesa de trabajo
@msg no artboard {i} (0-based; the document has {_1}) no existe la mesa de trabajo {i} (contando desde 0; el documento tiene {_1})
Can't render this file because it is too large.
+8
View File
@@ -1502,6 +1502,10 @@ lighting Light Valo
Add Anchor Point Tool Lisää ankkuripiste -työkalu
Anchor Point Tool Ankkuripistetyökalu
Arc Tool Kaarityökalu
Three-Point Arc Tool Kolmen pisteen kaaren työkalu
Three-Point Arc Kolmen pisteen kaari
Arc too large Kaari on liian suuri
Third Point Sets Direction Kolmas piste määrää suunnan
Area Graph Tool Aluekaaviotyökalu
Area Type Tool Aluetekstityökalu
Artboard Tool Piirtoalustatyökalu
@@ -5606,6 +5610,10 @@ liquify-list-end {0}, {1} {0} ja {1}
@msg a guide has no curvature circle apuviivalla ei ole kaarevuusympyrää
@msg the circle that matches the path there would reach past the canvas ympyrä, joka vastaa polkua siinä kohdassa, ylittäisi kankaan
@msg no circle passes through these points: two are the same or all three lie on one line näiden pisteiden kautta ei kulje ympyrää: kaksi pisteistä on samoja tai kaikki kolme ovat samalla suoralla
@msg `at` must be "start" or "end" `at` on oltava "start" tai "end"
@msg give exactly one of `through` and `toward` anna täsmälleen yksi parametreista `through` ja `toward`
@msg no arc fits these points: two are the same or all three lie on one line näihin pisteisiin ei sovi kaarta: kaksi pisteistä on samoja tai kaikki kolme ovat samalla suoralla
@msg give `at` only with `toward` anna `at` vain yhdessä parametrin `toward` kanssa
@msg no app to open files here täällä ei ole sovellusta tiedostojen avaamiseen
@msg no artboard ei piirtoalustaa
@msg no artboard {i} (0-based; the document has {_1}) ei piirtoalustaa {i} (0-pohjainen; asiakirjassa on {_1})
Can't render this file because it is too large.
+8
View File
@@ -239,6 +239,10 @@ font-technology Variable Variables
Arc Arc
Arc Lower… Arc inférieur…
Arc Tool Outil Arc
Three-Point Arc Tool Outil Arc par trois points
Three-Point Arc Arc par trois points
Arc too large Arc trop grand
Third Point Sets Direction Le troisième point indique la direction
Arc Upper… Arc supérieur…
Arch… Arche…
Arc… Arc…
@@ -5332,6 +5336,10 @@ liquify-list-end {0}, {1} {0} et {1}
@msg a guide has no curvature circle un repère n’a pas de cercle de courbure
@msg the circle that matches the path there would reach past the canvas le cercle qui correspond au tracé à cet endroit dépasserait la zone de travail
@msg no circle passes through these points: two are the same or all three lie on one line aucun cercle ne passe par ces points : deux sont identiques ou les trois sont alignés
@msg `at` must be "start" or "end" `at` doit valoir "start" ou "end"
@msg give exactly one of `through` and `toward` indiquez exactement un seul de `through` et `toward`
@msg no arc fits these points: two are the same or all three lie on one line aucun arc ne correspond à ces points : deux sont identiques ou les trois sont alignés
@msg give `at` only with `toward` indiquez `at` uniquement avec `toward`
@msg no app to open files here aucune application pour ouvrir des fichiers ici
@msg no artboard aucun plan de travail
@msg no artboard {i} (0-based; the document has {_1}) aucun plan de travail {i} (numérotation à partir de 0 ; le document en a {_1})
Can't render this file because it is too large.
+8
View File
@@ -283,6 +283,10 @@
Arc Lower… નીચે આર્ક…
Arc Segment Tool Options આર્ક સેગમેન્ટ ટૂલ વિકલ્પો
Arc Tool આર્ક ટૂલ
Three-Point Arc Tool ત્રણ-પૉઇન્ટ આર્ક ટૂલ
Three-Point Arc ત્રણ-પૉઇન્ટ આર્ક
Arc too large આર્ક ખૂબ મોટો છે
Third Point Sets Direction ત્રીજો પૉઇન્ટ દિશા નક્કી કરે છે
Arc Upper… ઉપર આર્ક…
Arch… કમાન…
Arc… આર્ક…
@@ -5630,6 +5634,10 @@ swatch [Registration] [રજિસ્ટ્રેશન]
Standard Single-line Composer સ્ટાન્ડર્ડ સિંગલ-લાઇન કમ્પોઝર
Standard Every-line Composer સ્ટાન્ડર્ડ એવરી-લાઇન કમ્પોઝર
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer આમાંથી એક હોવું જોઈએ: "singleLine", "everyLine", "standardSingleLine" અથવા "standardEveryLine"
@msg `at` must be "start" or "end" `at` "start" અથવા "end" હોવું જોઈએ
@msg give exactly one of `through` and `toward` `through` અને `toward` માંથી બરાબર એક આપો
@msg no arc fits these points: two are the same or all three lie on one line આ પૉઇન્ટ્સમાં કોઈ આર્ક બેસતો નથી: બે એકસરખા છે અથવા ત્રણેય એક જ રેખા પર છે
@msg give `at` only with `toward` `at` ફક્ત `toward` સાથે જ આપો
Engraving કોતરણી
Fine Hatching ઝીણી રેખાઓ
Dense Hatching ગાઢ રેખાઓ
Can't render this file because it contains an unexpected character in line 72 and column 5.
+8
View File
@@ -398,6 +398,10 @@ antiAlias Sharp शार्प
Arc Lower… निचला आर्क…
Arc Segment Tool Options आर्क सेगमेंट टूल ऑप्शन्स
Arc Tool आर्क टूल
Three-Point Arc Tool थ्री-पॉइंट आर्क टूल
Three-Point Arc थ्री-पॉइंट आर्क
Arc too large आर्क बहुत बड़ा है
Third Point Sets Direction तीसरा पॉइंट दिशा तय करता है
Arc Upper… ऊपरी आर्क…
Arc… आर्क…
Arch… मेहराब…
@@ -8302,6 +8306,10 @@ liquify-list-end {0}, {1} {0} और {1}
@msg a guide has no curvature circle गाइड का कोई वक्रता वृत्त नहीं होता
@msg the circle that matches the path there would reach past the canvas वहाँ पाथ से मेल खाने वाला वृत्त कैनवास से बाहर चला जाएगा
@msg no circle passes through these points: two are the same or all three lie on one line इन पॉइंट्स से होकर कोई वृत्त नहीं गुज़रता: दो एक जैसे हैं या तीनों एक ही रेखा पर हैं
@msg `at` must be "start" or "end" `at` को "start" या "end" होना चाहिए।
@msg give exactly one of `through` and `toward` `through` और `toward` में से ठीक एक दें
@msg no arc fits these points: two are the same or all three lie on one line इन पॉइंट्स पर कोई आर्क फ़िट नहीं होता: दो एक जैसे हैं या तीनों एक ही रेखा पर हैं
@msg give `at` only with `toward` `at` केवल `toward` के साथ दें
@msg no app to open files here यहां फ़ाइलों को ओपन करने के लिए कोई ऐप नहीं है
@msg no appearance item {index} कोई उपस्थिति आइटम {index}
@msg no artboard कोई आर्टबोर्ड नहीं
Can't render this file because it is too large.
+8
View File
@@ -322,6 +322,10 @@ font-technology Variable Változó
Arc Ív
Arc Lower… Alsó ív…
Arc Tool Ív
Three-Point Arc Tool Hárompontos ív eszköz
Three-Point Arc Hárompontos ív
Arc too large Az ív túl nagy
Third Point Sets Direction A harmadik pont adja meg az irányt
Arc Upper… Felső ív…
Arch… Boltív…
Arc… Ív…
@@ -6060,6 +6064,10 @@ liquify-list-end {0}, {1} {0} és {1}
@msg a guide has no curvature circle a segédvonalnak nincs görbületi köre
@msg the circle that matches the path there would reach past the canvas az útvonalhoz ott illeszkedő kör túlnyúlna a vásznon
@msg no circle passes through these points: two are the same or all three lie on one line ezeken a pontokon nem halad át kör: kettő egybeesik, vagy mindhárom egy egyenesen van
@msg `at` must be "start" or "end" `at`: "start" vagy "end" kell
@msg give exactly one of `through` and `toward` pontosan egyet adjon meg a `through` és a `toward` közül
@msg no arc fits these points: two are the same or all three lie on one line ezekre a pontokra nem illeszkedik ív: kettő egybeesik, vagy mindhárom egy egyenesen van
@msg give `at` only with `toward` az `at` csak a `toward` mellett adható meg
@msg no app to open files here itt nincs fájlmegnyitó alkalmazás
@msg no artboard nincs rajztábla
@msg no artboard {i} (0-based; the document has {_1}) nincs ilyen sorszámú rajztábla: {i} (0-tól számozva; a dokumentumban ennyi van: {_1})
Can't render this file because it is too large.
+8
View File
@@ -2061,6 +2061,10 @@ lighting Light Cahaya
Add Anchor Point Tool Alat tambah titik jangkar
Anchor Point Tool Alat titik jangkar
Arc Tool Alat busur
Three-Point Arc Tool Alat busur tiga titik
Three-Point Arc Busur tiga titik
Arc too large Busur terlalu besar
Third Point Sets Direction Titik ketiga menentukan arah
Area Graph Tool Alat grafik area
Area Type Tool Alat teks area
Artboard Tool Alat artboard
@@ -8580,6 +8584,10 @@ breakText Glyphs Glif
@msg A joint does not close by {gap} pt. Sebuah sambungan tidak menutup sejauh {gap} pt.
@msg Two panels pass through each other. Dua panel saling menembus.
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer harus "singleLine", "everyLine", "standardSingleLine", atau "standardEveryLine"
@msg `at` must be "start" or "end" `at` harus "start" atau "end"
@msg give exactly one of `through` and `toward` berikan tepat satu dari `through` dan `toward`
@msg no arc fits these points: two are the same or all three lie on one line tidak ada busur yang cocok dengan titik-titik ini: dua titik sama atau ketiganya segaris
@msg give `at` only with `toward` berikan `at` hanya bersama `toward`
Engraving Ukiran
Fine Hatching Arsiran halus
Dense Hatching Arsiran rapat
Can't render this file because it is too large.
+8
View File
@@ -240,6 +240,10 @@ font-technology Variable Variabili
Arc Arco
Arc Lower… Arco inferiore…
Arc Tool Strumento Arco
Three-Point Arc Tool Strumento Arco per tre punti
Three-Point Arc Arco per tre punti
Arc too large Arco troppo grande
Third Point Sets Direction Il terzo punto indica la direzione
Arc Upper… Arco superiore…
Arch… Arcata…
Arc… Arco…
@@ -5399,6 +5403,10 @@ liquify-list-end {0}, {1} {0} e {1}
@msg a guide has no curvature circle una guida non ha un cerchio di curvatura
@msg the circle that matches the path there would reach past the canvas il cerchio che corrisponde al tracciato in quel punto supererebbe l'area di lavoro
@msg no circle passes through these points: two are the same or all three lie on one line nessun cerchio passa per questi punti: due coincidono oppure tutti e tre sono allineati
@msg `at` must be "start" or "end" `at` deve essere "start" o "end"
@msg give exactly one of `through` and `toward` indicare esattamente uno tra `through` e `toward`
@msg no arc fits these points: two are the same or all three lie on one line nessun arco si adatta a questi punti: due coincidono oppure tutti e tre sono allineati
@msg give `at` only with `toward` indicare `at` solo insieme a `toward`
@msg no app to open files here nessuna app per aprire file qui
@msg no artboard nessuna tavola da disegno
@msg no artboard {i} (0-based; the document has {_1}) nessuna tavola da disegno {i} (a partire da 0; il documento ne ha {_1})
Can't render this file because it is too large.
+8
View File
@@ -1236,6 +1236,10 @@ antiAlias Sharp シャープ
@plural Apply to All ({n} more missing)|Apply to All ({n} more missing) すべてに適用 (ほかに {n} 個が見つかりません)
Arc 円弧
Arc Tool 円弧ツール
Three-Point Arc Tool 3 点円弧ツール
Three-Point Arc 3 点円弧
Arc too large 円弧が大きすぎます
Third Point Sets Direction 3 点目で方向を指定
Area / Path Type エリア内文字/パス上文字
Area Graph Tool 面グラフツール
Area Type Tool エリア内文字ツール
@@ -5164,6 +5168,10 @@ variable-list-end {0}, {1} {0}、{1}
@msg a guide has no curvature circle ガイドには曲率円がありません
@msg the circle that matches the path there would reach past the canvas その位置でパスに合う円はキャンバスからはみ出します
@msg no circle passes through these points: two are the same or all three lie on one line これらの点を通る円はありません: 2 つの点が同じか、3 点すべてが一直線上にあります
@msg `at` must be "start" or "end" `at` には "start" または "end" を指定してください
@msg give exactly one of `through` and `toward` `through` と `toward` のどちらか一方だけを指定してください
@msg no arc fits these points: two are the same or all three lie on one line これらの点に合う円弧はありません: 2 つの点が同じか、3 点すべてが一直線上にあります
@msg give `at` only with `toward` `at` は `toward` と一緒にだけ指定してください
@msg select at least two objects オブジェクトを 2 つ以上選択してください
@msg exit isolation mode first 先に分離モードを終了してください
@msg no saved presets 保存したプリセットはありません
Can't render this file because it is too large.
+8
View File
@@ -3585,6 +3585,10 @@ lighting Light სინათლე
Add Anchor Point Tool საყრდენი წერტილის დამატების ხელსაწყო
Anchor Point Tool საყრდენი წერტილის ხელსაწყო
Arc Tool რკალის ხელსაწყო
Three-Point Arc Tool სამწერტილიანი რკალის ხელსაწყო
Three-Point Arc სამწერტილიანი რკალი
Arc too large რკალი ზედმეტად დიდია
Third Point Sets Direction მესამე წერტილი მიმართულებას განსაზღვრავს
Area Graph Tool ფართობითი დიაგრამის ხელსაწყო
Area Type Tool არის ტექსტის ხელსაწყო
Artboard Tool სამუშაო დაფის ხელსაწყო
@@ -7140,6 +7144,10 @@ font-technology Variable ცვლადი
@msg a guide has no curvature circle დამხმარე ხაზს სიმრუდის წრე არ აქვს
@msg the circle that matches the path there would reach past the canvas წრეწირი, რომელიც იქ ტრაექტორიას შეესაბამება, ტილოს გასცდებოდა
@msg no circle passes through these points: two are the same or all three lie on one line ამ წერტილებზე წრეწირი არ გადის: ორი ერთნაირია ან სამივე ერთ წრფეზე მდებარეობს
@msg `at` must be "start" or "end" `at` უნდა იყოს "start" ან "end"
@msg give exactly one of `through` and `toward` მიუთითეთ ზუსტად ერთი: `through` ან `toward`
@msg no arc fits these points: two are the same or all three lie on one line ამ წერტილებს რკალი არ ერგება: ორი ერთნაირია ან სამივე ერთ წრფეზე მდებარეობს
@msg give `at` only with `toward` `at` მიუთითეთ მხოლოდ `toward`-თან ერთად
@msg no app to open files here აქ ფაილების გასახსნელი აპი არ არის
@msg no artboard სამუშაო დაფა არ არის
@msg no artboard {i} (0-based; the document has {_1}) სამუშაო დაფა {i} არ არსებობს (0-დან ითვლება; დოკუმენტს აქვს {_1})
Can't render this file because it is too large.
+8
View File
@@ -1226,6 +1226,10 @@ antiAlias Sharp 날카롭게
@plural Apply to All ({n} more missing)|Apply to All ({n} more missing) 모두에 적용(누락 {n}개 더 있음)
Arc 호
Arc Tool 호 도구
Three-Point Arc Tool 3점 호 도구
Three-Point Arc 3점 호
Arc too large 호가 너무 큽니다
Third Point Sets Direction 세 번째 점으로 방향 지정
Area / Path Type 영역/패스 문자
Area Graph Tool 영역 그래프 도구
Area Type Tool 영역 문자 도구
@@ -5093,6 +5097,10 @@ variable-list-end {0}, {1} {0} 및 {1}
@msg a guide has no curvature circle 안내선에는 곡률원이 없습니다
@msg the circle that matches the path there would reach past the canvas 그 위치에서 패스에 맞는 원이 캔버스를 벗어납니다
@msg no circle passes through these points: two are the same or all three lie on one line 이 점들을 지나는 원이 없습니다: 두 점이 같거나 세 점이 모두 한 직선 위에 있습니다
@msg `at` must be "start" or "end" `at`은(는) "start" 또는 "end"여야 합니다
@msg give exactly one of `through` and `toward` `through`와 `toward` 중 정확히 하나만 지정하세요
@msg no arc fits these points: two are the same or all three lie on one line 이 점들에 맞는 호가 없습니다: 두 점이 같거나 세 점이 모두 한 직선 위에 있습니다
@msg give `at` only with `toward` `at`은(는) `toward`와 함께만 지정하세요
@msg select at least two objects 개체를 두 개 이상 선택하세요
@msg exit isolation mode first 먼저 격리 모드를 종료하세요
@msg no saved presets 저장된 프리셋이 없습니다
Can't render this file because it is too large.
+8
View File
@@ -2053,6 +2053,10 @@ lighting Light Licht
Add Anchor Point Tool Ankerpunt toevoegen
Anchor Point Tool Ankerpunt-gereedschap
Arc Tool Boog-gereedschap
Three-Point Arc Tool Driepuntsboog-gereedschap
Three-Point Arc Driepuntsboog
Arc too large Boog te groot
Third Point Sets Direction Derde punt geeft de richting aan
Area Graph Tool Vlakdiagram-gereedschap
Area Type Tool Vlaktype-gereedschap
Artboard Tool Tekengebied-gereedschap
@@ -5757,6 +5761,10 @@ imageTrace Outline Contour
@msg a guide has no curvature circle een hulplijn heeft geen krommingscirkel
@msg the circle that matches the path there would reach past the canvas de cirkel die daar bij het pad past, zou voorbij het canvas reiken
@msg no circle passes through these points: two are the same or all three lie on one line er gaat geen cirkel door deze punten: twee zijn gelijk of alle drie liggen op één lijn
@msg `at` must be "start" or "end" `at` moet "start" of "end" zijn
@msg give exactly one of `through` and `toward` geef precies één van `through` en `toward`
@msg no arc fits these points: two are the same or all three lie on one line er past geen boog bij deze punten: twee zijn gelijk of alle drie liggen op één lijn
@msg give `at` only with `toward` geef `at` alleen samen met `toward`
@msg no app to open files here hier is geen app om bestanden mee te openen
@msg no artboard geen tekengebied
@msg no artboard {i} (0-based; the document has {_1}) geen tekengebied {i} (vanaf 0; het document heeft er {_1})
Can't render this file because it is too large.
+8
View File
@@ -1457,6 +1457,10 @@ lighting Light Światło
Add Anchor Point Tool Narzędzie Dodaj punkt kontrolny
Anchor Point Tool Narzędzie Punkt kontrolny
Arc Tool Narzędzie Łuk
Three-Point Arc Tool Narzędzie Łuk przez trzy punkty
Three-Point Arc Łuk przez trzy punkty
Arc too large Łuk jest za duży
Third Point Sets Direction Trzeci punkt wyznacza kierunek
Area Graph Tool Narzędzie Wykres warstwowy
Area Type Tool Narzędzie Tekst akapitowy
Artboard Tool Narzędzie Obszar kompozycji
@@ -5502,6 +5506,10 @@ liquify-list-end {0}, {1} {0} i {1}
@msg a guide has no curvature circle linia pomocnicza nie ma okręgu krzywizny
@msg the circle that matches the path there would reach past the canvas okrąg pasujący w tym miejscu do ścieżki wykroczyłby poza płótno
@msg no circle passes through these points: two are the same or all three lie on one line przez te punkty nie przechodzi żaden okrąg: dwa są takie same albo wszystkie trzy leżą na jednej prostej
@msg `at` must be "start" or "end" `at` musi mieć wartość "start" lub "end"
@msg give exactly one of `through` and `toward` podaj dokładnie jeden z parametrów `through` i `toward`
@msg no arc fits these points: two are the same or all three lie on one line żaden łuk nie pasuje do tych punktów: dwa są takie same albo wszystkie trzy leżą na jednej prostej
@msg give `at` only with `toward` podaj `at` tylko razem z `toward`
@msg no app to open files here brak aplikacji do otwierania plików
@msg no artboard brak obszaru kompozycji
@msg no artboard {i} (0-based; the document has {_1}) brak obszaru kompozycji {i} (numeracja od 0; dokument ma {_1})
Can't render this file because it is too large.
+8
View File
@@ -233,6 +233,10 @@ antiAlias Sharp Nítido
Arc Arco
Arc Lower… Arco Inferior…
Arc Tool Ferramenta Arco
Three-Point Arc Tool Ferramenta Arco por três pontos
Three-Point Arc Arco por três pontos
Arc too large Arco grande demais
Third Point Sets Direction O terceiro ponto indica a direção
Arc Upper… Arco Superior…
Arch… Abóbada…
Arc… Arco…
@@ -4647,6 +4651,10 @@ axis Both Ambos
@msg a guide has no curvature circle uma guia não tem círculo de curvatura
@msg the circle that matches the path there would reach past the canvas o círculo que corresponde ao caminho nesse ponto ultrapassaria a tela
@msg no circle passes through these points: two are the same or all three lie on one line nenhum círculo passa por esses pontos: dois são iguais ou os três estão na mesma reta
@msg `at` must be "start" or "end" `at` deve ser "start" ou "end"
@msg give exactly one of `through` and `toward` informe exatamente um entre `through` e `toward`
@msg no arc fits these points: two are the same or all three lie on one line nenhum arco se ajusta a esses pontos: dois são iguais ou os três estão na mesma reta
@msg give `at` only with `toward` informe `at` somente com `toward`
@msg no app to open files here nenhum aplicativo para abrir arquivos aqui
@msg no artboard nenhuma prancheta
@msg no artboard {i} (0-based; the document has {_1}) nenhuma prancheta {i} (base 0; o documento tem {_1})
Can't render this file because it is too large.
+8
View File
@@ -236,6 +236,10 @@ font-technology Variable Вариативные
Arc Дуга
Arc Lower… Дуга снизу…
Arc Tool Инструмент «Дуга»
Three-Point Arc Tool Инструмент «Дуга по трём точкам»
Three-Point Arc Дуга по трём точкам
Arc too large Дуга слишком велика
Third Point Sets Direction Третья точка задаёт направление
Arc Upper… Дуга сверху…
Arch… Арка…
Arc… Дуга…
@@ -5395,6 +5399,10 @@ liquify-list-end {0}, {1} {0} и {1}
@msg a guide has no curvature circle у направляющей нет круга кривизны
@msg the circle that matches the path there would reach past the canvas окружность, соответствующая контуру в этом месте, вышла бы за пределы холста
@msg no circle passes through these points: two are the same or all three lie on one line через эти точки не проходит ни одна окружность: две точки совпадают или все три лежат на одной прямой
@msg `at` must be "start" or "end" `at` должно быть "start" или "end"
@msg give exactly one of `through` and `toward` укажите ровно один из параметров `through` и `toward`
@msg no arc fits these points: two are the same or all three lie on one line ни одна дуга не подходит к этим точкам: две точки совпадают или все три лежат на одной прямой
@msg give `at` only with `toward` указывайте `at` только вместе с `toward`
@msg no app to open files here здесь нет приложения для открытия файлов
@msg no artboard нет монтажной области
@msg no artboard {i} (0-based; the document has {_1}) нет монтажной области {i} (счёт с 0; в документе {_1})
Can't render this file because it is too large.
+8
View File
@@ -227,6 +227,10 @@ font-technology Variable Variabla
Arc Båge
Arc Lower… Nedre båge…
Arc Tool Bågverktyg
Three-Point Arc Tool Verktyg för trepunktsbåge
Three-Point Arc Trepunktsbåge
Arc too large Bågen är för stor
Third Point Sets Direction Tredje punkten anger riktningen
Arc Upper… Övre båge…
Arch… Valv…
Arc… Båge…
@@ -5260,6 +5264,10 @@ liquify-list-end {0}, {1} {0} och {1}
@msg a guide has no curvature circle en stödlinje har ingen krökningscirkel
@msg the circle that matches the path there would reach past the canvas cirkeln som matchar banan där skulle nå utanför arbetsytan
@msg no circle passes through these points: two are the same or all three lie on one line ingen cirkel går genom de här punkterna: två är samma punkt eller så ligger alla tre på en linje
@msg `at` must be "start" or "end" `at` måste vara "start" eller "end"
@msg give exactly one of `through` and `toward` ange exakt en av `through` och `toward`
@msg no arc fits these points: two are the same or all three lie on one line ingen båge passar de här punkterna: två är samma punkt eller så ligger alla tre på en linje
@msg give `at` only with `toward` ange `at` endast tillsammans med `toward`
@msg no app to open files here det finns ingen app för att öppna filer här
@msg no artboard ingen rityta
@msg no artboard {i} (0-based; the document has {_1}) ingen rityta {i} (räknat från 0; dokumentet har {_1})
Can't render this file because it is too large.
+8
View File
@@ -223,6 +223,10 @@ font-technology Variable Değişken
Arc Yay
Arc Lower… Ark Alt…
Arc Tool Yay Aracı
Three-Point Arc Tool Üç Noktalı Yay Aracı
Three-Point Arc Üç Noktalı Yay
Arc too large Yay çok büyük
Third Point Sets Direction Üçüncü Nokta Yönü Belirler
Arc Upper… Ark Üst…
Arch… Kemer…
Arc… Yay…
@@ -5085,6 +5089,10 @@ liquify-list-end {0}, {1} {0} ve {1}
@msg a guide has no curvature circle bir kılavuzun eğrilik çemberi yoktur
@msg the circle that matches the path there would reach past the canvas yolla orada eşleşen çember tuvalin dışına taşardı
@msg no circle passes through these points: two are the same or all three lie on one line bu noktalardan geçen bir çember yok: ikisi aynı ya da üçü de aynı doğru üzerinde
@msg `at` must be "start" or "end" `at` "start" veya "end" olmalıdır
@msg give exactly one of `through` and `toward` `through` ve `toward` değerlerinden tam olarak birini verin
@msg no arc fits these points: two are the same or all three lie on one line bu noktalara uyan bir yay yok: ikisi aynı ya da üçü de aynı doğru üzerinde
@msg give `at` only with `toward` `at` değerini yalnızca `toward` ile birlikte verin
@msg no app to open files here burada dosyaları açacak uygulama yok
@msg no artboard çalışma yüzeyi yok
@msg no artboard {i} (0-based; the document has {_1}) çalışma yüzeyi yok {i} (0 tabanlı; belgede {_1} var)
Can't render this file because it is too large.
+8
View File
@@ -234,6 +234,10 @@ font-technology Variable Варіативні
Arc Дуга
Arc Lower… Дуга знизу…
Arc Tool Інструмент «Дуга»
Three-Point Arc Tool Інструмент «Дуга за трьома точками»
Three-Point Arc Дуга за трьома точками
Arc too large Дуга завелика
Third Point Sets Direction Третя точка задає напрямок
Arc Upper… Дуга зверху…
Arch… Арка…
Arc… Дуга…
@@ -5383,6 +5387,10 @@ liquify-list-end {0}, {1} {0} і {1}
@msg a guide has no curvature circle напрямна не має кола кривини
@msg the circle that matches the path there would reach past the canvas коло, що відповідає контуру в цьому місці, вийшло б за межі полотна
@msg no circle passes through these points: two are the same or all three lie on one line через ці точки не проходить жодне коло: дві точки збігаються або всі три лежать на одній прямій
@msg `at` must be "start" or "end" `at` має бути "start" або "end"
@msg give exactly one of `through` and `toward` вкажіть рівно один із параметрів `through` і `toward`
@msg no arc fits these points: two are the same or all three lie on one line жодна дуга не підходить до цих точок: дві точки збігаються або всі три лежать на одній прямій
@msg give `at` only with `toward` вказуйте `at` лише разом із `toward`
@msg no app to open files here тут немає програми для відкриття файлів
@msg no artboard немає монтажної області
@msg no artboard {i} (0-based; the document has {_1}) немає монтажної області {i} (рахунок з 0; у документі {_1})
Can't render this file because it is too large.
+8
View File
@@ -259,6 +259,10 @@ font-technology Variable Biến thiên
Arc Cung
Arc Lower… Cung dưới…
Arc Tool Công cụ Cung
Three-Point Arc Tool Công cụ Cung ba điểm
Three-Point Arc Cung ba điểm
Arc too large Cung quá lớn
Third Point Sets Direction Điểm thứ ba chỉ hướng
Arc Upper… Cung trên…
Arch… Vòm…
Arc… Cung…
@@ -5753,6 +5757,10 @@ liquify-list-end {0}, {1} {0} và {1}
@msg a guide has no curvature circle đường căn không có đường tròn độ cong
@msg the circle that matches the path there would reach past the canvas đường tròn khớp với đường dẫn tại đó sẽ vượt quá giới hạn vùng vẽ
@msg no circle passes through these points: two are the same or all three lie on one line không có đường tròn nào đi qua các điểm này: hai điểm trùng nhau hoặc cả ba điểm thẳng hàng
@msg `at` must be "start" or "end" `at` phải là "start" hoặc "end"
@msg give exactly one of `through` and `toward` hãy cho đúng một trong hai `through` và `toward`
@msg no arc fits these points: two are the same or all three lie on one line không có cung nào khớp với các điểm này: hai điểm trùng nhau hoặc cả ba điểm thẳng hàng
@msg give `at` only with `toward` chỉ cho `at` cùng với `toward`
@msg no app to open files here không có ứng dụng để mở tệp ở đây
@msg no artboard không có bảng vẽ
@msg no artboard {i} (0-based; the document has {_1}) không có bảng vẽ {i} (bắt đầu từ 0; tài liệu có {_1})
Can't render this file because it is too large.
+8
View File
@@ -184,6 +184,10 @@ antiAlias Sharp 锐利
Arc 弧形
Arc Lower… 下弧形…
Arc Tool 弧形工具
Three-Point Arc Tool 三点弧形工具
Three-Point Arc 三点弧形
Arc too large 弧形过大
Third Point Sets Direction 第三点指示方向
Arc Upper… 上弧形…
Arch… 拱形…
Arc… 弧形…
@@ -4850,6 +4854,10 @@ imageTrace Outline 轮廓
@msg a guide has no curvature circle 参考线没有曲率圆
@msg the circle that matches the path there would reach past the canvas 在该处与路径曲率相符的圆会超出画布
@msg no circle passes through these points: two are the same or all three lie on one line 没有圆经过这些点:有两点相同,或三点共线
@msg `at` must be "start" or "end" `at` 必须是 "start" 或 "end"
@msg give exactly one of `through` and `toward` `through` 和 `toward` 必须且只能指定一个
@msg no arc fits these points: two are the same or all three lie on one line 没有弧形符合这些点:有两点相同,或三点共线
@msg give `at` only with `toward` `at` 只能与 `toward` 一起指定
@msg select at least two objects 请至少选择两个对象
@msg exit isolation mode first 请先退出隔离模式
@msg no saved presets 没有已保存的预设
Can't render this file because it is too large.
+8
View File
@@ -198,6 +198,10 @@ font-technology Variable 可變
Arc 弧形
Arc Lower… 下弧形…
Arc Tool 弧形工具
Three-Point Arc Tool 三點弧形工具
Three-Point Arc 三點弧形
Arc too large 弧形過大
Third Point Sets Direction 第三點指示方向
Arc Upper… 上弧形…
Arch… 拱形…
Arc… 弧形…
@@ -2221,6 +2225,10 @@ file-filter Templates 範本
@msg a guide has no curvature circle 參考線沒有曲率圓
@msg the circle that matches the path there would reach past the canvas 在該處與路徑曲率相符的圓會超出畫布
@msg no circle passes through these points: two are the same or all three lie on one line 沒有圓通過這些點:有兩點相同,或三點共線
@msg `at` must be "start" or "end" `at` 必須是 "start" 或 "end"
@msg give exactly one of `through` and `toward` `through` 與 `toward` 必須且只能指定一個
@msg no arc fits these points: two are the same or all three lie on one line 沒有弧形符合這些點:有兩點相同,或三點共線
@msg give `at` only with `toward` `at` 只能與 `toward` 一起指定
@msg select at least two objects 請選取至少兩個物件
@msg exit isolation mode first 請先結束隔離模式
@msg no saved presets 沒有已儲存的預設集
Can't render this file because it is too large.
+1
View File
@@ -45,6 +45,7 @@ pub static ICONS: &[(&str, &[u8])] = &[
("dc-anchor-smooth", include_bytes!("../../../assets/icons/dc-anchor-smooth.svg")),
("dc-appearance", include_bytes!("../../../assets/icons/dc-appearance.svg")),
("dc-arc", include_bytes!("../../../assets/icons/dc-arc.svg")),
("dc-arc-three-point", include_bytes!("../../../assets/icons/dc-arc-three-point.svg")),
("dc-arrow-down", include_bytes!("../../../assets/icons/dc-arrow-down.svg")),
("dc-arrow-extend", include_bytes!("../../../assets/icons/dc-arrow-extend.svg")),
("dc-arrow-tip", include_bytes!("../../../assets/icons/dc-arrow-tip.svg")),
+1
View File
@@ -39,6 +39,7 @@ pub fn tool_icon(name: &str) -> &'static str {
"tool-touch-type" => "dc-touch-type",
"tool-line" => "dc-line",
"tool-arc" => "dc-arc",
"tool-three-point-arc" => "dc-arc-three-point",
"tool-spiral" => "tornado",
"tool-rect-grid" => "dc-rect-grid",
"tool-polar-grid" => "dc-polar-grid",
+3 -1
View File
@@ -37,7 +37,7 @@ pub const BASIC: &[(&str, &[&[&str]])] = &[
(
"Shapes",
&[
&["rectangle", "roundedRectangle", "star", "lineSegment", "arc", "spiral", "rectangularGrid", "polarGrid", "flare"],
&["rectangle", "roundedRectangle", "star", "lineSegment", "arc", "threePointArc", "spiral", "rectangularGrid", "polarGrid", "flare"],
&["ellipse", "circle", "curvatureCircle"],
&["polygon"],
&["shaper"],
@@ -475,6 +475,8 @@ pub fn open_options(app: &mut VectorcraftApp, tool: &str) -> Result<serde_json::
// The Line Segment, Arc and grid tools: their Tool Options, the options of their next
// drag and click.
_ if crate::dialogs::shapes::OPTION_TOOLS.contains(&tool) => crate::dialogs::shapes::open_options(app, tool),
// The Three-Point Arc tool: whether the third point gives a direction.
vectorcraft_tools::three_point_arc::ID => Ok(crate::dialogs::three_point_arc_options::open(app)),
// The Flare tool: its options, which draw the next flare (OK draws none); with flares
// selected, the first one's settings, and OK draws the selected flares again.
"flare" => Ok(crate::dialogs::flare_options::open(app, None)),
+30 -1
View File
@@ -825,6 +825,35 @@ from −100 to 100 and is 50 when left out with `lengthX` and `lengthY`, or 100
`` `baseAlong` must be one of x, y ``), as is a `slope` outside its range; the arc is not drawn and no undo step is
added.
`shape.threePointArc {start: [x, y], end: [x, y], through?: [x, y], toward?: [x, y], at?: "start"|"end"}` draws an
open circular arc from `start` to `end` and selects it. With `through`, the arc passes through that point. With
`toward`, the arc leaves `start` heading toward that point, so the line from `start` to the point is the arc's tangent
there. With `at: "end"`, the line from `end` to the point is the tangent at `end` instead. `at` is `"start"` when left
out, and `at` with `through` is an error. The arc has no fill and the current stroke (black when the stroke is none),
its ends are exactly the two points (it is not pixel-aligned), and it has a smooth anchor at the `through` point and
further smooth anchors so that no curve of the path turns more than a quarter turn. The result is
`{id, cx, cy, radius, sweep}`: the circle's center and radius, and the arc's turn in degrees, positive clockwise on the
page. One undo removes the arc. The command returns an error and draws nothing when two of the points are the same,
when the third point lies on the line through the ends, when the arc would reach past the canvas, when a point is not
`[x, y]`, when both or neither of `through` and `toward` are given, when `at` is anything but `"start"` or `"end"`, and
when `at` is given with `through`.
The Three-Point Arc tool, in the Line Segment tool's group after the Arc tool, runs this command. A drag from one end to
the other, or a click on each, places the ends; Shift keeps the second end at 45° steps from the first (from General ›
Constrain Angle). A click on a third point, or a press dragged to it, then draws the arc through it. With the tool's
`direction` option on, the third point gives the direction the arc leaves the first end in; with `mods.alt`, the
direction is at the second end, and Shift keeps the direction at 45° steps. Three-Point Arc Tool Options (`tool.options`,
or a double-click on the tool) sets `direction` with its Third Point Sets Direction box, and
`]` (with or without Shift) switches it while the ends are placed; the option is saved with the preferences. Until the
third point is placed, the tool shows the arc as a dashed outline, its center as a small cross, the direction line in
direction mode and, with Measurement Labels on, the radius. Where no arc fits, the tool shows "Arc too large" by the
pointer (nothing while the pointer is on an end), and a click there draws nothing and keeps the ends. Escape, and an
edit, Undo or Redo made outside the tool, remove the ends.
```json
{"name":"run_command","arguments":{"command":"shape.threePointArc","params":{"start":[0,0],"end":[80,0],"through":[40,-40]}}}
```
While a spiral is being dragged out with the Spiral tool, a `drag` event with `mods.alt` or `mods.cmd` keeps the
spiral's inner end at the distance from the center it had on the first modified `drag` event, and the outer end follows
the pointer. With `mods.alt` alone, dragging outward adds whole winds of four segments and dragging inward removes
@@ -8158,7 +8187,7 @@ snap the pointer as drawing tools do, so dragging a corner onto another object's
Every point a drawing tool places snaps the same way, through one snapper (#506): the Pen's and Curvature tool's
anchors, the shape tools' start and dragged corner or radius (`rectangle`,
`roundedRectangle`, `ellipse`, `polygon`, `star`, `lineSegment`, `arc`, `spiral`, `rectangularGrid`, `polarGrid`), the
Type tool's click and frame, and a new artboard's corners. The Pencil ignores Smart Guides and Snap to Point and
Three-Point Arc tool's ends and third point, the Type tool's click and frame, and a new artboard's corners. The Pencil ignores Smart Guides and Snap to Point and
shows no Smart Guides: its strokes and straight lines follow the hand (Snap to Grid and Snap to Pixel still move
their ends). The point lands on another object's anchor, centre or
path ("anchor", "center", "path"), else lines up with the anchors, edges and centres of the art and the artboards (a
+1
View File
@@ -738,6 +738,7 @@ since 2026-10-01.
- **Constrain Angle (#394):** General › Constrain Angle turns the arrow keys' axes (guides stay on the page's), holds Shift drags of the Selection, Direct Selection, Free Transform, Slice Selection, Reshape and Measure tools and the Pen's handles to the turned axes, and new rectangles, rounded rectangles, ellipses, grids, point and area type, Shift-drawn polygons and stars and the shape size dialogs are drawn along it with their bounding box turned; 0° and whole turns are exactly as before, quarter turns exact (<https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/rotate-objects-by-specific-angles.html>). Tests: `tests_constrain_tools`, `tests_constrain_new` (engine), `geom` `constrain_axes` / `rotate_deg`, the shape, grid and type tool tests.
- **Arcs along General › Constrain Angle:** with a Constrain Angle other than 0° or a whole turn, an arc dragged out with the Arc tool and an arc placed from the Arc Segment Tool Options click dialog are drawn along the turned x and y axes, with their bounding box turned. The drag's box and Shift's equal lengths are measured along those axes, the reference point stays at the drag's corner or at the click, and F, C and ↑/↓ keep the turn. `shape.arc` takes an optional `rotation` (degrees clockwise, about `x1`, `y1` or about the reference point `x`, `y`); a `rotation` that is not a number is an error. At 0° and whole turns arcs are drawn as before, and quarter turns are exact. The help page (<https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=226>) describes new objects being drawn along the turned axes; how the Arc tool's keys and reference point work with them is VectorCraft's own rule (tools `draw2::family::tests::arcs_follow_the_constrain_angle`; engine `constrain_angle_draws_a_dragged_arc_along_the_turned_axes`, `constrain_angle_turns_a_click_made_arc_about_its_reference_point`, `arc_rotation_turns_it_and_must_be_a_number`). Scores and hours unchanged.
- **Spirals turn as they are dragged, and along General › Constrain Angle:** a spiral dragged out with the Spiral tool turns about its center so that its outer end is at the pointer, so dragging around the center turns it, while Alt, Ctrl/Cmd, ↑/↓, Space and Escape work as before. A spiral placed from the Spiral dialog starts along the x axis turned by a Constrain Angle other than 0° or a whole turn, with its bounding box turned. `shape.spiral` takes an optional `rotation` (degrees clockwise about `cx`, `cy`); a `rotation` that is not a number is an error, and without one spirals are drawn as before. The help page (<https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=65>) says that moving the pointer around in a curve during the drag turns the new spiral, and the help page (<https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=226>) describes new objects being drawn along the turned axes. Putting the outer end exactly at the pointer, keeping the last direction while the pointer is within 0.01 pt of the center, and leaving a dragged spiral's direction to the pointer with Shift or a Constrain Angle are VectorCraft's own rules (tools `draw2::family::tests::spiral_drag_turns_the_spiral_to_the_pointer`; engine `a_dragged_spiral_turns_its_outer_end_to_the_pointer`, `constrain_angle_turns_a_click_made_spiral`, `spiral_rotation_turns_it_and_must_be_a_number`; UI `spiral_click_dialog_starts_along_the_constrain_angle`). Scores and hours unchanged.
- **Three-Point Arc tool:** a new tool in the Line Segment tool's group, after the Arc tool, draws an open circular arc. A drag or two clicks place its ends (Shift keeps the second end at 45° steps), and a third click places a point the arc passes through. With Third Point Sets Direction on (the tool's Tool Options, or `]` while drawing), the third point gives the direction the arc leaves its first end in, or with Alt the direction at its second end. The tool previews the arc and its center, and with Measurement Labels on its radius, shows "Arc too large" where no arc fits, and draws the arc in one undo step with `shape.threePointArc {start, end, through | toward, at?}` (geom `shapes::tests::the_arc_through_a_point_passes_through_it`, `the_arc_leaving_along_a_direction_has_that_tangent`, `degenerate_points_give_no_arc`, `the_path_via_the_third_point_passes_through_it_exactly`; tools `three_point_arc::tests`; engine `tests::three_point_arc`; ui-egui `dialogs::three_point_arc_options::tests`). Scores and hours unchanged.
- **Shape commands refuse invalid options:** `shape.arc` refuses a `reference` that is not a whole number from 0 to 8, a `baseAlong` other than `x` or `y` (either case), null included for both, and a `slope` outside −100…100, in both of its forms; before, such a value drew the arc with reference point 0 or 8, the X axis or the nearest slope. `shape.rectangularGrid` and `shape.polarGrid` refuse a divider count that is not a whole number of at least 0; before, such a count was 5. Each error names the key, and nothing is drawn. Left-out values keep their defaults. These ranges are VectorCraft's own command rules (engine `draw2::shape_arc_rejects_an_invalid_reference_base_along_or_slope`, `draw2::shape_arc_takes_every_reference_point_and_either_base_axis`, `draw2::grid_divider_counts_reject_fractions_and_negatives`). Scores and hours unchanged.
- **Roughen at Size 0 keeps the outline:** with Size 0 (relative or absolute), Effect › Distort & Transform › Roughen… moves no point: each segment is split at the Detail spacing (fewer points past the anchor limit) into pieces of equal length on the segment itself, so the path keeps its outline, with Smooth or Corner points alike. A straight segment gets corner points without handles, and a curve gets smooth points whose handles follow it. Before, the points were joined by straight lines (Corner) or a smoothed curve through them (Smooth), which changed curved outlines. Existing documents with a Roughen of Size 0 on a curved path, or with Smooth points, draw differently. This is VectorCraft's own rule; what Roughen does is described in [Distort and transform effects](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/distort-and-transform-effects-in-illustrator.html) (effects `tests::roughen_at_size_0_keeps_the_outline_and_spaces_its_points_evenly`). Scores and hours unchanged.
+1
View File
@@ -349,6 +349,7 @@ tools, never checked side by side) isn't captured row by row.
| Sliders in dialogs and popups (Save for Web, raster export options, Preferences, the opacity popup) show their rail, filled up to the handle | done | #1483 |
| Rectangular Grid and Polar Grid click dialogs: size, divider counts with a skew slider each, Use Outside Rectangle As Frame / Create Compound Path From Ellipses, Fill Grid; kept as the tool's options, used by drags too | done | #1377. The options are the documented ones; how far a skew percentage moves the dividers and which way the radial skew turns are our own choice (the public documentation gives neither). The reference point locator is in the dialog, and a double-click on the tool opens it as the tool's Tool Options (next row) |
| Double-click the Line Segment, Arc, Rectangular Grid or Polar Grid tool: its Tool Options ([Rectangular Grid tool](https://helpx.adobe.com/illustrator/using/tool-techniques/rectangular-grid-tool.html) and [Arc tool](https://helpx.adobe.com/illustrator/using/tool-techniques/arc-tool.html) step 3, [Tools](https://helpx.adobe.com/illustrator/using/tools.html)) | done | #2691. The tool's click dialog without a place to draw: Line Segment's Length, Angle and Fill Line; Arc's lengths, Reference Point, Type, Base Along, Slope and Fill Arc; the grids' Reference Point, Default Size, dividers, skews and switches. OK draws nothing and sets what the next drag draws with (Fill Line, the arc's type, base, slope and fill, the grids' dividers, skews and switches) and what a click's dialog opens at (with the Length, Angle and Default Size); Cancel changes nothing (`double_clicking_the_line_arc_and_grid_tools_opens_their_tool_options`) |
| Three-Point Arc tool (VectorCraft addition), after the Arc tool: two ends, then a third point the open arc passes through or, with Third Point Sets Direction (its Tool Options, or `]` while drawing), the direction it leaves an end in; a preview with the center and, with Measurement Labels on, the radius; one undo step | done | `shape.threePointArc` (`crates/engine/src/cmd/create.rs`), the tool in `crates/tools/src/three_point_arc.rs`, the geometry in `crates/geom/src/shapes.rs` (`CircularArc`), and their tests; a VectorCraft addition, so it is not scored |
## Modifier keys and temporary tools