mirror of
				https://github.com/mermaid-js/mermaid.git
				synced 2025-11-03 20:34:20 +01:00 
			
		
		
		
	#448 Fix for root nodes without children
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "@mermaid-js/mermaid-mindmap",
 | 
			
		||||
  "version": "9.2.0-rc2",
 | 
			
		||||
  "version": "9.2.0-rc3",
 | 
			
		||||
  "description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
 | 
			
		||||
  "main": "dist/mermaid-mindmap.core.mjs",
 | 
			
		||||
  "module": "dist/mermaid-mindmap.core.mjs",
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ function drawNodes(svg, mindmap, section, conf) {
 | 
			
		||||
 * @param cy
 | 
			
		||||
 */
 | 
			
		||||
function drawEdges(edgesEl, cy) {
 | 
			
		||||
  cy.edges().map((edge, id) => {
 | 
			
		||||
  cy?.edges().map((edge, id) => {
 | 
			
		||||
    const data = edge.data();
 | 
			
		||||
    if (edge[0]._private.bodyBounds) {
 | 
			
		||||
      const bounds = edge[0]._private.rscratch;
 | 
			
		||||
@@ -100,9 +100,10 @@ function addNodes(mindmap, cy, conf, level) {
 | 
			
		||||
 */
 | 
			
		||||
function layoutMindmap(node, conf) {
 | 
			
		||||
  return new Promise((resolve) => {
 | 
			
		||||
    if (node.children.length === 0) {
 | 
			
		||||
      return node;
 | 
			
		||||
    }
 | 
			
		||||
    // if (node.children.length === 0) {
 | 
			
		||||
    //   resolve(node);
 | 
			
		||||
    //   return;
 | 
			
		||||
    // }
 | 
			
		||||
 | 
			
		||||
    // Add temporary render element
 | 
			
		||||
    const renderEl = select('body').append('div').attr('id', 'cy').attr('style', 'display:none');
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user