The source flat array (not mutated).
Index of the element to move.
Parent code of the destination group (its current parent for a plain reorder).
Target position among the destination group's members, counted after the element has been removed.
Reads an element's parent code.
Returns a copy of an element stamped with a new parent code.
A new array with the element moved (and re-parented if needed).
Move one element of a flat, parent-referencing array — either reordering it among its current siblings or re-parenting it to another group — and return a new array (#780).
Since
body.structurestores zones, parts, and locations as flat sibling arrays, a child's position "within its parent" is just its relative order among the array elements sharing that parent code. Moving it therefore means splicing it to the flat slot currently occupied by the destination group'stoPosition-th member, after re-stamping its parent code.Placement rules:
toPositionpast the destination group's end inserts after its last member.fromIndexreturns an unchanged copy.Never mutates the input.