Skip to content

How to connect line to non-rectangle/non-circle shape (each shape lives inside a square in debug mode)? #156

Answered by johannes-wolf
Andrew15-5 asked this question in Q&A
Discussion options

You must be logged in to vote

I would do it by placing the path in a named group and overwriting the left/right anchor:

#let manual-operation(name, start: none, direction: "down", text) = {
  import cetz.draw: *
  validate-start-coordinate(start)
  validate-direction-vector(direction, valid-directions: ("down", "right"))
  if direction == "down" {
    start = (rel: (0, -height / 2), to: start)
  } else if direction == "right" {
    start = (rel: (width / 2, 0), to: start)
  }
  group(name: name, {
    let (tl, tr, bl, br) = ((rel: (-width / 2, +height / 2), to: start),
                            (rel: (+width / 2, +height / 2), to: start),
                            (rel: (-width / 4, -height / 2), to: start),
     …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Andrew15-5
Comment options

Answer selected by Andrew15-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants