File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -87,11 +87,12 @@ export default function() {
87
87
node . sourceLinks = [ ] ;
88
88
node . targetLinks = [ ] ;
89
89
} ) ;
90
- links . forEach ( function ( link ) {
90
+ links . forEach ( function ( link , i ) {
91
91
var source = link . source ,
92
92
target = link . target ;
93
93
if ( typeof source === "number" ) source = link . source = nodes [ link . source ] ;
94
94
if ( typeof target === "number" ) target = link . target = nodes [ link . target ] ;
95
+ link . originalIndex = i ;
95
96
source . sourceLinks . push ( link ) ;
96
97
target . targetLinks . push ( link ) ;
97
98
} ) ;
@@ -278,11 +279,11 @@ export default function() {
278
279
} ) ;
279
280
280
281
function ascendingSourceDepth ( a , b ) {
281
- return a . source . y - b . source . y ;
282
+ return ( a . source . y - b . source . y ) || ( a . originalIndex - b . originalIndex ) ;
282
283
}
283
284
284
285
function ascendingTargetDepth ( a , b ) {
285
- return a . target . y - b . target . y ;
286
+ return ( a . target . y - b . target . y ) || ( a . originalIndex - b . originalIndex ) ;
286
287
}
287
288
}
288
289
You can’t perform that action at this time.
0 commit comments