Skip to content

Commit

Permalink
No layout after operation does not work #32
Browse files Browse the repository at this point in the history
  • Loading branch information
osamazafar980 committed Oct 12, 2023
1 parent 4865b78 commit 9e855bc
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 69 deletions.
35 changes: 17 additions & 18 deletions dist/cytoscape-complexity-management.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,8 @@ function complexityManagement(cy) {
id: focusID,
parent: null,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? focusID : ''
}
},
position: cyInvisible.getElementById(focusID).position()
});
fNode.style({
'background-color': '#CCE1F9'
Expand All @@ -793,7 +794,8 @@ function complexityManagement(cy) {
id: node.ID,
parent: node.owner.parent.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? node.ID : ''
}
},
position: cyInvisible.getElementById(node.ID).position()
});
} else {
savedNodes.push({
Expand All @@ -802,7 +804,8 @@ function complexityManagement(cy) {
id: node.ID,
parent: node.owner.parent.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? node.ID : ''
}
},
position: cyInvisible.getElementById(node.ID).position()
});
}
});
Expand All @@ -817,7 +820,8 @@ function complexityManagement(cy) {
id: node.ID,
parent: node.owner.parent.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? node.ID : ''
}
},
position: cyInvisible.getElementById(node.ID).position()
});
} catch (e) {
console.log(e);
Expand All @@ -832,15 +836,17 @@ function complexityManagement(cy) {
data: {
id: edge.source.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? edge.source.ID : ''
}
},
position: cyInvisible.getElementById(edge.source.ID).position()
});
} else if (cyLayout.getElementById(edge.target.ID).length == 0) {
cyLayout.add({
group: 'nodes',
data: {
id: edge.target.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? edge.target.ID : ''
}
},
position: cyInvisible.getElementById(edge.target.ID).position()
});
}
cyLayout.add({
Expand All @@ -853,18 +859,11 @@ function complexityManagement(cy) {
});
} catch (e) {}
});
while (true) {
try {
cyLayout.layout({
name: 'fcose',
animate: false
}).run();
break;
} catch (e) {
console.log(e);
break;
}
}
cyLayout.layout({
name: 'fcose',
randomize: false,
animate: false
}).run();
var boundingBox = cyLayout.getElementById(focusID).boundingBox();
var focusNodeWidth = boundingBox.w;
var fcousNodeHeight = boundingBox.h;
Expand Down
35 changes: 17 additions & 18 deletions dist/cytoscape-complexity-management.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,8 @@ function complexityManagement(cy) {
id: focusID,
parent: null,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? focusID : ''
}
},
position: cyInvisible.getElementById(focusID).position()
});
fNode.style({
'background-color': '#CCE1F9'
Expand All @@ -791,7 +792,8 @@ function complexityManagement(cy) {
id: node.ID,
parent: node.owner.parent.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? node.ID : ''
}
},
position: cyInvisible.getElementById(node.ID).position()
});
} else {
savedNodes.push({
Expand All @@ -800,7 +802,8 @@ function complexityManagement(cy) {
id: node.ID,
parent: node.owner.parent.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? node.ID : ''
}
},
position: cyInvisible.getElementById(node.ID).position()
});
}
});
Expand All @@ -815,7 +818,8 @@ function complexityManagement(cy) {
id: node.ID,
parent: node.owner.parent.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? node.ID : ''
}
},
position: cyInvisible.getElementById(node.ID).position()
});
} catch (e) {
console.log(e);
Expand All @@ -830,15 +834,17 @@ function complexityManagement(cy) {
data: {
id: edge.source.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? edge.source.ID : ''
}
},
position: cyInvisible.getElementById(edge.source.ID).position()
});
} else if (cyLayout.getElementById(edge.target.ID).length == 0) {
cyLayout.add({
group: 'nodes',
data: {
id: edge.target.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? edge.target.ID : ''
}
},
position: cyInvisible.getElementById(edge.target.ID).position()
});
}
cyLayout.add({
Expand All @@ -851,18 +857,11 @@ function complexityManagement(cy) {
});
} catch (e) {}
});
while (true) {
try {
cyLayout.layout({
name: 'fcose',
animate: false
}).run();
break;
} catch (e) {
console.log(e);
break;
}
}
cyLayout.layout({
name: 'fcose',
randomize: false,
animate: false
}).run();
var boundingBox = cyLayout.getElementById(focusID).boundingBox();
var focusNodeWidth = boundingBox.w;
var fcousNodeHeight = boundingBox.h;
Expand Down
35 changes: 17 additions & 18 deletions dist/cytoscape-complexity-management.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -5141,7 +5141,8 @@
id: focusID,
parent: null,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? focusID : ''
}
},
position: cyInvisible.getElementById(focusID).position()
});
fNode.style({
'background-color': '#CCE1F9'
Expand All @@ -5155,7 +5156,8 @@
id: node.ID,
parent: node.owner.parent.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? node.ID : ''
}
},
position: cyInvisible.getElementById(node.ID).position()
});
} else {
savedNodes.push({
Expand All @@ -5164,7 +5166,8 @@
id: node.ID,
parent: node.owner.parent.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? node.ID : ''
}
},
position: cyInvisible.getElementById(node.ID).position()
});
}
});
Expand All @@ -5179,7 +5182,8 @@
id: node.ID,
parent: node.owner.parent.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? node.ID : ''
}
},
position: cyInvisible.getElementById(node.ID).position()
});
} catch (e) {
console.log(e);
Expand All @@ -5194,15 +5198,17 @@
data: {
id: edge.source.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? edge.source.ID : ''
}
},
position: cyInvisible.getElementById(edge.source.ID).position()
});
} else if (cyLayout.getElementById(edge.target.ID).length == 0) {
cyLayout.add({
group: 'nodes',
data: {
id: edge.target.ID,
'label': document.getElementById("cbk-flag-display-node-labels").checked ? edge.target.ID : ''
}
},
position: cyInvisible.getElementById(edge.target.ID).position()
});
}
cyLayout.add({
Expand All @@ -5215,18 +5221,11 @@
});
} catch (e) {}
});
while (true) {
try {
cyLayout.layout({
name: 'fcose',
animate: false
}).run();
break;
} catch (e) {
console.log(e);
break;
}
}
cyLayout.layout({
name: 'fcose',
randomize: false,
animate: false
}).run();
var boundingBox = cyLayout.getElementById(focusID).boundingBox();
var focusNodeWidth = boundingBox.w;
var fcousNodeHeight = boundingBox.h;
Expand Down
34 changes: 19 additions & 15 deletions src/complexity-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,9 @@ export function complexityManagement(cy) {
data: { id: focusID,
parent: null,
'label' : document.getElementById("cbk-flag-display-node-labels").checked ? focusID : ''
}}
},
position: cyInvisible.getElementById(focusID).position()
}
)
fNode.style({'background-color': '#CCE1F9',})
let savedNodes = [];
Expand All @@ -811,15 +813,19 @@ export function complexityManagement(cy) {
data: { id: node.ID,
parent: node.owner.parent.ID,
'label' : document.getElementById("cbk-flag-display-node-labels").checked ? node.ID : ''
}});
},
position: cyInvisible.getElementById(node.ID).position()
});

}else{
savedNodes.push({
group: 'nodes',
data: { id: node.ID,
parent: node.owner.parent.ID,
'label' : document.getElementById("cbk-flag-display-node-labels").checked ? node.ID : ''
}})
},
position: cyInvisible.getElementById(node.ID).position()
})
}

})
Expand All @@ -835,7 +841,9 @@ export function complexityManagement(cy) {
data: { id: node.ID,
parent: node.owner.parent.ID,
'label' : document.getElementById("cbk-flag-display-node-labels").checked ? node.ID : ''
}});
},
position: cyInvisible.getElementById(node.ID).position()
});

}catch(e){
console.log(e);
Expand All @@ -852,15 +860,19 @@ export function complexityManagement(cy) {
group: 'nodes',
data: { id: edge.source.ID,
'label' : document.getElementById("cbk-flag-display-node-labels").checked ? edge.source.ID : ''
}});
},
position: cyInvisible.getElementById(edge.source.ID).position()
});

}else if(cyLayout.getElementById(edge.target.ID).length == 0){

cyLayout.add({
group: 'nodes',
data: { id: edge.target.ID,
'label' : document.getElementById("cbk-flag-display-node-labels").checked ? edge.target.ID : ''
}});
},
position: cyInvisible.getElementById(edge.target.ID).position()
});

}
cyLayout.add({
Expand All @@ -876,15 +888,7 @@ export function complexityManagement(cy) {
}
})

while(true){
try{
cyLayout.layout({name: 'fcose', animate: false}).run();
break;
}catch(e){
console.log(e)
break;
}
}
cyLayout.layout({name: 'fcose', randomize: false, animate: false}).run();


const boundingBox = cyLayout.getElementById(focusID).boundingBox();
Expand Down

0 comments on commit 9e855bc

Please sign in to comment.