mirror of https://gitee.com/bigwinds/arangodb
Deleting nodes now works and redraws the graph, in the demo page deleting has been included
This commit is contained in:
parent
a4065dd30d
commit
60416e671a
|
@ -255,7 +255,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindDelete() {
|
function bindDelete() {
|
||||||
viewer.rebind({})
|
viewer.rebind({deleteNode: {target: "nodes", type: "click", callback: function() {console.log("Gone AWAY!");}}})
|
||||||
}
|
}
|
||||||
|
|
||||||
var viewer;
|
var viewer;
|
||||||
|
|
|
@ -203,7 +203,10 @@ function EventLibrary() {
|
||||||
nodeShaper = config.shaper;
|
nodeShaper = config.shaper;
|
||||||
|
|
||||||
return function(nodeToDelete, callback) {
|
return function(nodeToDelete, callback) {
|
||||||
adapter.deleteNode(nodeToDelete, callback);
|
adapter.deleteNode(nodeToDelete, function() {
|
||||||
|
nodeShaper.drawNodes(nodes);
|
||||||
|
callback();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,6 @@ function GraphViewer(svg, width, height,
|
||||||
throw "Events config has to be given";
|
throw "Events config has to be given";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var self = this,
|
var self = this,
|
||||||
adapter,
|
adapter,
|
||||||
nodeShaper,
|
nodeShaper,
|
||||||
|
@ -122,10 +120,14 @@ function GraphViewer(svg, width, height,
|
||||||
dispatcher.events.PATCHNODE);
|
dispatcher.events.PATCHNODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkDefs(conf.deleteNode)) {
|
if (checkDefs(conf.deleteNode)
|
||||||
|
&& checkFunction(conf.deleteNode.callback)) {
|
||||||
dispatcher.bind(conf.deleteNode.target,
|
dispatcher.bind(conf.deleteNode.target,
|
||||||
conf.deleteNode.type,
|
conf.deleteNode.type,
|
||||||
dispatcher.events.DELETENODE);
|
function(n) {
|
||||||
|
dispatcher.events.DELETENODE(n, conf.deleteNode.callback);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (conf.custom !== undefined) {
|
if (conf.custom !== undefined) {
|
||||||
_.each(conf.custom, function(toBind) {
|
_.each(conf.custom, function(toBind) {
|
||||||
|
|
Loading…
Reference in New Issue