@@ -149,14 +149,14 @@ module.exports = function() {
149
149
y1a = d . target . y + d . ty ,
150
150
y1b = y1a + d . dy ;
151
151
return 'M' + x0 + ',' + y0a +
152
- 'C' + x2 + ',' + y0a +
153
- ' ' + x3 + ',' + y1a +
154
- ' ' + x1 + ',' + y1a +
155
- 'L' + x1 + ',' + y1b +
156
- 'C' + x3 + ',' + y1b +
157
- ' ' + x2 + ',' + y0b +
158
- ' ' + x0 + ',' + y0b +
159
- 'Z' ;
152
+ 'C' + x2 + ',' + y0a +
153
+ ' ' + x3 + ',' + y1a +
154
+ ' ' + x1 + ',' + y1a +
155
+ 'L' + x1 + ',' + y1b +
156
+ 'C' + x3 + ',' + y1b +
157
+ ' ' + x2 + ',' + y0b +
158
+ ' ' + x0 + ',' + y0b +
159
+ 'Z' ;
160
160
}
161
161
162
162
link . curvature = function ( _ ) {
@@ -168,8 +168,8 @@ module.exports = function() {
168
168
return link ;
169
169
} ;
170
170
171
- // Populate the sourceLinks and targetLinks for each node.
172
- // Also, if the source and target are not objects, assume they are indices.
171
+ // Populate the sourceLinks and targetLinks for each node.
172
+ // Also, if the source and target are not objects, assume they are indices.
173
173
function computeNodeLinks ( ) {
174
174
nodes . forEach ( function ( node ) {
175
175
node . sourceLinks = [ ] ;
@@ -186,7 +186,7 @@ module.exports = function() {
186
186
} ) ;
187
187
}
188
188
189
- // Compute the value (size) of each node by summing the associated links.
189
+ // Compute the value (size) of each node by summing the associated links.
190
190
function computeNodeValues ( ) {
191
191
nodes . forEach ( function ( node ) {
192
192
node . value = Math . max (
@@ -196,10 +196,10 @@ module.exports = function() {
196
196
} ) ;
197
197
}
198
198
199
- // Iteratively assign the breadth (x-position) for each node.
200
- // Nodes are assigned the maximum breadth of incoming neighbors plus one;
201
- // nodes with no incoming links are assigned breadth zero, while
202
- // nodes with no outgoing links are assigned the maximum breadth.
199
+ // Iteratively assign the breadth (x-position) for each node.
200
+ // Nodes are assigned the maximum breadth of incoming neighbors plus one;
201
+ // nodes with no incoming links are assigned breadth zero, while
202
+ // nodes with no outgoing links are assigned the maximum breadth.
203
203
function computeNodeDepths ( ) {
204
204
var remainingNodes = nodes ,
205
205
nextNodes ,
@@ -228,14 +228,6 @@ module.exports = function() {
228
228
scaleNodeBreadths ( ( size [ 0 ] - dx ) / ( x - 1 ) ) ;
229
229
}
230
230
231
- // function moveSourcesRight() {
232
- // nodes.forEach(function(node) {
233
- // if (!node.targetLinks.length) {
234
- // node.x = min(node.sourceLinks, function(d) { return d.target.x; }) - 1;
235
- // }
236
- // });
237
- // }
238
-
239
231
function moveSinksRight ( x ) {
240
232
nodes . forEach ( function ( node ) {
241
233
if ( ! node . sourceLinks . length ) {
@@ -258,7 +250,7 @@ module.exports = function() {
258
250
. entries ( nodes )
259
251
. map ( function ( d ) { return d . values ; } ) ;
260
252
261
- //
253
+ //
262
254
initializeNodeDepth ( ) ;
263
255
resolveCollisions ( ) ;
264
256
for ( var alpha = 1 ; iterations > 0 ; -- iterations ) {
@@ -320,7 +312,7 @@ module.exports = function() {
320
312
n = nodes . length ,
321
313
i ;
322
314
323
- // Push any overlapping nodes down.
315
+ // Push any overlapping nodes down.
324
316
nodes . sort ( ascendingDepth ) ;
325
317
for ( i = 0 ; i < n ; ++ i ) {
326
318
node = nodes [ i ] ;
@@ -329,12 +321,12 @@ module.exports = function() {
329
321
y0 = node . y + node . dy + py ;
330
322
}
331
323
332
- // If the bottommost node goes outside the bounds, push it back up.
324
+ // If the bottommost node goes outside the bounds, push it back up.
333
325
dy = y0 - py - size [ 1 ] ;
334
326
if ( dy > 0 ) {
335
327
y0 = node . y -= dy ;
336
328
337
- // Push any overlapping nodes back up.
329
+ // Push any overlapping nodes back up.
338
330
for ( i = n - 2 ; i >= 0 ; -- i ) {
339
331
node = nodes [ i ] ;
340
332
dy = node . y + node . dy + py - y0 ;
0 commit comments