onBeforeRemoveNode method #91

Merged
merged 2 commits into from Nov 29, 2011

2 participants

@pedrofaustino

Added a onBeforeRemoveNode method which is triggered right before removing a Graph.Node.

Use case is when each ST node has an associated complex DOM element (think of an overlay panel) and when removing a node (with children) the only hook to delete the DOM elements would be the onComplete (when removal is animated), which is only fired for that specific node and not for each one of the removed nodes.

Thanks for including this change.

pedrofaustino added some commits Nov 6, 2011
@pedrofaustino pedrofaustino Added a onBeforeRemoveNode method which is triggered right before rem…
…oving a <Graph.Node>.
4d081d8
@pedrofaustino pedrofaustino - eachBFS: fixed a bug that caused an exception in case the supplied …
…node id didn't exist in the graph.

- eachLevel: added the possibility of breaking the iteration.
58b8761
@philogb philogb commented on the diff Nov 17, 2011
Source/Graph/Graph.js
@@ -1073,6 +1073,7 @@ Graph.Util = {
var queue = [graph.getNode(id)];
while(queue.length != 0) {
var node = queue.pop();
+ if (!node) return;
@philogb
Owner
philogb added a note Nov 17, 2011

Why was this check added here?

In case the user calls eachBFS with a non-existent nodeId, there's no check against the return value of getNode and so the next line will throw an error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@philogb
Owner

Thank you for contributing! :)

@philogb philogb merged commit 03417c0 into philogb:master Nov 29, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment