Skip to content

Commit f6975bb

Browse files
committed
Fix prefix in private functions.
1 parent 2c03029 commit f6975bb

3 files changed

Lines changed: 37 additions & 35 deletions

File tree

d3.layout.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,9 @@ d3.layout.tree = function() {
754754
layout = node._tree;
755755
if (children) {
756756
var n = children.length,
757-
ancestor = children[0],
757+
firstChild = children[0],
758758
previousChild,
759+
ancestor = firstChild,
759760
child,
760761
i = -1;
761762
while (++i < n) {
@@ -765,7 +766,7 @@ d3.layout.tree = function() {
765766
previousChild = child;
766767
}
767768
d3_layout_treeShift(node);
768-
var midpoint = .5 * (children[0]._tree.prelim + children[n - 1]._tree.prelim);
769+
var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
769770
if (previousSibling) {
770771
layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
771772
layout.mod = layout.prelim - midpoint;
@@ -803,9 +804,9 @@ d3.layout.tree = function() {
803804
sim = vim._tree.mod,
804805
som = vom._tree.mod,
805806
shift;
806-
while (vim = d3_tree_layoutRight(vim), vip = d3_tree_layoutLeft(vip), vim && vip) {
807-
vom = d3_tree_layoutLeft(vom);
808-
vop = d3_tree_layoutRight(vop);
807+
while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
808+
vom = d3_layout_treeLeft(vom);
809+
vop = d3_layout_treeRight(vop);
809810
vop._tree.ancestor = node;
810811
shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
811812
if (shift > 0) {
@@ -818,11 +819,11 @@ d3.layout.tree = function() {
818819
som += vom._tree.mod;
819820
sop += vop._tree.mod;
820821
}
821-
if (vim && !d3_tree_layoutRight(vop)) {
822+
if (vim && !d3_layout_treeRight(vop)) {
822823
vop._tree.thread = vim;
823824
vop._tree.mod += sim - sop;
824825
}
825-
if (vip && !d3_tree_layoutLeft(vom)) {
826+
if (vip && !d3_layout_treeLeft(vom)) {
826827
vom._tree.thread = vip;
827828
vom._tree.mod += sip - som;
828829
ancestor = node;
@@ -848,9 +849,9 @@ d3.layout.tree = function() {
848849
secondWalk(root, -root._tree.prelim);
849850

850851
// Compute the left-most, right-most, and depth-most nodes for extents.
851-
var left = d3_tree_layoutSearch(root, d3_tree_layoutLeftmost),
852-
right = d3_tree_layoutSearch(root, d3_tree_layoutRightmost),
853-
deep = d3_tree_layoutSearch(root, d3_tree_layoutDeepest),
852+
var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost),
853+
right = d3_layout_treeSearch(root, d3_layout_treeRightmost),
854+
deep = d3_layout_treeSearch(root, d3_layout_treeDeepest),
854855
x0 = left.x - separation(left, right) / 2,
855856
x1 = right.x + separation(right, left) / 2,
856857
y1 = deep.depth;
@@ -891,38 +892,38 @@ function d3_layout_treeSeparation(a, b) {
891892
// return (a.parent == b.parent ? 1 : 2) / a.depth;
892893
// }
893894

894-
function d3_tree_layoutLeft(node) {
895+
function d3_layout_treeLeft(node) {
895896
return node.children ? node.children[0] : node._tree.thread;
896897
}
897898

898-
function d3_tree_layoutRight(node) {
899+
function d3_layout_treeRight(node) {
899900
return node.children ? node.children[node.children.length - 1] : node._tree.thread;
900901
}
901902

902-
function d3_tree_layoutSearch(node, compare) {
903+
function d3_layout_treeSearch(node, compare) {
903904
var children = node.children;
904905
if (children) {
905906
var child,
906907
n = children.length,
907908
i = -1;
908909
while (++i < n) {
909-
if (compare(child = d3_tree_layoutSearch(children[i], compare), node) > 0) {
910+
if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
910911
node = child;
911912
}
912913
}
913914
}
914915
return node;
915916
}
916917

917-
function d3_tree_layoutRightmost(a, b) {
918+
function d3_layout_treeRightmost(a, b) {
918919
return a.x - b.x;
919920
}
920921

921-
function d3_tree_layoutLeftmost(a, b) {
922+
function d3_layout_treeLeftmost(a, b) {
922923
return b.x - a.x;
923924
}
924925

925-
function d3_tree_layoutDeepest(a, b) {
926+
function d3_layout_treeDeepest(a, b) {
926927
return a.depth - b.depth;
927928
}
928929

0 commit comments

Comments
 (0)