Adding missing id

This commit is contained in:
Knut Sveidqvist
2024-03-14 16:01:46 +01:00
parent 51b1216a46
commit ec4f0120ef
3 changed files with 7 additions and 4 deletions

View File

@@ -67,6 +67,7 @@
sequenceDiagram
Alice->>+John: Hello John, how are you?
Alice->>+John: John, can you hear me?
note right of Alice: John thinks\nabout it
John-->>-Alice: Hi Alice, I can hear you!
John-->>-Alice: I feel great!

View File

@@ -1,6 +1,6 @@
{
"name": "@mermaid-chart/mermaid",
"version": "10.9.0-b.2",
"version": "10.9.0-b.3",
"description": "Markdown-ish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
"type": "module",
"module": "./dist/mermaid.core.mjs",

View File

@@ -237,7 +237,8 @@ interface NoteModel {
* @param elem - The diagram to draw to.
* @param noteModel - Note model options.
*/
const drawNote = async function (elem: any, noteModel: NoteModel) {
const drawNote = async function (elem: any, noteModel: NoteModel, id: string) {
console.log('drawNote', noteModel);
bounds.bumpVerticalPos(conf.boxMargin);
noteModel.height = conf.boxMargin;
noteModel.starty = bounds.getVerticalPos();
@@ -249,7 +250,7 @@ const drawNote = async function (elem: any, noteModel: NoteModel) {
const g = elem.append('g');
g.attr('data-et', 'note');
g.attr('data-id', 'i' + noteModel.id);
g.attr('data-id', 'i' + id);
const rectElem = svgDraw.drawRect(g, rect);
const textObj = svgDrawCommon.getTextObj();
textObj.x = noteModel.startx;
@@ -854,9 +855,10 @@ export const draw = async function (_text: string, id: string, _version: string,
switch (msg.type) {
case diagObj.db.LINETYPE.NOTE:
console.log('Message', msg);
bounds.resetVerticalPos();
noteModel = msg.noteModel;
await drawNote(diagram, noteModel);
await drawNote(diagram, noteModel, msg.id);
break;
case diagObj.db.LINETYPE.ACTIVE_START:
bounds.newActivation(msg, diagram, actors);