added id to notes
This commit is contained in:
		| @@ -382,7 +382,7 @@ | ||||
|   } | ||||
| }) | ||||
|  | ||||
| #let render(participants, elements) = context canvas(length: 1pt, { | ||||
| #let render(participants, elements, notes) = context canvas(length: 1pt, { | ||||
|   setup-ctx(participants, elements) | ||||
|    | ||||
|   // Draw participants (start) | ||||
|   | ||||
| @@ -126,6 +126,7 @@ | ||||
|     "linked", | ||||
|     note.pos == none and note.side != "across" | ||||
|   ) | ||||
|   note.insert("id", ctx.notes.len()) | ||||
|   let names = ctx.participants.map(p => p.name) | ||||
|   if note.pos == none and note.side != "across" { | ||||
|     let i1 = names.position(n => n == ctx.last-seq.p1) | ||||
| @@ -186,6 +187,8 @@ | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   ctx.notes.push(note) | ||||
|  | ||||
|   ctx.elmts.at(ctx.i) = note | ||||
|  | ||||
|   ctx.last-note = ( | ||||
| @@ -226,6 +229,7 @@ | ||||
|     linked: (), | ||||
|     last-seq: none, | ||||
|     last-note: none, | ||||
|     notes: (), | ||||
|     participants: (), | ||||
|     elmts: elmts, | ||||
|     i: 0 | ||||
| @@ -290,10 +294,10 @@ | ||||
|     ).first()) | ||||
|   } | ||||
|  | ||||
|   return (ctx.elmts, participants) | ||||
|   return (ctx.elmts, participants, ctx.notes) | ||||
| } | ||||
|  | ||||
| #let finalize-setup(elmts, participants) = { | ||||
| #let finalize-setup(elmts, participants, notes) = { | ||||
|   for (i, p) in participants.enumerate() { | ||||
|     p.insert("i", i) | ||||
|     participants.at(i) = p | ||||
| @@ -323,14 +327,11 @@ | ||||
|     elmts.at(i).insert("max-i", max-i) | ||||
|   } | ||||
|  | ||||
|   return (elmts, participants) | ||||
|   return (elmts, participants, notes) | ||||
| } | ||||
|  | ||||
| #let setup(elements) = { | ||||
|   let (elmts, activation-history) = unwrap-containers(elements) | ||||
|    | ||||
|   let participants | ||||
|   (elmts, participants) = prepare-participants(elmts) | ||||
|  | ||||
|   return finalize-setup(elmts, participants) | ||||
|   let (elmts, participants, notes) = prepare-participants(elmts) | ||||
|   return finalize-setup(elmts, participants, notes) | ||||
| } | ||||
		Reference in New Issue
	
	Block a user