Gradient tool: a vector drawn on the art snaps as other drawn points do

A gradient vector drawn on the art, a click that applies one, and the
dragged start and end handles snapped through snap_draw, which gathers
the bounds and anchors of the art only. Path segments, View › Snap to
Glyph's guides and the construction guides through the vector's start
did not pull them, and a click applied the gradient from the pointer
rather than from the snapped point. They now snap through DrawSnap, as
the Pen and Line Segment tools do:

- The press gathers the targets, for a vector drawn on the art and the
  start and end handles only, and the drag keeps them. A click applies
  the gradient from the snapped press.
- A dragged end or handle leaves its start as a Line Segment's end does:
  it lands on the construction guides through the start, and with Shift
  it keeps to 45° steps from the Constrain Angle and snaps along them.
- The pointer hovering where a press would draw a vector (anywhere with
  art selected, over art with nothing selected), and not over the
  annotator, shows the guides of the point the vector would start on.

A press that snaps onto a nearby target no longer starts the drag
early: the 3 px drag threshold counts from where the pointer was
pressed, not from the snapped start.
This commit is contained in:
dotCooCoo committed 2026-11-13 22:25:34 -08:00
1 parent c11ee11c1c
commit 58bc03a3e7
4 files changed
+180 -33

No files matched your search

