Skip to content

Commit

Permalink
mark: Fix symbol regression #830
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Mar 9, 2025
1 parent 89d2bf3 commit a197179
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
11 changes: 9 additions & 2 deletions src/mark.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Binary file modified tests/arrows/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 20 additions & 10 deletions tests/arrows/test.typ
Original file line number Diff line number Diff line change
@@ -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) = {
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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",))
})

0 comments on commit a197179

Please sign in to comment.