mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-27 21:29:35 +00:00
Path Precision Tools: the Tangent Circle Tool's options set its preview and how near it snaps
The Tangent Circle Tool's options dialog and tool.setOption take five more options, kept with the preferences: center and radii show or hide the preview's center cross and the lines to the two touch points, color sets the color of the circle, the cross, the lines and the no-circle note (red, blue, magenta, green, black or gray), snapTolerance sets how near (screen pixels, 0 to 25) the pointer picks a segment, and snapWithoutGuides keeps that reach with Smart Guides off. With Smart Guides on, their Snapping Tolerance counts when it is larger; with snapping off a segment is picked within the Selection Tolerance. The help page lists these options: https://docs.astutegraphics.com/subscribe/tangent-circle-tool The defaults (both shown, red, 3 px, snapping on) are VectorCraft's own. With Smart Guides on, the default reach is now their Snapping Tolerance (4 px) instead of the 3 px Selection Tolerance. Of the segments within reach the tool now picks the nearest one, not the first one found, so a larger tolerance does not pick a farther path over a nearer one. tool.setOption gives an error for an unknown color, a tolerance outside its range or a value of the wrong type, and sets none of the values. Docs: docs/mcp.md, docs/target-app-parity.md, docs/ui-parity.md.
This commit is contained in:
@@ -16,6 +16,16 @@
|
||||
//! document, or a change to the first segment that leaves no undo step (a live preview, or one that
|
||||
//! was canceled) forgets the first segment. The circles are looked for again whenever either
|
||||
//! segment's shape differs from the one they were found on.
|
||||
//!
|
||||
//! The tool's options (its options dialog, `tool.setOption`; kept with the preferences): `radius`;
|
||||
//! `center` and `radii` show or hide the circle's center cross and the lines from its center to the
|
||||
//! two points it touches; `color` is the color of the circle, the cross, those lines and the note
|
||||
//! (one of [`COLORS`]); `snapTolerance` is how near (screen pixels) the pointer picks a segment
|
||||
//! with Smart Guides on, where Smart Guides' Snapping Tolerance counts instead when it is larger,
|
||||
//! or with Smart Guides off while `snapWithoutGuides` is on. Without snapping a segment is picked
|
||||
//! within the selection tolerance, as a click on a path picks it, and that is also the least reach
|
||||
//! snapping has. Of the segments within reach the nearest is picked ([`pick_at`]). By default the
|
||||
//! cross and the lines show, the color is red, the tolerance is 3 px and `snapWithoutGuides` is on.
|
||||
|
||||
use kurbo::{CubicBez, Shape};
|
||||
use serde_json::{Value, json};
|
||||
@@ -42,6 +52,22 @@ pub const NO_CIRCLE: &str = "No tangent circle here";
|
||||
const BLUE: [u8; 3] = [0x4f, 0x9d, 0xff];
|
||||
const RED: [u8; 3] = [0xe0, 0x3c, 0x3c];
|
||||
const GREY: [u8; 3] = [0x80, 0x80, 0x80];
|
||||
/// The colors the `color` option takes, by option value, with the color the circle, its center
|
||||
/// cross, its radii and the note are drawn in. Red is the first.
|
||||
pub const COLORS: &[(&str, [u8; 3])] = &[
|
||||
("red", RED),
|
||||
("blue", crate::draw2::FEEDBACK),
|
||||
("magenta", [0xd6, 0x2c, 0xd6]),
|
||||
("green", [0x1f, 0xb4, 0x4b]),
|
||||
("black", [0x00, 0x00, 0x00]),
|
||||
("gray", GREY),
|
||||
];
|
||||
/// The snapping tolerance the tool starts with (screen pixels).
|
||||
pub const SNAP_PX: f64 = 3.0;
|
||||
/// The snapping tolerance the `snapTolerance` option takes (screen pixels).
|
||||
pub const SNAP_RANGE: (f64, f64) = (0.0, 25.0);
|
||||
/// The option keys that are true or false.
|
||||
const SWITCHES: &[&str] = &["center", "radii", "snapWithoutGuides"];
|
||||
|
||||
/// A segment under the pointer: where on it, and the segment itself.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
@@ -72,6 +98,14 @@ struct Press {
|
||||
|
||||
pub struct TangentCircleTool {
|
||||
radius: f64,
|
||||
/// Whether the preview shows the center cross and the radii.
|
||||
center: bool,
|
||||
radii: bool,
|
||||
/// An entry of [`COLORS`].
|
||||
color: usize,
|
||||
/// The snapping tolerance (screen pixels), and whether the tool snaps with Smart Guides off.
|
||||
snap_px: f64,
|
||||
snap_without_guides: bool,
|
||||
first: Option<Pick>,
|
||||
hover: Option<Pick>,
|
||||
press: Option<Press>,
|
||||
@@ -91,13 +125,45 @@ type CacheKey = (NodeId, usize, usize, Option<u64>, CubicBez, Vec<CubicBez>);
|
||||
|
||||
impl Default for TangentCircleTool {
|
||||
fn default() -> Self {
|
||||
Self { radius: RADIUS, first: None, hover: None, press: None, picking: false, found: None, looked: false, pointer: Point::ZERO, cache: None }
|
||||
Self {
|
||||
radius: RADIUS,
|
||||
center: true,
|
||||
radii: true,
|
||||
color: 0,
|
||||
snap_px: SNAP_PX,
|
||||
snap_without_guides: true,
|
||||
first: None,
|
||||
hover: None,
|
||||
press: None,
|
||||
picking: false,
|
||||
found: None,
|
||||
looked: false,
|
||||
pointer: Point::ZERO,
|
||||
cache: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The path segment under `p`, of any editable path.
|
||||
fn pick_at(cx: &ToolContext, p: Point) -> Option<Pick> {
|
||||
let (id, subpath, segment, t) = crate::draw2::hit_segment(cx, p, cx.pick_tol())?;
|
||||
/// The nearest path segment within `reach` of `p`, of any editable path; of segments at the same
|
||||
/// distance, one of a selected path, then the one on top.
|
||||
fn pick_at(cx: &ToolContext, p: Point, reach: f64) -> Option<Pick> {
|
||||
let mut best: Option<((NodeId, usize, usize, f64), f64)> = None;
|
||||
for id in crate::draw2::candidate_paths(cx) {
|
||||
let Some(pd) = cx.doc.node(id).and_then(|n| n.path_data()) else { continue };
|
||||
// A path whose control points' box, with its edges, lies out of reach holds no point within
|
||||
// reach.
|
||||
let near = |b: vectorcraft_geom::Rect| p.x >= b.x0 - reach && p.x <= b.x1 + reach && p.y >= b.y0 - reach && p.y <= b.y1 + reach;
|
||||
if pd.control_bounds().is_none_or(|b| !near(b)) {
|
||||
continue;
|
||||
}
|
||||
if let Some((subpath, segment, t, _, d)) = pd.nearest(p)
|
||||
&& d <= reach
|
||||
&& best.is_none_or(|(_, b)| d < b)
|
||||
{
|
||||
best = Some(((id, subpath, segment, t), d));
|
||||
}
|
||||
}
|
||||
let ((id, subpath, segment, t), _) = best?;
|
||||
let sp = cx.doc.node(id)?.path_data()?.subpaths.get(subpath)?;
|
||||
if segment >= sp.segment_count() {
|
||||
return None;
|
||||
@@ -197,6 +263,26 @@ fn segment_path(c: &CubicBez) -> BezPath {
|
||||
}
|
||||
|
||||
impl TangentCircleTool {
|
||||
/// How near (document units) the pointer picks a segment: with Smart Guides on, the snapping
|
||||
/// tolerance or Smart Guides' Snapping Tolerance, whichever is larger; with them off, the
|
||||
/// snapping tolerance while `snapWithoutGuides` is on, and otherwise none. Never less than the
|
||||
/// selection tolerance.
|
||||
fn reach(&self, cx: &ToolContext) -> f64 {
|
||||
let pick = cx.pick_tol();
|
||||
if cx.smart_guides {
|
||||
pick.max(cx.tol(self.snap_px)).max(cx.snap_tol())
|
||||
} else if self.snap_without_guides {
|
||||
pick.max(cx.tol(self.snap_px))
|
||||
} else {
|
||||
pick
|
||||
}
|
||||
}
|
||||
|
||||
/// The color the preview is drawn in.
|
||||
fn preview_color(&self) -> [u8; 3] {
|
||||
COLORS.get(self.color).map_or(RED, |(_, rgb)| *rgb)
|
||||
}
|
||||
|
||||
/// The radius a drag gives, with Shift in round steps.
|
||||
fn shown_radius(cx: &ToolContext, r: f64, shift: bool) -> f64 {
|
||||
if !shift {
|
||||
@@ -304,12 +390,12 @@ impl Tool for TangentCircleTool {
|
||||
self.pointer = ev.pos;
|
||||
match ev.kind {
|
||||
PointerKind::Move => {
|
||||
self.hover = pick_at(cx, ev.pos);
|
||||
self.hover = pick_at(cx, ev.pos, self.reach(cx));
|
||||
self.look(cx, ev.pos, ev.mods);
|
||||
vec![]
|
||||
}
|
||||
PointerKind::Down => {
|
||||
let Some(pick) = pick_at(cx, ev.pos) else { return vec![] };
|
||||
let Some(pick) = pick_at(cx, ev.pos, self.reach(cx)) else { return vec![] };
|
||||
self.forget_if_changed(cx);
|
||||
let Some(first) = self.first.clone() else {
|
||||
self.first = Some(pick);
|
||||
@@ -415,21 +501,26 @@ impl Tool for TangentCircleTool {
|
||||
{
|
||||
out.push(Overlay::Line { a: press.at, b: self.pointer, color: GREY, dashed: false });
|
||||
}
|
||||
let color = self.preview_color();
|
||||
if let Some(c) = &self.found {
|
||||
let (at, r) = (c.circle.center, c.circle.radius);
|
||||
// A tolerance of at least a ten-thousandth of the radius keeps a huge circle to a few
|
||||
// dozen segments.
|
||||
let tol = cx.tol(0.1).max(r * 1e-4);
|
||||
out.push(Overlay::Path { path: kurbo::Circle::new(at, r).to_path(tol), color: RED, width: 1.0, dashed: false });
|
||||
let arm = cx.tol(4.0);
|
||||
out.push(Overlay::Line { a: at - kurbo::Vec2::new(arm, 0.0), b: at + kurbo::Vec2::new(arm, 0.0), color: RED, dashed: false });
|
||||
out.push(Overlay::Line { a: at - kurbo::Vec2::new(0.0, arm), b: at + kurbo::Vec2::new(0.0, arm), color: RED, dashed: false });
|
||||
out.push(Overlay::Line { a: at, b: c.first, color: RED, dashed: true });
|
||||
out.push(Overlay::Line { a: at, b: c.second, color: RED, dashed: true });
|
||||
out.push(Overlay::Path { path: kurbo::Circle::new(at, r).to_path(tol), color, width: 1.0, dashed: false });
|
||||
if self.center {
|
||||
let arm = cx.tol(4.0);
|
||||
out.push(Overlay::Line { a: at - kurbo::Vec2::new(arm, 0.0), b: at + kurbo::Vec2::new(arm, 0.0), color, dashed: false });
|
||||
out.push(Overlay::Line { a: at - kurbo::Vec2::new(0.0, arm), b: at + kurbo::Vec2::new(0.0, arm), color, dashed: false });
|
||||
}
|
||||
if self.radii {
|
||||
out.push(Overlay::Line { a: at, b: c.first, color, dashed: true });
|
||||
out.push(Overlay::Line { a: at, b: c.second, color, dashed: true });
|
||||
}
|
||||
out.push(Overlay::Measure { p: self.pointer, text: format!("R: {}", cx.len(r)) });
|
||||
} else if self.looked {
|
||||
// A label, which the canvas shows in the interface language.
|
||||
out.push(Overlay::Label { p: self.pointer, text: NO_CIRCLE.into(), color: RED });
|
||||
out.push(Overlay::Label { p: self.pointer, text: NO_CIRCLE.into(), color });
|
||||
}
|
||||
out
|
||||
}
|
||||
@@ -439,14 +530,29 @@ impl Tool for TangentCircleTool {
|
||||
}
|
||||
|
||||
fn options(&self) -> Value {
|
||||
json!({ "radius": self.radius })
|
||||
json!({
|
||||
"radius": self.radius,
|
||||
"center": self.center,
|
||||
"radii": self.radii,
|
||||
"color": COLORS.get(self.color).map_or("red", |(name, _)| *name),
|
||||
"snapTolerance": self.snap_px,
|
||||
"snapWithoutGuides": self.snap_without_guides,
|
||||
})
|
||||
}
|
||||
|
||||
/// Sets one option; a value the option does not take leaves it as it was.
|
||||
fn set_option(&mut self, key: &str, v: &Value) {
|
||||
if key == "radius"
|
||||
&& let Some(r) = v.as_f64().filter(|r| (RADIUS_RANGE.0..=RADIUS_RANGE.1).contains(r))
|
||||
{
|
||||
self.radius = r;
|
||||
if self.check_option(key, v).is_err() {
|
||||
return;
|
||||
}
|
||||
match key {
|
||||
"radius" => self.radius = v.as_f64().unwrap_or(self.radius),
|
||||
"center" => self.center = v.as_bool().unwrap_or(self.center),
|
||||
"radii" => self.radii = v.as_bool().unwrap_or(self.radii),
|
||||
"color" => self.color = v.as_str().and_then(|s| COLORS.iter().position(|(name, _)| *name == s)).unwrap_or(self.color),
|
||||
"snapTolerance" => self.snap_px = v.as_f64().unwrap_or(self.snap_px),
|
||||
"snapWithoutGuides" => self.snap_without_guides = v.as_bool().unwrap_or(self.snap_without_guides),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,6 +560,9 @@ impl Tool for TangentCircleTool {
|
||||
use crate::option_check as c;
|
||||
match key {
|
||||
"radius" => c::number(key, v, RADIUS_RANGE.0, RADIUS_RANGE.1),
|
||||
"snapTolerance" => c::number(key, v, SNAP_RANGE.0, SNAP_RANGE.1),
|
||||
"color" => c::one_of(key, v, &COLORS.iter().map(|(name, _)| *name).collect::<Vec<_>>()),
|
||||
k if SWITCHES.contains(&k) => c::boolean(key, v),
|
||||
_ => Err(c::unknown(key)),
|
||||
}
|
||||
}
|
||||
@@ -598,6 +707,123 @@ mod tests {
|
||||
assert!(close(drawn(&released), (130.0, 100.0, 40.0, 40.0)), "{released:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_preview_options_set_its_cross_radii_and_color() {
|
||||
let d = doc();
|
||||
let (sel, p) = (Selection::default(), paint());
|
||||
let cx = cx(&d, &sel, &p);
|
||||
let green = COLORS.iter().find(|(name, _)| *name == "green").map(|(_, rgb)| *rgb);
|
||||
let lines =
|
||||
|ov: &[Overlay], dashed_lines: bool| ov.iter().filter(|o| matches!(o, Overlay::Line { dashed, .. } if *dashed == dashed_lines)).count();
|
||||
let mut t = TangentCircleTool::default();
|
||||
t.pointer(&cx, &ev(PointerKind::Down, 150.0, 101.0));
|
||||
t.pointer(&cx, &ev(PointerKind::Up, 150.0, 101.0));
|
||||
t.pointer(&cx, &ev(PointerKind::Move, 200.0, 139.0));
|
||||
// By default: the red circle, its center cross (two lines) and its two radii.
|
||||
let ov = t.overlays(&cx);
|
||||
assert_eq!((lines(&ov, false), lines(&ov, true)), (2, 2), "{ov:?}");
|
||||
assert!(ov.iter().any(|o| matches!(o, Overlay::Path { color, width, .. } if *color == RED && *width == 1.0)), "{ov:?}");
|
||||
t.set_option("center", &json!(false));
|
||||
let ov = t.overlays(&cx);
|
||||
assert_eq!((lines(&ov, false), lines(&ov, true)), (0, 2), "no cross: {ov:?}");
|
||||
t.set_option("radii", &json!(false));
|
||||
t.set_option("color", &json!("green"));
|
||||
let ov = t.overlays(&cx);
|
||||
assert_eq!((lines(&ov, false), lines(&ov, true)), (0, 0), "no radii: {ov:?}");
|
||||
assert!(ov.iter().any(|o| matches!(o, Overlay::Path { color, .. } if Some(*color) == green)), "{ov:?}");
|
||||
assert!(ov.iter().any(|o| matches!(o, Overlay::Measure { text, .. } if text.starts_with("R: 20.00"))), "the radius still shows: {ov:?}");
|
||||
// The note takes the color too.
|
||||
t.set_option("radius", &json!(5));
|
||||
t.pointer(&cx, &shifted(PointerKind::Move, 200.0, 140.0));
|
||||
assert!(t.overlays(&cx).iter().any(|o| matches!(o, Overlay::Label { text, color, .. } if text == NO_CIRCLE && Some(*color) == green)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_preview_and_snap_options_take_only_their_values() {
|
||||
let mut t = TangentCircleTool::default();
|
||||
let o = t.options();
|
||||
assert_eq!(
|
||||
(&o["center"], &o["radii"], &o["color"], &o["snapTolerance"], &o["snapWithoutGuides"]),
|
||||
(&json!(true), &json!(true), &json!("red"), &json!(3.0), &json!(true))
|
||||
);
|
||||
for (key, good) in [
|
||||
("center", json!(false)),
|
||||
("radii", json!(false)),
|
||||
("snapWithoutGuides", json!(false)),
|
||||
("color", json!("gray")),
|
||||
("snapTolerance", json!(0)),
|
||||
("snapTolerance", json!(25)),
|
||||
("snapTolerance", json!(7.5)),
|
||||
] {
|
||||
assert_eq!(t.check_option(key, &good), Ok(()), "{key} {good}");
|
||||
t.set_option(key, &good);
|
||||
let now = t.options()[key].clone();
|
||||
assert!(now == good || (good.is_number() && now.as_f64() == good.as_f64()), "{key}: {now} for {good}");
|
||||
}
|
||||
let colors = "`color` must be one of `red`, `blue`, `magenta`, `green`, `black`, `gray`";
|
||||
for (key, bad, error) in [
|
||||
("center", json!(1), "`center` must be true or false"),
|
||||
("radii", json!("no"), "`radii` must be true or false"),
|
||||
("snapWithoutGuides", Value::Null, "`snapWithoutGuides` must be true or false"),
|
||||
("color", json!("orange"), colors),
|
||||
("color", json!("Red"), colors),
|
||||
("color", json!(0), colors),
|
||||
("snapTolerance", json!(-1), "`snapTolerance` must be a number from 0 to 25"),
|
||||
("snapTolerance", json!(26), "`snapTolerance` must be a number from 0 to 25"),
|
||||
("snapTolerance", json!("3"), "`snapTolerance` must be a number from 0 to 25"),
|
||||
] {
|
||||
assert_eq!(t.check_option(key, &bad), Err(error.into()), "{key} {bad}");
|
||||
let before = t.options();
|
||||
t.set_option(key, &bad);
|
||||
assert_eq!(t.options(), before, "{key} {bad}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_snap_options_set_how_near_a_segment_is_picked() {
|
||||
let d = doc();
|
||||
let (sel, p) = (Selection::default(), paint());
|
||||
// At 100%, Selection Tolerance 3 px; the first line is at y = 100.
|
||||
let picks = |t: &mut TangentCircleTool, cx: &ToolContext, y: f64| {
|
||||
t.forget();
|
||||
t.pointer(cx, &ev(PointerKind::Down, 150.0, y));
|
||||
t.pointer(cx, &ev(PointerKind::Up, 150.0, y));
|
||||
t.first.is_some()
|
||||
};
|
||||
let guides = |tolerance: f64| ToolContext { smart_guides: true, snapping_tolerance: tolerance, ..cx(&d, &sel, &p) };
|
||||
let no_guides = ToolContext { smart_guides: false, ..cx(&d, &sel, &p) };
|
||||
let mut t = TangentCircleTool::default();
|
||||
// Smart Guides on: their Snapping Tolerance when it is larger than the tool's.
|
||||
assert!(picks(&mut t, &guides(10.0), 109.0));
|
||||
assert!(!picks(&mut t, &guides(10.0), 111.0));
|
||||
t.set_option("snapTolerance", &json!(12));
|
||||
assert!(picks(&mut t, &guides(4.0), 111.0), "the tool's when it is larger");
|
||||
assert!(!picks(&mut t, &guides(4.0), 113.0));
|
||||
// Smart Guides off: the tool's tolerance while it snaps without them.
|
||||
t.set_option("snapTolerance", &json!(8));
|
||||
assert!(picks(&mut t, &no_guides, 107.0));
|
||||
assert!(!picks(&mut t, &no_guides, 109.0));
|
||||
// Without snapping, only the Selection Tolerance; a tolerance below it does not shrink it.
|
||||
t.set_option("snapWithoutGuides", &json!(false));
|
||||
assert!(!picks(&mut t, &no_guides, 105.0));
|
||||
assert!(picks(&mut t, &no_guides, 102.5));
|
||||
t.set_option("snapWithoutGuides", &json!(true));
|
||||
t.set_option("snapTolerance", &json!(0));
|
||||
assert!(picks(&mut t, &no_guides, 102.5));
|
||||
// Over the gap between the two lines, the nearer one is picked, though both are in reach.
|
||||
t.set_option("snapTolerance", &json!(25));
|
||||
t.forget();
|
||||
t.pointer(&no_guides, &ev(PointerKind::Move, 150.0, 122.0));
|
||||
assert!(t.hover.as_ref().is_some_and(|h| (h.p.y - 140.0).abs() < 1e-9), "{:?}", t.hover);
|
||||
t.pointer(&no_guides, &ev(PointerKind::Move, 150.0, 118.0));
|
||||
assert!(t.hover.as_ref().is_some_and(|h| (h.p.y - 100.0).abs() < 1e-9), "{:?}", t.hover);
|
||||
// A segment exactly at the reach is in reach, on either side of it.
|
||||
t.pointer(&no_guides, &ev(PointerKind::Move, 150.0, 75.0));
|
||||
assert!(t.hover.as_ref().is_some_and(|h| (h.p.y - 100.0).abs() < 1e-9), "{:?}", t.hover);
|
||||
t.pointer(&no_guides, &ev(PointerKind::Move, 150.0, 165.0));
|
||||
assert!(t.hover.as_ref().is_some_and(|h| (h.p.y - 140.0).abs() < 1e-9), "{:?}", t.hover);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_drag_sets_the_radius_with_shift_steps_and_a_slow_drag() {
|
||||
let d = doc();
|
||||
|
||||
@@ -108,7 +108,7 @@ const ROWS: &[Row] = &[
|
||||
(&[crate::addons::extend_path::ID], None, &["mode"]),
|
||||
(&[crate::addons::corner_tool::ID], None, &["radius", "kind"]),
|
||||
(&[crate::addons::shared_edge::ID], None, &["diameter", "tolerance", "together"]),
|
||||
(&[crate::addons::tangent_circle::ID], None, &["radius"]),
|
||||
(&[crate::addons::tangent_circle::ID], None, &["radius", "center", "radii", "color", "snapTolerance", "snapWithoutGuides"]),
|
||||
(&[crate::addons::smart_pen::ID], None, &["next"]),
|
||||
// The kind first: a new kind resets the values after it.
|
||||
(&[crate::addons::parametric_shape::ID], None, &["kind", "count", "a", "b", "radius", "width", "height", "rotation"]),
|
||||
|
||||
@@ -238,13 +238,35 @@ fn body(_app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> bool {
|
||||
return false;
|
||||
}
|
||||
if d.str("__tool") == tangent_circle_tool::ID {
|
||||
let label_w = tangent_circle_label_w(ui);
|
||||
let (lo, hi) = tangent_circle_tool::RADIUS_RANGE;
|
||||
let r = d.f64("radius", tangent_circle_tool::RADIUS);
|
||||
widgets::label_row(ui, tl!("Radius:"), LABEL_W, |ui| {
|
||||
widgets::label_row(ui, tl!("Radius:"), label_w, |ui| {
|
||||
if let Some(x) = widgets::range_field(ui, "tangent-circle-radius", r, lo..=hi, " pt", 2, 96.0) {
|
||||
d.fields.insert("radius".into(), json!(x));
|
||||
}
|
||||
});
|
||||
for (key, label) in [("center", tl!("Circle Center")), ("radii", tl!("Circle Radii Lines"))] {
|
||||
tangent_circle_check(ui, d, key, label);
|
||||
}
|
||||
let color = d.str("color");
|
||||
let at = tangent_circle_tool::COLORS.iter().position(|(name, _)| *name == color).unwrap_or(0);
|
||||
widgets::label_row(ui, tl!("Color:"), label_w, |ui| {
|
||||
let shown = TANGENT_CIRCLE_COLORS.get(at).copied().unwrap_or("Red");
|
||||
if let Some((name, _)) = widgets::dropdown_named(ui, "tangent-circle-color", Some(tl!("Color:")), shown, &TANGENT_CIRCLE_COLORS, 110.0)
|
||||
.and_then(|i| tangent_circle_tool::COLORS.get(i))
|
||||
{
|
||||
d.fields.insert("color".into(), json!(name));
|
||||
}
|
||||
});
|
||||
let (lo, hi) = tangent_circle_tool::SNAP_RANGE;
|
||||
let snap = d.f64("snapTolerance", tangent_circle_tool::SNAP_PX);
|
||||
widgets::label_row(ui, tl!("Snap Tolerance:"), label_w, |ui| {
|
||||
if let Some(x) = widgets::range_field(ui, "tangent-circle-snap", snap, lo..=hi, " px", 2, 72.0) {
|
||||
d.fields.insert("snapTolerance".into(), json!(x));
|
||||
}
|
||||
});
|
||||
tangent_circle_check(ui, d, "snapWithoutGuides", tl!("Snap When Smart Guides Are Off"));
|
||||
return false;
|
||||
}
|
||||
let rows = [
|
||||
@@ -266,6 +288,29 @@ fn body(_app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
/// The labels of the Tangent Circle tool's colors ([`tangent_circle_tool::COLORS`]), in its order.
|
||||
const TANGENT_CIRCLE_COLORS: [&str; 6] = ["Red", "Blue", "Magenta", "Green", "Black", "Gray"];
|
||||
|
||||
/// The labels of the Tangent Circle tool's rows with a field beside them.
|
||||
const TANGENT_CIRCLE_LABELS: [&str; 3] = ["Radius:", "Color:", "Snap Tolerance:"];
|
||||
|
||||
/// The width of the Tangent Circle tool's label column: [`LABEL_W`], or the widest of
|
||||
/// [`TANGENT_CIRCLE_LABELS`] in the interface language with a gap after it, when that is wider.
|
||||
fn tangent_circle_label_w(ui: &Ui) -> f32 {
|
||||
TANGENT_CIRCLE_LABELS
|
||||
.iter()
|
||||
.map(|label| ui.painter().layout_no_wrap(tl!(label).to_string(), egui::FontId::proportional(12.5), egui::Color32::PLACEHOLDER).size().x + 8.0)
|
||||
.fold(LABEL_W, f32::max)
|
||||
}
|
||||
|
||||
/// A check box for the Tangent Circle tool's option `key`, labeled `label`.
|
||||
fn tangent_circle_check(ui: &mut Ui, d: &mut Dialog, key: &str, label: &str) {
|
||||
let on = d.bool(key);
|
||||
if widgets::check(ui, label, on, true) {
|
||||
d.fields.insert(key.into(), json!(!on));
|
||||
}
|
||||
}
|
||||
|
||||
/// OK: set the tool's options. When the tool refuses one of them, nothing is set and the dialog
|
||||
/// stays open.
|
||||
fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
|
||||
|
||||
@@ -110,6 +110,78 @@ fn double_clicking_the_brush_opens_its_options_and_ok_sets_them() {
|
||||
assert!(app.run("tool.options", json!({"tool": "measureInspect"})).is_err());
|
||||
}
|
||||
|
||||
/// The Tangent Circle tool's options dialog shows the preview and snapping options, OK sets them,
|
||||
/// and a value the tool refuses sets none of them and keeps the dialog open.
|
||||
#[test]
|
||||
fn the_tangent_circle_options_set_the_preview_and_snapping() {
|
||||
let mut app = app();
|
||||
app.run("tool.options", json!({"tool": "tangentCircle"})).unwrap();
|
||||
let d = app.ui.dialog.as_ref().unwrap();
|
||||
assert_eq!((d.bool("center"), d.bool("radii"), d.str("color")), (true, true, "red".to_string()));
|
||||
assert_eq!((d.f64("snapTolerance", 0.0), d.bool("snapWithoutGuides")), (3.0, true));
|
||||
let text = painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx()));
|
||||
for label in ["Circle Center", "Circle Radii Lines", "Color:", "Red", "Snap Tolerance:", "Snap When Smart Guides Are Off"] {
|
||||
assert!(text.contains(label), "{label} in {text}");
|
||||
}
|
||||
let d = app.ui.dialog.as_mut().unwrap();
|
||||
for (key, v) in [
|
||||
("center", json!(false)),
|
||||
("radii", json!(false)),
|
||||
("color", json!("magenta")),
|
||||
("snapTolerance", json!(9)),
|
||||
("snapWithoutGuides", json!(false)),
|
||||
] {
|
||||
d.fields.insert(key.into(), v);
|
||||
}
|
||||
crate::dialogs::confirm(&mut app).unwrap();
|
||||
assert!(app.ui.dialog.is_none());
|
||||
let o = app.session.tool_options_of("tangentCircle");
|
||||
assert_eq!((&o["center"], &o["radii"], &o["color"], &o["snapWithoutGuides"]), (&json!(false), &json!(false), &json!("magenta"), &json!(false)));
|
||||
assert_eq!(o["snapTolerance"].as_f64(), Some(9.0));
|
||||
// A negative tolerance is refused: nothing changes and the dialog stays open.
|
||||
app.run("tool.options", json!({"tool": "tangentCircle"})).unwrap();
|
||||
let d = app.ui.dialog.as_mut().unwrap();
|
||||
d.fields.insert("center".into(), json!(true));
|
||||
d.fields.insert("snapTolerance".into(), json!(-2));
|
||||
let e = crate::dialogs::confirm(&mut app).unwrap_err();
|
||||
assert!(e.contains("`snapTolerance` must be a number from 0 to 25"), "{e}");
|
||||
assert!(app.ui.dialog.is_some());
|
||||
assert_eq!(app.session.tool_options_of("tangentCircle")["center"], json!(false));
|
||||
// Every color has a label, in the same order.
|
||||
assert_eq!(super::TANGENT_CIRCLE_COLORS.len(), vectorcraft_tools::addons::tangent_circle::COLORS.len());
|
||||
for (label, (name, _)) in super::TANGENT_CIRCLE_COLORS.iter().zip(vectorcraft_tools::addons::tangent_circle::COLORS) {
|
||||
assert_eq!(label.to_lowercase(), *name);
|
||||
}
|
||||
}
|
||||
|
||||
/// The Tangent Circle tool's options dialog shows a fractional snapping tolerance as it is, and its
|
||||
/// labels end before the fields beside them.
|
||||
#[test]
|
||||
fn the_tangent_circle_options_show_a_fractional_tolerance_beside_its_whole_label() {
|
||||
fn texts(s: &egui::Shape, out: &mut Vec<(String, egui::Rect)>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => out.push((t.galley.text().to_string(), t.galley.rect.translate(t.pos.to_vec2()))),
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| texts(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let mut app = app();
|
||||
app.run("tool.setOption", json!({"tool": "tangentCircle", "values": {"snapTolerance": 7.5}})).unwrap();
|
||||
app.run("tool.options", json!({"tool": "tangentCircle"})).unwrap();
|
||||
let ctx = egui::Context::default();
|
||||
crate::theme::install_fonts(&ctx);
|
||||
ctx.run_ui(egui::RawInput::default(), |ui| crate::dialogs::show(&mut app, ui.ctx())).textures_delta.clear();
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| crate::dialogs::show(&mut app, ui.ctx()));
|
||||
out.textures_delta.clear();
|
||||
let mut painted = vec![];
|
||||
out.shapes.iter().for_each(|c| texts(&c.shape, &mut painted));
|
||||
let at = |text: &str| painted.iter().find(|(t, _)| t == text).map(|(_, r)| *r).unwrap_or_else(|| panic!("no {text} in {painted:?}"));
|
||||
let (label, field) = (at("Snap Tolerance:"), at("7.5 px"));
|
||||
assert!(label.right() <= field.left(), "{label:?} runs into {field:?}");
|
||||
assert!(label.right() <= at("36 pt").left(), "the Radius field lines up with it");
|
||||
assert_eq!(app.session.tool_options_of("tangentCircle")["snapTolerance"].as_f64(), Some(7.5));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_parametric_shape_panel_opens_from_the_submenu_and_shows_the_shape() {
|
||||
let mut app = app();
|
||||
|
||||
@@ -7587,6 +7587,10 @@ breakText Glyphs Глифи
|
||||
Tangent Circle Допирателна окръжност
|
||||
Tangent Circle Tool Инструмент „Допирателна окръжност“
|
||||
No tangent circle here Тук няма допирателна окръжност
|
||||
Circle Center Център на окръжността
|
||||
Circle Radii Lines Линии на радиусите
|
||||
Snap Tolerance: Толеранс на прилепване:
|
||||
Snap When Smart Guides Are Off Прилепване при изключени интелигентни водачи
|
||||
Circle: Окръжност:
|
||||
@msg `ids` names an object twice `ids` посочва обект два пъти
|
||||
@msg select two or three paths or compound paths изберете два или три пътя или съставни пътя
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7636,6 +7636,10 @@ shape Open Otvoren
|
||||
Tangent Circle Tangentna kružnica
|
||||
Tangent Circle Tool Alat tangentna kružnica
|
||||
No tangent circle here Ovdje nema tangentne kružnice
|
||||
Circle Center Središte kružnice
|
||||
Circle Radii Lines Linije poluprečnika
|
||||
Snap Tolerance: Tolerancija hvatanja:
|
||||
Snap When Smart Guides Are Off Hvatanje kad su pametne vodilice isključene
|
||||
Circle: Kružnica:
|
||||
@msg `ids` names an object twice `ids` navodi objekat dvaput
|
||||
@msg select two or three paths or compound paths odaberite dvije ili tri putanje ili složene putanje
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -8468,6 +8468,10 @@ breakText Glyphs Glifs
|
||||
Tangent Circle Cercle tangent
|
||||
Tangent Circle Tool Eina de cercle tangent
|
||||
No tangent circle here Aquí no hi ha cap cercle tangent
|
||||
Circle Center Centre del cercle
|
||||
Circle Radii Lines Línies dels radis
|
||||
Snap Tolerance: Tolerància d’ajust:
|
||||
Snap When Smart Guides Are Off Ajusta amb les guies intel·ligents desactivades
|
||||
Circle: Cercle:
|
||||
@msg `ids` names an object twice `ids` indica un objecte dues vegades
|
||||
@msg select two or three paths or compound paths seleccioneu dos o tres camins o camins compostos
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8449,6 +8449,10 @@ breakText Glyphs Glyfy
|
||||
Tangent Circle Tečná kružnice
|
||||
Tangent Circle Tool Nástroj Tečná kružnice
|
||||
No tangent circle here Zde není žádná tečná kružnice
|
||||
Circle Center Střed kružnice
|
||||
Circle Radii Lines Čáry poloměrů
|
||||
Snap Tolerance: Tolerance přichytávání:
|
||||
Snap When Smart Guides Are Off Přichytávat při vypnutých chytrých vodítkách
|
||||
Circle: Kružnice:
|
||||
@msg `ids` names an object twice `ids` uvádí některý objekt dvakrát
|
||||
@msg select two or three paths or compound paths vyberte dvě nebo tři cesty nebo složené cesty
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -10505,6 +10505,10 @@ breakText Glyphs Glyffer
|
||||
Tangent Circle Tangentcirkel
|
||||
Tangent Circle Tool Tangentcirkel-værktøj
|
||||
No tangent circle here Ingen tangentcirkel her
|
||||
Circle Center Cirklens centrum
|
||||
Circle Radii Lines Radiuslinjer
|
||||
Snap Tolerance: Snap-tolerance:
|
||||
Snap When Smart Guides Are Off Snap, når smarte hjælpelinjer er slået fra
|
||||
Circle: Cirkel:
|
||||
@msg `ids` names an object twice `ids` nævner et objekt to gange
|
||||
@msg select two or three paths or compound paths vælg to eller tre stier eller sammensatte stier
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8074,6 +8074,10 @@ breakText Glyphs Glyphen
|
||||
Tangent Circle Tangentialkreis
|
||||
Tangent Circle Tool Tangentialkreis-Werkzeug
|
||||
No tangent circle here Hier kein Tangentialkreis
|
||||
Circle Center Kreismittelpunkt
|
||||
Circle Radii Lines Radiuslinien
|
||||
Snap Tolerance: Einrasttoleranz:
|
||||
Snap When Smart Guides Are Off Einrasten bei ausgeschalteten intelligenten Hilfslinien
|
||||
Circle: Kreis:
|
||||
@msg `ids` names an object twice `ids` nennt ein Objekt zweimal
|
||||
@msg select two or three paths or compound paths wählen Sie zwei oder drei Pfade oder zusammengesetzte Pfade aus
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8440,6 +8440,10 @@ breakText Glyphs Γλύφοι
|
||||
Tangent Circle Εφαπτόμενος κύκλος
|
||||
Tangent Circle Tool Εφαπτόμενος κύκλος (Tangent Circle Tool)
|
||||
No tangent circle here Δεν υπάρχει εφαπτόμενος κύκλος εδώ
|
||||
Circle Center Κέντρο κύκλου
|
||||
Circle Radii Lines Γραμμές ακτίνων
|
||||
Snap Tolerance: Ανοχή προσκόλλησης:
|
||||
Snap When Smart Guides Are Off Προσκόλληση με ανενεργούς έξυπνους οδηγούς
|
||||
Circle: Κύκλος:
|
||||
@msg `ids` names an object twice το `ids` αναφέρει ένα αντικείμενο δύο φορές
|
||||
@msg select two or three paths or compound paths επιλέξτε δύο ή τρεις διαδρομές ή σύνθετες διαδρομές
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8426,6 +8426,10 @@ breakText Glyphs Glifos
|
||||
Tangent Circle Círculo tangente
|
||||
Tangent Circle Tool Herramienta Círculo tangente
|
||||
No tangent circle here No hay círculo tangente aquí
|
||||
Circle Center Centro del círculo
|
||||
Circle Radii Lines Líneas de radio
|
||||
Snap Tolerance: Tolerancia de ajuste:
|
||||
Snap When Smart Guides Are Off Ajustar con las guías inteligentes desactivadas
|
||||
Circle: Círculo:
|
||||
@msg `ids` names an object twice `ids` indica un objeto dos veces
|
||||
@msg select two or three paths or compound paths seleccione dos o tres trazados o trazados compuestos
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8516,6 +8516,10 @@ breakText Glyphs Merkit
|
||||
Tangent Circle Sivuava ympyrä
|
||||
Tangent Circle Tool Sivuava ympyrä -työkalu
|
||||
No tangent circle here Tässä ei ole sivuavaa ympyrää
|
||||
Circle Center Ympyrän keskipiste
|
||||
Circle Radii Lines Säteiden viivat
|
||||
Snap Tolerance: Tartuntatoleranssi:
|
||||
Snap When Smart Guides Are Off Tartu, kun älykkäät apuviivat eivät ole käytössä
|
||||
Circle: Ympyrä:
|
||||
@msg `ids` names an object twice `ids` mainitsee saman objektin kahdesti
|
||||
@msg select two or three paths or compound paths valitse kaksi tai kolme polkua tai yhdistelmäpolkua
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8445,6 +8445,10 @@ breakText Glyphs Glyphes
|
||||
Tangent Circle Cercle tangent
|
||||
Tangent Circle Tool Outil Cercle tangent
|
||||
No tangent circle here Aucun cercle tangent ici
|
||||
Circle Center Centre du cercle
|
||||
Circle Radii Lines Lignes des rayons
|
||||
Snap Tolerance: Tolérance du magnétisme :
|
||||
Snap When Smart Guides Are Off Magnétisme avec les repères commentés désactivés
|
||||
Circle: Cercle :
|
||||
@msg `ids` names an object twice `ids` désigne deux fois le même objet
|
||||
@msg select two or three paths or compound paths sélectionnez deux ou trois tracés ou tracés transparents
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4336,6 +4336,11 @@ arrowhead Feather પીંછું
|
||||
Tangent Circle સ્પર્શક વર્તુળ
|
||||
Tangent Circle Tool સ્પર્શક વર્તુળ ટૂલ
|
||||
No tangent circle here અહીં કોઈ સ્પર્શક વર્તુળ નથી
|
||||
Circle Center વર્તુળનું કેન્દ્ર
|
||||
Circle Radii Lines ત્રિજ્યા રેખાઓ
|
||||
Snap Tolerance: સ્નેપ સહનશીલતા:
|
||||
Snap When Smart Guides Are Off સ્માર્ટ ગાઇડ બંધ હોય ત્યારે સ્નેપ કરો
|
||||
Magenta મેજેન્ટા
|
||||
Tangent Circle… સ્પર્શક વર્તુળ…
|
||||
Taper ટેપર
|
||||
Target લક્ષ્ય
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 72 and column 5.
|
@@ -5889,6 +5889,10 @@ arrowhead Feather पंख
|
||||
Tangent Circle स्पर्शी वृत्त
|
||||
Tangent Circle Tool स्पर्शी वृत्त टूल
|
||||
No tangent circle here यहाँ कोई स्पर्शी वृत्त नहीं है
|
||||
Circle Center वृत्त का केंद्र
|
||||
Circle Radii Lines त्रिज्या रेखाएँ
|
||||
Snap Tolerance: स्नैप सहिष्णुता:
|
||||
Snap When Smart Guides Are Off स्मार्ट गाइड्स बंद होने पर स्नैप करें
|
||||
Tangent Circle… स्पर्शी वृत्त…
|
||||
Taper टेपर
|
||||
Target लक्ष्य
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8435,6 +8435,10 @@ breakText Glyphs Glifák
|
||||
Tangent Circle Érintőkör
|
||||
Tangent Circle Tool Érintőkör eszköz
|
||||
No tangent circle here Itt nincs érintőkör
|
||||
Circle Center Kör középpontja
|
||||
Circle Radii Lines Sugárvonalak
|
||||
Snap Tolerance: Illesztési tűrés:
|
||||
Snap When Smart Guides Are Off Illesztés kikapcsolt intelligens segédvonalaknál
|
||||
Circle: Kör:
|
||||
@msg `ids` names an object twice `ids`: egy objektumot kétszer nevez meg
|
||||
@msg select two or three paths or compound paths jelölj ki két vagy három útvonalat vagy összetett útvonalat
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8290,6 +8290,10 @@ breakText Glyphs Glif
|
||||
Tangent Circle Lingkaran singgung
|
||||
Tangent Circle Tool Alat lingkaran singgung
|
||||
No tangent circle here Tidak ada lingkaran singgung di sini
|
||||
Circle Center Pusat lingkaran
|
||||
Circle Radii Lines Garis jari-jari
|
||||
Snap Tolerance: Toleransi kancing:
|
||||
Snap When Smart Guides Are Off Kancing saat panduan cerdas nonaktif
|
||||
Circle: Lingkaran:
|
||||
@msg `ids` names an object twice `ids` menyebut satu objek dua kali
|
||||
@msg select two or three paths or compound paths pilih dua atau tiga jalur atau jalur gabungan
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8112,6 +8112,10 @@ breakText Glyphs Glifi
|
||||
Tangent Circle Cerchio tangente
|
||||
Tangent Circle Tool Strumento Cerchio tangente
|
||||
No tangent circle here Nessun cerchio tangente qui
|
||||
Circle Center Centro del cerchio
|
||||
Circle Radii Lines Linee dei raggi
|
||||
Snap Tolerance: Tolleranza di aggancio:
|
||||
Snap When Smart Guides Are Off Aggancia con le guide sensibili disattivate
|
||||
Circle: Cerchio:
|
||||
@msg `ids` names an object twice `ids` indica due volte lo stesso oggetto
|
||||
@msg select two or three paths or compound paths seleziona due o tre tracciati o tracciati composti
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -10001,6 +10001,10 @@ breakText Glyphs 字形
|
||||
Tangent Circle 接円
|
||||
Tangent Circle Tool 接円ツール
|
||||
No tangent circle here ここに接円はありません
|
||||
Circle Center 円の中心
|
||||
Circle Radii Lines 半径の線
|
||||
Snap Tolerance: スナップ許容値:
|
||||
Snap When Smart Guides Are Off スマートガイドがオフのときもスナップ
|
||||
Circle: 円:
|
||||
@msg `ids` names an object twice `ids` に同じオブジェクトが 2 回指定されています
|
||||
@msg select two or three paths or compound paths パスまたは複合パスを 2 つか 3 つ選択してください
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -10623,6 +10623,10 @@ breakText Glyphs გლიფები
|
||||
Tangent Circle მხები წრე
|
||||
Tangent Circle Tool მხები წრის ხელსაწყო
|
||||
No tangent circle here აქ მხები წრე არ არის
|
||||
Circle Center წრის ცენტრი
|
||||
Circle Radii Lines რადიუსის ხაზები
|
||||
Snap Tolerance: მიბმის დაშვება:
|
||||
Snap When Smart Guides Are Off მიბმა, როცა ჭკვიანი დამხმარე ხაზები გამორთულია
|
||||
Circle: წრე:
|
||||
@msg `ids` names an object twice `ids` ერთსა და იმავე ობიექტს ორჯერ მიუთითებს
|
||||
@msg select two or three paths or compound paths მონიშნეთ ორი ან სამი ტრაექტორია ან შედგენილი ტრაექტორია
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8084,6 +8084,10 @@ breakText Glyphs 글리프
|
||||
Tangent Circle 접원
|
||||
Tangent Circle Tool 접원 도구
|
||||
No tangent circle here 여기에는 접원이 없음
|
||||
Circle Center 원 중심
|
||||
Circle Radii Lines 반지름 선
|
||||
Snap Tolerance: 스냅 허용 오차:
|
||||
Snap When Smart Guides Are Off 스마트 안내선이 꺼져 있을 때 스냅
|
||||
Circle: 원:
|
||||
@msg `ids` names an object twice `ids`에 같은 오브젝트가 두 번 있습니다
|
||||
@msg select two or three paths or compound paths 패스나 컴파운드 패스를 두 개 또는 세 개 선택하세요
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -10343,6 +10343,10 @@ breakText Glyphs Glyphs
|
||||
Tangent Circle Raakcirkel
|
||||
Tangent Circle Tool Raakcirkel-gereedschap
|
||||
No tangent circle here Hier geen raakcirkel
|
||||
Circle Center Middelpunt van cirkel
|
||||
Circle Radii Lines Straallijnen
|
||||
Snap Tolerance: Snapping-tolerantie:
|
||||
Snap When Smart Guides Are Off Snappen als slimme hulplijnen uit zijn
|
||||
Circle: Cirkel:
|
||||
@msg `ids` names an object twice `ids` noemt een object twee keer
|
||||
@msg select two or three paths or compound paths selecteer twee of drie paden of samengestelde paden
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8308,6 +8308,10 @@ breakText Glyphs Glify
|
||||
Tangent Circle Okrąg styczny
|
||||
Tangent Circle Tool Narzędzie Okrąg styczny
|
||||
No tangent circle here Brak okręgu stycznego w tym miejscu
|
||||
Circle Center Środek okręgu
|
||||
Circle Radii Lines Linie promieni
|
||||
Snap Tolerance: Tolerancja przyciągania:
|
||||
Snap When Smart Guides Are Off Przyciągaj przy wyłączonych inteligentnych liniach pomocniczych
|
||||
Circle: Okrąg:
|
||||
@msg `ids` names an object twice `ids` wskazuje ten sam obiekt dwa razy
|
||||
@msg select two or three paths or compound paths zaznacz dwie lub trzy ścieżki lub ścieżki złożone
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8468,6 +8468,10 @@ breakText Glyphs Glifos
|
||||
Tangent Circle Círculo tangente
|
||||
Tangent Circle Tool Ferramenta Círculo tangente
|
||||
No tangent circle here Nenhum círculo tangente aqui
|
||||
Circle Center Centro do Círculo
|
||||
Circle Radii Lines Linhas dos Raios
|
||||
Snap Tolerance: Tolerância de Ajuste:
|
||||
Snap When Smart Guides Are Off Ajustar com as Guias Inteligentes Desligadas
|
||||
Circle: Círculo:
|
||||
@msg `ids` names an object twice `ids` indica um objeto duas vezes
|
||||
@msg select two or three paths or compound paths selecione dois ou três caminhos ou caminhos compostos
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8440,6 +8440,10 @@ breakText Glyphs Глифы
|
||||
Tangent Circle Касательная окружность
|
||||
Tangent Circle Tool Инструмент «Касательная окружность»
|
||||
No tangent circle here Здесь нет касательной окружности
|
||||
Circle Center Центр окружности
|
||||
Circle Radii Lines Линии радиусов
|
||||
Snap Tolerance: Допуск привязки:
|
||||
Snap When Smart Guides Are Off Привязка при выключенных умных направляющих
|
||||
Circle: Окружность:
|
||||
@msg `ids` names an object twice `ids` указывает объект дважды
|
||||
@msg select two or three paths or compound paths выделите два или три контура или составных контура
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8484,6 +8484,10 @@ breakText Glyphs Glyfer
|
||||
Tangent Circle Tangentcirkel
|
||||
Tangent Circle Tool Tangentcirkelverktyget
|
||||
No tangent circle here Ingen tangentcirkel här
|
||||
Circle Center Cirkelns mittpunkt
|
||||
Circle Radii Lines Radielinjer
|
||||
Snap Tolerance: Fästtolerans:
|
||||
Snap When Smart Guides Are Off Fäst när smarta stödlinjer är av
|
||||
Circle: Cirkel:
|
||||
@msg `ids` names an object twice `ids` anger ett objekt två gånger
|
||||
@msg select two or three paths or compound paths markera två eller tre banor eller sammansatta banor
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -10339,6 +10339,10 @@ breakText Glyphs Glifler
|
||||
Tangent Circle Teğet Daire
|
||||
Tangent Circle Tool Teğet Daire Aracı
|
||||
No tangent circle here Burada teğet daire yok
|
||||
Circle Center Daire Merkezi
|
||||
Circle Radii Lines Yarıçap Çizgileri
|
||||
Snap Tolerance: Yapışma Toleransı:
|
||||
Snap When Smart Guides Are Off Akıllı Kılavuzlar Kapalıyken Yapış
|
||||
Circle: Daire:
|
||||
@msg `ids` names an object twice `ids` bir nesneyi iki kez belirtiyor
|
||||
@msg select two or three paths or compound paths iki veya üç yol ya da bileşik yol seçin
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8094,6 +8094,10 @@ breakText Glyphs Гліфи
|
||||
Tangent Circle Дотичне коло
|
||||
Tangent Circle Tool Інструмент «Дотичне коло»
|
||||
No tangent circle here Тут немає дотичного кола
|
||||
Circle Center Центр кола
|
||||
Circle Radii Lines Лінії радіусів
|
||||
Snap Tolerance: Допуск прив’язки:
|
||||
Snap When Smart Guides Are Off Прив’язка, коли розумні напрямні вимкнено
|
||||
Circle: Коло:
|
||||
@msg `ids` names an object twice `ids` указує об’єкт двічі
|
||||
@msg select two or three paths or compound paths виділіть два або три контури чи складені контури
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8140,6 +8140,10 @@ breakText Glyphs Glyph
|
||||
Tangent Circle Đường tròn tiếp xúc
|
||||
Tangent Circle Tool Công cụ Đường tròn tiếp xúc
|
||||
No tangent circle here Không có đường tròn tiếp xúc ở đây
|
||||
Circle Center Tâm đường tròn
|
||||
Circle Radii Lines Đường bán kính
|
||||
Snap Tolerance: Dung sai hút:
|
||||
Snap When Smart Guides Are Off Hút khi tắt đường căn thông minh
|
||||
Circle: Đường tròn:
|
||||
@msg `ids` names an object twice `ids` nêu một đối tượng hai lần
|
||||
@msg select two or three paths or compound paths chọn hai hoặc ba đường dẫn hoặc đường dẫn phức hợp
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8318,6 +8318,10 @@ breakText Glyphs 字形
|
||||
Tangent Circle 相切圆
|
||||
Tangent Circle Tool 相切圆工具
|
||||
No tangent circle here 此处没有相切圆
|
||||
Circle Center 圆心
|
||||
Circle Radii Lines 半径线
|
||||
Snap Tolerance: 吸附容差:
|
||||
Snap When Smart Guides Are Off 智能参考线关闭时也吸附
|
||||
Circle: 圆:
|
||||
@msg `ids` names an object twice `ids` 重复指定了同一个对象
|
||||
@msg select two or three paths or compound paths 请选择两个或三个路径或复合路径
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8142,6 +8142,10 @@ breakText Glyphs 字符
|
||||
Tangent Circle 相切圓
|
||||
Tangent Circle Tool 相切圓工具
|
||||
No tangent circle here 此處沒有相切圓
|
||||
Circle Center 圓心
|
||||
Circle Radii Lines 半徑線
|
||||
Snap Tolerance: 靠齊容許度:
|
||||
Snap When Smart Guides Are Off 智慧型參考線關閉時也靠齊
|
||||
Circle: 圓:
|
||||
@msg `ids` names an object twice `ids` 將同一個物件指定了兩次
|
||||
@msg select two or three paths or compound paths 請選取兩個或三個路徑或複合路徑
|
||||
|
||||
|
Can't render this file because it is too large.
|
+11
-4
@@ -14545,8 +14545,9 @@ Tools:
|
||||
preferences): `diameter` (0.25 to 200 pt, 20), `tolerance` (how near two anchors count as coincident, 0 to 3 pt,
|
||||
0.002) and `together` (Keep Shared Points Together).
|
||||
- **Tangent Circle Tool** (`tangentCircle`): draws a circle on two path segments of any unlocked paths, selected or
|
||||
not. A click picks the first segment; over a second segment the circle that would be drawn shows (red) with its
|
||||
center, its radii to the two touch points and its radius, or a note that there is none. A click there draws the
|
||||
not. A click picks the segment nearest the pointer within reach (see `snapTolerance` below) as the first segment;
|
||||
over a second segment the circle that would be drawn shows (in `color`) with its center cross, its radii to the two
|
||||
touch points (`center`, `radii`) and its radius, or a note that there is none. A click there draws the
|
||||
circle that is tangent to the first segment at the point clicked and touches the second (its center on the first
|
||||
segment's normal there). With Shift the circle instead has the tool's `radius` and may touch the first segment
|
||||
anywhere along it. A drag from the second segment sets the radius to the drag's length, and the circle may again
|
||||
@@ -14566,8 +14567,14 @@ Tools:
|
||||
change to the first segment that makes no undo step (a live preview, or one that was canceled) forgets the first
|
||||
segment. The circle is looked for again whenever either segment no longer has the shape it was found on, so a
|
||||
canceled preview does not leave a circle worked out on the previewed paths.
|
||||
Option (`tool.setOption`, or a double-click on the tool): `radius` (pt, 0.01 to 1000000, 36). `tool.setOption`
|
||||
gives an error for a value outside that range or one that is not a number, and for any other option.
|
||||
Options (`tool.setOption`, or a double-click on the tool; kept with the preferences): `radius` (pt, 0.01 to
|
||||
1000000, 36); `center` and `radii` (true or false, both true) show the center cross and the radii; `color` (`red`,
|
||||
`blue`, `magenta`, `green`, `black` or `gray`; `red`) is the color of the circle, the cross, the radii and the note;
|
||||
`snapTolerance` (screen pixels, 0 to 25, 3; VectorCraft's own range and default) is how near the pointer picks a
|
||||
segment while Smart Guides are on (their Snapping Tolerance counts instead when it is larger) or while they are off
|
||||
with `snapWithoutGuides` (true or false, true) on. Otherwise a segment is picked within the Selection Tolerance, which is also the least reach with snapping.
|
||||
`tool.setOption` gives an error for a value outside an option's range, of the wrong type, or a color not listed, and
|
||||
for any other option, and then sets none of the values.
|
||||
- **Trim at Crossings Tool** (`trimAtCrossings`): removes stretches of paths between the places where they are crossed,
|
||||
on any path that can be edited, selected or not. A click runs `addon.pathtools.trim` with `at`, for the path within 4
|
||||
screen pixels of the pointer. A drag draws a rectangle and runs it with `rect` on release; once the pointer has
|
||||
|
||||
@@ -2997,6 +2997,8 @@ A VectorCraft addition, not a feature of the reference app, so no area score mov
|
||||
|
||||
A VectorCraft addition, so no area score moves. The Tangent Circle Tool (`tangentCircle`; Object › Plug-ins › Path Precision Tools and the All Tools drawer) draws a circle on two clicked path segments: tangent to the first at the point clicked (its center on the normal there) and touching the second segment or one beside it on its subpath, the touch nearest the pointer winning. Shift gives the circle the tool's radius, and a drag from the second segment sets the radius to the drag's length (Shift: steps of 1, 2 or 5 times a power of 10 pt, at least 4 screen pixels; Cmd/Ctrl: a tenth of the movement); with a radius the circle may touch the first segment anywhere along it. Before the click the circle shows with its center, radii and radius, or a note says there is none. The circles are found by sampling the distance to the second segments along the first segment's normal (or along the first segment, for a radius) and taking the places where it equals the radius (samples, bisection where it crosses, and a search where it only touches). Left out are circles whose nearest point of the second segments is not on the circle (within a millionth of the radius: where the first segment turns back on itself the distance jumps past the radius without a touch), circles that cross the first segment, circles that touch both segments at one point, circles without a finite radius above 0, circles too small or too large for three of their points to give them back in floating point, and circles that would reach past the canvas; a circle found twice (the same center, touching the first segment at the same point) is kept once. The circle is a new ellipse with the current paint, one undo step; the first segment stays picked until it is drawn, also when drawing fails or the press is canceled, and the circles are looked for again when a live preview, or one that was canceled, changes either segment without an undo step (a changed first segment is forgotten). Tests: `tangent_circle::tests` in `vectorcraft-pathops` (parallel and crossing lines, a curved second segment, a corner's fillet, lines twice the radius apart, a touch between the places tried, the ends of a line with its handles on its anchors, a circle that crosses the first segment, a first segment that turns back, no circle), `addons::tangent_circle::tests` in `vectorcraft-tools` (two clicks, Shift and the radius option, a drag with Shift and Cmd/Ctrl, no circle and Escape, a canceled press, a canceled preview, a circle its three points cannot draw, a circle past the canvas), the session test for a failed draw in `vectorcraft-engine` and the Path Precision Tools menu, options, drawer and catalog tests in `vectorcraft-ui-egui`. Commands: `docs/mcp.md` › Path Precision Tools add-on.
|
||||
|
||||
The tool's options dialog also sets the preview and how a segment is picked, the options the help page lists (https://docs.astutegraphics.com/subscribe/tangent-circle-tool): Circle Center and Circle Radii Lines (`center`, `radii`) show or hide the center cross and the radii, Color (`color`: red, blue, magenta, green, black or gray) colors the circle, the cross, the radii and the note, Snap Tolerance (`snapTolerance`, screen pixels) is how near the pointer picks a segment with Smart Guides on, the Smart Guides Snapping Tolerance counting when it is larger, and Snap When Smart Guides Are Off (`snapWithoutGuides`) keeps that reach with Smart Guides off; without it the Selection Tolerance applies. Of the segments within reach the nearest is picked. The defaults (both shown, red, 3 px, snapping on) and the 0 to 25 px range are VectorCraft's own; they are kept with the preferences, and `tool.setOption` gives an error for a value an option does not take. Tests: `addons::tangent_circle::tests` in `vectorcraft-tools` (the preview options, the snapping reach, the options' values) and `the_tangent_circle_options_set_the_preview_and_snapping` in `vectorcraft-ui-egui`.
|
||||
|
||||
## Path Precision Tools add-on: Trim at Crossings (2026-11-13)
|
||||
|
||||
A VectorCraft addition, not a feature of the reference app, so no area score moves. Object › Plug-ins › Path Precision Tools › Trim at Crossings Tool (also in the Scissors tool's group in both shipped toolbars, after the Knife, since 2026-11-16; a toolbar edited before keeps its saved layout until Reset Toolbar; no shortcut) removes stretches of paths between the places where they are crossed by another path or by themselves, on any path that can be edited, selected or not. A click removes the stretch under the pointer, a drag removes every stretch its rectangle touches, and an Alt-drag removes every stretch its freehand line crosses; each is one undo step, and Escape during a drag removes nothing. A closed path that loses a stretch becomes open, an open path that loses a middle stretch becomes two paths with its appearance in its place in the stacking order, a path that nothing crosses is removed whole, and the stretches that stay get no new anchors. Hidden and locked paths, guides and clipping paths are not trimmed and do not count as crossing. Add Points at / Split at Crossings share the crossing search: segments that meet at an anchor now count where they cross again elsewhere, and with Self Crossings a curved segment that loops over itself crosses itself. Command `addon.pathtools.trim`; `vectorcraft_pathops::addons::pathtools::{crossings_on, spans, without_spans}`. Hovering shows in red the stretch a click would remove, worked out by the same code the command uses (`vectorcraft_tools::addons::trim::plan`), and a drag that reaches at most 32 paths shows what its release would remove; a preview spends at most a twentieth of the crossing work a click may (2026-11-15; tests `hovering_*`, `in_isolation_mode_*`, `a_path_whose_crossings_*` and `a_small_drag_*` in `addons::trim` in `vectorcraft-tools`, `hovering_with_the_tool_shows_the_stretch_its_click_removes` and `what_the_tool_shows_*` in `vectorcraft-engine`). Not yet: crossings with type, images and symbol instances. Tests: `crossings_on_*`, `segments_*`, `a_segment_that_loops_over_itself_crosses_itself`, `one_work_budget_*`, `spans_divide_*`, `a_subpath_without_*` and `a_slice_*` in `addons::pathtools::tests` in `vectorcraft-pathops`, `addons::trim` in `vectorcraft-tools` (click, rectangle, freehand line, Escape), `cmd::addons::pathtools::trim::tests` in `vectorcraft-engine` (a middle and an end stretch, a closed path opening, a rectangle and a line as one undo step, locked and hidden paths, guides and clipping paths, paths nothing crosses, compound path members, the selection, 3,000 other paths, a path too large to search left alone until touched, bad params refused), `the_plugins_submenu_selects_the_tools_and_opens_the_anchor_inspector` in `vectorcraft-ui-egui`, `edit_toolbar::tests` and `command_sweep`. Commands: `docs/mcp.md` › Path Precision Tools add-on. The tool shows the Knife's cursor, now drawn as a knife with the blade's point on the hotspot (2026-11-16; tests `trim_at_crossings_is_in_the_scissors_flyout` and `a_saved_toolbar_without_trim_at_crossings_keeps_its_layout` in `edit_toolbar::tests`, `trim_at_crossings_is_in_the_scissors_group_once` in `addons::tests`, `headless_backend_methods` in `vectorcraft-mcp`, `the_knife_shows_a_knife_with_its_point_on_the_hotspot` in `cursors::tests` and `drawing_tools_show_their_own_cursor` in `vectorcraft-tools`).
|
||||
|
||||
+1
-1
@@ -554,7 +554,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Divide into Dashes… (Dash and Gap in any unit, Fit to Corners and Ends, Remove Gaps; Preview) cuts the selected paths, or only their direct-selected segments, into open pieces along the curve, keeping their appearance, one undo step | done | #4950; `addon.pathtools.divideDashes`, `crates/pathops/src/addons/pathtools/dashes.rs`, `crates/ui-egui/src/addons/pathtools/dashes.rs` and their tests; not a feature of the reference app, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Set Corners… (also a button in the Anchor Inspector's Corners section: Radius in any unit, Corner kind, Anchors: All, Odd-Numbered or Even-Numbered, counted from each path's first anchor; Angle: from … to …°, only the corners whose sides meet at an angle in that range; Preview) cuts corners on the chosen anchors of every selected path, one undo step | done | #5546, #5545; `addon.pathtools.cornerSet` (`every`, `minAngle`, `maxAngle`), `crates/ui-egui/src/addons/pathtools/set_corners.rs` and their tests; not a feature of the reference app, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Trim at Crossings Tool (also in the Scissors tool's group in both shipped toolbars, after the Knife, and listed there in the All Tools drawer; a toolbar edited before keeps its saved layout until Reset Toolbar; no shortcut until one is set in Edit › Keyboard Shortcuts › Tools; the Knife's cursor, drawn as a knife with the blade's point on the hotspot) removes stretches of paths between the places where they are crossed, on any editable path, selected or not: a click removes the stretch under the pointer, a drag removes every stretch its rectangle touches, and an Alt-drag removes every stretch its freehand line crosses; one undo step each; Escape during a drag removes nothing; hovering shows in red the stretch a click would remove, and a drag that reaches few paths shows what its release would remove | done | `addon.pathtools.trim` (in `crates/engine/src/cmd/addons/pathtools/trim.rs`), `crates/tools/src/addons/trim.rs` and their tests; not a feature of the reference app, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Tangent Circle Tool (also in the All Tools drawer): a click on a path segment, then on another, draws the circle tangent to the first at the point clicked that touches the second or a segment beside it; Shift uses the tool's radius (36 pt to start, set in its options) 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 first, or a note when there is none; one undo step | done | tool `tangentCircle` (in `crates/tools/src/addons/tangent_circle.rs`, geometry in `crates/pathops/src/addons/pathtools/tangent_circle/on_segments.rs`) and its tests; a VectorCraft addition, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Tangent Circle Tool (also in the All Tools drawer): a click on a path segment, then on another, draws the circle tangent to the first at the point clicked that touches the second or a segment beside it; Shift uses the tool's radius (36 pt to start, set in its options) 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 first, or a note when there is none (its options show or hide the center cross and the radii, set their color, and set how near a segment is picked with Smart Guides on or off); one undo step | done | tool `tangentCircle` (in `crates/tools/src/addons/tangent_circle.rs`, geometry in `crates/pathops/src/addons/pathtools/tangent_circle/on_segments.rs`) and its tests; a VectorCraft addition, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Expand Dashes into Paths turns each selected path's dashed stroke into separate open paths, one per dash, laid out as the stroke draws them (pattern, offset, Align Dashes to Corners and Path Ends), each keeping the stroke with the dashes off; one undo step | done | #4922; `addon.pathtools.expandDashes` (in `crates/engine/src/cmd/addons/pathtools.rs`, using the renderer's dash layout) and its tests; not a feature of the reference app, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Smooth Bridge… (Radius as a percentage of the smaller circle's radius, or with Constant Gap that radius plus a gap; Reach; Keep Originals; Preview) joins two selected circles into one outline with two concave arcs that touch both circles, or three or more each to the others within reach, united where the bridges connect, in place of the circles or above them (a pair within reach gets no bridge when its arcs would not reach both circles or would cross, or when its neck would be thinner than the precision its shape is united at; a circle bridged to no other stays as it is); one undo step | done | `addon.pathtools.bridge`, `crates/pathops/src/addons/pathtools/bridge.rs`, `crates/ui-egui/src/addons/pathtools/bridge.rs` and their tests; a VectorCraft addition, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Tangent Circle… draws the circles that touch two selected paths or compound paths at a radius, or three of them, each touching the outlines without crossing them; Radius (two shapes), a Circle menu (All or one by number) and Preview; one undo step | done | `addon.pathtools.tangentCircle` (in `crates/engine/src/cmd/addons/pathtools/tangent_circle.rs`, geometry in `crates/pathops/src/addons/pathtools/tangent_circle.rs`) and its tests; a VectorCraft addition, so it is not scored |
|
||||
|
||||
Reference in New Issue
Block a user