Skip to content

Tree node names in draw-edge have a "g" in front (group name) #979

@steef435

Description

@steef435

Hi,

It seems that names passed as first and second argument to draw-edge have a "g" in front. For example, in the following, I would expect there to be a solid line from a to b and a dashed line from a to c:

#import "@preview/cetz:0.4.2"
#cetz.canvas({
  import cetz.tree
  import cetz.draw: *
  tree.tree(
    draw-edge: (start, end, ..) => {
      if end == "0-0" {
        line(start, end)
      } else {
        line(start, end, stroke: (dash: "loosely-dotted"))
      }
    },
    ([a], [b], [c])
  )
})

The one with the g seems to be the group-name, though it is not clear to me from the documentation what that means.

This does work:

    draw-edge: (_, _, parent, child) => {
      if child.name == "0-0" {
        line(parent.group-name, child.group-name)
      } else {
        line(parent.group-name, child.group-name, stroke: (dash: "loosely-dotted"))
      }

Is this the intended behavior/usage?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions