fixed gates y alignment

This commit is contained in:
Louis Heredero 2024-05-18 18:27:57 +02:00
parent d6248865b3
commit 4fae4fe19a
Signed by: HEL
GPG Key ID: 8D83DE470F8544E7

View File

@ -58,19 +58,16 @@
if (type(y) == dictionary) { if (type(y) == dictionary) {
let from = y.from let from = y.from
let to = y.to let to = y.to
let (to-side, i) = find-port(ports, to)
let margins = (0%, 0%)
if to-side in ports-margins {
margins = ports-margins.at(to-side)
}
let used-pct = 100% - margins.at(0) - margins.at(1)
let used-height = height * used-pct / 100%
let top-margin = height * margins.at(0) / 100%
let dy = used-height * (i + 1) / (ports.at(to-side).len() + 1) let dy
if to == "out" {
dy = height / 2
} else {
dy = height * (i + 0.5) / inputs
}
let (ctx, from-pos) = coordinate.resolve(ctx, from) let (ctx, from-pos) = coordinate.resolve(ctx, from)
y = from-pos.at(1) + dy - height + top-margin y = from-pos.at(1) + dy - height
} }
let tl = (x, y + height) let tl = (x, y + height)