MCPcopy Create free account
hub / github.com/microsoft/SandDance / firstWalk

Function firstWalk

docs/app/js/sanddance-app.js:138310–138321  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

138308 // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the
138309 // node v is placed to the midpoint of its outermost children.
138310 function firstWalk(v) {
138311 var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null;
138312 if (children) {
138313 executeShifts(v);
138314 var midpoint = (children[0].z + children[children.length - 1].z) / 2;
138315 if (w) {
138316 v.z = w.z + separation(v._, w._);
138317 v.m = v.z - midpoint;
138318 } else v.z = midpoint;
138319 } else if (w) v.z = w.z + separation(v._, w._);
138320 v.parent.A = apportion(v, w, v.parent.A || siblings[0]);
138321 }
138322 // Computes all real x-coordinates by summing up the modifiers recursively.
138323 function secondWalk(v) {
138324 v._.x = v.z + v.parent.m;

Callers

nothing calls this directly

Calls 2

executeShiftsFunction · 0.70
apportionFunction · 0.70

Tested by

no test coverage detected