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

Allow Outputting Anchors for Tree Nodes #700

Open
johannes-wolf opened this issue Sep 25, 2024 Discussed in #698 · 1 comment
Open

Allow Outputting Anchors for Tree Nodes #700

johannes-wolf opened this issue Sep 25, 2024 Discussed in #698 · 1 comment
Assignees
Labels
feature 🎁 Feature Request

Comments

@johannes-wolf
Copy link
Member

Discussed in #698

Originally posted by noahjutz September 23, 2024
Is it possible to refer to a tree's node's position from outside of a tree?

When I try

cetz.tree.tree(
  // ...
  draw-node: (node, p) => {
    if node.content.text == "1" {circle((), radius: 0, name: "anchor_1")}
    else if node.content.text == "2" {circle((), radius: 0, name: "anchor_2")}
  }
)

line("anchor_1", "anchor_2")

I get Assertion failed: Unknown element 'anchor_1' in elements ().

Motivation: I want to draw arrows between sibling nodes in a tree.

@johannes-wolf johannes-wolf added the feature 🎁 Feature Request label Sep 25, 2024
@johannes-wolf johannes-wolf self-assigned this Sep 25, 2024
@johannes-wolf johannes-wolf changed the title Named anchors in tree draw-node Allow Outputting Anchors for Tree Nodes Sep 25, 2024
@johannes-wolf
Copy link
Member Author

Forward anchors from the draw-node function to the tree group.

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

No branches or pull requests

1 participant