forked from HEL/chronos
		
	added some styling options
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							| @@ -12,8 +12,14 @@ Alice <-- Bob: Another authentication Response | |||||||
| #chronos.diagram({ | #chronos.diagram({ | ||||||
|   import "/src/diagram.typ": * |   import "/src/diagram.typ": * | ||||||
|   _seq("Alice", "Bob", comment: "Authentication Request") |   _seq("Alice", "Bob", comment: "Authentication Request") | ||||||
|   _seq("Bob", "Alice", comment: "Authentication Response", style: "dashed") |   _seq("Bob", "Alice", comment: "Authentication Response", dashed: true) | ||||||
|    |    | ||||||
|   _seq("Alice", "Bob", comment: "Another authentication Request") |   _seq("Alice", "Bob", comment: "Another authentication Request") | ||||||
|   _seq("Bob", "Alice", comment: "Another authentication Response", style: "dashed") |   _seq("Bob", "Alice", comment: "Another authentication Response", dashed: true) | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | #chronos.diagram({ | ||||||
|  |   import "/src/diagram.typ": * | ||||||
|  |   _seq("Bob", "Alice", comment: "bonjour", color: red) | ||||||
|  |   _seq("Alice", "Bob", comment: "ok", color: blue) | ||||||
| }) | }) | ||||||
| @@ -1,12 +1,21 @@ | |||||||
| #import "renderer.typ": render | #import "renderer.typ": render | ||||||
|  |  | ||||||
| #let _seq(p1, p2, comment: none, style: auto) = { | #let _seq( | ||||||
|  |   p1, | ||||||
|  |   p2, | ||||||
|  |   comment: none, | ||||||
|  |   dashed: false, | ||||||
|  |   tip: "default", | ||||||
|  |   color: black | ||||||
|  | ) = { | ||||||
|   return (( |   return (( | ||||||
|     type: "seq", |     type: "seq", | ||||||
|     p1: p1, |     p1: p1, | ||||||
|     p2: p2, |     p2: p2, | ||||||
|     comment: comment, |     comment: comment, | ||||||
|     style: style |     dashed: dashed, | ||||||
|  |     tip: tip, | ||||||
|  |     color: color, | ||||||
|   ),) |   ),) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| #import "@preview/cetz:0.2.2": canvas, draw | #import "@preview/cetz:0.2.2": canvas, draw | ||||||
|  |  | ||||||
| #let X-SPACE = 2 | #let X-SPACE = 2 | ||||||
| #let Y-SPACE = 30 | #let Y-SPACE = 20 | ||||||
|  |  | ||||||
| #let get-participants-i(participants) = { | #let get-participants-i(participants) = { | ||||||
|   let pars-i = (:) |   let pars-i = (:) | ||||||
| @@ -69,10 +69,18 @@ | |||||||
|     if elmt.type == "seq" { |     if elmt.type == "seq" { | ||||||
|       let x1 = x-pos.at(pars-i.at(elmt.p1)) |       let x1 = x-pos.at(pars-i.at(elmt.p1)) | ||||||
|       let x2 = x-pos.at(pars-i.at(elmt.p2)) |       let x2 = x-pos.at(pars-i.at(elmt.p2)) | ||||||
|  |       let style = ( | ||||||
|  |         mark: (end: "straight"), | ||||||
|  |         stroke: ( | ||||||
|  |           dash: if elmt.dashed {"dashed"} else {"solid"}, | ||||||
|  |           paint: elmt.color | ||||||
|  |         ) | ||||||
|  |       ) | ||||||
|  |  | ||||||
|       draw.line( |       draw.line( | ||||||
|         (x1, y), |         (x1, y), | ||||||
|         (x2, y), |         (x2, y), | ||||||
|         mark: (end: "straight") |         ..style | ||||||
|       ) |       ) | ||||||
|       if elmt.comment != none { |       if elmt.comment != none { | ||||||
|         draw.content( |         draw.content( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user