summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/model/graph.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/model/graph.js b/scripts/model/graph.js
index 4b4b0069..b41c6bb6 100644
--- a/scripts/model/graph.js
+++ b/scripts/model/graph.js
@@ -385,6 +385,26 @@ function Graph(el) {
}
}
+ this.removeLink = function(link) {
+ var link,
+ i;
+
+ for ( i = 0 ; i < links.length; ++i ) {
+ if (link.id !== undefined) {
+ if (link.id === links[i].id) {
+ links.splice(i, 1);
+ return;
+ }
+ } else {
+ if (link.sourceId === links[i].sourceId && link.targetId === links[i].targetId) {
+ links.splice(i, 1);
+ return;
+ }
+ }
+ }
+ console.log('bug: attempt to remove non existant link');
+ }
+
this.removeLinks = function(state) {
var id = null;
var ls = findLinks(state);