From cc161a5d4071963659274f4ceb4dece4af7837eb Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Sat, 19 Jul 2025 21:35:17 +0200 Subject: [PATCH] adapted entity shape rendering --- src/core/draw/participant/entity.typ | 31 ++++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/core/draw/participant/entity.typ b/src/core/draw/participant/entity.typ index 3abff0c..497fae2 100644 --- a/src/core/draw/participant/entity.typ +++ b/src/core/draw/participant/entity.typ @@ -1,20 +1,22 @@ #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 = "entity" #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 = ENTITY-HEIGHT / 2 + let size = normalize-units(style.size) + let spacing = normalize-units(style.spacing) + let gap = normalize-units(style.gap) + let r = size / 2 let y0 = if bottom { - y - m.height / 1pt - SYM-GAP + y - m.height - spacing } else { - y + m.height / 1pt + ENTITY-HEIGHT + SYM-GAP + y + m.height + size + spacing } - let y1 = y0 - ENTITY-HEIGHT - 1.5 + let y1 = y0 - size - gap draw.circle( (x, y0 - r), @@ -37,12 +39,19 @@ #let get-size(par) = { let m = normalize-measure(par.display-name) - // ENTITY-HEIGHT * 1pt - // ENTITY-HEIGHT * 1pt + 2pt + SYM-GAP * 1pt + h + let m = normalize-measure(par.display-name) - return m + let size = normalize-units(par.resolved-style.size) + let spacing = normalize-units(par.resolved-style.spacing) + + return ( + width: calc.max(m.width, size), + height: size + spacing + m.height + ) } #let default-style = ( - : + size: 20pt, + gap: 1.5pt, + spacing: 5pt ) \ No newline at end of file