Added comment, clean up stub API
This commit is contained in:
10
src/link.js
10
src/link.js
@@ -4,6 +4,7 @@ import jiggle from "./jiggle";
|
||||
/**
|
||||
* Modified link force algorithm
|
||||
* - simplify calculations for parameters locked for spring model
|
||||
* - replace the use of links {} with loop. greatly reduce memory usage
|
||||
* - removed other unused functions
|
||||
* Alpha should be constant 1 for accurate simulation
|
||||
*/
|
||||
@@ -39,6 +40,7 @@ export default function(links) {
|
||||
|
||||
function initialize() {
|
||||
if (!nodes) return;
|
||||
// 0.5 to divide the force to two part for source and target node
|
||||
dataSizeFactor = 0.5/(nodes.length-1);
|
||||
initializeDistance();
|
||||
}
|
||||
@@ -57,14 +59,6 @@ export default function(links) {
|
||||
initialize();
|
||||
};
|
||||
|
||||
force.links = function(_) {
|
||||
return arguments.length ? (links = _, initialize(), force) : links;
|
||||
};
|
||||
|
||||
force.id = function(_) {
|
||||
return arguments.length ? (id = _, force) : id;
|
||||
};
|
||||
|
||||
force.iterations = function(_) {
|
||||
return arguments.length ? (iterations = +_, force) : iterations;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user