From c35b51eb0f8ee99fcb864ca400f377a9e0f332fc Mon Sep 17 00:00:00 2001 From: Wadah Badawi <350738630+WadahBadawi@users.noreply.github.com> Date: Sat, 31 Oct 2026 23:30:06 +0700 Subject: [PATCH] Intertwine: object.intertwine.arrange takes an id without a selection --- crates/engine/src/cmd/intertwine.rs | 4 ++-- crates/engine/src/tests/intertwine.rs | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/intertwine.rs b/crates/engine/src/cmd/intertwine.rs index 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 { vec![ @@ -63,7 +63,7 @@ pub fn specs() -> Vec { [], 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.rs index 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); +}