mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-11 16:33:22 -06:00
Blend spine: moveAnchor refuses with alongside handle; spine built once per overlay and drag
object.blend.spine.moveAnchor now refuses any supplied `with` (even an empty list) together with `handle`. Direct Selection builds the blend spine once when drawing the picked points and once per drag preview, instead of once per picked point. Part of #5285.
This commit is contained in:
@@ -205,7 +205,8 @@ pub(super) fn spine_move_anchor(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
};
|
||||
let independent = switch_or(p, "independent", false, C)?;
|
||||
let with = spine_points_param(p, C)?;
|
||||
if handle.is_some() && !with.is_empty() {
|
||||
// Any `with`, even an empty list, asks to move points, which a handle drag doesn't.
|
||||
if handle.is_some() && p.get("with").is_some_and(|v| !v.is_null()) {
|
||||
return Err(bad(C, "`with` moves points, not a handle"));
|
||||
}
|
||||
edit_spine(s, p, C, "Reshape Spine", |sp, anchors, keys| {
|
||||
|
||||
@@ -76,6 +76,7 @@ fn spine_points_move_together() {
|
||||
let before = spec(&s, g);
|
||||
assert!(s.execute("object.blend.spine.moveAnchor", &json!({"anchor": 1, "x": 55, "y": 45, "with": [9]})).is_err());
|
||||
assert!(s.execute("object.blend.spine.moveAnchor", &json!({"anchor": 1, "x": 55, "y": 45, "with": [2], "handle": "in"})).is_err());
|
||||
assert!(s.execute("object.blend.spine.moveAnchor", &json!({"anchor": 1, "x": 55, "y": 45, "with": [], "handle": "in"})).is_err());
|
||||
assert!(s.execute("object.blend.spine.moveAnchor", &json!({"anchor": 1, "x": 55, "y": 45, "with": "2"})).is_err());
|
||||
assert_eq!(spec(&s, g), before, "refused requests change nothing");
|
||||
s.execute("object.blend.spine.moveAnchor", &json!({"anchor": 1, "x": 55, "y": 45, "with": [2, 1]})).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user