Compare commits

..

No commits in common. "5e0e680f608303a7a30b10bf69a7cda5984b22d6" and "83d7a8d85b6191f26b6777b6757893d1b366ad5c" have entirely different histories.

View File

@ -159,16 +159,16 @@
let mid-x = start-x + width / 2 let mid-x = start-x + width / 2
shapes += draw-link(config, mid-x, start-y, desc-x, desc-y) shapes += draw-link(config, mid-x, start-y, desc-x, desc-y)
let txt-x = desc-x let txt-anchor = "west"
if config.left-labels { if config.left-labels {
txt-x -= range_.description.len() * config.default-font-size / 2pt txt-anchor -= "east"
} }
shapes += draw-text( shapes += draw-text(
range_.description, range_.description,
config.text-color, config.text-color,
txt-x, desc-y + bit-h / 2, desc-x, desc-y + bit-h / 2,
anchor: "west" anchor: "west"
) )
@ -176,7 +176,7 @@
if range_.values != none and range_.depends-on == none { if range_.values != none and range_.depends-on == none {
let shapes_ let shapes_
(shapes_, _, desc-y) = draw-values(config, range_.values, txt-x, desc-y) (shapes_, _, desc-y) = draw-values(config, range_.values, desc-x, desc-y)
shapes += shapes_ shapes += shapes_
} }
@ -266,8 +266,7 @@
let width = rng.bits(range_) * bit-w let width = rng.bits(range_) * bit-w
shapes += draw-underbracket(config, start-x, start-x + width, bits-y) shapes += draw-underbracket(config, start-x, start-x + width, bits-y)
let depend-key = rng.key(..range_.depends-on) let depend-range = struct.ranges.at(rng.key(..range_.depends-on))
let depend-range = struct.ranges.at(depend-key)
let prev-range-y = bits-y + bit-h * 1.5 let prev-range-y = bits-y + bit-h * 1.5
let prev-depend-y = if depend-range.last-value-y == -1 { let prev-depend-y = if depend-range.last-value-y == -1 {
@ -336,9 +335,7 @@
shapes += shapes_ shapes += shapes_
} }
struct.ranges.at(depend-key) = depend-range return (shapes, desc-x, desc-y)
return (shapes, desc-x, desc-y, struct)
} }
#let draw-structure(config, struct, structures, ox: 0, oy: 0) = { #let draw-structure(config, struct, structures, ox: 0, oy: 0) = {
@ -400,13 +397,6 @@
let name-x = start-x + width / 2 let name-x = start-x + width / 2
let name-y = bits-y + bit-h / 2 let name-y = bits-y + bit-h / 2
shapes += draw-rect(
bg-col,
start-x + bit-w / 2,
name-y - bit-h * 0.3,
width - bit-w,
bit-h * 0.6
)
shapes += draw-text(range_.name, txt-col, name-x, name-y, fill: bg-col) shapes += draw-text(range_.name, txt-col, name-x, name-y, fill: bg-col)
if range_.description != "" { if range_.description != "" {
@ -423,7 +413,7 @@
for range_ in ranges { for range_ in ranges {
if range_.values() != none and range_.depends-on != none { if range_.values() != none and range_.depends-on != none {
let shapes_ let shapes_
(shapes_, desc-x, desc-y, struct) = draw-dependency( (shapes_, desc-x, desc-y) = draw-dependency(
draw-structure, config, draw-structure, config,
struct, structures, bits-x, bits-y, range_, desc-x, desc-y struct, structures, bits-x, bits-y, range_, desc-x, desc-y
) )