mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-01 13:47:21 -06:00
Merge pull request #4897 from WadahBadawi/fix/intertwine-arrange
fix(intertwine): allow object.intertwine.arrange with explicit id without selection
This commit is contained in:
@@ -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
|
||||
),
|
||||
]
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user