VectorCraft: An open-source, vector art tool written by scratch in pure Rust
Graph Type: Edge-to-Edge Lines start off, as the reference app's do
bflatastic471c47f96a36
diff --git a/ROADMAP.md b/ROADMAP.mdindex ba50a762d..fe0ba1a7f 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -138,7 +138,7 @@ grade by behaviour against `plan/illustrator/`, not by whether a menu item exist- **Live Corners:** drag a live rectangle's corner widgets (Selection or Direct Selection) to round all corners, with a radius readout; with Direct Selection, select corner anchors to show and round just those corners (#381). Each corner keeps its own radius and kind (Round, Inverted Round, Chamfer): Alt-click a widget to cycle the kind, double-click it for the Corners dialog, and the Properties and Transform radius fields set the selected corners (`object.setLiveShape {corners, radius, kind}`). Corners stay circular when the rectangle is scaled unevenly or along its own sides when rotated (the radius keeps its size, or scales by the mean scale with Scale Corners on); only a shear distorts them. On a rectangle that isn't square every corner is the same circle: a radius past half the shorter side stops there for all of them, the widgets sit on the corners as drawn and turn the edited corners red at that limit, CSS export writes the drawn radii, and rectangles saved stretched by older versions get circular corners when their corners are next set (#442). Live Corners work on any path's corners too, as on a rectangle's (#511): a star's, a live polygon's (which also shows them to the Selection tool, has a Corner Radius field in the Properties and Transform panels and keeps its radius as its sides change) and a pen path's, wherever two straight sides meet at an anchor. Direct Selection shows the widgets of every corner, or of the corners holding selected anchors; each corner is a circle tangent to both sides, drawn no larger than takes its cut halfway along its shorter side; a path keeps its uncut outline so its corners stay editable, and the same command, dialog, angle preference and View › Hide Corner Widget apply.- **Pen:** Alt pressed in the middle of dragging out an anchor splits its handles and keeps the curve already shaped into it (only the outgoing handle follows the pointer); Space held while dragging out an anchor moves it, handles and all. A press on the first anchor of the path being drawn closes it whatever the drag then does: the drag shapes the closing curve (symmetric handles, Alt breaks them) and the release closes the path wherever it ends (#501). Clicking the last anchor of the path being drawn retracts its outgoing handle (convert cursor), and dragging from it pulls out a new one on its own. Auto Add/Delete: over a selected path, a click on a segment adds an anchor and a click on an anchor deletes it (add and delete cursors); Shift held, or Preferences › General › Disable Auto Add/Delete, starts a new path instead. Alt held over a handle end or an anchor of a selected path (the one being drawn too) works as the Anchor Point tool, with its convert cursor: dragging a handle moves it alone, clicking a smooth anchor makes it a corner, dragging an anchor pulls out new symmetric handles, dragging a segment reshapes it; drawing then goes on. Cmd (Ctrl) held drags with the selection tool chosen last, Direct Selection until one is (handles, anchors and segments of the path being drawn or another), and the Pen then goes on drawing its path while that stays selected; the pointer shows that tool's while Cmd is held. The same holds for agents (`pointer_gesture` with `mods.cmd`), as the borrowing now lives in the engine (#494).- **Path editing (#494):** the handles shown are the handles that drag: Direct Selection drags those of a path selected as a whole (as the Pen leaves it), the Anchor Point tool and Pen+Alt no longer grab handles that Show handles when multiple anchors are selected hides, a handle shorter than the tolerance leaves its anchor to be picked, and the anchor tools pick within Selection & Anchor Display › Tolerance. A dragged segment keeps a smooth anchor at either end smooth. With Direct Selection, the Pen, the Curvature and the anchor tools, a path selected as a whole shows all its anchors selected, and the Control bar and the Properties panel offer Convert (corner, smooth) for them too; Remove and Cut wait for anchors direct-selected (#504). A handle drag gathers its snap targets once per drag (it took 21 ms per pointer move on a 20,000-path document, now 1 ms; `vectorcraft-cli perf` measures handle and segment drags on a 5,000-anchor path).- - **Graphs:** Column, Stacked Column, Bar, Stacked Bar, Line, Area, Scatter, Pie and Radar graph tools with Graph Data and Graph Type. A series starts in greyscale; Group Selection's fill and stroke are kept separately on the graph and reapplied when its data, type or size changes, and through save, open and undo. Graph Type's Override Calculated Values (both `axisMin` and `axisMax`) uses exactly that value-axis range, split into the tick count (5 when automatic). Line graphs take Edge-to-Edge Lines (on by default, as before; off, the points sit at the centres of their categories), and radar graphs follow Mark Data Points and Connect Data Points. Graph Design, Column and Marker artwork remain open.+ - **Graphs:** Column, Stacked Column, Bar, Stacked Bar, Line, Area, Scatter, Pie and Radar graph tools with Graph Data and Graph Type. A series starts in greyscale; Group Selection's fill and stroke are kept separately on the graph and reapplied when its data, type or size changes, and through save, open and undo. Graph Type's Override Calculated Values (both `axisMin` and `axisMax`) uses exactly that value-axis range, split into the tick count (5 when automatic). Line graphs take Edge-to-Edge Lines (off by default: the points sit at the centres of their categories; graphs saved before the option keep their edge-to-edge lines), and radar graphs follow Mark Data Points and Connect Data Points. Graph Design, Column and Marker artwork remain open.- **Other:** Eyedropper, Gradient annotator, Artboard (Alt-drag duplicates an artboard, and its art with Move/Copy Artwork with Artboard on; Copy, Cut and Paste take the artboard with its art, Paste right of the last artboard, Paste in Place where it was, into this or another document, #446; Object › Artboards › Rearrange All Artboards lays them out in a grid by row or by column, in one row or one column, left to right or right to left, from the menu, the Artboards panel or Properties' Rearrange All, #681; Scale Artwork with Artboard, in the Control bar and Properties beside Move Artwork with Artboard, resizes the artboard proportionally with the art fully inside it and its guides, strokes and corners per the Scale preferences, #602), Measure, Type, Hand, Zoom, Rotate View.- **Editing type:** double-clicking type with a selection tool switches to the Type tool with the caret where it was clicked.- **Temporary tools:** Cmd with any other tool drags with the selection tool used last (Selection, Direct Selection or Group Selection). Held Space pans and Cmd+Space zooms (Cmd+Alt+Space out) whatever the tool.diff --git a/crates/doc/src/graph.rs b/crates/doc/src/graph.rsindex 41bfba123..f5ed31e28 100644--- a/crates/doc/src/graph.rs+++ b/crates/doc/src/graph.rs@@ -106,14 +106,21 @@ pub struct GraphSpec {/// Line, scatter and radar graphs: mark data points, connect them.pub mark_points: bool,pub connect_points: bool,- /// Line graphs: run the lines from edge to edge of the plot (on, as before the option existed); off, the points- /// sit at the centres of their categories, like the columns of a column graph.+ /// Line graphs: run the lines from edge to edge of the plot; off (the default for new graphs), the points sit+ /// at the centres of their categories, like the columns of a column graph. Graphs saved before the option+ /// existed were drawn edge to edge and keep it.+ #[serde(default = "edge_to_edge_before_the_option")]pub edge_to_edge: bool,/// Bounds of the art when it was last generated (detects moves/scales of the graph group).#[serde(skip_serializing_if = "Option::is_none")]pub placed: Option<Rect>,}+/// Edge-to-Edge Lines for a graph saved before the option existed: on, as it was drawn then.+fn edge_to_edge_before_the_option() -> bool {+ true+}+impl Default for GraphSpec {fn default() -> Self {Self {@@ -131,7 +138,7 @@ impl Default for GraphSpec {axis_max: None,mark_points: true,connect_points: true,- edge_to_edge: true,+ edge_to_edge: false,placed: None,}}diff --git a/crates/engine/src/cmd/graph.rs b/crates/engine/src/cmd/graph.rsindex 7cf24cbc3..ad770fa96 100644--- a/crates/engine/src/cmd/graph.rs+++ b/crates/engine/src/cmd/graph.rs@@ -842,12 +842,12 @@ mod tests {fn edge_to_edge_lines_off_puts_line_points_at_category_centres() {let mut s = Session::new();s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap();- // 300 pt wide, three categories: edges at 100 and 400; centres at 150, 250, 350.+ // 300 pt wide, three categories: centres at 150, 250, 350 (off by default); edges at 100 and 400.let id = graph(&mut s, "line");- assert_eq!(marker_xs(&s, id, 0), vec![100.0, 250.0, 400.0]);- assert_eq!(s.execute("graph.setType", &json!({})).unwrap()["edgeToEdge"], json!(true));- s.execute("graph.setType", &json!({"edgeToEdge": false})).unwrap();assert_eq!(marker_xs(&s, id, 0), vec![150.0, 250.0, 350.0]);+ assert_eq!(s.execute("graph.setType", &json!({})).unwrap()["edgeToEdge"], json!(false));+ s.execute("graph.setType", &json!({"edgeToEdge": true})).unwrap();+ assert_eq!(marker_xs(&s, id, 0), vec![100.0, 250.0, 400.0]);// A graph saved before the option existed keeps its edge-to-edge lines.let old: GraphSpec = serde_json::from_value(json!({"kind": "line"})).unwrap();assert!(old.edge_to_edge);