diff --git a/src/client/components/network-editor/controller.js b/src/client/components/network-editor/controller.js index 9878a0ed..8f5024ea 100644 --- a/src/client/components/network-editor/controller.js +++ b/src/client/components/network-editor/controller.js @@ -18,18 +18,6 @@ export const DEFAULT_LAYOUT_OPTIONS = { }; -// Keys for scratch data -export const Scratch = { - // boolean flag indicating if the expand/collapse layout is currently running, attached to parent nodes - LAYOUT_RUNNING: '_layoutRunning', - // BubblePath instance, attached to parent nodes - BUBBLE: '_bubble', - // The HTML element for the expand/collapse toggle buttons, attached to parent nodes - TOGGLE_BUTTON_ELEM: '_buttonElem', - AUTOMOVE_RULE: '_automoveRule' -}; - - /** * The network editor controller contains all high-level model operations that the network * editor view can perform. @@ -222,37 +210,10 @@ export class NetworkEditorController { }); } - // _computeFCOSEidealEdgeLengthMap(clusterLabels, clusterAttr) { - // const idealLength = size => { - // switch(true) { - // case size < 10: return 40; - // case size < 20: return 75; - // case size < 30: return 120; - // case size < 40: return 180; - // default: return 250; - // } - // }; - - // const edgeLengthMap = new Map(); - - // clusterLabels.forEach(({ clusterId }) => { - // const cluster = this.cy.elements(`node[${clusterAttr}="${clusterId}"]`); - // if(!cluster.empty()) { - // const ideal = idealLength(cluster.size()); - // cluster.internalEdges().forEach(edge => { - // edgeLengthMap.set(edge.data('id'), ideal); - // }); - // } - // }); - - // return edgeLengthMap; - // } - - - async applyLayout(options) { + async applyLayout(eles, options) { const { cy } = this; - await this._applyLayoutToEles(cy.elements(), options); + await this._applyLayoutToEles(eles || cy.elements(), options || DEFAULT_LAYOUT_OPTIONS); cy.fit(DEFAULT_PADDING); } @@ -280,16 +241,6 @@ export class NetworkEditorController { cy.minZoom(-1e50); cy.maxZoom(1e50); - // const idealLengths = this._computeFCOSEidealEdgeLengthMap(clusterLabels, clusterAttr); - - // const options = { - // name: 'fcose', - // animate: false, - // // idealEdgeLength: edge => idealLengths.get(edge.data('id')) || 50, - // nodeRepulsion: 100000 - // }; - options = options || DEFAULT_LAYOUT_OPTIONS; - const allNodes = eles.nodes(); const disconnectedNodes = allNodes.filter(n => n.degree() === 0); // careful, our compound nodes have degree 0 const connectedNodes = allNodes.not(disconnectedNodes); @@ -599,17 +550,17 @@ export class NetworkEditorController { } - /** - * Delete the selected (i.e. :selected) elements in the graph - */ - deleteSelectedNodes() { - let selectedNodes = this.cy.nodes(':selected'); - selectedNodes = selectedNodes.filter(n => n.children().empty()); // Filter out parent nodes - if (!selectedNodes.empty()) { - const deletedNodes = selectedNodes.remove(); - this.bus.emit('deletedSelectedNodes', deletedNodes); - } - } + // /** + // * Delete the selected (i.e. :selected) elements in the graph + // */ + // deleteSelectedNodes() { + // let selectedNodes = this.cy.nodes(':selected'); + // selectedNodes = selectedNodes.filter(n => n.children().empty()); // Filter out parent nodes + // if (!selectedNodes.empty()) { + // const deletedNodes = selectedNodes.remove(); + // this.bus.emit('deletedSelectedNodes', deletedNodes); + // } + // } /** * @param {boolean} isQuery if `true`, the returned list will contain only query genes diff --git a/src/client/components/network-editor/main.js b/src/client/components/network-editor/main.js index 21d24f02..3692d878 100644 --- a/src/client/components/network-editor/main.js +++ b/src/client/components/network-editor/main.js @@ -30,10 +30,6 @@ import UndoIcon from '@mui/icons-material/Undo'; import RestoreIcon from '@mui/icons-material/SettingsBackupRestore'; import KeyboardReturnIcon from '@mui/icons-material/KeyboardReturn'; import { DragSelectIcon, DownloadIcon, ShareIcon } from '../svg-icons'; -import ConcentricLayoutIcon from '@mui/icons-material/Adjust'; -import LayeredLayoutIcon from '@mui/icons-material/FormatAlignCenter'; -import ClustersLayoutIcon from '@mui/icons-material/WorkspacesOutlined'; -import PhysicsLayoutIcon from '@mui/icons-material/Grain'; const useStyles = makeStyles((theme) => ({ @@ -275,9 +271,6 @@ const Main = ({ const shiftXCy = openLeftDrawer && !isMobile && !isTablet; const shiftYCy = openBottomDrawer; - const handleNetworkRestore = () => { - setConfirmDialogOpen(true); - }; const onConfirmCancel = () => { setConfirmDialogOpen(false); }; @@ -360,50 +353,8 @@ const Main = ({ { title: "Apply Network Layout", icon: , - onClick: handleNetworkRestore, + onClick: () => controller.applyLayout(), unrelated: true, - subMenu: [ - { - title: "Layered - Circle", - icon: , - onClick: () => controller.applyLayout({ name: 'breadthfirst', circle: true }), - }, - { - title: "Layered - Top Down", - icon: , - onClick: () => controller.applyLayout({ name: 'breadthfirst', circle: false, grid: false }), - }, - { - title: "Concentric", - icon: , - onClick: () => controller.applyLayout({ name: 'concentric' }), - }, - { - title: "Clusters", - icon: , - onClick: () => controller.applyLayout({ name: 'cise', clusters: createClusterArrays() }), - }, - { - title: "Physics Simulation", - icon: , - onClick: () => controller.applyLayout({ - name: 'euler', - animate: false, - mass: (n) => n.data('regulatoryFunction') === 'regulator' ? 480 : 12, - springLength: () => 120, - }), - }, - // { - // title: "CoSE", - // icon: , - // onClick: () => controller.applyLayout({ name: 'cose', animate: false, nodeRepulsion: 100000 }), - // }, - // { - // title: "Cola", - // icon: , - // onClick: () => controller.applyLayout({ name: 'cola', animate: false }), - // }, - ], }, { title: "Download Data and Images", icon: ,