added done callback to renderer start method.

The done callback existed in the ForceDirected layout start method, but no one passed that in. Maybe I don't understand how it's meant to be used? Or something was lost on the way with refactorings in springy? Anyway, with this change it's possible to call the Springy.Renderer start() method with a done callback. Please accept it, or document how it's meant to be used. Thanks ;-)
This commit is contained in:
Fabian Kessler 2013-04-20 23:43:28 +03:00
parent 143d2d4c41
commit 1b20da23e2

View File

@ -639,7 +639,11 @@
this.start(); this.start();
}; };
Renderer.prototype.start = function() { /**
* @param done An optional callback function that gets executed when the springy algorithm stops,
* either because it ended or because stop() was called.
*/
Renderer.prototype.start = function(done) {
var t = this; var t = this;
this.layout.start(function render() { this.layout.start(function render() {
t.clear(); t.clear();
@ -651,7 +655,7 @@
t.layout.eachNode(function(node, point) { t.layout.eachNode(function(node, point) {
t.drawNode(node, point.p); t.drawNode(node, point.p);
}); });
}); }, done);
}; };
Renderer.prototype.stop = function() { Renderer.prototype.stop = function() {