mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-18 07:49:26 +00:00
Merge pull request #8345 from dotCooCoo/feat/bounding-box-rotate
Transform: Rotate Bounding Box… turns the selection's bounding box without moving the art
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//! Object menu long tail: Lock/Hide All Artwork Above & Other Layers, Transform Each, Reset
|
||||
//! Bounding Box, Rasterize, Crop Image, Mask (an image), Create Trim Marks, Convert to Shape and
|
||||
//! Artboards → Convert / Rearrange. (Live blends are in `live.rs`.)
|
||||
//! Bounding Box, Rotate Bounding Box, Rasterize, Crop Image, Mask (an image), Create Trim Marks,
|
||||
//! Convert to Shape and Artboards → Convert / Rearrange. (Live blends are in `live.rs`.)
|
||||
|
||||
use std::collections::{BTreeMap, BTreeSet, HashSet};
|
||||
use std::sync::Arc;
|
||||
@@ -15,8 +15,8 @@ use vectorcraft_render::encode::{RasterExportOptions, RasterFormat};
|
||||
|
||||
use super::edit::{duplicate_in, selected_roots, selected_roots_to_transform};
|
||||
use super::{
|
||||
CommandSpec, EngineError, Result, Session, bad, check_numbers, check_switches, cmd, f64_or, fileio, find_command, has_doc, has_selected_member,
|
||||
has_selection, switch_or,
|
||||
CommandSpec, EngineError, Result, Session, bad, check_numbers, check_switches, cmd, f64_or, f64_req, fileio, find_command, has_doc,
|
||||
has_selected_member, has_selection, switch_or,
|
||||
};
|
||||
|
||||
/// Session-level (not saved) state owned by the menu commands.
|
||||
@@ -110,6 +110,15 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
has_selection,
|
||||
reset_bounding_box
|
||||
),
|
||||
cmd!(
|
||||
"object.rotateBoundingBox",
|
||||
"Rotate Bounding Box…",
|
||||
["Object", "Transform"],
|
||||
None,
|
||||
"{angle: degrees (counter-clockwise), absolute?: bool (true: turn the box to angle; default false: turn it by angle from the angle the selected objects share, 0 when theirs differ)} turn the bounding box of the selected objects to one angle without moving their art; the objects inside them (the children of groups, compound paths, clip groups, blends, envelopes, repeats and intertwines, and the art of linked opacity masks) turn with them and keep their angle relative to them; a path of a compound path selected on its own turns only its own box; one undo step, none when every box is already at the angle; object.resetBoundingBox squares the boxes again; a missing or non-numeric angle is an error → {angle: the new angle of the boxes, in (-180, 180], changed: objects whose box turned, the objects inside the selected ones included}",
|
||||
has_selection,
|
||||
rotate_bounding_box
|
||||
),
|
||||
cmd!(
|
||||
"object.rasterize",
|
||||
"Rasterize…",
|
||||
@@ -225,9 +234,10 @@ pub(crate) fn squash(s: &mut Session, from: usize, label: &str) {
|
||||
// ---------- Reset Bounding Box ----------
|
||||
|
||||
/// Squares each selected object and every object inside it: the children of groups, compound paths,
|
||||
/// clip groups, blends, envelopes, repeats and intertwines, and the art of linked opacity masks.
|
||||
/// clip groups, blends, envelopes, repeats and intertwines, and the art of linked opacity masks. A
|
||||
/// path of a compound path selected on its own is squared alone, as the transforms move it alone.
|
||||
fn reset_bounding_box(s: &mut Session, _: &Value) -> Result<Value> {
|
||||
let ids = selected_roots(s)?;
|
||||
let ids = selected_roots_to_transform(s)?;
|
||||
let d = &s.doc()?.doc;
|
||||
let mut changed = 0;
|
||||
let squared: Vec<(NodeId, Node)> = ids
|
||||
@@ -251,6 +261,69 @@ fn reset_bounding_box(s: &mut Session, _: &Value) -> Result<Value> {
|
||||
Ok(json!({ "changed": changed }))
|
||||
}
|
||||
|
||||
// ---------- Rotate Bounding Box ----------
|
||||
|
||||
/// Turns the bounding box of the selected objects to one angle without moving their art: by `angle`
|
||||
/// from the angle they share (0 when it differs), or to `angle` with `absolute`. Each object's box
|
||||
/// turns by what takes it there, and so do the boxes of the objects inside it (the children of
|
||||
/// groups and the art of linked opacity masks), which keep their angle relative to it.
|
||||
fn rotate_bounding_box(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
const C: &str = "object.rotateBoundingBox";
|
||||
// A JSON number is always finite.
|
||||
let angle = f64_req(p, "angle", C)?;
|
||||
let absolute = switch_or(p, "absolute", false, C)?;
|
||||
// The same objects the transforms move: a path of a compound path selected on its own turns
|
||||
// its own box. Layers are left out, as they have no box.
|
||||
let owners = selected_roots_to_transform(s)?;
|
||||
let d = &s.doc()?.doc;
|
||||
let start = if absolute { 0.0 } else { d.bbox_angle(&owners) };
|
||||
// An angle within the tolerance of 0 is stored as 0, as `Node::turn_boxes` stores it.
|
||||
let target = match vectorcraft_geom::normalize_deg(start + angle) {
|
||||
a if a.abs() <= BOX_EPS_DEG => 0.0,
|
||||
a => a,
|
||||
};
|
||||
let mut changed = 0;
|
||||
let turned: Vec<(NodeId, Node)> = owners
|
||||
.iter()
|
||||
.filter_map(|id| {
|
||||
let n = d.node(*id)?;
|
||||
let by = vectorcraft_geom::normalize_deg(target - n.bbox_angle);
|
||||
(by.abs() > BOX_EPS_DEG).then(|| {
|
||||
let mut c = n.clone();
|
||||
c.turn_boxes(by);
|
||||
// The selected object's box is set to the target itself, so repeated turns add no
|
||||
// rounding error to it.
|
||||
c.bbox_angle = target;
|
||||
changed += boxes(&c);
|
||||
(*id, c)
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
if !turned.is_empty() {
|
||||
s.edit("Rotate Bounding Box", |d, _| {
|
||||
for (id, n) in turned {
|
||||
if let Some(slot) = d.node_mut(id) {
|
||||
*slot = n;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
}
|
||||
Ok(json!({ "angle": target, "changed": changed }))
|
||||
}
|
||||
|
||||
/// Angles closer than this (degrees) are the same, as `vectorcraft_doc::orient` compares them.
|
||||
const BOX_EPS_DEG: f64 = 1e-6;
|
||||
|
||||
/// The number of objects in `n`'s subtree whose box [`Node::turn_boxes`] turns: `n`, its children
|
||||
/// and the art of a linked opacity mask, layers left out.
|
||||
fn boxes(n: &Node) -> usize {
|
||||
let own = usize::from(!n.is_layer());
|
||||
let children: usize = n.children().into_iter().flatten().map(|c| boxes(c)).sum();
|
||||
let mask = n.extras().mask.as_ref().filter(|m| m.linked).map_or(0, |m| boxes(&m.art));
|
||||
own + children + mask
|
||||
}
|
||||
|
||||
/// A copy of `n` with the angle of every object in its subtree set to 0, or `None` when no box in
|
||||
/// it stands at an angle, and the number of objects squared. The subtree takes in children and the
|
||||
/// art of linked opacity masks (an unlinked mask's art turns on its own); layers have no box. Only
|
||||
|
||||
@@ -366,6 +366,7 @@ pub(super) const ALLOWED: &[&str] = &[
|
||||
"object.repeat.release",
|
||||
"object.resetBoundingBox",
|
||||
"object.rotate",
|
||||
"object.rotateBoundingBox",
|
||||
"object.scale",
|
||||
"object.setBounds",
|
||||
"object.setLiveShape",
|
||||
|
||||
@@ -2809,6 +2809,26 @@ fn an_isolated_compound_paths_member_moves_alone() {
|
||||
assert_eq!((x0(&s, outer), x0(&s, hole)), (5.0, 55.0), "the compound path selected: the whole ring");
|
||||
}
|
||||
|
||||
/// Rotate Bounding Box and Reset Bounding Box take the same objects as the transforms: a path of
|
||||
/// a compound path selected alone turns or squares its own box, and the compound path selected
|
||||
/// turns its box and its paths'.
|
||||
#[test]
|
||||
fn rotate_bounding_box_of_a_compound_paths_member_turns_only_that_path() {
|
||||
let angle = |s: &Session, id: NodeId| s.doc().unwrap().doc.node(id).unwrap().bbox_angle;
|
||||
let mut s = session();
|
||||
let (c, outer, hole) = isolated_ring(&mut s);
|
||||
s.execute("object.exitIsolation", &json!({})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [hole.0]})).unwrap();
|
||||
s.execute("object.rotateBoundingBox", &json!({"angle": 30})).unwrap();
|
||||
assert_eq!((angle(&s, c), angle(&s, outer), angle(&s, hole)), (0.0, 0.0, 30.0), "only the hole's box turned");
|
||||
s.execute("select.set", &json!({"ids": [c.0]})).unwrap();
|
||||
s.execute("object.rotateBoundingBox", &json!({"angle": 10})).unwrap();
|
||||
assert_eq!((angle(&s, c), angle(&s, outer), angle(&s, hole)), (10.0, 10.0, 40.0), "the compound path and its paths");
|
||||
s.execute("select.set", &json!({"ids": [hole.0]})).unwrap();
|
||||
assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 1);
|
||||
assert_eq!((angle(&s, c), angle(&s, outer), angle(&s, hole)), (10.0, 10.0, 0.0), "Reset squared only the hole's box");
|
||||
}
|
||||
|
||||
/// The X, Y, W and H of the Properties and Transform panels run `object.setBounds`, which takes the
|
||||
/// same objects as the other transforms: a path of a compound path selected alone sets its own
|
||||
/// box and leaves the ring around it (#4046). The hole is off-centre, and a plain rectangle
|
||||
|
||||
@@ -579,6 +579,157 @@ fn reset_bounding_box_squares_the_turned_members_of_a_square_group() {
|
||||
assert_eq!(selection_box(&s).angle, 0.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rotate_bounding_box_turns_the_box_and_leaves_the_art() {
|
||||
let mut s = session();
|
||||
let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0);
|
||||
sel(&mut s, &[a]);
|
||||
let art = anchors(&s, a);
|
||||
let n = undo_len(&s);
|
||||
let r = s.execute("object.rotateBoundingBox", &json!({"angle": 90})).unwrap();
|
||||
assert_eq!((r["changed"].as_u64(), r["angle"].as_f64()), (Some(1), Some(90.0)));
|
||||
assert_eq!(undo_len(&s), n + 1);
|
||||
assert_eq!(anchors(&s, a), art, "the art stays where it is");
|
||||
// The box is at 90°, so its width runs along the rectangle's 50 pt side.
|
||||
let b = selection_box(&s);
|
||||
assert!(near(b.angle, 90.0));
|
||||
assert!(near(b.rect.width(), 50.0) && near(b.rect.height(), 100.0), "{b:?}");
|
||||
// By an angle from the box's angle; absolute sets it; the result wraps to (-180, 180].
|
||||
s.execute("object.rotateBoundingBox", &json!({"angle": 20})).unwrap();
|
||||
assert!(near(angle(&s, a), 110.0));
|
||||
let r = s.execute("object.rotateBoundingBox", &json!({"angle": 200, "absolute": true})).unwrap();
|
||||
assert!(near(r["angle"].as_f64().unwrap(), -160.0) && near(angle(&s, a), -160.0));
|
||||
// A box already at the angle changes nothing and adds no step.
|
||||
let n = undo_len(&s);
|
||||
let r = s.execute("object.rotateBoundingBox", &json!({"angle": -160, "absolute": true})).unwrap();
|
||||
assert_eq!(r["changed"], 0);
|
||||
let r = s.execute("object.rotateBoundingBox", &json!({"angle": 360})).unwrap();
|
||||
assert_eq!(r["changed"], 0);
|
||||
assert_eq!(undo_len(&s), n);
|
||||
// Undo turns the box back; Reset Bounding Box squares it.
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert!(near(angle(&s, a), 110.0));
|
||||
assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 1);
|
||||
assert_eq!(anchors(&s, a), art);
|
||||
}
|
||||
|
||||
/// Turns that add up to 0 within the tolerance leave the box at exactly 0, so the box measures
|
||||
/// square to the page and Reset Bounding Box has nothing to square.
|
||||
#[test]
|
||||
fn rotate_bounding_box_back_to_zero_stores_zero() {
|
||||
let mut s = session();
|
||||
let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0);
|
||||
sel(&mut s, &[a]);
|
||||
for by in [0.3, -0.1] {
|
||||
s.execute("object.rotateBoundingBox", &json!({"angle": by})).unwrap();
|
||||
}
|
||||
let r = s.execute("object.rotateBoundingBox", &json!({"angle": -0.2})).unwrap();
|
||||
assert_eq!((r["angle"].as_f64(), angle(&s, a)), (Some(0.0), 0.0), "{r}");
|
||||
assert_eq!(selection_box(&s).angle, 0.0);
|
||||
let n = undo_len(&s);
|
||||
assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 0);
|
||||
assert_eq!(undo_len(&s), n);
|
||||
// A negative zero is reported and stored as 0.
|
||||
let r = s.execute("object.rotateBoundingBox", &json!({"angle": -0.0, "absolute": true})).unwrap();
|
||||
let got = r["angle"].as_f64().unwrap();
|
||||
assert!(got == 0.0 && got.is_sign_positive(), "{r}");
|
||||
assert_eq!(r["changed"], 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rotate_bounding_box_gives_a_mixed_selection_one_angle() {
|
||||
let mut s = session();
|
||||
let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0);
|
||||
let b = turned_rect(&mut s);
|
||||
sel(&mut s, &[a, b]);
|
||||
// The objects share no angle, so the box is square to the page and turns from 0.
|
||||
assert_eq!(selection_box(&s).angle, 0.0);
|
||||
let n = undo_len(&s);
|
||||
assert_eq!(s.execute("object.rotateBoundingBox", &json!({"angle": 10})).unwrap()["changed"], 2);
|
||||
assert_eq!(undo_len(&s), n + 1, "one step for both");
|
||||
assert!(near(angle(&s, a), 10.0) && near(angle(&s, b), 10.0));
|
||||
assert!(near(selection_box(&s).angle, 10.0));
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert!(near(angle(&s, a), 0.0) && near(angle(&s, b), 45.0));
|
||||
s.execute("edit.redo", &json!({})).unwrap();
|
||||
assert!(near(angle(&s, a), 10.0) && near(angle(&s, b), 10.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rotate_bounding_box_turns_the_objects_inside_a_group_with_it() {
|
||||
let mut s = session();
|
||||
let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0);
|
||||
let b = rect(&mut s, 300.0, 100.0, 100.0, 50.0);
|
||||
sel(&mut s, &[a, b]);
|
||||
s.execute("object.rotate", &json!({"angle": 20})).unwrap();
|
||||
let g = id_of(&s.execute("object.group", &json!({})).unwrap());
|
||||
let art = (anchors(&s, a), anchors(&s, b));
|
||||
// The group and both members, as Reset Bounding Box counts them.
|
||||
assert_eq!(s.execute("object.rotateBoundingBox", &json!({"angle": 30})).unwrap()["changed"], 3);
|
||||
// The members keep their 20° relative to the group's box.
|
||||
assert!(near(angle(&s, g), 30.0) && near(angle(&s, a), 50.0) && near(angle(&s, b), 50.0));
|
||||
assert_eq!((anchors(&s, a), anchors(&s, b)), art);
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert!(near(angle(&s, g), 0.0) && near(angle(&s, a), 20.0) && near(angle(&s, b), 20.0));
|
||||
s.execute("edit.redo", &json!({})).unwrap();
|
||||
assert!(near(angle(&s, g), 30.0) && near(angle(&s, a), 50.0) && near(angle(&s, b), 50.0));
|
||||
// After Ungroup the members still share a turned box.
|
||||
s.execute("object.ungroup", &json!({})).unwrap();
|
||||
assert!(near(selection_box(&s).angle, 50.0));
|
||||
}
|
||||
|
||||
/// The art of a linked opacity mask turns with its object; an unlinked mask's art keeps its angle.
|
||||
#[test]
|
||||
fn rotate_bounding_box_turns_a_linked_masks_art_only() {
|
||||
let mask_angle = |s: &Session, a: NodeId| s.doc().unwrap().doc.node(a).unwrap().extras().mask.as_ref().unwrap().art.bbox_angle;
|
||||
let mut s = session();
|
||||
let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0);
|
||||
let b = rect(&mut s, 150.0, 120.0, 100.0, 50.0);
|
||||
sel(&mut s, &[a, b]);
|
||||
s.execute("transparency.makeOpacityMask", &json!({})).unwrap();
|
||||
assert_eq!(s.execute("object.rotateBoundingBox", &json!({"angle": 30})).unwrap()["changed"], 2);
|
||||
assert!(near(angle(&s, a), 30.0) && near(mask_angle(&s, a), 30.0));
|
||||
s.execute("transparency.unlinkOpacityMask", &json!({})).unwrap();
|
||||
assert_eq!(s.execute("object.rotateBoundingBox", &json!({"angle": 10})).unwrap()["changed"], 1);
|
||||
assert!(near(angle(&s, a), 40.0) && near(mask_angle(&s, a), 30.0));
|
||||
}
|
||||
|
||||
/// Rotate Bounding Box and Reset Bounding Box act on the same boxes: after a turn of a group that
|
||||
/// holds an object with a linked opacity mask, Reset squares every box it turned.
|
||||
#[test]
|
||||
fn reset_bounding_box_squares_every_box_rotate_bounding_box_turned() {
|
||||
let mut s = session();
|
||||
let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0);
|
||||
let b = rect(&mut s, 150.0, 120.0, 100.0, 50.0);
|
||||
sel(&mut s, &[a, b]);
|
||||
s.execute("transparency.makeOpacityMask", &json!({})).unwrap();
|
||||
let c = rect(&mut s, 300.0, 100.0, 100.0, 50.0);
|
||||
sel(&mut s, &[a, c]);
|
||||
s.execute("object.group", &json!({})).unwrap();
|
||||
let art = (anchors(&s, a), anchors(&s, c));
|
||||
// The group, the masked object, its mask's art and the other rectangle.
|
||||
assert_eq!(s.execute("object.rotateBoundingBox", &json!({"angle": 25})).unwrap()["changed"], 4);
|
||||
assert!(object_angles(&s).iter().all(|x| near(*x, 25.0)), "{:?}", object_angles(&s));
|
||||
assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 4);
|
||||
assert!(object_angles(&s).iter().all(|x| *x == 0.0), "{:?}", object_angles(&s));
|
||||
assert_eq!((anchors(&s, a), anchors(&s, c)), art);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rotate_bounding_box_refuses_bad_params() {
|
||||
let mut s = session();
|
||||
let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0);
|
||||
sel(&mut s, &[a]);
|
||||
let n = undo_len(&s);
|
||||
for p in [json!({}), json!({"angle": null}), json!({"angle": "30"}), json!({"angle": 30, "absolute": "yes"})] {
|
||||
assert!(s.execute("object.rotateBoundingBox", &p).is_err(), "{p}");
|
||||
}
|
||||
assert_eq!((angle(&s, a), undo_len(&s)), (0.0, n));
|
||||
// Nothing selected: the command is not enabled.
|
||||
s.execute("select.none", &json!({})).unwrap();
|
||||
assert!(s.execute("object.rotateBoundingBox", &json!({"angle": 30})).is_err());
|
||||
}
|
||||
|
||||
/// Two rectangles turned 20°, put in a container by `make`, turned 10° with it and reset, then
|
||||
/// released by `release`: nothing stands at an angle before or after the release.
|
||||
fn reset_then_release(make: &str, release: &str) -> Session {
|
||||
|
||||
@@ -2955,6 +2955,8 @@ digits Malayalam Малаялам
|
||||
Reselect Избиране отново
|
||||
Reset Нулиране
|
||||
Reset Bounding Box Нулиране на ограничителната рамка
|
||||
Rotate Bounding Box Завъртане на ограничителната рамка
|
||||
Rotate Bounding Box… Завъртане на ограничителната рамка…
|
||||
Reset Envelope Mesh Нулиране на мрежата на обвивката
|
||||
Reset Envelope Shape Нулиране на формата на обвивката
|
||||
Reset Essentials Нулиране на основните
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -169,6 +169,8 @@
|
||||
Shear… Smicanje…
|
||||
Transform Each… Transformiši svaki…
|
||||
Reset Bounding Box Vrati granični okvir na početno
|
||||
Rotate Bounding Box Rotiraj granični okvir
|
||||
Rotate Bounding Box… Rotiraj granični okvir…
|
||||
Arrange Rasporedi
|
||||
Bring to Front Postavi na vrh
|
||||
Bring Forward Pomakni naprijed
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -3764,6 +3764,8 @@ digits Malayalam Malaiàlam
|
||||
Reset Automation Restableix Automation
|
||||
Reset Bar Position Restableix la posició de la barra
|
||||
Reset Bounding Box Restableix el quadre delimitador
|
||||
Rotate Bounding Box Gira el quadre delimitador
|
||||
Rotate Bounding Box… Gira el quadre delimitador…
|
||||
Reset Envelope Mesh Restableix la malla de l’embolcall
|
||||
Reset Envelope Shape Restableix la forma de l’embolcall
|
||||
Reset Essentials Restableix Essentials
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -173,6 +173,8 @@
|
||||
Shear… Zkosit…
|
||||
Transform Each… Transformovat jednotlivě…
|
||||
Reset Bounding Box Obnovit ohraničovací rámeček
|
||||
Rotate Bounding Box Otočit ohraničovací rámeček
|
||||
Rotate Bounding Box… Otočit ohraničovací rámeček…
|
||||
Arrange Uspořádat
|
||||
Bring to Front Přenést do popředí
|
||||
Bring Forward Přenést blíž
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -871,6 +871,8 @@ liquify-list-end {0}, {1} {0} og {1}
|
||||
Shear… Skæv…
|
||||
Transform Each… Transformér hver for sig…
|
||||
Reset Bounding Box Nulstil afgrænsningsramme
|
||||
Rotate Bounding Box Rotér afgrænsningsramme
|
||||
Rotate Bounding Box… Rotér afgrænsningsramme…
|
||||
Arrange Arrangér
|
||||
Bring to Front Anbring forrest
|
||||
Bring Forward Flyt fremad
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3004,6 +3004,8 @@ digits Malayalam Malayalam
|
||||
Reselect Erneut auswählen
|
||||
Reset Zurücksetzen
|
||||
Reset Bounding Box Begrenzungsrahmen zurücksetzen
|
||||
Rotate Bounding Box Begrenzungsrahmen drehen
|
||||
Rotate Bounding Box… Begrenzungsrahmen drehen…
|
||||
Reset Envelope Mesh Hüllengitter zurücksetzen
|
||||
Reset Envelope Shape Hüllenform zurücksetzen
|
||||
Reset Essentials Essentials zurücksetzen
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3839,6 +3839,8 @@ digits Malayalam Μαλαγιάλαμ
|
||||
Replaces the saved preset of that name. Αντικαθιστά την αποθηκευμένη προεπιλογή με αυτό το όνομα.
|
||||
Require a password to open the document Απαίτηση κωδικού για το άνοιγμα εγγράφου
|
||||
Reset Bounding Box Επαναφορά πλαισίου οριοθέτησης
|
||||
Rotate Bounding Box Περιστροφή πλαισίου οριοθέτησης
|
||||
Rotate Bounding Box… Περιστροφή πλαισίου οριοθέτησης…
|
||||
Reset Envelope Mesh Επαναφορά πλέγματος περιβλήματος
|
||||
Reset Envelope Shape Επαναφορά σχήματος περιβλήματος
|
||||
Reset Essentials Επαναφορά χώρου εργασίας Essentials
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3043,6 +3043,8 @@ digits Malayalam Malayálam
|
||||
Reselect Volver a seleccionar
|
||||
Reset Restablecer
|
||||
Reset Bounding Box Restablecer cuadro delimitador
|
||||
Rotate Bounding Box Rotar cuadro delimitador
|
||||
Rotate Bounding Box… Rotar cuadro delimitador…
|
||||
Reset Envelope Mesh Restablecer malla de envolvente
|
||||
Reset Envelope Shape Restablecer forma de envolvente
|
||||
Reset Essentials Restablecer Essentials
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -180,6 +180,8 @@
|
||||
Shear… Vinouta…
|
||||
Transform Each… Muunna kutakin…
|
||||
Reset Bounding Box Palauta rajausruutu
|
||||
Rotate Bounding Box Kierrä rajausruutua
|
||||
Rotate Bounding Box… Kierrä rajausruutua…
|
||||
Arrange Järjestä
|
||||
Bring to Front Tuo eteen
|
||||
Bring Forward Tuo eteenpäin
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -3031,6 +3031,8 @@ digits Malayalam Malayalam
|
||||
Reselect Resélectionner
|
||||
Reset Réinitialiser
|
||||
Reset Bounding Box Réinitialiser le cadre de sélection
|
||||
Rotate Bounding Box Faire pivoter le cadre de sélection
|
||||
Rotate Bounding Box… Faire pivoter le cadre de sélection…
|
||||
Reset Envelope Mesh Réinitialiser le filet de l’enveloppe
|
||||
Reset Envelope Shape Réinitialiser la forme de l’enveloppe
|
||||
Reset Essentials Réinitialiser Essentials
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3116,6 +3116,8 @@
|
||||
Reset રીસેટ કરો
|
||||
Reset Bar Position બાર સ્થિતિ રીસેટ કરો
|
||||
Reset Bounding Box બાઉન્ડિંગ બોક્સ રીસેટ કરો
|
||||
Rotate Bounding Box બાઉન્ડિંગ બોક્સ ફેરવો
|
||||
Rotate Bounding Box… બાઉન્ડિંગ બોક્સ ફેરવો…
|
||||
Reset Envelope Mesh એન્વેલપ મેશ રીસેટ કરો
|
||||
Reset Envelope Shape એન્વેલપ આકાર રીસેટ કરો
|
||||
Reset Essentials એસેન્શિયલ્સ રીસેટ કરો
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 72 and column 5.
|
@@ -4129,6 +4129,8 @@ antiAlias Sharp शार्प
|
||||
Reset Automation स्वचालन रीसेट करें
|
||||
Reset Bar Position बार स्थिति रीसेट करें
|
||||
Reset Bounding Box बाउंडिंग बॉक्स रीसेट करें
|
||||
Rotate Bounding Box बाउंडिंग बॉक्स घुमाएँ
|
||||
Rotate Bounding Box… बाउंडिंग बॉक्स घुमाएँ…
|
||||
Reset Envelope Mesh एन्वेलप मेश रीसेट करें
|
||||
Reset Envelope Shape एन्वेलप शेप रीसेट करें
|
||||
Reset Essentials एसेंशियल्स रीसेट करें
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3606,6 +3606,8 @@ mark-style Japanese Japán
|
||||
Reset Automation Automation visszaállítása
|
||||
Reset Bar Position Sáv helyének visszaállítása
|
||||
Reset Bounding Box Befoglaló keret visszaállítása
|
||||
Rotate Bounding Box Befoglaló keret elforgatása
|
||||
Rotate Bounding Box… Befoglaló keret elforgatása…
|
||||
Reset Envelope Mesh Burkolóháló visszaállítása
|
||||
Reset Envelope Shape Burkoló alakjának visszaállítása
|
||||
Reset Essentials Essentials visszaállítása
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -162,6 +162,8 @@
|
||||
Shear… Miringkan…
|
||||
Transform Each… Transformasi masing-masing…
|
||||
Reset Bounding Box Atur ulang kotak pembatas
|
||||
Rotate Bounding Box Putar kotak pembatas
|
||||
Rotate Bounding Box… Putar kotak pembatas…
|
||||
Arrange Susun
|
||||
Bring to Front Bawa ke depan
|
||||
Bring Forward Majukan
|
||||
|
||||
|
@@ -3085,6 +3085,8 @@ digits Malayalam Malayalam
|
||||
Reselect Riseleziona
|
||||
Reset Reimposta
|
||||
Reset Bounding Box Reimposta riquadro di delimitazione
|
||||
Rotate Bounding Box Ruota riquadro di delimitazione
|
||||
Rotate Bounding Box… Ruota riquadro di delimitazione…
|
||||
Reset Envelope Mesh Reimposta trama involucro
|
||||
Reset Envelope Shape Reimposta forma involucro
|
||||
Reset Essentials Reimposta Essentials
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -217,6 +217,8 @@ digits Malayalam マラヤーラム数字
|
||||
Shear… シアー…
|
||||
Transform Each… 個別に変形…
|
||||
Reset Bounding Box バウンディングボックスのリセット
|
||||
Rotate Bounding Box バウンディングボックスの回転
|
||||
Rotate Bounding Box… バウンディングボックスの回転…
|
||||
Arrange 重ね順
|
||||
Bring to Front 最前面へ
|
||||
Bring Forward 前面へ
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2334,6 +2334,8 @@
|
||||
Shear… დახრა…
|
||||
Transform Each… თითოეულის გარდაქმნა…
|
||||
Reset Bounding Box შემომსაზღვრელი ჩარჩოს ჩამოყრა
|
||||
Rotate Bounding Box შემომსაზღვრელი ჩარჩოს შემობრუნება
|
||||
Rotate Bounding Box… შემომსაზღვრელი ჩარჩოს შემობრუნება…
|
||||
Arrange დალაგება
|
||||
Bring to Front წინა პლანზე გადმოტანა
|
||||
Bring Forward წინ გადმოტანა
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -210,6 +210,8 @@ digits Malayalam 말라얄람어
|
||||
Shear… 기울이기…
|
||||
Transform Each… 각각 변형…
|
||||
Reset Bounding Box 경계 상자 재설정
|
||||
Rotate Bounding Box 경계 상자 회전
|
||||
Rotate Bounding Box… 경계 상자 회전…
|
||||
Arrange 정렬 순서
|
||||
Bring to Front 맨 앞으로 가져오기
|
||||
Bring Forward 앞으로 가져오기
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -735,6 +735,8 @@ liquify-list-end {0}, {1} {0} en {1}
|
||||
Shear… Schuin zetten…
|
||||
Transform Each… Elk afzonderlijk transformeren…
|
||||
Reset Bounding Box Begrenzingskader herstellen
|
||||
Rotate Bounding Box Begrenzingskader roteren
|
||||
Rotate Bounding Box… Begrenzingskader roteren…
|
||||
Arrange Schikken
|
||||
Bring to Front Naar de voorgrond brengen
|
||||
Bring Forward Naar voren brengen
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -137,6 +137,8 @@
|
||||
Shear… Pochyl…
|
||||
Transform Each… Przekształć każdy…
|
||||
Reset Bounding Box Resetuj obwiednię
|
||||
Rotate Bounding Box Obróć obwiednię
|
||||
Rotate Bounding Box… Obróć obwiednię…
|
||||
Arrange Ułóż
|
||||
Bring to Front Przenieś na wierzch
|
||||
Bring Forward Przesuń do przodu
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2536,6 +2536,8 @@ digits Malayalam Malaiala
|
||||
Reselect Resselecionar
|
||||
Reset Redefinir
|
||||
Reset Bounding Box Redefinir Caixa Delimitadora
|
||||
Rotate Bounding Box Girar Caixa Delimitadora
|
||||
Rotate Bounding Box… Girar Caixa Delimitadora…
|
||||
Reset Envelope Mesh Redefinir Malha do Envelope
|
||||
Reset Envelope Shape Redefinir Forma do Envelope
|
||||
Reset Essentials Redefinir Essentials
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3072,6 +3072,8 @@ digits Malayalam Малаялам
|
||||
Reselect Выделить снова
|
||||
Reset Сбросить
|
||||
Reset Bounding Box Сбросить ограничительную рамку
|
||||
Rotate Bounding Box Повернуть ограничительную рамку
|
||||
Rotate Bounding Box… Повернуть ограничительную рамку…
|
||||
Reset Envelope Mesh Сбросить сетку оболочки
|
||||
Reset Envelope Shape Сбросить форму оболочки
|
||||
Reset Essentials Сбросить «Основные»
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2973,6 +2973,8 @@ digits Malayalam Malayalam
|
||||
Reselect Markera igen
|
||||
Reset Återställ
|
||||
Reset Bounding Box Återställ begränsningsram
|
||||
Rotate Bounding Box Rotera begränsningsram
|
||||
Rotate Bounding Box… Rotera begränsningsram…
|
||||
Reset Envelope Mesh Återställ kuvertnät
|
||||
Reset Envelope Shape Återställ kuvertform
|
||||
Reset Essentials Återställ Grundläggande
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2810,6 +2810,8 @@ digits Malayalam Malayalam
|
||||
Reselect Yeniden seç
|
||||
Reset Sıfırla
|
||||
Reset Bounding Box Sınırlayıcı Kutuyu Sıfırla
|
||||
Rotate Bounding Box Sınırlayıcı Kutuyu Döndür
|
||||
Rotate Bounding Box… Sınırlayıcı Kutuyu Döndür…
|
||||
Reset Envelope Mesh Zarf Ağını Sıfırla
|
||||
Reset Envelope Shape Zarf Şeklini Sıfırla
|
||||
Reset Essentials Essentials'ı sıfırla
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3077,6 +3077,8 @@ digits Malayalam Малаялам
|
||||
Reselect Виділити знову
|
||||
Reset Скинути
|
||||
Reset Bounding Box Скинути обмежувальну рамку
|
||||
Rotate Bounding Box Повернути обмежувальну рамку
|
||||
Rotate Bounding Box… Повернути обмежувальну рамку…
|
||||
Reset Envelope Mesh Скинути сітку оболонки
|
||||
Reset Envelope Shape Скинути форму оболонки
|
||||
Reset Essentials Скинути «Основні»
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3381,6 +3381,8 @@ mark-style Japanese Kiểu Nhật
|
||||
Reset all Revolve settings to their defaults. Đặt lại tất cả cài đặt Revolve về mặc định.
|
||||
Reset Bar Position Đặt lại vị trí thanh
|
||||
Reset Bounding Box Đặt lại hộp bao
|
||||
Rotate Bounding Box Xoay hộp bao
|
||||
Rotate Bounding Box… Xoay hộp bao…
|
||||
Reset Envelope Mesh Đặt lại lưới Envelope
|
||||
Reset Envelope Shape Đặt lại hình dạng Envelope
|
||||
Reset Essentials Đặt lại Essentials
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 206 and column 5.
|
@@ -2937,6 +2937,8 @@ digits Malayalam 马拉雅拉姆数字
|
||||
Reselect 重新选择
|
||||
Reset 重置
|
||||
Reset Bounding Box 重置定界框
|
||||
Rotate Bounding Box 旋转定界框
|
||||
Rotate Bounding Box… 旋转定界框…
|
||||
Reset Envelope Mesh 重置封套网格
|
||||
Reset Envelope Shape 重置封套形状
|
||||
Reset Essentials 重置基本功能
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4226,6 +4226,8 @@ digits Malayalam 馬來亞拉姆數字
|
||||
Reselect 重新選取
|
||||
Reset 重設
|
||||
Reset Bounding Box 重設邊框
|
||||
Rotate Bounding Box 旋轉邊框
|
||||
Rotate Bounding Box… 旋轉邊框…
|
||||
Reset Envelope Mesh 重設封套網格
|
||||
Reset Envelope Shape 重設封套形狀
|
||||
Reset Essentials 重設基本功能
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -770,6 +770,7 @@ pub(super) fn transform_items() -> Vec<Item> {
|
||||
c("Transform Each…", "object.transformEach"),
|
||||
Sep,
|
||||
c("Reset Bounding Box", "object.resetBoundingBox"),
|
||||
cp("Rotate Bounding Box…", "object.rotateBoundingBox", json!({"angle": 0})),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,35 @@ fn rotation_field_shows_the_angle_the_box_keeps() {
|
||||
assert!(shown.iter().any(|t| t == "0°") && !shown.iter().any(|t| t == "100 pt"), "{shown:?}");
|
||||
}
|
||||
|
||||
/// Object › Transform › Rotate Bounding Box… asks for an angle and turns the box, not the art, in
|
||||
/// one undo step: the panel then shows the box's angle.
|
||||
#[test]
|
||||
fn rotate_bounding_box_menu_item_turns_the_box_by_the_dialog_angle() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 300, "height": 300})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 100, "height": 50})).unwrap();
|
||||
let entry = crate::menus::menu_entries(&app)
|
||||
.into_iter()
|
||||
.find(|e| e.path == ["Object", "Transform"] && e.label == "Rotate Bounding Box…")
|
||||
.expect("menu item");
|
||||
let (id, p) = crate::menus::click_target(&entry.label, entry.command.as_deref().unwrap(), &entry.params);
|
||||
crate::menus::invoke(&mut app, &id, p);
|
||||
let d = app.ui.dialog.as_mut().expect("a dialog opens");
|
||||
assert_eq!(d.str("__command"), "object.rotateBoundingBox");
|
||||
d.fields.insert("angle".into(), json!(90));
|
||||
let bounds = |app: &VectorcraftApp| {
|
||||
let st = app.session.doc().unwrap();
|
||||
st.doc.bounds_of(&st.selection.objects, false)
|
||||
};
|
||||
let art = bounds(&app);
|
||||
let undo = app.session.doc().unwrap().history.undo.len();
|
||||
crate::dialogs::confirm(&mut app).unwrap();
|
||||
assert_eq!(app.session.doc().unwrap().history.undo.len(), undo + 1);
|
||||
assert_eq!(bounds(&app), art, "the art stays where it is");
|
||||
let shown = texts(&mut app, show);
|
||||
assert!(shown.iter().any(|t| t == "90°"), "{shown:?}");
|
||||
}
|
||||
|
||||
/// #812: a selected live polygon shows its Polygon Properties in the Transform panel and the
|
||||
/// Properties panel's Transform section, and Make Sides Equal evens it out after a stretch.
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user