Flare: a flare keeps its settings and can be edited after it is drawn

A flare drawn with the Flare tool or shape.flare now keeps the settings
it was drawn with and the transform it has had since. With flares
selected, double-clicking the Flare tool opens Flare Tool Options filled
from the first one, and OK draws the selected flares again in their
place as one undo step (none when nothing changed). With one flare
selected, the Flare tool shows its center and end handles, and dragging
either changes the flare's length or direction. Object > Expand turns a
flare into a plain group of its parts.

- shape.editFlare draws flares again with the settings it is given.
- A flare whose parts were edited, or that is locked or hidden, is not
  edited as a flare.
- shape.flare returns an error for a fractional or negative count.
- Native files save a flare's settings.
This commit is contained in:
dotCooCoo committed 2026-11-15 06:37:03 -08:00
1 parent 0c1ac3bdc5
commit 578072babb
46 files changed
+1043 -134

No files matched your search

+326
View File
@@ -0,0 +1,326 @@
//! Flare objects: the settings a flare group was drawn with (the Flare tool, `shape.flare`). Its
//! children are ordinary paths for every renderer and exporter; the settings let it be drawn again.
use serde::{Deserialize, Serialize};
use serde_json::Value;
use vectorcraft_color::{BlendMode, Color, Gradient, GradientGeom, GradientKind, GradientPaint, GradientStop, Paint};
use vectorcraft_geom::{Affine, BezPath, PathData, Point, Rect, Vec2, shapes};
use crate::Appearance;
use crate::node::{Node, NodeId, NodeKind};
/// The seed of the sizes a flare's rays and rings take when its settings give none.
pub const DEFAULT_SEED: u64 = 0x2545_f491_4f6c_dd1d;
/// One part of a flare: its name, outline, fill and opacity.
pub type Part = (&'static str, PathData, Paint, f32);
/// The number `key` of the settings `v`, or `default`.
fn number(v: &Value, key: &str, default: f64) -> f64 {
v.get(key).and_then(Value::as_f64).unwrap_or(default)
}
/// The parts of a flare with the settings `v` (`shape.flare`'s params, each one given): a bright
/// center, a halo ring, rays of varying length and rings along the path to the end point.
pub fn parts(v: &Value) -> Vec<Part> {
let c = Point::new(number(v, "cx", 0.0), number(v, "cy", 0.0));
let end = Point::new(number(v, "x2", c.x), number(v, "y2", c.y));
let pct = |k: &str| (number(v, k, 0.0) / 100.0).clamp(0.0, 10.0);
let r = (number(v, "diameter", 100.0) / 2.0).max(0.5);
let opacity = pct("opacity").min(1.0) as f32;
let brightness = pct("brightness").min(1.0) as f32;
let growth = pct("growth");
let fuzz = pct("fuzziness").min(1.0);
let rays = v.get("rays").and_then(Value::as_u64).unwrap_or(0).min(50) as usize;
let longest = pct("longest");
let ray_fuzz = pct("rayFuzziness").min(1.0);
let ray_turn = number(v, "rotation", 0.0).to_radians();
let rings = v.get("rings").and_then(Value::as_u64).unwrap_or(0).min(50) as usize;
let largest = pct("largest");
// Deterministic pseudo-random sizes (same parameters → same flare).
let mut seed = v.get("seed").and_then(Value::as_u64).unwrap_or(DEFAULT_SEED) | 1;
let mut rnd = move || {
seed ^= seed << 13;
seed ^= seed >> 7;
seed ^= seed << 17;
(seed >> 11) as f64 / (1u64 << 53) as f64
};
let stop = |offset: f32, opacity: f32| GradientStop { opacity, ..GradientStop::new(offset, Color::WHITE) };
let radial = |centre: Point, radius: f64, stops: Vec<GradientStop>| {
let mut g = GradientPaint::new(Gradient::new(GradientKind::Radial, stops));
g.geom = Some(GradientGeom { start: centre, end: centre + Vec2::new(radius, 0.0), aspect: 1.0, focal: None });
Paint::Gradient(Box::new(g))
};
let circle = |centre: Point, radius: f64| shapes::ellipse(Rect::from_center_size(centre, (radius * 2.0, radius * 2.0)));
let mut parts: Vec<Part> = vec![];
// Halo: a soft ring just outside the centre.
let halo_r = r * (1.0 + growth) * 1.6;
let inner = (1.0 - fuzz as f32 * 0.6).clamp(0.05, 0.95);
parts.push(("Halo", circle(c, halo_r), radial(c, halo_r, vec![stop(0.0, 0.0), stop(inner * 0.75, 0.0), stop(inner, 0.5), stop(1.0, 0.0)]), 1.0));
// Rays: thin spikes of random length (Longest = % of the centre radius), fading outwards.
// `rotation` turns them clockwise about the center.
if rays > 0 {
let mut bp = BezPath::new();
let mut reach: f64 = 0.0;
for i in 0..rays {
let a = std::f64::consts::TAU * (i as f64 + rnd() * 0.6) / rays as f64 + ray_turn;
let len = r * longest * (1.0 - ray_fuzz * 0.75 * rnd()).max(0.1);
reach = reach.max(len);
let w = r * 0.035;
let dir = Vec2::new(a.cos(), a.sin());
let n = Vec2::new(-dir.y, dir.x) * w;
bp.move_to(c + n);
bp.line_to(c + dir * len);
bp.line_to(c - n);
bp.line_to(c - dir * (w * 4.0));
bp.close_path();
}
parts.push(("Rays", PathData::from_bezpath(&bp), radial(c, reach, vec![stop(0.0, 0.9), stop(0.25, 0.35), stop(1.0, 0.0)]), 1.0));
}
// Centre: bright core fading to transparent.
parts.push(("Center", circle(c, r), radial(c, r, vec![stop(0.0, 1.0), stop(0.25 + brightness * 0.5, 0.6), stop(1.0, 0.0)]), opacity));
// Rings along the path to the end point (Largest = % of the average ring size).
for _ in 0..rings {
let t = rnd();
let at = c + (end - c) * t;
let rr = (r * largest * (0.25 + rnd() * 0.75)).max(0.5);
let solid = rnd() < 0.5;
let stops = if solid {
vec![stop(0.0, 0.25), stop(0.8, 0.2), stop(1.0, 0.0)]
} else {
vec![stop(0.0, 0.0), stop(0.7, 0.05), stop(0.92, 0.35), stop(1.0, 0.0)]
};
parts.push(("Ring", circle(at, rr), radial(at, rr, stops), 1.0));
}
parts
}
/// Part `part` of a flare as the object `id`, transformed by `xf` (the transform its flare has had
/// since it was drawn), with the pixel-aligned property when `aligned`.
pub fn part_node(id: NodeId, part: Part, xf: Affine, aligned: bool) -> Node {
let (name, pd, paint, op) = part;
let mut n = Node::path(id, pd, Appearance::basic(paint, Paint::None, 0.0));
n.name = Some(name.into());
n.blend = BlendMode::Screen;
n.opacity = op;
if aligned {
n.extras_mut().pixel_aligned = true;
}
if xf != Affine::IDENTITY {
n.transform(xf, false);
}
n
}
/// The ellipse of a radial gradient's placement `geom` as the symmetric matrix `[xx, xy, yy]` that
/// maps it to the unit circle's: the same for every end point and aspect that give that ellipse
/// (transforms applied one by one and all at once can put the end on different axes of it).
fn ellipse(geom: &GradientGeom) -> [f64; 3] {
let u = geom.end - geom.start;
let w = Vec2::new(-u.y, u.x) * geom.aspect;
[u.x * u.x + w.x * w.x, u.x * u.y + w.x * w.y, u.y * u.y + w.y * w.y]
}
/// `n` as JSON without what depends on how its transforms were applied: its id, the angle of its
/// bounding box, and which axis of a gradient's ellipse its end point is on (the ellipse stays).
fn comparable(n: &Node) -> Value {
fn strip(v: &mut Value) {
match v {
Value::Object(m) => {
for key in ["id", "bbox_angle"] {
m.remove(key);
}
if let Some(geom) = m.get_mut("geom")
&& let Ok(g) = serde_json::from_value::<GradientGeom>(geom.clone())
&& let Value::Object(geom) = geom
{
geom.remove("end");
geom.remove("aspect");
geom.insert("ellipse".into(), serde_json::json!(ellipse(&g)));
}
m.values_mut().for_each(strip);
}
Value::Array(a) => a.iter_mut().for_each(strip),
_ => {}
}
}
let mut v = serde_json::to_value(n).unwrap_or(Value::Null);
strip(&mut v);
v
}
/// How close, relative to its size, a number in an outline or a gradient's placement must be to the
/// one its transforms give: a few thousandths of a point near the edge of the canvas.
const GEOMETRY_TOL: f64 = 1e-9;
/// Whether `a` and `b` are the same JSON, with each number within `tol` relative to its size; each
/// number in an outline (`path`) or a gradient's placement (`geom`) is within [`GEOMETRY_TOL`]
/// relative to its size (or `tol`, when smaller), and `snap` points as well.
fn close(a: &Value, b: &Value, tol: f64, snap: f64, geometry: bool) -> bool {
match (a, b) {
(Value::Number(x), Value::Number(y)) => match (x.as_f64(), y.as_f64()) {
(Some(x), Some(y)) => {
let (snap, tol) = if geometry { (snap, tol.min(GEOMETRY_TOL)) } else { (0.0, tol) };
(x - y).abs() <= snap + tol * (1.0 + x.abs().max(y.abs()))
}
_ => x == y,
},
(Value::Array(x), Value::Array(y)) => x.len() == y.len() && x.iter().zip(y).all(|(x, y)| close(x, y, tol, snap, geometry)),
(Value::Object(x), Value::Object(y)) => {
x.len() == y.len() && x.iter().all(|(k, v)| y.get(k).is_some_and(|w| close(v, w, tol, snap, geometry || k == "path" || k == "geom")))
}
_ => a == b,
}
}
/// Whether `a` and `b` are the same JSON, with each number within `tol` relative to its size.
pub fn json_close(a: &Value, b: &Value, tol: f64) -> bool {
close(a, b, tol, 0.0, false)
}
/// How far a pixel-aligned object's points may be from where its transforms put them: snapping to
/// the pixel grid moves each by up to a pixel.
const PIXEL_SNAP: f64 = 1.0;
/// The settings of a flare group ([`crate::NodeExtras::flare`]).
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct FlareSpec {
/// `shape.flare`'s params the flare was drawn with, each one given: the center (`cx`, `cy`) and
/// the rings' end point (`x2`, `y2`) are in the coordinates it was drawn in.
pub params: serde_json::Value,
/// The transform its art has had since it was drawn (moves, scales, rotations, reflections and
/// shears).
#[serde(default = "identity", skip_serializing_if = "is_identity")]
pub transform: Affine,
}
fn identity() -> Affine {
Affine::IDENTITY
}
fn is_identity(a: &Affine) -> bool {
*a == Affine::IDENTITY
}
impl FlareSpec {
/// The settings of a flare drawn with `params`, not transformed since.
pub fn new(params: serde_json::Value) -> Self {
Self { params, transform: Affine::IDENTITY }
}
/// The point `key_x`, `key_y` of the params, where it is in the document now.
fn point(&self, key_x: &str, key_y: &str) -> Option<Point> {
let x = self.params.get(key_x)?.as_f64()?;
let y = self.params.get(key_y)?.as_f64()?;
Some(self.transform * Point::new(x, y)).filter(|p| p.x.is_finite() && p.y.is_finite())
}
/// The flare's center, where it is in the document now.
pub fn center(&self) -> Option<Point> {
self.point("cx", "cy")
}
/// The rings' end point, where it is in the document now.
pub fn end(&self) -> Option<Point> {
self.point("x2", "y2")
}
/// Its art transformed by `a`.
pub fn transform(&mut self, a: Affine) {
self.transform = a * self.transform;
}
/// Whether `group`'s parts are still the ones these settings draw, in place: none was edited,
/// distorted, removed or added, and the transform can be undone.
pub fn draws(&self, group: &Node) -> bool {
let NodeKind::Group { children, .. } = &group.kind else { return false };
if self.transform.determinant().abs() < 1e-12 || !self.transform.as_coeffs().iter().all(|c| c.is_finite()) {
return false;
}
let expected = parts(&self.params);
expected.len() == children.len()
&& expected.into_iter().zip(children).all(|(part, child)| {
let aligned = child.extras().pixel_aligned;
let snap = if aligned { PIXEL_SNAP } else { 0.0 };
close(&comparable(&part_node(child.id, part, self.transform, aligned)), &comparable(child), 1e-6, snap, false)
})
}
}
#[cfg(test)]
mod tests {
use super::*;
use serde_json::json;
/// A flare's center and end point follow its art through a transform, and a save and reload
/// keeps its settings.
#[test]
fn a_flare_keeps_its_settings_through_a_transform_and_a_save() {
let mut g = Node::group(NodeId(1), vec![std::sync::Arc::new(Node::path(NodeId(2), PathData::default(), Default::default()))]);
g.extras_mut().flare = Some(Box::new(FlareSpec::new(json!({ "cx": 10.0, "cy": 20.0, "x2": 110.0, "y2": 20.0, "seed": 7 }))));
g.transform(Affine::translate((5.0, 0.0)) * Affine::rotate(std::f64::consts::FRAC_PI_2), false);
let spec = g.extras().flare.as_deref().cloned().unwrap_or_else(|| panic!("no flare"));
let c = spec.center().unwrap_or_else(|| panic!("no center"));
let e = spec.end().unwrap_or_else(|| panic!("no end"));
assert!((c.x - -15.0).abs() < 1e-9 && (c.y - 10.0).abs() < 1e-9, "{c:?}");
assert!((e.x - -15.0).abs() < 1e-9 && (e.y - 110.0).abs() < 1e-9, "{e:?}");
let text = serde_json::to_string(&g).unwrap_or_else(|e| panic!("{e}"));
let back: Node = serde_json::from_str(&text).unwrap_or_else(|e| panic!("{e}"));
assert_eq!(back.extras().flare.as_deref(), Some(&spec));
// A flare that was not transformed writes no transform.
let plain = FlareSpec::new(json!({ "cx": 1.0 }));
assert_eq!(serde_json::to_value(&plain).unwrap_or_default(), json!({ "params": { "cx": 1.0 } }));
}
/// A flare group draws its settings until a part's gradient, opacity or outline is edited; a
/// pixel-aligned part may sit up to a pixel from where its transforms put it, but only in its
/// outline and its gradient's placement.
#[test]
fn a_flare_with_an_edited_part_no_longer_draws_its_settings() {
let v = json!({ "cx": 50.0, "cy": 50.0, "x2": 250.0, "y2": 50.0, "rays": 5, "rings": 2, "seed": 9, "diameter": 40.0,
"opacity": 50.0, "brightness": 30.0, "growth": 20.0, "fuzziness": 50.0, "longest": 300.0, "rayFuzziness": 100.0,
"rotation": 0.0, "largest": 50.0 });
let flare = |aligned: bool| {
let xf = Affine::rotate(0.3) * Affine::scale_non_uniform(1.5, 0.75);
let children = parts(&v).into_iter().enumerate().map(|(i, p)| std::sync::Arc::new(part_node(NodeId(10 + i as u64), p, xf, aligned)));
let mut g = Node::group(NodeId(1), children.collect());
g.extras_mut().flare = Some(Box::new(FlareSpec { params: v.clone(), transform: xf }));
g
};
let spec = |g: &Node| g.extras().flare.as_deref().cloned().unwrap_or_else(|| panic!("no flare"));
let edit = |g: &mut Node, f: &dyn Fn(&mut Node)| {
let NodeKind::Group { children, .. } = &mut g.kind else { panic!("not a group") };
// The center, drawn at half opacity.
f(std::sync::Arc::make_mut(&mut children[2]));
};
for aligned in [false, true] {
let g = flare(aligned);
assert!(spec(&g).draws(&g), "aligned {aligned}");
let mut moved = g.clone();
edit(&mut moved, &|n| n.transform(Affine::translate((0.4, 0.0)), false));
assert_eq!(spec(&moved).draws(&moved), aligned, "a fraction of a pixel, aligned {aligned}");
let mut faded = g.clone();
edit(&mut faded, &|n| n.opacity *= 0.8);
assert!(!spec(&faded).draws(&faded), "opacity, aligned {aligned}");
let mut shifted = g.clone();
edit(&mut shifted, &|n| {
if let Some(crate::AppearanceItem::Fill(fill)) = n.appearance.items.first_mut()
&& let Paint::Gradient(gp) = &mut fill.paint
&& let Some(geom) = &mut gp.geom
{
geom.start.x += 20.0;
}
});
assert!(!spec(&shifted).draws(&shifted), "gradient placement, aligned {aligned}");
let mut squashed = g.clone();
edit(&mut squashed, &|n| {
if let Some(crate::AppearanceItem::Fill(fill)) = n.appearance.items.first_mut()
&& let Paint::Gradient(gp) = &mut fill.paint
&& let Some(geom) = &mut gp.geom
{
geom.aspect *= 0.5;
}
});
assert!(!spec(&squashed).draws(&squashed), "gradient shape, aligned {aligned}");
}
}
}
+1
View File
@@ -16,6 +16,7 @@ pub mod compound_shape;
pub mod corners;
pub mod depth;
pub mod dimension;
pub mod flare;
pub mod graph;
mod halftone_radii;
pub mod hit;
+1
View File
@@ -266,6 +266,7 @@ fn node_bytes(n: &Node, other: Option<&Node>, counted: &mut HashSet<usize>) -> u
.as_deref()
.map_or(0, |m| ALLOC + size_of::<crate::color_mask::ColorMask>() + m.key.capacity() + m.from.capacity() + m.colors.capacity() * 3);
b += e.trace.as_ref().map_or(0, |t| ALLOC + size_of::<Value>() + json_bytes(t));
b += e.flare.as_ref().map_or(0, |f| ALLOC + size_of::<crate::flare::FlareSpec>() + json_bytes(&f.params));
b += e.intertwine.as_deref().map_or(0, |a| ALLOC + size_of::<PathData>() + path_bytes(a));
if e.intertwine_tiers.capacity() > 0 {
b += ALLOC + e.intertwine_tiers.capacity() * size_of::<PathData>() + e.intertwine_tiers.iter().map(path_bytes).sum::<usize>();
+4
View File
@@ -41,6 +41,9 @@ pub struct NodeExtras {
/// Dimension object: the live measurement it draws; its ordinary group children hold its
/// exportable appearance (Object › Dimensions, the Dimension tool).
pub dimension: Option<Box<crate::dimension::Dimension>>,
/// Flare object: the settings its group was drawn with (the Flare tool); its ordinary group
/// children hold its art.
pub flare: Option<Box<crate::flare::FlareSpec>>,
/// Object › Intertwine: as a member of an Intertwine group, the area (document coordinates,
/// filled non-zero) where this object is drawn over the group's other members.
pub intertwine: Option<Box<PathData>>,
@@ -96,6 +99,7 @@ pub(super) static NO_EXTRAS: NodeExtras = NodeExtras {
slice: None,
perspective: None,
dimension: None,
flare: None,
intertwine: None,
intertwine_tiers: Vec::new(),
live_paint_gaps: None,
+6
View File
@@ -448,6 +448,12 @@ impl Node {
{
dimension.transform(a);
}
// So does a flare's center and end point.
if let Some(e) = self.extras_if_any()
&& let Some(flare) = &mut e.flare
{
flare.transform(a);
}
// The path the objects are attached to, before it is transformed.
let on_path_before = self.on_path_data().cloned();
if !self.is_layer() {
+5
View File
@@ -45,6 +45,7 @@ impl Serialize for Node {
is_default(&self.bbox_angle),
e.perspective.is_none(),
e.dimension.is_none(),
e.flare.is_none(),
e.intertwine.is_none(),
e.intertwine_tiers.is_empty(),
e.live_paint_gaps.is_none(),
@@ -90,6 +91,7 @@ impl Serialize for Node {
field!("bbox_angle", &self.bbox_angle);
field!("perspective", &e.perspective);
field!("dimension", &e.dimension);
field!("flare", &e.flare);
field!("intertwine", &e.intertwine);
field!("intertwine_tiers", &e.intertwine_tiers);
field!("live_paint_gaps", &e.live_paint_gaps);
@@ -226,6 +228,8 @@ pub(super) struct NodeWire {
#[serde(default)]
dimension: Option<Box<crate::dimension::Dimension>>,
#[serde(default)]
flare: Option<Box<crate::flare::FlareSpec>>,
#[serde(default)]
intertwine: Option<Box<PathData>>,
#[serde(default, deserialize_with = "counted_list")]
intertwine_tiers: Vec<PathData>,
@@ -267,6 +271,7 @@ impl From<NodeWire> for Node {
slice: w.slice,
perspective: w.perspective,
dimension: w.dimension,
flare: w.flare,
intertwine: w.intertwine,
intertwine_tiers: w.intertwine_tiers,
live_paint_gaps: w.live_paint_gaps,
+1
View File
@@ -32,6 +32,7 @@ pub mod expand;
pub(crate) mod fileinfo;
pub mod fileio;
pub mod findfiles;
pub mod flare;
pub mod flatten;
pub mod fontfiles;
mod fonts;
+10 -122
View File
@@ -55,7 +55,16 @@ pub fn specs() -> Vec<CommandSpec> {
None,
"{cx, cy, diameter=100, opacity=50 (%), brightness=30 (%), growth=20 (%), fuzziness=50 (%), rays=15, longest=300 (%), rayFuzziness=100 (%), rotation=0 (deg, turns the rays clockwise), x2?, y2? (ring end; else pathLength at direction), pathLength=300, rings=10, largest=50 (%), direction=45 (deg counter-clockwise from 3 o'clock: where the rings run from the centre), seed?} → {id}",
has_doc,
flare
super::flare::flare
),
cmd!(
"shape.editFlare",
"Edit Flare",
[],
None,
"{ids?|id?: flares (default: the selected flares), cx?, cy? (the center, where it is drawn now), x2?, y2? (the rings' end point, where it is drawn now; else pathLength at direction from the center, both where it is drawn now, when either is given; else where it was), diameter?, opacity?, brightness?, growth?, fuzziness?, rays?, longest?, rayFuzziness?, rotation?, pathLength?, rings?, largest?, direction? (as shape.flare: what is left out stays as it was)} draws each flare again in its place, moved, scaled, rotated, reflected or sheared as it has been since it was drawn, as one undo step (none when nothing changes); a flare whose parts were edited, or that is locked or hidden, is not one → {ids}",
has_doc,
super::flare::edit_flare
),
cmd!("shape.line", "Line Segment", [], None, "{x1, y1, x2, y2, fill?: bool (Fill Line: the current fill, else none)} → {id}", has_doc, line),
cmd!("shape.spiral", "Spiral", [], None, "{cx, cy, radius, decay=80 (%), segments=10, clockwise?} → {id}", has_doc, spiral),
@@ -407,127 +416,6 @@ fn star(s: &mut Session, p: &Value) -> Result<Value> {
add_art_turned(s, "Star", path_kind(path, None), constrained_turn(s, rot))
}
/// Flare tool: a lens flare built from radial-gradient paths in Screen mode — a bright centre, a halo
/// ring, rays of varying length and rings along the path to the end point.
fn flare(s: &mut Session, p: &Value) -> Result<Value> {
use vectorcraft_color::{BlendMode, Gradient, GradientGeom, GradientKind, GradientPaint, GradientStop, Paint};
let c = Point::new(f64_req(p, "cx", "shape.flare")?, f64_req(p, "cy", "shape.flare")?);
let numbers = [
"diameter",
"opacity",
"brightness",
"growth",
"fuzziness",
"rays",
"longest",
"rayFuzziness",
"rotation",
"rings",
"largest",
"x2",
"y2",
"direction",
"pathLength",
"seed",
];
check_numbers(p, &numbers, "shape.flare")?;
let pct = |k: &str, d: f64| (f64_or(p, k, d) / 100.0).clamp(0.0, 10.0);
let r = (f64_or(p, "diameter", 100.0) / 2.0).max(0.5);
let opacity = pct("opacity", 50.0).min(1.0) as f32;
let brightness = pct("brightness", 30.0).min(1.0) as f32;
let growth = pct("growth", 20.0);
let fuzz = pct("fuzziness", 50.0).min(1.0);
let rays = p.get("rays").and_then(Value::as_u64).unwrap_or(15).min(50) as usize;
let longest = pct("longest", 300.0);
let ray_fuzz = pct("rayFuzziness", 100.0).min(1.0);
let ray_turn = f64_or(p, "rotation", 0.0).to_radians();
let rings = p.get("rings").and_then(Value::as_u64).unwrap_or(10).min(50) as usize;
let largest = pct("largest", 50.0);
let end = match (p.get("x2").and_then(Value::as_f64), p.get("y2").and_then(Value::as_f64)) {
(Some(x), Some(y)) => Point::new(x, y),
_ => {
let a = f64_or(p, "direction", 45.0).to_radians();
c + vectorcraft_geom::Vec2::new(a.cos(), -a.sin()) * f64_or(p, "pathLength", 300.0)
}
};
// Deterministic pseudo-random sizes (same parameters → same flare).
let mut seed = p.get("seed").and_then(Value::as_u64).unwrap_or(0x2545_f491_4f6c_dd1d) | 1;
let mut rnd = move || {
seed ^= seed << 13;
seed ^= seed >> 7;
seed ^= seed << 17;
(seed >> 11) as f64 / (1u64 << 53) as f64
};
let stop = |offset: f32, opacity: f32| GradientStop { opacity, ..GradientStop::new(offset, vectorcraft_color::Color::WHITE) };
let radial = |centre: Point, radius: f64, stops: Vec<GradientStop>| {
let mut g = GradientPaint::new(Gradient::new(GradientKind::Radial, stops));
g.geom = Some(GradientGeom { start: centre, end: centre + vectorcraft_geom::Vec2::new(radius, 0.0), aspect: 1.0, focal: None });
Paint::Gradient(Box::new(g))
};
let circle = |centre: Point, radius: f64| shapes::ellipse(Rect::from_center_size(centre, (radius * 2.0, radius * 2.0)));
let mut parts: Vec<(&str, PathData, Paint, f32)> = vec![];
// Halo: a soft ring just outside the centre.
let halo_r = r * (1.0 + growth) * 1.6;
let inner = (1.0 - fuzz as f32 * 0.6).clamp(0.05, 0.95);
parts.push(("Halo", circle(c, halo_r), radial(c, halo_r, vec![stop(0.0, 0.0), stop(inner * 0.75, 0.0), stop(inner, 0.5), stop(1.0, 0.0)]), 1.0));
// Rays: thin spikes of random length (Longest = % of the centre radius), fading outwards.
// `rotation` turns them clockwise about the center.
if rays > 0 {
let mut bp = vectorcraft_geom::BezPath::new();
let mut reach: f64 = 0.0;
for i in 0..rays {
let a = std::f64::consts::TAU * (i as f64 + rnd() * 0.6) / rays as f64 + ray_turn;
let len = r * longest * (1.0 - ray_fuzz * 0.75 * rnd()).max(0.1);
reach = reach.max(len);
let w = r * 0.035;
let dir = vectorcraft_geom::Vec2::new(a.cos(), a.sin());
let n = vectorcraft_geom::Vec2::new(-dir.y, dir.x) * w;
bp.move_to(c + n);
bp.line_to(c + dir * len);
bp.line_to(c - n);
bp.line_to(c - dir * (w * 4.0));
bp.close_path();
}
parts.push(("Rays", PathData::from_bezpath(&bp), radial(c, reach, vec![stop(0.0, 0.9), stop(0.25, 0.35), stop(1.0, 0.0)]), 1.0));
}
// Centre: bright core fading to transparent.
parts.push(("Center", circle(c, r), radial(c, r, vec![stop(0.0, 1.0), stop(0.25 + brightness * 0.5, 0.6), stop(1.0, 0.0)]), opacity));
// Rings along the path to the end point (Largest = % of the average ring size).
for _ in 0..rings {
let t = rnd();
let at = c + (end - c) * t;
let rr = (r * largest * (0.25 + rnd() * 0.75)).max(0.5);
let solid = rnd() < 0.5;
let stops = if solid {
vec![stop(0.0, 0.25), stop(0.8, 0.2), stop(1.0, 0.0)]
} else {
vec![stop(0.0, 0.0), stop(0.7, 0.05), stop(0.92, 0.35), stop(1.0, 0.0)]
};
parts.push(("Ring", circle(at, rr), radial(at, rr, stops), 1.0));
}
let parent = s.doc()?.target_parent()?;
let id = s.edit("Flare", |d, sel| {
let children = parts
.into_iter()
.map(|(name, pd, paint, op)| {
let mut n = Node::path(d.alloc_id(), pd, Appearance::basic(paint, Paint::None, 0.0));
n.name = Some(name.into());
n.blend = BlendMode::Screen;
n.opacity = op;
super::object::align_new_object(d, &mut n);
std::sync::Arc::new(n)
})
.collect();
let gid = d.alloc_id();
let mut g = Node::group(gid, children);
g.name = Some("Flare".into());
d.insert(parent, usize::MAX, g)?;
sel.set([gid]);
Ok(gid)
})?;
Ok(json!({ "id": id.0 }))
}
fn line(s: &mut Session, p: &Value) -> Result<Value> {
let a = Point::new(f64_req(p, "x1", "shape.line")?, f64_req(p, "y1", "shape.line")?);
let b = Point::new(f64_req(p, "x2", "shape.line")?, f64_req(p, "y2", "shape.line")?);
+5 -1
View File
@@ -182,7 +182,7 @@ impl Expandable {
n.walk(&mut |c| {
let shape = matches!(c.kind, NodeKind::Path { .. } | NodeKind::Compound { .. });
e.text |= matches!(c.kind, NodeKind::Text(_));
e.live |= matches!(c.kind, NodeKind::Path { live: Some(_), .. });
e.live |= matches!(c.kind, NodeKind::Path { live: Some(_), .. }) || c.extras().flare.is_some();
e.effects |= !c.appearance.effects.is_empty();
e.envelope |= matches!(c.kind, NodeKind::Envelope { .. });
e.blends |= matches!(c.kind, NodeKind::Blend { .. });
@@ -500,10 +500,14 @@ fn end_dimension_links(s: &mut Session, ended: &mut Vec<EndedLink>) -> Result<()
Ok(())
}
/// Makes the live shapes in `n` plain paths, and the flares plain groups of their parts.
fn drop_live(n: &mut Node) {
if let NodeKind::Path { live, .. } = &mut n.kind {
*live = None;
}
if n.extras().flare.is_some() {
n.extras_mut().flare = None;
}
if let Some(ch) = n.children_mut() {
for c in ch.iter_mut() {
drop_live(Arc::make_mut(c));
+220
View File
@@ -0,0 +1,220 @@
//! Flares (the Flare tool): `shape.flare` draws a group of radial-gradient paths that keeps the
//! settings it was drawn with ([`FlareSpec`]), and `shape.editFlare` draws it again from them.
use std::sync::Arc;
use serde_json::{Value, json};
use vectorcraft_doc::flare::{DEFAULT_SEED, FlareSpec, json_close, part_node, parts};
use vectorcraft_doc::{Document, Node, NodeId};
use vectorcraft_geom::{Affine, Point, Vec2};
use super::{EngineError, Result, Session, bad, check_numbers, f64_or, f64_req, given_objects, number_or};
const C: &str = "shape.editFlare";
/// `shape.flare`'s settings besides the center, the rings' end point, the counts and the seed:
/// (key, default).
const SETTINGS: [(&str, f64); 9] = [
("diameter", 100.0),
("opacity", 50.0),
("brightness", 30.0),
("growth", 20.0),
("fuzziness", 50.0),
("longest", 300.0),
("rayFuzziness", 100.0),
("rotation", 0.0),
("largest", 50.0),
];
/// The whole number of 0 or more `p` gives for `key`, or `default`.
fn count_or(p: &Value, key: &str, default: u64, cmd: &str) -> Result<u64> {
let n = number_or(p, key, default as f64, cmd)?;
if n.is_finite() && n >= 0.0 && n.fract() == 0.0 {
Ok(n as u64)
} else {
Err(bad(cmd, format!("`{key}` must be a whole number of at least 0, not {n}")))
}
}
/// `shape.flare`'s params `p` with every setting given: the defaults filled in, the counts at most
/// 50 and the rings' end point as `x2`, `y2` (from `pathLength` and `direction` when `p` gives no
/// end point).
fn settings_of(p: &Value, cmd: &str) -> Result<Value> {
let c = Point::new(f64_req(p, "cx", cmd)?, f64_req(p, "cy", cmd)?);
let mut numbers: Vec<&str> = SETTINGS.iter().map(|(key, _)| *key).collect();
numbers.extend(["x2", "y2", "direction", "pathLength", "seed"]);
check_numbers(p, &numbers, cmd)?;
let rays = count_or(p, "rays", 15, cmd)?.min(50);
let rings = count_or(p, "rings", 10, cmd)?.min(50);
let end = match (p.get("x2").and_then(Value::as_f64), p.get("y2").and_then(Value::as_f64)) {
(Some(x), Some(y)) => Point::new(x, y),
_ => {
let a = f64_or(p, "direction", 45.0).to_radians();
c + Vec2::new(a.cos(), -a.sin()) * f64_or(p, "pathLength", 300.0)
}
};
let seed = p.get("seed").and_then(Value::as_u64).unwrap_or(DEFAULT_SEED);
let mut v = json!({ "cx": c.x, "cy": c.y, "x2": end.x, "y2": end.y, "rays": rays, "rings": rings, "seed": seed });
for (key, default) in SETTINGS {
v[key] = json!(f64_or(p, key, default));
}
Ok(v)
}
/// The objects of a flare drawn with the settings `v`, transformed by `xf`. A new flare's parts
/// (`old` None) get new ids and take the document's Align New Objects to Pixel Grid. A flare drawn
/// again from its parts `old` keeps, for each part, the id and pixel-aligned property of the old
/// part it replaces (the same kind of part, counted in order: the second ring replaces the second
/// ring); a part that replaces none gets a new id and the first old part's property.
fn part_nodes(d: &mut Document, v: &Value, xf: Affine, old: Option<&[Arc<Node>]>) -> Vec<Arc<Node>> {
let mut seen: Vec<&str> = vec![];
parts(v)
.into_iter()
.map(|part| {
let name = part.0;
let nth = seen.iter().filter(|n| **n == name).count();
seen.push(name);
let replaced = old.and_then(|old| old.iter().filter(|c| c.name.as_deref() == Some(name)).nth(nth));
let id = replaced.map_or_else(|| d.alloc_id(), |c| c.id);
let mut n = part_node(id, part, Affine::IDENTITY, false);
match old {
None => super::object::align_new_object(d, &mut n),
Some(old) => n.extras_mut().pixel_aligned = replaced.or(old.first()).is_some_and(|c| c.extras().pixel_aligned),
}
if xf != Affine::IDENTITY {
n.transform(xf, false);
}
Arc::new(n)
})
.collect()
}
/// `shape.flare`: a flare group that keeps its settings.
pub(super) fn flare(s: &mut Session, p: &Value) -> Result<Value> {
let v = settings_of(p, "shape.flare")?;
let parent = s.doc()?.target_parent()?;
let id = s.edit("Flare", |d, sel| {
let children = part_nodes(d, &v, Affine::IDENTITY, None);
let gid = d.alloc_id();
let mut g = Node::group(gid, children);
g.name = Some("Flare".into());
g.extras_mut().flare = Some(Box::new(FlareSpec::new(v)));
d.insert(parent, usize::MAX, g)?;
sel.set([gid]);
Ok(gid)
})?;
Ok(json!({ "id": id.0 }))
}
/// The settings of flare `id`: a group drawn by the Flare tool whose parts are still the ones its
/// settings draw, in place ([`FlareSpec::draws`]). A flare whose parts were edited, distorted,
/// removed or added to, or whose art was flattened to a line, is no longer one.
pub fn flare_settings(d: &Document, id: NodeId) -> Option<FlareSpec> {
let n = d.node(id)?;
let spec = n.extras().flare.as_deref()?;
// Settings a file holds are read as `shape.flare` reads them.
let spec = FlareSpec { params: settings_of(&spec.params, "shape.flare").ok()?, transform: spec.transform };
spec.draws(n).then_some(spec)
}
/// The flares `shape.editFlare` changes: those `p` names, else the selected flares. Each must be a
/// flare that can be edited.
fn flares_to_edit(s: &Session, p: &Value) -> Result<Vec<(NodeId, FlareSpec)>> {
let given = given_objects(s, p, C)?;
let d = &s.doc()?.doc;
let flare = |id: NodeId| flare_settings(d, id).filter(|_| d.is_editable(id)).map(|spec| (id, spec));
let flares: Vec<(NodeId, FlareSpec)> = match &given {
Some(ids) => ids.iter().map(|id| flare(*id)).collect::<Option<Vec<_>>>().unwrap_or_default(),
None => s.doc()?.selection.objects.iter().filter_map(|id| flare(*id)).collect(),
};
if flares.is_empty() {
return Err(EngineError::Other("select a flare".into()));
}
Ok(flares)
}
/// The settings `old` changed as `p` asks (`shape.editFlare`'s params). The center and the end
/// point `p` gives are in the document, where the flare is now drawn, which `xf` maps from where
/// it was drawn.
fn edited(old: &Value, p: &Value, xf: Affine) -> Result<Value> {
let mut v = old.clone();
let inv = xf.inverse();
let point = |kx: &str, ky: &str| -> Result<Option<Point>> {
if p.get(kx).is_none_or(Value::is_null) && p.get(ky).is_none_or(Value::is_null) {
return Ok(None);
}
Ok(Some(inv * Point::new(f64_req(p, kx, C)?, f64_req(p, ky, C)?)))
};
let c = point("cx", "cy")?;
let end = point("x2", "y2")?;
if let Some(c) = c {
v["cx"] = json!(c.x);
v["cy"] = json!(c.y);
}
let centre = Point::new(f64_or(&v, "cx", 0.0), f64_or(&v, "cy", 0.0));
let old_end = Point::new(f64_or(&v, "x2", centre.x), f64_or(&v, "y2", centre.y));
let end = match end {
Some(e) => e,
None if p.get("pathLength").is_some_and(|l| !l.is_null()) || p.get("direction").is_some_and(|a| !a.is_null()) => {
// The path length and the direction are where the flare is drawn now; the direction is
// measured counter-clockwise from 3 o'clock, as `shape.flare` takes it.
let (c, e) = (xf * centre, xf * old_end);
let d = e - c;
let a = number_or(p, "direction", (-d.y).atan2(d.x).to_degrees(), C)?.to_radians();
inv * (c + Vec2::new(a.cos(), -a.sin()) * number_or(p, "pathLength", d.hypot(), C)?)
}
// Moving the center leaves the rings' end point where it is.
None => old_end,
};
v["x2"] = json!(end.x);
v["y2"] = json!(end.y);
for (key, _) in SETTINGS {
if p.get(key).is_some_and(|x| !x.is_null()) {
v[key] = json!(number_or(p, key, 0.0, C)?);
}
}
for key in ["rays", "rings"] {
if p.get(key).is_some_and(|x| !x.is_null()) {
v[key] = json!(count_or(p, key, 0, C)?.min(50));
}
}
settings_of(&v, C)
}
/// `shape.editFlare`: draw the flares again with the settings `p` changes, each in its place and
/// transformed as it has been since it was drawn, as one undo step.
pub(super) fn edit_flare(s: &mut Session, p: &Value) -> Result<Value> {
let mut numbers: Vec<&str> = SETTINGS.iter().map(|(key, _)| *key).collect();
numbers.extend(["cx", "cy", "x2", "y2", "pathLength", "direction", "rays", "rings"]);
check_numbers(p, &numbers, C)?;
let flares = flares_to_edit(s, p)?;
let mut changed: Vec<(NodeId, FlareSpec)> = vec![];
for (id, spec) in &flares {
let v = edited(&spec.params, p, spec.transform)?;
if !json_close(&v, &spec.params, 1e-9) {
changed.push((*id, FlareSpec { params: v, transform: spec.transform }));
}
}
let ids: Vec<u64> = flares.iter().map(|(id, _)| id.0).collect();
// Nothing changes: no undo step.
if changed.is_empty() {
return Ok(json!({ "ids": ids }));
}
let edited_ids: Vec<NodeId> = changed.iter().map(|(id, _)| *id).collect();
s.edit("Edit Flare", |d, _| {
for (id, spec) in changed {
let old: Vec<Arc<Node>> = d.node(id).and_then(Node::children).cloned().unwrap_or_default();
let children = part_nodes(d, &spec.params, spec.transform, Some(&old));
let n = d.node_mut(id).ok_or(EngineError::NoNode(id))?;
if let Some(ch) = n.children_mut() {
*ch = children;
}
n.extras_mut().flare = Some(Box::new(spec));
}
if !crate::sanity::objects_in_range(d, &edited_ids) {
return Err(EngineError::Other("result would exceed the canvas (coordinates out of range)".into()));
}
Ok(())
})?;
Ok(json!({ "ids": ids }))
}
+1
View File
@@ -29,6 +29,7 @@ use vectorcraft_tools::{PaintDefaults, Tool};
pub use cmd::clipboard::{Clipboard, SourceLayer};
pub use cmd::create::constrain_click;
pub use cmd::distortcmds::perspective_click;
pub use cmd::flare::flare_settings;
pub use cmd::params::{check_keys, check_params};
pub use cmd::pathops::auto_simplify_level;
pub use cmd::rasterfx::{export_pdf, flatten_raster_effects};
+122
View File
@@ -3268,6 +3268,128 @@ fn flare_rotation_turns_only_the_rays() {
}
}
/// A flare keeps its settings: `shape.editFlare` draws it again with the settings changed, in its
/// place and transformed as it has been since, as one undo step (none when nothing changes). A
/// flare with a changed part, a locked one and an expanded one are not edited.
#[test]
fn edit_flare_draws_a_transformed_flare_again_in_its_place_in_one_undo_step() {
let mut s = session();
let p = json!({"cx": 200, "cy": 200, "diameter": 60, "rays": 9, "rings": 4, "x2": 400, "y2": 200, "seed": 3});
let id = NodeId(s.execute("shape.flare", &p).unwrap()["id"].as_u64().unwrap());
// Reflected twice, sheared and back, turned a quarter and moved: it stays a flare.
for (c, p) in [
("object.reflect", json!({"axis": "vertical"})),
("object.reflect", json!({"axis": "horizontal"})),
("object.shear", json!({"angle": 30})),
("object.shear", json!({"angle": -30})),
("object.rotate", json!({"angle": 90})),
("object.move", json!({"dx": 50, "dy": 10})),
] {
s.execute(c, &p).unwrap();
}
let spec = |s: &Session| flare_settings(&s.doc().unwrap().doc, id).expect("still a flare");
let part = |s: &Session, name: &str| {
let g = s.doc().unwrap().doc.node(id).unwrap();
g.children().unwrap().iter().filter(|c| c.name.as_deref() == Some(name)).map(|c| c.geometric_bounds().unwrap()).collect::<Vec<_>>()
};
let (c, e) = (spec(&s).center().unwrap(), spec(&s).end().unwrap());
// The quarter turn made the rings run vertically, 200 points from the center.
assert!((c.distance(e) - 200.0).abs() < 1e-6 && (c.x - e.x).abs() < 1e-6, "{c:?} {e:?}");
let undo = s.doc().unwrap().history.undo.len();
s.execute("shape.editFlare", &json!({"diameter": 100, "rings": 6, "rays": 0})).unwrap();
assert_eq!(s.doc().unwrap().history.undo.len(), undo + 1);
assert_eq!(s.doc().unwrap().selection.objects, vec![id]);
let centre = part(&s, "Center")[0];
assert!(centre.center().distance(c) < 1e-6 && (centre.width() - 100.0).abs() < 1e-6, "{centre:?}");
assert_eq!((part(&s, "Ring").len(), part(&s, "Rays").len()), (6, 0));
assert!(spec(&s).end().unwrap().distance(e) < 1e-6, "the end point stays");
// Each ring lies on the line from the center to the end point.
assert!(part(&s, "Ring").iter().all(|r| (r.center().x - c.x).abs() < 1e-6), "{:?}", part(&s, "Ring"));
// The center handle, where it is drawn now: the end point stays where it is.
s.execute("shape.editFlare", &json!({"ids": [id.0], "cx": c.x + 20.0, "cy": c.y})).unwrap();
assert!(spec(&s).center().unwrap().distance(Point::new(c.x + 20.0, c.y)) < 1e-6);
assert!(spec(&s).end().unwrap().distance(e) < 1e-6);
assert!(part(&s, "Center")[0].center().distance(Point::new(c.x + 20.0, c.y)) < 1e-6);
// The end handle, then the path length and direction.
s.execute("shape.editFlare", &json!({"x2": c.x + 20.0, "y2": c.y + 80.0})).unwrap();
assert!(spec(&s).end().unwrap().distance(Point::new(c.x + 20.0, c.y + 80.0)) < 1e-6);
// The path length and direction are where the flare is drawn now, though it was turned.
s.execute("shape.editFlare", &json!({"direction": 0, "pathLength": 50})).unwrap();
assert!(spec(&s).end().unwrap().distance(Point::new(c.x + 70.0, c.y)) < 1e-6, "{:?}", spec(&s).end());
s.execute("edit.undo", &json!({})).unwrap();
// Nothing changes: no undo step.
let undo = s.doc().unwrap().history.undo.len();
s.execute("shape.editFlare", &json!({"diameter": 100})).unwrap();
assert_eq!(s.doc().unwrap().history.undo.len(), undo);
// Bad values are refused.
for bad in [json!({"rings": 2.5}), json!({"diameter": "big"}), json!({"cx": 10}), json!({"diameter": 1e20})] {
assert!(s.execute("shape.editFlare", &bad).is_err(), "{bad}");
}
assert_eq!(s.doc().unwrap().history.undo.len(), undo);
s.execute("edit.undo", &json!({})).unwrap();
assert!(spec(&s).end().unwrap().distance(e) < 1e-6, "undo puts the end point back");
// A changed part: no longer a flare.
s.edit("Opacity", |d, _| {
let ring = d.node(id).unwrap().children().unwrap().iter().find(|c| c.name.as_deref() == Some("Center")).unwrap().id;
d.node_mut(ring).unwrap().opacity = 0.25;
Ok(())
})
.unwrap();
assert_eq!(s.execute("shape.editFlare", &json!({"rings": 3})).unwrap_err().to_string(), "select a flare");
s.execute("edit.undo", &json!({})).unwrap();
// A locked flare.
s.execute("object.lock", &json!({})).unwrap();
assert!(s.execute("shape.editFlare", &json!({"ids": [id.0], "rings": 3})).is_err());
s.execute("object.unlockAll", &json!({})).unwrap();
// Object › Expand: a plain group that is no longer a flare.
s.execute("object.expand", &json!({"object": true, "fill": false, "stroke": false})).unwrap();
assert!(s.doc().unwrap().doc.node(id).unwrap().extras().flare.is_none());
assert!(s.execute("shape.editFlare", &json!({"rings": 3})).is_err());
}
/// `shape.flare` reads whole-number counts written as floats, and refuses fractions.
#[test]
fn flare_counts_are_whole_numbers() {
let mut s = session();
let id = NodeId(s.execute("shape.flare", &json!({"cx": 100, "cy": 100, "rays": 4.0, "rings": 2})).unwrap()["id"].as_u64().unwrap());
let g = s.doc().unwrap().doc.node(id).unwrap();
let rays = g.children().unwrap().iter().find(|c| c.name.as_deref() == Some("Rays")).unwrap();
assert_eq!(rays.path_data().unwrap().subpaths.len(), 4);
assert!(s.execute("shape.flare", &json!({"cx": 100, "cy": 100, "rays": 2.5})).is_err());
}
/// A flare drawn again keeps its parts' pixel-aligned property, whatever the document's Align New
/// Objects to Pixel Grid is now, and a pixel-aligned flare that was moved is still a flare.
#[test]
fn edit_flare_keeps_its_parts_pixel_alignment() {
let mut s = session();
let aligned = |s: &Session, id: NodeId| -> Vec<bool> {
s.doc().unwrap().doc.node(id).unwrap().children().unwrap().iter().map(|c| c.extras().pixel_aligned).collect()
};
s.execute("document.setup", &json!({"alignNewObjectsToPixelGrid": true})).unwrap();
let on = NodeId(s.execute("shape.flare", &json!({"cx": 100.3, "cy": 200.6, "rings": 2})).unwrap()["id"].as_u64().unwrap());
s.execute("object.move", &json!({"dx": 10.25, "dy": 3.5})).unwrap();
s.execute("document.setup", &json!({"alignNewObjectsToPixelGrid": false})).unwrap();
let part = |s: &Session, id: NodeId, name: &str| -> NodeId {
s.doc().unwrap().doc.node(id).unwrap().children().unwrap().iter().find(|c| c.name.as_deref() == Some(name)).unwrap().id
};
let centre = part(&s, on, "Center");
s.execute("shape.editFlare", &json!({"rings": 4})).unwrap();
assert!(aligned(&s, on).len() > 4 && aligned(&s, on).iter().all(|a| *a));
// Each part drawn again keeps its id and its own property: without the rays, the center does
// not take theirs.
assert_eq!(part(&s, on, "Center"), centre);
s.execute("object.setPixelAligned", &json!({"ids": [centre.0], "on": false})).unwrap();
s.execute("select.set", &json!({"ids": [on.0]})).unwrap();
s.execute("shape.editFlare", &json!({"rays": 0})).unwrap();
let node = |s: &Session, id: NodeId| s.doc().unwrap().doc.node(id).unwrap().extras().pixel_aligned;
assert!(!node(&s, centre) && node(&s, part(&s, on, "Halo")));
let off = NodeId(s.execute("shape.flare", &json!({"cx": 300.3, "cy": 200.6, "rings": 2})).unwrap()["id"].as_u64().unwrap());
s.execute("document.setup", &json!({"alignNewObjectsToPixelGrid": true})).unwrap();
s.execute("shape.editFlare", &json!({"rings": 4})).unwrap();
assert!(aligned(&s, off).iter().all(|a| !*a));
}
#[test]
fn reshape_moves_the_grabbed_point_and_its_neighbourhood() {
let mut s = session();
+138 -4
View File
@@ -3,7 +3,9 @@
//! Flare: drag sets the center and its size and turns the rays as the pointer moves up or down
//! (Shift holds their turn; click without dragging opens the Flare Tool Options), then a click
//! sets the end point of the rings; Space held during either drag moves the flare. The rest comes
//! from the tool's options (the Flare Tool Options, which last). Reshape: a click on a selected
//! from the tool's options (the Flare Tool Options, which last). With one flare selected, the tool
//! shows its center and end handles, and dragging either changes the flare's length and direction
//! (`shape.editFlare`). Reshape: a click on a selected
//! path sets a focal point (adding an anchor on a segment), Shift-click adds or removes more, and
//! a drag from a focal point moves them all; the engine's `path.reshape` stretches the selected
//! anchors between them and the anchors that stay.
@@ -66,6 +68,38 @@ pub struct FlareTool {
/// Whether the flare has rays and rings (the options' Rays and Rings checkboxes).
rays_on: bool,
rings_on: bool,
/// A drag of the selected flare's center or end handle.
handle: Option<HandleDrag>,
}
/// A drag of a selected flare's handle: the flare, whether it is the end handle (else the center),
/// where the handle was, where it was pressed and whether the drag has begun its undo step.
#[derive(Clone, Copy, Debug)]
struct HandleDrag {
id: vectorcraft_doc::NodeId,
end: bool,
from: Point,
at: Point,
began: bool,
}
/// The flare whose handles the Flare tool shows: the one selected object, when it is a flare that
/// can be edited, with its center and the rings' end point.
fn selected_flare(cx: &ToolContext) -> Option<(vectorcraft_doc::NodeId, Point, Point)> {
let [id] = cx.selection.objects.as_slice() else { return None };
if !cx.doc.is_editable(*id) {
return None;
}
let node = cx.doc.node(*id)?;
let spec = node.extras().flare.as_deref().filter(|spec| spec.draws(node))?;
Some((*id, spec.center()?, spec.end()?))
}
/// `shape.editFlare`'s params for handle drag `h` with the pointer at `pointer`: the handle moves
/// as far as the pointer has.
fn handle_params(h: HandleDrag, pointer: Point) -> Value {
let p = h.from + (pointer - h.at);
if h.end { json!({ "ids": [h.id.0], "x2": p.x, "y2": p.y }) } else { json!({ "ids": [h.id.0], "cx": p.x, "cy": p.y }) }
}
impl Default for FlareTool {
@@ -81,6 +115,7 @@ impl Default for FlareTool {
values: FLARE_OPTIONS.map(|(_, default, _, _)| default),
rays_on: true,
rings_on: true,
handle: None,
}
}
}
@@ -146,12 +181,40 @@ impl Tool for FlareTool {
"flare"
}
fn busy(&self) -> bool {
self.drag.is_some() || self.placed.is_some()
self.drag.is_some() || self.placed.is_some() || self.handle.is_some()
}
fn pointer(&mut self, cx: &ToolContext, ev: &PointerEvent) -> Vec<Action> {
self.hover = ev.pos;
if let Some(mut h) = self.handle {
return match ev.kind {
PointerKind::Drag if h.began => vec![Action::Preview("shape.editFlare".into(), handle_params(h, ev.pos))],
PointerKind::Drag if ev.pos.distance(h.at) < cx.tol(3.0) => vec![],
PointerKind::Drag => {
h.began = true;
self.handle = Some(h);
vec![Action::Begin("Edit Flare".into()), Action::Preview("shape.editFlare".into(), handle_params(h, ev.pos))]
}
PointerKind::Up => {
self.handle = None;
if h.began { vec![Action::Preview("shape.editFlare".into(), handle_params(h, ev.pos)), Action::Commit] } else { vec![] }
}
_ => vec![],
};
}
match ev.kind {
PointerKind::Down => {
// A press on the selected flare's center or end handle drags that handle.
if self.placed.is_none()
&& let Some((id, c, e)) = selected_flare(cx)
{
let tol = cx.tol(4.0);
let (dc, de) = (ev.pos.distance(c), ev.pos.distance(e));
if dc.min(de) <= tol {
let end = de < dc;
self.handle = Some(HandleDrag { id, end, from: if end { e } else { c }, at: ev.pos, began: false });
return vec![];
}
}
if self.placed.is_none() {
self.drag = Some((ev.pos, ev.pos));
self.rays = None;
@@ -223,6 +286,11 @@ impl Tool for FlareTool {
};
return vec![Action::Preview("shape.flare".into(), preview)];
}
if key == ToolKey::Escape
&& let Some(h) = self.handle.take()
{
return if h.began { vec![Action::Cancel] } else { vec![] };
}
if key == ToolKey::Escape && self.busy() {
self.rays = None;
self.drag = None;
@@ -235,15 +303,26 @@ impl Tool for FlareTool {
fn deactivate(&mut self, _cx: &ToolContext) -> Vec<Action> {
// Switching away after the centre drag keeps the flare with the rings its options give.
self.drag = None;
if self.handle.take().is_some_and(|h| h.began) {
return vec![Action::Commit];
}
if self.placed.take().is_some() && std::mem::take(&mut self.began) { vec![Action::Commit] } else { vec![] }
}
fn overlays(&self, _cx: &ToolContext) -> Vec<Overlay> {
fn overlays(&self, cx: &ToolContext) -> Vec<Overlay> {
match (self.drag, self.placed) {
(Some((c, p)), _) => {
vec![Overlay::Path { path: ellipse_path(c, p.distance(c), p.distance(c), 0.0), color: BLUE, width: 1.0, dashed: false }]
}
(_, Some((c, _))) => vec![Overlay::Line { a: c, b: self.hover, color: BLUE, dashed: true }],
_ => vec![],
// The selected flare's center and end handles.
_ => match selected_flare(cx) {
Some((_, c, e)) => vec![
Overlay::Line { a: c, b: e, color: BLUE, dashed: true },
Overlay::Anchor { p: c, color: BLUE, filled: self.handle.is_some_and(|h| !h.end), size: 7.0 },
Overlay::Anchor { p: e, color: BLUE, filled: self.handle.is_some_and(|h| h.end), size: 7.0 },
],
None => vec![],
},
}
}
fn cursor(&self, _cx: &ToolContext, _p: Point, _mods: Mods) -> Cursor {
@@ -791,6 +870,61 @@ mod tests {
assert_eq!(t.turn, 10.0);
}
/// With one flare selected, the tool shows its center and end handles where the flare is now
/// drawn, and dragging either edits the flare (`shape.editFlare`) as one undo step; a press
/// away from them draws a new flare.
#[test]
fn dragging_a_selected_flares_handles_changes_its_length_and_direction() {
use crate::testutil::*;
use vectorcraft_doc::flare::{FlareSpec, part_node, parts};
use vectorcraft_doc::{Node, Selection};
let (mut d, _) = doc_with_rect();
let gid = d.alloc_id();
let v = json!({ "cx": 100.0, "cy": 100.0, "x2": 300.0, "y2": 100.0, "rays": 3, "rings": 2, "seed": 5, "diameter": 30.0,
"opacity": 50.0, "brightness": 30.0, "growth": 20.0, "fuzziness": 50.0, "longest": 300.0, "rayFuzziness": 100.0,
"rotation": 0.0, "largest": 50.0 });
let xf = vectorcraft_geom::Affine::translate((10.0, 20.0));
let children: Vec<_> = parts(&v).into_iter().map(|part| std::sync::Arc::new(part_node(d.alloc_id(), part, xf, false))).collect();
let edited = children[0].id;
let mut g = Node::group(gid, children);
g.extras_mut().flare = Some(Box::new(FlareSpec { params: v, transform: xf }));
let layer = d.layers[0].id;
d.insert(Some(layer), usize::MAX, g).unwrap_or_else(|e| panic!("{e}"));
let s = Selection { objects: vec![gid], ..Default::default() };
let p = paint();
let cx = cx(&d, &s, &p);
let mut t = FlareTool::default();
let ov = t.overlays(&cx);
let anchors: Vec<Point> = ov.iter().filter_map(|o| if let Overlay::Anchor { p, .. } = o { Some(*p) } else { None }).collect();
assert_eq!(anchors, vec![Point::new(110.0, 120.0), Point::new(310.0, 120.0)]);
// The end handle, grabbed 2 points off: it moves as far as the pointer.
assert!(t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 312.0, 120.0)).is_empty());
assert!(t.busy());
let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 312.0, 160.0));
assert_eq!(a.first(), Some(&Action::Begin("Edit Flare".into())));
let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 302.0, 200.0));
assert_eq!(a, vec![Action::Preview("shape.editFlare".into(), json!({ "ids": [gid.0], "x2": 300.0, "y2": 200.0 })), Action::Commit]);
// The center handle; Escape cancels its drag.
t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 110.0, 121.0));
let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 121.0));
assert_eq!(a.last(), Some(&Action::Preview("shape.editFlare".into(), json!({ "ids": [gid.0], "cx": 150.0, "cy": 120.0 }))));
assert_eq!(t.key(&cx, ToolKey::Escape, Mods::default()), vec![Action::Cancel]);
assert!(!t.busy());
// A click on a handle without a drag changes nothing.
t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 110.0, 120.0));
assert!(t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 110.0, 120.0)).is_empty());
// Away from the handles a drag draws a new flare.
t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 200.0, 300.0));
let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 240.0, 300.0));
assert_eq!(a.first(), Some(&Action::Begin("Flare".into())));
// Without a flare selected, no handles show.
let none = Selection::default();
assert!(FlareTool::default().overlays(&crate::testutil::cx(&d, &none, &p)).is_empty());
// A flare with an edited part is no longer edited as a flare: no handles show.
d.node_mut(edited).unwrap_or_else(|| panic!("no part")).opacity = 0.25;
assert!(FlareTool::default().overlays(&crate::testutil::cx(&d, &s, &p)).is_empty());
}
/// Space held while dragging out a flare moves it at its current size and turn, in the center
/// drag and in the drag that places the rings' end point; let go, the drag goes on from there.
#[test]
+125 -5
View File
@@ -5,11 +5,15 @@
//! grid shows). While Alt (Option on macOS) is held, Cancel reads Reset, which puts every option
//! back to the tool's default and leaves the dialog open (`ui.dialogReset`). A click-opened
//! dialog previews its settings live; Reset refreshes that preview and Cancel rolls it back.
//! Opened from the toolbar with flares selected, it shows the first one's settings, and OK draws
//! the selected flares again with the settings changed in the dialog (`shape.editFlare`); the tool
//! keeps its options.
//!
//! Fields: the options (`vectorcraft_tools::extra::FLARE_OPTIONS`): `diameter` and `pathLength`
//! (points), `opacity`, `brightness`, `growth`, `fuzziness`, `longest`, `rayFuzziness` and
//! `largest` (%), `rays` and `rings` (counts), `direction` (degrees); `raysOn` and `ringsOn`; and
//! `x`, `y` where a click opened it, with `preview` on initially for that click.
//! `largest` (%), `rays` and `rings` (counts), `direction` (degrees); `raysOn` and `ringsOn`;
//! `x`, `y` where a click opened it, with `preview` on initially for that click; and `flares`
//! (ids) with `shown` (the settings the dialog opened with) for the selected flares.
use serde_json::{Map, Value, json};
use vectorcraft_geom::Point;
@@ -38,7 +42,8 @@ const LABEL_W: f32 = 78.0;
const FIELD_W: f32 = 90.0;
/// Open the Flare Tool Options with the tool's values; `at`: where a click opened them, to draw a
/// flare there on OK.
/// flare there on OK. Opened without a click while flares are selected, they show the first one's
/// settings, to change the selected flares on OK.
pub fn open(app: &mut VectorcraftApp, at: Option<Point>) -> Value {
let mut fields = match app.session.tool_options_of("flare") {
Value::Object(o) => o,
@@ -48,11 +53,79 @@ pub fn open(app: &mut VectorcraftApp, at: Option<Point>) -> Value {
fields.insert("preview".into(), json!(true));
fields.insert("x".into(), json!(p.x));
fields.insert("y".into(), json!(p.y));
} else if let Some((ids, settings)) = selected_flares(app) {
// A flare without rays or rings shows that checkbox off, with the tool's count.
for (key, on) in [("rays", "raysOn"), ("rings", "ringsOn")] {
let n = settings.get(key).and_then(Value::as_f64).unwrap_or(0.0);
fields.insert(on.into(), json!(n > 0.0));
if n > 0.0 {
fields.insert(key.into(), json!(n));
}
}
for (key, ..) in FLARE_OPTIONS.iter().filter(|(k, ..)| !matches!(*k, "rays" | "rings")) {
if let Some(v) = settings.get(*key) {
fields.insert(key.to_string(), v.clone());
}
}
fields.insert("shown".into(), Value::Object(shown(&fields)));
fields.insert("flares".into(), json!(ids));
}
app.ui.dialog = Some(Dialog { kind: KIND.into(), fields });
json!({ "dialog": KIND })
}
/// The selected flares that can be edited (ids) and the first one's settings as the dialog shows
/// them: its rings' path length and direction from its center to its end point, where the flare is
/// drawn now.
fn selected_flares(app: &VectorcraftApp) -> Option<(Vec<u64>, Map<String, Value>)> {
let st = app.session.doc().ok()?;
let flares: Vec<_> = st
.selection
.objects
.iter()
.filter(|id| st.doc.is_editable(**id))
.filter_map(|id| vectorcraft_engine::flare_settings(&st.doc, *id).map(|spec| (id.0, spec)))
.collect();
let (_, first) = flares.first()?;
let Value::Object(mut settings) = first.params.clone() else { return None };
let d = first.end()? - first.center()?;
settings.insert("pathLength".into(), json!(d.hypot()));
// Counter-clockwise from 3 o'clock, 0° to 360°, as `shape.flare` takes it.
settings.insert("direction".into(), json!((-d.y).atan2(d.x).to_degrees().rem_euclid(360.0)));
Some((flares.iter().map(|(id, _)| *id).collect(), settings))
}
/// The settings `fields` give a flare: each option, with a count of 0 when its checkbox is off.
fn shown(fields: &Map<String, Value>) -> Map<String, Value> {
let get = |key: &str, default: f64| fields.get(key).and_then(Value::as_f64).unwrap_or(default);
let on = |key: &str| fields.get(key).and_then(Value::as_bool) != Some(false);
FLARE_OPTIONS
.iter()
.map(|&(key, default, ..)| {
let v = match key {
"rays" if !on("raysOn") => 0.0,
"rings" if !on("ringsOn") => 0.0,
"rays" | "rings" => get(key, default).round(),
_ => get(key, default),
};
(key.to_string(), json!(v))
})
.collect()
}
/// `shape.editFlare`'s params for the selected flares: the settings changed since the dialog opened.
fn edit_params(d: &Dialog) -> Option<Value> {
let ids = d.fields.get("flares")?.clone();
let start = d.fields.get("shown").and_then(Value::as_object).cloned().unwrap_or_default();
let mut params = json!({ "ids": ids });
for (key, v) in shown(&d.fields) {
if start.get(&key) != Some(&v) {
params[key.as_str()] = if matches!(key.as_str(), "rays" | "rings") { json!(v.as_f64().unwrap_or(0.0) as u64) } else { v };
}
}
Some(params)
}
/// A row for option `key`, kept within its range: a distance in `unit`, else a number.
fn field(ui: &mut egui::Ui, d: &mut Dialog, unit: vectorcraft_doc::Unit, (key, label): (&str, &str)) {
let Some(&(_, default, lo, hi)) = FLARE_OPTIONS.iter().find(|(k, ..)| *k == key) else { return };
@@ -119,8 +192,12 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
false
}
/// A click-created flare previews at that original click; toolbar options draw no artwork.
/// A click-created flare previews at that original click, and the selected flares preview with the
/// settings changed; toolbar options draw no artwork.
fn preview_command(app: &VectorcraftApp, d: &Dialog) -> Option<(String, Value)> {
if let Some(params) = edit_params(d) {
return Some(("shape.editFlare".into(), params));
}
let at = Point::new(d.fields.get("x")?.as_f64().filter(|v| v.is_finite())?, d.fields.get("y")?.as_f64().filter(|v| v.is_finite())?);
// Use the same clamping and whole-count conversion as accepted tool settings.
let mut tool = vectorcraft_tools::create("flare");
@@ -142,8 +219,16 @@ fn reset(_: &VectorcraftApp, d: &mut Dialog) {
}
}
/// OK: set the tool's options; opened by a click, draw a flare there with them.
/// OK: set the tool's options; opened by a click, draw a flare there with them. Opened for the
/// selected flares, draw them again with the settings changed, leaving the tool's options.
fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> DialogResult {
if let Some(params) = edit_params(d) {
return if d.fields.contains_key(form::PREVIEWED) {
form::commit_preview(app, "shape.editFlare", params)
} else {
run_and_close(app, "shape.editFlare", params)
};
}
let command = preview_command(app, d);
if command.is_none() && (d.fields.contains_key("x") || d.fields.contains_key("y") || d.fields.contains_key(form::PREVIEWED)) {
return Err("Flare click coordinates must be finite numbers".into());
@@ -317,6 +402,41 @@ mod tests {
assert_eq!((o["opacity"].as_f64(), o["diameter"].as_f64()), (Some(100.0), Some(0.0)));
}
/// With a flare selected, the toolbar's Flare Tool Options show its settings, and OK draws it
/// again with the settings changed, as one undo step, leaving the tool's options.
#[test]
fn with_a_flare_selected_the_options_show_its_settings_and_ok_draws_it_again() {
let mut app = app();
let flare = json!({"cx": 200, "cy": 200, "diameter": 60, "rays": 0, "rings": 4, "x2": 200, "y2": 0, "largest": 80, "seed": 5});
app.run("shape.flare", flare).unwrap();
app.run("object.move", json!({"dx": 30, "dy": 0})).unwrap();
let options = app.session.tool_options_of("flare");
app.run("tool.options", json!({"tool": "flare"})).unwrap();
painted(&mut app);
let d = app.ui.dialog.as_mut().unwrap();
let shown = (d.f64("diameter", 0.0), d.bool("raysOn"), d.f64("rays", 0.0), d.f64("rings", 0.0), d.f64("largest", 0.0));
assert_eq!(shown, (60.0, false, 15.0, 4.0, 80.0));
assert!((d.f64("pathLength", 0.0) - 200.0).abs() < 1e-9 && (d.f64("direction", 0.0) - 90.0).abs() < 1e-9);
d.fields.insert("rings".into(), json!(7));
d.fields.insert("raysOn".into(), json!(true));
let depth = app.session.doc().unwrap().history.undo.len();
super::super::confirm(&mut app).unwrap();
assert!(app.ui.dialog.is_none());
assert_eq!(app.session.doc().unwrap().history.undo.len(), depth + 1);
let parts = flare_parts(&app);
assert_eq!((parts.iter().filter(|p| *p == "Ring").count(), parts.iter().any(|p| p == "Rays")), (7, true), "{parts:?}");
// Still where it was moved to.
let doc = &app.session.doc().unwrap().doc;
let id = app.session.doc().unwrap().selection.objects[0];
assert!(vectorcraft_engine::flare_settings(doc, id).unwrap().center().unwrap().distance(Point::new(230.0, 200.0)) < 1e-9);
assert_eq!(app.session.tool_options_of("flare"), options);
// With nothing selected, the dialog shows the tool's options again.
app.run("select.none", json!({})).unwrap();
app.run("tool.options", json!({"tool": "flare"})).unwrap();
let d = app.ui.dialog.as_ref().unwrap();
assert_eq!((d.f64("diameter", 0.0), d.fields.contains_key("flares")), (100.0, false));
}
#[test]
fn ui_dialog_reset_puts_the_defaults_back_and_keeps_where_a_click_opened_it() {
let mut app = app();
+2
View File
@@ -1234,6 +1234,7 @@ font-technology Variable Променливи
Fit to Selected Art Побиране спрямо избраната графика
Flag… Знаме…
Flare Взрив
Edit Flare Редактиране на взрива
Flare Tool Инструмент „Взрив“
Flare Tool Options Опции на инструмента „Взрив“
Halo Ореол
@@ -4615,6 +4616,7 @@ axis Both И двете
@msg select a blend изберете преход (blend)
@msg select a blend or give `id` изберете преливане или задайте неговия `id`
@msg select a clip group изберете група за изрязване
@msg select a flare изберете взрив
@msg select a gradient mesh изберете мрежа на градиент (gradient mesh)
@msg select a linked image: an embedded one has no file изберете свързано изображение: вграденото няма файл
@msg select a repeat изберете повторение (repeat)
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -4049,6 +4049,7 @@ theme Appearance Izgled
Set Tab Stops Postavi tabulatore
Tab Stops Tabulatori
Flare Odsjaj
Edit Flare Uredi odsjaj
Rays Zrake
Rectangle Pravougaonik
Paintbrush Kist
@@ -5011,6 +5012,7 @@ imageTrace Outline Obris
@msg select a blend odaberite stapanje
@msg select a blend or give `id` odaberite stapanje ili navedite `id`
@msg select a clip group odaberite grupu isijecanja
@msg select a flare odaberite odsjaj
@msg select a gradient mesh odaberite gradijentnu mrežu
@msg select a linked image: an embedded one has no file odaberite povezanu sliku: ugrađena nema datoteku
@msg select a repeat odaberite ponavljanje
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -1738,6 +1738,7 @@ digits Malayalam Malaiàlam
Fixed Fix
Flag… Marca…
Flare Resplendor
Edit Flare Edita el resplendor
Flare Tool Eina de resplendor
Flare Tool Options Opcions de l’eina de resplendor
Flat Angle Angle pla
@@ -6106,6 +6107,7 @@ digits Malayalam Malaiàlam
@msg select a blend selecciona una fusió
@msg select a blend or give `id` selecciona una fusió o dona `id`
@msg select a clip group selecciona un grup de retall
@msg select a flare selecciona un resplendor
@msg select a gradient mesh selecciona una malla de degradat
@msg select a linked image: an embedded one has no file selecciona una imatge enllaçada: una d’incrustada no té fitxer
@msg select a Live Paint group selecciona un grup de pintura interactiva
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -4105,6 +4105,7 @@ theme Appearance Motiv
Set Tab Stops Nastavit zarážky tabulátoru
Tab Stops Zarážky tabulátoru
Flare Odlesk
Edit Flare Upravit odlesk
Rays Paprsky
Rectangle Obdélník
Paintbrush Štětec
@@ -5185,6 +5186,7 @@ imageTrace Outline Obrys
@msg select a blend vyberte prolnutí
@msg select a blend or give `id` vyberte prolnutí, nebo zadejte `id`
@msg select a clip group vyberte ořezovou skupinu
@msg select a flare vyberte odlesk
@msg select a gradient mesh vyberte přechodovou síť
@msg select a linked image: an embedded one has no file vyberte propojený obrázek: vložený nemá soubor
@msg select a repeat vyberte opakování
Can't render this file because it is too large.
+2
View File
@@ -4431,6 +4431,7 @@ theme Appearance Udseende
Set Tab Stops Angiv tabulatorstop
Tab Stops Tabulatorstop
Flare Flare
Edit Flare Redigér flare
Rays Stråler
Rectangle Rektangel
Paintbrush Malerpensel
@@ -5323,6 +5324,7 @@ imageTrace Outline Kontur
@msg select a Live Paint group markér en Live Paint-gruppe
@msg select a blend markér en blanding
@msg select a clip group markér en klipgruppe
@msg select a flare markér en flare
@msg select a gradient mesh markér et gradientnet
@msg select a linked image: an embedded one has no file markér et linket billede: et indlejret har ingen fil
@msg select a repeat markér en gentagelse
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -1267,6 +1267,7 @@ font-technology Variable Variabel
Fit to Selected Art An ausgewählte Grafik anpassen
Flag… Flagge…
Flare Blendenfleck
Edit Flare Blendenfleck bearbeiten
Flare Tool Blendenfleck-Werkzeug
Flare Tool Options Optionen für das Blendenfleck-Werkzeug
Halo Lichtkranz
@@ -4800,6 +4801,7 @@ theme Appearance Erscheinungsbild
@msg select a blend wählen Sie eine Angleichung aus
@msg select a blend or give `id` wählen Sie eine Angleichung aus oder geben Sie `id` an
@msg select a clip group wählen Sie eine Schnittgruppe aus
@msg select a flare wählen Sie einen Blendenfleck aus
@msg select a gradient mesh wählen Sie ein Verlaufsgitter aus
@msg select a linked image: an embedded one has no file wählen Sie ein verknüpftes Bild aus: Ein eingebettetes hat keine Datei
@msg select a repeat wählen Sie eine Wiederholung aus
Can't render this file because it is too large.
+2
View File
@@ -1212,6 +1212,7 @@ font-technology Variable Μεταβλητές
Fit to Selected Art Προσαρμογή στο επιλεγμένο γραφικό
Flag… Σημαία…
Flare Λάμψη
Edit Flare Επεξεργασία λάμψης
Flare Tool Λάμψη (Flare Tool)
Flare Tool Options Επιλογές εργαλείου λάμψης
Halo Άλως
@@ -4834,6 +4835,7 @@ digits Malayalam Μαλαγιάλαμ
@msg select a blend επιλέξτε ανάμειξη
@msg select a blend or give `id` επιλέξτε ανάμειξη ή δώστε το `id`
@msg select a clip group επιλέξτε ομάδα αποκοπής
@msg select a flare επιλέξτε λάμψη
@msg select a gradient mesh επιλέξτε πλέγμα ντεγκραντέ
@msg select a linked image: an embedded one has no file επιλέξτε συνδεδεμένη εικόνα: η ενσωματωμένη δεν έχει αρχείο
@msg select a repeat επιλέξτε επανάληψη
Can't render this file because it is too large.
+2
View File
@@ -1288,6 +1288,7 @@ font-technology Variable Variables
Fit to Selected Art Encajar en la ilustración seleccionada
Flag… Bandera…
Flare Destello
Edit Flare Editar destello
Flare Tool Herramienta Destello
Flare Tool Options Opciones de la herramienta Destello
Halo Halo
@@ -4878,6 +4879,7 @@ axis Both Ambos
@msg select a blend selecciona una fusión
@msg select a blend or give `id` selecciona una fusión o indica su `id`
@msg select a clip group selecciona un grupo de recorte
@msg select a flare selecciona un destello
@msg select a gradient mesh selecciona una malla de degradado
@msg select a linked image: an embedded one has no file selecciona una imagen vinculada: una incrustada no tiene archivo
@msg select a repeat selecciona una repetición
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -4029,6 +4029,7 @@ theme Appearance Ulkoasu
Set Tab Stops Aseta sarkainkohdat
Tab Stops Sarkainkohdat
Flare Häikäisy
Edit Flare Muokkaa häikäisyä
Rays Säteet
Rectangle Suorakulmio
Paintbrush Maalaussivellin
@@ -5093,6 +5094,7 @@ imageTrace Outline Ääriviiva
@msg select a blend valitse sulautus
@msg select a blend or give `id` valitse sulautus tai anna sen `id`
@msg select a clip group valitse leikkausryhmä
@msg select a flare valitse häikäisy
@msg select a gradient mesh valitse liukuväriverkko
@msg select a linked image: an embedded one has no file valitse linkitetty kuva: upotetulla kuvalla ei ole tiedostoa
@msg select a repeat valitse toisto
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -1282,6 +1282,7 @@ font-technology Variable Variables
Fit to Selected Art Ajuster à l’illustration sélectionnée
Flag… Drapeau…
Flare Halo
Edit Flare Modifier le halo
Flare Tool Outil Halo
Flare Tool Options Options de l’outil Halo
Halo Halo
@@ -4865,6 +4866,7 @@ axis Both Les deux
@msg select a blend sélectionnez un dégradé de formes
@msg select a blend or give `id` sélectionnez un dégradé de formes ou indiquez son `id`
@msg select a clip group sélectionnez un groupe d’écrêtage
@msg select a flare sélectionnez un halo
@msg select a gradient mesh sélectionnez un filet de dégradé
@msg select a linked image: an embedded one has no file sélectionnez une image liée : une image incorporée n’a pas de fichier
@msg select a repeat sélectionnez une répétition
Can't render this file because it is too large.
+1
View File
@@ -1412,6 +1412,7 @@
Fix Selected પસંદ કરેલું ઠીક કરો
Flag… ફ્લેગ…
Flare ફ્લેર
Edit Flare ફ્લેર સંપાદિત કરો
Flare Tool ફ્લેર ટૂલ
Flare Tool Options ફ્લેર ટૂલ વિકલ્પો
Flat Image ફ્લેટ છબી
Can't render this file because it contains an unexpected character in line 72 and column 5.
+2
View File
@@ -1939,6 +1939,7 @@ antiAlias Sharp शार्प
Fixed निश्चित
Flag… झंडा…
Flare फ्लेयर
Edit Flare फ्लेयर संपादित करें
Flare Tool फ्लेयर टूल
Flare Tool Options फ़्लेयर टूल ऑप्शन्स
Flat Angle फ्लैट कोण
@@ -7831,6 +7832,7 @@ antiAlias Sharp शार्प
@msg select a blend or give `id` एक मिश्रण सिलेक्ट करें या `id` देना
@msg select a blend to set easing or color shift Easing या रंग शिफ्ट सेट करने के लिए एक मिश्रण सिलेक्ट करें
@msg select a clip group एक क्लिप समूह चुनें
@msg select a flare एक फ्लेयर चुनें
@msg select a compound shape एक मिश्रित आकार चुनें
@msg Select a dimension first पहले आयाम सिलेक्ट करें
@msg select a gradient mesh एक ग्रेडिएंट जाल सिलेक्ट करें
Can't render this file because it is too large.
+2
View File
@@ -1602,6 +1602,7 @@ digits Malayalam Malajálam
Fixed Rögzített
Flag… Zászló…
Flare Fényvillanás
Edit Flare Fényvillanás szerkesztése
Flare Tool Fényvillanás
Flare Tool Options Fényvillanás beállításai
Flat Angle Lapos, ferde
@@ -5638,6 +5639,7 @@ imageTrace Outline Körvonal
@msg select a blend jelölj ki egy összemosást
@msg select a blend or give `id` jelölj ki egy összemosást, vagy add meg az `id` értékét
@msg select a clip group jelölj ki egy vágócsoportot
@msg select a flare jelölj ki egy fényvillanást
@msg select a gradient mesh jelölj ki egy színátmenetes hálót
@msg select a linked image: an embedded one has no file jelölj ki egy csatolt képet: a beágyazottnak nincs fájlja
@msg select a Live Paint group jelölj ki egy élőfestés-csoportot
Can't render this file because it is too large.
+2
View File
@@ -3822,6 +3822,7 @@ theme Appearance Tampilan
Set Tab Stops Atur hentian tab
Tab Stops Hentian tab
Flare Flare
Edit Flare Edit flare
Rays Sinar
Rectangle Persegi panjang
Paintbrush Kuas lukis
@@ -4713,6 +4714,7 @@ imageTrace Outline Kontur
@msg select a Live Paint group pilih grup Live Paint
@msg select a blend pilih blend
@msg select a clip group pilih grup klip
@msg select a flare pilih flare
@msg select a gradient mesh pilih mesh gradien
@msg select a linked image: an embedded one has no file pilih gambar tertaut: gambar yang tersemat tidak memiliki berkas
@msg select a repeat pilih pengulangan
Can't render this file because it contains an unexpected character in line 2454 and column 5.
+2
View File
@@ -1297,6 +1297,7 @@ font-technology Variable Variabili
Fit to Selected Art Adatta alla grafica selezionata
Flag… Bandiera…
Flare Riflesso
Edit Flare Modifica riflesso
Flare Tool Strumento Riflesso
Flare Tool Options Opzioni strumento Riflesso
Halo Alone
@@ -4928,6 +4929,7 @@ axis Both Entrambi
@msg select a blend seleziona una fusione
@msg select a blend or give `id` seleziona una fusione o specifica il suo `id`
@msg select a clip group seleziona un gruppo di ritaglio
@msg select a flare seleziona un riflesso
@msg select a gradient mesh seleziona una trama sfumatura
@msg select a linked image: an embedded one has no file seleziona un'immagine collegata: un'immagine incorporata non ha un file
@msg select a repeat seleziona una ripetizione
Can't render this file because it is too large.
+2
View File
@@ -1826,6 +1826,7 @@ antiAlias Sharp シャープ
Fit in Window ウィンドウに合わせる
Fit on Screen 画面にフィット
Flare フレア
Edit Flare フレアを編集
Flare Tool フレアツール
Flat Image 統合イメージ
Flatness: フラットネス:
@@ -4602,6 +4603,7 @@ swatch Bright Violet ビビッドバイオレット
@msg no previous transform 前回の変形がありません
@msg nothing to align 整列するものがありません
@msg select a clip group クリップグループを選択してください
@msg select a flare フレアを選択してください
@msg select two or more objects to distribute 分布させるオブジェクトを 2 つ以上選択してください
@msg axis must be "vertical", "horizontal" or an angle in degrees, not `{v}` axis には "vertical"、"horizontal"、度単位の角度のいずれかを指定してください (`{v}` は指定できません)
@msg give horizontal or vertical horizontal または vertical を指定してください
Can't render this file because it is too large.
+2
View File
@@ -3660,6 +3660,7 @@ theme Appearance იერსახე
Set Tab Stops ტაბულაციის გაჩერებების დაყენება
Tab Stops ტაბულაციის გაჩერებები
Flare ბლიკი
Edit Flare ბლიკის რედაქტირება
Rays სხივები
Rectangle მართკუთხედი
Paintbrush ფუნჯი
@@ -4543,6 +4544,7 @@ font-technology Variable ცვლადი
@msg select a Live Paint group მონიშნეთ ცოცხალი შეღებვის ჯგუფი
@msg select a blend მონიშნეთ გადასვლა
@msg select a clip group მონიშნეთ მომჭრელი ჯგუფი
@msg select a flare მონიშნეთ ბლიკი
@msg select a gradient mesh მონიშნეთ გრადიენტული ბადე
@msg select a linked image: an embedded one has no file მონიშნეთ მიბმული გამოსახულება: ჩაშენებულს ფაილი არ აქვს
@msg select a repeat მონიშნეთ გამეორება
Can't render this file because it is too large.
+2
View File
@@ -1816,6 +1816,7 @@ antiAlias Sharp 날카롭게
Fit in Window 창에 맞추기
Fit on Screen 화면에 맞추기
Flare 플레어
Edit Flare 플레어 편집
Flare Tool 플레어 도구
Flat Image 단일 이미지
Flatness: 평탄도:
@@ -4529,6 +4530,7 @@ theme Appearance 외관
@msg no previous transform 이전 변형이 없습니다
@msg nothing to align 정렬할 항목이 없습니다
@msg select a clip group 클립 그룹을 선택하세요
@msg select a flare 플레어를 선택하세요
@msg select two or more objects to distribute 분포할 개체를 두 개 이상 선택하세요
@msg axis must be "vertical", "horizontal" or an angle in degrees, not `{v}` axis는 "vertical", "horizontal" 또는 도 단위 각도여야 합니다: `{v}`
@msg give horizontal or vertical horizontal 또는 vertical을 지정하세요
Can't render this file because it is too large.
+2
View File
@@ -4340,6 +4340,7 @@ theme Appearance Vormgeving
Set Tab Stops Tabstops instellen
Tab Stops Tabstops
Flare Flare
Edit Flare Flare bewerken
Rays Stralen
Rectangle Rechthoek
Paintbrush Penseel
@@ -5232,6 +5233,7 @@ imageTrace Outline Contour
@msg select a Live Paint group selecteer een Live Paint-groep
@msg select a blend selecteer een vermenging
@msg select a clip group selecteer een knipgroep
@msg select a flare selecteer een flare
@msg select a gradient mesh selecteer een verloopnet
@msg select a linked image: an embedded one has no file selecteer een gekoppelde afbeelding: een ingesloten afbeelding heeft geen bestand
@msg select a repeat selecteer een herhaling
Can't render this file because it is too large.
+2
View File
@@ -3964,6 +3964,7 @@ theme Appearance Wygląd
Set Tab Stops Ustaw tabulatory
Tab Stops Tabulatory
Flare Rozbłysk
Edit Flare Edytuj rozbłysk
Rays Promienie
Rectangle Prostokąt
Paintbrush Pędzel
@@ -5011,6 +5012,7 @@ imageTrace Outline Kontur
@msg select a blend zaznacz przejście
@msg select a blend or give `id` zaznacz przejście lub podaj `id`
@msg select a clip group zaznacz grupę przycinającą
@msg select a flare zaznacz rozbłysk
@msg select a gradient mesh zaznacz siatkę gradientową
@msg select a linked image: an embedded one has no file zaznacz obraz połączony: osadzony nie ma pliku
@msg select a repeat zaznacz powtórzenie
Can't render this file because it is too large.
+2
View File
@@ -1168,6 +1168,7 @@ antiAlias Sharp Nítido
Fit to Selected Art Ajustar à Arte Selecionada
Flag… Bandeira…
Flare Brilho de Lente
Edit Flare Editar Brilho de Lente
Flare Tool Ferramenta Brilho de Lente
Flat Image Imagem Plana
Flatness: Achatamento:
@@ -4325,6 +4326,7 @@ axis Both Ambos
@msg select a blend selecione uma mesclagem
@msg select a blend or give `id` selecione uma mesclagem ou informe seu `id`
@msg select a clip group selecione um grupo de recorte
@msg select a flare selecione um brilho de lente
@msg select a gradient mesh selecione uma malha de gradiente
@msg select a linked image: an embedded one has no file selecione uma imagem vinculada: uma incorporada não tem arquivo
@msg select a repeat selecione uma repetição
Can't render this file because it is too large.
+2
View File
@@ -1286,6 +1286,7 @@ font-technology Variable Вариативные
Fit to Selected Art Вписать в выделенный рисунок
Flag… Флаг…
Flare Блик
Edit Flare Редактировать блик
Flare Tool Инструмент «Блик»
Flare Tool Options Параметры инструмента «Блик»
Halo Ореол
@@ -4915,6 +4916,7 @@ axis Both Оба
@msg select a blend выделите переход
@msg select a blend or give `id` выделите переход или укажите `id`
@msg select a clip group выделите группу обрезки
@msg select a flare выделите блик
@msg select a gradient mesh выделите градиентную сетку
@msg select a linked image: an embedded one has no file выделите связанное изображение: у внедрённого нет файла
@msg select a repeat выделите повтор
Can't render this file because it is too large.
+2
View File
@@ -1247,6 +1247,7 @@ font-technology Variable Variabla
Fit to Selected Art Anpassa till markerad grafik
Flag… Flagga…
Flare Ljusreflex
Edit Flare Redigera ljusreflex
Flare Tool Ljusreflexverktyg
Flare Tool Options Alternativ för ljusreflexverktyget
Halo Halo
@@ -4776,6 +4777,7 @@ axis Both Båda
@msg select a blend markera en blandning
@msg select a blend or give `id` markera en blandning eller ange dess `id`
@msg select a clip group markera en urklippsgrupp
@msg select a flare markera en ljusreflex
@msg select a gradient mesh markera ett gradientnät
@msg select a linked image: an embedded one has no file markera en länkad bild: en inbäddad bild har ingen fil
@msg select a repeat markera en upprepning
Can't render this file because it is too large.
+2
View File
@@ -1241,6 +1241,7 @@ font-technology Variable Değişken
Fit to Selected Art Seçilen Sanata Sığdır
Flag… Bayrak…
Flare parlama
Edit Flare Parlamayı Düzenle
Flare Tool Mercek Parlaması Aracı
Flare Tool Options Genişletme Aracı Seçenekleri
Halo Hale
@@ -4647,6 +4648,7 @@ axis Both Her İkisi
@msg select a Live Paint group bir Canlı Boyama grubu seçin
@msg select a blend bir karışım seç
@msg select a clip group bir klip grubu seçin
@msg select a flare bir parlama seçin
@msg select a gradient mesh bir degrade ağı seçin
@msg select a linked image: an embedded one has no file bağlantılı bir görsel seçin: gömülü görselin dosyası yok
@msg select a repeat bir tekrar seç
Can't render this file because it is too large.
+2
View File
@@ -1291,6 +1291,7 @@ font-technology Variable Варіативні
Fit to Selected Art Вписати у виділений малюнок
Flag… Прапор…
Flare Відблиск
Edit Flare Редагувати відблиск
Flare Tool Інструмент «Відблиск»
Flare Tool Options Параметри інструменту «Відблиск»
Halo Ореол
@@ -4912,6 +4913,7 @@ axis Both Обидві
@msg select a blend виділіть перехід
@msg select a blend or give `id` виділіть перехід або вкажіть `id`
@msg select a clip group виділіть відсічну групу
@msg select a flare виділіть відблиск
@msg select a gradient mesh виділіть градієнтну сітку
@msg select a linked image: an embedded one has no file виділіть пов’язане зображення: у вбудованого немає файлу
@msg select a repeat виділіть повтор
Can't render this file because it is too large.
+2
View File
@@ -1513,6 +1513,7 @@ digits Malayalam Malayalam
Fixed Cố định
Flag… Lá cờ…
Flare Hào quang
Edit Flare Chỉnh sửa hào quang
Flare Tool Công cụ Hào quang
Flare Tool Options Tùy chọn Công cụ Hào quang
Flat Angle Góc phẳng
@@ -5302,6 +5303,7 @@ theme Appearance Giao diện
@msg select a blend hãy chọn một đối tượng hòa trộn
@msg select a blend or give `id` hãy chọn một đối tượng hòa trộn hoặc cung cấp `id`
@msg select a clip group hãy chọn nhóm cắt
@msg select a flare hãy chọn một hào quang
@msg select a gradient mesh hãy chọn lưới chuyển sắc
@msg select a linked image: an embedded one has no file hãy chọn ảnh liên kết: ảnh nhúng không có tệp
@msg select a Live Paint group hãy chọn nhóm tô trực tiếp
Can't render this file because it contains an unexpected character in line 204 and column 5.
+2
View File
@@ -1228,6 +1228,7 @@ antiAlias Sharp 锐利
Fit to Selected Art 适合所选图稿
Flag… 旗形…
Flare 光晕
Edit Flare 编辑光晕
Flare Tool 光晕工具
Flare Tool Options 光晕工具选项
Halo 光晕
@@ -4301,6 +4302,7 @@ imageTrace Outline 轮廓
@msg no previous transform 没有上一次变换
@msg nothing to align 没有可对齐的内容
@msg select a clip group 请选择一个剪切组
@msg select a flare 请选择一个光晕
@msg select two or more objects to distribute 请选择两个或更多要分布的对象
@msg axis must be "vertical", "horizontal" or an angle in degrees, not `{v}` axis 必须是 "vertical"、"horizontal" 或以度为单位的角度,而不是 `{v}`
@msg give horizontal or vertical 请给出 horizontal 或 vertical
Can't render this file because it is too large.
+2
View File
@@ -1262,6 +1262,7 @@ font-technology Variable 可變
Fit to Selected Art 符合選取的圖稿
Flag… 旗形…
Flare 光暈
Edit Flare 編輯光暈
Flare Tool 光暈工具
Flare Tool Options 光暈工具選項
Halo 光暈
@@ -1997,6 +1998,7 @@ file-filter Templates 範本
@msg no previous transform 沒有上一次的變形
@msg nothing to align 沒有可對齊的內容
@msg select a clip group 請選取剪裁群組
@msg select a flare 請選取光暈
@msg select two or more objects to distribute 請選取兩個以上要均分的物件
@msg axis must be "vertical", "horizontal" or an angle in degrees, not `{v}` axis 必須是 "vertical"、"horizontal" 或以度為單位的角度,而非 `{v}`
@msg give horizontal or vertical 請提供 horizontal 或 vertical
Can't render this file because it is too large.
+1 -1
View File
@@ -956,7 +956,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"tool.options",
"Tool Options…",
"",
"{tool: id} what double-clicking a tool button opens: hand → fits the artboard in the window (view.fitArtboard), zoom → 100% (view.actualSize), rotate|scale|reflect|shear → that Object › Transform dialog (dialog `rotate`, `scale`, `reflect` or `shear`; error `nothing selected` without a selection), selection|directSelection|groupSelection → the Move dialog (dialog `move`; the same error), gradient|magicWand → the Gradient or Magic Wand panel (window.panel), artboard → Artboard Options of the active artboard (dialog `artboardOptions`, fields index, name, x, y, width, height, showCenterMark, showCrossHairs; OK runs artboard.setProps, and with other artboards selected with the Artboard tool a new width or height goes to each of them too, in its `artboards` list, each resized about the reference point the form used for that size, or about its top-left corner when the size was set in the fields directly), flare → Flare Tool Options (dialog `flareOptions`, fields diameter and pathLength (pt), opacity, brightness, growth, fuzziness, longest, rayFuzziness, largest (%), rays, rings, direction (°), raysOn, ringsOn; OK runs tool.setOption {tool: \"flare\", values}: the next flare dragged out uses them, and a Flare click's dialog, which also has x, y and preview (on initially), previews one there and accepts it as one Undo step; Cancel rolls back the preview), lineSegment|arc|rectangularGrid|polarGrid → that tool's Tool Options, its click dialog without x and y (dialog kind = the tool id, `__toolOptions: true`; lineSegment: length (pt), angle (°), fillLine; arc: lengthX, lengthY (pt), reference (0–8), arcType: open|closed, baseAlong: x|y, slope (−100…100), fillArc; rectangularGrid: width, height (pt, the Default Size), reference (0–8), rows, columns, rowSkew, columnSkew (%), frame, fill; polarGrid: the same with concentric, radial, concentricSkew, radialSkew and compound for rows, columns, the skews and frame; OK runs tool.setOption {tool, values} and draws nothing: the next drag uses them (Fill Line, the arc's type, base, slope and fill, the grids' dividers, skews and switches) and a click's dialog opens at them), columnGraph|stackedColumnGraph|barGraph|stackedBarGraph|lineGraph|areaGraph|scatterGraph|pieGraph|radarGraph → Graph Type for the selected graph (dialog `command` running graph.setType; an error without one), typeOnPath|verticalTypeOnPath → Type on a Path Options for the selected type on a path (dialog `command` running type.pathOptions; error `nothing selected` without a selection, and the command's error when no type on a path is selected),symbolSprayer|symbolShifter|symbolScruncher|symbolSizer|symbolSpinner|symbolStainer|symbolScreener|symbolStyler → Symbolism Tools Options (dialog `symbolismOptions`, fields tool, diameter (pt), intensity and density (1–10), shared by the eight tools; OK runs tool.setOption {tool, values}), blend → Blend Options, perspectiveGrid → Perspective Grid Options, eyedropper → Eyedropper Options (dialog `eyedropperOptions`, fields sampleSize, pickUp, apply; OK runs eyedropper.setOptions), printTiling → resets the print tiling (print.tiling.set {reset: true}), warp|twirl|pucker|bloat|scallop|crystallize|wrinkle → that tool's Tool Options (dialog `liquifyOptions`, fields tool, width, height, angle, intensity %, usePressure, detail, simplify, simplifyOn, rate, complexity, horizontal %, vertical %, affectAnchors, affectIn, affectOut, showBrush; OK runs tool.setOption {tool, values}), pencil|paintbrush|smooth|blobBrush|eraser → that tool's Tool Options (dialog `freehandOptions`, fields tool and the options the tool keeps: fidelity (px for pencil, paintbrush and smooth, the same at any zoom; pt for blobBrush), fill, keepSelected (on for pencil and paintbrush, off for blobBrush), mergeOnlySelection (off), closeWithin and editWithin (px, 0 is off), livePreview (pencil, on: off draws a thin line while the stroke is drawn, and the path's fill and stroke on release), size (pt), angle (°, −180–180; 0) and roundness (%, 1–100; 100) of the eraser's tip; OK runs tool.setOption {tool, values}), livePaintSelection → Live Paint Selection Tool Options (dialog `livePaintSelectionOptions`, fields selectFills and selectStrokes (both on), color (the highlight color, #rrggbb or a layer color's name; #ff2a2a), width (the highlight's width, 1–20 px; 4); OK runs tool.setOption {tool: \"livePaintSelection\", values}; a color with an alpha part (#rrggbbaa or #rgba) is an error and OK changes nothing), livePaintBucket → Live Paint Bucket Options (dialog `livePaintBucketOptions`, fields paintFills (on) and paintStrokes (off), cursorSwatchPreview (on: the active fill or stroke shows above the pointer between the color swatches before and after it; Left and Right without modifiers step it through the color swatches whether it is on or off), highlight (on), color (the highlight color, #rrggbb or a layer color's name; #ff2a2a), width (the face h Line truncated
"{tool: id} what double-clicking a tool button opens: hand → fits the artboard in the window (view.fitArtboard), zoom → 100% (view.actualSize), rotate|scale|reflect|shear → that Object › Transform dialog (dialog `rotate`, `scale`, `reflect` or `shear`; error `nothing selected` without a selection), selection|directSelection|groupSelection → the Move dialog (dialog `move`; the same error), gradient|magicWand → the Gradient or Magic Wand panel (window.panel), artboard → Artboard Options of the active artboard (dialog `artboardOptions`, fields index, name, x, y, width, height, showCenterMark, showCrossHairs; OK runs artboard.setProps, and with other artboards selected with the Artboard tool a new width or height goes to each of them too, in its `artboards` list, each resized about the reference point the form used for that size, or about its top-left corner when the size was set in the fields directly), flare → Flare Tool Options (dialog `flareOptions`, fields diameter and pathLength (pt), opacity, brightness, growth, fuzziness, longest, rayFuzziness, largest (%), rays, rings, direction (°), raysOn, ringsOn; OK runs tool.setOption {tool: \"flare\", values}: the next flare dragged out uses them, and a Flare click's dialog, which also has x, y and preview (on initially), previews one there and accepts it as one Undo step; Cancel rolls back the preview; with flares selected, the fields show the first one's settings, `flares` lists them and OK runs shape.editFlare with the settings changed instead, leaving the tool's options), lineSegment|arc|rectangularGrid|polarGrid → that tool's Tool Options, its click dialog without x and y (dialog kind = the tool id, `__toolOptions: true`; lineSegment: length (pt), angle (°), fillLine; arc: lengthX, lengthY (pt), reference (0–8), arcType: open|closed, baseAlong: x|y, slope (−100…100), fillArc; rectangularGrid: width, height (pt, the Default Size), reference (0–8), rows, columns, rowSkew, columnSkew (%), frame, fill; polarGrid: the same with concentric, radial, concentricSkew, radialSkew and compound for rows, columns, the skews and frame; OK runs tool.setOption {tool, values} and draws nothing: the next drag uses them (Fill Line, the arc's type, base, slope and fill, the grids' dividers, skews and switches) and a click's dialog opens at them), columnGraph|stackedColumnGraph|barGraph|stackedBarGraph|lineGraph|areaGraph|scatterGraph|pieGraph|radarGraph → Graph Type for the selected graph (dialog `command` running graph.setType; an error without one), typeOnPath|verticalTypeOnPath → Type on a Path Options for the selected type on a path (dialog `command` running type.pathOptions; error `nothing selected` without a selection, and the command's error when no type on a path is selected),symbolSprayer|symbolShifter|symbolScruncher|symbolSizer|symbolSpinner|symbolStainer|symbolScreener|symbolStyler → Symbolism Tools Options (dialog `symbolismOptions`, fields tool, diameter (pt), intensity and density (1–10), shared by the eight tools; OK runs tool.setOption {tool, values}), blend → Blend Options, perspectiveGrid → Perspective Grid Options, eyedropper → Eyedropper Options (dialog `eyedropperOptions`, fields sampleSize, pickUp, apply; OK runs eyedropper.setOptions), printTiling → resets the print tiling (print.tiling.set {reset: true}), warp|twirl|pucker|bloat|scallop|crystallize|wrinkle → that tool's Tool Options (dialog `liquifyOptions`, fields tool, width, height, angle, intensity %, usePressure, detail, simplify, simplifyOn, rate, complexity, horizontal %, vertical %, affectAnchors, affectIn, affectOut, showBrush; OK runs tool.setOption {tool, values}), pencil|paintbrush|smooth|blobBrush|eraser → that tool's Tool Options (dialog `freehandOptions`, fields tool and the options the tool keeps: fidelity (px for pencil, paintbrush and smooth, the same at any zoom; pt for blobBrush), fill, keepSelected (on for pencil and paintbrush, off for blobBrush), mergeOnlySelection (off), closeWithin and editWithin (px, 0 is off), livePreview (pencil, on: off draws a thin line while the stroke is drawn, and the path's fill and stroke on release), size (pt), angle (°, −180–180; 0) and roundness (%, 1–100; 100) of the eraser's tip; OK runs tool.setOption {tool, values}), livePaintSelection → Live Paint Selection Tool Options (dialog `livePaintSelectionOptions`, fields selectFills and selectStrokes (both on), color (the highlight color, #rrggbb or a layer color's name; #ff2a2a), width (the highlight's width, 1–20 px; 4); OK runs tool.setOption {tool: \"livePaintSelection\", values}; a color with an alpha part (#rrggbbaa or #rgba) is an error and OK changes nothing), livePaintBucket → Live Paint Bucket Options (dialog `livePaintBucketOptions`, fields paintFills (on) and paintStrokes (off), cursorSwatchPreview (on: the active fill or stroke shows above the pointer between the color swatches before and after it; Left and Right without Line truncated
),
(
"ui.colorGuideOptions",
+2 -1
View File
@@ -460,7 +460,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 Flare tool: its options, which draw the next flare (OK draws none).
// 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)),
// A double click on the Print Tiling tool puts the pages back where the placement puts them.
"printTiling" => app.run("print.tiling.set", json!({ "reset": true })),
+18
View File
@@ -10478,6 +10478,24 @@ A canvas-click dialog also has `preview` (initially on): tentative settings draw
{"name":"run_command","arguments":{"command":"tool.setOption","params":{"tool":"flare","values":{"rays":24,"ringsOn":false}}}}
```
A flare keeps the settings it was drawn with, and a move, scale, rotation, reflection or shear of it updates them.
With one or more flares selected, double-clicking the Flare tool opens Flare Tool Options filled from the first
selected flare, with `flares` listing the selected ones. OK runs `shape.editFlare` with the settings changed in the
dialog and leaves the tool's own options as they were. `shape.editFlare {ids?, cx?, cy?, x2?, y2?, diameter?, ...}`
draws each flare again in its place from its settings, changing only the ones given (the center, the end point,
the path length and the direction where the flare is drawn now, the other settings as in `shape.flare`), as one undo step, and adds no step when nothing
changes. With a flare selected, the Flare tool draws its center and end point as handles joined by a dashed line;
dragging the center moves it while the end point stays, and dragging the end point moves the end point; either drag
changes the flare's length and direction as one undo step, and Esc cancels the drag. A flare whose parts were edited
is no longer edited as a flare (error `select a flare`), and a locked or hidden flare is not edited either. Object › Expand turns
a flare into a plain group of its parts. The document saves a flare's settings. Sources:
[Draw and edit flares](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-and-edit-flares.html),
[the CS3 help, page 67](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=67).
```json
{"name":"run_command","arguments":{"command":"shape.editFlare","params":{"diameter":100,"rings":6}}}
```
The Shape Builder tool's options are its Shape Builder Tool Options (dialog `shapeBuilderOptions`):
`openFilledAsClosed` (on: a filled open path bounds a region as if an invisible edge closed it; a path counts as
filled when any of its fill rows is shown, painted and above 0% opacity, whichever row is on top; off: it cuts regions
+2
View File
@@ -14,6 +14,8 @@
Numeric fields step on wheel hover without taking keyboard focus (#5949). Arrow keys still require focus; modifiers, units, limits, mixed values and existing rounding stay in the shared stepping path. Headless regressions in `tests/numfields.rs` cover hovered unfocused fields, focused fields, trackpad accumulation and panel scroll exclusion. Scores and estimates unchanged.
A flare keeps its settings through transforms and saves. With a flare selected, double-clicking the Flare tool opens Flare Tool Options filled from it, and OK draws it again in its place as one undo step (`shape.editFlare`; none when nothing changed); the Flare tool shows the selected flare's center and end handles, and dragging either changes its length or direction; Object › Expand turns it into plain objects ([Draw and edit flares](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-and-edit-flares.html)). Regressions: `edit_flare_draws_a_transformed_flare_again_in_its_place_in_one_undo_step`, `dragging_a_selected_flares_handles_changes_its_length_and_direction` and `with_a_flare_selected_the_options_show_its_settings_and_ok_draws_it_again`. Scores and estimates unchanged.
| 2026-11-06 | minor | Opening a file that takes longer than 0.4 s shows a progress window: the file name, a moving bar (reading reports no steps), how many more files wait, Cancel (Esc; the file doesn't open) and Continue in Background (`file.cancelOpen`, `file.openInBackground`); it never opens over another dialog or progress window (part of #5930); scores and estimates unchanged |
Raster rendering fits and preflattens curved stroke outlines more tightly only below four times the raster tolerance, retaining thin-band coverage without changing stroke weight or vector export geometry. Current cached character/object outlines, cropped long strokes, gradient clips and effect rasters share the helper; cropped-region reuse and guarded flattening remain. The unchanged `fractional_curved_strokes_retain_coverage_between_notches` regression covers fractional weights, rotation, phase, opacity and f32-rounded endpoints. This is a quality/cost tradeoff, not a speed claim. Scores and estimates unchanged.