Skip to content

Commit db4a5f3

Browse files
committed
simplify arrow flipping
1 parent 392e9a7 commit db4a5f3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

R/geom-curve.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,8 @@ GeomCurve <- ggproto("GeomCurve", GeomSegment,
6666
if (flip) {
6767
trans <- rename(trans, c(x = "xend", xend = "x", y = "yend", yend = "y"))
6868
if (!is.null(arrow)) {
69-
# Flip end where arrow appears
70-
last_end <- arrow$ends == 2L
71-
first_end <- arrow$ends == 1L
72-
arrow$ends[last_end] <- 1L
73-
arrow$ends[first_end] <- 2L
69+
# Flip end where arrow appears (2 = last, 1 = first, 3 = both)
70+
arrow$ends <- match(arrow$ends, c(2, 1, 3))
7471
}
7572
}
7673

0 commit comments

Comments
 (0)