From f00aa869629841aa7e24932f0631e0ecde9f2229 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Sat, 19 Jul 2025 21:38:35 +0200 Subject: [PATCH] adapted database shape rendering --- src/core/draw/participant/database.typ | 28 ++++++++++++++++---------- src/core/draw/participant/entity.typ | 2 -- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/core/draw/participant/database.typ b/src/core/draw/participant/database.typ index c873515..3e66766 100644 --- a/src/core/draw/participant/database.typ +++ b/src/core/draw/participant/database.typ @@ -1,20 +1,21 @@ #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 = "database" #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 height = DATABASE-WIDTH * 4 / 3 - let rx = DATABASE-WIDTH / 2 + let width = normalize-units(style.width) + let spacing = normalize-units(style.spacing) + let height = width * 4 / 3 + let rx = width / 2 let ry = rx / 2 let y0 = if bottom { - y - m.height / 1pt - SYM-GAP + y - m.height - spacing } else { - y + m.height / 1pt + height + SYM-GAP + y + m.height + height + spacing } let y1 = y0 - height @@ -47,12 +48,17 @@ #let get-size(par) = { let m = normalize-measure(par.display-name) - // DATABASE-WIDTH * 1pt - // DATABASE-WIDTH * 4pt / 3 + SYM-GAP * 1pt + h + let width = normalize-units(par.resolved-style.width) + let height = width * 4 / 3 + let spacing = normalize-units(par.resolved-style.spacing) - return m + return ( + width: calc.max(m.width, width), + height: height + spacing + m.height + ) } #let default-style = ( - : + width: 24pt, + spacing: 5pt ) \ No newline at end of file diff --git a/src/core/draw/participant/entity.typ b/src/core/draw/participant/entity.typ index 497fae2..44674ac 100644 --- a/src/core/draw/participant/entity.typ +++ b/src/core/draw/participant/entity.typ @@ -39,8 +39,6 @@ #let get-size(par) = { let m = normalize-measure(par.display-name) - let m = normalize-measure(par.display-name) - let size = normalize-units(par.resolved-style.size) let spacing = normalize-units(par.resolved-style.spacing)