adapted database shape rendering
This commit is contained in:
@ -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
|
||||
)
|
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user