cetz icon indicating copy to clipboard operation
cetz copied to clipboard

Wrong marks in merged paths

Open Wallbreaker5th opened this issue 1 year ago • 5 comments

#import "@preview/cetz:0.2.0"

#cetz.canvas({
  import cetz.draw: *
  merge-path({
    line((0,1), (1,1), mark: (symbol: ">"))
  })
  line((0,0), (1,0), mark: (symbol: ">"))
})

b

Wallbreaker5th avatar Feb 23 '24 02:02 Wallbreaker5th

This is a known problem, for now you must not use marks inside merge-path.

johannes-wolf avatar Feb 23 '24 14:02 johannes-wolf

Is there another way to draw a polyline with an arrowhead?

jason-s avatar Jun 04 '24 19:06 jason-s

It is possible with the current version by implementing the mark placement in a custom element. I will post an example later. But you can take a look into cetz source code how it is done: src/draw/shapes.typ has calls to drawables = mark_.place-marks-along-path(ctx, style.mark, transform, drawables). You need to do add that to your custom merge-path like element.

johannes-wolf avatar Jun 05 '24 00:06 johannes-wolf

If you mean multiple connected straight lines by polyline: this is possible. You can pass > 2 coordinates to line.

johannes-wolf avatar Jun 05 '24 00:06 johannes-wolf

This would be fixed by #463

fenjalien avatar Aug 07 '24 19:08 fenjalien