Skip to content

Commit

Permalink
fix: unexpected line breaks in node labels (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jollywatt committed Dec 15, 2024
1 parent b3b11f2 commit 27fe43d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/draw.typ
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@
}

if node.label != none {
let ε = 1e-10pt // temp fix for https://github.com/Jollywatt/typst-fletcher/issues/64
cetz.draw.content(
node.pos.xyz,
box(
// wrapping label in a box allows user to control its alignment
align(center + horizon, node.label),
stroke: if debug >= 3 { DEBUG_COLOR2 + 0.25pt },
width: node.size.at(0) - 2*node.inset,
width: node.size.at(0) - 2*node.inset + ε,
height: node.size.at(1) - 2*node.inset,
),
anchor: "center",
Expand Down
Binary file added tests/issues/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.
10 changes: 10 additions & 0 deletions tests/issues/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#set page(width: auto, height: auto, margin: 1em)
#import "/src/exports.typ" as fletcher: diagram, node, edge

#show link: underline

https://github.com/Jollywatt/typst-fletcher/issues/64


#diagram($A times B$)
#par(justify: true, diagram($A times B$))

0 comments on commit 27fe43d

Please sign in to comment.