From 1b20da23e2acff576edf82fafb3c635202aef857 Mon Sep 17 00:00:00 2001 From: Fabian Kessler Date: Sat, 20 Apr 2013 23:43:28 +0300 Subject: [PATCH] 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 ;-) --- springy.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/springy.js b/springy.js index ace5406..e9fdfff 100644 --- a/springy.js +++ b/springy.js @@ -639,7 +639,11 @@ 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; this.layout.start(function render() { t.clear(); @@ -651,7 +655,7 @@ t.layout.eachNode(function(node, point) { t.drawNode(node, point.p); }); - }); + }, done); }; Renderer.prototype.stop = function() {