Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support radius in content(frame: "rect") #802

Open
janosh opened this issue Jan 24, 2025 · 2 comments
Open

Support radius in content(frame: "rect") #802

janosh opened this issue Jan 24, 2025 · 2 comments

Comments

@janosh
Copy link
Contributor

janosh commented Jan 24, 2025

when fitting rectangular frames to content, would be great if you could apply a border radius. rect has that ability but content(frame: "rect") is not forwarding the radius

#import "@preview/cetz:0.3.1": canvas, draw

#set page(width: auto, height: auto, margin: 8pt)

#canvas({
  draw.content(
    (0, 0),
    [$hat(H)_"KS"=-frac(planck.reduce^2, 2m)arrow(nabla)^2 + v_("ext,s") (arrow(r))$],
    frame: "rect",
    stroke: .5pt,
    fill: rgb("#DCDCDC"),
    padding: 8pt,
    name: "hamiltonian",
    radius: 4pt, // currently has no effect, needs forwarding to rect
  )
})
@johannes-wolf
Copy link
Member

johannes-wolf commented Jan 24, 2025

I would prefer changing frame: to string or function and use something like frame: fit.rect.with(radius: ...).

Since we plan to change/add some kind of generic decoration to elements, frames could also implemented as some kind of decoration you can apply to an element.

@janosh
Copy link
Contributor Author

janosh commented Jan 24, 2025

agreed, that sounds like a much better API where that doesn't need individual arg forwarding and it's much clearer what the radius refers to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants