Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Legend Label Measuring #53

Merged
merged 3 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified gallery/barchart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/plot/legend.typ
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
spacing: .1, // Spacing between anchor and legend
item: (
radius: 0,
spacing: .05, // Spacing between items
spacing: 0, // Extra spacing between items
preview: (
width: .75, // Preview width
height: .3, // Preview height
Expand Down Expand Up @@ -170,7 +170,7 @@

// Draw item preview
let draw-preview = if preview == auto { draw-generic-preview } else { preview }
group({
scope({
set-viewport(preview-a, preview-b, bounds: (1, 1, 0))
(draw-preview)(item)
})
Expand All @@ -186,7 +186,7 @@

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

Expand Down
Binary file modified tests/axes/log-mode/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/axes/log-mode/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
x => {calc.pow(10, x)},
samples: 100,
line: "raw",
label: $y=10^x$
label: $ y=10^x $,
)
plot.add(
domain: (1, 10),
x => {x},
samples: 100,
line: "raw",
hypograph: true,
label: $y=x$
label: $ y=x $,
)
}
)
Expand Down
Binary file modified tests/chart/piechart/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plot/legend/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plot/violin/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading