Skip to content

Commit

Permalink
Saving Test Images #30
Browse files Browse the repository at this point in the history
  • Loading branch information
Osama committed Jul 31, 2023
1 parent f9c7da8 commit b6af9c8
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,18 +532,14 @@ function onLoaded() {

cy.nodes().forEach(node => {
if(node.id()!= topLevelFocusParent.id() && node.parent().length == 0){
if(node.isChildless()){
node.select();

}else{
selectChildren(node);
}
var newboundingBox = cy.collection(cy.$(":selected")).boundingBox();

var newboundingBox = {w: node.width(),h:node.height(), ...node.position()};
var width = newboundingBox.w;
var height = newboundingBox.h;

componentNodes.push({id: node.id(),data:cy.$(":selected"),pos:{
x: (newboundingBox.x2 + newboundingBox.x1)/2,
y: (newboundingBox.y1 + newboundingBox.y2)/2}});
x: newboundingBox.x,
y: newboundingBox.y}});
var newNode = cyLayout.add({
group: 'nodes',
data: {
Expand All @@ -554,16 +550,16 @@ function onLoaded() {


newNode.position({
x: (newboundingBox.x2 + newboundingBox.x1)/2,
y: (newboundingBox.y1 + newboundingBox.y2)/2
x: newboundingBox.x,
y: newboundingBox.y
});

newNode.style({
'width': Math.max(width,height)+'px', // Set the new width of the node
'height': Math.max(width,height)+'px', // Set the new height of the node
'width': Math.max(width,height), // Set the new width of the node
'height': Math.max(width,height), // Set the new height of the node
'label' : document.getElementById("cbk-flag-display-node-labels").checked ? newNode.data().id : ''
});
cy.nodes().unselect();

compoundsCounter++;
}
})
Expand Down

0 comments on commit b6af9c8

Please sign in to comment.