Skip to content
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
2 changes: 1 addition & 1 deletion src/cetz.typ
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Import cetz into the root scope. Import cetz by importing this file only!
#import "@preview/cetz:0.4.2": *
#import "@preview/cetz:0.5.2": *
6 changes: 4 additions & 2 deletions src/chart/piechart.typ
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#import "/src/cetz.typ": draw, styles, palette, util, vector, intersection
#import util: circle-arclen

#import "/src/plot/legend.typ"

// Piechart Label Kind
Expand Down Expand Up @@ -344,6 +342,10 @@
continue
}

let circle-arclen(radius, angle: 90deg) = {
calc.abs(angle / 360deg * 2 * calc.pi * radius)
}

// A sharp item is an item that should be round but is sharp due to the gap being big
let is-sharp = inner-radius == 0 or circle-arclen(inner-radius, angle: inner-angle) > circle-arclen(radius, angle: outer-angle)

Expand Down
20 changes: 17 additions & 3 deletions src/plot.typ
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
legend-style: (:),
..options
) = draw.group(name: name, ctx => {
draw.assert-version(version(0, 4, 2))
draw.assert-version(version(0, 5, 0), max: version(0, 6, 0))

// Create plot context object
let make-ctx(x, y, size) = {
Expand Down Expand Up @@ -233,7 +233,14 @@
if y.horizontal {
(x, y) = (y, x)
body = draw.set-ctx(ctx => {
ctx.transform = matrix.swap-cols(ctx.transform, 0, 1)
let ((x0, x1, x2, x3),
(y0, y1, y2, y3),
(z0, z1, z2, z3),
(w0, w1, w2, w3)) = ctx.transform
ctx.transform = ((x1, x0, x2, x3),
(y1, y0, y2, y3),
(z1, z0, z2, z3),
(w1, w0, w2, w3))
return ctx
}) + body
}
Expand Down Expand Up @@ -451,7 +458,14 @@
draw.scope({
if y.horizontal {
draw.set-ctx(ctx => {
ctx.transform = matrix.swap-cols(ctx.transform, 0, 1)
let ((x0, x1, x2, x3),
(y0, y1, y2, y3),
(z0, z1, z2, z3),
(w0, w1, w2, w3)) = ctx.transform
ctx.transform = ((x1, x0, x2, x3),
(y1, y0, y2, y3),
(z1, z0, z2, z3),
(w1, w0, w2, w3))
return ctx
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/plot/legend.typ
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@

// Draw item preview
let draw-preview = if preview == auto { draw-generic-preview } else { preview }
scope({
group({ // BUG: scope in group seems to be bugged, we use group instead
set-viewport(preview-a, preview-b, bounds: (1, 1, 0))
(draw-preview)(item)
})
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.
Binary file modified tests/axes/self/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/chart/boxwhisker/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/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/chart/self/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.
Binary file modified tests/smartart/cycle/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/smartart/cycle/ref/2.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/smartart/cycle/ref/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading