forked from HEL/chronos
		
	added slanted sequences
This commit is contained in:
		| @@ -35,7 +35,8 @@ | ||||
|   destroy-dst: false, | ||||
|   disable-src: false, | ||||
|   destroy-src: false, | ||||
|   lifeline-style: auto | ||||
|   lifeline-style: auto, | ||||
|   slant: none | ||||
| ) = { | ||||
|   return (( | ||||
|     type: "seq", | ||||
| @@ -54,6 +55,7 @@ | ||||
|     disable-src: disable-src, | ||||
|     destroy-src: destroy-src, | ||||
|     lifeline-style: lifeline-style, | ||||
|     slant: slant | ||||
|   ),) | ||||
| } | ||||
|  | ||||
| @@ -87,27 +89,38 @@ | ||||
|     y: y, | ||||
|     ll-lvl: lifelines.at(i2).level * LIFELINE-W / 2 | ||||
|   ) | ||||
|   let slant = if elmt.slant == auto { | ||||
|     DEFAULT-SLANT | ||||
|   } else if elmt.slant != none { | ||||
|     elmt.slant | ||||
|   } else { | ||||
|     0 | ||||
|   } | ||||
|   end-info.y -= slant | ||||
|   if elmt.p1 == elmt.p2 { | ||||
|     end-info.y -= 10 | ||||
|   } | ||||
|  | ||||
|   if elmt.disable-src { | ||||
|     let src-line = lifelines.at(i1) | ||||
|     src-line.level -= 1 | ||||
|     src-line.lines.push(("disable", y)) | ||||
|     src-line.lines.push(("disable", start-info.y)) | ||||
|     lifelines.at(i1) = src-line | ||||
|   } | ||||
|   if elmt.destroy-src { | ||||
|     let src-line = lifelines.at(i1) | ||||
|     src-line.lines.push(("destroy", y)) | ||||
|     src-line.lines.push(("destroy", start-info.y)) | ||||
|     lifelines.at(i1) = src-line | ||||
|   } | ||||
|   if elmt.disable-dst { | ||||
|     let dst-line = lifelines.at(i2) | ||||
|     dst-line.level -= 1 | ||||
|     dst-line.lines.push(("disable", y)) | ||||
|     dst-line.lines.push(("disable", end-info.y)) | ||||
|     lifelines.at(i2) = dst-line | ||||
|   } | ||||
|   if elmt.destroy-dst { | ||||
|     let dst-line = lifelines.at(i2) | ||||
|     dst-line.lines.push(("destroy", y)) | ||||
|     dst-line.lines.push(("destroy", end-info.y)) | ||||
|     lifelines.at(i2) = dst-line | ||||
|   } | ||||
|   if elmt.enable-dst { | ||||
| @@ -120,7 +133,7 @@ | ||||
|     let m = measure(box(par.display-name)) | ||||
|     let f = if i1 > i2 {-1} else {1} | ||||
|     end-info.x -= (m.width + PAR-PAD.last() * 2) / 2pt * f | ||||
|     shapes += participant.render(x-pos, par, y: y - CREATE-OFFSET) | ||||
|     shapes += participant.render(x-pos, par, y: end-info.y - CREATE-OFFSET) | ||||
|   } | ||||
|  | ||||
|   end-info.ll-lvl = lifelines.at(i2).level * LIFELINE-W / 2 | ||||
| @@ -156,9 +169,9 @@ | ||||
|     ) | ||||
|   ) | ||||
|  | ||||
|   let y0 = y | ||||
|   let y0 = start-info.y | ||||
|   if "linked-note" in elmt { | ||||
|     let shps = note.render(pars-i, x-pos, elmt.linked-note, y, lifelines).last() | ||||
|     let shps = note.render(pars-i, x-pos, elmt.linked-note, start-info.y, lifelines).last() | ||||
|     shapes += shps | ||||
|   } | ||||
|  | ||||
| @@ -177,7 +190,7 @@ | ||||
|  | ||||
|     if elmt.comment != none { | ||||
|       shapes += draw.content( | ||||
|         (x1, y), | ||||
|         (x1, start-info.y), | ||||
|         elmt.comment, | ||||
|         anchor: if elmt.flip {"south-east"} else {"south-west"}, | ||||
|         padding: 3pt | ||||
| @@ -185,13 +198,12 @@ | ||||
|     } | ||||
|  | ||||
|     shapes += draw.line( | ||||
|       (x1, y), | ||||
|       (x-mid, y), | ||||
|       (x-mid, y - 10), | ||||
|       (x2, y - 10), | ||||
|       (x1, start-info.y), | ||||
|       (x-mid, start-info.y), | ||||
|       (x-mid, end-info.y), | ||||
|       (x2, end-info.y), | ||||
|       ..style | ||||
|     ) | ||||
|     y -= 10 | ||||
|  | ||||
|   } else { | ||||
|     if elmt.comment != none { | ||||
| @@ -200,7 +212,7 @@ | ||||
|         x += COMMENT-PAD | ||||
|       } | ||||
|       shapes += draw.content( | ||||
|         (x, y), | ||||
|         (x, start-info.y), | ||||
|         elmt.comment, | ||||
|         anchor: "south-west", | ||||
|         padding: 3pt | ||||
| @@ -208,28 +220,28 @@ | ||||
|     } | ||||
|  | ||||
|     shapes += draw.line( | ||||
|       (x1, y), | ||||
|       (x2, y), | ||||
|       (x1, start-info.y), | ||||
|       (x2, end-info.y), | ||||
|       ..style | ||||
|     ) | ||||
|   } | ||||
|   if elmt.enable-dst { | ||||
|     let dst-line = lifelines.at(i2) | ||||
|     dst-line.lines.push(("enable", y, elmt.lifeline-style)) | ||||
|     dst-line.lines.push(("enable", end-info.y, elmt.lifeline-style)) | ||||
|     lifelines.at(i2) = dst-line | ||||
|   } | ||||
|   if elmt.create-dst { | ||||
|     y -= CREATE-OFFSET | ||||
|     end-info.y -= CREATE-OFFSET | ||||
|     let dst-line = lifelines.at(i2) | ||||
|     dst-line.lines.push(("create", y)) | ||||
|     dst-line.lines.push(("create", end-info.y)) | ||||
|     lifelines.at(i2) = dst-line | ||||
|   } | ||||
|  | ||||
|   if "linked-note" in elmt { | ||||
|     let m = note.get-size(elmt.linked-note) | ||||
|     y = calc.min(y, y0 - m.height / 2) | ||||
|     end-info.y = calc.min(end-info.y, y0 - m.height / 2) | ||||
|   } | ||||
|  | ||||
|   let r = (y, lifelines, shapes) | ||||
|   let r = (end-info.y, lifelines, shapes) | ||||
|   return r | ||||
| } | ||||
		Reference in New Issue
	
	Block a user