Skip to content

Commit

Permalink
fix: Reimplement notes in namespaces for classRenderer-v3 (#5880)
Browse files Browse the repository at this point in the history
  • Loading branch information
kairi003 committed Nov 9, 2024
1 parent 02d368d commit 309ff6b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/mermaid/src/diagrams/class/classDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const lookUpDomId = function (_id: string): string {
export const clear = function () {
relations = [];
classes = new Map();
notes = [];
notes = new Map<string, ClassNote>();
interfaces = [];
functions = [];
functions.push(setupToolTips);
Expand Down Expand Up @@ -629,9 +629,7 @@ export const getData = () => {
}
}

let cnt = 0;
for (const note of notes) {
cnt++;
for (const note of notes.values()) {
const noteNode: Node = {
id: note.id,
label: note.text,
Expand All @@ -645,14 +643,15 @@ export const getData = () => {
`stroke: ${config.themeVariables.noteBorderColor}`,
],
look: config.look,
parentId: note.parent,
};
nodes.push(noteNode);

const noteClassId = classes.get(note.class)?.id ?? '';
const noteClassId = classes.get(note.class)?.id;

if (noteClassId) {
const edge: Edge = {
id: `edgeNote${cnt}`,
id: `edgeNote${note.index}`,
start: note.id,
end: noteClassId,
type: 'normal',
Expand Down Expand Up @@ -682,7 +681,7 @@ export const getData = () => {
nodes.push(interfaceNode);
}

cnt = 0;
let cnt = 0;
for (const classRelation of relations) {
cnt++;
const edge: Edge = {
Expand Down

0 comments on commit 309ff6b

Please sign in to comment.