diff --git a/static/diagram.js b/static/diagram.js index 183835e..5f503e2 100644 --- a/static/diagram.js +++ b/static/diagram.js @@ -333,7 +333,14 @@ var Diagrams = /** @class */ (function () { this.connections.push([A, B]); }; Diagrams.prototype.removeConnection = function (A, B) { - this.connections.splice(this.connections.indexOf([A, B]), 1); + var index = 0; + for (var _i = 0, _a = this.connections; _i < _a.length; _i++) { + var _b = _a[_i], output = _b[0], input = _b[1]; + if (output.id == A.id && input.id == B.id) { + this.connections.splice(index, 1); + } + index++; + } }; Diagrams.prototype.onresize = function () { this.fillParent(); diff --git a/static/diagram.ts b/static/diagram.ts index d4acb8b..bf98942 100644 --- a/static/diagram.ts +++ b/static/diagram.ts @@ -398,7 +398,13 @@ class Diagrams { this.connections.push([A, B]); } removeConnection(A: DiagramNode, B: DiagramNode){ - this.connections.splice(this.connections.indexOf([A, B]), 1); + let index = 0; + for (let [output, input] of this.connections){ + if (output.id == A.id && input.id == B.id) { + this.connections.splice(index, 1); + } + index++; + } } onresize(){