mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-30 20:58:00 -06:00
Extract geometry command helpers
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
use super::transform::transform_patterns;
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, Document, EngineError, NodeId, OrientedBox, Point, Rect, Result, Scaling, Session, Value, Vec2, bad, check_numbers, check_switches,
|
||||
effects, has_multi, ok, selected_roots, str_param,
|
||||
};
|
||||
|
||||
impl Session {
|
||||
/// The bounds of `ids` the Transform panel, the bounding box, Align and Distribute measure:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::*;
|
||||
use super::{Document, EngineError, Node, NodeId, NodeKind, Result, Session, Value, bad, id_param, json, ok, selected_roots};
|
||||
|
||||
pub(super) enum Arrange {
|
||||
Front,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
use super::spans::Spans;
|
||||
use super::transform::{TRANSFORM_SWITCHES, about, apply_transform, scaling_options, transforms_objects};
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, Document, EngineError, NodeId, OrientedBox, Point, Rect, Result, Scaling, Session, Value, bool_or, check_numbers, check_switches,
|
||||
effects, f64_or, json, selected_roots_to_transform,
|
||||
};
|
||||
|
||||
pub(super) fn set_bounds(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
match bounds_transform(s, p, selected_roots_to_transform(s)?, 0.0)? {
|
||||
|
||||
@@ -5,7 +5,7 @@ use super::compound::{clip_edit, clip_make, clip_release, compound_make, compoun
|
||||
use super::props::set_props;
|
||||
use super::shape::{expand_shape, set_live_shape};
|
||||
use super::transform::{move_cmd, nudge, reflect, rotate, scale, shear, transform, transform_again};
|
||||
use super::*;
|
||||
use super::{CommandSpec, cmd, has_doc, has_multi, has_selection, has_selection_or_guides};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
vec![
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use super::*;
|
||||
use super::{
|
||||
Appearance, Arc, Document, EngineError, FillRule, Node, NodeId, NodeKind, Paint, PathData, Result, Session, Value, json, ok, selected_roots,
|
||||
};
|
||||
|
||||
pub(super) fn compound_make(s: &mut Session, _: &Value) -> Result<Value> {
|
||||
let ids = selected_roots(s)?;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::*;
|
||||
use super::{BlendMode, EngineError, Knockout, Node, Result, Session, Value, bad, check_numbers, check_switches, ok, percent, str_param, targets};
|
||||
|
||||
/// The most data entries `object.setProps` takes at once.
|
||||
const MAX_DATA: usize = 256;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
use super::spans::Span;
|
||||
use super::*;
|
||||
use super::{
|
||||
BTreeSet, CornerKind, EngineError, LiveCorners, LiveShape, NodeId, NodeKind, Result, Session, Value, bad, check_numbers, check_switches,
|
||||
convert_radii_relative, ok, selected_roots, set_corners, targets,
|
||||
};
|
||||
|
||||
/// The largest scale of 0 or more at which `spans`, with the margins that scale grown by `k`,
|
||||
/// reach across `size` together. Returns 1 when their geometric boxes reach 1e-9 or less across
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::shape::scale_across;
|
||||
use super::*;
|
||||
use super::{Affine, Document, Node, NodeId, NodeKind, OrientedBox, Point, Rect};
|
||||
|
||||
/// One axis of an object that [`set_bounds`] sizes, square to its frame: the geometric box runs
|
||||
/// from `lo` to `hi`, and the visual box reaches past each end (before, after) by a margin that
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
use super::align::choice;
|
||||
use super::*;
|
||||
use super::{
|
||||
Affine, Arc, Document, EngineError, LastTransform, Node, NodeId, NodeKind, Point, Result, Scaling, Session, Value, Vec2, bad, bool_or,
|
||||
check_numbers, check_switches, duplicate_in, effects, f64_or, f64_req, ids_param, json, matrix_param, ok, outermost, point_param,
|
||||
selected_roots_to_transform,
|
||||
};
|
||||
|
||||
fn origin_of(s: &Session, p: &Value, ids: &[NodeId]) -> Result<Point> {
|
||||
if let Some(o) = point_param(p, "origin") {
|
||||
|
||||
Reference in New Issue
Block a user