diff --git a/packages/mermaid/src/diagrams/mindmap/mindmapDb.ts b/packages/mermaid/src/diagrams/mindmap/mindmapDb.ts index 71df343b6..07f945d61 100644 --- a/packages/mermaid/src/diagrams/mindmap/mindmapDb.ts +++ b/packages/mermaid/src/diagrams/mindmap/mindmapDb.ts @@ -204,7 +204,7 @@ export class MindmapDB { // For other nodes, inherit parent's section number if (node.children) { for (const [index, child] of node.children.entries()) { - const childSectionNumber = node.level === 0 ? (index % MAX_SECTIONS) - 1 : sectionNumber; + const childSectionNumber = node.level === 0 ? index % (MAX_SECTIONS - 1) : sectionNumber; this.assignSections(child, childSectionNumber); } }