Skip to content

Commit

Permalink
Revert "Split cytoscape"
Browse files Browse the repository at this point in the history
This reverts commit f81f9f7.
  • Loading branch information
sidharthv96 committed Feb 28, 2023
1 parent f8f7d94 commit b8b8c47
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions packages/mermaid/src/diagrams/mindmap/mindmapRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ import { log } from '../../logger';
import { getConfig } from '../../config';
import { setupGraphViewbox } from '../../setupGraphViewbox';
import svgDraw from './svgDraw';
import cytoscape from 'cytoscape';
import coseBilkent from 'cytoscape-cose-bilkent';
import * as db from './mindmapDb';

let cytoscape;
// Inject the layout algorithm into cytoscape
cytoscape.use(coseBilkent);

/**
* @param {any} svg The svg element to draw the diagram onto
* @param {object} mindmap The mindmap data and hierarchy
Expand Down Expand Up @@ -89,14 +93,7 @@ function addNodes(mindmap, cy, conf, level) {
* @param conf
* @param cy
*/
async function layoutMindmap(node, conf) {
if (!cytoscape) {
cytoscape = (await import('cytoscape')).default;
const coseBilkent = (await import('cytoscape-cose-bilkent')).default;
// Inject the layout algorithm into cytoscape
cytoscape.use(coseBilkent);
}

function layoutMindmap(node, conf) {
return new Promise((resolve) => {
// Add temporary render element
const renderEl = select('body').append('div').attr('id', 'cy').attr('style', 'display:none');
Expand Down

0 comments on commit b8b8c47

Please sign in to comment.