Compare commits

..

2 Commits

View File

@ -240,29 +240,20 @@ var Pivot =
{ {
// collect modifiers effecting leaves // collect modifiers effecting leaves
let modifiers = []; let modifiers = [];
let check = N.Step(inLeaf, "ModifyAt", false); let collectModifier = n => modifiers.push(n);
if(check) let connectModifiers = n => modifiers.forEach(inModifier => N.Connect(inModifier, n, "ModifyOut", true));
{
modifiers = modifiers.concat(check); N.Walk(collectModifier, inLeaf, "ModifyAt", false);
} N.Walk(collectModifier, inLeaf, "ModifyDown", false);
check = N.Step(inLeaf, "ModifyDown", false);
if(check)
{
modifiers = modifiers.concat(check);
}
if(modifiers.length) if(modifiers.length)
{ {
// apply them to the branch // apply them to the branch
inLastBranch.ID.Walk = N.ID.Walk; inLastBranch.ID.Walk = N.ID.Walk;
modifiers.forEach( inModifier => N.Connect(inModifier, inLastBranch, "ModifyOut") ) connectModifiers(inLastBranch);
// also walk them up and connect, but with "check unique" enabled // also walk them up and connect, but with "check unique" enabled
N.Walk( inNode=> N.Walk(connectModifiers, inLastBranch, "Hierarchy", false);
{
modifiers.forEach( inModifier => N.Connect(inModifier, inNode, "ModifyOut", true) )
}
, inLastBranch, "Hierarchy", false);
} }
// lastly connect the leaf to the branch // lastly connect the leaf to the branch
@ -275,7 +266,7 @@ var Pivot =
{ {
iterator = child => Pivot.Pivot(inRoot, child, inPivotIndicies, inSumIndicies, depth+1); iterator = child => Pivot.Pivot(inRoot, child, inPivotIndicies, inSumIndicies, depth+1);
} }
N.Step(inParent, "Hierarchy").forEach(iterator); N.Walk(iterator, inParent, "Hierarchy");
return inParent; return inParent;
}, },
Create(inPivotIndicies, inSumIndicies) Create(inPivotIndicies, inSumIndicies)
@ -304,13 +295,13 @@ var Pivot =
} }
} }
// disconnect terminal branches // disconnect leaves from terminal branches
N.Walk(()=>{}, inRoot, "Hierarchy", inNode=>{ N.Walk(()=>{}, inRoot, "Hierarchy", true, terminal=>{
N.Disconnect(inNode, null, "Leaf"); N.Disconnect(terminal, null, "Leaf");
}); });
// disconnect from app // disconnect from app
N.Disconnect(null, inRoot, "Pivot") N.Disconnect(null, inRoot, "Pivot");
}, },
Modify(inNode) Modify(inNode)
{ {