+118
View File
@@ -953,6 +953,124 @@ fn a_drawn_point_lands_on_a_corner_of_a_glyphs_bounds() {
}
}
/// Snap to Glyph: both ends of a gradient vector drawn on the art with the Gradient tool, a click
/// that applies one, and its dragged start and end handles, land on a glyph's anchor point as a
/// Pen click does, with the guides shown while hovering, and not with Snap to Glyph off. A drawn
/// end also lands on a slanted path's segment, which no bounds line passes along, and on a
/// construction guide through its start, and with Shift on an anchor along its 45° step. With nothing
/// selected, hovering off the art shows no guides. A press that snaps still starts a drag only
/// after the pointer moves 3 px from where it was pressed.
#[test]
fn gradient_vector_ends_land_on_a_glyph_anchor() {
use crate::xform::GradientTool;
use crate::{Action, PointerEvent, PointerKind, Tool};
use vectorcraft_color::{Gradient, GradientGeom, GradientPaint, Paint};
use vectorcraft_doc::Appearance;
use vectorcraft_geom::shapes;
let (mut d, t) = glyph_doc("H", 0.0);
let lay = layout_text(FontDb::global(), &t);
let g = lay.glyphs.iter().find(|g| !g.outline.elements().is_empty()).expect("a glyph with an outline");
// An anchor inside the glyph's bounds, which no glyph bounds line passes through.
let bb = g.outline.bounding_box();
let inside = |p: Point| p.x > bb.x0 + 1.0 && p.x < bb.x1 - 1.0 && p.y > bb.y0 + 1.0 && p.y < bb.y1 - 1.0;
let anchor = t.xf * g.outline.segments().map(|s| s.start()).find(|p| inside(*p)).expect("an anchor inside the glyph");
let type_id = d.children(Some(d.layers[0].id)).unwrap()[0].id;
// A rectangle away from the type, with a gradient from (300, 100) to (400, 100).
let (l, rect) = (d.layers[0].id, d.alloc_id());
d.insert(Some(l), 0, Node::path(rect, shapes::rectangle(Rect::new(300.0, 50.0, 400.0, 150.0)), Appearance::default_art())).unwrap();
let mut gp = GradientPaint::new(Gradient::default());
gp.geom = Some(GradientGeom { start: Point::new(300.0, 100.0), end: Point::new(400.0, 100.0), aspect: 1.0, focal: None });
d.node_mut(rect).unwrap().appearance.set_fill(Paint::Gradient(Box::new(gp)));
// A slanted line, its middle far from its bounds' edges.
let (a0, a1) = (Point::new(200.0, 420.0), Point::new(280.0, 480.0));
let line = d.alloc_id();
d.insert(Some(l), 0, Node::path(line, shapes::line(a0, a1), Appearance::default_art())).unwrap();
let mut on_type = Selection::default();
on_type.add(type_id);
let mut on_rect = Selection::default();
on_rect.add(rect);
let p = paint();
let click = anchor + Vec2::new(1.5, -1.0);
let away = anchor + Vec2::new(-83.3, -61.7);
let ev = |kind, q: Point| PointerEvent::new(kind, q.x, q.y);
let preview = |acts: &[Action]| {
acts.iter().find_map(|a| if let Action::Preview(_, v) = a { Some(v.clone()) } else { None }).unwrap_or_else(|| panic!("{acts:?}"))
};
let at = |v: &serde_json::Value| Point::new(v[0].as_f64().unwrap(), v[1].as_f64().unwrap());
for glyphs in [true, false] {
let c = ToolContext { snap_to_glyph: glyphs, ..cx(&d, &on_type, &p) };
let lands = |q: Point| q.distance(anchor) < 1e-9;
// The pointer hovering at the click shows the guides of the anchor a vector would start on.
let mut tool = GradientTool::default();
tool.pointer(&c, &ev(PointerKind::Move, click));
assert_eq!(!tool.overlays(&c).is_empty(), glyphs, "hover, Snap to Glyph {glyphs}");
// A vector drawn from the click starts on the anchor.
tool.pointer(&c, &ev(PointerKind::Down, click));
let v = preview(&tool.pointer(&c, &ev(PointerKind::Drag, click + Vec2::new(80.0, 60.0))));
assert_eq!(lands(at(&v["start"])), glyphs, "start, Snap to Glyph {glyphs}: {v}");
tool.pointer(&c, &ev(PointerKind::Up, click + Vec2::new(80.0, 60.0)));
// One drawn to beside the slanted line, a quarter of the way along (15 pt or more from its
// bounds' edges, centre and anchors), ends on the line.
let dir = (a1 - a0) / (a1 - a0).hypot();
let quarter = a0 + (a1 - a0) * 0.25;
tool.pointer(&c, &ev(PointerKind::Down, away));
let v = preview(&tool.pointer(&c, &ev(PointerKind::Drag, quarter + Vec2::new(-dir.y, dir.x) * 2.0)));
assert!((at(&v["end"]) - a0).cross(dir).abs() < 1e-6, "end on the line: {v}");
tool.pointer(&c, &ev(PointerKind::Up, quarter));
// One drawn to the click ends on it.
tool.pointer(&c, &ev(PointerKind::Down, away));
let v = preview(&tool.pointer(&c, &ev(PointerKind::Drag, click)));
assert_eq!(lands(at(&v["end"])), glyphs, "end, Snap to Glyph {glyphs}: {v}");
tool.pointer(&c, &ev(PointerKind::Up, click));
// A click at the click applies a gradient that starts on the anchor.
tool.pointer(&c, &ev(PointerKind::Down, click));
let acts = tool.pointer(&c, &ev(PointerKind::Up, click));
let v = acts.iter().find_map(|a| if let Action::Exec(_, v) = a { Some(v.clone()) } else { None }).unwrap_or_else(|| panic!("{acts:?}"));
assert_eq!(lands(at(&v["start"])), glyphs, "click, Snap to Glyph {glyphs}: {v}");
// One drawn to 2 px below the horizontal through its start, far from any target, ends on
// that construction guide, as a Line Segment's end does.
tool.pointer(&c, &ev(PointerKind::Down, away));
let v = preview(&tool.pointer(&c, &ev(PointerKind::Drag, away + Vec2::new(150.0, 2.0))));
assert!((at(&v["end"]).y - away.y).abs() < 1e-9, "end on the construction guide: {v}");
tool.pointer(&c, &ev(PointerKind::Up, away + Vec2::new(150.0, 2.0)));
// With Shift, one drawn at 45° toward the line's first anchor slides along that step onto it.
let shift = |kind, q: Point| PointerEvent { mods: crate::Mods { shift: true, ..Default::default() }, ..ev(kind, q) };
tool.pointer(&c, &shift(PointerKind::Down, a0 + Vec2::new(60.0, -60.0)));
let v = preview(&tool.pointer(&c, &shift(PointerKind::Drag, a0 + Vec2::new(-1.5, 0.5))));
assert!(at(&v["end"]).distance(a0) < 1e-9, "Shift end on the anchor: {v}");
tool.pointer(&c, &shift(PointerKind::Up, a0));
// A press 3 px from the anchor, then a move of 2 px away from it: no drag yet.
let near = anchor + Vec2::new(2.5, -1.5);
tool.pointer(&c, &ev(PointerKind::Down, near));
let acts = tool.pointer(&c, &ev(PointerKind::Drag, near + Vec2::new(1.5, -1.0)));
assert!(acts.is_empty(), "drag start, Snap to Glyph {glyphs}: {acts:?}");
tool.pointer(&c, &ev(PointerKind::Up, near + Vec2::new(1.5, -1.0)));
// The end handle of the rectangle's gradient dragged to the click lands on the anchor.
let c = ToolContext { snap_to_glyph: glyphs, ..cx(&d, &on_rect, &p) };
let mut tool = GradientTool::default();
// Hovering over the handle (on the rectangle's edge) shows no guides.
tool.pointer(&c, &ev(PointerKind::Move, Point::new(400.0, 100.0)));
assert!(!tool.overlays(&c).iter().any(|o| matches!(o, Overlay::Label { .. })), "hover over the handle");
tool.pointer(&c, &ev(PointerKind::Down, Point::new(400.0, 100.0)));
let v = preview(&tool.pointer(&c, &ev(PointerKind::Drag, click)));
assert_eq!(lands(at(&v["end"])), glyphs, "end handle, Snap to Glyph {glyphs}: {v}");
tool.pointer(&c, &ev(PointerKind::Up, click));
// The start handle dragged to the click lands on the anchor.
tool.pointer(&c, &ev(PointerKind::Down, Point::new(300.0, 100.0)));
let v = preview(&tool.pointer(&c, &ev(PointerKind::Drag, click)));
assert_eq!(lands(at(&v["start"])), glyphs, "start handle, Snap to Glyph {glyphs}: {v}");
tool.pointer(&c, &ev(PointerKind::Up, click));
// With nothing selected, hovering beside the rectangle (off the art and its 1 pt stroke,
// where a press draws nothing, but within the snapping tolerance of its edge) shows no
// guides.
let none = Selection::default();
let c = ToolContext { snap_to_glyph: glyphs, ..cx(&d, &none, &p) };
let mut tool = GradientTool::default();
tool.pointer(&c, &ev(PointerKind::Move, Point::new(296.2, 75.0)));
assert!(tool.overlays(&c).is_empty(), "hover off the art: {:?}", tool.overlays(&c));
}
}
/// With Smart Guides off, View → Snap to Point still pulls a drawn point onto an anchor, but
/// draws no Smart Guides: no "anchor" label, no lines.
#[test]
+58 -31
View File
@@ -7,8 +7,10 @@
//!
//! The annotator is a bar from a round start handle to a square end handle. Drag the start handle
//! (or the bar) to move the gradient, the end handle to change its length and angle, and just past
//! the end to rotate it. Dragged handles snap to anchors, edges and smart guides; Shift instead
//! constrains the vector to 45° steps from the Constrain Angle preference. Colour stops sit under the bar: click the bar to add
//! the end to rotate it. A vector drawn on the art, a click that applies one, and the dragged
//! handles snap as drawn points do (the anchors and paths of the art, and with Snap to Glyph the
//! guides of live type); Shift keeps the dragged end or handle at 45° steps from the Constrain Angle
//! preference, snapping along that step. Colour stops sit under the bar: click the bar to add
//! one, drag one to move it (Alt drags a copy), drag it off the bar to delete it, and drag a
//! diamond above the bar to move a midpoint. Double-clicking a stop opens its popover. The
//! selected stop (`gradient.selectStop`) is shared with the Gradient and Color panels: Delete or
@@ -43,7 +45,7 @@ use vectorcraft_geom::{Affine, Point, Shape, Vec2, constrain_angle_from};
use super::freeform::{self, Annotator as FreeformAnnotator};
use super::paint_owner;
use crate::guides::snap_draw;
use crate::guides::{DrawSnap, Leave};
use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, ToolContext, ToolKey};
const BAR: [u8; 3] = [0x20, 0x20, 0x20];
@@ -239,6 +241,8 @@ struct Gesture {
grab: Grab,
/// Where the press happened.
at: Point,
/// Where a vector drawn on the art starts: the press, snapped.
start: Point,
/// Moved past the drag threshold (an interaction is open).
began: bool,
/// The vector drawn so far (Art drags).
@@ -255,8 +259,9 @@ pub struct GradientTool {
free: Option<freeform::Gesture>,
/// The line Lines mode is drawing on a freeform gradient.
lines: freeform::Lines,
/// Smart-guide feedback of the handle being dragged.
guides: Vec<Overlay>,
/// Smart Guides for the vector being drawn or the handle being dragged, and for the pointer
/// hovering over the art.
snap: DrawSnap,
}
/// Overlays of an annotator: the bar, the handles, the midpoint diamonds and a chip per stop; a
@@ -378,18 +383,40 @@ impl GradientTool {
Some((a, Part::Aspect)) => Grab::Aspect(GradientGeom { aspect: a.geom.aspect.abs(), ..a.geom }),
None => {
if cx.selection.is_empty() {
let Some(h) = hit_test(cx.doc, p, cx.hit_options()) else { return out };
let Some(h) = hit_test(cx.doc, p, cx.hit_options()) else {
self.snap.clear();
return out;
};
out.push(Action::Exec("select.set".into(), json!({ "ids": [paint_owner(cx.doc, h.leaf).0] })));
}
Grab::Art
}
};
// A vector drawn on the art starts on the snapped point.
let at = if grab == Grab::Art { snap_draw(cx, p, &[]).0 } else { p };
self.gesture = Some(Gesture { grab, at, began: false, vector: None, stop: None });
// The targets are gathered for a drag that snaps. A vector drawn on the art starts on the
// snapped point; the drag threshold still counts from the press.
let snaps = matches!(grab, Grab::Art | Grab::Move { .. } | Grab::End(_));
let snapped = if snaps { self.snap.press(cx, p, &[], None) } else { p };
let start = if grab == Grab::Art { snapped } else { p };
if grab != Grab::Art {
self.snap.clear();
}
self.gesture = Some(Gesture { grab, at: p, start, began: false, vector: None, stop: None });
out
}
/// Snap the pointer hovering where a press would draw a vector (anywhere with art selected,
/// over art with nothing selected), to show where the vector starts; no guides over the
/// annotator, elsewhere with nothing selected, or during a press.
fn hover(&mut self, cx: &ToolContext, p: Point) {
let on_annotator = || Annotator::of(cx).is_some_and(|a| a.hit(cx, p).is_some());
let off_art = || cx.selection.is_empty() && hit_test(cx.doc, p, cx.hit_options()).is_none();
if self.gesture.is_some() || self.free.is_some() || FreeformAnnotator::of(cx).is_some() || on_annotator() || off_art() {
self.snap.clear();
} else {
self.snap.hover(cx, p, &[], None);
}
}
fn drag(&mut self, cx: &ToolContext, p: Point, mods: Mods) -> Vec<Action> {
let Some(g) = &mut self.gesture else { return vec![] };
let mut out = vec![];
@@ -401,23 +428,16 @@ impl GradientTool {
out.push(Action::Begin("Gradient".into()));
}
let constrain = |v: Vec2| constrain_angle_from(v, 45.0, cx.constrain_angle);
// Where a handle dragged to `to` lands: Shift constrains the vector from `from`, else it
// snaps (keeping the guides to show).
let mut guides = vec![];
let mut place = |from: Point, to: Point| {
if mods.shift {
from + constrain(to - from)
} else {
let (q, o) = snap_draw(cx, to, &[]);
guides = o;
q
}
};
// Where a handle dragged to `to` lands: it snaps as a drawn segment's end leaving `from`
// does, Shift keeping it at 45° steps from `from` (keeping the guides to show).
let snap = &mut self.snap;
snap.clear();
let mut place = |from: Point, to: Point| snap.drag(cx, to, Some(&Leave::segment(cx, from, mods.shift)));
let (cmd, params) = match &g.grab {
Grab::Art => {
let end = place(g.at, p);
g.vector = Some((g.at, end));
("paint.setGradientGeom", Self::geom_params(cx, g.at, end))
let end = place(g.start, p);
g.vector = Some((g.start, end));
("paint.setGradientGeom", Self::geom_params(cx, g.start, end))
}
Grab::Move { geom, .. } => {
// The start handle snaps; Shift constrains the move.
@@ -469,13 +489,12 @@ impl GradientTool {
("paint.editGradient", Self::stops_params(cx, &set_midpoint(stops, *index, m)))
}
};
self.guides = guides;
out.push(Action::Preview(cmd.into(), params));
out
}
fn release(&mut self, cx: &ToolContext, p: Point) -> Vec<Action> {
self.guides.clear();
self.snap.clear();
let Some(g) = self.gesture.take() else { return vec![] };
if g.began {
let mut out = vec![Action::Commit];
@@ -494,12 +513,12 @@ impl GradientTool {
let (stops, i) = insert_stop(&a.gradient, t);
vec![Action::Exec("paint.editGradient".into(), Self::stops_params(cx, &stops)), Self::select_stop(i)]
}
// A click inside selected art applies the gradient from that point.
// A click inside selected art applies the gradient from that point, snapped.
Grab::Art => {
let Some(h) = hit_test(cx.doc, p, cx.hit_options()) else { return vec![] };
let id = paint_owner(cx.doc, h.leaf);
let Some(v) = cx.selection.objects.contains(&id).then(|| click_vector(cx, id)).flatten() else { return vec![] };
let mut params = Self::geom_params(cx, p, p + v);
let mut params = Self::geom_params(cx, g.start, g.start + v);
// Without `ids`, the engine refuses the gradient while an object of a dynamic symbol
// instance's art is selected.
if cx.selection.symbol_part.is_some() {
@@ -550,6 +569,9 @@ impl Tool for GradientTool {
}
_ => {}
}
if matches!(ev.kind, PointerKind::Move) {
self.hover(cx, ev.pos);
}
match ev.kind {
PointerKind::Down => self.press(cx, ev.pos, ev.mods),
PointerKind::Drag => self.drag(cx, ev.pos, ev.mods),
@@ -579,14 +601,19 @@ impl Tool for GradientTool {
return self.key(cx, ToolKey::Escape, Mods::default());
}
(self.gesture, self.free) = (None, None);
self.guides.clear();
self.snap.clear();
vec![]
}
fn deactivate(&mut self, _cx: &ToolContext) -> Vec<Action> {
self.snap.clear();
vec![]
}
fn key(&mut self, cx: &ToolContext, key: ToolKey, mods: Mods) -> Vec<Action> {
if key == ToolKey::Escape && self.busy() {
self.gesture = None;
self.guides.clear();
self.snap.clear();
return self.free.take().map_or_else(|| vec![Action::Cancel], |g| freeform::cancel(&g));
}
if self.busy() || !self.claims_key(cx, key) {
@@ -626,7 +653,7 @@ impl Tool for GradientTool {
}
_ => vec![],
};
o.extend(self.guides.iter().cloned());
o.extend(self.snap.guides().iter().cloned());
o
}
+3 -1
View File
@@ -1299,7 +1299,9 @@ Drive a tool like a mouse:
Edit a gradient with the Gradient tool's annotator (the bar runs along the vector; stop chips sit 10 px under
it, midpoint diamonds 7 px above): a click on the bar adds a stop, dragging a chip moves it (drag it off the bar to
delete it, hold Alt to copy it), dragging the end handle changes the vector. The selected stop
delete it, hold Alt to copy it), dragging the end handle changes the vector. Both ends of a vector drawn on the art,
the start of one a click applies, and the dragged start and end handles snap as drawn points do; with Shift, the end
or the handle keeps to 45° steps and snaps along them. The selected stop
(`gradient.selectStop`) takes Delete and ←/→:
```json
+1 -1
View File
@@ -1506,7 +1506,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Swatches made from a shown color in a CMYK document:** the Color panel menu's Create New Swatch, an Alt-click on the Swatches panel's New Swatch button, the New Swatch dialog for a gradient, a Fill or Stroke proxy or the Gradient panel's thumbnail dropped on the Swatches panel (or Alt-dropped on a swatch of its kind), and the Gradient panel's Add to Swatches and Save to Swatches keep each color's model, as the Color Guide's and Color Themes' saved colors do: an RGB object's color gives an RGB swatch, and a gradient's RGB stops stay RGB.
- **Sample Color from Screen:** an eyedropper button in the Color Picker and `ui.sampleScreenColor` (which can be given a key in Keyboard Shortcuts) pick a color anywhere on the screen with the system's sampler: `NSColorSampler` on macOS, the XDG desktop portal's [PickColor](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Screenshot.html) on Linux, and the EyeDropper API in browsers that have it. The color becomes the fill or the stroke as one undo step, or the Color Picker's color, converted from display sRGB into the working RGB space. On Linux, a session without a portal that has PickColor, a portal that does not return from the call within 25 seconds (VectorCraft's own limit) or leaves the bus before it answers, and a portal that ends the request another way each show a status message and end the wait. Windows, the BSDs and other browsers have no sampler yet; the button is gray there.
- **Stroke visibility (#1253):** adding paint to a previously unpainted zero-width stroke restores the existing 1 pt default (`PaintDefaults::default`, `Appearance::set_stroke`), for the selected appearance item, the new-art defaults and Swap Fill/Stroke. Positive widths are kept; recoloring a painted zero-width stroke keeps its explicit zero. A real Eyedropper-to-new-shape sequence reproduces the zero-width inheritance. Five engine regressions cover creation, defaults, targeted items, preserved widths and one-step Undo/Redo (`crates/engine/tests/it/stroke_visibility.rs`).
- **Gradients:** lossless, validated gradient params; gradients follow rotate, reflect, shear, non-uniform scale and distortions; the Gradient tool edits the fill or stroke of the active proxy, type included; an interactive on-canvas annotator (move, length/angle, rotate, add/move/delete/duplicate stops, midpoints, a stop popover, Delete and arrow keys). The Gradient panel has the Fill/Stroke proxy, a gradient-swatch dropdown with Save to Swatches, midpoint locations, Alt-drag to copy or swap stops, swatch drops on the ramp and a stop eyedropper; copied appearances and graphic styles place gradients on each target's own bounds; gradient handles snap and honour Constrain Angle. Gradient stops stay linked to global and spot swatches. Freeform gradients (points and lines) are edited on the canvas; radial gradients have an extent ellipse, an aspect handle and an off-centre focal point (SVG `fx`/`fy`, PDF two-point radials). A stroke's gradient runs within, along or across it. Object ▸ Expand turns gradients into N objects or a gradient mesh.
- **Gradients:** lossless, validated gradient params; gradients follow rotate, reflect, shear, non-uniform scale and distortions; the Gradient tool edits the fill or stroke of the active proxy, type included; an interactive on-canvas annotator (move, length/angle, rotate, add/move/delete/duplicate stops, midpoints, a stop popover, Delete and arrow keys). The Gradient panel has the Fill/Stroke proxy, a gradient-swatch dropdown with Save to Swatches, midpoint locations, Alt-drag to copy or swap stops, swatch drops on the ramp and a stop eyedropper; copied appearances and graphic styles place gradients on each target's own bounds; gradient handles, both ends of a vector drawn on the art and the start of a clicked one snap as other drawn points do (path segments, construction guides and View › Snap to Glyph's guides included) and honour Constrain Angle. Gradient stops stay linked to global and spot swatches. Freeform gradients (points and lines) are edited on the canvas; radial gradients have an extent ellipse, an aspect handle and an off-centre focal point (SVG `fx`/`fy`, PDF two-point radials). A stroke's gradient runs within, along or across it. Object ▸ Expand turns gradients into N objects or a gradient mesh.
- The Gradient panel's Delete Stop sits at the right end of the ramp, level with it, so a panel too short to show the stop fields still shows it; it deletes the selected stop (never below two), as dragging a stop down off the ramp does (#5403).
- Conic gradients, VectorCraft's own gradient type: the stops sweep once around the center from the vector, clockwise on the page (a negative aspect, or a reflection, turns the sweep the other way), with a Conic button in the Gradient panel's Type row and the Gradient tool's extent ellipse and aspect handle; they follow transforms, Expand into wedges or a mesh, open from `.af` files, and export to PDF as a function-based shading that PDF import reads back as a conic gradient; SVG, EPS and legacy `.ai` files get solid wedges, and CSS a `conic-gradient`.
- Diamond gradients, VectorCraft's own gradient type: the stops run from the center out to a square with a corner at the end of the vector (the aspect stretches it into a rhombus), with a Diamond button in the Gradient panel's Type row and the Gradient tool's square and aspect handle; they follow transforms, Expand into nested squares or a mesh, and export to PDF, SVG, EPS and legacy `.ai` as four linear gradients, one for each quarter of the square (an image in PDF and SVG for translucent stops, a dithered fill, the Perceptual method other than spot color shadings in PDF, or a square with no area), and on type characters in SVG as a radial gradient; PDF import reads a function-based shading whose color is the same along each square about its origin as a diamond gradient.