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

[feature request] Support angle border anchors for content() elements #603

Open
tapyu opened this issue May 23, 2024 · 2 comments
Open

[feature request] Support angle border anchors for content() elements #603

tapyu opened this issue May 23, 2024 · 2 comments
Labels
Milestone

Comments

@tapyu
Copy link
Contributor

tapyu commented May 23, 2024

In

#import "@preview/cetz:0.2.2": canvas, draw
#import draw: *

#let i = 50
#canvas({
  content(
    (),
    [hello world],
    name: "hello",
  )
  line(
    "hello.south",
    (rel : (y: -2)),
  )
})

We are able to use compass border anchors (“north”, “north-east”, etc), but we cannot anchor by passing an angles (e.g. "hello.30deg"):

error: assertion failed: Element 'hello' does not support border anchors.

This would be a very helpful feature for more complex Cetz figures.

@tapyu tapyu changed the title [feature request] Support border anchors for content() elements [feature request] Support angle border anchors for content() elements May 23, 2024
@johannes-wolf
Copy link
Member

Yes, this should be implemented. Since anchors of content do not get transformed by the current transformation, this is a bit more complicated, though.

@johannes-wolf
Copy link
Member

johannes-wolf commented May 23, 2024

What makes things really complicated is that content stays untransformed.
Maybe we should propagate adding something like transform(<matrix>) into Typst, allowing to set any transformation matrix for native Typst elements. This would then allow transforming content correctly with cetz current transformation. @fenjalien?

@fenjalien fenjalien added this to the 0.4.0 milestone Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants