forked from HEL/chronos
		
	refactored debug rendering
This commit is contained in:
		@@ -353,6 +353,24 @@
 | 
			
		||||
  )
 | 
			
		||||
},)
 | 
			
		||||
 | 
			
		||||
#let render-debug() = get-ctx(ctx => {
 | 
			
		||||
  for p in ctx.participants.filter(p => p.invisible) {
 | 
			
		||||
    let color = if p.name.starts-with("?") {green} else if p.name.ends-with("?") {red} else {blue}
 | 
			
		||||
    let x = ctx.x-pos.at(p.i)
 | 
			
		||||
    draw.line(
 | 
			
		||||
      (x, 0),
 | 
			
		||||
      (x, ctx.y),
 | 
			
		||||
      stroke: (paint: color, dash: "dotted")
 | 
			
		||||
    )
 | 
			
		||||
    draw.content(
 | 
			
		||||
      (x, 0),
 | 
			
		||||
      p.display-name,
 | 
			
		||||
      anchor: "west",
 | 
			
		||||
      angle: 90deg
 | 
			
		||||
    )
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
#let render(participants, elements) = context canvas(length: 1pt, {
 | 
			
		||||
  setup-ctx(participants, elements)
 | 
			
		||||
  
 | 
			
		||||
@@ -379,24 +397,9 @@
 | 
			
		||||
    return ctx
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  // Draw vertical lines + lifelines + end participants
 | 
			
		||||
  draw.on-layer(-1, {
 | 
			
		||||
    if DEBUG-INVISIBLE {
 | 
			
		||||
      for p in participants.filter(p => p.invisible) {
 | 
			
		||||
        let color = if p.name.starts-with("?") {green} else if p.name.ends-with("?") {red} else {blue}
 | 
			
		||||
        let x = x-pos.at(p.i)
 | 
			
		||||
        draw.line(
 | 
			
		||||
          (x, 0),
 | 
			
		||||
          (x, y),
 | 
			
		||||
          stroke: (paint: color, dash: "dotted")
 | 
			
		||||
        )
 | 
			
		||||
        draw.content(
 | 
			
		||||
          (x, 0),
 | 
			
		||||
          p.display-name,
 | 
			
		||||
          anchor: "west",
 | 
			
		||||
          angle: 90deg
 | 
			
		||||
        )
 | 
			
		||||
      }
 | 
			
		||||
      render-debug()
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    participant.render-lifelines()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user