diff --git a/src/canvas.typ b/src/canvas.typ index eb7c64be2..d11d73f49 100644 --- a/src/canvas.typ +++ b/src/canvas.typ @@ -129,7 +129,7 @@ for i in range(1, pts.len()) { vertices.push(curve.line(pts.at(i))) } - last-point = pts.at(1) + last-point = pts.last() } } diff --git a/src/mark.typ b/src/mark.typ index 0c3f5c0e1..463c33ef9 100644 --- a/src/mark.typ +++ b/src/mark.typ @@ -385,10 +385,17 @@ if style == none { style = (start: none, end: none, symbol: none) } + let both-symbol = style.at("symbol", default: none) let start-symbol = style.at("start", - default: style.at("symbol", default: none)) + default: both-symbol) + if start-symbol == none { + start-symbol = both-symbol + } let end-symbol = style.at("end", - default: style.at("symbol", default: none)) + default: both-symbol) + if end-symbol == none { + end-symbol = both-symbol + } let (path, is-transformed) = if not style.at("transform-shape", default: true) and transform != none { (drawable.apply-transform(transform, path).first(), true) diff --git a/tests/anchor-centroid/ref/1.png b/tests/anchor-centroid/ref/1.png index e706a8372..e3f1f486e 100644 Binary files a/tests/anchor-centroid/ref/1.png and b/tests/anchor-centroid/ref/1.png differ diff --git a/tests/angle/ref/1.png b/tests/angle/ref/1.png index 3b2025f1f..0cf3591ba 100644 Binary files a/tests/angle/ref/1.png and b/tests/angle/ref/1.png differ diff --git a/tests/arrows/ref/1.png b/tests/arrows/ref/1.png index cbd9fd887..5bcf99854 100644 Binary files a/tests/arrows/ref/1.png and b/tests/arrows/ref/1.png differ diff --git a/tests/arrows/test.typ b/tests/arrows/test.typ index c3b351e7c..60be60ea7 100644 --- a/tests/arrows/test.typ +++ b/tests/arrows/test.typ @@ -1,7 +1,8 @@ #set page(width: auto, height: auto) #import "/src/lib.typ": * +#import "/tests/helper.typ": * -#box(stroke: 2pt + red, canvas({ +#test-case({ import draw: * let next(mark) = { @@ -31,9 +32,9 @@ for m in marks { next((start: m)) } -})) +} ) -#box(stroke: 2pt + red, canvas({ +#test-case({ import draw: * line((0,0), (9,0), stroke: blue + 1pt) @@ -48,9 +49,9 @@ line((x * .5, -1), (x * .5, 0), mark: (start: ">", end: ">", width: (x / 50 + .05))) } -})) +}) -#box(stroke: 2pt + red, canvas({ +#test-case({ import draw: * line((0,0), (9,0), stroke: blue + 1pt) @@ -65,9 +66,9 @@ line((x * .5, -1), (x * .5, 0), mark: (start: "<", end: "<", width: (x / 50 + .05))) } -})) +}) -#box(stroke: 2pt + red, canvas({ +#test-case({ import draw: * line((0,0), (9,0), stroke: blue + 1pt) @@ -82,9 +83,9 @@ line((x * .5, -1), (x * .5, 0), mark: (start: "<", end: ">", width: (x / 50 + .05))) } -})) +}) -#box(stroke: 2pt + red, canvas({ +#test-case({ import draw: * line((0,0), (9,0), stroke: blue + 1pt) @@ -99,4 +100,13 @@ line((x * .5, -1), (x * .5, 0), mark: (start: "<", end: ">", width: (x / 50 + .05))) } -})) +}) + +// Issue #830 +#test-case({ + import draw: * + line((0, 0), (1, 0), mark: (start: "stealth")) + line((0, -1), (1, -1), mark: (end: "stealth")) + line((0, -2), (1, -2), mark: (start: "stealth", end: "stealth")) + line((0, -3), (1, -3), mark: (symbol: "stealth",)) +}) diff --git a/tests/circle-through/ref/1.png b/tests/circle-through/ref/1.png index ff24ae491..d3d3fb696 100644 Binary files a/tests/circle-through/ref/1.png and b/tests/circle-through/ref/1.png differ diff --git a/tests/content-intersection/ref/1.png b/tests/content-intersection/ref/1.png index 2f7ef9375..6e14f2d4f 100644 Binary files a/tests/content-intersection/ref/1.png and b/tests/content-intersection/ref/1.png differ diff --git a/tests/content-padding/ref/1.png b/tests/content-padding/ref/1.png index 6fee5dd29..3c38906a4 100644 Binary files a/tests/content-padding/ref/1.png and b/tests/content-padding/ref/1.png differ diff --git a/tests/content-rtl/ref/1.png b/tests/content-rtl/ref/1.png index 0c4b6cf50..3d42c1cd1 100644 Binary files a/tests/content-rtl/ref/1.png and b/tests/content-rtl/ref/1.png differ diff --git a/tests/content-span/ref/1.png b/tests/content-span/ref/1.png index a9f433068..1647ff863 100644 Binary files a/tests/content-span/ref/1.png and b/tests/content-span/ref/1.png differ diff --git a/tests/content/ref/1.png b/tests/content/ref/1.png index 99c39ea4a..e90d46fa3 100644 Binary files a/tests/content/ref/1.png and b/tests/content/ref/1.png differ diff --git a/tests/cube/ref/1.png b/tests/cube/ref/1.png index 30833937b..0d2a5b70e 100644 Binary files a/tests/cube/ref/1.png and b/tests/cube/ref/1.png differ diff --git a/tests/gradient/ref/1.png b/tests/gradient/ref/1.png index 601cf9550..98c3072f3 100644 Binary files a/tests/gradient/ref/1.png and b/tests/gradient/ref/1.png differ diff --git a/tests/intersection/ref/1.png b/tests/intersection/ref/1.png index 6e7bb5690..18157bd04 100644 Binary files a/tests/intersection/ref/1.png and b/tests/intersection/ref/1.png differ diff --git a/tests/line-element-element-intersection/ref/1.png b/tests/line-element-element-intersection/ref/1.png index 4a53da31a..8c2467fff 100644 Binary files a/tests/line-element-element-intersection/ref/1.png and b/tests/line-element-element-intersection/ref/1.png differ diff --git a/tests/line-fill-rule/ref/1.png b/tests/line-fill-rule/ref/1.png index f18673411..2938e3670 100644 Binary files a/tests/line-fill-rule/ref/1.png and b/tests/line-fill-rule/ref/1.png differ diff --git a/tests/mark-anchors/ref/1.png b/tests/mark-anchors/ref/1.png index d8ec217f3..cf778ac11 100644 Binary files a/tests/mark-anchors/ref/1.png and b/tests/mark-anchors/ref/1.png differ diff --git a/tests/mark-auto-offset/ref/1.png b/tests/mark-auto-offset/ref/1.png index 2c3d291ea..c8cc99cf1 100644 Binary files a/tests/mark-auto-offset/ref/1.png and b/tests/mark-auto-offset/ref/1.png differ diff --git a/tests/mark-position/ref/1.png b/tests/mark-position/ref/1.png index f47a48ccb..adfcbe50e 100644 Binary files a/tests/mark-position/ref/1.png and b/tests/mark-position/ref/1.png differ diff --git a/tests/mark-shape-transform/ref/1.png b/tests/mark-shape-transform/ref/1.png index badf5facf..bb91a780f 100644 Binary files a/tests/mark-shape-transform/ref/1.png and b/tests/mark-shape-transform/ref/1.png differ diff --git a/tests/mark-single/ref/1.png b/tests/mark-single/ref/1.png index 21acaaba2..c484d43cb 100644 Binary files a/tests/mark-single/ref/1.png and b/tests/mark-single/ref/1.png differ diff --git a/tests/mark-style/ref/1.png b/tests/mark-style/ref/1.png index aa1f01090..6fd516ad1 100644 Binary files a/tests/mark-style/ref/1.png and b/tests/mark-style/ref/1.png differ diff --git a/tests/mark-z-axis/ref/1.png b/tests/mark-z-axis/ref/1.png index bcc9ada1d..5b25e3d7a 100644 Binary files a/tests/mark-z-axis/ref/1.png and b/tests/mark-z-axis/ref/1.png differ diff --git a/tests/merge/ref/1.png b/tests/merge/ref/1.png index c1304ce0b..0b4b10624 100644 Binary files a/tests/merge/ref/1.png and b/tests/merge/ref/1.png differ diff --git a/tests/multiple-marks/ref/1.png b/tests/multiple-marks/ref/1.png index a30c5e5b2..2bf2a8da9 100644 Binary files a/tests/multiple-marks/ref/1.png and b/tests/multiple-marks/ref/1.png differ diff --git a/tests/polygon/ref/1.png b/tests/polygon/ref/1.png index 82b98eea1..2a3948edb 100644 Binary files a/tests/polygon/ref/1.png and b/tests/polygon/ref/1.png differ diff --git a/tests/projection-default/ref/1.png b/tests/projection-default/ref/1.png index 651c161b9..0707d53ad 100644 Binary files a/tests/projection-default/ref/1.png and b/tests/projection-default/ref/1.png differ diff --git a/tests/projection-ortho/ref/1.png b/tests/projection-ortho/ref/1.png index 0a34aff1d..56e178c04 100644 Binary files a/tests/projection-ortho/ref/1.png and b/tests/projection-ortho/ref/1.png differ diff --git a/tests/rect-rounded/ref/1.png b/tests/rect-rounded/ref/1.png index 112692d59..ea98c49b4 100644 Binary files a/tests/rect-rounded/ref/1.png and b/tests/rect-rounded/ref/1.png differ diff --git a/tests/rotate-around/ref/1.png b/tests/rotate-around/ref/1.png index 4ff271373..e7c2bc827 100644 Binary files a/tests/rotate-around/ref/1.png and b/tests/rotate-around/ref/1.png differ diff --git a/tests/set-get-ctx/ref/1.png b/tests/set-get-ctx/ref/1.png index fac838204..0351e644e 100644 Binary files a/tests/set-get-ctx/ref/1.png and b/tests/set-get-ctx/ref/1.png differ diff --git a/tests/style/ref/1.png b/tests/style/ref/1.png index 5042e3b1f..40873bc75 100644 Binary files a/tests/style/ref/1.png and b/tests/style/ref/1.png differ diff --git a/tests/tree/ref/1.png b/tests/tree/ref/1.png index d935f37f0..efcf7dadf 100644 Binary files a/tests/tree/ref/1.png and b/tests/tree/ref/1.png differ