From b34702485f0d3a20ec0f4da34118391b2539cf51 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Sat, 19 Jul 2025 18:04:16 +0200 Subject: [PATCH] adapted control shape rendering --- src/core/draw/participant/control.typ | 32 ++++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/core/draw/participant/control.typ b/src/core/draw/participant/control.typ index e62fb44..a3bbad2 100644 --- a/src/core/draw/participant/control.typ +++ b/src/core/draw/participant/control.typ @@ -1,18 +1,19 @@ #import "/src/cetz.typ": draw -#import "/src/core/utils.typ": normalize-measure -#import "/src/consts.typ": * +#import "/src/core/utils.typ": normalize-measure, normalize-units #let name = "control" #let render(x, y, p, bottom) = { - let m = measure(p.display-name) + let m = normalize-measure(p.display-name) let style = p.resolved-style - let r = CONTROL-HEIGHT / 2 + let size = normalize-units(style.size) + let spacing = normalize-units(style.spacing) + let r = size / 2 let y0 = if bottom { - y - m.height / 1pt - SYM-GAP + y - m.height - spacing } else { - y + m.height / 1pt + CONTROL-HEIGHT + SYM-GAP + y + m.height + size + spacing } draw.circle( @@ -22,7 +23,12 @@ stroke: style.stroke ) let s = stroke(style.stroke) - draw.mark((x, y0), (x - r / 2, y0), symbol: "stealth", fill: s.paint) + draw.mark( + (x, y0), (x - r / 2, y0), + symbol: "stealth", + fill: s.paint, + stroke: s.paint + ) draw.content( (x, y), p.display-name, @@ -33,12 +39,16 @@ #let get-size(par) = { let m = normalize-measure(par.display-name) - // CONTROL-HEIGHT * 1pt - // CONTROL-HEIGHT * 1pt + SYM-GAP * 1pt + h + let size = normalize-units(par.resolved-style.size) + let spacing = normalize-units(par.resolved-style.spacing) - return m + return ( + width: calc.max(m.width, size), + height: size + spacing + m.height + ) } #let default-style = ( - : + size: 20pt, + spacing: 5pt ) \ No newline at end of file