From 6500e5a4a3bd9ee9f902ee0328550edb86efabb9 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Fri, 21 Jun 2024 02:25:30 +0200 Subject: [PATCH] added arrow tips (WIP) --- src/sequence.typ | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/sequence.typ b/src/sequence.typ index b5809fb..23dd557 100644 --- a/src/sequence.typ +++ b/src/sequence.typ @@ -2,12 +2,30 @@ #import "consts.typ": * #import "participant.typ" +#let get-arrow-marks(sym, color) = { + if type(sym) == array { + return sym.map(s => get-arrow-marks(s, color)) + } + ( + "": none, + ">": (symbol: ">", fill: color), + ">>": (symbol: "straight"), + "\\": (symbol: ">", fill: color, harpoon: true, flip: true), + "\\\\": (symbol: "straight", harpoon: true, flip: true), + "/": (symbol: ">", fill: color, harpoon: true), + "//": (symbol: "straight", harpoon: true), + "x": none, + "o": (symbol: "o"), + ).at(sym) +} + #let _seq( p1, p2, comment: none, dashed: false, - tip: "default", + start-tip: "", + end-tip: ">", color: black, flip: false, enable-dst: false, @@ -24,7 +42,8 @@ p2: p2, comment: comment, dashed: dashed, - tip: tip, + start-tip: start-tip, + end-tip: end-tip, color: color, flip: flip, enable-dst: enable-dst, @@ -119,7 +138,10 @@ } let style = ( - mark: (end: ">", fill: elmt.color), + mark: ( + start: get-arrow-marks(elmt.start-tip, elmt.color), + end: get-arrow-marks(elmt.end-tip, elmt.color) + ), stroke: ( dash: if elmt.dashed {"dashed"} else {"solid"}, paint: elmt.color