Skip to content

Commit 532970c

Browse files
Fix Legend Label Measuring (#53)
2 parents 7330b7e + 6c0adc3 commit 532970c

7 files changed

Lines changed: 5 additions & 5 deletions

File tree

gallery/barchart.png

-253 Bytes
Loading

src/plot/legend.typ

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
spacing: .1, // Spacing between anchor and legend
1616
item: (
1717
radius: 0,
18-
spacing: .05, // Spacing between items
18+
spacing: 0, // Extra spacing between items
1919
preview: (
2020
width: .75, // Preview width
2121
height: .3, // Preview height
@@ -170,7 +170,7 @@
170170

171171
// Draw item preview
172172
let draw-preview = if preview == auto { draw-generic-preview } else { preview }
173-
group({
173+
scope({
174174
set-viewport(preview-a, preview-b, bounds: (1, 1, 0))
175175
(draw-preview)(item)
176176
})
@@ -186,7 +186,7 @@
186186

187187
// Draw label
188188
content(label-west,
189-
align(left + horizon, label),
189+
text(top-edge: "ascender", bottom-edge: "descender", align(left + horizon, label)),
190190
name: "label", anchor: "west")
191191
}, name: "item", anchor: if style.orientation == ltr { "west" } else { "north-west" })
192192

tests/axes/log-mode/ref/1.png

27 Bytes
Loading

tests/axes/log-mode/test.typ

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
x => {calc.pow(10, x)},
2424
samples: 100,
2525
line: "raw",
26-
label: $y=10^x$
26+
label: $ y=10^x $,
2727
)
2828
plot.add(
2929
domain: (1, 10),
3030
x => {x},
3131
samples: 100,
3232
line: "raw",
3333
hypograph: true,
34-
label: $y=x$
34+
label: $ y=x $,
3535
)
3636
}
3737
)

tests/chart/piechart/ref/1.png

336 Bytes
Loading

tests/plot/legend/ref/1.png

68 Bytes
Loading

tests/plot/violin/ref/1.png

119 Bytes
Loading

0 commit comments

Comments
 (0)