mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-25 20:01:07 +01:00
The new General preference Delete Removes Anchor Points and Keeps Paths Joined (`deleteKeepsPathsJoined`, off by default) is the default of a new `keepJoined` param of edit.clear (Delete, Backspace, Edit › Clear, and the Layers panel's Delete button while no row is highlighted). With it on, Delete removes the direct-selected anchors of each path as Remove Anchor Points does, refitting the curve around each one, so a closed path stays closed and an open path stays in one piece. The next anchor along is selected (the one before at an open path's end), so the next Delete goes on along the path. - Objects selected whole are deleted and paths with a selected segment are cut there, as before, in the same undo step. A path left with fewer than two anchors is deleted; a compound path keeps its other members. When no changed subpath keeps two anchors, the path stays selected whole, as Remove Anchor Points leaves it. - The value used joins the journal entry, so a replay removes the anchors the same way whatever the preference is at the time; a saved step without it opens the paths as it did when it was recorded. A keepJoined value that is not a boolean is an error, also with ids, where the param has no other effect. path.deleteAnchors and Cut are unchanged. - The Smart Pen does not take the Delete key, so Delete follows the preference with it chosen too. - The label and its description have a row in every catalog. Without keepJoined and with the preference off, edit.clear gives the same result as before. Part of #8326 Docs: docs/mcp.md, docs/target-app-parity.md.
39 lines
1.4 KiB
Rust
39 lines
1.4 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 quickpen;
|
|
mod smooth;
|
|
|
|
pub(super) use anchors::{following_anchors, remove_anchors_of};
|
|
pub use commands::specs;
|
|
pub(super) use common::{center_strokes, ids_json, replace_with_pieces, usize_opt};
|
|
pub(super) use cut::{components, erase_outline};
|
|
pub(super) use freehand::freehand_brushed;
|