VectorCraft: An open-source, vector art tool written by scratch in pure Rust
Intertwine: object.intertwine.arrange takes an id without a selection
Wadah Badawic35b51eb0f8e
diff --git a/crates/engine/src/cmd/intertwine.rs b/crates/engine/src/cmd/intertwine.rsindex 41e4a467d..27f1080e1 100644--- a/crates/engine/src/cmd/intertwine.rs+++ b/crates/engine/src/cmd/intertwine.rs@@ -26,7 +26,7 @@ use vectorcraft_tools::intertwine::{Face, drawn_order, face_at, faces, faces_in,use super::edit::selected_roots;use super::pathops::Beside;-use super::{CommandSpec, EngineError, Result, Session, bad, checked_id, checked_ids_param, cmd, has_selection, point_param, str_param};+use super::{CommandSpec, EngineError, Result, Session, bad, checked_id, checked_ids_param, cmd, has_doc, has_selection, point_param, str_param};pub fn specs() -> Vec<CommandSpec> {vec![@@ -63,7 +63,7 @@ pub fn specs() -> Vec<CommandSpec> {[],None,"{id?: Intertwine group (default: the selected one), at?: [x,y] (the overlap area under this point, as a click picks it) | area?: [[x,y]…] (a closed polygon drawn around overlap areas: every area whose inside it encloses), order?: toggle|front|back (toggle: the object drawn right below the top comes to the front, so two objects swap), member?: id (front and back: the object to move; default: front brings the object right below the top, back sends the top one)} → {count: areas changed, top: [id of the object now on top in each area]}",- has_intertwine,+ has_doc,arrange),]diff --git a/crates/engine/src/tests/intertwine.rs b/crates/engine/src/tests/intertwine.rsindex 02a279447..bdd3455f7 100644--- a/crates/engine/src/tests/intertwine.rs+++ b/crates/engine/src/tests/intertwine.rs@@ -329,3 +329,13 @@ fn edit_chooses_the_tool_for_the_group_of_a_selected_member() {assert_eq!(s.tool_id(), "intertwine");assert_eq!(s.doc().unwrap().selection.objects.to_vec(), [g]);}++#[test]+fn arrange_with_explicit_id_works_without_active_selection() {+ let mut s = session();+ let (g, _, _) = intertwined(&mut s);+ s.execute("select.none", &json!({})).unwrap();+ assert!(s.doc().unwrap().selection.is_empty());+ let out = s.execute("object.intertwine.arrange", &json!({"id": g.0, "at": [50.0, 30.0]})).unwrap();+ assert_eq!(out["count"], 1);+}