function secondPass(node, totalOffset=0) {

		// Set Y position
		if (! node.isRoot()) {
			node.targetY = node.parent.targetY + LEVEL_SPACING;
		} else {
			node.targetY = 0;
		}

		// Apply the offset
		node.targetX += totalOffset;
		minX = Math.min(minX, node.targetX);

		// Tack on our offset, and recursively apply to children
		totalOffset += node.offsetX;
		node.children.forEach(child => secondPass(child, totalOffset));
	}
// Y positions. We also take this opportunity to find the leftmost node.
Y positions. We also take this opportunity to find the leftmost node.
Y positions . We also take this opportunity to find the leftmost node .
function secondPass(node, totalOffset=0) {
		if (! node.isRoot()) {
			node.targetY = node.parent.targetY + LEVEL_SPACING;
		} else {
			node.targetY = 0;
		}
		node.targetX += totalOffset;
		minX = Math.min(minX, node.targetX);
		totalOffset += node.offsetX;
		node.children.forEach(child => secondPass(child, totalOffset));
	}
function secondPass ( node , totalOffset = 0 ) { if ( ! node . isRoot ( ) ) { node . targetY = node . parent . targetY + LEVEL_SPACING ; } else { node . targetY = 0 ; } node . targetX += totalOffset ; minX = Math . min ( minX , node . targetX ) ; totalOffset += node . offsetX ; node . children . forEach ( child => secondPass ( child , totalOffset ) ) ; }
Y positions.
Y positions .
// Set Y position // Apply the offset // Tack on our offset, and recursively apply to children