fixed removing of connections

This commit is contained in:
BroodjeAap 2022-09-18 13:01:22 +00:00
parent 0ebe369f7e
commit fee75e1e17
2 changed files with 15 additions and 2 deletions

View file

@ -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();

View file

@ -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(){