|
|
|
@ -8,12 +8,40 @@ function findLogique(logiqueId) {
|
|
|
|
|
return elem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function giveSwitchYWithLineId(lineId){
|
|
|
|
|
var elementY = null;
|
|
|
|
|
switchsInfoCopy.forEach(function(element){
|
|
|
|
|
if(stage.findOne("#"+element.id).id3 == lineId){
|
|
|
|
|
elementY = (element.y);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return elementY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function removeLineFromSwitch(lineId){
|
|
|
|
|
switchsInfoCopy.forEach(function(element){
|
|
|
|
|
if(stage.findOne("#"+element.id).id3 == lineId){
|
|
|
|
|
stage.findOne("#"+element.id).id3 = null;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function removeLine(lineId){
|
|
|
|
|
//remove from switch
|
|
|
|
|
removeLineFromSwitch(lineId);
|
|
|
|
|
let line = stage.findOne("#" + lineId);
|
|
|
|
|
line.destroy();
|
|
|
|
|
line = stage.findOne("#" + lineId);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function giveLineId(logiqueId,entre) {
|
|
|
|
|
var newEntre = entre;
|
|
|
|
|
isSwitch = false;
|
|
|
|
|
if(entre.id !== undefined){
|
|
|
|
|
switchsInfoCopy.forEach(function(element){
|
|
|
|
|
if(entre.id() == element.id){
|
|
|
|
|
|
|
|
|
|
isSwitch = true;
|
|
|
|
|
newEntre = element;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -30,10 +58,14 @@ function giveLineId(logiqueId,entre) {
|
|
|
|
|
if (logique.id1 == null) {
|
|
|
|
|
lineId = "id1";
|
|
|
|
|
} else if (logique.id2 == null) {
|
|
|
|
|
lineId = "id2";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isSwitch){
|
|
|
|
|
if(giveSwitchYWithLineId(logique.id1) > entre.getY()){
|
|
|
|
|
lineRemove.push([entre, "switch"]);
|
|
|
|
|
}else{
|
|
|
|
|
lineId = "id2";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if (logique.type === "inv") {
|
|
|
|
|