From 9e855bc6b49e9f812362676e3ab8e0d966f3e7b6 Mon Sep 17 00:00:00 2001 From: osamazafar980 Date: Thu, 12 Oct 2023 18:02:21 -0400 Subject: [PATCH] No layout after operation does not work #32 --- dist/cytoscape-complexity-management.cjs.js | 35 ++++++++++----------- dist/cytoscape-complexity-management.esm.js | 35 ++++++++++----------- dist/cytoscape-complexity-management.umd.js | 35 ++++++++++----------- src/complexity-management.js | 34 +++++++++++--------- 4 files changed, 70 insertions(+), 69 deletions(-) diff --git a/dist/cytoscape-complexity-management.cjs.js b/dist/cytoscape-complexity-management.cjs.js index 589c735..7cd3f6a 100644 --- a/dist/cytoscape-complexity-management.cjs.js +++ b/dist/cytoscape-complexity-management.cjs.js @@ -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' @@ -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({ @@ -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() }); } }); @@ -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); @@ -832,7 +836,8 @@ 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({ @@ -840,7 +845,8 @@ function complexityManagement(cy) { 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({ @@ -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; diff --git a/dist/cytoscape-complexity-management.esm.js b/dist/cytoscape-complexity-management.esm.js index 966bd9a..92eaa96 100644 --- a/dist/cytoscape-complexity-management.esm.js +++ b/dist/cytoscape-complexity-management.esm.js @@ -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' @@ -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({ @@ -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() }); } }); @@ -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); @@ -830,7 +834,8 @@ 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({ @@ -838,7 +843,8 @@ function complexityManagement(cy) { 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({ @@ -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; diff --git a/dist/cytoscape-complexity-management.umd.js b/dist/cytoscape-complexity-management.umd.js index 2123bda..8167b28 100644 --- a/dist/cytoscape-complexity-management.umd.js +++ b/dist/cytoscape-complexity-management.umd.js @@ -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' @@ -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({ @@ -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() }); } }); @@ -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); @@ -5194,7 +5198,8 @@ 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({ @@ -5202,7 +5207,8 @@ 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({ @@ -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; diff --git a/src/complexity-management.js b/src/complexity-management.js index b55f391..00951f9 100644 --- a/src/complexity-management.js +++ b/src/complexity-management.js @@ -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 = []; @@ -811,7 +813,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() + }); }else{ savedNodes.push({ @@ -819,7 +823,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() + }) } }) @@ -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); @@ -852,7 +860,9 @@ 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){ @@ -860,7 +870,9 @@ export function complexityManagement(cy) { 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({ @@ -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();