Skip to content

Commit

Permalink
flat-brace: Add missing stroke & fill keys (#771)
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf authored Jan 7, 2025
1 parent 8b160e1 commit 7d24317
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/lib/decorations/brace.typ
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@


#let flat-brace-default-style = (
stroke: auto,
fill: none,
amplitude: .3,
aspect: 50%,
curves: (1, .5, .6, .15),
Expand Down Expand Up @@ -315,19 +317,22 @@
bezier(e, c, elc, clc)
bezier(c, f, crc, frc)
bezier(g, b, grc, brc)
})
// define some named anchors
}, stroke: style.stroke, fill: style.fill)

// Define some named anchors
anchor("spike", c)
anchor("content", h)
anchor("start", a)
anchor("end", b)
anchor("default", (d, 50%, g))
// define anchors for all points

// Define anchors for all points
for (name, point) in points {
anchor(name, point)
}

if debug {
// show bezier control points using colored lines
// Show bezier control points using colored lines
line(stroke: purple, a, alc)
line(stroke: blue, d, dlc)
line(stroke: olive, e, elc)
Expand All @@ -336,12 +341,13 @@
line(stroke: olive, f, frc)
line(stroke: blue, g, grc)
line(stroke: purple, b, brc)
// show all named points
// Show all named points
for (name, point) in points {
content(point, box(fill: luma(240), inset: .5pt, text(style.debug-text-size, raw(name))))
}
}
})
// move to end point so the current position after this is the end position

// Move to end point so the current position after this is the end position
move-to(end)
}
Binary file modified tests/decorations/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.
5 changes: 5 additions & 0 deletions tests/decorations/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@
(flip: false),
(flip: true),
))

#test-case({
decorations.flat-brace((0,0), (1,0), stroke: blue, fill: gray)
decorations.brace((0,1), (1,1), stroke: blue, fill: gray)
})

0 comments on commit 7d24317

Please sign in to comment.