diff --git a/dist/cytoscape-complexity-management.cjs.js b/dist/cytoscape-complexity-management.cjs.js index 7cd3f6a..00d10c5 100644 --- a/dist/cytoscape-complexity-management.cjs.js +++ b/dist/cytoscape-complexity-management.cjs.js @@ -1396,6 +1396,26 @@ var layoutOptions = { } }; document.getElementsByName('cbk-flag-display-node-label-pos'); + +// Function to set the label position based on the selected radio button +function setLabelPosition(position) { + var cyChildlessNodes = cy.nodes().filter(function (element) { + return element.isChildless(); + }); + var cyVisibleChildlessNodes = cyVisible.nodes().filter(function (element) { + return element.isChildless(); + }); + var cyInVisibleChildlessNodes = cyInvisible.nodes().filter(function (element) { + return element.isChildless(); + }); + var cyLayoutChildlessNodes = cyLayout.nodes().filter(function (element) { + return element.isChildless(); + }); + cyChildlessNodes.style('text-valign', position); + cyVisibleChildlessNodes.style('text-valign', position); + cyInVisibleChildlessNodes.style('text-valign', position); + cyLayoutChildlessNodes.style('text-valign', position); +} function cueUtilities(params, cy, api) { var fn = params; var CUE_POS_UPDATE_DELAY = 100; @@ -1622,7 +1642,7 @@ function cueUtilities(params, cy, api) { clearDraws(); if (document.getElementById("cbk-flag-recursive").checked) { if (document.getElementById("cbk-run-layout3").checked) { - api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked, pngImage, setLabelPosition); setTimeout(function () { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); @@ -1631,7 +1651,7 @@ function cueUtilities(params, cy, api) { } }, document.getElementById("cbk-run-layout3").checked ? 700 : 0); } else { - api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked, pngImage, setLabelPosition); setTimeout(function () { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); @@ -1642,7 +1662,7 @@ function cueUtilities(params, cy, api) { } } else { if (document.getElementById("cbk-run-layout3").checked) { - api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked, pngImage, setLabelPosition); setTimeout(function () { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); @@ -1651,7 +1671,7 @@ function cueUtilities(params, cy, api) { } }, document.getElementById("cbk-run-layout3").checked ? 700 : 0); } else { - api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked, pngImage, setLabelPosition); setTimeout(function () { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); diff --git a/dist/cytoscape-complexity-management.esm.js b/dist/cytoscape-complexity-management.esm.js index 92eaa96..8b0251d 100644 --- a/dist/cytoscape-complexity-management.esm.js +++ b/dist/cytoscape-complexity-management.esm.js @@ -1394,6 +1394,26 @@ var layoutOptions = { } }; document.getElementsByName('cbk-flag-display-node-label-pos'); + +// Function to set the label position based on the selected radio button +function setLabelPosition(position) { + var cyChildlessNodes = cy.nodes().filter(function (element) { + return element.isChildless(); + }); + var cyVisibleChildlessNodes = cyVisible.nodes().filter(function (element) { + return element.isChildless(); + }); + var cyInVisibleChildlessNodes = cyInvisible.nodes().filter(function (element) { + return element.isChildless(); + }); + var cyLayoutChildlessNodes = cyLayout.nodes().filter(function (element) { + return element.isChildless(); + }); + cyChildlessNodes.style('text-valign', position); + cyVisibleChildlessNodes.style('text-valign', position); + cyInVisibleChildlessNodes.style('text-valign', position); + cyLayoutChildlessNodes.style('text-valign', position); +} function cueUtilities(params, cy, api) { var fn = params; var CUE_POS_UPDATE_DELAY = 100; @@ -1620,7 +1640,7 @@ function cueUtilities(params, cy, api) { clearDraws(); if (document.getElementById("cbk-flag-recursive").checked) { if (document.getElementById("cbk-run-layout3").checked) { - api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked, pngImage, setLabelPosition); setTimeout(function () { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); @@ -1629,7 +1649,7 @@ function cueUtilities(params, cy, api) { } }, document.getElementById("cbk-run-layout3").checked ? 700 : 0); } else { - api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked, pngImage, setLabelPosition); setTimeout(function () { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); @@ -1640,7 +1660,7 @@ function cueUtilities(params, cy, api) { } } else { if (document.getElementById("cbk-run-layout3").checked) { - api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked, pngImage, setLabelPosition); setTimeout(function () { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); @@ -1649,7 +1669,7 @@ function cueUtilities(params, cy, api) { } }, document.getElementById("cbk-run-layout3").checked ? 700 : 0); } else { - api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked, pngImage, setLabelPosition); setTimeout(function () { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); diff --git a/dist/cytoscape-complexity-management.umd.js b/dist/cytoscape-complexity-management.umd.js index 8167b28..c7e2c82 100644 --- a/dist/cytoscape-complexity-management.umd.js +++ b/dist/cytoscape-complexity-management.umd.js @@ -5758,6 +5758,26 @@ } }; document.getElementsByName('cbk-flag-display-node-label-pos'); + + // Function to set the label position based on the selected radio button + function setLabelPosition(position) { + var cyChildlessNodes = cy.nodes().filter(function (element) { + return element.isChildless(); + }); + var cyVisibleChildlessNodes = cyVisible.nodes().filter(function (element) { + return element.isChildless(); + }); + var cyInVisibleChildlessNodes = cyInvisible.nodes().filter(function (element) { + return element.isChildless(); + }); + var cyLayoutChildlessNodes = cyLayout.nodes().filter(function (element) { + return element.isChildless(); + }); + cyChildlessNodes.style('text-valign', position); + cyVisibleChildlessNodes.style('text-valign', position); + cyInVisibleChildlessNodes.style('text-valign', position); + cyLayoutChildlessNodes.style('text-valign', position); + } function cueUtilities(params, cy, api) { var fn = params; var CUE_POS_UPDATE_DELAY = 100; @@ -5984,7 +6004,7 @@ clearDraws(); if (document.getElementById("cbk-flag-recursive").checked) { if (document.getElementById("cbk-run-layout3").checked) { - api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked, pngImage, setLabelPosition); setTimeout(function () { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); @@ -5993,7 +6013,7 @@ } }, document.getElementById("cbk-run-layout3").checked ? 700 : 0); } else { - api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked, pngImage, setLabelPosition); setTimeout(function () { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); @@ -6004,7 +6024,7 @@ } } else { if (document.getElementById("cbk-run-layout3").checked) { - api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked, pngImage, setLabelPosition); setTimeout(function () { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); @@ -6013,7 +6033,7 @@ } }, document.getElementById("cbk-run-layout3").checked ? 700 : 0); } else { - api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked, pngImage, setLabelPosition); setTimeout(function () { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); diff --git a/src/cue-utilities.js b/src/cue-utilities.js index a202fd8..54118bc 100644 --- a/src/cue-utilities.js +++ b/src/cue-utilities.js @@ -685,7 +685,8 @@ export function cueUtilities(params, cy, api) { clearDraws(); if (document.getElementById("cbk-flag-recursive").checked) { if (document.getElementById("cbk-run-layout3").checked) { - api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked); + + api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked, pngImage,setLabelPosition); setTimeout(() => { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); @@ -696,7 +697,7 @@ export function cueUtilities(params, cy, api) { }, document.getElementById("cbk-run-layout3").checked?700:0); }else{ - api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], true, document.getElementById("cbk-run-layout3").checked, pngImage,setLabelPosition); setTimeout(() => { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); @@ -709,7 +710,7 @@ export function cueUtilities(params, cy, api) { } }else{ if (document.getElementById("cbk-run-layout3").checked) { - api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked, pngImage,setLabelPosition); setTimeout(() => { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run(); @@ -719,7 +720,7 @@ export function cueUtilities(params, cy, api) { } }, document.getElementById("cbk-run-layout3").checked?700:0); }else{ - api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked); + api.expandNodes([node], false, document.getElementById("cbk-run-layout3").checked, pngImage,setLabelPosition); setTimeout(() => { if (document.getElementById("cbk-run-layout3").checked) { cy.layout(layoutOptions).run();