mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-07 19:12:46 +00:00
A built-in add-on in Object › Plug-ins › Arrange Tools (#4830, #4831, #4832, #4833, #4834): - addon.arrange.grid lays the top-level selected objects out in rows and columns, a row or a column (stacking order from the back, visual bounds, each object centred in its cell), from the selection's top-left or centred on the artboard. - addon.arrange.swap swaps two objects' bounds centres, and with `size` their widths and heights. - addon.arrange.replace puts a copy of the topmost selected object centred on each of the others, in its stacking place, kept, stretched or fitted in proportion; the replaced objects are deleted unless `keep`. - addon.arrange.size gives each selected object an exact width and/or height about a reference point. - addon.arrange.zoomSelection (a UI command) fits the active view to the selection. Places and sizes are measured as object.setBounds measures them (its transform, now also available per object), strokes scale as Scale Strokes & Effects says, each command is one undo step, and Arrange in Grid, Replace with Top Object and Set Size of Each open previewed dialogs. Catalog rows, command sweep cases, docs/mcp.md, parity docs and the ROADMAP progress log.
40 lines
1.5 KiB
Rust
40 lines
1.5 KiB
Rust
//! Object menu: transforms, arrange, group, lock/hide, compound paths, clipping masks, isolation,
|
|
//! align & distribute, object properties.
|
|
|
|
use std::collections::BTreeSet;
|
|
use std::sync::Arc;
|
|
|
|
use serde_json::{Value, json};
|
|
use vectorcraft_color::{BlendMode, Paint};
|
|
use vectorcraft_doc::corners::{convert_radii_relative, set_corners};
|
|
use vectorcraft_doc::{Appearance, Document, Knockout, LiveCorners, LiveShape, Node, NodeId, NodeKind, OrientedBox, Scaling};
|
|
use vectorcraft_geom::shapes::CornerKind;
|
|
use vectorcraft_geom::{Affine, FillRule, PathData, Point, Rect, Vec2};
|
|
use vectorcraft_render::effects;
|
|
|
|
use super::edit::{duplicate_in, outermost, selected_roots, selected_roots_to_transform};
|
|
use super::opacitymask::percent;
|
|
use super::{
|
|
CommandSpec, Result, Session, bad, bool_or, check_numbers, check_switches, cmd, f64_or, f64_req, has_doc, has_multi, has_selection,
|
|
has_selection_or_guides, id_param, ids_param, matrix_param, ok, point_param, str_param, targets,
|
|
};
|
|
use crate::{EngineError, LastTransform};
|
|
|
|
mod align;
|
|
mod arrange;
|
|
mod bounds;
|
|
mod commands;
|
|
mod compound;
|
|
mod props;
|
|
mod shape;
|
|
mod spans;
|
|
mod transform;
|
|
|
|
pub(crate) use align::choice;
|
|
pub(crate) use arrange::group_nodes;
|
|
pub(crate) use bounds::{bounds_rewrite, object_bounds_transform};
|
|
pub use commands::specs;
|
|
pub(super) use compound::{as_clipping_path, make_clipping_path, release_clip};
|
|
pub(super) use shape::recut;
|
|
pub(crate) use transform::{apply_transform, preview_copies, scaling, transform_node, transform_patterns, transforms_objects};
|