Skip to content

Commit

Permalink
Fix #621
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Aug 9, 2024
1 parent c52b987 commit 62c501d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package called `cetz-plot`.
- The center anchor of `content()` with two coordinates got fixed when using
negative cordinates.
- Element names are now checked to not contain a "." character.
- Fixed intersection bug for content with `anchor:` set.

## Draw
- Added `floating` function for drawing elements without affecting bounding boxes.
Expand Down
2 changes: 1 addition & 1 deletion src/draw/shapes.typ
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@
let (ta, tb) = util.apply-transform(ctx.transform, a, b)

let pts = ()
for drawable in elem.at("drawables", default: ()) {
for drawable in elem.at("drawables", default: ()).filter(d => d.type == "path") {
pts += intersection.line-path(ta, tb, drawable)
}
return if pts == () {
Expand Down
Binary file modified tests/content/intersection/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.
28 changes: 28 additions & 0 deletions tests/content/intersection/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,31 @@
})
})
})

#test-case({
import draw: *

draw.content(name: "test1", frame: "rect", (0,0))[Test 1]
draw.content(name: "test2", frame: "rect", (-1,-1))[Test 2]
draw.line("test1", "test2")
})

#test-case({
let thide = hide
import draw: *

draw.content(name: "test1", (0,0))[Test 1]
draw.content((-1,-1))[#box(stroke: 1pt + red, thide[Test 2])]
draw.content(name: "test2", frame: "rect", anchor: "north-east", (-1,-1))[Test 2]
draw.line("test1", "test2")
})

#test-case({
let thide = hide
import draw: *

draw.content(name: "test1", (0,0))[Test 1]
draw.content((-1,-1))[#box(stroke: 1pt + red, thide[Test 2])]
draw.content(name: "test2", frame: "rect", anchor: "south", (-1,-1))[Test 2]
draw.line("test1", "test2")
})
Binary file modified tests/content/span/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.

0 comments on commit 62c501d

Please sign in to comment.