minor style improvements

This commit is contained in:
Louis Heredero 2024-06-20 22:44:15 +02:00
parent ef73f98dd0
commit fd5b147e86
Signed by: HEL
GPG Key ID: 8D83DE470F8544E7
3 changed files with 22 additions and 9 deletions

View File

@ -16,3 +16,5 @@
#let QUEUE-PAD = (5pt, 3pt) #let QUEUE-PAD = (5pt, 3pt)
#let COL-DESTRUCTION = rgb("#A80238") #let COL-DESTRUCTION = rgb("#A80238")
#let COL-GRP-NAME = rgb("#EEEEEE")
#let COL-SEP-NAME = rgb("#EEEEEE")

View File

@ -1,4 +1,5 @@
#import "@preview/cetz:0.2.2": draw #import "@preview/cetz:0.2.2": draw
#import "consts.typ": *
#let _grp(name, desc: none, type: "default", elmts) = { #let _grp(name, desc: none, type: "default", elmts) = {
return (( return ((
@ -12,7 +13,8 @@
#let render(x0, x1, y0, y1, group) = { #let render(x0, x1, y0, y1, group) = {
let shapes = () let shapes = ()
let m = measure(box(group.name)) let name = text(group.name, weight: "bold")
let m = measure(box(name))
let w = m.width / 1pt + 15 let w = m.width / 1pt + 15
let h = m.height / 1pt + 6 let h = m.height / 1pt + 6
shapes += draw.rect( shapes += draw.rect(
@ -20,7 +22,7 @@
(x1, y1) (x1, y1)
) )
shapes += draw.merge-path( shapes += draw.merge-path(
fill: gray.lighten(20%), fill: COL-GRP-NAME,
close: true, close: true,
{ {
draw.line( draw.line(
@ -34,7 +36,7 @@
) )
shapes += draw.content( shapes += draw.content(
(x0, y0), (x0, y0),
group.name, name,
anchor: "north-west", anchor: "north-west",
padding: (left: 5pt, right: 10pt, top: 3pt, bottom: 3pt) padding: (left: 5pt, right: 10pt, top: 3pt, bottom: 3pt)
) )

View File

@ -26,17 +26,26 @@
let xr = cx + w / 2 let xr = cx + w / 2
y -= h / 2 y -= h / 2
shapes += draw.line((x0, y), (xl, y)) shapes += draw.rect(
shapes += draw.line((xr, y), (x1, y)) (x0, y),
(x1, y - 3),
stroke: none,
fill: white
)
shapes += draw.line((x0, y), (x1, y))
//shapes += draw.line((x0, y), (xl, y))
//shapes += draw.line((xr, y), (x1, y))
y -= 3 y -= 3
shapes += draw.line((x0, y), (xl, y)) shapes += draw.line((x0, y), (x1, y))
shapes += draw.line((xr, y), (x1, y)) //shapes += draw.line((x0, y), (xl, y))
//shapes += draw.line((xr, y), (x1, y))
shapes += draw.content( shapes += draw.content(
((x0 + x1) / 2, y + 1.5), ((x0 + x1) / 2, y + 1.5),
elmt.name, elmt.name,
anchor: "center", anchor: "center",
padding: (5pt, 3pt), padding: (5pt, 3pt),
frame: "rect" frame: "rect",
fill: COL-SEP-NAME
) )
y -= h / 2 y -= h / 2
y -= Y-SPACE y -= Y-SPACE