mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-13 13:52:34 +00:00
Merge pull request #2117 from Silvertree2010/fix/h11295-node-reparent-silently-turns-a-n
Reject negative or fractional index in node.reparent
This commit is contained in:
2 files changed
+17
-1
No files matched your search
@@ -245,7 +245,7 @@ pub(super) fn stroke_brush(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
pub(super) fn reparent(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let ids = req_targets("node.reparent", s, p)?;
|
||||
let parent = req_id("node.reparent", p, "parent")?;
|
||||
let index = num(p, "index").map(|i| i.max(0.0) as usize);
|
||||
let index = opt_index("node.reparent", p, "index")?;
|
||||
let doc = s.doc_mut()?;
|
||||
let ids = z_sorted(doc, &roots(doc, &ids));
|
||||
// `index` is where the first moved layer ends up among the parent's children (bottom first),
|
||||
|
||||
Reference in new issue
Block a user