Files
vectorcraft/crates/engine/src/cmd/draw2.rs
T
dotCooCoo ba9acf808e Brushes: brush.freehand is one undo step and refuses strokeless paths and unknown keys
brush.freehand drew the path with one edit and set the brush with a
second, so one Undo left the path without its brush. The brush is now
set in the same edit that draws, continues or redraws the path, and the
step is named Paintbrush whatever the style.

A brush for a path with no stroke (a continued or redrawn path without
one, or a new filled "pencil" path while the stroke is None) was skipped
and the call still succeeded. It is now refused with "cannot apply brush
`<name>`: path has no stroke" before anything changes. The Paintbrush
tool sends brush.freehand when a brush is current, so continuing or
redrawing such a path with it now shows this error. This rule is
VectorCraft's own.

brush.freehand is no longer in UNCHECKED: it takes the path.freehand
keys and `brush`, and any other key is refused with "unknown parameter".
2026-11-14 17:31:16 -08:00

37 lines
1.3 KiB
Rust

//! Commands backing the drawing tools (pencil, curvature, anchor tools, scissors, knife, eraser,
//! blob brush, smooth, path eraser, join).
use std::collections::BTreeSet;
use std::sync::Arc;
use kurbo::{CubicBez, ParamCurve, ParamCurveNearest};
use serde_json::{Value, json};
use vectorcraft_color::{Color, Paint};
use vectorcraft_doc::{AngleProfile, Appearance, Document, Node, NodeId, NodeKind, PressureProfile, Selection};
use vectorcraft_geom::hit::fill_contains;
use vectorcraft_geom::{Anchor, AnchorKind, BezPath, FillRule, PathData, Point, Rect, SubPath, Vec2};
use vectorcraft_pathops as po;
use vectorcraft_pathops::{BoolOp, Cap, Join, SimplifyOptions};
use vectorcraft_tools::draw2::{eraser_area, eraser_tip};
use super::create::{add_look, insert_look};
use super::newart::NewArt;
use super::pathops::{Beside, remove_each};
use super::{
CommandSpec, Result, Session, bad, check_numbers, cmd, f64_or, has_anchors, has_doc, has_selection, index, number_or, object_param, ok,
str_param, switch_or,
};
use crate::EngineError;
mod anchors;
mod commands;
mod common;
mod cut;
mod freehand;
mod smooth;
pub use commands::specs;
pub(super) use common::{ids_json, replace_with_pieces, usize_opt};
pub(super) use cut::{components, erase_outline};
pub(super) use freehand::freehand_brushed;