Skip to content

Commit 95b1ea5

Browse files
committed
shapes: Transform content angle coordinate
Fixes #1032
1 parent 49ba120 commit 95b1ea5

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
- New `perspective` element for perspective division.
2323
There is a known issue with intersections of perspective elements
2424
outsides the `perspective` environment! (#1033)
25+
- Fixed a bug when passing a coordinate to the `angle:` argument of
26+
`content` and a transformation matrix ≠ id.
2527

2628
# 0.4.2
2729
- The `tree` element now has a `anchor:` argument to position the tree (#929)

src/draw/shapes.typ

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,9 +1125,8 @@
11251125
}
11261126

11271127
let angle = if type(angle) != std.angle {
1128-
let c
1129-
(ctx, c) = coordinate.resolve(ctx, angle)
1130-
vector.angle2(a, c)
1128+
let (_, c) = coordinate.resolve(ctx, angle)
1129+
vector.angle2(a, util.apply-transform(ctx.transform, c))
11311130
} else {
11321131
angle
11331132
}

tests/content/rotation/ref/1.png

1.89 KB
Loading

tests/content/rotation/test.typ

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,13 @@
1919
content((0,0), [Content], angle: pt)
2020
})
2121
}
22+
23+
// Rotate to coordinate with transformation != id (#1032)
24+
#test-case({
25+
import draw: *
26+
27+
line((0, 0), (1, 0), name: "a")
28+
rotate(90deg)
29+
line((0, 0), (1, 0), name: "b")
30+
content((0,0), [Content], angle: "a.end")
31+
})

0 commit comments

Comments
 (0)