forked from HEL/chronos
		
	improved seq arrow positioning
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -61,11 +61,6 @@ | ||||
|     ll-lvl: lifelines.at(i2).level * LIFELINE-W / 2 | ||||
|   ) | ||||
|  | ||||
|   let ll-lvl1 = lifelines.at(i1).level * LIFELINE-W / 2 | ||||
|  | ||||
|   let x1 = x-pos.at(i1) | ||||
|   let x2 = x-pos.at(i2) | ||||
|  | ||||
|   if elmt.disable-src { | ||||
|     let src-line = lifelines.at(i1) | ||||
|     src-line.level -= 1 | ||||
| @@ -96,20 +91,29 @@ | ||||
|   if elmt.create-dst { | ||||
|     let par = participants.at(i2) | ||||
|     let m = measure(box(par.display-name)) | ||||
|     x2 -= (m.width + PAR-PAD.last() * 2) / 2pt | ||||
|     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) | ||||
|   } | ||||
|  | ||||
|   end-info.ll-lvl = lifelines.at(i2).level * LIFELINE-W / 2 | ||||
|   let ll-lvl2 = lifelines.at(i2).level * LIFELINE-W / 2 | ||||
|  | ||||
|   let f = if elmt.flip {-1} else {1} | ||||
|   if i1 <= i2 { | ||||
|     x1 += ll-lvl1 * f | ||||
|     x2 -= ll-lvl2 * f | ||||
|   } else { | ||||
|     x1 -= ll-lvl1 * f | ||||
|     x2 += ll-lvl2 * f | ||||
|   // Compute left/right position at start/end | ||||
|   start-info.insert("lx", start-info.x) | ||||
|   if start-info.ll-lvl != 0 { start-info.lx -= LIFELINE-W / 2 } | ||||
|   end-info.insert("lx", end-info.x) | ||||
|   if end-info.ll-lvl != 0 { end-info.lx -= LIFELINE-W / 2 } | ||||
|  | ||||
|   start-info.insert("rx", start-info.x + start-info.ll-lvl) | ||||
|   end-info.insert("rx", end-info.x + end-info.ll-lvl) | ||||
|  | ||||
|   // Choose correct points to link | ||||
|   let x1 = start-info.rx | ||||
|   let x2 = end-info.lx | ||||
|  | ||||
|   if (start-info.i > end-info.i) { | ||||
|     x1 = start-info.lx | ||||
|     x2 = end-info.rx | ||||
|   } | ||||
|  | ||||
|   let style = ( | ||||
| @@ -121,9 +125,17 @@ | ||||
|   ) | ||||
|  | ||||
|   if elmt.p1 == elmt.p2 { | ||||
|     let x3 = x1 - ll-lvl1 + ll-lvl2 | ||||
|     if elmt.flip { | ||||
|       x1 = start-info.lx | ||||
|     } else { | ||||
|       x2 = end-info.rx | ||||
|     } | ||||
|  | ||||
|     x2 = if elmt.flip {x1 - 20} else {x1 + 20} | ||||
|     let x-mid = if elmt.flip { | ||||
|       calc.min(x1, x2) - 20 | ||||
|     } else { | ||||
|       calc.max(x1, x2) + 20 | ||||
|     } | ||||
|  | ||||
|     if elmt.comment != none { | ||||
|       shapes += draw.content( | ||||
| @@ -136,9 +148,9 @@ | ||||
|  | ||||
|     shapes += draw.line( | ||||
|       (x1, y), | ||||
|       (x2, y), | ||||
|       (x-mid, y), | ||||
|       (x-mid, y - 10), | ||||
|       (x2, y - 10), | ||||
|       (x3, y - 10), | ||||
|       ..style | ||||
|     ) | ||||
|     y -= 10 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user