diff --git a/src/cetz.typ b/src/cetz.typ index 624a277..8a95d8f 100644 --- a/src/cetz.typ +++ b/src/cetz.typ @@ -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": * diff --git a/src/chart/piechart.typ b/src/chart/piechart.typ index ba41a0a..e32fcac 100644 --- a/src/chart/piechart.typ +++ b/src/chart/piechart.typ @@ -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 @@ -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) diff --git a/src/plot.typ b/src/plot.typ index 7f50209..f0f55ca 100644 --- a/src/plot.typ +++ b/src/plot.typ @@ -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) = { @@ -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 } @@ -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 }) } diff --git a/src/plot/legend.typ b/src/plot/legend.typ index aec0e80..94838d4 100644 --- a/src/plot/legend.typ +++ b/src/plot/legend.typ @@ -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) }) diff --git a/tests/axes/log-mode/ref/1.png b/tests/axes/log-mode/ref/1.png index 8572759..54a96f1 100644 Binary files a/tests/axes/log-mode/ref/1.png and b/tests/axes/log-mode/ref/1.png differ diff --git a/tests/axes/self/ref/1.png b/tests/axes/self/ref/1.png index 09a285a..8046fb8 100644 Binary files a/tests/axes/self/ref/1.png and b/tests/axes/self/ref/1.png differ diff --git a/tests/chart/boxwhisker/ref/1.png b/tests/chart/boxwhisker/ref/1.png index 4490aa0..8c3a649 100644 Binary files a/tests/chart/boxwhisker/ref/1.png and b/tests/chart/boxwhisker/ref/1.png differ diff --git a/tests/chart/piechart/ref/1.png b/tests/chart/piechart/ref/1.png index 2d05a1d..61d565a 100644 Binary files a/tests/chart/piechart/ref/1.png and b/tests/chart/piechart/ref/1.png differ diff --git a/tests/chart/self/ref/1.png b/tests/chart/self/ref/1.png index bf399c4..e772e48 100644 Binary files a/tests/chart/self/ref/1.png and b/tests/chart/self/ref/1.png differ diff --git a/tests/plot/legend/ref/1.png b/tests/plot/legend/ref/1.png index 0fc8e61..a5ec75f 100644 Binary files a/tests/plot/legend/ref/1.png and b/tests/plot/legend/ref/1.png differ diff --git a/tests/plot/violin/ref/1.png b/tests/plot/violin/ref/1.png index 1f49fcb..7efb9c7 100644 Binary files a/tests/plot/violin/ref/1.png and b/tests/plot/violin/ref/1.png differ diff --git a/tests/smartart/cycle/ref/1.png b/tests/smartart/cycle/ref/1.png index bc3be81..c39e35f 100644 Binary files a/tests/smartart/cycle/ref/1.png and b/tests/smartart/cycle/ref/1.png differ diff --git a/tests/smartart/cycle/ref/2.png b/tests/smartart/cycle/ref/2.png index 3661020..d9255bc 100644 Binary files a/tests/smartart/cycle/ref/2.png and b/tests/smartart/cycle/ref/2.png differ diff --git a/tests/smartart/cycle/ref/3.png b/tests/smartart/cycle/ref/3.png index 1469c76..40ee222 100644 Binary files a/tests/smartart/cycle/ref/3.png and b/tests/smartart/cycle/ref/3.png differ